* How to specify registers constraints for memory operands?
@ 2008-05-23 9:40 Mohamed Shafi
0 siblings, 0 replies; only message in thread
From: Mohamed Shafi @ 2008-05-23 9:40 UTC (permalink / raw)
To: GCC
Hello everyone,
I need to specify constraints for registers used in the memory
operands in a load pattern. For these the following are the things
that i have done.
#define CONSTRAINT_LEN(CHAR,STR) \
((CHAR) == 'R' ? 3 \
: DEFAULT_CONSTRAINT_LEN(CHAR,STR))
#define EXTRA_MEMORY_CONSTRAINT(C, STR) \
((C) == 'R')
#define REG_CLASS_FROM_CONSTRAINT(CHAR,STR) \
reg_class_from_constraint (CHAR, STR)
#define EXTRA_CONSTRAINT_STR(VALUE,C,STR) \
extra_constraint (VALUE, C, STR)
in extra_constraints i have the following code:
{
if (GET_CODE(value) != MEM)
return 0;
if (c == 'R')
{
r = XEXP(value,0);
if ((GET_CODE(r) == REG) && (REGNO(r) < FIRST_PSEUDO_REGISTER))
{
rclass = REG_CLASS_FROM_CONSTRAINT(c, str);
if (rclass == REGNO_REG_CLASS (REGNO(r)))
return 1;
}
}
return 0;
}
And i have the following pattern in the md file:
(define_insn "movhi_load"
[(set (match_operand:HI 0 "register_operand" "=R01,R03,R05,R07,R09,R13,R15,r")
(match_operand:HI 1 "memory_operand" "R00,R02,R04,R06,R08,R12,R14,m"))]
Is this the proper way to do this?
Thank you for taking the time to read this.
Regards,
Shafi
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-05-23 9:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-23 9:40 How to specify registers constraints for memory operands? Mohamed Shafi
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).