Andreas Gampe | 53c913b | 2014-08-12 23:19:23 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 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 "compiler_ir.h" |
| 18 | |
Andreas Gampe | 0b9203e | 2015-01-22 20:39:27 -0800 | [diff] [blame] | 19 | #include "arch/instruction_set_features.h" |
Ian Rogers | c7dd295 | 2014-10-21 23:31:19 -0700 | [diff] [blame] | 20 | #include "base/dumpable.h" |
Andreas Gampe | 0b9203e | 2015-01-22 20:39:27 -0800 | [diff] [blame] | 21 | #include "dex_flags.h" |
Andreas Gampe | 9c46208 | 2015-01-27 14:31:40 -0800 | [diff] [blame] | 22 | #include "dex/quick/mir_to_lir.h" |
Andreas Gampe | 0b9203e | 2015-01-22 20:39:27 -0800 | [diff] [blame] | 23 | #include "driver/compiler_driver.h" |
Andreas Gampe | 53c913b | 2014-08-12 23:19:23 -0700 | [diff] [blame] | 24 | #include "mir_graph.h" |
| 25 | |
| 26 | namespace art { |
| 27 | |
Andreas Gampe | 0b9203e | 2015-01-22 20:39:27 -0800 | [diff] [blame] | 28 | CompilationUnit::CompilationUnit(ArenaPool* pool, InstructionSet isa, CompilerDriver* driver, |
| 29 | ClassLinker* linker) |
| 30 | : compiler_driver(driver), |
| 31 | class_linker(linker), |
Andreas Gampe | 53c913b | 2014-08-12 23:19:23 -0700 | [diff] [blame] | 32 | dex_file(nullptr), |
| 33 | class_loader(nullptr), |
| 34 | class_def_idx(0), |
| 35 | method_idx(0), |
Andreas Gampe | 53c913b | 2014-08-12 23:19:23 -0700 | [diff] [blame] | 36 | access_flags(0), |
| 37 | invoke_type(kDirect), |
| 38 | shorty(nullptr), |
| 39 | disable_opt(0), |
| 40 | enable_debug(0), |
| 41 | verbose(false), |
Andreas Gampe | 0b9203e | 2015-01-22 20:39:27 -0800 | [diff] [blame] | 42 | instruction_set(isa), |
| 43 | target64(Is64BitInstructionSet(isa)), |
Andreas Gampe | 53c913b | 2014-08-12 23:19:23 -0700 | [diff] [blame] | 44 | arena(pool), |
| 45 | arena_stack(pool), |
| 46 | mir_graph(nullptr), |
| 47 | cg(nullptr), |
| 48 | timings("QuickCompiler", true, false), |
| 49 | print_pass(false) { |
| 50 | } |
| 51 | |
| 52 | CompilationUnit::~CompilationUnit() { |
Razvan A Lupusoru | bd25d4b | 2014-07-02 18:16:51 -0700 | [diff] [blame] | 53 | overridden_pass_options.clear(); |
Andreas Gampe | 53c913b | 2014-08-12 23:19:23 -0700 | [diff] [blame] | 54 | } |
| 55 | |
| 56 | void CompilationUnit::StartTimingSplit(const char* label) { |
| 57 | if (compiler_driver->GetDumpPasses()) { |
| 58 | timings.StartTiming(label); |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | void CompilationUnit::NewTimingSplit(const char* label) { |
| 63 | if (compiler_driver->GetDumpPasses()) { |
| 64 | timings.EndTiming(); |
| 65 | timings.StartTiming(label); |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | void CompilationUnit::EndTiming() { |
| 70 | if (compiler_driver->GetDumpPasses()) { |
| 71 | timings.EndTiming(); |
| 72 | if (enable_debug & (1 << kDebugTimings)) { |
| 73 | LOG(INFO) << "TIMINGS " << PrettyMethod(method_idx, *dex_file); |
| 74 | LOG(INFO) << Dumpable<TimingLogger>(timings); |
| 75 | } |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | } // namespace art |