2 * Copyright (C) 2012 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef ART_COMPILER_LLVM_COMPILER_LLVM_H_
18 #define ART_COMPILER_LLVM_COMPILER_LLVM_H_
25 #include "base/macros.h"
27 #include "driver/compiler_driver.h"
28 #include "instruction_set.h"
29 #include "mirror/object.h"
34 class DexCompilationUnit;
55 class LlvmCompilationUnit;
60 CompilerLLVM(CompilerDriver* driver, InstructionSet insn_set);
64 CompilerDriver* GetCompiler() const {
65 return compiler_driver_;
68 InstructionSet GetInstructionSet() const {
72 void SetBitcodeFileName(const std::string& filename) {
73 bitcode_filename_ = filename;
76 CompiledMethod* CompileDexMethod(DexCompilationUnit* dex_compilation_unit,
77 InvokeType invoke_type);
79 CompiledMethod* CompileGBCMethod(DexCompilationUnit* dex_compilation_unit, std::string* func);
81 CompiledMethod* CompileNativeMethod(DexCompilationUnit* dex_compilation_unit);
84 LlvmCompilationUnit* AllocateCompilationUnit();
86 CompilerDriver* const compiler_driver_;
88 const InstructionSet insn_set_;
90 Mutex next_cunit_id_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;
91 size_t next_cunit_id_ GUARDED_BY(next_cunit_id_lock_);
93 std::string bitcode_filename_;
95 DISALLOW_COPY_AND_ASSIGN(CompilerLLVM);
98 void ArtInitCompilerContext(CompilerDriver* driver);
100 void ArtUnInitCompilerContext(CompilerDriver* driver);
102 CompiledMethod* ArtCompileMethod(CompilerDriver* driver, const DexFile::CodeItem* code_item,
103 uint32_t access_flags, InvokeType invoke_type,
104 uint16_t class_def_idx, uint32_t method_idx, jobject class_loader,
105 const DexFile& dex_file);
107 CompiledMethod* ArtLLVMJniCompileMethod(CompilerDriver* driver, uint32_t access_flags,
108 uint32_t method_idx, const DexFile& dex_file);
110 void compilerLLVMSetBitcodeFileName(const CompilerDriver& driver, const std::string& filename);
115 #endif // ART_COMPILER_LLVM_COMPILER_LLVM_H_