Shih-wei Liao | d1fec81 | 2012-02-13 09:51:10 -0800 | [diff] [blame^] | 1 | /* |
| 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 | #include "method_compiler.h" |
| 18 | |
| 19 | #include "compiler.h" |
| 20 | #include "ir_builder.h" |
| 21 | #include "logging.h" |
| 22 | #include "object.h" |
| 23 | #include "object_utils.h" |
| 24 | #include "stl_util.h" |
| 25 | |
| 26 | #include <iomanip> |
| 27 | |
| 28 | #include <llvm/Analysis/Verifier.h> |
| 29 | #include <llvm/Function.h> |
| 30 | |
| 31 | using namespace art::compiler_llvm; |
| 32 | |
| 33 | |
| 34 | MethodCompiler::MethodCompiler(art::InstructionSet insn_set, |
| 35 | art::Compiler const* compiler, |
| 36 | art::ClassLinker* class_linker, |
| 37 | art::ClassLoader const* class_loader, |
| 38 | art::DexFile const* dex_file, |
| 39 | art::DexCache* dex_cache, |
| 40 | art::DexFile::CodeItem const* code_item, |
| 41 | uint32_t method_idx, |
| 42 | uint32_t access_flags) |
| 43 | : insn_set_(insn_set), |
| 44 | compiler_(compiler), compiler_llvm_(compiler->GetCompilerLLVM()), |
| 45 | class_linker_(class_linker), class_loader_(class_loader), |
| 46 | dex_file_(dex_file), dex_cache_(dex_cache), code_item_(code_item), |
| 47 | method_(dex_cache->GetResolvedMethod(method_idx)), |
| 48 | method_helper_(method_), method_idx_(method_idx), |
| 49 | access_flags_(access_flags), module_(compiler_llvm_->GetModule()), |
| 50 | context_(compiler_llvm_->GetLLVMContext()), |
| 51 | irb_(*compiler_llvm_->GetIRBuilder()), func_(NULL) { |
| 52 | } |
| 53 | |
| 54 | |
| 55 | MethodCompiler::~MethodCompiler() { |
| 56 | } |
| 57 | |
| 58 | |
| 59 | void MethodCompiler::EmitPrologue() { |
| 60 | // TODO: Not implemented! |
| 61 | } |
| 62 | |
| 63 | |
| 64 | void MethodCompiler::EmitEpilogue() { |
| 65 | } |
| 66 | |
| 67 | |
| 68 | void MethodCompiler::EmitInstruction(uint32_t addr, |
| 69 | art::Instruction const* insn) { |
| 70 | // TODO: Not implemented! |
| 71 | } |
| 72 | |
| 73 | |
| 74 | art::CompiledMethod *MethodCompiler::Compile() { |
| 75 | // TODO: Not implemented! |
| 76 | return new art::CompiledMethod(insn_set_, NULL); |
| 77 | } |