Chromium Code Reviews| 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 |
|
srdjan
2012/07/10 23:27:54
Move cpu_reg_names to constants_<arch>.h
Vyacheslav Egorov (Google)
2012/07/11 13:27:58
Do we really want to have arrays declarations in t
srdjan
2012/07/11 17:22:31
We do not want to have if def targets in shared co
|
| + |
| + |
| +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 |