public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Porting the GCC: order of registers
@ 2000-01-29  9:57 Anja Müller
  2000-01-31  6:28 ` Joern Rennecke
  0 siblings, 1 reply; 2+ messages in thread
From: Anja Müller @ 2000-01-29  9:57 UTC (permalink / raw)
  To: gcc

Hello,

I want to port the gcc to the microcontroller 8051 and now write the
machine description. There are some questions about register allocation,
I want to ask you.

How can I tell the GCC the order of registers ? I need to know this for
special operation of the microcontroller: the 8051 ist a
8-Bit-Microcontroller, that means that alle Registers have 8 Bit. But
the 8051 has a Multiply-Operation that multiplies the Akkumulator
Register A and another Register B and writes the 16-Bit-Result into A
and B, especially the low-Byte into register A and the high-Byte into
Register B. So I want to define the named Instruction Pattern "mulqihi3"
to make this operation avaiable to the GCC:

(define_insn "mulqihi3"
  [(set (match_operand:HI 0 "register_operand" "=a")
        (mult:HI (match_operand:QI 1 "register_operand" "%0")
    (match_operand:QI 2 "register_operand" "b")))]
  ""
  "@
        ...

a = register constraint to point at register A
b = register constraint to point at register B

But how does the GCC know that the higher part of the result is stored
in register B ? When I defined the Macros FIXED_REGISTERS,
CALL_USED_REGISTER, ... registers B is not the next one to register A,
there are some other registers betweem them because the operation on
these registers are faster, so they shall be allocated by the GCC
earlier then regsiter B and the following. My Question is: which macro
defines the order of register when more than one register is needed to
store a value, for example a 16-Bit-Value in two 8-Bit-register ?

Bye, Anja



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Porting the GCC: order of registers
  2000-01-29  9:57 Porting the GCC: order of registers Anja Müller
@ 2000-01-31  6:28 ` Joern Rennecke
  0 siblings, 0 replies; 2+ messages in thread
From: Joern Rennecke @ 2000-01-31  6:28 UTC (permalink / raw)
  To: Anja [M_ller]; +Cc: gcc

> But how does the GCC know that the higher part of the result is stored
> in register B ? When I defined the Macros FIXED_REGISTERS,
> CALL_USED_REGISTER, ... registers B is not the next one to register A,
> there are some other registers betweem them because the operation on
> these registers are faster, so they shall be allocated by the GCC
> earlier then regsiter B and the following. My Question is: which macro
> defines the order of register when more than one register is needed to
> store a value, for example a 16-Bit-Value in two 8-Bit-register ?

There is no such macro - you always get adjacent hard registers when
you use a hard register in a mode that is wider than a single hard
register.

However, there is REG_ALLOC_ORDER, so that you can order the registers
according to how multi-hard-register values are to be represented,
yet specify with REG_ALLOC_ORDER that a different order should be used
when allocating registers.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-01-31  6:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-29  9:57 Porting the GCC: order of registers Anja Müller
2000-01-31  6:28 ` 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).