blob: 4d7763eab9a215bad9953b3597f49eb807c32224 [file] [log] [blame]
Logan Chien88894ee2012-02-13 16:42:22 +08001/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ART_SRC_COMPILER_LLVM_JNI_COMPILER_H_
18#define ART_SRC_COMPILER_LLVM_JNI_COMPILER_H_
19
20#include "constants.h"
21
22#include <stdint.h>
23
24namespace art {
25 class ClassLinker;
26 class ClassLoader;
27 class CompiledMethod;
28 class Compiler;
29 class DexCache;
30 class DexFile;
31 class Method;
32 class OatCompilationUnit;
33}
34
35namespace llvm {
36 class Function;
37 class FunctionType;
38 class LLVMContext;
39 class Module;
40}
41
42namespace art {
43namespace compiler_llvm {
44
45class CompilerLLVM;
46class IRBuilder;
47
48class JniCompiler {
49 public:
50 JniCompiler(InstructionSet insn_set,
51 Compiler const& compiler,
52 OatCompilationUnit* oat_compilation_unit);
53
54 CompiledMethod* Compile();
55
56 private:
57 void CreateFunction();
58
59 llvm::FunctionType* GetFunctionType(uint32_t method_idx,
60 bool is_static);
61
62 private:
63 InstructionSet insn_set_;
64 Compiler const* compiler_;
65 CompilerLLVM* compiler_llvm_;
66
67 llvm::Module* module_;
68 llvm::LLVMContext* context_;
69 IRBuilder& irb_;
70
71 OatCompilationUnit* oat_compilation_unit_;
72
73 uint32_t access_flags_;
74 uint32_t method_idx_;
75 ClassLinker * class_linker_;
76 ClassLoader const* class_loader_;
77 DexCache const* dex_cache_;
78 DexFile const* dex_file_;
79 Method* method_;
80
81 llvm::Function* func_;
82};
83
84
85} // namespace compiler_llvm
86} // namespace art
87
88
89#endif // ART_SRC_COMPILER_LLVM_JNI_COMPILER_H_