Patrick Alexander Simmons
2010-Apr-23 23:42 UTC
[LLVMdev] Inserting a varargs function declaration with getOrInsertFunction()?
I need to insert a varargs function declaration from within an LLVM pass. getOrInsertFunction() allows an arbitrary list of type parameters for function arguments to be passed in, but as far as I can tell there is no LLVM "type" to represent the variable-length portion of a function argument list. How is this normally done? --Patrick
Scott Ricketts
2010-Apr-24 00:26 UTC
[LLVMdev] Inserting a varargs function declaration with getOrInsertFunction()?
On Fri, Apr 23, 2010 at 4:42 PM, Patrick Alexander Simmons <simmon12 at cs.uiuc.edu> wrote:> I need to insert a varargs function declaration from within an LLVM > pass. getOrInsertFunction() allows an arbitrary list of type parameters > for function arguments to be passed in, but as far as I can tell there > is no LLVM "type" to represent the variable-length portion of a function > argument list. How is this normally done?I am not sure how it is normally done, but I have used getOrInsertFunction to insert function calls with variable arguments and FunctionType::get to build my function type. Check out DerivedTypes.h and look at the get methods (there are options with isVarArg as a parameter). Scott
Duncan Sands
2010-Apr-25 12:41 UTC
[LLVMdev] Inserting a varargs function declaration with getOrInsertFunction()?
Hi Patrick,> I need to insert a varargs function declaration from within an LLVM > pass. getOrInsertFunction() allows an arbitrary list of type parameters > for function arguments to be passed in, but as far as I can tell there > is no LLVM "type" to represent the variable-length portion of a function > argument list. How is this normally done?when you create a FunctionType you can specify whether it is varargs or not. Ciao, Duncan.
Maybe Matching Threads
- [LLVMdev] Inserting Calls to var args Functions
- [LLVMdev] Calling C-language variadic functions
- [LLVMdev] [INCOMPLETE] [GC] Support wrapping vararg functions in statepoint
- [LLVMdev] insert printf into IR
- [LLVMdev] Duplicate Function with duplicated Arguments