diff options
Diffstat (limited to 'gcc-4.8/gcc/alias.c')
-rw-r--r-- | gcc-4.8/gcc/alias.c | 71 |
1 files changed, 53 insertions, 18 deletions
diff --git a/gcc-4.8/gcc/alias.c b/gcc-4.8/gcc/alias.c index 970bdb0ee..637839615 100644 --- a/gcc-4.8/gcc/alias.c +++ b/gcc-4.8/gcc/alias.c @@ -156,7 +156,9 @@ static int insert_subset_children (splay_tree_node, void*); static alias_set_entry get_alias_set_entry (alias_set_type); static bool nonoverlapping_component_refs_p (const_rtx, const_rtx); static tree decl_for_component_ref (tree); -static int write_dependence_p (const_rtx, const_rtx, int); +static int write_dependence_p (const_rtx, + const_rtx, enum machine_mode, rtx, + bool, bool, bool); static void memory_modified_1 (rtx, const_rtx, void *); @@ -2558,15 +2560,24 @@ canon_true_dependence (const_rtx mem, enum machine_mode mem_mode, rtx mem_addr, } /* Returns nonzero if a write to X might alias a previous read from - (or, if WRITEP is nonzero, a write to) MEM. */ + (or, if WRITEP is true, a write to) MEM. + If X_CANONCALIZED is true, then X_ADDR is the canonicalized address of X, + and X_MODE the mode for that access. + If MEM_CANONICALIZED is true, MEM is canonicalized. */ static int -write_dependence_p (const_rtx mem, const_rtx x, int writep) +write_dependence_p (const_rtx mem, + const_rtx x, enum machine_mode x_mode, rtx x_addr, + bool mem_canonicalized, bool x_canonicalized, bool writep) { - rtx x_addr, mem_addr; + rtx mem_addr; rtx base; int ret; + gcc_checking_assert (x_canonicalized + ? (x_addr != NULL_RTX && x_mode != VOIDmode) + : (x_addr == NULL_RTX && x_mode == VOIDmode)); + if (MEM_VOLATILE_P (x) && MEM_VOLATILE_P (mem)) return 1; @@ -2590,8 +2601,10 @@ write_dependence_p (const_rtx mem, const_rtx x, int writep) if (MEM_ADDR_SPACE (mem) != MEM_ADDR_SPACE (x)) return 1; - x_addr = XEXP (x, 0); mem_addr = XEXP (mem, 0); + if (!x_addr) + { + x_addr = XEXP (x, 0); if (!((GET_CODE (x_addr) == VALUE && GET_CODE (mem_addr) != VALUE && reg_mentioned_p (x_addr, mem_addr)) @@ -2600,8 +2613,10 @@ write_dependence_p (const_rtx mem, const_rtx x, int writep) && reg_mentioned_p (mem_addr, x_addr)))) { x_addr = get_addr (x_addr); + if (!mem_canonicalized) mem_addr = get_addr (mem_addr); } + } if (! writep) { @@ -2616,11 +2631,16 @@ write_dependence_p (const_rtx mem, const_rtx x, int writep) GET_MODE (mem))) return 0; + if (!x_canonicalized) + { x_addr = canon_rtx (x_addr); + x_mode = GET_MODE (x); + } + if (!mem_canonicalized) mem_addr = canon_rtx (mem_addr); if ((ret = memrefs_conflict_p (SIZE_FOR_MODE (mem), mem_addr, - SIZE_FOR_MODE (x), x_addr, 0)) != -1) + GET_MODE_SIZE (x_mode), x_addr, 0)) != -1) return ret; if (nonoverlapping_memrefs_p (x, mem, false)) @@ -2634,7 +2654,23 @@ write_dependence_p (const_rtx mem, const_rtx x, int writep) int anti_dependence (const_rtx mem, const_rtx x) { - return write_dependence_p (mem, x, /*writep=*/0); + return write_dependence_p (mem, x, VOIDmode, NULL_RTX, + /*mem_canonicalized=*/false, + /*x_canonicalized*/false, /*writep=*/false); +} + +/* Likewise, but we already have a canonicalized MEM, and X_ADDR for X. + Also, consider X in X_MODE (which might be from an enclosing + STRICT_LOW_PART / ZERO_EXTRACT). + If MEM_CANONICALIZED is true, MEM is canonicalized. */ + +int +canon_anti_dependence (const_rtx mem, bool mem_canonicalized, + const_rtx x, enum machine_mode x_mode, rtx x_addr) +{ + return write_dependence_p (mem, x, x_mode, x_addr, + mem_canonicalized, /*x_canonicalized=*/true, + /*writep=*/false); } /* Output dependence: X is written after store in MEM takes place. */ @@ -2642,7 +2678,9 @@ anti_dependence (const_rtx mem, const_rtx x) int output_dependence (const_rtx mem, const_rtx x) { - return write_dependence_p (mem, x, /*writep=*/1); + return write_dependence_p (mem, x, VOIDmode, NULL_RTX, + /*mem_canonicalized=*/false, + /*x_canonicalized*/false, /*writep=*/true); } @@ -2871,16 +2909,13 @@ init_alias_analysis (void) /* Wipe the reg_seen array clean. */ bitmap_clear (reg_seen); - /* Mark all hard registers which may contain an address. - The stack, frame and argument pointers may contain an address. - An argument register which can hold a Pmode value may contain - an address even if it is not in BASE_REGS. - - The address expression is VOIDmode for an argument and - Pmode for other registers. */ - - memcpy (new_reg_base_value, static_reg_base_value, - FIRST_PSEUDO_REGISTER * sizeof (rtx)); + /* Initialize the alias information for this pass. */ + for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) + if (static_reg_base_value[i]) + { + new_reg_base_value[i] = static_reg_base_value[i]; + bitmap_set_bit (reg_seen, i); + } /* Walk the insns adding values to the new_reg_base_value array. */ for (i = 0; i < rpo_cnt; i++) |