blob: d4e1c7e7407d2ff7762042b23d551a02d3b9cfa6 [file] [log] [blame]
Dragos Sbirlea7467ee02013-06-21 09:20:34 -07001
2#include <llvm/Support/Threading.h>
3
4#include "compiler/driver/compiler_driver.h"
5
6
7#include "compiler/llvm/llvm_compilation_unit.h"
8#include "compiler/dex/portable/mir_to_gbc.h"
9
10#include "leb128.h"
11#include "mirror/object.h"
12#include "runtime.h"
13#include "base/logging.h"
14
15#ifdef ART_SEA_IR_MODE
16#include "compiler/sea_ir/sea.h"
17#endif
18
19
20
21
22#ifdef ART_SEA_IR_MODE
23#include "compiler/sea_ir/sea.h"
24namespace art {
25
26static CompiledMethod* CompileMethodWithSeaIr(CompilerDriver& compiler,
27 const CompilerBackend compiler_backend,
28 const DexFile::CodeItem* code_item,
29 uint32_t access_flags, InvokeType invoke_type,
30 uint32_t class_def_idx, uint32_t method_idx,
31 jobject class_loader, const DexFile& dex_file
32#if defined(ART_USE_PORTABLE_COMPILER)
33 , llvm::LlvmCompilationUnit* llvm_compilation_unit
34#endif
35)
36{
37 VLOG(compiler) << "Compiling " << PrettyMethod(method_idx, dex_file) << "...";
38 sea_ir::SeaGraph* sg = sea_ir::SeaGraph::GetCurrentGraph();
39 sg->CompileMethod(code_item, class_def_idx, method_idx, dex_file);
40 sg->DumpSea("/tmp/temp.dot");
41 CHECK(0 && "No SEA compiled function exists yet.");
42 return NULL;
43}
44
45
46CompiledMethod* SeaIrCompileOneMethod(CompilerDriver& compiler,
47 const CompilerBackend backend,
48 const DexFile::CodeItem* code_item,
49 uint32_t access_flags,
50 InvokeType invoke_type,
51 uint32_t class_def_idx,
52 uint32_t method_idx,
53 jobject class_loader,
54 const DexFile& dex_file,
55 llvm::LlvmCompilationUnit* llvm_compilation_unit)
56{
57 return CompileMethodWithSeaIr(compiler, backend, code_item, access_flags, invoke_type, class_def_idx,
58 method_idx, class_loader, dex_file
59#if defined(ART_USE_PORTABLE_COMPILER)
60 , llvm_compilation_unit
61#endif
62
63 );
64}
65
66extern "C" art::CompiledMethod*
67 SeaIrCompileMethod(art::CompilerDriver& compiler,
68 const art::DexFile::CodeItem* code_item,
69 uint32_t access_flags, art::InvokeType invoke_type,
70 uint32_t class_def_idx, uint32_t method_idx, jobject class_loader,
71 const art::DexFile& dex_file)
72{
73 // TODO: check method fingerprint here to determine appropriate backend type. Until then, use build default
74 art::CompilerBackend backend = compiler.GetCompilerBackend();
75 return art::SeaIrCompileOneMethod(compiler, backend, code_item, access_flags, invoke_type,
76 class_def_idx, method_idx, class_loader, dex_file,
77 NULL /* use thread llvm_info */);
78}
79#endif
80
81} // end namespace art