diff options
author | Bingfeng Mei <bmei@broadcom.com> | 2010-08-09 14:44:03 +0000 |
---|---|---|
committer | Bingfeng Mei <meibf@gcc.gnu.org> | 2010-08-09 14:44:03 +0000 |
commit | c6ea834c83126f1a249525715f677ccf9969c30b (patch) | |
tree | e1019cb9c50fe10a946e21114e247d48c6ccc78a /gcc/ddg.c | |
parent | 72ac05b04e2baf2ff9eebd42e6ff5f22fd3b1546 (diff) | |
download | gcc-c6ea834c83126f1a249525715f677ccf9969c30b.tar.gz |
ddg.c (walk_mems_2): Moved from alias.c, use may_alias_p instead of alias_sets_conflict_p.
2010-08-09 Bingfeng Mei <bmei@broadcom.com>
* ddg.c (walk_mems_2): Moved from alias.c, use may_alias_p instead of
alias_sets_conflict_p.
(walk_mems_1): Moved from alias.c.
(insns_may_alias_p): New function, originally insn_alias_sets_conflict_p
in alias.c.
(add_inter_loop_mem_dep): Use insns_may_alias_p now.
* cse.c (cse_insn): New argument in calling nonoverlapping_memrefs_p.
* alias.c (walk_mems_2): Moved to ddg.c.
(walk_mems_1): Ditto.
(insn_alias_sets_conflict_p): Renamed to insns_may_alias_p and moved
to ddg.c.
(nonoverlapping_memrefs_p): Add flag to guard offset-based memory
disambiguation.
*(may_alias_p): New function to check whether two memory expression
may alias or not. Currently used in buidling inter-iteration memory
dependence.
*alias.h (nonoverlapping_memrefs_p): New flag as third argument.
(insn_alias_sets_conflict_p): Removed
*rtl.h (may_alias_p): New function prototype.
From-SVN: r163037
Diffstat (limited to 'gcc/ddg.c')
-rw-r--r-- | gcc/ddg.c | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/gcc/ddg.c b/gcc/ddg.c index 0a20ed61291..88aaf9bb2e4 100644 --- a/gcc/ddg.c +++ b/gcc/ddg.c @@ -348,12 +348,49 @@ build_inter_loop_deps (ddg_ptr g) } +static int +walk_mems_2 (rtx *x, rtx mem) +{ + if (MEM_P (*x)) + { + if (may_alias_p (*x, mem)) + return 1; + + return -1; + } + return 0; +} + +static int +walk_mems_1 (rtx *x, rtx *pat) +{ + if (MEM_P (*x)) + { + /* Visit all MEMs in *PAT and check indepedence. */ + if (for_each_rtx (pat, (rtx_function) walk_mems_2, *x)) + /* Indicate that dependence was determined and stop traversal. */ + return 1; + + return -1; + } + return 0; +} + +/* Return 1 if two specified instructions have mem expr with conflict alias sets*/ +static int +insns_may_alias_p (rtx insn1, rtx insn2) +{ + /* For each pair of MEMs in INSN1 and INSN2 check their independence. */ + return for_each_rtx (&PATTERN (insn1), (rtx_function) walk_mems_1, + &PATTERN (insn2)); +} + /* Given two nodes, analyze their RTL insns and add inter-loop mem deps to ddg G. */ static void add_inter_loop_mem_dep (ddg_ptr g, ddg_node_ptr from, ddg_node_ptr to) { - if (!insn_alias_sets_conflict_p (from->insn, to->insn)) + if (!insns_may_alias_p (from->insn, to->insn)) /* Do not create edge if memory references have disjoint alias sets. */ return; |