diff options
author | 2015-09-16 14:33:16 +0000 | |
---|---|---|
committer | 2015-09-16 14:33:16 +0000 | |
commit | fe157012b6d760c275d944ff83e8bea371c59b09 (patch) | |
tree | a2b013dded6e25cab1d3ff5abf09c426904e142c /compiler/optimizing | |
parent | aef880c4b872ccf1a63a3c563cb056ae117fc9c8 (diff) | |
parent | ecc4366670e12b4812ef1653f7c8d52234ca1b1f (diff) |
Merge "Add OptimizingCompilerStats to the CodeGenerator class."
Diffstat (limited to 'compiler/optimizing')
-rw-r--r-- | compiler/optimizing/code_generator.cc | 34 | ||||
-rw-r--r-- | compiler/optimizing/code_generator.h | 12 | ||||
-rw-r--r-- | compiler/optimizing/code_generator_arm.cc | 6 | ||||
-rw-r--r-- | compiler/optimizing/code_generator_arm.h | 3 | ||||
-rw-r--r-- | compiler/optimizing/code_generator_arm64.cc | 6 | ||||
-rw-r--r-- | compiler/optimizing/code_generator_arm64.h | 3 | ||||
-rw-r--r-- | compiler/optimizing/code_generator_mips64.cc | 6 | ||||
-rw-r--r-- | compiler/optimizing/code_generator_mips64.h | 3 | ||||
-rw-r--r-- | compiler/optimizing/code_generator_x86.cc | 8 | ||||
-rw-r--r-- | compiler/optimizing/code_generator_x86.h | 3 | ||||
-rw-r--r-- | compiler/optimizing/code_generator_x86_64.cc | 6 | ||||
-rw-r--r-- | compiler/optimizing/code_generator_x86_64.h | 3 |
12 files changed, 64 insertions, 29 deletions
diff --git a/compiler/optimizing/code_generator.cc b/compiler/optimizing/code_generator.cc index aadf525f26..50108a7275 100644 --- a/compiler/optimizing/code_generator.cc +++ b/compiler/optimizing/code_generator.cc @@ -542,24 +542,33 @@ void CodeGenerator::AllocateLocations(HInstruction* instruction) { } } +void CodeGenerator::MaybeRecordStat(MethodCompilationStat compilation_stat, size_t count) const { + if (stats_ != nullptr) { + stats_->RecordStat(compilation_stat, count); + } +} + CodeGenerator* CodeGenerator::Create(HGraph* graph, InstructionSet instruction_set, const InstructionSetFeatures& isa_features, - const CompilerOptions& compiler_options) { + const CompilerOptions& compiler_options, + OptimizingCompilerStats* stats) { switch (instruction_set) { #ifdef ART_ENABLE_CODEGEN_arm case kArm: case kThumb2: { return new arm::CodeGeneratorARM(graph, - *isa_features.AsArmInstructionSetFeatures(), - compiler_options); + *isa_features.AsArmInstructionSetFeatures(), + compiler_options, + stats); } #endif #ifdef ART_ENABLE_CODEGEN_arm64 case kArm64: { return new arm64::CodeGeneratorARM64(graph, - *isa_features.AsArm64InstructionSetFeatures(), - compiler_options); + *isa_features.AsArm64InstructionSetFeatures(), + compiler_options, + stats); } #endif #ifdef ART_ENABLE_CODEGEN_mips @@ -572,22 +581,25 @@ CodeGenerator* CodeGenerator::Create(HGraph* graph, #ifdef ART_ENABLE_CODEGEN_mips64 case kMips64: { return new mips64::CodeGeneratorMIPS64(graph, - *isa_features.AsMips64InstructionSetFeatures(), - compiler_options); + *isa_features.AsMips64InstructionSetFeatures(), + compiler_options, + stats); } #endif #ifdef ART_ENABLE_CODEGEN_x86 case kX86: { return new x86::CodeGeneratorX86(graph, - *isa_features.AsX86InstructionSetFeatures(), - compiler_options); + *isa_features.AsX86InstructionSetFeatures(), + compiler_options, + stats); } #endif #ifdef ART_ENABLE_CODEGEN_x86_64 case kX86_64: { return new x86_64::CodeGeneratorX86_64(graph, - *isa_features.AsX86_64InstructionSetFeatures(), - compiler_options); + *isa_features.AsX86_64InstructionSetFeatures(), + compiler_options, + stats); } #endif default: diff --git a/compiler/optimizing/code_generator.h b/compiler/optimizing/code_generator.h index 11daf3f111..d2af56a33a 100644 --- a/compiler/optimizing/code_generator.h +++ b/compiler/optimizing/code_generator.h @@ -28,6 +28,7 @@ #include "locations.h" #include "memory_region.h" #include "nodes.h" +#include "optimizing_compiler_stats.h" #include "stack_map_stream.h" namespace art { @@ -144,7 +145,8 @@ class CodeGenerator { static CodeGenerator* Create(HGraph* graph, InstructionSet instruction_set, const InstructionSetFeatures& isa_features, - const CompilerOptions& compiler_options); + const CompilerOptions& compiler_options, + OptimizingCompilerStats* stats = nullptr); virtual ~CodeGenerator() {} HGraph* GetGraph() const { return graph_; } @@ -209,6 +211,8 @@ class CodeGenerator { const CompilerOptions& GetCompilerOptions() const { return compiler_options_; } + void MaybeRecordStat(MethodCompilationStat compilation_stat, size_t count = 1) const; + // Saves the register in the stack. Returns the size taken on stack. virtual size_t SaveCoreRegister(size_t stack_index, uint32_t reg_id) = 0; // Restores the register from the stack. Returns the size taken on stack. @@ -392,7 +396,8 @@ class CodeGenerator { size_t number_of_register_pairs, uint32_t core_callee_save_mask, uint32_t fpu_callee_save_mask, - const CompilerOptions& compiler_options) + const CompilerOptions& compiler_options, + OptimizingCompilerStats* stats) : frame_size_(0), core_spill_mask_(0), fpu_spill_mask_(0), @@ -409,6 +414,7 @@ class CodeGenerator { block_order_(nullptr), is_baseline_(false), disasm_info_(nullptr), + stats_(stats), graph_(graph), compiler_options_(compiler_options), src_map_(nullptr), @@ -503,6 +509,8 @@ class CodeGenerator { void BlockIfInRegister(Location location, bool is_out = false) const; void EmitEnvironment(HEnvironment* environment, SlowPathCode* slow_path); + OptimizingCompilerStats* stats_; + HGraph* const graph_; const CompilerOptions& compiler_options_; diff --git a/compiler/optimizing/code_generator_arm.cc b/compiler/optimizing/code_generator_arm.cc index eefcf7ab93..c3d63b9952 100644 --- a/compiler/optimizing/code_generator_arm.cc +++ b/compiler/optimizing/code_generator_arm.cc @@ -402,7 +402,8 @@ size_t CodeGeneratorARM::RestoreFloatingPointRegister(size_t stack_index, uint32 CodeGeneratorARM::CodeGeneratorARM(HGraph* graph, const ArmInstructionSetFeatures& isa_features, - const CompilerOptions& compiler_options) + const CompilerOptions& compiler_options, + OptimizingCompilerStats* stats) : CodeGenerator(graph, kNumberOfCoreRegisters, kNumberOfSRegisters, @@ -411,7 +412,8 @@ CodeGeneratorARM::CodeGeneratorARM(HGraph* graph, arraysize(kCoreCalleeSaves)), ComputeRegisterMask(reinterpret_cast<const int*>(kFpuCalleeSaves), arraysize(kFpuCalleeSaves)), - compiler_options), + compiler_options, + stats), block_labels_(graph->GetArena(), 0), location_builder_(graph, this), instruction_visitor_(graph, this), diff --git a/compiler/optimizing/code_generator_arm.h b/compiler/optimizing/code_generator_arm.h index 2baac61725..e44209d41b 100644 --- a/compiler/optimizing/code_generator_arm.h +++ b/compiler/optimizing/code_generator_arm.h @@ -231,7 +231,8 @@ class CodeGeneratorARM : public CodeGenerator { public: CodeGeneratorARM(HGraph* graph, const ArmInstructionSetFeatures& isa_features, - const CompilerOptions& compiler_options); + const CompilerOptions& compiler_options, + OptimizingCompilerStats* stats = nullptr); virtual ~CodeGeneratorARM() {} void GenerateFrameEntry() OVERRIDE; diff --git a/compiler/optimizing/code_generator_arm64.cc b/compiler/optimizing/code_generator_arm64.cc index 5094f6761a..377eaf6c40 100644 --- a/compiler/optimizing/code_generator_arm64.cc +++ b/compiler/optimizing/code_generator_arm64.cc @@ -510,14 +510,16 @@ Location InvokeDexCallingConventionVisitorARM64::GetMethodLocation() const { CodeGeneratorARM64::CodeGeneratorARM64(HGraph* graph, const Arm64InstructionSetFeatures& isa_features, - const CompilerOptions& compiler_options) + const CompilerOptions& compiler_options, + OptimizingCompilerStats* stats) : CodeGenerator(graph, kNumberOfAllocatableRegisters, kNumberOfAllocatableFPRegisters, kNumberOfAllocatableRegisterPairs, callee_saved_core_registers.list(), callee_saved_fp_registers.list(), - compiler_options), + compiler_options, + stats), block_labels_(nullptr), location_builder_(graph, this), instruction_visitor_(graph, this), diff --git a/compiler/optimizing/code_generator_arm64.h b/compiler/optimizing/code_generator_arm64.h index 7ebe8842a0..3211a831f6 100644 --- a/compiler/optimizing/code_generator_arm64.h +++ b/compiler/optimizing/code_generator_arm64.h @@ -248,7 +248,8 @@ class CodeGeneratorARM64 : public CodeGenerator { public: CodeGeneratorARM64(HGraph* graph, const Arm64InstructionSetFeatures& isa_features, - const CompilerOptions& compiler_options); + const CompilerOptions& compiler_options, + OptimizingCompilerStats* stats = nullptr); virtual ~CodeGeneratorARM64() {} void GenerateFrameEntry() OVERRIDE; diff --git a/compiler/optimizing/code_generator_mips64.cc b/compiler/optimizing/code_generator_mips64.cc index 8d60026b41..0787e49dda 100644 --- a/compiler/optimizing/code_generator_mips64.cc +++ b/compiler/optimizing/code_generator_mips64.cc @@ -418,7 +418,8 @@ class DeoptimizationSlowPathMIPS64 : public SlowPathCodeMIPS64 { CodeGeneratorMIPS64::CodeGeneratorMIPS64(HGraph* graph, const Mips64InstructionSetFeatures& isa_features, - const CompilerOptions& compiler_options) + const CompilerOptions& compiler_options, + OptimizingCompilerStats* stats) : CodeGenerator(graph, kNumberOfGpuRegisters, kNumberOfFpuRegisters, @@ -427,7 +428,8 @@ CodeGeneratorMIPS64::CodeGeneratorMIPS64(HGraph* graph, arraysize(kCoreCalleeSaves)), ComputeRegisterMask(reinterpret_cast<const int*>(kFpuCalleeSaves), arraysize(kFpuCalleeSaves)), - compiler_options), + compiler_options, + stats), block_labels_(graph->GetArena(), 0), location_builder_(graph, this), instruction_visitor_(graph, this), diff --git a/compiler/optimizing/code_generator_mips64.h b/compiler/optimizing/code_generator_mips64.h index 5433b751b1..c7548388d1 100644 --- a/compiler/optimizing/code_generator_mips64.h +++ b/compiler/optimizing/code_generator_mips64.h @@ -220,7 +220,8 @@ class CodeGeneratorMIPS64 : public CodeGenerator { public: CodeGeneratorMIPS64(HGraph* graph, const Mips64InstructionSetFeatures& isa_features, - const CompilerOptions& compiler_options); + const CompilerOptions& compiler_options, + OptimizingCompilerStats* stats = nullptr); virtual ~CodeGeneratorMIPS64() {} void GenerateFrameEntry() OVERRIDE; diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc index 9713d6a9c9..c7ddabb5fb 100644 --- a/compiler/optimizing/code_generator_x86.cc +++ b/compiler/optimizing/code_generator_x86.cc @@ -431,7 +431,8 @@ void CodeGeneratorX86::InvokeRuntime(Address entry_point, CodeGeneratorX86::CodeGeneratorX86(HGraph* graph, const X86InstructionSetFeatures& isa_features, - const CompilerOptions& compiler_options) + const CompilerOptions& compiler_options, + OptimizingCompilerStats* stats) : CodeGenerator(graph, kNumberOfCpuRegisters, kNumberOfXmmRegisters, @@ -439,8 +440,9 @@ CodeGeneratorX86::CodeGeneratorX86(HGraph* graph, ComputeRegisterMask(reinterpret_cast<const int*>(kCoreCalleeSaves), arraysize(kCoreCalleeSaves)) | (1 << kFakeReturnRegister), - 0, - compiler_options), + 0, + compiler_options, + stats), block_labels_(graph->GetArena(), 0), location_builder_(graph, this), instruction_visitor_(graph, this), diff --git a/compiler/optimizing/code_generator_x86.h b/compiler/optimizing/code_generator_x86.h index 5e4952ff12..c63634dbeb 100644 --- a/compiler/optimizing/code_generator_x86.h +++ b/compiler/optimizing/code_generator_x86.h @@ -220,7 +220,8 @@ class CodeGeneratorX86 : public CodeGenerator { public: CodeGeneratorX86(HGraph* graph, const X86InstructionSetFeatures& isa_features, - const CompilerOptions& compiler_options); + const CompilerOptions& compiler_options, + OptimizingCompilerStats* stats = nullptr); virtual ~CodeGeneratorX86() {} void GenerateFrameEntry() OVERRIDE; diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc index 43a3e52a7f..82c037a07b 100644 --- a/compiler/optimizing/code_generator_x86_64.cc +++ b/compiler/optimizing/code_generator_x86_64.cc @@ -580,7 +580,8 @@ static constexpr int kNumberOfCpuRegisterPairs = 0; static constexpr Register kFakeReturnRegister = Register(kLastCpuRegister + 1); CodeGeneratorX86_64::CodeGeneratorX86_64(HGraph* graph, const X86_64InstructionSetFeatures& isa_features, - const CompilerOptions& compiler_options) + const CompilerOptions& compiler_options, + OptimizingCompilerStats* stats) : CodeGenerator(graph, kNumberOfCpuRegisters, kNumberOfFloatRegisters, @@ -590,7 +591,8 @@ CodeGeneratorX86_64::CodeGeneratorX86_64(HGraph* graph, | (1 << kFakeReturnRegister), ComputeRegisterMask(reinterpret_cast<const int*>(kFpuCalleeSaves), arraysize(kFpuCalleeSaves)), - compiler_options), + compiler_options, + stats), block_labels_(graph->GetArena(), 0), location_builder_(graph, this), instruction_visitor_(graph, this), diff --git a/compiler/optimizing/code_generator_x86_64.h b/compiler/optimizing/code_generator_x86_64.h index cc1c524e08..522f03649d 100644 --- a/compiler/optimizing/code_generator_x86_64.h +++ b/compiler/optimizing/code_generator_x86_64.h @@ -220,7 +220,8 @@ class CodeGeneratorX86_64 : public CodeGenerator { public: CodeGeneratorX86_64(HGraph* graph, const X86_64InstructionSetFeatures& isa_features, - const CompilerOptions& compiler_options); + const CompilerOptions& compiler_options, + OptimizingCompilerStats* stats = nullptr); virtual ~CodeGeneratorX86_64() {} void GenerateFrameEntry() OVERRIDE; |