[LLVMdev] tblgen internals

Garrison Venn gvenn.cfe.dev at gmail.com
Fri Dec 10 12:31:42 PST 2010


Attached patch for removing for the first trivial RecordKeeper:: getAllDerivedDefinitions(...) 
dependency on the global RecordKeeper Records instance. The real work will be removing
this dependency from the other Record.h classes/structs, and from TGParser. Thinking this would
be implemented as some sort of context structure/class holding a RecordKeeper instance passed
to TGParser which in turn would set this RecordKeeper instance on the various Record classes/
structures. Not sure about this yet. Free to direct if you wish. :-)

I checked this with make (with clang), and Release+Asserts/bin/llvm-lit test/TableGen.

Garrison


On Dec 9, 2010, at 18:32, Chris Lattner wrote:

> 
> On Dec 9, 2010, at 4:50 AM, Garrison Venn wrote:
> 
>> Is there a reason that RecordKeeper:: getAllDerivedDefinitions(...)implementation 
>> accesses the global Records instance instead of just referencing itself?
>> 
>> As far as I can tell from the usage:
>> 
>> 1) Records has the linkage as extern RecordKeeper Records in Record.h
>> 2) Is instantiated as a global in TableGen
>> 3) All llvm uses of getAllDerivedDefinitions SEEM to be manifested as a 
>> message to this global RecordKeeper
>> 
>> In short getAllDerivedDefinitions(...) sort of (non-static) treats RecordKeeper 
>> as a singleton but it is never accessed this way. It is always accessed via
>> the global: Records.
> 
> Hi Garrison,
> 
> There is no good reason.  This is one of many instances of tblgen just being poorly designed because noone gives it much love.  It would be great if you could send in or commit a patch to tidy this up, thanks!
> 
> -Chris
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101210/95a98efa/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RecordKeeper.patch
Type: application/octet-stream
Size: 557 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101210/95a98efa/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101210/95a98efa/attachment-0001.html>


More information about the llvm-dev mailing list