[LLVMdev] Inserting Instructions (pass)

Michael Graumann MichaelGraumann at gmx.net
Sat Aug 1 04:23:23 PDT 2009


Hi,

both versions are working:

 

FunctionType *asm_Ftype = FunctionType::get(Type::VoidTy, std::vector<const
Type*>(), false);

InlineAsm* Iasm =
InlineAsm::get(asm_Ftype,"isync","~{dirflag},~{fpsr},~{flags}",true);

 

How can I insert this InlineAsm, because it is no instruction and this way
it will not work:

 

Instruction *pi = bi;

pi->getParent()->getInstList().insert(pi, Iasm);

 

I try to build a CallInst with a function, but I have still some problems

 

Function *NewF = new Function(asm_Ftype,???,???);

CallInst* NewCInst = new CallInst(NewF, ???

 

But where to set the InlineAsm  and what type of LinkageType is required .?

 

Thanks for help

 

Michael

 

Von: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] Im
Auftrag von Chris Lattner
Gesendet: Samstag, 1. August 2009 07:24
An: LLVM Developers Mailing List
Betreff: Re: [LLVMdev] Inserting Instructions (pass)

 

 

On Jul 31, 2009, at 5:04 PM, Michael Graumann wrote:





Thank you Chris,

for your hint, but I am still too stupid. I tried two versions

 

asm_arguments.push_back(Type::VoidTy);

FunctionType *asm_type = FunctionType::get(Type::VoidTy, asm_arguments,
false);

 

Alternatively

 

FunctionType *asm_type = FunctionType::get(Type::VoidTy, std::vector<const
Type*>(), false);

 

. Can you give me a snippet of example code, or somebody else?

Thanks for help

 

Yes, either of these should work.  What *problem* are you seeing?

 

-Chris

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090801/815e74f2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6952 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090801/815e74f2/attachment.bin>


More information about the llvm-dev mailing list