Chris Lattner
2003-May-08 14:46 UTC
[LLVMdev] New support for variable argument functions & intrinsic functions
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/
Maybe Matching Threads
- [LLVMdev] [PATCH] LangRef: va_arg doesn't work on X86_64; update example
- [LLVMdev] llvm-gcc 4.0 question
- [RFC] The future of the va_arg instruction
- [LLVMdev] Declaration of a va_list should be an intrinsic?
- [LLVMdev] Declaration of a va_list should be an intrinsic?