blob: 7a5b114c8dcd7c5dab3108da7dd519d437191e89 [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() {
57}
58
59void CompilationUnit::StartTimingSplit(const char* label) {
60 if (compiler_driver->GetDumpPasses()) {
61 timings.StartTiming(label);
62 }
63}
64
65void CompilationUnit::NewTimingSplit(const char* label) {
66 if (compiler_driver->GetDumpPasses()) {
67 timings.EndTiming();
68 timings.StartTiming(label);
69 }
70}
71
72void CompilationUnit::EndTiming() {
73 if (compiler_driver->GetDumpPasses()) {
74 timings.EndTiming();
75 if (enable_debug & (1 << kDebugTimings)) {
76 LOG(INFO) << "TIMINGS " << PrettyMethod(method_idx, *dex_file);
77 LOG(INFO) << Dumpable<TimingLogger>(timings);
78 }
79 }
80}
81
82} // namespace art