blob: e7182a919bfb8121fdf2f1be9f14479efe01bc45 [file] [log] [blame]
* Copyright (C) 2011 The Android Open Source Project
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* See the License for the specific language governing permissions and
* limitations under the License.
#include "jni.h"
#include <string>
#include <vector>
#include "base/timing_logger.h"
#include "invoke_type.h"
#include "safe_map.h"
#include "utils/arena_allocator.h"
#include "utils/scoped_arena_allocator.h"
namespace art {
class Backend;
class ClassLinker;
class CompilerDriver;
class MIRGraph;
struct CompilationUnit {
CompilationUnit(ArenaPool* pool, InstructionSet isa, CompilerDriver* driver, ClassLinker* linker);
void StartTimingSplit(const char* label);
void NewTimingSplit(const char* label);
void EndTiming();
* Fields needed/generated by common frontend and generally used throughout
* the compiler.
CompilerDriver* const compiler_driver;
ClassLinker* const class_linker; // Linker to resolve fields and methods.
const DexFile* dex_file; // DexFile containing the method being compiled.
jobject class_loader; // compiling method's class loader.
uint16_t class_def_idx; // compiling method's defining class definition index.
uint32_t method_idx; // compiling method's index into method_ids of DexFile.
uint32_t access_flags; // compiling method's access flags.
InvokeType invoke_type; // compiling method's invocation type.
const char* shorty; // compiling method's shorty.
uint32_t disable_opt; // opt_control_vector flags.
uint32_t enable_debug; // debugControlVector flags.
bool verbose;
const InstructionSet instruction_set;
const bool target64;
// TODO: move memory management to mir_graph, or just switch to using standard containers.
ArenaAllocator arena;
ArenaStack arena_stack; // Arenas for ScopedArenaAllocator.
std::unique_ptr<MIRGraph> mir_graph; // MIR container.
std::unique_ptr<Backend> cg; // Target-specific codegen.
TimingLogger timings;
bool print_pass; // Do we want to print a pass or not?
* @brief Holds pass options for current pass being applied to compilation unit.
* @details This is updated for every pass to contain the overridden pass options
* that were specified by user. The pass itself will check this to see if the
* default settings have been changed. The key is simply the option string without
* the pass name.
SafeMap<const std::string, int> overridden_pass_options;
} // namespace art