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/il_printer.h" | 5 #include "vm/il_printer.h" |
6 | 6 |
7 #include "vm/intermediate_language.h" | 7 #include "vm/intermediate_language.h" |
8 #include "vm/os.h" | 8 #include "vm/os.h" |
9 #include "vm/parser.h" | 9 #include "vm/parser.h" |
10 | 10 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 char buffer[1024]; | 163 char buffer[1024]; |
164 BufferFormatter f(buffer, sizeof(buffer)); | 164 BufferFormatter f(buffer, sizeof(buffer)); |
165 PrintICDataHelper(&f, ic_data); | 165 PrintICDataHelper(&f, ic_data); |
166 OS::Print("%s\n", buffer); | 166 OS::Print("%s\n", buffer); |
167 } | 167 } |
168 | 168 |
169 | 169 |
170 static void PrintUse(BufferFormatter* f, const Definition& definition) { | 170 static void PrintUse(BufferFormatter* f, const Definition& definition) { |
171 if (definition.is_used()) { | 171 if (definition.is_used()) { |
172 if (definition.HasSSATemp()) { | 172 if (definition.HasSSATemp()) { |
173 f->Print("v%" Pd, definition.ssa_temp_index()); | 173 if (definition.HasPairRepresentation()) { |
| 174 f->Print("v%" Pd ", v%" Pd "", definition.ssa_temp_index(), |
| 175 definition.ssa_temp_index() + 1); |
| 176 } else { |
| 177 f->Print("v%" Pd "", definition.ssa_temp_index()); |
| 178 } |
174 } else if (definition.temp_index() != -1) { | 179 } else if (definition.temp_index() != -1) { |
175 f->Print("t%" Pd, definition.temp_index()); | 180 f->Print("t%" Pd "", definition.temp_index()); |
176 } | 181 } |
177 } | 182 } |
178 } | 183 } |
179 | 184 |
180 | 185 |
181 const char* Instruction::ToCString() const { | 186 const char* Instruction::ToCString() const { |
182 char buffer[1024]; | 187 char buffer[1024]; |
183 BufferFormatter f(buffer, sizeof(buffer)); | 188 BufferFormatter f(buffer, sizeof(buffer)); |
184 PrintTo(&f); | 189 PrintTo(&f); |
185 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer); | 190 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 if (type_ != NULL) { | 230 if (type_ != NULL) { |
226 f->Print(" "); | 231 f->Print(" "); |
227 type_->PrintTo(f); | 232 type_->PrintTo(f); |
228 } | 233 } |
229 } | 234 } |
230 | 235 |
231 | 236 |
232 void Definition::PrintOperandsTo(BufferFormatter* f) const { | 237 void Definition::PrintOperandsTo(BufferFormatter* f) const { |
233 for (int i = 0; i < InputCount(); ++i) { | 238 for (int i = 0; i < InputCount(); ++i) { |
234 if (i > 0) f->Print(", "); | 239 if (i > 0) f->Print(", "); |
235 if (InputAt(i) != NULL) InputAt(i)->PrintTo(f); | 240 if (InputAt(i) != NULL) { |
| 241 InputAt(i)->PrintTo(f); |
| 242 } |
236 } | 243 } |
237 } | 244 } |
238 | 245 |
239 | 246 |
240 void Value::PrintTo(BufferFormatter* f) const { | 247 void Value::PrintTo(BufferFormatter* f) const { |
241 PrintUse(f, *definition()); | 248 PrintUse(f, *definition()); |
242 if ((reaching_type_ != NULL) && | 249 if ((reaching_type_ != NULL) && |
243 (reaching_type_ != definition()->type_)) { | 250 (reaching_type_ != definition()->type_)) { |
244 f->Print(" "); | 251 f->Print(" "); |
245 reaching_type_->PrintTo(f); | 252 reaching_type_->PrintTo(f); |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 value()->PrintTo(f); | 573 value()->PrintTo(f); |
567 } | 574 } |
568 | 575 |
569 | 576 |
570 void MergedMathInstr::PrintOperandsTo(BufferFormatter* f) const { | 577 void MergedMathInstr::PrintOperandsTo(BufferFormatter* f) const { |
571 f->Print("'%s', ", MergedMathInstr::KindToCString(kind())); | 578 f->Print("'%s', ", MergedMathInstr::KindToCString(kind())); |
572 Definition::PrintOperandsTo(f); | 579 Definition::PrintOperandsTo(f); |
573 } | 580 } |
574 | 581 |
575 | 582 |
| 583 void ExtractNthOutputInstr::PrintOperandsTo(BufferFormatter* f) const { |
| 584 f->Print("Extract %" Pd " from ", index()); |
| 585 Definition::PrintOperandsTo(f); |
| 586 } |
| 587 |
| 588 |
576 void BinarySmiOpInstr::PrintTo(BufferFormatter* f) const { | 589 void BinarySmiOpInstr::PrintTo(BufferFormatter* f) const { |
577 Definition::PrintTo(f); | 590 Definition::PrintTo(f); |
578 f->Print(" %co", overflow_ ? '+' : '-'); | 591 f->Print(" %co", overflow_ ? '+' : '-'); |
579 f->Print(" %ct", is_truncating() ? '+' : '-'); | 592 f->Print(" %ct", is_truncating() ? '+' : '-'); |
580 } | 593 } |
581 | 594 |
582 | 595 |
583 void BinarySmiOpInstr::PrintOperandsTo(BufferFormatter* f) const { | 596 void BinarySmiOpInstr::PrintOperandsTo(BufferFormatter* f) const { |
584 f->Print("%s, ", Token::Str(op_kind())); | 597 f->Print("%s, ", Token::Str(op_kind())); |
585 left()->PrintTo(f); | 598 left()->PrintTo(f); |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 f->Print(" ["); | 1051 f->Print(" ["); |
1039 locations_[i].PrintTo(f); | 1052 locations_[i].PrintTo(f); |
1040 f->Print("]"); | 1053 f->Print("]"); |
1041 } | 1054 } |
1042 } | 1055 } |
1043 f->Print(" }"); | 1056 f->Print(" }"); |
1044 if (outer_ != NULL) outer_->PrintTo(f); | 1057 if (outer_ != NULL) outer_->PrintTo(f); |
1045 } | 1058 } |
1046 | 1059 |
1047 } // namespace dart | 1060 } // namespace dart |
OLD | NEW |