summaryrefslogtreecommitdiff
path: root/src/compiler_llvm
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler_llvm')
-rw-r--r--src/compiler_llvm/backend_types.h2
-rw-r--r--src/compiler_llvm/compiler_llvm.cc11
-rw-r--r--src/compiler_llvm/compiler_llvm.h1
-rw-r--r--src/compiler_llvm/frontend.cc20
-rw-r--r--src/compiler_llvm/ir_builder.cc16
-rw-r--r--src/compiler_llvm/ir_builder.h2
-rw-r--r--src/compiler_llvm/libdex.h46
-rw-r--r--src/compiler_llvm/method_compiler.cc38
-rw-r--r--src/compiler_llvm/method_compiler.h39
9 files changed, 74 insertions, 101 deletions
diff --git a/src/compiler_llvm/backend_types.h b/src/compiler_llvm/backend_types.h
index 86b0ea2b8f..bf5a413311 100644
--- a/src/compiler_llvm/backend_types.h
+++ b/src/compiler_llvm/backend_types.h
@@ -115,7 +115,7 @@ inline RegCategory GetRegCategoryFromJType(JType jty) {
return kRegObject;
}
- LOG(FATAL) << "Uknown java type: " << jty;
+ LOG(FATAL) << "Unknown java type: " << jty;
return kRegUnknown;
}
diff --git a/src/compiler_llvm/compiler_llvm.cc b/src/compiler_llvm/compiler_llvm.cc
index c0f5881438..10aaca4adb 100644
--- a/src/compiler_llvm/compiler_llvm.cc
+++ b/src/compiler_llvm/compiler_llvm.cc
@@ -27,8 +27,8 @@
#include <llvm/Module.h>
#include <llvm/Support/ToolOutputFile.h>
-using namespace art;
-using namespace art::compiler_llvm;
+namespace art {
+namespace compiler_llvm {
CompilerLLVM::CompilerLLVM(Compiler* compiler, InstructionSet insn_set)
@@ -49,7 +49,8 @@ CompilerLLVM::~CompilerLLVM() {
void CompilerLLVM::MaterializeLLVMModule() {
#if !defined(NDEBUG)
- // TODO: For device, need to use another temporary path.
+ // TODO: Add options to JNI_CreateJavaVM() and dex2oat, so that we don't
+ // have to hard-code the path.
WriteBitcodeToFile("/tmp/art_llvm_module.bc");
#endif
}
@@ -94,3 +95,7 @@ CompilerLLVM::CompileDexMethod(DexFile::CodeItem const* code_item,
return method_compiler->Compile();
}
+
+
+} // namespace compiler_llvm
+} // namespace art
diff --git a/src/compiler_llvm/compiler_llvm.h b/src/compiler_llvm/compiler_llvm.h
index 74f8ba1c33..0de28f5309 100644
--- a/src/compiler_llvm/compiler_llvm.h
+++ b/src/compiler_llvm/compiler_llvm.h
@@ -29,7 +29,6 @@ namespace art {
class ClassLoader;
class CompiledMethod;
class Compiler;
- class Mutex;
}
diff --git a/src/compiler_llvm/frontend.cc b/src/compiler_llvm/frontend.cc
index d2a4ad4417..7507b2651e 100644
--- a/src/compiler_llvm/frontend.cc
+++ b/src/compiler_llvm/frontend.cc
@@ -14,26 +14,22 @@
* limitations under the License.
*/
-#include "method_compiler.h"
-
-#include "class_linker.h"
-#include "class_loader.h"
-#include "compiler.h"
-#include "constants.h"
#include "dex_file.h"
-#include "runtime.h"
+#include "logging.h"
-#include <UniquePtr.h>
#include <stdint.h>
-using namespace art::compiler_llvm;
-
namespace art {
-int oatVRegOffset(const art::DexFile::CodeItem* code_item,
+int oatVRegOffset(const DexFile::CodeItem* code_item,
uint32_t core_spills, uint32_t fp_spills,
size_t frame_size, int reg) {
- UNIMPLEMENTED(FATAL);
+
+ // TODO: Remove oatVRegOffset() after we have adapted the OatWriter
+ // and OatFile.
+
+ UNIMPLEMENTED(WARNING) << "oatVRegOffset() is not and won't be "
+ << "implemented in LLVM backend";
return 0;
}
diff --git a/src/compiler_llvm/ir_builder.cc b/src/compiler_llvm/ir_builder.cc
index ea773bd5fd..24fac1a46d 100644
--- a/src/compiler_llvm/ir_builder.cc
+++ b/src/compiler_llvm/ir_builder.cc
@@ -18,7 +18,8 @@
#include <llvm/Module.h>
-using namespace art::compiler_llvm;
+namespace art {
+namespace compiler_llvm {
//----------------------------------------------------------------------------
@@ -78,9 +79,13 @@ llvm::Type* IRBuilder::getJTypeInAccurateSpace(JType jty) {
llvm::Type* IRBuilder::getJTypeInRegSpace(JType jty) {
- switch (GetRegCategoryFromJType(jty)) {
+ RegCategory regcat = GetRegCategoryFromJType(jty);
+
+ switch (regcat) {
case kRegUnknown:
case kRegZero:
+ LOG(FATAL) << "Register category \"Unknown\" or \"Zero\" does not have "
+ << "the LLVM type";
return NULL;
case kRegCat1nr:
@@ -93,6 +98,7 @@ llvm::Type* IRBuilder::getJTypeInRegSpace(JType jty) {
return getJObjectTy();
}
+ LOG(FATAL) << "Unknown register category: " << regcat;
return NULL;
}
@@ -100,6 +106,7 @@ llvm::Type* IRBuilder::getJTypeInRegSpace(JType jty) {
llvm::Type* IRBuilder::getJTypeInArraySpace(JType jty) {
switch (jty) {
case kVoid:
+ LOG(FATAL) << "void type should not be used in array type space";
return NULL;
case kBoolean:
@@ -126,5 +133,10 @@ llvm::Type* IRBuilder::getJTypeInArraySpace(JType jty) {
return getJObjectTy();
}
+ LOG(FATAL) << "Unknown java type: " << jty;
return NULL;
}
+
+
+} // namespace compiler_llvm
+} // namespace art
diff --git a/src/compiler_llvm/ir_builder.h b/src/compiler_llvm/ir_builder.h
index 2b4095c190..a88b16da10 100644
--- a/src/compiler_llvm/ir_builder.h
+++ b/src/compiler_llvm/ir_builder.h
@@ -110,6 +110,7 @@ class IRBuilder : public LLVMIRBuilder {
return getJTypeInArraySpace(jty);
}
+ LOG(FATAL) << "Unknown type space: " << space;
return NULL;
}
@@ -201,6 +202,7 @@ class IRBuilder : public LLVMIRBuilder {
llvm::Constant* getJZero(JType jty) {
switch (jty) {
case kVoid:
+ LOG(FATAL) << "Zero is not a value of void type";
return NULL;
case kBoolean:
diff --git a/src/compiler_llvm/libdex.h b/src/compiler_llvm/libdex.h
deleted file mode 100644
index 40668fc46a..0000000000
--- a/src/compiler_llvm/libdex.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ART_SRC_COMPILER_LLVM_LIBDEX_H_
-#define ART_SRC_COMPILER_LLVM_LIBDEX_H_
-
-#include <assert.h>
-
-// From Common.h
-// TODO: remove all these and just use the long names
-typedef uint8_t u1;
-typedef uint16_t u2;
-typedef uint32_t u4;
-typedef uint64_t u8;
-typedef int8_t s1;
-typedef int16_t s2;
-typedef int32_t s4;
-typedef int64_t s8;
-typedef unsigned long long u8;
-
-// Skip old DexFile.h
-#define LIBDEX_DEXFILE_H_
-
-// Skip old vm/Common.h
-#define DALVIK_COMMON_H_
-
-// Make inlines inline
-#define DEX_INLINE inline
-#include "DexOpcodes.h"
-#include "InstrUtils.h"
-
-
-#endif // ART_SRC_COMPILER_LLVM_LIBDEX_H_
diff --git a/src/compiler_llvm/method_compiler.cc b/src/compiler_llvm/method_compiler.cc
index 4aec8b15c7..cf0ea3ec4b 100644
--- a/src/compiler_llvm/method_compiler.cc
+++ b/src/compiler_llvm/method_compiler.cc
@@ -28,16 +28,17 @@
#include <llvm/Analysis/Verifier.h>
#include <llvm/Function.h>
-using namespace art::compiler_llvm;
+namespace art {
+namespace compiler_llvm {
-MethodCompiler::MethodCompiler(art::InstructionSet insn_set,
- art::Compiler const* compiler,
- art::ClassLinker* class_linker,
- art::ClassLoader const* class_loader,
- art::DexFile const* dex_file,
- art::DexCache* dex_cache,
- art::DexFile::CodeItem const* code_item,
+MethodCompiler::MethodCompiler(InstructionSet insn_set,
+ Compiler* compiler,
+ ClassLinker* class_linker,
+ ClassLoader const* class_loader,
+ DexFile const* dex_file,
+ DexCache* dex_cache,
+ DexFile::CodeItem const* code_item,
uint32_t method_idx,
uint32_t access_flags)
: insn_set_(insn_set),
@@ -57,21 +58,26 @@ MethodCompiler::~MethodCompiler() {
void MethodCompiler::EmitPrologue() {
- // TODO: Not implemented!
+ // UNIMPLEMENTED(WARNING);
}
-void MethodCompiler::EmitEpilogue() {
+void MethodCompiler::EmitInstructions() {
+ // UNIMPLEMENTED(WARNING);
}
-void MethodCompiler::EmitInstruction(uint32_t addr,
- art::Instruction const* insn) {
- // TODO: Not implemented!
+void MethodCompiler::EmitInstruction(uint32_t dex_pc,
+ Instruction const* insn) {
+ // UNIMPLEMENTED(WARNING);
}
-art::CompiledMethod *MethodCompiler::Compile() {
- // TODO: Not implemented!
- return new art::CompiledMethod(insn_set_, NULL);
+CompiledMethod *MethodCompiler::Compile() {
+ // UNIMPLEMENTED(WARNING);
+ return new CompiledMethod(insn_set_, NULL);
}
+
+
+} // namespace compiler_llvm
+} // namespace art
diff --git a/src/compiler_llvm/method_compiler.h b/src/compiler_llvm/method_compiler.h
index 2d9f91c771..8d9820a453 100644
--- a/src/compiler_llvm/method_compiler.h
+++ b/src/compiler_llvm/method_compiler.h
@@ -57,19 +57,19 @@ class IRBuilder;
class MethodCompiler {
private:
- art::InstructionSet insn_set_;
- art::Compiler const* compiler_;
- art::compiler_llvm::CompilerLLVM* compiler_llvm_;
+ InstructionSet insn_set_;
+ Compiler* compiler_;
+ compiler_llvm::CompilerLLVM* compiler_llvm_;
- art::ClassLinker* class_linker_;
- art::ClassLoader const* class_loader_;
+ ClassLinker* class_linker_;
+ ClassLoader const* class_loader_;
- art::DexFile const* dex_file_;
- art::DexCache* dex_cache_;
- art::DexFile::CodeItem const* code_item_;
+ DexFile const* dex_file_;
+ DexCache* dex_cache_;
+ DexFile::CodeItem const* code_item_;
- art::Method* method_;
- art::MethodHelper method_helper_;
+ Method* method_;
+ MethodHelper method_helper_;
uint32_t method_idx_;
uint32_t access_flags_;
@@ -80,27 +80,26 @@ class MethodCompiler {
llvm::Function* func_;
public:
- MethodCompiler(art::InstructionSet insn_set,
- art::Compiler const* compiler,
- art::ClassLinker* class_linker,
- art::ClassLoader const* class_loader,
- art::DexFile const* dex_file,
- art::DexCache* dex_cache,
- art::DexFile::CodeItem const* code_item,
+ MethodCompiler(InstructionSet insn_set,
+ Compiler* compiler,
+ ClassLinker* class_linker,
+ ClassLoader const* class_loader,
+ DexFile const* dex_file,
+ DexCache* dex_cache,
+ DexFile::CodeItem const* code_item,
uint32_t method_idx,
uint32_t access_flags);
~MethodCompiler();
- art::CompiledMethod* Compile();
+ CompiledMethod* Compile();
private:
void CreateFunction();
void EmitPrologue();
void EmitInstructions();
- void EmitInstruction(uint32_t addr, art::Instruction const* insn);
- void EmitEpilogue();
+ void EmitInstruction(uint32_t dex_pc, Instruction const* insn);
};