Compile llvm.Module into ELF object file.
Change-Id: I8faf7427944324c9bac12573d217cde2a2e658f1
diff --git a/src/compiler_llvm/compiler_llvm.h b/src/compiler_llvm/compiler_llvm.h
index 29d32a5..208edfc 100644
--- a/src/compiler_llvm/compiler_llvm.h
+++ b/src/compiler_llvm/compiler_llvm.h
@@ -47,6 +47,7 @@
namespace art {
namespace compiler_llvm {
+class CompilationUnit;
class IRBuilder;
class CompilerLLVM {
@@ -55,9 +56,7 @@
~CompilerLLVM();
- void MaterializeLLVMModule();
-
- void WriteBitcodeToFile(std::string const &filename);
+ void MaterializeEveryCompilationUnit();
Compiler* GetCompiler() const {
return compiler_;
@@ -67,16 +66,12 @@
return insn_set_;
}
- llvm::Module* GetModule() const {
- return module_;
+ void SetElfFileName(std::string const& filename) {
+ elf_filename_ = filename;
}
- llvm::LLVMContext* GetLLVMContext() const {
- return context_.get();
- }
-
- IRBuilder* GetIRBuilder() const {
- return irb_.get();
+ void SetBitcodeFileName(std::string const& filename) {
+ bitcode_filename_ = filename;
}
CompiledMethod* CompileDexMethod(OatCompilationUnit* oat_compilation_unit);
@@ -86,17 +81,25 @@
CompiledInvokeStub* CreateInvokeStub(bool is_static, char const *shorty);
private:
+ void EnsureCompilationUnit();
+
+ void MaterializeCompilationUnit();
+
+ void MaterializeCompilationUnitSafePoint();
+
Compiler* compiler_;
Mutex compiler_lock_;
InstructionSet insn_set_;
- UniquePtr<llvm::LLVMContext> context_;
+ UniquePtr<CompilationUnit> cunit_;
- UniquePtr<IRBuilder> irb_;
+ unsigned cunit_counter_;
- llvm::Module* module_;
+ std::string elf_filename_;
+
+ std::string bitcode_filename_;
DISALLOW_COPY_AND_ASSIGN(CompilerLLVM);
};