Beginning of LLVM backend for ART.
Change-Id: I03466aed94670ac72d489ebc6e34d7ee1c9c857e
diff --git a/src/compiler.cc b/src/compiler.cc
index b1a7066..35108bb 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -34,12 +34,18 @@
#include "stl_util.h"
#include "timing_logger.h"
+#if defined(ART_USE_LLVM_COMPILER)
+#include "compiler_llvm/compiler_llvm.h"
+#endif
+
namespace art {
+#if !defined(ART_USE_LLVM_COMPILER)
CompiledMethod* oatCompileMethod(Compiler& compiler, const DexFile::CodeItem* code_item,
uint32_t access_flags, uint32_t method_idx,
const ClassLoader* class_loader,
const DexFile& dex_file, InstructionSet);
+#endif
namespace arm {
ByteArray* CreateAbstractMethodErrorStub();
@@ -172,7 +178,12 @@
compiled_invoke_stubs_lock_("compiled invoke stubs lock"),
image_(image),
thread_count_(thread_count),
- image_classes_(image_classes) {
+ image_classes_(image_classes)
+#if defined(ART_USE_LLVM_COMPILER)
+ ,
+ compiler_llvm_(new compiler_llvm::CompilerLLVM(this, instruction_set))
+#endif
+ {
CHECK(!Runtime::Current()->IsStarted());
if (!image_) {
CHECK(image_classes_ == NULL);
@@ -293,6 +304,9 @@
void Compiler::PostCompile(const ClassLoader* class_loader,
const std::vector<const DexFile*>& dex_files) {
SetGcMaps(class_loader, dex_files);
+#if defined(ART_USE_LLVM_COMPILER)
+ compiler_llvm_->MaterializeLLVMModule();
+#endif
SetCodeAndDirectMethods(dex_files);
}
@@ -914,8 +928,14 @@
CHECK(compiled_method != NULL);
} else if ((access_flags & kAccAbstract) != 0) {
} else {
+#if defined(ART_USE_LLVM_COMPILER)
+ compiled_method =
+ compiler_llvm_->CompileDexMethod(code_item, access_flags, method_idx,
+ class_loader, dex_file);
+#else
compiled_method = oatCompileMethod(*this, code_item, access_flags, method_idx, class_loader,
dex_file, kThumb2);
+#endif
CHECK(compiled_method != NULL) << PrettyMethod(method_idx, dex_file);
}
uint64_t duration_ns = NanoTime() - start_ns;