[PATCH] D12455: [IR] Teach `llvm::User` to co-allocate a descriptor.
Joseph Tremoulet via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 31 13:17:51 PDT 2015
JosephTremoulet added inline comments.
================
Comment at: include/llvm/IR/User.h:49-54
@@ -48,6 +48,8 @@
- /// Allocate a User with the operands co-allocated.
+ /// Allocate a User with the operands co-allocated. If DescBytes is non-zero
+ /// then allocate an additional DescBytes bytes before the operands. These
+ /// bytes can be accessed by calling getDescriptor.
///
/// This is used for subclasses which have a fixed number of operands.
- void *operator new(size_t Size, unsigned Us);
+ void *operator new(size_t Size, unsigned Us, unsigned DescBytes = 0);
----------------
I wonder what sort of alignment guarantees this should make / what sort of alignment expectations it should set. The end of this allocation will always be 4 bytes before a pointer-aligned address, correct? Maybe just note that in the comment so that callers can figure out how to get pointer alignment if they want it?
http://reviews.llvm.org/D12455
More information about the llvm-commits
mailing list