+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>
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
&& 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))
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);
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. */
return XVECEXP (term, 0, 0);
}
- return ix86_delegitimize_address (x);
+ return ix86_delegitimize_address_1 (x, true);
}
\f
static void