[LLVMdev] Early-clobber constraint in TableGen
Jim Grosbach
grosbach at apple.com
Tue Dec 15 17:52:54 PST 2009
On Dec 15, 2009, at 5:08 PM, David Greene wrote:
> On Tuesday 15 December 2009 18:01, Jim Grosbach wrote:
>
>> For a usage example, I've included in the patch the modification to
>> use the constraint for the STREX ARM instruction.
>
> Your example is:
>
> constraints = "@early $success"
>
> Why not spell it as:
>
> constraints = "$success != $src", "$success != $ptr"
>
This was my first thought as well; however, I decided against it. I
think it's best, at least for now, to expose an interface in tablegen
to express the early-clobber semantics that the back-end already
supports rather than adding something completely new.
Doing more would require significantly surgery on both tablegen and
the register allocation framework to support. The handling of early-
clobber register definitions is already in place in the allocator, and
this approach simply provides a means of specifying it in the tablegen
files. I think that's likely something we'd want separately from a
more general purpose solution in any case, as it's analogous to the
inline assembler '&' constraint, for example.
Do you have specific examples in mind that would be expressible with
something more complicated that aren't handleable via an early-clobber
constraint?
> The grammar would change to something like:
>
> constraint: operand '!=' operand
> | operand '=' operand
>
> This seems more intuitive and more generally applicable. I could
> see a use
> for this in other architectures. From reading your example, without
> the
> background I wouldn't know what "@early" means.
Perhaps spelling it out more fully with "earlyclobber" rather than
"early" would help?
Thanks for the feedback!
-Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091215/b5ad25f8/attachment.html>
More information about the llvm-dev
mailing list