Preferred registers for integer arithmetic

Ian Lance Taylor iant@google.com
Fri Apr 15 15:01:00 GMT 2011


Paul Römer <roemer.paul@googlemail.com> writes:

> I'm playing around with the gcc and its generated assembler code for
> some test applications. I recognized that the gcc prefers the use of
> the registers eax, (ebx), ecx and edx (x86) for arithmetic
> instructions like lea, add, mul, etc. I know that the gcc uses several
> register classes to define which registers can be used for which task
> (e.g. FIXED_REGS, GENERAL_REGS).
>
> Is there also a class that explains the described behavior? Or does
> the gcc simply looks for unused registers in a special order?

See REG_ALLOC_ORDER.

> Another question: What is meant by the Q_REGS class?

The Q_REGS are the registers which can be accessed using byte
operations.

Ian



More information about the Gcc-help mailing list