Get PORTABLE + SMALL on x86.
Implemented the portable resolution trampoline and
the portable to interpreter bridge.
Also work on integrating SEA_IR in the PORTABLE+SMALL framework.
Refactor some naming and correct indenting.
Change-Id: Ibd97da5e5b6f5148274c9bff368e3654b661ef51
diff --git a/compiler/sea_ir/ir/sea.cc b/compiler/sea_ir/ir/sea.cc
index 08fe0e1..902839d 100644
--- a/compiler/sea_ir/ir/sea.cc
+++ b/compiler/sea_ir/ir/sea.cc
@@ -386,7 +386,7 @@
scoped_table->CloseScope();
}
-void SeaGraph::GenerateLLVM() {
+CodeGenData* SeaGraph::GenerateLLVM() {
// Pass: Generate LLVM IR.
CodeGenPrepassVisitor code_gen_prepass_visitor;
std::cout << "Generating code..." << std::endl;
@@ -399,9 +399,11 @@
CodeGenPostpassVisitor code_gen_postpass_visitor(code_gen_visitor.GetData());
Accept(&code_gen_postpass_visitor);
code_gen_postpass_visitor.Write(std::string("my_file.llvm"));
+ return code_gen_postpass_visitor.GetData();
}
-void SeaGraph::CompileMethod(const art::DexFile::CodeItem* code_item, uint32_t class_def_idx,
+CodeGenData* SeaGraph::CompileMethod(
+ const art::DexFile::CodeItem* code_item, uint32_t class_def_idx,
uint32_t method_idx, uint32_t method_access_flags, const art::DexFile& dex_file) {
// Two passes: Builds the intermediate structure (non-SSA) of the sea-ir for the function.
BuildMethodSeaGraph(code_item, dex_file, class_def_idx, method_idx, method_access_flags);
@@ -420,7 +422,8 @@
// Pass: type inference
ti_->ComputeTypes(this);
// Pass: Generate LLVM IR.
- GenerateLLVM();
+ CodeGenData* cgd = GenerateLLVM();
+ return cgd;
}
void SeaGraph::ComputeDominanceFrontier() {
diff --git a/compiler/sea_ir/ir/sea.h b/compiler/sea_ir/ir/sea.h
index 0b20ed7..df420ed 100644
--- a/compiler/sea_ir/ir/sea.h
+++ b/compiler/sea_ir/ir/sea.h
@@ -37,6 +37,7 @@
};
class TypeInference;
+class CodeGenData;
class Region;
class InstructionNode;
@@ -260,7 +261,7 @@
public:
static SeaGraph* GetGraph(const art::DexFile&);
- void CompileMethod(const art::DexFile::CodeItem* code_item, uint32_t class_def_idx,
+ CodeGenData* CompileMethod(const art::DexFile::CodeItem* code_item, uint32_t class_def_idx,
uint32_t method_idx, uint32_t method_access_flags, const art::DexFile& dex_file);
// Returns all regions corresponding to this SeaGraph.
std::vector<Region*>* GetRegions() {
@@ -337,7 +338,7 @@
void RenameAsSSA(Region* node, utils::ScopedHashtable<int, InstructionNode*>* scoped_table);
// Generate LLVM IR for the method.
// Precondition: ConvertToSSA().
- void GenerateLLVM();
+ CodeGenData* GenerateLLVM();
static SeaGraph graph_;
std::vector<Region*> regions_;