[PATCH] D12455: [IR] Teach `llvm::User` to co-allocate a descriptor.

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 31 21:31:06 PDT 2015


I don't know why this hasn't showed up on llvm-commits yet, but I've
replied to the review on phabricator.

On Mon, Aug 31, 2015 at 1:17 PM, Joseph Tremoulet <jotrem at microsoft.com> wrote:
> 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
>
>
>



-- 
Sanjoy Das
http://playingwithpointers.com


More information about the llvm-commits mailing list