From 62332eba32708fbe911dcea662b17410bab8faa5 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Sun, 26 Aug 2012 19:20:31 +0000 Subject: [PATCH] mips.c (r10k_safe_mem_expr_p): Use get_inner_reference. gcc/ * config/mips/mips.c (r10k_safe_mem_expr_p): Use get_inner_reference. From-SVN: r190700 --- gcc/ChangeLog | 4 ++++ gcc/config/mips/mips.c | 19 ++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ae2bb1b12ec..7277a9af370 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2012-08-26 Richard Sandiford + + * config/mips/mips.c (r10k_safe_mem_expr_p): Use get_inner_reference. + 2012-08-26 Richard Sandiford * config/mips/mips.c (mips_rtx_costs): Add costs for CINS. diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 1f0c9ae1df0..3a19f44a48f 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -14398,17 +14398,18 @@ r10k_safe_address_p (rtx x, rtx insn) static bool r10k_safe_mem_expr_p (tree expr, HOST_WIDE_INT offset) { - if (offset < 0 || offset >= int_size_in_bytes (TREE_TYPE (expr))) + HOST_WIDE_INT bitoffset, bitsize; + tree inner, var_offset; + enum machine_mode mode; + int unsigned_p, volatile_p; + + inner = get_inner_reference (expr, &bitsize, &bitoffset, &var_offset, &mode, + &unsigned_p, &volatile_p, false); + if (!DECL_P (inner) || !DECL_SIZE_UNIT (inner) || var_offset) return false; - while (TREE_CODE (expr) == COMPONENT_REF) - { - expr = TREE_OPERAND (expr, 0); - if (expr == NULL_TREE) - return false; - } - - return DECL_P (expr); + offset += bitoffset / BITS_PER_UNIT; + return offset >= 0 && offset < tree_low_cst (DECL_SIZE_UNIT (inner), 1); } /* A for_each_rtx callback for which DATA points to the instruction