[llvm-dev] [RFC] Clean up the way we store optional Function data

Duncan P. N. Exon Smith via llvm-dev llvm-dev at lists.llvm.org
Mon Oct 12 09:46:36 PDT 2015


> On 2015-Oct-12, at 09:01, Vedant Kumar <vsk at apple.com> wrote:
> 
> Hi Sanjoy,
> 
> 
>> I don't know how prologue and prefix data is used -- is it correct to
>> say that you're basically trying to give `llvm::Function` s some
>> "optional" operands, and that you know during construction of an
>> `llvm::Function` how many optional operands the `llvm::Function` will
>> need[1]?
> 
> Yep. Though not operands exactly, since they wouldn't be in Function's use list.
> 
> 
>> If so, you might want to consider using the "descriptor"
>> functionality that was added recently[2].  It allows classes deriving
>> from `llvm::User` to allocate an arbitrary number of bookkeeping bytes
>> before the normal `Use &` array.  Instructions with operand bundles
>> use these bytes to remember which where the individual operand bundles
>> start and end, and an `llvm::Function` could easily use the extra
>> storage to remember if / where optional operands like the personality
>> function are in the `Use &` array.  And by making the operands part of
>> the regular `Use &` array, functionality like RAUW that use Def-Use
>> chains should Just Work(TM).
> 
> That's a neat idea. To summarize: make Function have 3 optional operands. (For context -- Function currently has 1 optional operand, and my proposal is to move to 0.)
> 
> Could someone else chime in on what they'd like to see?

Sanjoy's idea makes sense to me, but only if we never need to add
prefix/prologue data after functions are created.  Are there any places
where we need/want to add them after the fact?


More information about the llvm-dev mailing list