search for: call_print

Displaying 4 results from an estimated 4 matches for "call_print".

2013 Dec 16
3
[LLVMdev] Add call printf instructions problems
Hello, everyone! I want to write a pass which can insert a call "printf" instructions before every instruction in the LLVM IR. here is what I wrote: namespace { class call_print : public FunctionPass{ private: DenseMap<const Value*, int> inst_map; public: static char ID; call_print() : FunctionPass(ID){} //define a extern function "printf" static llvm::Function* printf_prototype(llvm::LLVMContext& ctx, llvm::Module *mod) { std::vector<llvm::Ty...
2013 Dec 16
0
[LLVMdev] Add call printf instructions problems
Hi Jin, It's difficult to say just from looking at a pass, but one thing looked odd: > CallInst *call_print = CallInst::Create(call_print,paramArrayRef,"",ins_temp); This looks very dodgy. The "call_print" being used as an argument is the (uninitialised) one that's just been declared. This could be the source of the assertion failure (though a segfault is just as likely). Other...
2013 Dec 17
2
[LLVMdev] Add call printf instructions problems
Thanks,Cheers! I found the problem is that the "Function *call_print" using the same name as the “class call_print”, which made the compiler wrongly resolved the call_print type! But I got another problems. I successfully compile the pass and I can insert the call printf (C Lib function) instructions in the LLVM IR(eg: call.bc). If the call.bc didn't cont...
2012 Aug 22
1
[LLVMdev] Insert Self Written Function Call from a FunctionPass?
...); BI != BE; ++BI) { if(isa<LoadInst>(&(*BI))) { LoadInst *CI = dyn_cast<LoadInst>(BI); /*load count*/ LoadInst* load_count = new LoadInst(count, "", false); load_count->setAlignment(4); /*call print(count)*/ CallInst* call_print = CallInst::Create(check, load_count, ""); /*insert the instructions*/ BB->getInstList().insert((Instruction*)CI, load_count); BB->getInstList().insert((Instruction*)CI, call_print); }//end of if } return true; } }; } char bishe_insert::ID =...