[tree-ssa] RFC: Never gimplify ASM_EXPRs

Paul Koning pkoning@equallogic.com
Thu Jun 5 18:48:00 GMT 2003


>>>>> "Richard" == Richard Henderson <rth@redhat.com> writes:

 Richard> On Thu, Jun 05, 2003 at 11:12:36AM -0400, Jason Merrill
 Richard> wrote:
 >> Andrew and I discussed this issue at the summit, and agreed (I
 >> thought) that the asm should either make the operand an
 >> input/output operand or pass in X and do the dereference in the
 >> explicit assembly.

 Richard> Doing the dereference explicitly in the assembly is not an
 Richard> option.  The syntax for various addressing modes varies too
 Richard> widely.

 Richard> IMO yall should be special-casing memory operands.

I agree.  

Another reason I ran into with MIPS, where you find the classic RISC
register/displacement addressing.  If you code something like a
prefetch (or a cache op, to pick something not alread covered by
__builtin_xxx) using a pointer in a register, the compiler often ends
up allocating another register and generates an arithmetic op to form
the address.  If you make the operand a memory operand, and there
happens to be already a base register set up for the variable in
question, the compiler just supplies the register and displacement.
Savings: one register plus one instruction -- that's significant.

For this to work, the optimizer has to know that it's not allowed to
convert memory operands of asm statements to refer to temporary copies
of the operand (assuming, of course, that the operand is a variable
rather than an expression).

       paul



More information about the Gcc mailing list