This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Register constraints + and =


<Paul_Koning@Dell.com> writes:

> On May 4, 2012, at 11:39 AM, Ian Lance Taylor wrote:
>
>> <Paul_Koning@Dell.com> writes:
>> 
>>> I thought that the "operand" in a mem:BLK is the pointer to the block,
>>> not the block itself.  So if the instruction(s) generated don't touch
>>> the pointer -- a likely answer for a block-move instruction -- then
>>> the operand would be read-only.  Is that the right interpretation?
>> 
>> Yes.
>> 
>> But many block move instructions do in fact touch the pointer, in that
>> they update the registers pointing to the starts of the blocks to point
>> to the ends after the instruction completes.
>
> I interpreted + to mean that the operand is written with a value known to the compiler, as opposed to clobber which means that the value is not known (or not one that can be described to the compiler).   So I take it that for mem:BLK a + operand is interpreted as final value == end of the buffer?  Or byte after the buffer?

Hmmmm.  I don't really know what you mean, so there is some sort of
communication difficulty.

A '+' in a constraint for an operand means that the operand is both read
and written by the instruction.  It's relatively unusual to find such a
constraint in a GCC backend.  In a GCC backend, it's more common to
write the instruction as a PARALLEL with one insn that sets the operand,
another insn that uses the operand, and a matching constraint to put
both operands in the same register.

A '+' in a constraint doesn't say anything at all about what value the
register has after the insn.  That is expressed only in the RTL.

The place where you often see '+' in a constraint is in an asm
instruction.  The asm instruction could also use a matching constraint,
but there is generally less point since the asm instruction can't say
anything about the value the register will have after the asm executes.

Comparing '+' in a constraint and CLOBBER doesn't make sense.  The '+'
tells the register allocator something about which registers it may use.
In particular, an operand with a '+' constraint may not be placed in a
register that holds either an input or an output operand.  An operand
with an '=' constraint, on the other hand, may be placed in the same
register as an input operand.

Constraints like '+' matter to the register allocator and reload.  RTL
constructs like CLOBBER matter to the RTL optimizers.  They are
different categories of things.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]