[LLVMdev] Passing String to an external function in llvm
omnia at mailinator.com
Thu Jul 25 13:45:52 PDT 2013
> OK - seems you might want to take a few steps back & understand how
> C++ code is written/structured generally (and/or take a look at other
> parts of the compiler). You'll need a header file with the declaration
> of your function & you can include that header file in the
> hashtable.cpp and testing.cpp - if that sentence doesn't make sense to
> you yet, please find some general C++ programming resources to provide
> further detail as such a discussion isn't really on-topic here.
I know it could be a bit frustrating for you to answer such foolish
question, but am novice to llvm and desperately need some help to resolve
testing.cpp is an instrumentation file of llvm, whereas hashtable.cpp is
simple c++ code.
I want to insert the function named hashtable() (which is already present in
hashtable.cpp) after every store instruction.
So I have to first DECLARE it, which can be done with getOrInsertFunction()
Now since declaration of function hashtable() is like
void hashtable(string expr) //in hashtable.cpp
So in getOrInsertFunction() I have to pass some more details like
getOrInsertFunction (name of function in IR, Return type of function, List
of argument for the function, etc.)
Type::getVoidTy(M.getContext()), ????, ????,);
Now hashtable() function takes string as an argument, so what should I write
in place of ???? above.
And than how should I actually CALL that hashtable() function with the help
like CallInst::Create, getInstList().insert etc.
View this message in context: http://llvm.1065342.n5.nabble.com/Passing-String-to-an-external-function-in-llvm-tp59798p59818.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.
More information about the llvm-dev