aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/pa
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/pa')
-rw-r--r--gcc/config/pa/pa.c40
-rw-r--r--gcc/config/pa/pa.h31
2 files changed, 40 insertions, 31 deletions
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index ab0fe6a..e3260c4 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -188,6 +188,7 @@ static void pa_conditional_register_usage (void);
static enum machine_mode pa_c_mode_for_suffix (char);
static section *pa_function_section (tree, enum node_frequency, bool, bool);
static bool pa_cannot_force_const_mem (enum machine_mode, rtx);
+static bool pa_legitimate_constant_p (enum machine_mode, rtx);
/* The following extra sections are only used for SOM. */
static GTY(()) section *som_readonly_data_section;
@@ -397,6 +398,9 @@ static const struct default_options pa_option_optimization_table[] =
#undef TARGET_ASM_FUNCTION_SECTION
#define TARGET_ASM_FUNCTION_SECTION pa_function_section
+#undef TARGET_LEGITIMATE_CONSTANT_P
+#define TARGET_LEGITIMATE_CONSTANT_P pa_legitimate_constant_p
+
struct gcc_target targetm = TARGET_INITIALIZER;
/* Parse the -mfixed-range= option string. */
@@ -10276,4 +10280,40 @@ pa_function_section (tree decl, enum node_frequency freq,
return default_function_section (decl, freq, startup, exit);
}
+/* Implement TARGET_LEGITIMATE_CONSTANT_P.
+
+ In 64-bit mode, we reject CONST_DOUBLES. We also reject CONST_INTS
+ that need more than three instructions to load prior to reload. This
+ limit is somewhat arbitrary. It takes three instructions to load a
+ CONST_INT from memory but two are memory accesses. It may be better
+ to increase the allowed range for CONST_INTS. We may also be able
+ to handle CONST_DOUBLES. */
+
+static bool
+pa_legitimate_constant_p (enum machine_mode mode, rtx x)
+{
+ if (GET_MODE_CLASS (mode) == MODE_FLOAT && x != CONST0_RTX (mode))
+ return false;
+
+ if (!NEW_HP_ASSEMBLER && !TARGET_GAS && GET_CODE (x) == LABEL_REF)
+ return false;
+
+ if (TARGET_64BIT && GET_CODE (x) == CONST_DOUBLE)
+ return false;
+
+ if (TARGET_64BIT
+ && HOST_BITS_PER_WIDE_INT > 32
+ && GET_CODE (x) == CONST_INT
+ && !reload_in_progress
+ && !reload_completed
+ && !LEGITIMATE_64BIT_CONST_INT_P (INTVAL (x))
+ && !cint_ok_for_move (INTVAL (x)))
+ return false;
+
+ if (function_label_operand (x, mode))
+ return false;
+
+ return true;
+}
+
#include "gt-pa.h"
diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h
index f3ad883..f401707 100644
--- a/gcc/config/pa/pa.h
+++ b/gcc/config/pa/pa.h
@@ -806,37 +806,6 @@ extern int may_call_alloca;
#define LEGITIMATE_64BIT_CONST_INT_P(X) \
((X) >= MIN_LEGIT_64BIT_CONST_INT && (X) < MAX_LEGIT_64BIT_CONST_INT)
-/* A C expression that is nonzero if X is a legitimate constant for an
- immediate operand.
-
- We include all constant integers and constant doubles, but not
- floating-point, except for floating-point zero. We reject LABEL_REFs
- if we're not using gas or the new HP assembler.
-
- In 64-bit mode, we reject CONST_DOUBLES. We also reject CONST_INTS
- that need more than three instructions to load prior to reload. This
- limit is somewhat arbitrary. It takes three instructions to load a
- CONST_INT from memory but two are memory accesses. It may be better
- to increase the allowed range for CONST_INTS. We may also be able
- to handle CONST_DOUBLES. */
-
-#define LEGITIMATE_CONSTANT_P(X) \
- ((GET_MODE_CLASS (GET_MODE (X)) != MODE_FLOAT \
- || (X) == CONST0_RTX (GET_MODE (X))) \
- && (NEW_HP_ASSEMBLER \
- || TARGET_GAS \
- || GET_CODE (X) != LABEL_REF) \
- && (!TARGET_64BIT \
- || GET_CODE (X) != CONST_DOUBLE) \
- && (!TARGET_64BIT \
- || HOST_BITS_PER_WIDE_INT <= 32 \
- || GET_CODE (X) != CONST_INT \
- || reload_in_progress \
- || reload_completed \
- || LEGITIMATE_64BIT_CONST_INT_P (INTVAL (X)) \
- || cint_ok_for_move (INTVAL (X))) \
- && !function_label_operand (X, VOIDmode))
-
/* Target flags set on a symbol_ref. */
/* Set by ASM_OUTPUT_SYMBOL_REF when a symbol_ref is output. */