[LLVMdev] tablegen keywords

Sean Silva chisophugis at gmail.com
Sun May 25 11:22:28 PDT 2014


tl;dr: don't worry about it.

Essentially, marking a field with "field" makes RecordVal::getPrefix return
1. Otherwise, it returns 0. (RecordVal::getPrefix is in
include/llvm/TableGen/Record.h). It effectively is just a way to set a bit
on a field. It's only used in two places:

llvm/utils/TableGen$ git grep '\bgetPrefix\b'
CodeEmitterGen.cpp:    if (Vals[i].getPrefix() ||
Vals[i].getValue()->isComplete())
FixedLenDecoderEmitter.cpp:      if (Vals[i].getPrefix() ||
Vals[i].getValue()->isComplete())

The use for it here is something one of the backend people will have to
answer, but my understanding is that this "field" feature is entirely
historical. I'm pretty sure that its purpose can be accomplished in another
way within the rest of the language without too much trouble.

If you can get rid of the use of getPrefix in the lines above (and remove
use of "field" from the .td files), you could then remove "field" from the
language. The attached (completely untested) patch should remove "field"
from the language.

As long as the replacement for "field" isn't completely insane, I think it
would be great to whittle down TableGen's complexity a tiny bit by removing
it.

-- Sean Silva





On Fri, May 23, 2014 at 5:48 AM, Francesco Petrogalli <
francesco.petrogalli at gmail.com> wrote:

> Hello,
>
> what is the tablegen keyword 'field' for?
>
> Thanks,
>
> Francesco
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140525/9d1c981f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: remove-field.patch
Type: text/x-patch
Size: 4520 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140525/9d1c981f/attachment.bin>


More information about the llvm-dev mailing list