[LLVMdev] print machine code using llvm c++ api

James Molloy James.Molloy at arm.com
Thu Oct 14 00:36:25 PDT 2010


Hi,

Look for the function addPassesToEmitFile, in LLVMTargetMachine. This is
called directly from llc.cpp if I recall correctly, and will emit a
string representation of the assembler code.

If you want pure ELF, look for addPassesToEmitMachineCode (old version)
or addPassesToEmitMC (new version).

Cheers,

James

> -----Original Message-----
> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu]
> On Behalf Of KULBHUSHAN PACHAURI
> Sent: 14 October 2010 05:35
> To: llvmdev at cs.uiuc.edu
> Subject: [LLVMdev] print machine code using llvm c++ api
> 
> Hi,
> 
> I know using llc i can print machine code (-print-machineinstrs).
> 
> How can i print machine code using llvm c++ api.. i looked into llc
> code but not able to find it..
> 
> 
> Thanks & Regards,
> Pachauri
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
-- 
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium.  Thank you.




More information about the llvm-dev mailing list