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

Vedant Kumar via llvm-dev llvm-dev at lists.llvm.org
Mon Oct 12 09:01:17 PDT 2015

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?


More information about the llvm-dev mailing list