summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2017-03-22 18:33:37 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2017-03-22 18:33:37 +0000
commit9dff31564d1eb71876c14b824679abd43655582e (patch)
treef9bb79e947b0f5d45222e3ffc658c82a054d9204
parentd5de5991e159a63bc3b9ea60db7fbef689ee0a4f (diff)
downloadgcc-9dff31564d1eb71876c14b824679abd43655582e.tar.gz
PR rtl-optimization/63191
* config/i386/i386.c (ix86_delegitimize_address): Turn into small wrapper function, moved the whole old content into ... (ix86_delegitimize_address_1): ... this. New inline function. (ix86_find_base_term): Use ix86_delegitimize_address_1 with true as last argument instead of ix86_delegitimize_address. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246398 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog13
-rw-r--r--gcc/config/i386/i386.c30
2 files changed, 36 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9d52b253966..00d2015f959 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,7 +1,16 @@
+2017-03-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/63191
+ * config/i386/i386.c (ix86_delegitimize_address): Turn into small
+ wrapper function, moved the whole old content into ...
+ (ix86_delegitimize_address_1): ... this. New inline function.
+ (ix86_find_base_term): Use ix86_delegitimize_address_1 with
+ true as last argument instead of ix86_delegitimize_address.
+
2017-03-22 Wilco Dijkstra <wdijkstr@arm.com>
- * config/aarch64/aarch64.c (generic_branch_cost):
- Copycortexa57_branch_cost.
+ * config/aarch64/aarch64.c (generic_branch_cost): Copy
+ cortexa57_branch_cost.
2017-03-22 Wilco Dijkstra <wdijkstr@arm.com>
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 259f97b5a10..0f7e0295121 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -17261,10 +17261,16 @@ ix86_delegitimize_tls_address (rtx orig_x)
has a different PIC label for each routine but the DWARF debugging
information is not associated with any particular routine, so it's
necessary to remove references to the PIC label from RTL stored by
- the DWARF output code. */
+ the DWARF output code.
-static rtx
-ix86_delegitimize_address (rtx x)
+ This helper is used in the normal ix86_delegitimize_address
+ entrypoint (e.g. used in the target delegitimization hook) and
+ in ix86_find_base_term. As compile time memory optimization, we
+ avoid allocating rtxes that will not change anything on the outcome
+ of the callers (find_base_value and find_base_term). */
+
+static inline rtx
+ix86_delegitimize_address_1 (rtx x, bool base_term_p)
{
rtx orig_x = delegitimize_mem_from_attrs (x);
/* addend is NULL or some rtx if x is something+GOTOFF where
@@ -17291,6 +17297,10 @@ ix86_delegitimize_address (rtx x)
&& GET_CODE (XEXP (XEXP (x, 0), 0)) == UNSPEC
&& XINT (XEXP (XEXP (x, 0), 0), 1) == UNSPEC_PCREL)
{
+ /* find_base_{value,term} only care about MEMs with arg_pointer_rtx
+ base. A CONST can't be arg_pointer_rtx based. */
+ if (base_term_p && MEM_P (orig_x))
+ return orig_x;
rtx x2 = XVECEXP (XEXP (XEXP (x, 0), 0), 0, 0);
x = gen_rtx_PLUS (Pmode, XEXP (XEXP (x, 0), 1), x2);
if (MEM_P (orig_x))
@@ -17367,7 +17377,9 @@ ix86_delegitimize_address (rtx x)
if (! result)
return ix86_delegitimize_tls_address (orig_x);
- if (const_addend)
+ /* For (PLUS something CONST_INT) both find_base_{value,term} just
+ recurse on the first operand. */
+ if (const_addend && !base_term_p)
result = gen_rtx_CONST (Pmode, gen_rtx_PLUS (Pmode, result, const_addend));
if (reg_addend)
result = gen_rtx_PLUS (Pmode, reg_addend, result);
@@ -17405,6 +17417,14 @@ ix86_delegitimize_address (rtx x)
return result;
}
+/* The normal instantiation of the above template. */
+
+static rtx
+ix86_delegitimize_address (rtx x)
+{
+ return ix86_delegitimize_address_1 (x, false);
+}
+
/* If X is a machine specific address (i.e. a symbol or label being
referenced as a displacement from the GOT implemented using an
UNSPEC), then return the base term. Otherwise return X. */
@@ -17430,7 +17450,7 @@ ix86_find_base_term (rtx x)
return XVECEXP (term, 0, 0);
}
- return ix86_delegitimize_address (x);
+ return ix86_delegitimize_address_1 (x, true);
}
static void