+2008-10-06 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * config/rs6000/rs6000-protos.h (rs6000_find_base_term): Declare.
+ * config/rs6000/rs6000.h (FIND_BASE_TERM): New macro.
+ * config/rs6000/rs6000.c (rs6000_find_base_term): New function.
+
2008-10-06 Richard Sandiford <rdsandiford@googlemail.com>
* config/darwin-protos.h (machopic_function_base_name): Delete.
extern int rs6000_legitimate_address (enum machine_mode, rtx, int);
extern bool rs6000_legitimate_offset_address_p (enum machine_mode, rtx, int);
extern bool rs6000_mode_dependent_address (rtx);
+extern rtx rs6000_find_base_term (rtx);
extern bool rs6000_offsettable_memref_p (rtx);
extern rtx rs6000_return_addr (int, rtx);
extern void rs6000_output_symbol_ref (FILE*, rtx);
return false;
}
+/* Implement FIND_BASE_TERM. */
+
+rtx
+rs6000_find_base_term (rtx op)
+{
+ rtx base, offset;
+
+ split_const (op, &base, &offset);
+ if (GET_CODE (base) == UNSPEC)
+ switch (XINT (base, 1))
+ {
+ case UNSPEC_TOCREL:
+ case UNSPEC_MACHOPIC_OFFSET:
+ /* OP represents SYM [+ OFFSET] - ANCHOR. SYM is the base term
+ for aliasing purposes. */
+ return XVECEXP (base, 0, 0);
+ }
+
+ return op;
+}
+
/* More elaborate version of recog's offsettable_memref_p predicate
that works around the ??? note of rs6000_mode_dependent_address.
In particular it accepts
if (rs6000_mode_dependent_address (ADDR)) \
goto LABEL; \
} while (0)
+
+#define FIND_BASE_TERM rs6000_find_base_term
\f
/* The register number of the register used to address a table of
static data addresses in memory. In some cases this register is