search for: vararg

Displaying 20 results from an estimated 538 matches for "vararg".

Did you mean: va_arg
2007 Sep 13
2
[LLVMdev] assumptions about varargs ABI
Hi, Various parts of LLVM seem to assume that the ABI for a varargs function is compatible with the ABI for a non-varargs function, so that code like this: define void @f(i32 %x) { ... } ... call void (...)* bitcast (void (i32)* @f to void (...)*)(i32 42) will work. (I don't think C guarantees that this will work, at least not in the version of the...
2015 Jan 20
3
[LLVMdev] [INCOMPLETE] [GC] Support wrapping vararg functions in statepoint
Philip Reames wrote: > Any change outside of statepoint lowering is highly suspect. Notice that SelectionDAGBuilder::LowerCallTo (the one I'm modifying) has exactly one other caller: visitCall, which doesn't match vararg functions. Every other codepath directly calls TargetLowering::LowerCallTo, supplying CallLoweringInfo information explicity (it's a structure with a vararg field). I suspect I'm not overloading SelectionDAGBuilder enough. > I'm pretty sure that calling a vararg function through a...
2007 Sep 13
0
[LLVMdev] assumptions about varargs ABI
On Thu, 13 Sep 2007, Jay Foad wrote: > Various parts of LLVM seem to assume that the ABI for a varargs > function is compatible with the ABI for a non-varargs function, so This is due to 'K&R' C function handling. In K&R and ANSI C, you can do stuff like this: void foo(); void bar() { foo(1, 2, 3); } void foo(int a, int b, int c) {} and it needs to work. > (I don...
2008 Sep 05
1
[LLVMdev] missed optimizations
Hi Eli, > That said, clang really should be turning int x2() { return x(0); } > into "define i32 @x2()" rather than "define i32 @x2(...)"; the > function isn't varargs, and marking it as such could lead to wrong > code for exotic calling conventions. I always understood that this is correct per C language specification. For functions that are internal (static), the DeadArgElim pass removes the vararg spec if it's unused, but that's not applicable in t...
2010 Jan 31
3
[LLVMdev] llvm-gcc 4.0 question
...E - D__STDC_LIMIT_MACROS -DNDEBUG -O3 -O2 -m32 -arch ppc -isysroot / Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -fno-omit- frame-pointer -fno-strict-aliasing -fPIC /Users/build/NightlyBuild/ rabbit_main/3rdparty/llvm-2.6-src/projects/test-suite/SingleSource/ UnitTests/2003-05-07-VarArgs.c -lm -o Output/2003-05-07-VarArgs.native /Users/build/NightlyBuild/rabbit_main/3rdparty/llvm-2.6-src/projects/ test-suite/RunSafely.sh -r ppcmac3x104.arxan.com -l build -rc ssh 500 1 /dev/null Output/2003-05-07-VarArgs.out-nat Output/2003-05-07- VarArgs.native /Developer/usr/bin/llvm-gcc -I/U...
2007 Aug 21
0
[LLVMdev] lowering varargs, rewriting types
Hi, I'm looking at writing a custom backend targetting a proprietary virtual machine. I'm basing it on the existing C and MSIL backends. The VM has a defined ABI for varargs functions: the caller allocates some memory to hold the arguments and passes a pointer to this memory as an extra parameter in the call. I'd like to write a varargs lowering pass that represents this ABI explicitly in the LLVM code, replacing varargs intrinsics with explicit operations on poin...
2018 May 22
2
Rewriting calls to varargs functions
Hello, A new patch: https://reviews.llvm.org/D47159 proposes transformations like: printf("Hello, %s %d", "world", 123) - > printf("Hello world 123") As Eli noted: "I'm not sure we can rewrite calls to varargs functions safely in general given the current state of the C ABI rules in LLVM. Sometimes clang does weird things to conform with the ABI rules, because the LLVM type system isn't the same as the C system. For most functions, it's pretty easy to tell it happened: if the IR signature of th...
2013 May 17
2
[LLVMdev] Vararg Intrinsics still supported?
Hi everybody, I checked around examples for vararg intrinsics, but seems like no target or other parts in LLVM use intrinsics with llvm_vararg_ty as an input and adding such an intrinsics gives me a compiler error saying "unhandled MVT in intrinsics!". Are these kind of intrinsics still supported into LLVM? Cheers, Marcello
2018 May 22
0
Rewriting calls to varargs functions
...ubstitute all of the arguments, then you can turn this into a call to puts. In any case , why do you want to do this? Also, doesn't the formatting used by printf depend on the process's current locale?  -Hal > > As Eli noted: > > "I'm not sure we can rewrite calls to varargs functions safely in > general given the current state of the C ABI rules in LLVM. > > Sometimes clang does weird things to conform with the ABI rules, > because the LLVM type system isn't the same as the C system. For most > functions, it's pretty easy to tell it happened: i...
2010 Apr 23
2
[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 thi...
2013 May 17
0
[LLVMdev] Vararg Intrinsics still supported?
Hi Marcello, > I checked around examples for vararg intrinsics, but seems like no target or > other parts in LLVM use intrinsics with llvm_vararg_ty as an input and adding > such an intrinsics gives me a compiler error saying "unhandled MVT in intrinsics!". > > Are these kind of intrinsics still supported into LLVM? LLVM never...
2005 Jun 17
1
[LLVMdev] varargs heads up
Sometime this weekend (or today) vararg support will change. vanext will go away, and the intrinsic signatures will change. Backwards compatibility code will be included so front ends won't need to change initially (after that code is tested, then we will upgrade llvm-gcc). What should work after the transition: All Pattern based...
2018 May 22
4
Rewriting calls to varargs functions
...then you > can turn this into a call to puts. > > In any case , why do you want to do this? Also, doesn't the formatting > used by printf depend on the process's current locale? > > -Hal > > > As Eli noted: > > "I'm not sure we can rewrite calls to varargs functions safely in general > given the current state of the C ABI rules in LLVM. > > Sometimes clang does weird things to conform with the ABI rules, because > the LLVM type system isn't the same as the C system. For most functions, > it's pretty easy to tell it happened: i...
2014 Sep 02
2
[LLVMdev] PSA: Perfectly forwarding thunks can now be expressed in LLVM IR with musttail and varargs
...al applications. You can do it like this: define i32 @my_forwarding_thunk(i32 %arg1, i8* %arg2, ...) { ... ; define new_arg1 and new_arg2 %r = musttail call i32 (i32, i8*, ...)* @the_true_target(i32 %new_arg1, i8* %new_arg2, ...) ret i32 %r } declare i32 @the_true_target(i32, i8*, ...) The varargs convention (usually) matches the standard function call convention, and everything will line up if you do an indirect call like this: declare i32 @the_true_target(%struct.Foo* %this, i64, i8) define i32 @my_forwarding_thunk(%struct.Foo* %this, ...) { %fptr = ... ; Compute fptr by bitcasting @th...
2013 Oct 07
2
[LLVMdev] [lld] Verifying the Architecture of files read
...re at codeaurora.org>wrote: > >> Hi, >> >> It is needed that lld verifies the input to the linker. >> >> For example : a x86 ELF file can be given to lld when the target is >> x86_64. Similiarly with other flavors. >> >> I was thinking to have a varargs function in the LinkingContext that would >> be overridden by each of the LinkingContexts to verify files after being >> read. >> >> The reader would call the varargs function in the LinkingContext and raise >> an error if the input is not suitable with the current li...
2013 Oct 05
5
[LLVMdev] [lld] Verifying the Architecture of files read
Hi, It is needed that lld verifies the input to the linker. For example : a x86 ELF file can be given to lld when the target is x86_64. Similiarly with other flavors. I was thinking to have a varargs function in the LinkingContext that would be overridden by each of the LinkingContexts to verify files after being read. The reader would call the varargs function in the LinkingContext and raise an error if the input is not suitable with the current link mode. Thanks Shankar Easwaran -- Q...
2003 Aug 26
3
[LLVMdev] Seemingly ambiguous parameter lists
LLVMers, And while we're on the subject to the type definitions table, what's the difference between 0e 07 01 00 function returning Int ( Void )? Function returning Int ( ... )? and 0e 07 00 Function returning Int () I'm guessing the former really is a function returning Int ( ... ), but how is the callee supposed to decode the parameter list? I'm an old callee and I
2017 Oct 27
2
Why does LLVm 3.8.0 recognize fputs_unlocked as a vararg function?
Considering F represents the function fputs_unlocked() in an LLVM pass, => F->isVarArg() returns true => F->getNumParams() returns 0 => *F returns declare i32 @fputs_unlocked(...) The signature of fputs_unlocked from man page is: int fputs_unlocked(const char *s, FILE *stream); Can anybody explain why fputs_unlocked() is recognized as a vararg method while it accepts two...
2018 May 22
0
Rewriting calls to varargs functions
...all to puts. > > In any case , why do you want to do this? Also, doesn't the > formatting used by printf depend on the process's current locale? > >  -Hal > >> >> As Eli noted: >> >> "I'm not sure we can rewrite calls to varargs functions safely in >> general given the current state of the C ABI rules in LLVM. >> >> Sometimes clang does weird things to conform with the ABI rules, >> because the LLVM type system isn't the same as the C system. For >> most functions, it'...
2013 Aug 07
0
[LLVMdev] Scheme on LLVM IR
...e this entirely in the front-end? Just decide by fiat that all of your scheme functions will take an extra (hidden to the Scheme users) parameter saying how many args they were given. That's how C++ deals with the implicit "this" parameter for class methods. Then you could either use varargs or bitcast your functions to a reasonable type when used. > Incidentially, the same handling is necessary for return values (any > function can return any number of values, and the caller must check for > correct return value arity). A similar approach could work there, though targets a...