@@ -151,9 +151,7 @@
if (GET_CODE (op) == LABEL_REF)
return true;
if (SYMBOL_REF_P (op))
- return (!SYMBOL_FLAG_NOTALIGN2_P (op)
- && SYMBOL_REF_TLS_MODEL (op) == 0
- && s390_rel_address_ok_p (op));
+ return s390_symbol_larl_p (op);
/* Everything else must have a CONST, so strip it. */
if (GET_CODE (op) != CONST)
@@ -176,10 +174,7 @@
if (GET_CODE (op) == LABEL_REF)
return true;
if (SYMBOL_REF_P (op))
- return (!SYMBOL_FLAG_NOTALIGN2_P (op)
- && SYMBOL_REF_TLS_MODEL (op) == 0
- && s390_rel_address_ok_p (op));
-
+ return s390_symbol_larl_p (op);
/* Now we must have a @GOTENT offset or @PLT stub
or an @INDNTPOFF TLS offset. */
@@ -157,6 +157,7 @@ extern void s390_indirect_branch_via_thunk (unsigned int regno,
rtx comparison_operator,
enum s390_indirect_branch_type type);
extern void s390_indirect_branch_via_inline_thunk (rtx execute_target);
+extern bool s390_symbol_larl_p (rtx);
#endif /* RTX_CODE */
/* s390-c.c routines */
@@ -2816,6 +2816,16 @@ s390_decompose_constant_pool_ref (rtx *ref, rtx *disp, bool *is_ptr,
return true;
}
+/* Return true iff SYMBOL_REF X can be used with a LARL instruction. */
+
+bool
+s390_symbol_larl_p (rtx x)
+{
+ return (!SYMBOL_FLAG_NOTALIGN2_P (x)
+ && SYMBOL_REF_TLS_MODEL (x) == 0
+ && s390_rel_address_ok_p (x));
+}
+
/* Decompose a RTL expression ADDR for a memory address into
its components, returned in OUT.
@@ -8120,6 +8130,10 @@ annotate_constant_pool_refs (rtx *x)
int i, j;
const char *fmt;
+ /* Skip LARL operands, because they don't require a base register. */
+ if (larl_operand (*x, VOIDmode))
+ return;
+
gcc_assert (GET_CODE (*x) != SYMBOL_REF
|| !CONSTANT_POOL_ADDRESS_P (*x));
@@ -8223,6 +8237,18 @@ find_constant_pool_ref (rtx x, rtx *ref)
&& XINT (x, 1) == UNSPECV_POOL_ENTRY)
return;
+ if (SYMBOL_REF_P (x)
+ && CONSTANT_POOL_ADDRESS_P (x)
+ && s390_symbol_larl_p (x))
+ {
+ if (*ref == NULL_RTX)
+ *ref = x;
+ else
+ gcc_assert (*ref == x);
+
+ return;
+ }
+
gcc_assert (GET_CODE (x) != SYMBOL_REF
|| !CONSTANT_POOL_ADDRESS_P (x));
@@ -8264,6 +8290,10 @@ replace_constant_pool_ref (rtx *x, rtx ref, rtx offset)
int i, j;
const char *fmt;
+ /* Skip LARL operands, because they don't require a base register. */
+ if (larl_operand (*x, VOIDmode))
+ return;
+
gcc_assert (*x != ref);
if (GET_CODE (*x) == UNSPEC