Index: runtime/vm/il_printer.cc |
diff --git a/runtime/vm/il_printer.cc b/runtime/vm/il_printer.cc |
index d2a0121c837e67a4c64621437b99b446ff96c539..1a5fa19e2e8cd78b0351f17b88bead20c221629e 100644 |
--- a/runtime/vm/il_printer.cc |
+++ b/runtime/vm/il_printer.cc |
@@ -75,14 +75,6 @@ void FlowGraphPrinter::PrintInstruction(Instruction* instr) { |
} |
-void FlowGraphPrinter::PrintComputation(Computation* comp) { |
- char str[1000]; |
- BufferFormatter f(str, sizeof(str)); |
- comp->PrintTo(&f); |
- OS::Print("%s", str); |
-} |
- |
- |
void FlowGraphPrinter::PrintTypeCheck(const ParsedFunction& parsed_function, |
intptr_t token_pos, |
Value* value, |
@@ -130,7 +122,7 @@ static void PrintICData(BufferFormatter* f, const ICData& ic_data) { |
} |
-void Computation::PrintTo(BufferFormatter* f) const { |
+void Definition::PrintTo(BufferFormatter* f) const { |
// Do not access 'deopt_id()' as it asserts that the computation can |
// deoptimize. |
f->Print("%s:%d(", DebugName(), deopt_id_); |
@@ -139,7 +131,7 @@ void Computation::PrintTo(BufferFormatter* f) const { |
} |
-void Computation::PrintOperandsTo(BufferFormatter* f) const { |
+void Definition::PrintOperandsTo(BufferFormatter* f) const { |
for (int i = 0; i < InputCount(); ++i) { |
if (i > 0) f->Print(", "); |
if (InputAt(i) != NULL) InputAt(i)->PrintTo(f); |
@@ -147,6 +139,11 @@ void Computation::PrintOperandsTo(BufferFormatter* f) const { |
} |
+void Definition::PrintToVisualizer(BufferFormatter* f) const { |
+ PrintTo(f); |
+} |
+ |
+ |
void Value::PrintTo(BufferFormatter* f) const { |
if (definition()->HasSSATemp()) { |
f->Print("v%d", definition()->ssa_temp_index()); |
@@ -156,12 +153,12 @@ void Value::PrintTo(BufferFormatter* f) const { |
} |
-void ConstantComp::PrintOperandsTo(BufferFormatter* f) const { |
+void ConstantInstr::PrintOperandsTo(BufferFormatter* f) const { |
f->Print("#%s", value().ToCString()); |
} |
-void AssertAssignableComp::PrintOperandsTo(BufferFormatter* f) const { |
+void AssertAssignableInstr::PrintOperandsTo(BufferFormatter* f) const { |
value()->PrintTo(f); |
f->Print(", %s, '%s'%s", |
String::Handle(dst_type().Name()).ToCString(), |
@@ -176,13 +173,13 @@ void AssertAssignableComp::PrintOperandsTo(BufferFormatter* f) const { |
} |
-void AssertBooleanComp::PrintOperandsTo(BufferFormatter* f) const { |
+void AssertBooleanInstr::PrintOperandsTo(BufferFormatter* f) const { |
value()->PrintTo(f); |
f->Print("%s", is_eliminated() ? " eliminated" : ""); |
} |
-void ArgumentDefinitionTestComp::PrintOperandsTo(BufferFormatter* f) const { |
+void ArgumentDefinitionTestInstr::PrintOperandsTo(BufferFormatter* f) const { |
saved_arguments_descriptor()->PrintTo(f); |
f->Print(", ?%s @%d", |
formal_parameter_name().ToCString(), |
@@ -190,7 +187,7 @@ void ArgumentDefinitionTestComp::PrintOperandsTo(BufferFormatter* f) const { |
} |
-void ClosureCallComp::PrintOperandsTo(BufferFormatter* f) const { |
+void ClosureCallInstr::PrintOperandsTo(BufferFormatter* f) const { |
for (intptr_t i = 0; i < ArgumentCount(); ++i) { |
if (i > 0) f->Print(", "); |
ArgumentAt(i)->value()->PrintTo(f); |
@@ -198,7 +195,7 @@ void ClosureCallComp::PrintOperandsTo(BufferFormatter* f) const { |
} |
-void InstanceCallComp::PrintOperandsTo(BufferFormatter* f) const { |
+void InstanceCallInstr::PrintOperandsTo(BufferFormatter* f) const { |
f->Print("%s", function_name().ToCString()); |
for (intptr_t i = 0; i < ArgumentCount(); ++i) { |
f->Print(", "); |
@@ -210,7 +207,7 @@ void InstanceCallComp::PrintOperandsTo(BufferFormatter* f) const { |
} |
-void PolymorphicInstanceCallComp::PrintTo(BufferFormatter* f) const { |
+void PolymorphicInstanceCallInstr::PrintTo(BufferFormatter* f) const { |
f->Print("%s(", DebugName()); |
instance_call()->PrintOperandsTo(f); |
f->Print(") "); |
@@ -218,7 +215,7 @@ void PolymorphicInstanceCallComp::PrintTo(BufferFormatter* f) const { |
} |
-void StrictCompareComp::PrintOperandsTo(BufferFormatter* f) const { |
+void StrictCompareInstr::PrintOperandsTo(BufferFormatter* f) const { |
f->Print("%s, ", Token::Str(kind())); |
left()->PrintTo(f); |
f->Print(", "); |
@@ -226,7 +223,7 @@ void StrictCompareComp::PrintOperandsTo(BufferFormatter* f) const { |
} |
-void EqualityCompareComp::PrintOperandsTo(BufferFormatter* f) const { |
+void EqualityCompareInstr::PrintOperandsTo(BufferFormatter* f) const { |
left()->PrintTo(f); |
f->Print(" %s ", Token::Str(kind())); |
right()->PrintTo(f); |
@@ -236,7 +233,7 @@ void EqualityCompareComp::PrintOperandsTo(BufferFormatter* f) const { |
} |
-void StaticCallComp::PrintOperandsTo(BufferFormatter* f) const { |
+void StaticCallInstr::PrintOperandsTo(BufferFormatter* f) const { |
f->Print("%s ", String::Handle(function().name()).ToCString()); |
for (intptr_t i = 0; i < ArgumentCount(); ++i) { |
if (i > 0) f->Print(", "); |
@@ -245,30 +242,30 @@ void StaticCallComp::PrintOperandsTo(BufferFormatter* f) const { |
} |
-void LoadLocalComp::PrintOperandsTo(BufferFormatter* f) const { |
+void LoadLocalInstr::PrintOperandsTo(BufferFormatter* f) const { |
f->Print("%s lvl:%d", local().name().ToCString(), context_level()); |
} |
-void StoreLocalComp::PrintOperandsTo(BufferFormatter* f) const { |
+void StoreLocalInstr::PrintOperandsTo(BufferFormatter* f) const { |
f->Print("%s, ", local().name().ToCString()); |
value()->PrintTo(f); |
f->Print(", lvl: %d", context_level()); |
} |
-void NativeCallComp::PrintOperandsTo(BufferFormatter* f) const { |
+void NativeCallInstr::PrintOperandsTo(BufferFormatter* f) const { |
f->Print("%s", native_name().ToCString()); |
} |
-void LoadInstanceFieldComp::PrintOperandsTo(BufferFormatter* f) const { |
+void LoadInstanceFieldInstr::PrintOperandsTo(BufferFormatter* f) const { |
f->Print("%s, ", String::Handle(field().name()).ToCString()); |
instance()->PrintTo(f); |
} |
-void StoreInstanceFieldComp::PrintOperandsTo(BufferFormatter* f) const { |
+void StoreInstanceFieldInstr::PrintOperandsTo(BufferFormatter* f) const { |
f->Print("%s, ", String::Handle(field().name()).ToCString()); |
instance()->PrintTo(f); |
f->Print(", "); |
@@ -276,18 +273,18 @@ void StoreInstanceFieldComp::PrintOperandsTo(BufferFormatter* f) const { |
} |
-void LoadStaticFieldComp::PrintOperandsTo(BufferFormatter* f) const { |
+void LoadStaticFieldInstr::PrintOperandsTo(BufferFormatter* f) const { |
f->Print("%s", String::Handle(field().name()).ToCString()); |
} |
-void StoreStaticFieldComp::PrintOperandsTo(BufferFormatter* f) const { |
+void StoreStaticFieldInstr::PrintOperandsTo(BufferFormatter* f) const { |
f->Print("%s, ", String::Handle(field().name()).ToCString()); |
value()->PrintTo(f); |
} |
-void InstanceOfComp::PrintOperandsTo(BufferFormatter* f) const { |
+void InstanceOfInstr::PrintOperandsTo(BufferFormatter* f) const { |
value()->PrintTo(f); |
f->Print(" %s %s", |
negate_result() ? "ISNOT" : "IS", |
@@ -301,7 +298,7 @@ void InstanceOfComp::PrintOperandsTo(BufferFormatter* f) const { |
} |
-void RelationalOpComp::PrintOperandsTo(BufferFormatter* f) const { |
+void RelationalOpInstr::PrintOperandsTo(BufferFormatter* f) const { |
f->Print("%s, ", Token::Str(kind())); |
left()->PrintTo(f); |
f->Print(", "); |
@@ -312,7 +309,7 @@ void RelationalOpComp::PrintOperandsTo(BufferFormatter* f) const { |
} |
-void AllocateObjectComp::PrintOperandsTo(BufferFormatter* f) const { |
+void AllocateObjectInstr::PrintOperandsTo(BufferFormatter* f) const { |
f->Print("%s", Class::Handle(constructor().Owner()).ToCString()); |
for (intptr_t i = 0; i < ArgumentCount(); i++) { |
f->Print(", "); |
@@ -321,7 +318,7 @@ void AllocateObjectComp::PrintOperandsTo(BufferFormatter* f) const { |
} |
-void AllocateObjectWithBoundsCheckComp::PrintOperandsTo( |
+void AllocateObjectWithBoundsCheckInstr::PrintOperandsTo( |
BufferFormatter* f) const { |
f->Print("%s", Class::Handle(constructor().Owner()).ToCString()); |
for (intptr_t i = 0; i < InputCount(); i++) { |
@@ -331,7 +328,7 @@ void AllocateObjectWithBoundsCheckComp::PrintOperandsTo( |
} |
-void CreateArrayComp::PrintOperandsTo(BufferFormatter* f) const { |
+void CreateArrayInstr::PrintOperandsTo(BufferFormatter* f) const { |
for (int i = 0; i < ArgumentCount(); ++i) { |
if (i != 0) f->Print(", "); |
ArgumentAt(i)->value()->PrintTo(f); |
@@ -341,7 +338,7 @@ void CreateArrayComp::PrintOperandsTo(BufferFormatter* f) const { |
} |
-void CreateClosureComp::PrintOperandsTo(BufferFormatter* f) const { |
+void CreateClosureInstr::PrintOperandsTo(BufferFormatter* f) const { |
f->Print("%s", function().ToCString()); |
for (intptr_t i = 0; i < ArgumentCount(); ++i) { |
if (i > 0) f->Print(", "); |
@@ -350,27 +347,27 @@ void CreateClosureComp::PrintOperandsTo(BufferFormatter* f) const { |
} |
-void LoadVMFieldComp::PrintOperandsTo(BufferFormatter* f) const { |
+void LoadVMFieldInstr::PrintOperandsTo(BufferFormatter* f) const { |
value()->PrintTo(f); |
f->Print(", %d", offset_in_bytes()); |
} |
-void StoreVMFieldComp::PrintOperandsTo(BufferFormatter* f) const { |
+void StoreVMFieldInstr::PrintOperandsTo(BufferFormatter* f) const { |
dest()->PrintTo(f); |
f->Print(", %d, ", offset_in_bytes()); |
value()->PrintTo(f); |
} |
-void InstantiateTypeArgumentsComp::PrintOperandsTo(BufferFormatter* f) const { |
+void InstantiateTypeArgumentsInstr::PrintOperandsTo(BufferFormatter* f) const { |
const String& type_args = String::Handle(type_arguments().Name()); |
f->Print("%s, ", type_args.ToCString()); |
instantiator()->PrintTo(f); |
} |
-void ExtractConstructorTypeArgumentsComp::PrintOperandsTo( |
+void ExtractConstructorTypeArgumentsInstr::PrintOperandsTo( |
BufferFormatter* f) const { |
const String& type_args = String::Handle(type_arguments().Name()); |
f->Print("%s, ", type_args.ToCString()); |
@@ -378,19 +375,19 @@ void ExtractConstructorTypeArgumentsComp::PrintOperandsTo( |
} |
-void AllocateContextComp::PrintOperandsTo(BufferFormatter* f) const { |
+void AllocateContextInstr::PrintOperandsTo(BufferFormatter* f) const { |
f->Print("%d", num_context_variables()); |
} |
-void CatchEntryComp::PrintOperandsTo(BufferFormatter* f) const { |
+void CatchEntryInstr::PrintOperandsTo(BufferFormatter* f) const { |
f->Print("%s, %s", |
exception_var().name().ToCString(), |
stacktrace_var().name().ToCString()); |
} |
-void BinarySmiOpComp::PrintOperandsTo(BufferFormatter* f) const { |
+void BinarySmiOpInstr::PrintOperandsTo(BufferFormatter* f) const { |
f->Print("%s, ", Token::Str(op_kind())); |
left()->PrintTo(f); |
f->Print(", "); |
@@ -398,7 +395,7 @@ void BinarySmiOpComp::PrintOperandsTo(BufferFormatter* f) const { |
} |
-void BinaryMintOpComp::PrintOperandsTo(BufferFormatter* f) const { |
+void BinaryMintOpInstr::PrintOperandsTo(BufferFormatter* f) const { |
f->Print("%s, ", Token::Str(op_kind())); |
left()->PrintTo(f); |
f->Print(", "); |
@@ -406,7 +403,7 @@ void BinaryMintOpComp::PrintOperandsTo(BufferFormatter* f) const { |
} |
-void UnboxedDoubleBinaryOpComp::PrintOperandsTo(BufferFormatter* f) const { |
+void UnboxedDoubleBinaryOpInstr::PrintOperandsTo(BufferFormatter* f) const { |
f->Print("%s, ", Token::Str(op_kind())); |
left()->PrintTo(f); |
f->Print(", "); |
@@ -414,13 +411,13 @@ void UnboxedDoubleBinaryOpComp::PrintOperandsTo(BufferFormatter* f) const { |
} |
-void UnarySmiOpComp::PrintOperandsTo(BufferFormatter* f) const { |
+void UnarySmiOpInstr::PrintOperandsTo(BufferFormatter* f) const { |
f->Print("%s, ", Token::Str(op_kind())); |
value()->PrintTo(f); |
} |
-void CheckClassComp::PrintOperandsTo(BufferFormatter* f) const { |
+void CheckClassInstr::PrintOperandsTo(BufferFormatter* f) const { |
value()->PrintTo(f); |
PrintICData(f, unary_checks()); |
} |
@@ -506,19 +503,6 @@ void TargetEntryInstr::PrintTo(BufferFormatter* f) const { |
} |
-void BindInstr::PrintTo(BufferFormatter* f) const { |
- if (!is_used()) { |
- f->Print(" "); |
- } else if (HasSSATemp()) { |
- f->Print(" v%d <- ", ssa_temp_index()); |
- } else { |
- f->Print(" t%d <- ", temp_index()); |
- } |
- computation()->PrintTo(f); |
- PrintPropagatedType(f, *this); |
-} |
- |
- |
void PushArgumentInstr::PrintTo(BufferFormatter* f) const { |
f->Print(" %s ", DebugName()); |
value()->PrintTo(f); |
@@ -554,7 +538,7 @@ void GotoInstr::PrintTo(BufferFormatter* f) const { |
void BranchInstr::PrintTo(BufferFormatter* f) const { |
f->Print(" %s ", DebugName()); |
f->Print("if "); |
- computation()->PrintTo(f); |
+ comparison()->PrintTo(f); |
f->Print(" goto (%d, %d)", |
true_successor()->block_id(), |
@@ -749,18 +733,6 @@ void TargetEntryInstr::PrintToVisualizer(BufferFormatter* f) const { |
} |
-void BindInstr::PrintToVisualizer(BufferFormatter* f) const { |
- if (!is_used()) { |
- f->Print("_ "); |
- } else if (HasSSATemp()) { |
- f->Print("v%d ", ssa_temp_index()); |
- } else { |
- f->Print("t%d ", temp_index()); |
- } |
- computation()->PrintTo(f); |
-} |
- |
- |
void PushArgumentInstr::PrintToVisualizer(BufferFormatter* f) const { |
f->Print("_ %s ", DebugName()); |
value()->PrintTo(f); |
@@ -791,7 +763,7 @@ void GotoInstr::PrintToVisualizer(BufferFormatter* f) const { |
void BranchInstr::PrintToVisualizer(BufferFormatter* f) const { |
f->Print("_ %s ", DebugName()); |
f->Print("if "); |
- computation()->PrintTo(f); |
+ comparison()->PrintTo(f); |
f->Print(" goto (B%d, B%d)", |
true_successor()->block_id(), |
false_successor()->block_id()); |