[LLVMdev] How do I get MachineFunctions?

John Criswell jtcriswel at gmail.com
Thu Oct 16 06:17:09 PDT 2014


Dear Vanderson,

You need to write a MachineFunctionPass instead of a ModulePass or 
FunctionPass.  A MachineFunctionPass is given a MachineFunction to 
analyze/transform in its runOnFunction() method.

MachineFunctionPass'es are run by llc and other LLVM-based tools that 
generate native code (such as the libLTO plugin and Clang).

Regards,

John Criswell

On 10/14/14, 4:52 PM, Vanderson Martins do Rosario wrote:
> Hi everybody,
>
> I know that this may be a very silly question, but seriously, I'm 
> totally lost.
>
> So, what I want to know is how from my Module I can get 
> MachineFunctions or MachineBasicBlocks.
>
> I'm able to read a file with LLVM IR, create the Module and I also 
> managed to create some passes for it, but what I want is to see the 
> x86-64 assembly that this IR generates and map MachineBasicBlocks with 
> BasicBlocks.
>
> I know that I should follow the Instruction Selection steps from 
> http://llvm.org/docs/CodeGenerator.html#using-the-machineinstrbuilder-h-functions, 
> but I couldn't figure it out how to do this. I also tried to read the 
> llc's code, but it didn't help me so much.
>
> I would be grateful if somebody show me an example of how from a 
> Module I can get MachineBasicBlocks.
>
> Thank you,
>
> Vanderson M. Rosario
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev


-- 
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
http://www.cs.rochester.edu/u/criswell

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141016/bc25e912/attachment.html>


More information about the llvm-dev mailing list