i'm afraid this question is extremely basic, but i've assumed that dumping a .bc file from a module was a trivial operation, but now, first time i have to actually do it from code, for the life of me i can't find one missing step in the process: static void WriteModule ( const Module * M, BitstreamWriter & Stream ) http://llvm.org/docs/doxygen/html/BitcodeWriter_8cpp.html#a828cec7a8fed9d232556420efef7ae89 to write that module, first i need a BistreamWriter BitstreamWriter::BitstreamWriter (SmallVectorImpl< char > &O) http://llvm.org/docs/doxygen/html/classllvm_1_1BitstreamWriter.html and for a BitstreamWriter i need a SmallVectorImpl. But, what next? Should i write the content of the SmallVectorImpl byte by byte on a file handler myself? is there a llvm api for this? do i need something else?
On Sun, Dec 16, 2012 at 6:18 PM, charles quarra <charllsnotieneningunputocorreo at gmail.com> wrote:> i'm afraid this question is extremely basic, but i've assumed that > dumping a .bc file from a module was a trivial operation, > […] is there a llvm api for this? do i need something > else?You could just set up a llvm::raw_fd_ostream for the output file and then pass it to llvm::WriteBitcodeToFile [1]. David [1] http://llvm.org/docs/doxygen/html/namespacellvm.html#a979cf64d92322765aef149bc5b002cbb
nevermind, i found how to write to a fd_stream; http://llvm.org/docs/doxygen/html/namespacellvm.html#a979cf64d92322765aef149bc5b002cbb ---------- Forwarded message ---------- From: charles quarra <charllsnotieneningunputocorreo at gmail.com> Date: 2012/12/16 Subject: write module to .bc file To: llvmdev at cs.uiuc.edu i'm afraid this question is extremely basic, but i've assumed that dumping a .bc file from a module was a trivial operation, but now, first time i have to actually do it from code, for the life of me i can't find one missing step in the process: static void WriteModule ( const Module * M, BitstreamWriter & Stream ) http://llvm.org/docs/doxygen/html/BitcodeWriter_8cpp.html#a828cec7a8fed9d232556420efef7ae89 to write that module, first i need a BistreamWriter BitstreamWriter::BitstreamWriter (SmallVectorImpl< char > &O) http://llvm.org/docs/doxygen/html/classllvm_1_1BitstreamWriter.html and for a BitstreamWriter i need a SmallVectorImpl. But, what next? Should i write the content of the SmallVectorImpl byte by byte on a file handler myself? is there a llvm api for this? do i need something else?
Possibly Parallel Threads
- Refactor BitcodeWriter into classes?
- [LLVMdev] [PATCH / PROPOSAL] bitcode encoding that is ~15% smaller for large bitcode files...
- [LLVMdev] [PATCH / PROPOSAL] bitcode encoding that is ~15% smaller for large bitcode files...
- Refactor BitcodeWriter into classes?
- [LLVMdev] Bit-code file input to ld (was: ...From module/bitcode to Mach-O dylib file directly)