[LLVMdev] Header in bitcode format 3.0?
Samuel Crow
samuraileumas at yahoo.com
Mon May 9 12:56:11 PDT 2011
Hello LLVM team,
In the past I've worked on a PEG parser generator for any LLVM-based language to use. One obstacle we ran into when generating LLVM IR assembly was that we'd end up cutting and pasting a list of declarations and aliases into every .ll file that needed to link with the others. I'd propose that in the Bitcode 3.0 format, that a header definition be added to the IR assembly format using a FoldingSet to make sure that only unique headers are fetched recursively. This would be primarily useful for making the bitcode a true virtual machine instead of just a pure intermediate representation of code written in other languages.
The real reason I'd like to do this is that PNaCl and other projects that are trying to build a target-neutral backend for cross-platform bitcode usage cannot currently implement a target-neutral runtime library without a sandbox running on every platform. If accepted, my proposal would make a much thinner OS abstraction layer of headers that function as link-time substitutions.
I've already started some of the work of abstracting the C runtime library with a project called the LLVM Wrapper found at http://sourceforge.net/projects/llvmlibc/ . At present, file accesses are typecast from FILE * typedefs to byte pointers and back again by a small linker library. When running the link-time optimizer, most of the library just optimizes away into oblivion, leaving equivalent code for x86 on Windows, Mac, and Linux. The caveat for this implementation is that the target triple must be specified in the call to llc. But I digress.
Would such an arrangement be welcome to the LLVM project? If you have any questions, just ask me on the list.
Thanks,
--Sam Crow
More information about the llvm-dev
mailing list