[LLVMdev] New support for variable argument functions & intrinsic functions
Chris Lattner
sabre at nondot.org
Thu May 8 14:46:00 PDT 2003
Two new features are now supported by LLVM:
1. Intrinsic functions. These are a cheap and easy way to extend LLVM
to support target-specific or other useful features without mangling
the LLVM language. If you are interested in this, check out:
http://llvm.cs.uiuc.edu/docs/LangRef.html#intrinsics
The new Function::getIntrinsicID() method and llvm/Intrinsics.h file
defines a simple interface to identify if a function is calling an
intrinsic function and what it is. No LLVM passes should need to be
modified ever to support intrinsic functions (assuming they treat
external functions calls in a conservative fashion).
2. Variable argument handling support. It is now possible to write
printf in LLVM! This is the last big feature that LLVM has been
missing that has prevented it from compiling "any old" C program.
Specifically, support has been added for the C <stdarg.h> header.
This involved the addition of three new intrinsics and a new LLVM
va_arg instruction. These are documented here:
http://llvm.cs.uiuc.edu/docs/LangRef.html#int_varargs
http://llvm.cs.uiuc.edu/docs/LangRef.html#i_va_arg
Support for variable argument functions has been added to LLI, the C
backend, and the X86 JIT. The _new_ C front-end also generates
these correctly. A testcase has been checked in here:
test/Programs/SingleSource/UnitTests/2003-05-07-VarArgs.c
Let me know if you have any questions or concerns.
-Chris
--
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/
More information about the llvm-dev
mailing list