[LLVMdev] General LLVM question

Chris Lattner sabre at nondot.org
Sat Jan 6 14:04:16 PST 2007


On Sat, 6 Jan 2007, Anton Korobeynikov wrote:
> And another question: I'm wanting to "mark" some functions in source
> code (e.g. we're considering c/c++ source) and after emit some special
> "information" for them at codegen stage (so, actually, I'm wanting to
> find "marked" functions at some pass, etc).
>
> I can introduce special attribute to allow user mark function as
> void foo() __attribute__(("mark_me"));
> and than do lookup_attribute() call inside llvv-gcc backend.
>
> Is there any "standard" way to introduce some flags for Functions/GVs
> inside LLVM? Or I should introduce some new "structure", change bytecode
> format, etc.
>
> It seems to me, that such feature can also be useful for
> visibility/aliasing (if we'll allow "flags" be just set pair of
> name-value) support in LLVM.

It depends on what sort of attribute it is.  If it is something specific 
to a particular function, adding it to the Function object makes sense 
(e.g. see alignment and section info).  If it affects the calling 
convention, adding it to FunctionType makes sense.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list