[cfe-dev] va_arg instruction

Reid Kleckner rnk at google.com
Mon Jul 20 09:05:12 PDT 2015


Someone else (possibly from your research group!) wanted something similar
a long time ago. They wanted a way to ensure that structs were always
passed in memory using the 'byval' attribute, so that they could more
easily analyze the IR. The proposed solution was to add a target triple and
then compile targeting that. Unfortunately, they didn't get any traction,
so we never added that. That solution also has the downside that you'll
miss code under architecture specific #ifdefs that you might want to
analyze.

Anyway, I can't actually find the relevant email anymore, but searching
"llvmdev defaultabiinfo" turns up a bunch of relevant hits for you.

On Sun, Jul 19, 2015 at 12:43 PM, Jia Chen <jchen at cs.utexas.edu> wrote:

> 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
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150720/4127482d/attachment.html>


More information about the cfe-dev mailing list