[LLVMdev] convert a char * to a value
Nabila ABDESSAIED
nabila.abdessaied at gmail.com
Fri May 20 15:46:51 PDT 2011
Hi all,
Please i need help, I have a method that takes 2 arguments with type char *:
void branchPredict(char *b1, char *b2){
---
--
}
i'm supposed to add this method, in an IR basic bloc:
to add it into a basic bloc i do:
//i: is the basic bloc
std::vector<Value*> void_43_params;
Constant* tbname = ConstantArray::get(M.getContext(),i->getNameStr() ,
true);
Constant* pbname = ConstantArray::get(M.getContext(),
i->getPrevNode()->getNameStr(), true);
void_43_params.push_back(tbname);
void_43_params.push_back(pbname);
CallInst* void_43 = CallInst::Create(func_branchPredict,
void_43_params.begin(), void_43_params.end(), "", i->getTerminator());
when i execute the pass (opt -load ....) i get an error:
Call parameter type does not match function signature!
[3 x i8] c"bb\00"
i8* call void @branchPredict([3 x i8] c"bb\00", [4 x i8] c"bb1\00")
Call parameter type does not match function signature!
[4 x i8] c"bb5\00"
i8* call void @branchPredict([4 x i8] c"bb5\00", [18 x i8]
c"bb3.bb3_crit_edge\00")
Broken module found, compilation aborted!
0 libLLVM-2.8.so.1 0x01421628
Stack dump:
0. Program arguments: opt -load
/home/inspiron/PhdWork/llvm-2.8/Release/lib/Example.so -Example6
1. Running pass 'Function Pass Manager' on module '<stdin>'.
2. Running pass 'Module Verifier' on function '@main'
Aborted
Any help
thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110520/f78b2619/attachment.html>
More information about the llvm-dev
mailing list