[LLVMdev] tblgen internals
Chris Lattner
clattner at apple.com
Tue Dec 14 20:53:20 PST 2010
On Dec 12, 2010, at 8:12 PM, Garrison Venn wrote:
>> I believe I caught most of the syntax style issues with the attached patch. It only contains
>> these style changes.
Thanks! I applied your followup patch in r121837.
> Concerning the RecordKeeper reference in Record. Would you prefer to partially go
> back to a more limited constrained version of a global. Since we are not threaded anyway,
> we could turn the reference into a singleton for the duration of an initial parse and use session.
> The concept would be to instead make the reference a static pointer, make RecordKeeper
> a friend of Record, and add RecordKeeper::resetSession(void). resetSession would set
> the static pointer to itself. Asserts would also have to be added to the methods which needed
> a Record to have a non-NULL RecordKeeper pointer. Although we would in effect still be
> using a global, we would be allowing it to be controlled while simultaneously removing the
> sizeof(RecordKeeper*) number of bytes from Record instances. Offsets into a another say
> SmallVector instance could also be attempted, but this seems messy to me.
I prefer to make RecordKeeper not a global. This leaves us with three options: 1) keep the ivar reference, 2) pass the reference into any method that (transitively) needs the recordkeeper. 3) do #2, but refactor code so that it doesn't have to be passed around as much.
I honestly don't know what is best, if you think the current solution is good enough, lets stay with it. Tblgen isn't exactly a paragon of high performance or low memory use anyway :)
Thanks Garrison!
-Chris
More information about the llvm-dev
mailing list