* RFC: address operand predicates other than address_operand?
@ 2003-05-22 17:13 Joern Rennecke
0 siblings, 0 replies; only message in thread
From: Joern Rennecke @ 2003-05-22 17:13 UTC (permalink / raw)
To: gcc
[-- Attachment #1: Type: text/plain, Size: 1151 bytes --]
I think it would make sense to have predicates that
already enforce some of the restrictions that an
EXTRA_ADDRESS_CONSTRAINT places on address.
So, we could either have a target macro that describes
a list of address operand predicates, or one that
recognizes address operand predicates, or have a convention
for predicate names that are generally recognized as
address operand predicates.
Note that such a new target macro would not be in the way
of run-time switching the target, as it is used to generate
the recognizer, which is inherently target-specific, and would
have to be switched anyway.
OTOH, having a convention for predicate names seems simpler
both in implementation and in making for more uniform target
descriptions. We could just say that every predicate that
contains the substring "address_opeerand" is an address_operand
predicate. This is pretty easy to implement, as the attached
patch shows. If there is agreement that this is the way to
go, I'll write up a ChangeLog entry and documentation patch
for it.
--
--------------------------
SuperH (UK) Ltd.
2410 Aztec West / Almondsbury / BRISTOL / BS32 4QX
T:+44 1454 465658
[-- Attachment #2: address-operand-patch-2 --]
[-- Type: text/plain, Size: 3710 bytes --]
Index: genrecog.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/genrecog.c,v
retrieving revision 1.125
diff -p -r1.125 genrecog.c
*** genrecog.c 17 May 2003 01:40:41 -0000 1.125
--- genrecog.c 22 May 2003 16:32:25 -0000
*************** validate_pattern (pattern, insn, set, se
*** 623,629 ****
&& allows_non_const
&& ! special_mode_pred
&& pred_name[0] != '\0'
! && strcmp (pred_name, "address_operand") != 0
&& strstr (c_test, "operands") == NULL
&& ! (set
&& GET_CODE (set) == SET
--- 623,629 ----
&& allows_non_const
&& ! special_mode_pred
&& pred_name[0] != '\0'
! && strstr (pred_name, "address_operand") == NULL
&& strstr (c_test, "operands") == NULL
&& ! (set
&& GET_CODE (set) == SET
*************** validate_pattern (pattern, insn, set, se
*** 667,673 ****
/* The mode of an ADDRESS_OPERAND is the mode of the memory
reference, not the mode of the address. */
if (GET_CODE (src) == MATCH_OPERAND
! && ! strcmp (XSTR (src, 1), "address_operand"))
;
/* The operands of a SET must have the same mode unless one
--- 667,673 ----
/* The mode of an ADDRESS_OPERAND is the mode of the memory
reference, not the mode of the address. */
if (GET_CODE (src) == MATCH_OPERAND
! && strstr (XSTR (src, 1), "address_operand") == NULL)
;
/* The operands of a SET must have the same mode unless one
*************** add_to_sequence (pattern, last, position
*** 868,876 ****
If we know that the predicate does not allow CONST_INT,
we know that the only way the predicate can match is if
! the modes match (here we use the kludge of relying on the
! fact that "address_operand" accepts CONST_INT; otherwise,
! it would have to be a special case), so we can test the
mode (but we need not). This fact should considerably
simplify the generated code. */
--- 868,876 ----
If we know that the predicate does not allow CONST_INT,
we know that the only way the predicate can match is if
! the modes match (here we used to use the kludge of relying
! on "address_operand" accepting CONST_INT, but that is not
! true for all architectures), so we can test the
mode (but we need not). This fact should considerably
simplify the generated code. */
*************** add_to_sequence (pattern, last, position
*** 900,906 ****
}
/* Can't enforce a mode if we allow const_int. */
! if (allows_const_int)
mode = VOIDmode;
/* Accept the operand, ie. record it in `operands'. */
--- 900,908 ----
}
/* Can't enforce a mode if we allow const_int. */
! if (allows_const_int
! || (GET_CODE (pattern) == MATCH_OPERAND
! && strstr (XSTR (pattern, 1), "address_operand") != NULL))
mode = VOIDmode;
/* Accept the operand, ie. record it in `operands'. */
*************** maybe_both_true_2 (d1, d2)
*** 1111,1117 ****
mode of the memory, not the operand. It can only
be used for testing the predicate, so we must
ignore it here. */
! && strcmp (d1->u.pred.name, "address_operand") != 0)
return 0;
}
/* Don't check two predicate modes here, because if both predicates
--- 1113,1119 ----
mode of the memory, not the operand. It can only
be used for testing the predicate, so we must
ignore it here. */
! && strstr (d1->u.pred.name, "address_operand") == NULL)
return 0;
}
/* Don't check two predicate modes here, because if both predicates
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-05-22 16:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-22 17:13 RFC: address operand predicates other than address_operand? Joern Rennecke
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).