This patch enables reading llvm bytecodes from PCH file. Applied. - Devang > > Index: llvm.h > =================================================================== > --- llvm.h (revision 123555) > +++ llvm.h (working copy) > @@ -83,6 +83,9 @@ void print_llvm(FILE *file, void *LLVM); > /* Init pch writing. */ > void llvm_pch_write_init(void); > +/* Read bytecodes from PCH file. */ > +void llvm_pch_read(void); > + > /* llvm_asm_file_start - Start the .s file. */ > void llvm_asm_file_start(void); > Index: llvm-backend.cpp > =================================================================== > --- llvm-backend.cpp (revision 123555) > +++ llvm-backend.cpp (working copy) > @@ -32,6 +32,7 @@ Software Foundation, 59 Temple Place - S > #include "llvm/Assembly/Writer.h" > #include "llvm/Assembly/PrintModulePass.h" > #include "llvm/Bytecode/WriteBytecodePass.h" > +#include "llvm/Bytecode/Reader.h" > #include "llvm/CodeGen/RegAllocRegistry.h" > #include "llvm/CodeGen/SchedulerRegistry.h" > #include "llvm/CodeGen/ScheduleDAG.h" > @@ -184,6 +185,21 @@ void llvm_lang_dependent_init(const char > oFILEstream *AsmOutStream = 0; > +void llvm_pch_read(void) { > + > + if (TheModule) > + delete TheModule; > + > + fclose (asm_out_file); > + std::string ErrMsg; > + TheModule = ParseBytecodeFile(asm_file_name, &ErrMsg); > + if (!TheModule) { > + cerr << "Error reading bytecodes from PCH file\n"; > + cerr << ErrMsg << "\n"; > + exit(1); > + } > +} > + > // Initialize PCH writing. > void llvm_pch_write_init(void) { > timevar_push(TV_LLVM_INIT); > Index: c-pch.c > =================================================================== > --- c-pch.c (revision 123555) > +++ c-pch.c (working copy) > @@ -429,6 +429,12 @@ c_common_read_pch (cpp_reader *pfile, co > written += size; > } > free (buf); > + /* APPLE LOCAL begin LLVM */ > +#ifdef ENABLE_LLVM > + llvm_pch_read(); > +#endif > + /* APPLE LOCAL end LLVM */ > + > } > else > { > @@ -438,6 +444,7 @@ c_common_read_pch (cpp_reader *pfile, co > cpp_errno (pfile, CPP_DL_ERROR, "seeking"); > } > + > cpp_prepare_state (pfile, &smd); > gt_pch_restore (f); > Index: llvm-linker-hack.cpp > =================================================================== > --- llvm-linker-hack.cpp (revision 123555) > +++ llvm-linker-hack.cpp (working copy) > @@ -26,6 +26,7 @@ Software Foundation, 59 Temple Place - S > #include "llvm/Analysis/LoadValueNumbering.h" > #include "llvm/Transforms/IPO.h" > #include "llvm/Bytecode/Writer.h" > +#include "llvm/Bytecode/Reader.h" > #include "llvm/CodeGen/ScheduleDAG.h" > #include "llvm/CodeGen/Passes.h" > #include "llvm/Support/Streams.h" > @@ -41,6 +42,7 @@ void dummy_function() { > new llvm::ExistingModuleProvider(0); > llvm::createVerifierPass(); > llvm::WriteBytecodeToFile(0, llvm::cout); > + llvm::ParseBytecodeFile(NULL,NULL); > llvm::createInstructionCombiningPass(); > llvm::createScalarReplAggregatesPass(); > Index: Makefile.in > =================================================================== > --- Makefile.in (revision 123555) > +++ Makefile.in (working copy) > @@ -1069,7 +1069,7 @@ endif > # We use llvm-config to determine the libraries that we need to > link in our > # target, optimizations analyses and the bcwriter. > -LLVMCOMPONENTS := $(LLVMTARGETOBJ) scalaropts transformutils > analysis bcwriter ipo > +LLVMCOMPONENTS := $(LLVMTARGETOBJ) scalaropts transformutils > analysis bcwriter ipo bcreader > LLVMLIBFILES := $(shell $(LLVMBINPATH)/llvm-config --libfiles $ > (LLVMCOMPONENTS)) > LLVMLDFLAGS := $(shell $(LLVMBINPATH)/llvm-config --ldflags) > LIBS += $(LLVMLDFLAGS) > [dp5.apple.com:/Volumes/src/llvm-gcc/gcc]$ >
_______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits