llvm.org GIT mirror llvm / d6da5db
Use print() instead of dump() in code The dump() functions are meant to be used in a debugger, code should typically use something like print(errs()); git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293365 91177308-0d34-0410-b5e6-96231b3b80d8 Matthias Braun 2 years ago
20 changed file(s) with 77 addition(s) and 41 deletion(s). Raw diff Collapse all Expand all
457457 if (auto FnAST = ParseDefinition()) {
458458 if (auto *FnIR = FnAST->codegen()) {
459459 fprintf(stderr, "Read function definition:");
460 FnIR->dump();
460 FnIR->print(errs());
461 fprintf(stderr, "\n");
461462 TheJIT->addModule(std::move(TheModule));
462463 InitializeModuleAndPassManager();
463464 }
471472 if (auto ProtoAST = ParseExtern()) {
472473 if (auto *FnIR = ProtoAST->codegen()) {
473474 fprintf(stderr, "Read extern: ");
474 FnIR->dump();
475 FnIR->print(errs());
476 fprintf(stderr, "\n");
475477 FunctionProtos[ProtoAST->getName()] = std::move(ProtoAST);
476478 }
477479 } else {
11091109 if (auto FnAST = ParseDefinition()) {
11101110 if (auto *FnIR = FnAST->codegen()) {
11111111 fprintf(stderr, "Read function definition:");
1112 FnIR->dump();
1112 FnIR->print(errs());
1113 fprintf(stderr, "\n");
11131114 TheJIT->addModule(std::move(TheModule));
11141115 InitializeModule();
11151116 }
11231124 if (auto ProtoAST = ParseExtern()) {
11241125 if (auto *FnIR = ProtoAST->codegen()) {
11251126 fprintf(stderr, "Read extern: ");
1126 FnIR->dump();
1127 FnIR->print(errs());
1128 fprintf(stderr, "\n");
11271129 FunctionProtos[ProtoAST->getName()] = std::move(ProtoAST);
11281130 }
11291131 } else {
11091109 if (auto FnAST = ParseDefinition()) {
11101110 if (auto *FnIR = FnAST->codegen()) {
11111111 fprintf(stderr, "Read function definition:");
1112 FnIR->dump();
1112 FnIR->print(errs());
1113 fprintf(stderr, "\n");
11131114 TheJIT->addModule(std::move(TheModule));
11141115 InitializeModule();
11151116 }
11231124 if (auto ProtoAST = ParseExtern()) {
11241125 if (auto *FnIR = ProtoAST->codegen()) {
11251126 fprintf(stderr, "Read extern: ");
1126 FnIR->dump();
1127 FnIR->print(errs());
1128 fprintf(stderr, "\n");
11271129 FunctionProtos[ProtoAST->getName()] = std::move(ProtoAST);
11281130 }
11291131 } else {
11091109 if (auto FnAST = ParseDefinition()) {
11101110 if (auto *FnIR = FnAST->codegen()) {
11111111 fprintf(stderr, "Read function definition:");
1112 FnIR->dump();
1112 FnIR->print(errs());
1113 fprintf(stderr, "\n");
11131114 TheJIT->addModule(std::move(TheModule));
11141115 InitializeModule();
11151116 }
11231124 if (auto ProtoAST = ParseExtern()) {
11241125 if (auto *FnIR = ProtoAST->codegen()) {
11251126 fprintf(stderr, "Read extern: ");
1126 FnIR->dump();
1127 FnIR->print(errs());
1128 fprintf(stderr, "\n");
11271129 FunctionProtos[ProtoAST->getName()] = std::move(ProtoAST);
11281130 }
11291131 } else {
11251125 if (auto ProtoAST = ParseExtern()) {
11261126 if (auto *FnIR = ProtoAST->codegen()) {
11271127 fprintf(stderr, "Read extern: ");
1128 FnIR->dump();
1128 FnIR->print(errs());
1129 fprintf(stderr, "\n");
11291130 FunctionProtos[ProtoAST->getName()] = std::move(ProtoAST);
11301131 }
11311132 } else {
11491149 if (auto ProtoAST = ParseExtern()) {
11501150 if (auto *FnIR = ProtoAST->codegen()) {
11511151 fprintf(stderr, "Read extern: ");
1152 FnIR->dump();
1152 FnIR->print(errs());
1153 fprintf(stderr, "\n");
11531154 FunctionProtos[ProtoAST->getName()] = std::move(ProtoAST);
11541155 }
11551156 } else {
521521 if (auto FnAST = ParseDefinition()) {
522522 if (auto *FnIR = FnAST->codegen()) {
523523 fprintf(stderr, "Read function definition:");
524 FnIR->dump();
524 FnIR->print(errs());
525 fprintf(stderr, "\n");
525526 }
526527 } else {
527528 // Skip token for error recovery.
533534 if (auto ProtoAST = ParseExtern()) {
534535 if (auto *FnIR = ProtoAST->codegen()) {
535536 fprintf(stderr, "Read extern: ");
536 FnIR->dump();
537 FnIR->print(errs());
538 fprintf(stderr, "\n");
537539 }
538540 } else {
539541 // Skip token for error recovery.
546548 if (auto FnAST = ParseTopLevelExpr()) {
547549 if (auto *FnIR = FnAST->codegen()) {
548550 fprintf(stderr, "Read top-level expression:");
549 FnIR->dump();
551 FnIR->print(errs());
552 fprintf(stderr, "\n");
550553 }
551554 } else {
552555 // Skip token for error recovery.
600603 MainLoop();
601604
602605 // Print out all of the generated code.
603 TheModule->dump();
606 TheModule->print(errs(), nullptr);
604607
605608 return 0;
606609 }
570570 if (auto FnAST = ParseDefinition()) {
571571 if (auto *FnIR = FnAST->codegen()) {
572572 fprintf(stderr, "Read function definition:");
573 FnIR->dump();
573 FnIR->print(errs());
574 fprintf(stderr, "\n");
574575 TheJIT->addModule(std::move(TheModule));
575576 InitializeModuleAndPassManager();
576577 }
584585 if (auto ProtoAST = ParseExtern()) {
585586 if (auto *FnIR = ProtoAST->codegen()) {
586587 fprintf(stderr, "Read extern: ");
587 FnIR->dump();
588 FnIR->print(errs());
589 fprintf(stderr, "\n");
588590 FunctionProtos[ProtoAST->getName()] = std::move(ProtoAST);
589591 }
590592 } else {
844844 if (auto FnAST = ParseDefinition()) {
845845 if (auto *FnIR = FnAST->codegen()) {
846846 fprintf(stderr, "Read function definition:");
847 FnIR->dump();
847 FnIR->print(errs());
848 fprintf(stderr, "\n");
848849 TheJIT->addModule(std::move(TheModule));
849850 InitializeModuleAndPassManager();
850851 }
858859 if (auto ProtoAST = ParseExtern()) {
859860 if (auto *FnIR = ProtoAST->codegen()) {
860861 fprintf(stderr, "Read extern: ");
861 FnIR->dump();
862 FnIR->print(errs());
863 fprintf(stderr, "\n");
862864 FunctionProtos[ProtoAST->getName()] = std::move(ProtoAST);
863865 }
864866 } else {
963963 if (auto FnAST = ParseDefinition()) {
964964 if (auto *FnIR = FnAST->codegen()) {
965965 fprintf(stderr, "Read function definition:");
966 FnIR->dump();
966 FnIR->print(errs());
967 fprintf(stderr, "\n");
967968 TheJIT->addModule(std::move(TheModule));
968969 InitializeModuleAndPassManager();
969970 }
977978 if (auto ProtoAST = ParseExtern()) {
978979 if (auto *FnIR = ProtoAST->codegen()) {
979980 fprintf(stderr, "Read extern: ");
980 FnIR->dump();
981 FnIR->print(errs());
982 fprintf(stderr, "\n");
981983 FunctionProtos[ProtoAST->getName()] = std::move(ProtoAST);
982984 }
983985 } else {
11301130 if (auto FnAST = ParseDefinition()) {
11311131 if (auto *FnIR = FnAST->codegen()) {
11321132 fprintf(stderr, "Read function definition:");
1133 FnIR->dump();
1133 FnIR->print(errs());
1134 fprintf(stderr, "\n");
11341135 TheJIT->addModule(std::move(TheModule));
11351136 InitializeModuleAndPassManager();
11361137 }
11441145 if (auto ProtoAST = ParseExtern()) {
11451146 if (auto *FnIR = ProtoAST->codegen()) {
11461147 fprintf(stderr, "Read extern: ");
1147 FnIR->dump();
1148 FnIR->print(errs());
1149 fprintf(stderr, "\n");
11481150 FunctionProtos[ProtoAST->getName()] = std::move(ProtoAST);
11491151 }
11501152 } else {
11131113 if (auto FnAST = ParseDefinition()) {
11141114 if (auto *FnIR = FnAST->codegen()) {
11151115 fprintf(stderr, "Read function definition:");
1116 FnIR->dump();
1116 FnIR->print(errs());
1117 fprintf(stderr, "\n");
11171118 }
11181119 } else {
11191120 // Skip token for error recovery.
11251126 if (auto ProtoAST = ParseExtern()) {
11261127 if (auto *FnIR = ProtoAST->codegen()) {
11271128 fprintf(stderr, "Read extern: ");
1128 FnIR->dump();
1129 FnIR->print(errs());
1130 fprintf(stderr, "\n");
11291131 FunctionProtos[ProtoAST->getName()] = std::move(ProtoAST);
11301132 }
11311133 } else {
14381438 DBuilder->finalize();
14391439
14401440 // Print out all of the generated code.
1441 TheModule->dump();
1441 TheModule->print(errs(), nullptr);
14421442
14431443 return 0;
14441444 }
13941394 if (Function *LF = F->Codegen()) {
13951395 #ifndef MINIMAL_STDERR_OUTPUT
13961396 fprintf(stderr, "Read function definition:");
1397 LF->dump();
1397 LF->print(errs());
1398 fprintf(stderr, "\n");
13981399 #endif
13991400 }
14001401 } else {
14081409 if (Function *F = P->Codegen()) {
14091410 #ifndef MINIMAL_STDERR_OUTPUT
14101411 fprintf(stderr, "Read extern: ");
1411 F->dump();
1412 F->print(errs());
1413 fprintf(stderr, "\n");
14121414 #endif
14131415 }
14141416 } else {
15391541
15401542 #ifndef MINIMAL_STDERR_OUTPUT
15411543 // Print out all of the generated code.
1542 TheHelper->dump();
1544 TheHelper->print(errs());
15431545 #endif
15441546
15451547 return 0;
14731473 Function *LF = F->Codegen();
14741474 if (LF && VerboseOutput) {
14751475 fprintf(stderr, "Read function definition:");
1476 LF->dump();
1476 LF->print(errs());
1477 fprintf(stderr, "\n");
14771478 }
14781479 } else {
14791480 // Skip token for error recovery.
14861487 Function *F = P->Codegen();
14871488 if (F && VerboseOutput) {
14881489 fprintf(stderr, "Read extern: ");
1489 F->dump();
1490 F->print(errs());
1491 fprintf(stderr, "\n");
14901492 }
14911493 } else {
14921494 // Skip token for error recovery.
12511251 if (Function *LF = F->Codegen()) {
12521252 #ifndef MINIMAL_STDERR_OUTPUT
12531253 fprintf(stderr, "Read function definition:");
1254 LF->dump();
1254 LF->print(errs());
1255 fprintf(stderr, "\n");
12551256 #endif
12561257 }
12571258 } else {
12651266 if (Function *F = P->Codegen()) {
12661267 #ifndef MINIMAL_STDERR_OUTPUT
12671268 fprintf(stderr, "Read extern: ");
1268 F->dump();
1269 F->print(errs());
1270 fprintf(stderr, "\n");
12691271 #endif
12701272 }
12711273 } else {
13691371
13701372 #ifndef MINIMAL_STDERR_OUTPUT
13711373 // Print out all of the generated code.
1372 TheHelper->dump();
1374 TheHelper->print(errs());
13731375 #endif
13741376
13751377 return 0;
10091009 if (Function *LF = F->Codegen()) {
10101010 #ifndef MINIMAL_STDERR_OUTPUT
10111011 fprintf(stderr, "Read function definition:");
1012 LF->dump();
1012 LF->print(errs());
1013 fprintf(stderr, "\n");
10131014 #endif
10141015 }
10151016 } else {
10231024 if (Function *F = P->Codegen()) {
10241025 #ifndef MINIMAL_STDERR_OUTPUT
10251026 fprintf(stderr, "Read extern: ");
1026 F->dump();
1027 F->print(errs());
1028 fprintf(stderr, "\n");
10271029 #endif
10281030 }
10291031 } else {
11561158 // Print out all of the generated code.
11571159 TheFPM = 0;
11581160 #ifndef MINIMAL_STDERR_OUTPUT
1159 TheModule->dump();
1161 TheModule->print(errs(), nullptr);
11601162 #endif
11611163 return 0;
11621164 }
12921292 if (Function *LF = F->Codegen()) {
12931293 #ifndef MINIMAL_STDERR_OUTPUT
12941294 fprintf(stderr, "Read function definition:");
1295 LF->dump();
1295 LF->print(errs());
1296 fprintf(stderr, "\n");
12961297 #endif
12971298 }
12981299 } else {
13061307 if (Function *F = P->Codegen()) {
13071308 #ifndef MINIMAL_STDERR_OUTPUT
13081309 fprintf(stderr, "Read extern: ");
1309 F->dump();
1310 F->print(errs());
1311 fprintf(stderr, "\n");
13101312 #endif
13111313 }
13121314 } else {
5353 void dump() const;
5454 };
5555
56 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
5657 LLVM_DUMP_METHOD void SubMultiClassReference::dump() const {
5758 errs() << "Multiclass:\n";
5859
6263 for (Init *TA : TemplateArgs)
6364 TA->dump();
6465 }
66 #endif
6567
6668 } // end namespace llvm
6769
1515
1616 using namespace llvm;
1717
18 void SubtargetFeatureInfo::dump() const {
19 errs() << getEnumName() << " " << Index << "\n";
20 TheDef->dump();
18 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
19 LLVM_DUMP_METHOD void SubtargetFeatureInfo::dump() const {
20 errs() << getEnumName() << " " << Index << "\n" << *TheDef;
2121 }
22 #endif
2223
2324 std::vector>
2425 SubtargetFeatureInfo::getAll(const RecordKeeper &Records) {