[LLVMdev] adding args to func call
Jerry Hom
jhom at cs.rutgers.edu
Sun Jun 25 14:49:57 PDT 2006
This question is similar to Ryan Lefever's post on May 1, 2006 about
printf declaration. In my case, I want to insert fprintf(stderr,
...) calls. I'm new to LLVM, and I don't know what's the recipe for
putting together the arguments. Can someone give me basic
instructions or point me in the direction on what to do? I can't find
any more documentation on this. Thanks!
Another question in reference to Ryan's post, can someone explain the
purpose of this code, in particular the last 4 lines? Are the
duplicate lines intentional?
/* m is Module*, f is Function*, i is Instruction* */
Constant* constStr = ConstantArray::get("test\n");
GlobalVariable* gv = new GlobalVariable
(constStr->getType(), true, GlobalValue::InternalLinkage, constStr,
"", m);
std::vector<Constant*> geplist;
geplist.push_back(ConstantUInt::get(Type::UIntTy,0));
geplist.push_back(ConstantUInt::get(Type::UIntTy,0));
Constant* gep = ConstantExpr::getGetElementPtr(gv,geplist);
--
Jerry Hom
More information about the llvm-dev
mailing list