blob: e1d489a0516ee9864bfd771edaf3d4b2ee49d484 [file] [log] [blame]
Andreas Gampe53c913b2014-08-12 23:19:23 -07001/*
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
19#include "backend.h"
20#include "frontend.h"
21#include "mir_graph.h"
22
23namespace art {
24
25CompilationUnit::CompilationUnit(ArenaPool* pool)
26 : compiler_driver(nullptr),
27 class_linker(nullptr),
28 dex_file(nullptr),
29 class_loader(nullptr),
30 class_def_idx(0),
31 method_idx(0),
32 code_item(nullptr),
33 access_flags(0),
34 invoke_type(kDirect),
35 shorty(nullptr),
36 disable_opt(0),
37 enable_debug(0),
38 verbose(false),
39 compiler(nullptr),
40 instruction_set(kNone),
41 target64(false),
42 num_dalvik_registers(0),
43 insns(nullptr),
44 num_ins(0),
45 num_outs(0),
46 num_regs(0),
47 compiler_flip_match(false),
48 arena(pool),
49 arena_stack(pool),
50 mir_graph(nullptr),
51 cg(nullptr),
52 timings("QuickCompiler", true, false),
53 print_pass(false) {
54}
55
56CompilationUnit::~CompilationUnit() {
Razvan A Lupusorubd25d4b2014-07-02 18:16:51 -070057 overridden_pass_options.clear();
Andreas Gampe53c913b2014-08-12 23:19:23 -070058}
59
60void CompilationUnit::StartTimingSplit(const char* label) {
61 if (compiler_driver->GetDumpPasses()) {
62 timings.StartTiming(label);
63 }
64}
65
66void CompilationUnit::NewTimingSplit(const char* label) {
67 if (compiler_driver->GetDumpPasses()) {
68 timings.EndTiming();
69 timings.StartTiming(label);
70 }
71}
72
73void CompilationUnit::EndTiming() {
74 if (compiler_driver->GetDumpPasses()) {
75 timings.EndTiming();
76 if (enable_debug & (1 << kDebugTimings)) {
77 LOG(INFO) << "TIMINGS " << PrettyMethod(method_idx, *dex_file);
78 LOG(INFO) << Dumpable<TimingLogger>(timings);
79 }
80 }
81}
82
83} // namespace art