This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] S/390: CONST_OK_FOR_* macros
- From: Andreas Krebbel <krebbel1 at de dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 12 Aug 2005 12:26:35 +0200
- Subject: [PATCH] S/390: CONST_OK_FOR_* macros
Hi,
this is a small cleanup patch shrinking uses of the
CONSTRAINT_OK_FOR_CONSTRAINT_P macro by using new shorter versions.
Bootstrapped and testsuite run without regressions on s390 and s390x.
OK for mainline?
Bye,
-Andreas-
2005-08-11 Andreas Krebbel <krebbel1@de.ibm.com>
* config/s390/s390.c (CONST_OK_FOR_J, CONST_OK_FOR_K): New macros.
(s390_select_ccmode, s390_rtx_costs, legitimate_reload_constant_p,
s390_init_frame_layout, s390_emit_prologue, s390_emit_epilogue,
s390_output_mi_thunk): Replaced uses of CONST_OK_FOR_CONSTRAINT_P
with one of the new macros.
Index: gcc/config/s390/s390.c
===================================================================
--- gcc/config/s390/s390.c.orig 2005-08-11 12:38:21.000000000 +0200
+++ gcc/config/s390/s390.c 2005-08-11 12:38:21.000000000 +0200
@@ -267,6 +267,12 @@ struct machine_function GTY(())
#define GP_ARG_NUM_REG 5
#define FP_ARG_NUM_REG (TARGET_64BIT? 4 : 2)
+/* A couple of shortcuts. */
+#define CONST_OK_FOR_J(x) \
+ CONST_OK_FOR_CONSTRAINT_P((x), 'J', "J")
+#define CONST_OK_FOR_K(x) \
+ CONST_OK_FOR_CONSTRAINT_P((x), 'K', "K")
+
/* Set the has_landing_pad_p flag in struct machine_function to VALUE. */
void
@@ -446,7 +452,7 @@ s390_select_ccmode (enum rtx_code code,
&& GET_MODE_CLASS (GET_MODE (op0)) == MODE_INT)
return CCAPmode;
if (GET_CODE (op0) == PLUS && GET_CODE (XEXP (op0, 1)) == CONST_INT
- && CONST_OK_FOR_CONSTRAINT_P (INTVAL (XEXP (op0, 1)), 'K', "K"))
+ && CONST_OK_FOR_K (INTVAL (XEXP (op0, 1))))
return CCAPmode;
if ((GET_CODE (op0) == PLUS || GET_CODE (op0) == MINUS
|| GET_CODE (op1) == NEG)
@@ -495,7 +501,7 @@ s390_select_ccmode (enum rtx_code code,
int a, b; if ((b = a + c) > 0)
with c as a constant value: c < 0 -> CCAN and c >= 0 -> CCAP */
if (GET_CODE (op0) == PLUS && GET_CODE (XEXP (op0, 1)) == CONST_INT
- && CONST_OK_FOR_CONSTRAINT_P (INTVAL (XEXP (op0, 1)), 'K', "K"))
+ && CONST_OK_FOR_K (INTVAL (XEXP (op0, 1))))
{
if (INTVAL (XEXP((op0), 1)) < 0)
return CCANmode;
@@ -1931,7 +1937,7 @@ s390_rtx_costs (rtx x, int code, int out
rtx left = XEXP (x, 0);
rtx right = XEXP (x, 1);
if (GET_CODE (right) == CONST_INT
- && CONST_OK_FOR_CONSTRAINT_P (INTVAL (right), 'K', "K"))
+ && CONST_OK_FOR_K (INTVAL (right)))
*total = s390_cost->mhi;
else if (GET_CODE (left) == SIGN_EXTEND)
*total = s390_cost->mh;
@@ -1946,7 +1952,7 @@ s390_rtx_costs (rtx x, int code, int out
if (TARGET_64BIT)
{
if (GET_CODE (right) == CONST_INT
- && CONST_OK_FOR_CONSTRAINT_P (INTVAL (right), 'K', "K"))
+ && CONST_OK_FOR_K (INTVAL (right)))
*total = s390_cost->mghi;
else if (GET_CODE (left) == SIGN_EXTEND)
*total = s390_cost->msgf;
@@ -2293,7 +2299,7 @@ legitimate_reload_constant_p (rtx op)
/* Accept l(g)hi operands. */
if (GET_CODE (op) == CONST_INT
- && CONST_OK_FOR_CONSTRAINT_P (INTVAL (op), 'K', "K"))
+ && CONST_OK_FOR_K (INTVAL (op)))
return true;
/* Accept lliXX operands. */
@@ -6053,7 +6059,7 @@ s390_init_frame_layout (void)
base_used = cfun->machine->split_branches_pending_p
|| current_function_uses_const_pool
|| (!DISP_IN_RANGE (-frame_size)
- && !CONST_OK_FOR_CONSTRAINT_P (-frame_size, 'K', "K"));
+ && !CONST_OK_FOR_K (-frame_size));
/* Decide which register to use as literal pool base. In small
leaf functions, try to use an unused call-clobbered register
@@ -6481,7 +6487,7 @@ s390_emit_prologue (void)
}
else
{
- if (!CONST_OK_FOR_CONSTRAINT_P (INTVAL (frame_off), 'K', "K"))
+ if (!CONST_OK_FOR_K (INTVAL (frame_off)))
frame_off = force_const_mem (Pmode, frame_off);
insn = emit_insn (gen_add2_insn (stack_pointer_rtx, frame_off));
@@ -6648,7 +6654,7 @@ s390_emit_epilogue (bool sibcall)
}
else
{
- if (!CONST_OK_FOR_CONSTRAINT_P (INTVAL (frame_off), 'K', "K"))
+ if (!CONST_OK_FOR_K (INTVAL (frame_off)))
frame_off = force_const_mem (Pmode, frame_off);
insn = emit_insn (gen_add2_insn (frame_pointer, frame_off));
@@ -7682,9 +7688,9 @@ s390_output_mi_thunk (FILE *file, tree t
{
/* Setup literal pool pointer if required. */
if ((!DISP_IN_RANGE (delta)
- && !CONST_OK_FOR_CONSTRAINT_P (delta, 'K', "K"))
+ && !CONST_OK_FOR_K (delta))
|| (!DISP_IN_RANGE (vcall_offset)
- && !CONST_OK_FOR_CONSTRAINT_P (vcall_offset, 'K', "K")))
+ && !CONST_OK_FOR_K (vcall_offset)))
{
op[5] = gen_label_rtx ();
output_asm_insn ("larl\t%4,%5", op);
@@ -7693,11 +7699,11 @@ s390_output_mi_thunk (FILE *file, tree t
/* Add DELTA to this pointer. */
if (delta)
{
- if (CONST_OK_FOR_CONSTRAINT_P (delta, 'J', "J"))
+ if (CONST_OK_FOR_J (delta))
output_asm_insn ("la\t%1,%2(%1)", op);
else if (DISP_IN_RANGE (delta))
output_asm_insn ("lay\t%1,%2(%1)", op);
- else if (CONST_OK_FOR_CONSTRAINT_P (delta, 'K', "K"))
+ else if (CONST_OK_FOR_K (delta))
output_asm_insn ("aghi\t%1,%2", op);
else
{
@@ -7714,7 +7720,7 @@ s390_output_mi_thunk (FILE *file, tree t
output_asm_insn ("lg\t%4,0(%1)", op);
output_asm_insn ("ag\t%1,%3(%4)", op);
}
- else if (CONST_OK_FOR_CONSTRAINT_P (vcall_offset, 'K', "K"))
+ else if (CONST_OK_FOR_K (vcall_offset))
{
output_asm_insn ("lghi\t%4,%3", op);
output_asm_insn ("ag\t%4,0(%1)", op);
@@ -7757,9 +7763,9 @@ s390_output_mi_thunk (FILE *file, tree t
/* Setup base pointer if required. */
if (!vcall_offset
|| (!DISP_IN_RANGE (delta)
- && !CONST_OK_FOR_CONSTRAINT_P (delta, 'K', "K"))
+ && !CONST_OK_FOR_K (delta))
|| (!DISP_IN_RANGE (delta)
- && !CONST_OK_FOR_CONSTRAINT_P (vcall_offset, 'K', "K")))
+ && !CONST_OK_FOR_K (vcall_offset)))
{
op[5] = gen_label_rtx ();
output_asm_insn ("basr\t%4,0", op);
@@ -7770,11 +7776,11 @@ s390_output_mi_thunk (FILE *file, tree t
/* Add DELTA to this pointer. */
if (delta)
{
- if (CONST_OK_FOR_CONSTRAINT_P (delta, 'J', "J"))
+ if (CONST_OK_FOR_J (delta))
output_asm_insn ("la\t%1,%2(%1)", op);
else if (DISP_IN_RANGE (delta))
output_asm_insn ("lay\t%1,%2(%1)", op);
- else if (CONST_OK_FOR_CONSTRAINT_P (delta, 'K', "K"))
+ else if (CONST_OK_FOR_K (delta))
output_asm_insn ("ahi\t%1,%2", op);
else
{
@@ -7786,7 +7792,7 @@ s390_output_mi_thunk (FILE *file, tree t
/* Perform vcall adjustment. */
if (vcall_offset)
{
- if (CONST_OK_FOR_CONSTRAINT_P (vcall_offset, 'J', "J"))
+ if (CONST_OK_FOR_J (vcall_offset))
{
output_asm_insn ("l\t%4,0(%1)", op);
output_asm_insn ("a\t%1,%3(%4)", op);
@@ -7796,7 +7802,7 @@ s390_output_mi_thunk (FILE *file, tree t
output_asm_insn ("l\t%4,0(%1)", op);
output_asm_insn ("ay\t%1,%3(%4)", op);
}
- else if (CONST_OK_FOR_CONSTRAINT_P (vcall_offset, 'K', "K"))
+ else if (CONST_OK_FOR_K (vcall_offset))
{
output_asm_insn ("lhi\t%4,%3", op);
output_asm_insn ("a\t%4,0(%1)", op);