summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2014-09-17 18:21:53 +0100
committerNicolas Geoffray <ngeoffray@google.com>2014-09-18 09:10:09 +0100
commitb09aacb495dce2cb3e8469f056fdc2636ae393e6 (patch)
tree9e044d74ec6c7667d2c6684b8c44a7a5db045096 /compiler/optimizing
parent7d029af44c45c56b3b7a271c54434c2dcec1e219 (diff)
downloadart-b09aacb495dce2cb3e8469f056fdc2636ae393e6.zip
art-b09aacb495dce2cb3e8469f056fdc2636ae393e6.tar.gz
art-b09aacb495dce2cb3e8469f056fdc2636ae393e6.tar.bz2
Small fixes to get the boot image compiled in debug mode.
Change-Id: Id697737a1bcfb87f407d707e2ddd4f50a77caf26
Diffstat (limited to 'compiler/optimizing')
-rw-r--r--compiler/optimizing/graph_visualizer.cc25
-rw-r--r--compiler/optimizing/nodes.h3
-rw-r--r--compiler/optimizing/ssa_type_propagation.cc6
3 files changed, 29 insertions, 5 deletions
diff --git a/compiler/optimizing/graph_visualizer.cc b/compiler/optimizing/graph_visualizer.cc
index f011e85..7f64be4 100644
--- a/compiler/optimizing/graph_visualizer.cc
+++ b/compiler/optimizing/graph_visualizer.cc
@@ -81,6 +81,23 @@ class HGraphVisualizerPrinter : public HGraphVisitor {
}
}
+ char GetTypeId(Primitive::Type type) {
+ 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";
@@ -140,7 +157,7 @@ class HGraphVisualizerPrinter : public HGraphVisitor {
if (instruction->InputCount() > 0) {
output_ << " [ ";
for (HInputIterator inputs(instruction); !inputs.Done(); inputs.Advance()) {
- output_ << "v" << inputs.Current()->GetId() << " ";
+ output_ << GetTypeId(inputs.Current()->GetType()) << inputs.Current()->GetId() << " ";
}
output_ << "]";
}
@@ -175,7 +192,8 @@ class HGraphVisualizerPrinter : public HGraphVisitor {
HInstruction* instruction = it.Current();
AddIndent();
int bci = 0;
- output_ << bci << " " << instruction->NumberOfUses() << " v" << instruction->GetId() << " ";
+ output_ << bci << " " << instruction->NumberOfUses()
+ << " " << GetTypeId(instruction->GetType()) << instruction->GetId() << " ";
instruction->Accept(this);
output_ << kEndInstructionMarker << std::endl;
}
@@ -214,7 +232,8 @@ class HGraphVisualizerPrinter : public HGraphVisitor {
for (HInstructionIterator it(block->GetPhis()); !it.Done(); it.Advance()) {
AddIndent();
HInstruction* instruction = it.Current();
- output_ << instruction->GetId() << " v" << instruction->GetId() << "[ ";
+ output_ << instruction->GetId() << " " << GetTypeId(instruction->GetType())
+ << instruction->GetId() << "[ ";
for (HInputIterator inputs(instruction); !inputs.Done(); inputs.Advance()) {
output_ << inputs.Current()->GetId() << " ";
}
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h
index d6dfeae..7298e25 100644
--- a/compiler/optimizing/nodes.h
+++ b/compiler/optimizing/nodes.h
@@ -192,7 +192,8 @@ class HLoopInformation : public ArenaObject {
HLoopInformation(HBasicBlock* header, HGraph* graph)
: header_(header),
back_edges_(graph->GetArena(), kDefaultNumberOfBackEdges),
- blocks_(graph->GetArena(), graph->GetBlocks().Size(), false) {}
+ // Make bit vector growable, as the number of blocks may change.
+ blocks_(graph->GetArena(), graph->GetBlocks().Size(), true) {}
HBasicBlock* GetHeader() const {
return header_;
diff --git a/compiler/optimizing/ssa_type_propagation.cc b/compiler/optimizing/ssa_type_propagation.cc
index 53fa74e..a860cb7 100644
--- a/compiler/optimizing/ssa_type_propagation.cc
+++ b/compiler/optimizing/ssa_type_propagation.cc
@@ -28,7 +28,11 @@ static Primitive::Type MergeTypes(Primitive::Type existing, Primitive::Type new_
case Primitive::kPrimNot:
return existing;
default:
- return new_type;
+ // Phis are initialized with a void type, so if we are asked
+ // to merge with a void type, we should use the existing one.
+ return new_type == Primitive::kPrimVoid
+ ? existing
+ : new_type;
}
}