summaryrefslogtreecommitdiff
path: root/compiler/optimizing/graph_visualizer.cc
diff options
context:
space:
mode:
authorVladimir Marko <vmarko@google.com>2017-09-21 22:50:39 +0100
committerVladimir Marko <vmarko@google.com>2017-09-25 15:45:01 +0100
commit0ebe0d83138bba1996e9c8007969b5381d972b32 (patch)
treea5ee66ebc5b587ade97e56ac8fc7d832fbbed4af /compiler/optimizing/graph_visualizer.cc
parente1e347dace0ded83774999bb26c37527dcdb1d5a (diff)
ART: Introduce compiler data type.
Replace most uses of the runtime's Primitive in compiler with a new class DataType. This prepares for introducing new types, such as Uint8, that the runtime does not need to know about. Test: m test-art-host-gtest Test: testrunner.py --host Bug: 23964345 Change-Id: Iec2ad82454eec678fffcd8279a9746b90feb9b0c
Diffstat (limited to 'compiler/optimizing/graph_visualizer.cc')
-rw-r--r--compiler/optimizing/graph_visualizer.cc30
1 files changed, 6 insertions, 24 deletions
diff --git a/compiler/optimizing/graph_visualizer.cc b/compiler/optimizing/graph_visualizer.cc
index 3035e4657d..194f063d48 100644
--- a/compiler/optimizing/graph_visualizer.cc
+++ b/compiler/optimizing/graph_visualizer.cc
@@ -24,6 +24,7 @@
#include "bounds_check_elimination.h"
#include "builder.h"
#include "code_generator.h"
+#include "data_type-inl.h"
#include "dead_code_elimination.h"
#include "disassembler.h"
#include "inliner.h"
@@ -243,25 +244,6 @@ class HGraphVisualizerPrinter : public HGraphDelegateVisitor {
}
}
- char GetTypeId(Primitive::Type type) {
- // Note that Primitive::Descriptor would not work for us
- // because it does not handle reference types (that is kPrimNot).
- switch (type) {
- case Primitive::kPrimBoolean: return 'z';
- case Primitive::kPrimByte: return 'b';
- case Primitive::kPrimChar: return 'c';
- case Primitive::kPrimShort: return 's';
- case Primitive::kPrimInt: return 'i';
- case Primitive::kPrimLong: return 'j';
- case Primitive::kPrimFloat: return 'f';
- case Primitive::kPrimDouble: return 'd';
- case Primitive::kPrimNot: return 'l';
- case Primitive::kPrimVoid: return 'v';
- }
- LOG(FATAL) << "Unreachable";
- return 'v';
- }
-
void PrintPredecessors(HBasicBlock* block) {
AddIndent();
output_ << "predecessors";
@@ -583,7 +565,7 @@ class HGraphVisualizerPrinter : public HGraphDelegateVisitor {
if (!inputs.empty()) {
StringList input_list;
for (const HInstruction* input : inputs) {
- input_list.NewEntryStream() << GetTypeId(input->GetType()) << input->GetId();
+ input_list.NewEntryStream() << DataType::TypeId(input->GetType()) << input->GetId();
}
StartAttributeStream() << input_list;
}
@@ -597,7 +579,7 @@ class HGraphVisualizerPrinter : public HGraphDelegateVisitor {
for (size_t i = 0, e = environment->Size(); i < e; ++i) {
HInstruction* insn = environment->GetInstructionAt(i);
if (insn != nullptr) {
- vregs.NewEntryStream() << GetTypeId(insn->GetType()) << insn->GetId();
+ vregs.NewEntryStream() << DataType::TypeId(insn->GetType()) << insn->GetId();
} else {
vregs.NewEntryStream() << "_";
}
@@ -654,7 +636,7 @@ class HGraphVisualizerPrinter : public HGraphDelegateVisitor {
if ((IsPass(HGraphBuilder::kBuilderPassName)
|| IsPass(HInliner::kInlinerPassName))
- && (instruction->GetType() == Primitive::kPrimNot)) {
+ && (instruction->GetType() == DataType::Type::kReference)) {
ReferenceTypeInfo info = instruction->IsLoadClass()
? instruction->AsLoadClass()->GetLoadedClassRTI()
: instruction->GetReferenceTypeInfo();
@@ -698,7 +680,7 @@ class HGraphVisualizerPrinter : public HGraphDelegateVisitor {
size_t num_uses = instruction->GetUses().SizeSlow();
AddIndent();
output_ << bci << " " << num_uses << " "
- << GetTypeId(instruction->GetType()) << instruction->GetId() << " ";
+ << DataType::TypeId(instruction->GetType()) << instruction->GetId() << " ";
PrintInstruction(instruction);
output_ << " " << kEndInstructionMarker << "\n";
}
@@ -821,7 +803,7 @@ class HGraphVisualizerPrinter : public HGraphDelegateVisitor {
for (HInstructionIterator it(block->GetPhis()); !it.Done(); it.Advance()) {
AddIndent();
HInstruction* instruction = it.Current();
- output_ << instruction->GetId() << " " << GetTypeId(instruction->GetType())
+ output_ << instruction->GetId() << " " << DataType::TypeId(instruction->GetType())
<< instruction->GetId() << "[ ";
for (const HInstruction* input : instruction->GetInputs()) {
output_ << input->GetId() << " ";