OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/locations.h" | 5 #include "vm/locations.h" |
6 | 6 |
7 #include "vm/il_printer.h" | 7 #include "vm/il_printer.h" |
8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
9 #include "vm/flow_graph_compiler.h" | 9 #include "vm/flow_graph_compiler.h" |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 summary->set_in(i, Location::RequiresRegister()); | 36 summary->set_in(i, Location::RequiresRegister()); |
37 } | 37 } |
38 summary->set_out(out); | 38 summary->set_out(out); |
39 return summary; | 39 return summary; |
40 } | 40 } |
41 | 41 |
42 | 42 |
43 const char* Location::Name() const { | 43 const char* Location::Name() const { |
44 switch (kind()) { | 44 switch (kind()) { |
45 case kInvalid: return "?"; | 45 case kInvalid: return "?"; |
| 46 case kSpillSlot: return "S"; |
46 case kRegister: return Assembler::RegisterName(reg()); | 47 case kRegister: return Assembler::RegisterName(reg()); |
47 case kUnallocated: | 48 case kUnallocated: |
48 switch (policy()) { | 49 switch (policy()) { |
49 case kRequiresRegister: | 50 case kRequiresRegister: |
50 return "R"; | 51 return "R"; |
51 case kSameAsFirstInput: | 52 case kSameAsFirstInput: |
52 return "0"; | 53 return "0"; |
53 } | 54 } |
54 default: | 55 default: |
55 ASSERT(IsConstant()); | 56 ASSERT(IsConstant()); |
56 return "C"; | 57 return "C"; |
57 } | 58 } |
58 return "?"; | 59 return "?"; |
59 } | 60 } |
60 | 61 |
61 | 62 |
| 63 void Location::PrintTo(BufferFormatter* f) const { |
| 64 if (kind() == kSpillSlot) { |
| 65 f->Print("S%d", spill_index()); |
| 66 } else { |
| 67 f->Print("%s", Name()); |
| 68 } |
| 69 } |
| 70 |
| 71 |
62 void LocationSummary::PrintTo(BufferFormatter* f) const { | 72 void LocationSummary::PrintTo(BufferFormatter* f) const { |
63 if (input_count() > 0) { | 73 if (input_count() > 0) { |
64 f->Print(" ("); | 74 f->Print(" ("); |
65 for (intptr_t i = 0; i < input_count(); i++) { | 75 for (intptr_t i = 0; i < input_count(); i++) { |
66 if (i != 0) f->Print(", "); | 76 if (i != 0) f->Print(", "); |
67 f->Print("%s", in(i).Name()); | 77 in(i).PrintTo(f); |
68 } | 78 } |
69 f->Print(")"); | 79 f->Print(")"); |
70 } | 80 } |
71 | 81 |
72 if (temp_count() > 0) { | 82 if (temp_count() > 0) { |
73 f->Print(" ["); | 83 f->Print(" ["); |
74 for (intptr_t i = 0; i < temp_count(); i++) { | 84 for (intptr_t i = 0; i < temp_count(); i++) { |
75 if (i != 0) f->Print(", "); | 85 if (i != 0) f->Print(", "); |
76 f->Print("%s", temp(i).Name()); | 86 temp(i).PrintTo(f); |
77 } | 87 } |
78 f->Print("]"); | 88 f->Print("]"); |
79 } | 89 } |
80 | 90 |
81 if (!out().IsInvalid()) { | 91 if (!out().IsInvalid()) { |
82 f->Print(" => "); | 92 f->Print(" => "); |
83 f->Print("%s", out().Name()); | 93 out().PrintTo(f); |
84 } | 94 } |
85 | 95 |
86 if (is_call()) f->Print(" C"); | 96 if (is_call()) f->Print(" C"); |
87 } | 97 } |
88 | 98 |
89 } // namespace dart | 99 } // namespace dart |
90 | 100 |
OLD | NEW |