*base = x;
}
+/* Classify symbolic expression X, given that it appears in context
+ CONTEXT. */
+
+static enum mips_symbol_type
+mips_classify_symbolic_expression (rtx x)
+{
+ HOST_WIDE_INT offset;
+
+ mips_split_const (x, &x, &offset);
+ if (UNSPEC_ADDRESS_P (x))
+ return UNSPEC_ADDRESS_TYPE (x);
+
+ return mips_classify_symbol (x);
+}
/* Return true if SYMBOL is a SYMBOL_REF and OFFSET + SYMBOL points
to the same object as SYMBOL. */
info->type = ADDRESS_LO_SUM;
info->reg = XEXP (x, 0);
info->offset = XEXP (x, 1);
+ /* We have to trust the creator of the LO_SUM to do something vaguely
+ sane. Target-independent code that creates a LO_SUM should also
+ create and verify the matching HIGH. Target-independent code that
+ adds an offset to a LO_SUM must prove that the offset will not
+ induce a carry. Failure to do either of these things would be
+ a bug, and we are not required to check for it here. The MIPS
+ backend itself should only create LO_SUMs for valid symbolic
+ constants, with the high part being either a HIGH or a copy
+ of _gp. */
+ info->symbol_type = mips_classify_symbolic_expression (info->offset);
return (mips_valid_base_register_p (info->reg, mode, strict)
- && mips_symbolic_constant_p (info->offset, &info->symbol_type)
&& mips_symbolic_address_p (info->symbol_type, mode)
&& mips_lo_relocs[info->symbol_type] != 0);
rtx base;
HOST_WIDE_INT offset;
- if (!mips_symbolic_constant_p (op, &symbol_type) || relocs[symbol_type] == 0)
+ symbol_type = mips_classify_symbolic_expression (op);
+ if (relocs[symbol_type] == 0)
fatal_insn ("PRINT_OPERAND, invalid operand for relocation", op);
/* If OP uses an UNSPEC address, we want to print the inner symbol. */
# $mips_forced_isa: true if the command line uses -march=* or -mips*
# $mips_forced_abi: true if the command line uses -mabi=* or -mgp*
# $mips_forced_float: true if the command line uses -mhard/soft-float
+# $mips_forced_le true if the command line uses -EL or -mel
proc setup_mips_tests {} {
global mips_isa
global mips_arch
global mips_forced_isa
global mips_forced_abi
global mips_forced_float
+ global mips_forced_le
global compiler_flags
global tool
set mips_forced_isa [regexp -- {(-mips|-march)} $compiler_flags]
set mips_forced_abi [regexp -- {(-mgp|-mabi)} $compiler_flags]
set mips_forced_float [regexp -- {-m(hard|soft)-float} $compiler_flags]
+ set mips_forced_le [regexp -- {-(EL|mel)[[:>:]]} $compiler_flags]
}
# Return true if command-line option FLAG forces 32-bit code.
# -mhard-float
# Select the given floating-point mode. Skip the test if the
# multilib flags force a different selection.
+#
+# -EB
+# Select big-endian code. Skip the test if the multilib flags
+# force a little-endian target.
proc dg-mips-options {args} {
upvar dg-extra-tool-flags extra_tool_flags
upvar dg-do-what do_what
global mips_forced_isa
global mips_forced_abi
global mips_forced_float
+ global mips_forced_le
set flags [lindex $args 1]
set matches 1
if {$mips_float != $float && $mips_forced_float} {
set matches 0
}
+ } elseif {[regexp -- {^-(EB|meb)$} $flag]} {
+ if {$mips_forced_le} {
+ set matches 0
+ }
}
}
if {$matches} {