Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(654)

Side by Side Diff: runtime/vm/il_printer.cc

Issue 2481873005: clang-format runtime/vm (Closed)
Patch Set: Merge Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/il_printer.h ('k') | runtime/vm/instructions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/flow_graph_range_analysis.h" 7 #include "vm/flow_graph_range_analysis.h"
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 #include "vm/os.h" 9 #include "vm/os.h"
10 #include "vm/parser.h" 10 #include "vm/parser.h"
11 11
12 namespace dart { 12 namespace dart {
13 13
14 #ifndef PRODUCT 14 #ifndef PRODUCT
15 15
16 DEFINE_FLAG(bool, display_sorted_ic_data, false, 16 DEFINE_FLAG(bool,
17 "Calls display a unary, sorted-by count form of ICData"); 17 display_sorted_ic_data,
18 false,
19 "Calls display a unary, sorted-by count form of ICData");
18 DEFINE_FLAG(bool, print_environments, false, "Print SSA environments."); 20 DEFINE_FLAG(bool, print_environments, false, "Print SSA environments.");
19 DEFINE_FLAG(charp, print_flow_graph_filter, NULL, 21 DEFINE_FLAG(charp,
20 "Print only IR of functions with matching names"); 22 print_flow_graph_filter,
23 NULL,
24 "Print only IR of functions with matching names");
21 25
22 DECLARE_FLAG(bool, trace_inlining_intervals); 26 DECLARE_FLAG(bool, trace_inlining_intervals);
23 27
24 void BufferFormatter::Print(const char* format, ...) { 28 void BufferFormatter::Print(const char* format, ...) {
25 va_list args; 29 va_list args;
26 va_start(args, format); 30 va_start(args, format);
27 VPrint(format, args); 31 VPrint(format, args);
28 va_end(args); 32 va_end(args);
29 } 33 }
30 34
31 35
32 void BufferFormatter::VPrint(const char* format, va_list args) { 36 void BufferFormatter::VPrint(const char* format, va_list args) {
33 intptr_t available = size_ - position_; 37 intptr_t available = size_ - position_;
34 if (available <= 0) return; 38 if (available <= 0) return;
35 intptr_t written = 39 intptr_t written = OS::VSNPrint(buffer_ + position_, available, format, args);
36 OS::VSNPrint(buffer_ + position_, available, format, args);
37 if (written >= 0) { 40 if (written >= 0) {
38 position_ += (available <= written) ? available : written; 41 position_ += (available <= written) ? available : written;
39 } 42 }
40 } 43 }
41 44
42 45
43 // Checks whether function's name matches the given filter, which is 46 // Checks whether function's name matches the given filter, which is
44 // a comma-separated list of strings. 47 // a comma-separated list of strings.
45 bool FlowGraphPrinter::PassesFilter(const char* filter, 48 bool FlowGraphPrinter::PassesFilter(const char* filter,
46 const Function& function) { 49 const Function& function) {
(...skipping 11 matching lines...) Expand all
58 char* token = strtok_r(filter_buffer, ",", &save_ptr); 61 char* token = strtok_r(filter_buffer, ",", &save_ptr);
59 bool found = false; 62 bool found = false;
60 while (token != NULL) { 63 while (token != NULL) {
61 if (strstr(function_name, token) != NULL) { 64 if (strstr(function_name, token) != NULL) {
62 found = true; 65 found = true;
63 break; 66 break;
64 } 67 }
65 const intptr_t token_len = strlen(token); 68 const intptr_t token_len = strlen(token);
66 if (token[token_len - 1] == '%') { 69 if (token[token_len - 1] == '%') {
67 if (function_name_len > token_len) { 70 if (function_name_len > token_len) {
68 const char* suffix = function_name + 71 const char* suffix =
69 (function_name_len - token_len + 1); 72 function_name + (function_name_len - token_len + 1);
70 if (strncmp(suffix, token, token_len - 1) == 0) { 73 if (strncmp(suffix, token, token_len - 1) == 0) {
71 found = true; 74 found = true;
72 break; 75 break;
73 } 76 }
74 } 77 }
75 } 78 }
76 token = strtok_r(NULL, ",", &save_ptr); 79 token = strtok_r(NULL, ",", &save_ptr);
77 } 80 }
78 delete[] filter_buffer; 81 delete[] filter_buffer;
79 82
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 } 150 }
148 } 151 }
149 152
150 153
151 void FlowGraphPrinter::PrintTypeCheck(const ParsedFunction& parsed_function, 154 void FlowGraphPrinter::PrintTypeCheck(const ParsedFunction& parsed_function,
152 TokenPosition token_pos, 155 TokenPosition token_pos,
153 Value* value, 156 Value* value,
154 const AbstractType& dst_type, 157 const AbstractType& dst_type,
155 const String& dst_name, 158 const String& dst_name,
156 bool eliminated) { 159 bool eliminated) {
157 const char* compile_type_name = "unknown"; 160 const char* compile_type_name = "unknown";
158 if (value != NULL && value->reaching_type_ != NULL) { 161 if (value != NULL && value->reaching_type_ != NULL) {
159 compile_type_name = value->reaching_type_->ToCString(); 162 compile_type_name = value->reaching_type_->ToCString();
160 } 163 }
161 THR_Print("%s type check: compile type %s is %s specific than " 164 THR_Print(
162 "type '%s' of '%s'.\n", 165 "%s type check: compile type %s is %s specific than "
163 eliminated ? "Eliminated" : "Generated", 166 "type '%s' of '%s'.\n",
164 compile_type_name, 167 eliminated ? "Eliminated" : "Generated", compile_type_name,
165 eliminated ? "more" : "not more", 168 eliminated ? "more" : "not more",
166 String::Handle(dst_type.Name()).ToCString(), 169 String::Handle(dst_type.Name()).ToCString(), dst_name.ToCString());
167 dst_name.ToCString());
168 } 170 }
169 171
170 172
171 void CompileType::PrintTo(BufferFormatter* f) const { 173 void CompileType::PrintTo(BufferFormatter* f) const {
172 const char* type_name = "?"; 174 const char* type_name = "?";
173 if ((cid_ != kIllegalCid) && (cid_ != kDynamicCid)) { 175 if ((cid_ != kIllegalCid) && (cid_ != kDynamicCid)) {
174 const Class& cls = 176 const Class& cls =
175 Class::Handle(Isolate::Current()->class_table()->At(cid_)); 177 Class::Handle(Isolate::Current()->class_table()->At(cid_));
176 type_name = String::Handle(cls.ScrubbedName()).ToCString(); 178 type_name = String::Handle(cls.ScrubbedName()).ToCString();
177 } else if (type_ != NULL && 179 } else if (type_ != NULL &&
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 f->Print("..."); 226 f->Print("...");
225 } 227 }
226 f->Print("]"); 228 f->Print("]");
227 } 229 }
228 230
229 231
230 static void PrintICDataSortedHelper(BufferFormatter* f, 232 static void PrintICDataSortedHelper(BufferFormatter* f,
231 const ICData& ic_data_orig) { 233 const ICData& ic_data_orig) {
232 const ICData& ic_data = 234 const ICData& ic_data =
233 ICData::Handle(ic_data_orig.AsUnaryClassChecksSortedByCount()); 235 ICData::Handle(ic_data_orig.AsUnaryClassChecksSortedByCount());
234 f->Print(" IC[n:%" Pd"; ", ic_data.NumberOfChecks()); 236 f->Print(" IC[n:%" Pd "; ", ic_data.NumberOfChecks());
235 for (intptr_t i = 0; i < ic_data.NumberOfChecks(); i++) { 237 for (intptr_t i = 0; i < ic_data.NumberOfChecks(); i++) {
236 const intptr_t count = ic_data.GetCountAt(i); 238 const intptr_t count = ic_data.GetCountAt(i);
237 const intptr_t cid = ic_data.GetReceiverClassIdAt(i); 239 const intptr_t cid = ic_data.GetReceiverClassIdAt(i);
238 const Class& cls = 240 const Class& cls =
239 Class::Handle(Isolate::Current()->class_table()->At(cid)); 241 Class::Handle(Isolate::Current()->class_table()->At(cid));
240 f->Print("%s : %" Pd ", ", 242 f->Print("%s : %" Pd ", ", String::Handle(cls.Name()).ToCString(), count);
241 String::Handle(cls.Name()).ToCString(), count);
242 } 243 }
243 f->Print("]"); 244 f->Print("]");
244 } 245 }
245 246
246 247
247 void FlowGraphPrinter::PrintICData(const ICData& ic_data, 248 void FlowGraphPrinter::PrintICData(const ICData& ic_data,
248 intptr_t num_checks_to_print) { 249 intptr_t num_checks_to_print) {
249 char buffer[1024]; 250 char buffer[1024];
250 BufferFormatter f(buffer, sizeof(buffer)); 251 BufferFormatter f(buffer, sizeof(buffer));
251 PrintICDataHelper(&f, ic_data, num_checks_to_print); 252 PrintICDataHelper(&f, ic_data, num_checks_to_print);
252 THR_Print("%s ", buffer); 253 THR_Print("%s ", buffer);
253 const Array& a = Array::Handle(ic_data.arguments_descriptor()); 254 const Array& a = Array::Handle(ic_data.arguments_descriptor());
254 THR_Print(" arg-desc %" Pd "\n", a.Length()); 255 THR_Print(" arg-desc %" Pd "\n", a.Length());
255 } 256 }
256 257
257 258
258 static void PrintUse(BufferFormatter* f, const Definition& definition) { 259 static void PrintUse(BufferFormatter* f, const Definition& definition) {
259 if (definition.HasSSATemp()) { 260 if (definition.HasSSATemp()) {
260 if (definition.HasPairRepresentation()) { 261 if (definition.HasPairRepresentation()) {
261 f->Print("(v%" Pd ", v%" Pd ")", definition.ssa_temp_index(), 262 f->Print("(v%" Pd ", v%" Pd ")", definition.ssa_temp_index(),
262 definition.ssa_temp_index() + 1); 263 definition.ssa_temp_index() + 1);
263 } else { 264 } else {
264 f->Print("v%" Pd "", definition.ssa_temp_index()); 265 f->Print("v%" Pd "", definition.ssa_temp_index());
265 } 266 }
266 } else if (definition.HasTemp()) { 267 } else if (definition.HasTemp()) {
267 f->Print("t%" Pd "", definition.temp_index()); 268 f->Print("t%" Pd "", definition.temp_index());
268 } 269 }
269 } 270 }
270 271
271 272
272 const char* Instruction::ToCString() const { 273 const char* Instruction::ToCString() const {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 if (InputAt(i) != NULL) { 326 if (InputAt(i) != NULL) {
326 InputAt(i)->PrintTo(f); 327 InputAt(i)->PrintTo(f);
327 } 328 }
328 } 329 }
329 } 330 }
330 331
331 332
332 void Value::PrintTo(BufferFormatter* f) const { 333 void Value::PrintTo(BufferFormatter* f) const {
333 PrintUse(f, *definition()); 334 PrintUse(f, *definition());
334 335
335 if ((reaching_type_ != NULL) && 336 if ((reaching_type_ != NULL) && (reaching_type_ != definition()->type_)) {
336 (reaching_type_ != definition()->type_)) {
337 f->Print(" "); 337 f->Print(" ");
338 reaching_type_->PrintTo(f); 338 reaching_type_->PrintTo(f);
339 } 339 }
340 } 340 }
341 341
342 342
343 void ConstantInstr::PrintOperandsTo(BufferFormatter* f) const { 343 void ConstantInstr::PrintOperandsTo(BufferFormatter* f) const {
344 const char* cstr = value().ToCString(); 344 const char* cstr = value().ToCString();
345 const char* new_line = strchr(cstr, '\n'); 345 const char* new_line = strchr(cstr, '\n');
346 if (new_line == NULL) { 346 if (new_line == NULL) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 f->Print("%" Pd "", num_temps()); 416 f->Print("%" Pd "", num_temps());
417 if (value() != NULL) { 417 if (value() != NULL) {
418 f->Print(", "); 418 f->Print(", ");
419 value()->PrintTo(f); 419 value()->PrintTo(f);
420 } 420 }
421 } 421 }
422 422
423 423
424 void AssertAssignableInstr::PrintOperandsTo(BufferFormatter* f) const { 424 void AssertAssignableInstr::PrintOperandsTo(BufferFormatter* f) const {
425 value()->PrintTo(f); 425 value()->PrintTo(f);
426 f->Print(", %s, '%s'", 426 f->Print(", %s, '%s'", dst_type().ToCString(), dst_name().ToCString());
427 dst_type().ToCString(),
428 dst_name().ToCString());
429 f->Print(" instantiator_type_arguments("); 427 f->Print(" instantiator_type_arguments(");
430 instantiator_type_arguments()->PrintTo(f); 428 instantiator_type_arguments()->PrintTo(f);
431 f->Print(")"); 429 f->Print(")");
432 } 430 }
433 431
434 432
435 void AssertBooleanInstr::PrintOperandsTo(BufferFormatter* f) const { 433 void AssertBooleanInstr::PrintOperandsTo(BufferFormatter* f) const {
436 value()->PrintTo(f); 434 value()->PrintTo(f);
437 } 435 }
438 436
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 if (needs_number_check()) { 489 if (needs_number_check()) {
492 f->Print(", with number check"); 490 f->Print(", with number check");
493 } 491 }
494 } 492 }
495 493
496 494
497 void TestCidsInstr::PrintOperandsTo(BufferFormatter* f) const { 495 void TestCidsInstr::PrintOperandsTo(BufferFormatter* f) const {
498 left()->PrintTo(f); 496 left()->PrintTo(f);
499 f->Print(" %s [", Token::Str(kind())); 497 f->Print(" %s [", Token::Str(kind()));
500 for (intptr_t i = 0; i < cid_results().length(); i += 2) { 498 for (intptr_t i = 0; i < cid_results().length(); i += 2) {
501 f->Print("0x%" Px ":%s ", 499 f->Print("0x%" Px ":%s ", cid_results()[i],
502 cid_results()[i], cid_results()[i + 1] == 0 ? "false" : "true"); 500 cid_results()[i + 1] == 0 ? "false" : "true");
503 } 501 }
504 f->Print("] "); 502 f->Print("] ");
505 } 503 }
506 504
507 505
508 void EqualityCompareInstr::PrintOperandsTo(BufferFormatter* f) const { 506 void EqualityCompareInstr::PrintOperandsTo(BufferFormatter* f) const {
509 left()->PrintTo(f); 507 left()->PrintTo(f);
510 f->Print(" %s ", Token::Str(kind())); 508 f->Print(" %s ", Token::Str(kind()));
511 right()->PrintTo(f); 509 right()->PrintTo(f);
512 } 510 }
(...skipping 18 matching lines...) Expand all
531 value()->PrintTo(f); 529 value()->PrintTo(f);
532 } 530 }
533 531
534 532
535 void NativeCallInstr::PrintOperandsTo(BufferFormatter* f) const { 533 void NativeCallInstr::PrintOperandsTo(BufferFormatter* f) const {
536 f->Print("%s", native_name().ToCString()); 534 f->Print("%s", native_name().ToCString());
537 } 535 }
538 536
539 537
540 void GuardFieldInstr::PrintOperandsTo(BufferFormatter* f) const { 538 void GuardFieldInstr::PrintOperandsTo(BufferFormatter* f) const {
541 f->Print("%s %s, ", 539 f->Print("%s %s, ", String::Handle(field().name()).ToCString(),
542 String::Handle(field().name()).ToCString(),
543 field().GuardedPropertiesAsCString()); 540 field().GuardedPropertiesAsCString());
544 value()->PrintTo(f); 541 value()->PrintTo(f);
545 } 542 }
546 543
547 544
548 void StoreInstanceFieldInstr::PrintOperandsTo(BufferFormatter* f) const { 545 void StoreInstanceFieldInstr::PrintOperandsTo(BufferFormatter* f) const {
549 if (field().IsNull()) { 546 if (field().IsNull()) {
550 f->Print("{%" Pd "}, ", offset_in_bytes()); 547 f->Print("{%" Pd "}, ", offset_in_bytes());
551 } else { 548 } else {
552 f->Print("%s {%" Pd "}, ", 549 f->Print("%s {%" Pd "}, ", String::Handle(field().name()).ToCString(),
553 String::Handle(field().name()).ToCString(),
554 field().Offset()); 550 field().Offset());
555 } 551 }
556 instance()->PrintTo(f); 552 instance()->PrintTo(f);
557 f->Print(", "); 553 f->Print(", ");
558 value()->PrintTo(f); 554 value()->PrintTo(f);
559 } 555 }
560 556
561 557
562 void IfThenElseInstr::PrintOperandsTo(BufferFormatter* f) const { 558 void IfThenElseInstr::PrintOperandsTo(BufferFormatter* f) const {
563 comparison()->PrintOperandsTo(f); 559 comparison()->PrintOperandsTo(f);
564 f->Print(" ? %" Pd " : %" Pd, 560 f->Print(" ? %" Pd " : %" Pd, if_true_, if_false_);
565 if_true_,
566 if_false_);
567 } 561 }
568 562
569 563
570 void LoadStaticFieldInstr::PrintOperandsTo(BufferFormatter* f) const { 564 void LoadStaticFieldInstr::PrintOperandsTo(BufferFormatter* f) const {
571 field_value()->PrintTo(f); 565 field_value()->PrintTo(f);
572 } 566 }
573 567
574 568
575 void StoreStaticFieldInstr::PrintOperandsTo(BufferFormatter* f) const { 569 void StoreStaticFieldInstr::PrintOperandsTo(BufferFormatter* f) const {
576 f->Print("%s, ", String::Handle(field().name()).ToCString()); 570 f->Print("%s, ", String::Handle(field().name()).ToCString());
577 value()->PrintTo(f); 571 value()->PrintTo(f);
578 } 572 }
579 573
580 574
581 void InstanceOfInstr::PrintOperandsTo(BufferFormatter* f) const { 575 void InstanceOfInstr::PrintOperandsTo(BufferFormatter* f) const {
582 value()->PrintTo(f); 576 value()->PrintTo(f);
583 f->Print(" %s %s", 577 f->Print(" %s %s", negate_result() ? "ISNOT" : "IS",
584 negate_result() ? "ISNOT" : "IS", 578 String::Handle(type().Name()).ToCString());
585 String::Handle(type().Name()).ToCString());
586 f->Print(" type-arg("); 579 f->Print(" type-arg(");
587 instantiator_type_arguments()->PrintTo(f); 580 instantiator_type_arguments()->PrintTo(f);
588 f->Print(")"); 581 f->Print(")");
589 } 582 }
590 583
591 584
592 void RelationalOpInstr::PrintOperandsTo(BufferFormatter* f) const { 585 void RelationalOpInstr::PrintOperandsTo(BufferFormatter* f) const {
593 f->Print("%s, ", Token::Str(kind())); 586 f->Print("%s, ", Token::Str(kind()));
594 left()->PrintTo(f); 587 left()->PrintTo(f);
595 f->Print(", "); 588 f->Print(", ");
(...skipping 26 matching lines...) Expand all
622 615
623 void LoadFieldInstr::PrintOperandsTo(BufferFormatter* f) const { 616 void LoadFieldInstr::PrintOperandsTo(BufferFormatter* f) const {
624 instance()->PrintTo(f); 617 instance()->PrintTo(f);
625 f->Print(", %" Pd, offset_in_bytes()); 618 f->Print(", %" Pd, offset_in_bytes());
626 619
627 if (field() != NULL) { 620 if (field() != NULL) {
628 f->Print(" {%s}", String::Handle(field()->name()).ToCString()); 621 f->Print(" {%s}", String::Handle(field()->name()).ToCString());
629 const char* expected = "?"; 622 const char* expected = "?";
630 if (field()->guarded_cid() != kIllegalCid) { 623 if (field()->guarded_cid() != kIllegalCid) {
631 const Class& cls = Class::Handle( 624 const Class& cls = Class::Handle(
632 Isolate::Current()->class_table()->At(field()->guarded_cid())); 625 Isolate::Current()->class_table()->At(field()->guarded_cid()));
633 expected = String::Handle(cls.Name()).ToCString(); 626 expected = String::Handle(cls.Name()).ToCString();
634 } 627 }
635 628
636 f->Print(" [%s %s]", 629 f->Print(" [%s %s]", field()->is_nullable() ? "nullable" : "non-nullable",
637 field()->is_nullable() ? "nullable" : "non-nullable",
638 expected); 630 expected);
639 } 631 }
640 632
641 f->Print(", immutable=%d", immutable_); 633 f->Print(", immutable=%d", immutable_);
642 } 634 }
643 635
644 636
645 void InstantiateTypeInstr::PrintOperandsTo(BufferFormatter* f) const { 637 void InstantiateTypeInstr::PrintOperandsTo(BufferFormatter* f) const {
646 const String& type_name = String::Handle(type().Name()); 638 const String& type_name = String::Handle(type().Name());
647 f->Print("%s, ", type_name.ToCString()); 639 f->Print("%s, ", type_name.ToCString());
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 void UnaryDoubleOpInstr::PrintOperandsTo(BufferFormatter* f) const { 976 void UnaryDoubleOpInstr::PrintOperandsTo(BufferFormatter* f) const {
985 f->Print("%s, ", Token::Str(op_kind())); 977 f->Print("%s, ", Token::Str(op_kind()));
986 value()->PrintTo(f); 978 value()->PrintTo(f);
987 } 979 }
988 980
989 981
990 void CheckClassIdInstr::PrintOperandsTo(BufferFormatter* f) const { 982 void CheckClassIdInstr::PrintOperandsTo(BufferFormatter* f) const {
991 value()->PrintTo(f); 983 value()->PrintTo(f);
992 984
993 const Class& cls = 985 const Class& cls =
994 Class::Handle(Isolate::Current()->class_table()->At(cid())); 986 Class::Handle(Isolate::Current()->class_table()->At(cid()));
995 f->Print(", %s", String::Handle(cls.ScrubbedName()).ToCString()); 987 f->Print(", %s", String::Handle(cls.ScrubbedName()).ToCString());
996 } 988 }
997 989
998 990
999 void CheckClassInstr::PrintOperandsTo(BufferFormatter* f) const { 991 void CheckClassInstr::PrintOperandsTo(BufferFormatter* f) const {
1000 value()->PrintTo(f); 992 value()->PrintTo(f);
1001 if (FLAG_display_sorted_ic_data) { 993 if (FLAG_display_sorted_ic_data) {
1002 PrintICDataSortedHelper(f, unary_checks()); 994 PrintICDataSortedHelper(f, unary_checks());
1003 } else { 995 } else {
1004 PrintICDataHelper(f, unary_checks(), FlowGraphPrinter::kPrintAll); 996 PrintICDataHelper(f, unary_checks(), FlowGraphPrinter::kPrintAll);
(...skipping 20 matching lines...) Expand all
1025 f->Print("\n "); 1017 f->Print("\n ");
1026 def->PrintTo(f); 1018 def->PrintTo(f);
1027 } 1019 }
1028 f->Print("\n}"); 1020 f->Print("\n}");
1029 } 1021 }
1030 } 1022 }
1031 1023
1032 1024
1033 void JoinEntryInstr::PrintTo(BufferFormatter* f) const { 1025 void JoinEntryInstr::PrintTo(BufferFormatter* f) const {
1034 if (try_index() != CatchClauseNode::kInvalidTryIndex) { 1026 if (try_index() != CatchClauseNode::kInvalidTryIndex) {
1035 f->Print("B%" Pd "[join try_idx %" Pd "]:%" Pd " pred(", 1027 f->Print("B%" Pd "[join try_idx %" Pd "]:%" Pd " pred(", block_id(),
1036 block_id(), try_index(), GetDeoptId()); 1028 try_index(), GetDeoptId());
1037 } else { 1029 } else {
1038 f->Print("B%" Pd "[join]:%" Pd " pred(", block_id(), GetDeoptId()); 1030 f->Print("B%" Pd "[join]:%" Pd " pred(", block_id(), GetDeoptId());
1039 } 1031 }
1040 for (intptr_t i = 0; i < predecessors_.length(); ++i) { 1032 for (intptr_t i = 0; i < predecessors_.length(); ++i) {
1041 if (i > 0) f->Print(", "); 1033 if (i > 0) f->Print(", ");
1042 f->Print("B%" Pd, predecessors_[i]->block_id()); 1034 f->Print("B%" Pd, predecessors_[i]->block_id());
1043 } 1035 }
1044 f->Print(")"); 1036 f->Print(")");
1045 if (phis_ != NULL) { 1037 if (phis_ != NULL) {
1046 f->Print(" {"); 1038 f->Print(" {");
(...skipping 28 matching lines...) Expand all
1075 } 1067 }
1076 f->Print("\n}"); 1068 f->Print("\n}");
1077 } 1069 }
1078 if (HasParallelMove()) { 1070 if (HasParallelMove()) {
1079 f->Print(" "); 1071 f->Print(" ");
1080 parallel_move()->PrintTo(f); 1072 parallel_move()->PrintTo(f);
1081 } 1073 }
1082 } 1074 }
1083 1075
1084 1076
1085 static const char *RepresentationToCString(Representation rep) { 1077 static const char* RepresentationToCString(Representation rep) {
1086 switch (rep) { 1078 switch (rep) {
1087 case kTagged: 1079 case kTagged:
1088 return "tagged"; 1080 return "tagged";
1089 case kUntagged: 1081 case kUntagged:
1090 return "untagged"; 1082 return "untagged";
1091 case kUnboxedDouble: 1083 case kUnboxedDouble:
1092 return "double"; 1084 return "double";
1093 case kUnboxedInt32: 1085 case kUnboxedInt32:
1094 return "int32"; 1086 return "int32";
1095 case kUnboxedUint32: 1087 case kUnboxedUint32:
(...skipping 14 matching lines...) Expand all
1110 return "none"; 1102 return "none";
1111 case kNumRepresentations: 1103 case kNumRepresentations:
1112 UNREACHABLE(); 1104 UNREACHABLE();
1113 } 1105 }
1114 return "?"; 1106 return "?";
1115 } 1107 }
1116 1108
1117 1109
1118 void PhiInstr::PrintTo(BufferFormatter* f) const { 1110 void PhiInstr::PrintTo(BufferFormatter* f) const {
1119 if (HasPairRepresentation()) { 1111 if (HasPairRepresentation()) {
1120 f->Print("(v%" Pd ", v%" Pd ") <- phi(", 1112 f->Print("(v%" Pd ", v%" Pd ") <- phi(", ssa_temp_index(),
1121 ssa_temp_index(), ssa_temp_index() + 1); 1113 ssa_temp_index() + 1);
1122 } else { 1114 } else {
1123 f->Print("v%" Pd " <- phi(", ssa_temp_index()); 1115 f->Print("v%" Pd " <- phi(", ssa_temp_index());
1124 } 1116 }
1125 for (intptr_t i = 0; i < inputs_.length(); ++i) { 1117 for (intptr_t i = 0; i < inputs_.length(); ++i) {
1126 if (inputs_[i] != NULL) inputs_[i]->PrintTo(f); 1118 if (inputs_[i] != NULL) inputs_[i]->PrintTo(f);
1127 if (i < inputs_.length() - 1) f->Print(", "); 1119 if (i < inputs_.length() - 1) f->Print(", ");
1128 } 1120 }
1129 f->Print(")"); 1121 f->Print(")");
1130 if (is_alive()) { 1122 if (is_alive()) {
1131 f->Print(" alive"); 1123 f->Print(" alive");
1132 } else { 1124 } else {
1133 f->Print(" dead"); 1125 f->Print(" dead");
1134 } 1126 }
1135 if (range_ != NULL) { 1127 if (range_ != NULL) {
1136 f->Print(" "); 1128 f->Print(" ");
1137 range_->PrintTo(f); 1129 range_->PrintTo(f);
1138 } 1130 }
1139 1131
1140 if (representation() != kNoRepresentation && 1132 if (representation() != kNoRepresentation && representation() != kTagged) {
1141 representation() != kTagged) {
1142 f->Print(" %s", RepresentationToCString(representation())); 1133 f->Print(" %s", RepresentationToCString(representation()));
1143 } 1134 }
1144 1135
1145 if (type_ != NULL) { 1136 if (type_ != NULL) {
1146 f->Print(" "); 1137 f->Print(" ");
1147 type_->PrintTo(f); 1138 type_->PrintTo(f);
1148 } 1139 }
1149 } 1140 }
1150 1141
1151 1142
1152 void UnboxIntegerInstr::PrintOperandsTo(BufferFormatter* f) const { 1143 void UnboxIntegerInstr::PrintOperandsTo(BufferFormatter* f) const {
1153 if (is_truncating()) { 1144 if (is_truncating()) {
1154 f->Print("[tr], "); 1145 f->Print("[tr], ");
1155 } 1146 }
1156 Definition::PrintOperandsTo(f); 1147 Definition::PrintOperandsTo(f);
1157 } 1148 }
1158 1149
1159 1150
1160 void UnboxedIntConverterInstr::PrintOperandsTo(BufferFormatter* f) const { 1151 void UnboxedIntConverterInstr::PrintOperandsTo(BufferFormatter* f) const {
1161 f->Print("%s->%s%s, ", 1152 f->Print("%s->%s%s, ", RepresentationToCString(from()),
1162 RepresentationToCString(from()), 1153 RepresentationToCString(to()), is_truncating() ? "[tr]" : "");
1163 RepresentationToCString(to()),
1164 is_truncating() ? "[tr]" : "");
1165 Definition::PrintOperandsTo(f); 1154 Definition::PrintOperandsTo(f);
1166 } 1155 }
1167 1156
1168 1157
1169 void ParameterInstr::PrintOperandsTo(BufferFormatter* f) const { 1158 void ParameterInstr::PrintOperandsTo(BufferFormatter* f) const {
1170 f->Print("%" Pd, index()); 1159 f->Print("%" Pd, index());
1171 } 1160 }
1172 1161
1173 1162
1174 void CheckStackOverflowInstr::PrintOperandsTo(BufferFormatter* f) const { 1163 void CheckStackOverflowInstr::PrintOperandsTo(BufferFormatter* f) const {
1175 if (in_loop()) f->Print("depth %" Pd, loop_depth()); 1164 if (in_loop()) f->Print("depth %" Pd, loop_depth());
1176 } 1165 }
1177 1166
1178 1167
1179 void TargetEntryInstr::PrintTo(BufferFormatter* f) const { 1168 void TargetEntryInstr::PrintTo(BufferFormatter* f) const {
1180 if (try_index() != CatchClauseNode::kInvalidTryIndex) { 1169 if (try_index() != CatchClauseNode::kInvalidTryIndex) {
1181 f->Print("B%" Pd "[target try_idx %" Pd "]:%" Pd, 1170 f->Print("B%" Pd "[target try_idx %" Pd "]:%" Pd, block_id(), try_index(),
1182 block_id(), try_index(), GetDeoptId()); 1171 GetDeoptId());
1183 } else { 1172 } else {
1184 f->Print("B%" Pd "[target]:%" Pd, block_id(), GetDeoptId()); 1173 f->Print("B%" Pd "[target]:%" Pd, block_id(), GetDeoptId());
1185 } 1174 }
1186 if (HasParallelMove()) { 1175 if (HasParallelMove()) {
1187 f->Print(" "); 1176 f->Print(" ");
1188 parallel_move()->PrintTo(f); 1177 parallel_move()->PrintTo(f);
1189 } 1178 }
1190 } 1179 }
1191 1180
1192 1181
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 InputAt(0)->PrintTo(f); 1227 InputAt(0)->PrintTo(f);
1239 f->Print(")"); 1228 f->Print(")");
1240 } 1229 }
1241 1230
1242 1231
1243 void BranchInstr::PrintTo(BufferFormatter* f) const { 1232 void BranchInstr::PrintTo(BufferFormatter* f) const {
1244 f->Print("%s ", DebugName()); 1233 f->Print("%s ", DebugName());
1245 f->Print("if "); 1234 f->Print("if ");
1246 comparison()->PrintTo(f); 1235 comparison()->PrintTo(f);
1247 1236
1248 f->Print(" goto (%" Pd ", %" Pd ")", 1237 f->Print(" goto (%" Pd ", %" Pd ")", true_successor()->block_id(),
1249 true_successor()->block_id(), 1238 false_successor()->block_id());
1250 false_successor()->block_id());
1251 } 1239 }
1252 1240
1253 1241
1254 void ParallelMoveInstr::PrintTo(BufferFormatter* f) const { 1242 void ParallelMoveInstr::PrintTo(BufferFormatter* f) const {
1255 f->Print("%s ", DebugName()); 1243 f->Print("%s ", DebugName());
1256 for (intptr_t i = 0; i < moves_.length(); i++) { 1244 for (intptr_t i = 0; i < moves_.length(); i++) {
1257 if (i != 0) f->Print(", "); 1245 if (i != 0) f->Print(", ");
1258 moves_[i]->dest().PrintTo(f); 1246 moves_[i]->dest().PrintTo(f);
1259 f->Print(" <- "); 1247 f->Print(" <- ");
1260 moves_[i]->src().PrintTo(f); 1248 moves_[i]->src().PrintTo(f);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 } 1319 }
1332 1320
1333 1321
1334 bool FlowGraphPrinter::ShouldPrint(const Function& function) { 1322 bool FlowGraphPrinter::ShouldPrint(const Function& function) {
1335 return false; 1323 return false;
1336 } 1324 }
1337 1325
1338 #endif // !PRODUCT 1326 #endif // !PRODUCT
1339 1327
1340 } // namespace dart 1328 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/il_printer.h ('k') | runtime/vm/instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698