[LLVMdev] LLVM Metadata from Pass to Backend optimization

John Criswell jtcriswel at gmail.com
Sun Jul 20 09:47:08 PDT 2014


On 7/20/14, 6:49 AM, Konstantinos Parasyris wrote:
> Hello,
>
> I am new in the LLVM infrastructure and I want to write a pass which 
> creates extra information for each instruction. This information is 
> going to be used by a back-end optimization. I am thinking
> of using the Metadata structure to pass the data from the Analysis 
> Pass to the Back end. Is this the correct methodology? Or should I use 
> another mechanism?

If a MachineFunctionPass can require a "regular" LLVM pass (such as a 
FunctionPass or ModulePass), then I would simply write the pass which 
creates the extra information as an LLVM analysis pass and give it 
methods which the MachineFunctionPass can use to query the extra 
information.  This ensures that transformations between the time you do 
the analysis and the time you do code generation don't invalidate your 
results.

If that's too difficult, then I think adding Metadata would work. It's 
just not the approach I'd take.

Regards,

John Criswell


>
> Konstantinos Parasyris.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list