From e9ff93b1e1540dfd1f609a92dfa66c27c673abfa Mon Sep 17 00:00:00 2001 From: krebbel Date: Tue, 27 May 2008 11:41:10 +0000 Subject: [PATCH] 2008-05-27 Andreas Krebbel * defaults.h (TARGET_MEM_CONSTRAINT): New target macro added. * postreload.c (reload_cse_simplify_operands): Replace 'm' constraint with TARGET_MEM_CONSTRAINT. * recog.c (asm_operand_ok, preprocess_constraints, constrain_operands): Likewise. * regclass.c (record_reg_classes): Likewise. * reload.c (find_reloads, alternative_allows_const_pool_ref): Likewise. * reload1.c (maybe_fix_stack_asms): Likewise. * stmt.c (parse_output_constraint, parse_input_constraint): Likewise. * recog.h: Adjust comment. * genpreds.c (generic_constraint_letters): Remove 'm' constraint. * genoutput.c (note_constraint): Don't emit error for 'm' constraint. * doc/md.texi: Add a note to description of 'm' constraint. * doc/tm.texi: Document the new TARGET_MEM_CONSTRAINT macro. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@136011 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 20 ++++++++++++++++++++ gcc/defaults.h | 4 ++++ gcc/doc/md.texi | 2 ++ gcc/doc/tm.texi | 11 +++++++++++ gcc/genoutput.c | 5 ++++- gcc/genpreds.c | 7 +++++-- gcc/postreload.c | 4 ++-- gcc/recog.c | 6 +++--- gcc/recog.h | 3 ++- gcc/regclass.c | 2 +- gcc/reload.c | 6 +++--- gcc/reload1.c | 10 +++++----- gcc/stmt.c | 4 ++-- 13 files changed, 64 insertions(+), 20 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d373b1bf314..a26bec4eed4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,23 @@ +2008-05-27 Andreas Krebbel + + * defaults.h (TARGET_MEM_CONSTRAINT): New target macro added. + * postreload.c (reload_cse_simplify_operands): Replace 'm' + constraint with TARGET_MEM_CONSTRAINT. + * recog.c (asm_operand_ok, preprocess_constraints, + constrain_operands): Likewise. + * regclass.c (record_reg_classes): Likewise. + * reload.c (find_reloads, alternative_allows_const_pool_ref): + Likewise. + * reload1.c (maybe_fix_stack_asms): Likewise. + * stmt.c (parse_output_constraint, parse_input_constraint): + Likewise. + * recog.h: Adjust comment. + * genpreds.c (generic_constraint_letters): Remove 'm' constraint. + * genoutput.c (note_constraint): Don't emit error for 'm' + constraint. + * doc/md.texi: Add a note to description of 'm' constraint. + * doc/tm.texi: Document the new TARGET_MEM_CONSTRAINT macro. + 2008-05-27 Eric Botcazou * tree-sra.c (sra_type_can_be_decomposed_p) : Make sure diff --git a/gcc/defaults.h b/gcc/defaults.h index 392d22cfabb..3eecd8db81a 100644 --- a/gcc/defaults.h +++ b/gcc/defaults.h @@ -902,6 +902,10 @@ along with GCC; see the file COPYING3. If not see #define LEGITIMATE_PIC_OPERAND_P(X) 1 #endif +#ifndef TARGET_MEM_CONSTRAINT +#define TARGET_MEM_CONSTRAINT 'm' +#endif + #ifndef REVERSIBLE_CC_MODE #define REVERSIBLE_CC_MODE(MODE) 0 #endif diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi index a8e43ead2fd..ee8021c7d59 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -1085,6 +1085,8 @@ number of constraints and modifiers. @item @samp{m} A memory operand is allowed, with any kind of address that the machine supports in general. +Note that the letter used for the general memory constraint can be +re-defined by a back end using the @code{TARGET_MEM_CONSTRAINT} macro. @cindex offsettable address @cindex @samp{o} in constraint diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index eeb744bd60d..3e4d2b7b5bf 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -5315,6 +5315,17 @@ into the @code{symbol_ref}, and then check for it here. When you see a Format}. @end defmac +@defmac TARGET_MEM_CONSTRAINT +A single character to be used instead of the default @code{'m'} +character for general memory addresses. This defines the constraint +letter which matches the memory addresses accepted by +@code{GO_IF_LEGITIMATE_ADDRESS_P}. Define this macro if you want to +support new address formats in your back end without changing the +semantics of the @code{'m'} constraint. This is necessary in order to +preserve functionality of inline assembly constructs using the +@code{'m'} constraint. +@end defmac + @defmac FIND_BASE_TERM (@var{x}) A C expression to determine the base term of address @var{x}. This macro is used in only one place: `find_base_term' in alias.c. diff --git a/gcc/genoutput.c b/gcc/genoutput.c index ba7fd4c2462..be4fb00bc7c 100644 --- a/gcc/genoutput.c +++ b/gcc/genoutput.c @@ -1122,7 +1122,10 @@ note_constraint (rtx exp, int lineno) unsigned int namelen = strlen (name); struct constraint_data **iter, **slot, *new; - if (strchr (indep_constraints, name[0])) + /* The 'm' constraint is special here since that constraint letter + can be overridden by the back end by defining the + TARGET_MEM_CONSTRAINT macro. */ + if (strchr (indep_constraints, name[0]) && name[0] != 'm') { if (name[1] == '\0') message_with_line (lineno, "constraint letter '%s' cannot be " diff --git a/gcc/genpreds.c b/gcc/genpreds.c index bc20b16f70e..b292784247a 100644 --- a/gcc/genpreds.c +++ b/gcc/genpreds.c @@ -690,8 +690,11 @@ static struct constraint_data **last_constraint_ptr = &first_constraint; for (iter_ = first_constraint; iter_; iter_ = iter_->next_textual) /* These letters, and all names beginning with them, are reserved for - generic constraints. */ -static const char generic_constraint_letters[] = "EFVXgimnoprs"; + generic constraints. + The 'm' constraint is not mentioned here since that constraint + letter can be overridden by the back end by defining the + TARGET_MEM_CONSTRAINT macro. */ +static const char generic_constraint_letters[] = "EFVXginoprs"; /* Machine-independent code expects that constraints with these (initial) letters will allow only (a subset of all) CONST_INTs. */ diff --git a/gcc/postreload.c b/gcc/postreload.c index 7e40728e876..15a14f001c6 100644 --- a/gcc/postreload.c +++ b/gcc/postreload.c @@ -542,12 +542,12 @@ reload_cse_simplify_operands (rtx insn, rtx testreg) case '*': case '%': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': - case 'm': case '<': case '>': case 'V': case 'o': + case '<': case '>': case 'V': case 'o': case 'E': case 'F': case 'G': case 'H': case 's': case 'i': case 'n': case 'I': case 'J': case 'K': case 'L': case 'M': case 'N': case 'O': case 'P': - case 'p': case 'X': + case 'p': case 'X': case TARGET_MEM_CONSTRAINT: /* These don't say anything we care about. */ break; diff --git a/gcc/recog.c b/gcc/recog.c index 9ede30f90fd..a8994ea856e 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -1543,7 +1543,7 @@ asm_operand_ok (rtx op, const char *constraint) result = 1; break; - case 'm': + case TARGET_MEM_CONSTRAINT: case 'V': /* non-offsettable */ if (memory_operand (op, VOIDmode)) result = 1; @@ -2082,7 +2082,7 @@ preprocess_constraints (void) } continue; - case 'm': + case TARGET_MEM_CONSTRAINT: op_alt[j].memory_ok = 1; break; case '<': @@ -2355,7 +2355,7 @@ constrain_operands (int strict) win = 1; break; - case 'm': + case TARGET_MEM_CONSTRAINT: /* Memory operands must be valid, to the extent required by STRICT. */ if (MEM_P (op)) diff --git a/gcc/recog.h b/gcc/recog.h index cdc438c8892..a7e22e6e349 100644 --- a/gcc/recog.h +++ b/gcc/recog.h @@ -50,7 +50,8 @@ struct operand_alternative /* Nonzero if '&' was found in the constraint string. */ unsigned int earlyclobber:1; - /* Nonzero if 'm' was found in the constraint string. */ + /* Nonzero if TARGET_MEM_CONSTRAINT was found in the constraint + string. */ unsigned int memory_ok:1; /* Nonzero if 'o' was found in the constraint string. */ unsigned int offmem_ok:1; diff --git a/gcc/regclass.c b/gcc/regclass.c index 200f3eefa58..1194c5ca75d 100644 --- a/gcc/regclass.c +++ b/gcc/regclass.c @@ -1701,7 +1701,7 @@ record_reg_classes (int n_alts, int n_ops, rtx *ops, [(int) base_reg_class (VOIDmode, ADDRESS, SCRATCH)]; break; - case 'm': case 'o': case 'V': + case TARGET_MEM_CONSTRAINT: case 'o': case 'V': /* It doesn't seem worth distinguishing between offsettable and non-offsettable addresses here. */ allows_mem[i] = 1; diff --git a/gcc/reload.c b/gcc/reload.c index 0492ee8cc64..b6880ea7bc9 100644 --- a/gcc/reload.c +++ b/gcc/reload.c @@ -3182,7 +3182,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known, badop = 0; break; - case 'm': + case TARGET_MEM_CONSTRAINT: if (force_reload) break; if (MEM_P (operand) @@ -4522,7 +4522,7 @@ alternative_allows_const_pool_ref (rtx mem, const char *constraint, int altnum) while (*constraint++ != ','); altnum--; } - /* Scan the requested alternative for 'm' or 'o'. + /* Scan the requested alternative for TARGET_MEM_CONSTRAINT or 'o'. If one of them is present, this alternative accepts the result of passing a constant-pool reference through find_reloads_toplev. @@ -4533,7 +4533,7 @@ alternative_allows_const_pool_ref (rtx mem, const char *constraint, int altnum) for (; (c = *constraint) && c != ',' && c != '#'; constraint += CONSTRAINT_LEN (c, constraint)) { - if (c == 'm' || c == 'o') + if (c == TARGET_MEM_CONSTRAINT || c == 'o') return true; #ifdef EXTRA_CONSTRAINT_STR if (EXTRA_MEMORY_CONSTRAINT (c, constraint) diff --git a/gcc/reload1.c b/gcc/reload1.c index 13b8e6f7ef0..51d3f4c4d19 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -1454,11 +1454,11 @@ maybe_fix_stack_asms (void) switch (c) { case '=': case '+': case '*': case '%': case '?': case '!': - case '0': case '1': case '2': case '3': case '4': case 'm': - case '<': case '>': case 'V': case 'o': case '&': case 'E': - case 'F': case 's': case 'i': case 'n': case 'X': case 'I': - case 'J': case 'K': case 'L': case 'M': case 'N': case 'O': - case 'P': + case '0': case '1': case '2': case '3': case '4': case '<': + case '>': case 'V': case 'o': case '&': case 'E': case 'F': + case 's': case 'i': case 'n': case 'X': case 'I': case 'J': + case 'K': case 'L': case 'M': case 'N': case 'O': case 'P': + case TARGET_MEM_CONSTRAINT: break; case 'p': diff --git a/gcc/stmt.c b/gcc/stmt.c index 4dba88196cf..57e8ad4db7e 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -363,7 +363,7 @@ parse_output_constraint (const char **constraint_p, int operand_num, } break; - case 'V': case 'm': case 'o': + case 'V': case TARGET_MEM_CONSTRAINT: case 'o': *allows_mem = true; break; @@ -462,7 +462,7 @@ parse_input_constraint (const char **constraint_p, int input_num, } break; - case 'V': case 'm': case 'o': + case 'V': case TARGET_MEM_CONSTRAINT: case 'o': *allows_mem = true; break; -- 2.11.4.GIT