[LLVMdev] PATCH: Use size reduction -- wave1
sabre at nondot.org
Sun Mar 30 10:40:00 PDT 2008
On Mar 26, 2008, at 3:16 PM, Gabor Greif wrote:
> here comes the patch for the first wave of Use class size reduction.
> I have split it into 3 files, corresponding to
> - header changes
> - implementation changes
> - applications
> This at the moment does not contain the description how the
> size of the Use class will be reduced from 16 to 12 bytes,
> I am going to send that in a separate patch.
Right, sounds great.
> This wave primarily consists of changes that are needed
> to allocate objects with a variable number of embedded <Use>s.
> Where the number of <Use>s is constant in the lifetime of an object,
> I preferred to keep the 'new Instr(...)' syntax. Otherwise I have
> introduced static 'Create(...)' methods, which are used instead of the
> 'new Instr(...)' construct.
The bad thing about this is that it is inconsistent. I'd prefer to
have consistent use of ::Create for all IR classes to make it easier
to learn the API. That said, a temporary moment of inconsistency is
ok: you could commit this part, then switch the remaining classes over.
> These replace the constructors and the
> constructors become private/protected. The arguments of the 'Create'
> methods are identical to the corresponding constructors.
> Essentially at the moment all introduced 'operator new's end up
> '::operator new(size_t)', so there should be no functionality change
> at all.
> This will change in subsequent waves.
This basically looks good, some thoughts for the future:
1) Please (eventually) don't make the 'operator new' override be
public. I'd actually prefer all memory alloc/dealloc stuff to be done
privately to the (vmcore) .cpp files, not exposed through the header.
2) Eventually we'll need to make the dtor private as well.
3) Make sure that make check and some reasonable subset of llvm-test
passes with this patch :)
Finally, please update llvm-gcc 4.2 as well when you commit this.
I'll update clang after you commit.
When you commit, please email llvmdev/commits with an email that says
"API CHANGE" in the subject line with info on how to upgrade out-of-
tree projects (e.g. vmkit).
More information about the llvm-dev