[cfe-dev] va_arg instruction

Jia Chen jchen at cs.utexas.edu
Sun Jul 19 12:43:19 PDT 2015


Hi clang devs,

I've been writing static analysis on top of LLVM IR for quite some time 
and I rely on clang to get me IRs from C source codes. Functions with 
variadic arguments used to be something I tried to avoid but as my work 
progressed, it seems that a lot of real-world C codes use them so it's 
necessary to teach my analysis to understand them.

If my understanding was correct, currently clang recognizes variadic 
functions in C source code and directly emit IRs that manipulate 
architecture-specific vararg structures, rather than emitting a 
target-independent va_arg instruction. At least on my x86_64 machine, 
this vararg structure consists of two offset fields and two buffer 
pointers and is quite difficult to handle. It would be nice if the front 
end could stop the vararg lowering and just give me a simple va_arg 
instruction instead. Is there a simple tweak I can do to have clang give 
me the va_arg instruction I want? Or do I have to modify clang's source 
code to do that?

-- 
Best Regards,

--
Jia Chen
Department of Computer Science
University of Texas at Austin
jchen at cs.utexas.edu
http://www.cs.utexas.edu/~jchen




More information about the cfe-dev mailing list