[cfe-dev] [PATCH] adding flag for generating va_arg instructions

John Criswell criswell at illinois.edu
Fri Apr 20 10:10:59 PDT 2012


On 4/17/12 9:16 PM, David Lazar wrote:
> This patch is a minor change which adds a flag to generate LLVM's
> va_arg instruction instead of target-specific instructions for
> handling variadic arguments. The flag is called -fuse-llvm-variadics,
> but feel free to pick a better name :-). By default, this flag is
> disabled, which preserves the existing behavior.
>
> This functionality is useful for Clang users who want to do program
> analysis in LLVM in a platform-independent way. Currently, there is no
> way to disable the platform-specific instructions. We needed this
> functionality for our research and we are aware of other groups who
> want this as well.

I'd like to add that this functionality would be useful for projects 
like DSA (a points-to analysis) and SAFECode (a memory safety tool).  
Currently, these tools have platform-specific code in them so that they 
understand the format of the varargs objects generated by the C/C++ 
front-ends.  This prevents them from handling varargs functions in a 
platform-independent way.

For example, DSA has code to understand the x86 and x86_64 varargs 
structures, but it is very conservative for all other platforms.  DSA 
could be more aggressive and platform-independent if it could just 
analyze varargs intrinsics like the ones that LLVM had originally.

-- John T.

>
> Thanks,
> David
>
>
> _______________________________________________
> 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/20120420/143f2944/attachment.html>


More information about the cfe-dev mailing list