Index: runtime/vm/locations.cc |
diff --git a/runtime/vm/locations.cc b/runtime/vm/locations.cc |
index 7447760c5b180d9c02cd4e3dbc27b961adf6ebf5..c2ba2fedf5efb80ffbf31d8f3ff6ae5a08e7cbbf 100644 |
--- a/runtime/vm/locations.cc |
+++ b/runtime/vm/locations.cc |
@@ -4,6 +4,7 @@ |
#include "vm/locations.h" |
+#include "vm/il_printer.h" |
#include "vm/intermediate_language.h" |
#include "vm/flow_graph_compiler.h" |
@@ -24,5 +25,65 @@ LocationSummary* LocationSummary::Make(intptr_t input_count, |
return summary; |
} |
+ |
+#if defined(TARGET_ARCH_IA32) |
+static const char* cpu_reg_names[kNumberOfCpuRegisters] = { |
+ "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi" |
+}; |
+#elif defined(TARGET_ARCH_X64) |
+static const char* cpu_reg_names[kNumberOfCpuRegisters] = { |
+ "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi", |
+ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15" |
+}; |
+#endif |
+ |
+ |
+const char* Location::Name() const { |
+ switch (kind()) { |
+ case kInvalid: return "?"; |
+ case kRegister: return cpu_reg_names[reg()]; |
+ case kUnallocated: |
+ switch (policy()) { |
+ case kRequiresRegister: |
+ return "R"; |
+ case kSameAsFirstInput: |
+ return "0"; |
+ } |
+ default: |
+ ASSERT(IsConstant()); |
+ return "C"; |
+ } |
+ return "?"; |
+} |
+ |
+ |
+void LocationSummary::PrintTo(BufferFormatter* f) const { |
+ if (input_count() > 0) { |
+ f->Print(" ("); |
+ for (intptr_t i = 0; i < input_count(); i++) { |
+ if (i != 0) f->Print(", "); |
+ f->Print("%s", in(i).Name()); |
+ } |
+ f->Print(")"); |
+ } |
+ |
+ if (temp_count() > 0) { |
+ f->Print(" ["); |
+ for (intptr_t i = 0; i < temp_count(); i++) { |
+ if (i != 0) f->Print(", "); |
+ f->Print("%s", temp(i).Name()); |
+ } |
+ f->Print("]"); |
+ } |
+ |
+ if (!out().IsInvalid()) { |
+ f->Print(" => "); |
+ f->Print("%s", out().Name()); |
+ } |
+ |
+ if (is_call()) f->Print(" C"); |
+ if (is_branch()) f->Print(" B"); |
+} |
+ |
} // namespace dart |