2 * Alias analysis. I will really need to document this soon (jyh).
4 * We combine loop analysis with alias analysis.
6 * ----------------------------------------------------------------
9 * Copyright (C) 2002 Jason Hickey, Caltech
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 * Author: Jason Hickey
26 * @email{jyh@cs.caltech.edu}
49 open Fir_alias_pre_cse
51 module Pos
= MakePos
(struct let name = "Fir_alias_pre_loop" end)
57 let loop_arg gvenv aenv lenv loc v op step base
=
58 let pos = string_pos
"ps_loop_arg" (var_exp_pos v
) in
59 let gvenv, _
, step
= cse_normalize_etree
gvenv aenv
pos zero_depth
(add_etree op
(ETVar v
) step
) in
60 let lenv = SymbolTable.add
lenv v
(make_etree loc step
, make_etree loc base
) in
64 * In the final step, add the base and step expressions as pseudo-arguments
67 let loop_prog gvenv aenv
=
69 SymbolTable.fold
(fun (gvenv, lenv) _
(ac
, _
) ->
70 let loc = loc_of_aclass ac
in
71 match dest_aclass_core ac
with
72 AliasInduction
(_
, v
, _
, op
, _
, _
, _
, step
, base
) ->
73 loop_arg gvenv aenv
lenv loc v op step base
76 gvenv, lenv) (gvenv, SymbolTable.empty
) gvenv.gvenv_values
78 if debug debug_alias
then
80 Format.printf
"@[<hv 3>*** FIR: alias: loop table:";
81 SymbolTable.iter
(fun v
(base
, step
) ->
82 Format.printf
"@ @[<hv 0>@[<hv 3> %a" pp_print_symbol v
;
83 Format.printf
" {@ @[<hv 3>base =@ %a" pp_print_etree base
;
84 Format.printf
"@];@ @[<hv 3>step =@ %a" pp_print_etree step
;
85 Format.printf
"@]@]@ }@]") lenv;
95 * Caml-master: "compile"