blob: a6cdd9c4c82e94f2b88f711732e91b70aeae66e3 [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
Logan Chien8b977d32012-02-21 19:14:55 +080045class CompilationUnit;
Logan Chien88894ee2012-02-13 16:42:22 +080046class IRBuilder;
47
48class JniCompiler {
49 public:
Logan Chien8b977d32012-02-21 19:14:55 +080050 JniCompiler(CompilationUnit* cunit,
Logan Chien88894ee2012-02-13 16:42:22 +080051 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:
Logan Chien8b977d32012-02-21 19:14:55 +080063 CompilationUnit* cunit_;
Logan Chien88894ee2012-02-13 16:42:22 +080064 Compiler const* compiler_;
Logan Chien88894ee2012-02-13 16:42:22 +080065
66 llvm::Module* module_;
67 llvm::LLVMContext* context_;
68 IRBuilder& irb_;
69
70 OatCompilationUnit* oat_compilation_unit_;
71
72 uint32_t access_flags_;
73 uint32_t method_idx_;
74 ClassLinker * class_linker_;
75 ClassLoader const* class_loader_;
76 DexCache const* dex_cache_;
77 DexFile const* dex_file_;
78 Method* method_;
79
80 llvm::Function* func_;
81};
82
83
84} // namespace compiler_llvm
85} // namespace art
86
87
88#endif // ART_SRC_COMPILER_LLVM_JNI_COMPILER_H_