This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Segment register support for the i386
Sergey Larin <larin@overta.ru> writes:
[...]
> Porting would be much more easier if all that we need is *.h file and
> instructions description file (*.id) that contains
> all kinds of machine instructions description of particular target
> look like RTL expressions.
Really I think only about something like this:
(define-address "VOID" ; for any mode
(match_operand:HI 0 "immediate_operand" "")
"/* remain C condition */"
"%0"
[(set_attr "cost" "4")])
(define-address "QI,HI,SI,SF"
(match_operand:HI 0 "register_operand" "e")
""
"*{
switch (REGNO (operands[0]))
{
case REG_X: return \"X\";
case REG_Y: return \"Y\";
case REG_Z: return \"Z\";
default:
fatal (\"Incorrect register as address\");
}
}"
[(set_attr "cost" "2")])
(define-address "QI,HI,SI,SF"
(post_inc:HI (match_operand:HI 0 "register_operand" "e"))
""
"*{
switch (REGNO (operands[0]))
{
case REG_X: return \"X+\";
case REG_Y: return \"Y+\";
case REG_Z: return \"Z+\";
default:
fatal ("Incorrect register as address");
}
}"
[(set_attr "cost" "2")
(set_attr "mode_dependent" "1")])
(define-address "QI,HI,SI,SF"
(plus:HI (match_operand:HI 0 "register_operand" "b")
(match_operand:HI 1 "const_int_operand" "I"))
"INTVAL (operands[1]) >= 0 && INTVAL (operands[1]) <= 63"
"*{
if (REGNO (operands[0]) == REG_Y)
return \"Y+%1\";
else if (REGNO (operands[0] == REG_Z))
return \"Z+%1\";
else
fatal (\"Incorrect register as address\");
}"
[(set_attr "cost" "2")])
This is a full (except pre_dec) description of the AVR addressing modes.
Where: `b' - base pointer regs;
`e' - any reg which can be a pointer.
`I' - numbers lower than 64 and more or equal than 0.
From this descriptions I can generate:
- GO_IF_LEGITIMATE_ADDRESS;
- LEGITIMIZE_RELOAD_ADDRESS;
- ADDRESS_COST;
- HAVE_POST_INCREMENT, HAVE_POST_DECREMENT,
HAVE_PRE_INCREMENT, HAVE_PRE_DECREMENT;
- BASE_REG_CLASS;
- INDEX_REG_CLASS;
- REGNO_MODE_OK_FOR_BASE_P;
- REGNO_OK_FOR_INDEX_P;
- REG_OK_FOR_BASE_P;
- REG_OK_FOR_INDEX_P;
Any suggestions ?
Denis.