diff options
Diffstat (limited to 'compiler/optimizing/graph_visualizer.cc')
| -rw-r--r-- | compiler/optimizing/graph_visualizer.cc | 73 |
1 files changed, 36 insertions, 37 deletions
diff --git a/compiler/optimizing/graph_visualizer.cc b/compiler/optimizing/graph_visualizer.cc index fe47f7db7d..3084a4ff2b 100644 --- a/compiler/optimizing/graph_visualizer.cc +++ b/compiler/optimizing/graph_visualizer.cc @@ -98,7 +98,9 @@ typedef Disassembler* create_disasm_prototype(InstructionSet instruction_set, DisassemblerOptions* options); class HGraphVisualizerDisassembler { public: - HGraphVisualizerDisassembler(InstructionSet instruction_set, const uint8_t* base_address) + HGraphVisualizerDisassembler(InstructionSet instruction_set, + const uint8_t* base_address, + const uint8_t* end_address) : instruction_set_(instruction_set), disassembler_(nullptr) { libart_disassembler_handle_ = dlopen(kIsDebugBuild ? "libartd-disassembler.so" : "libart-disassembler.so", RTLD_NOW); @@ -119,6 +121,7 @@ class HGraphVisualizerDisassembler { instruction_set, new DisassemblerOptions(/* absolute_addresses */ false, base_address, + end_address, /* can_read_literals */ true))); } @@ -174,7 +177,9 @@ class HGraphVisualizerPrinter : public HGraphDelegateVisitor { disassembler_(disasm_info_ != nullptr ? new HGraphVisualizerDisassembler( codegen_.GetInstructionSet(), - codegen_.GetAssembler().CodeBufferBaseAddress()) + codegen_.GetAssembler().CodeBufferBaseAddress(), + codegen_.GetAssembler().CodeBufferBaseAddress() + + codegen_.GetAssembler().CodeSize()) : nullptr), indent_(0) {} @@ -389,6 +394,11 @@ class HGraphVisualizerPrinter : public HGraphDelegateVisitor { << instance_of->MustDoNullCheck() << std::noboolalpha; } + void VisitArrayLength(HArrayLength* array_length) OVERRIDE { + StartAttributeStream("is_string_length") << std::boolalpha + << array_length->IsStringLength() << std::noboolalpha; + } + void VisitArraySet(HArraySet* array_set) OVERRIDE { StartAttributeStream("value_can_be_null") << std::boolalpha << array_set->GetValueCanBeNull() << std::noboolalpha; @@ -487,12 +497,13 @@ class HGraphVisualizerPrinter : public HGraphDelegateVisitor { void PrintInstruction(HInstruction* instruction) { output_ << instruction->DebugName(); - if (instruction->InputCount() > 0) { - StringList inputs; - for (HInputIterator it(instruction); !it.Done(); it.Advance()) { - inputs.NewEntryStream() << GetTypeId(it.Current()->GetType()) << it.Current()->GetId(); + auto&& inputs = instruction->GetInputs(); + if (!inputs.empty()) { + StringList input_list; + for (const HInstruction* input : inputs) { + input_list.NewEntryStream() << GetTypeId(input->GetType()) << input->GetId(); } - StartAttributeStream() << inputs; + StartAttributeStream() << input_list; } instruction->Accept(this); if (instruction->HasEnvironment()) { @@ -534,36 +545,29 @@ class HGraphVisualizerPrinter : public HGraphDelegateVisitor { StartAttributeStream("liveness") << instruction->GetLifetimePosition(); LocationSummary* locations = instruction->GetLocations(); if (locations != nullptr) { - StringList inputs; - for (size_t i = 0; i < instruction->InputCount(); ++i) { - DumpLocation(inputs.NewEntryStream(), locations->InAt(i)); + StringList input_list; + for (size_t i = 0, e = locations->GetInputCount(); i < e; ++i) { + DumpLocation(input_list.NewEntryStream(), locations->InAt(i)); } std::ostream& attr = StartAttributeStream("locations"); - attr << inputs << "->"; + attr << input_list << "->"; DumpLocation(attr, locations->Out()); } } - if (IsPass(LICM::kLoopInvariantCodeMotionPassName) - || IsPass(HDeadCodeElimination::kFinalDeadCodeEliminationPassName) - || IsPass(HDeadCodeElimination::kInitialDeadCodeEliminationPassName) - || IsPass(BoundsCheckElimination::kBoundsCheckEliminationPassName) - || IsPass(RegisterAllocator::kRegisterAllocatorPassName) - || IsPass(HGraphBuilder::kBuilderPassName)) { - HLoopInformation* info = instruction->GetBlock()->GetLoopInformation(); - if (info == nullptr) { - StartAttributeStream("loop") << "none"; + HLoopInformation* loop_info = instruction->GetBlock()->GetLoopInformation(); + if (loop_info == nullptr) { + StartAttributeStream("loop") << "none"; + } else { + StartAttributeStream("loop") << "B" << loop_info->GetHeader()->GetBlockId(); + HLoopInformation* outer = loop_info->GetPreHeader()->GetLoopInformation(); + if (outer != nullptr) { + StartAttributeStream("outer_loop") << "B" << outer->GetHeader()->GetBlockId(); } else { - StartAttributeStream("loop") << "B" << info->GetHeader()->GetBlockId(); - HLoopInformation* outer = info->GetPreHeader()->GetLoopInformation(); - if (outer != nullptr) { - StartAttributeStream("outer_loop") << "B" << outer->GetHeader()->GetBlockId(); - } else { - StartAttributeStream("outer_loop") << "none"; - } - StartAttributeStream("irreducible") - << std::boolalpha << info->IsIrreducible() << std::noboolalpha; + StartAttributeStream("outer_loop") << "none"; } + StartAttributeStream("irreducible") + << std::boolalpha << loop_info->IsIrreducible() << std::noboolalpha; } if ((IsPass(HGraphBuilder::kBuilderPassName) @@ -608,12 +612,7 @@ class HGraphVisualizerPrinter : public HGraphDelegateVisitor { for (HInstructionIterator it(list); !it.Done(); it.Advance()) { HInstruction* instruction = it.Current(); int bci = 0; - size_t num_uses = 0; - for (HUseIterator<HInstruction*> use_it(instruction->GetUses()); - !use_it.Done(); - use_it.Advance()) { - ++num_uses; - } + size_t num_uses = instruction->GetUses().SizeSlow(); AddIndent(); output_ << bci << " " << num_uses << " " << GetTypeId(instruction->GetType()) << instruction->GetId() << " "; @@ -741,8 +740,8 @@ class HGraphVisualizerPrinter : public HGraphDelegateVisitor { HInstruction* instruction = it.Current(); output_ << instruction->GetId() << " " << GetTypeId(instruction->GetType()) << instruction->GetId() << "[ "; - for (HInputIterator inputs(instruction); !inputs.Done(); inputs.Advance()) { - output_ << inputs.Current()->GetId() << " "; + for (const HInstruction* input : instruction->GetInputs()) { + output_ << input->GetId() << " "; } output_ << "]\n"; } |
