Lines Matching refs:IR
141 template <typename IRUnitT> static const IRUnitT *unwrapIR(Any IR) { in unwrapIR() argument
142 const IRUnitT **IRPtr = llvm::any_cast<const IRUnitT *>(&IR); in unwrapIR()
162 const Module *unwrapModule(Any IR, bool Force = false) { in unwrapModule() argument
163 if (const auto *M = unwrapIR<Module>(IR)) in unwrapModule()
166 if (const auto *F = unwrapIR<Function>(IR)) { in unwrapModule()
173 if (const auto *C = unwrapIR<LazyCallGraph::SCC>(IR)) { in unwrapModule()
184 if (const auto *L = unwrapIR<Loop>(IR)) { in unwrapModule()
191 if (const auto *MF = unwrapIR<MachineFunction>(IR)) { in unwrapModule()
238 std::string getIRName(Any IR) { in getIRName() argument
239 if (unwrapIR<Module>(IR)) in getIRName()
242 if (const auto *F = unwrapIR<Function>(IR)) in getIRName()
245 if (const auto *C = unwrapIR<LazyCallGraph::SCC>(IR)) in getIRName()
248 if (const auto *L = unwrapIR<Loop>(IR)) in getIRName()
252 if (const auto *MF = unwrapIR<MachineFunction>(IR)) in getIRName()
274 bool shouldPrintIR(Any IR) { in shouldPrintIR() argument
275 if (const auto *M = unwrapIR<Module>(IR)) in shouldPrintIR()
278 if (const auto *F = unwrapIR<Function>(IR)) in shouldPrintIR()
281 if (const auto *C = unwrapIR<LazyCallGraph::SCC>(IR)) in shouldPrintIR()
284 if (const auto *L = unwrapIR<Loop>(IR)) in shouldPrintIR()
287 if (const auto *MF = unwrapIR<MachineFunction>(IR)) in shouldPrintIR()
294 void unwrapAndPrint(raw_ostream &OS, Any IR) { in unwrapAndPrint() argument
295 if (!shouldPrintIR(IR)) in unwrapAndPrint()
299 auto *M = unwrapModule(IR); in unwrapAndPrint()
305 if (const auto *M = unwrapIR<Module>(IR)) { in unwrapAndPrint()
310 if (const auto *F = unwrapIR<Function>(IR)) { in unwrapAndPrint()
315 if (const auto *C = unwrapIR<LazyCallGraph::SCC>(IR)) { in unwrapAndPrint()
320 if (const auto *L = unwrapIR<Loop>(IR)) { in unwrapAndPrint()
325 if (const auto *MF = unwrapIR<MachineFunction>(IR)) { in unwrapAndPrint()
357 const Module *getModuleForComparison(Any IR) { in getModuleForComparison() argument
358 if (const auto *M = unwrapIR<Module>(IR)) in getModuleForComparison()
360 if (const auto *C = unwrapIR<LazyCallGraph::SCC>(IR)) in getModuleForComparison()
371 bool isInteresting(Any IR, StringRef PassID, StringRef PassName) { in isInteresting() argument
374 if (const auto *F = unwrapIR<Function>(IR)) in isInteresting()
386 void ChangeReporter<T>::saveIRBeforePass(Any IR, StringRef PassID, in saveIRBeforePass() argument
392 handleInitialIR(IR); in saveIRBeforePass()
400 if (!isInteresting(IR, PassID, PassName)) in saveIRBeforePass()
405 generateIRRepresentation(IR, PassID, Data); in saveIRBeforePass()
409 void ChangeReporter<T>::handleIRAfterPass(Any IR, StringRef PassID, in handleIRAfterPass() argument
413 std::string Name = getIRName(IR); in handleIRAfterPass()
418 } else if (!isInteresting(IR, PassID, PassName)) { in handleIRAfterPass()
426 generateIRRepresentation(IR, PassID, After); in handleIRAfterPass()
433 handleAfter(PassID, Name, Before, After, IR); in handleIRAfterPass()
454 PIC.registerBeforeNonSkippedPassCallback([&PIC, this](StringRef P, Any IR) { in registerRequiredCallbacks() argument
455 saveIRBeforePass(IR, P, PIC.getPassNameForClassName(P)); in registerRequiredCallbacks()
459 [&PIC, this](StringRef P, Any IR, const PreservedAnalyses &) { in registerRequiredCallbacks() argument
460 handleIRAfterPass(IR, P, PIC.getPassNameForClassName(P)); in registerRequiredCallbacks()
472 template <typename T> void TextChangeReporter<T>::handleInitialIR(Any IR) { in handleInitialIR() argument
475 auto *M = unwrapModule(IR, /*Force=*/true); in handleInitialIR()
513 void IRChangedPrinter::generateIRRepresentation(Any IR, StringRef PassID, in generateIRRepresentation() argument
516 unwrapAndPrint(OS, IR); in generateIRRepresentation()
571 void IRChangedTester::handleInitialIR(Any IR) { in handleInitialIR() argument
575 generateIRRepresentation(IR, "Initial IR", S); in handleInitialIR()
689 template <typename T> void IRComparer<T>::analyzeIR(Any IR, IRDataT<T> &Data) { in analyzeIR() argument
690 if (const Module *M = getModuleForComparison(IR)) { in analyzeIR()
697 if (const auto *F = unwrapIR<Function>(IR)) { in analyzeIR()
702 if (const auto *L = unwrapIR<Loop>(IR)) { in analyzeIR()
708 if (const auto *MF = unwrapIR<MachineFunction>(IR)) { in analyzeIR()
751 static SmallString<32> getIRFileDisplayName(Any IR) { in getIRFileDisplayName() argument
754 const Module *M = unwrapModule(IR); in getIRFileDisplayName()
758 if (unwrapIR<Module>(IR)) { in getIRFileDisplayName()
760 } else if (const auto *F = unwrapIR<Function>(IR)) { in getIRFileDisplayName()
765 } else if (const auto *C = unwrapIR<LazyCallGraph::SCC>(IR)) { in getIRFileDisplayName()
769 } else if (const auto *L = unwrapIR<Loop>(IR)) { in getIRFileDisplayName()
773 } else if (const auto *MF = unwrapIR<MachineFunction>(IR)) { in getIRFileDisplayName()
786 Any IR) { in fetchDumpFilename() argument
796 FilenameStream << getIRFileDisplayName(IR); in fetchDumpFilename()
816 StringRef PassID, Any IR, std::string &DumpIRFilename) { in pushPassRunDescriptor() argument
817 const Module *M = unwrapModule(IR); in pushPassRunDescriptor()
819 PassRunDescriptor(M, DumpIRFilename, getIRName(IR), PassID)); in pushPassRunDescriptor()
849 void PrintIRInstrumentation::printBeforePass(StringRef PassID, Any IR) { in printBeforePass() argument
858 DumpIRFilename = fetchDumpFilename(PassID, IR); in printBeforePass()
865 pushPassRunDescriptor(PassID, IR, DumpIRFilename); in printBeforePass()
867 if (!shouldPrintIR(IR)) in printBeforePass()
874 << " on " << getIRName(IR) << "\n"; in printBeforePass()
877 pushPassRunDescriptor(PassID, IR, DumpIRFilename); in printBeforePass()
886 Stream << PassID << " on " << getIRName(IR) << " ***\n"; in printBeforePass()
887 unwrapAndPrint(Stream, IR); in printBeforePass()
900 void PrintIRInstrumentation::printAfterPass(StringRef PassID, Any IR) { in printAfterPass() argument
910 if (!shouldPrintIR(IR) || in printAfterPass()
919 unwrapAndPrint(Stream, IR); in printAfterPass()
1023 [this](StringRef P, Any IR) { this->printBeforePass(P, IR); }); in registerCallbacks() argument
1027 [this](StringRef P, Any IR, const PreservedAnalyses &) { in registerCallbacks() argument
1028 this->printAfterPass(P, IR); in registerCallbacks()
1040 [this](StringRef P, Any IR) { return this->shouldRun(P, IR); }); in registerCallbacks() argument
1043 bool OptNoneInstrumentation::shouldRun(StringRef PassID, Any IR) { in shouldRun() argument
1044 const auto *F = unwrapIR<Function>(IR); in shouldRun()
1046 if (const auto *L = unwrapIR<Loop>(IR)) in shouldRun()
1057 bool OptPassGateInstrumentation::shouldRun(StringRef PassName, Any IR) { in shouldRun() argument
1062 Context.getOptPassGate().shouldRunPass(PassName, getIRName(IR)); in shouldRun()
1067 const Module *M = unwrapModule(IR, /*Force=*/true); in shouldRun()
1084 PIC.registerShouldRunOptionalPassCallback([this](StringRef PassName, Any IR) { in registerCallbacks() argument
1085 return this->shouldRun(PassName, IR); in registerCallbacks()
1109 Any IR) { in registerCallbacks() argument
1113 print() << "Skipping pass: " << PassID << " on " << getIRName(IR) << "\n"; in registerCallbacks()
1116 StringRef PassID, Any IR) { in registerCallbacks() argument
1121 OS << "Running pass: " << PassID << " on " << getIRName(IR); in registerCallbacks()
1122 if (const auto *F = unwrapIR<Function>(IR)) { in registerCallbacks()
1128 } else if (const auto *C = unwrapIR<LazyCallGraph::SCC>(IR)) { in registerCallbacks()
1139 [this, SpecialPasses](StringRef PassID, Any IR, in registerCallbacks()
1147 [this, SpecialPasses](StringRef PassID, Any IR) { in registerCallbacks() argument
1155 PIC.registerBeforeAnalysisCallback([this](StringRef PassID, Any IR) { in registerCallbacks() argument
1156 print() << "Running analysis: " << PassID << " on " << getIRName(IR) in registerCallbacks()
1161 [this](StringRef PassID, Any IR) { Indent -= 2; }); in registerCallbacks() argument
1162 PIC.registerAnalysisInvalidatedCallback([this](StringRef PassID, Any IR) { in registerCallbacks() argument
1163 print() << "Invalidating analysis: " << PassID << " on " << getIRName(IR) in registerCallbacks()
1341 static SmallVector<Function *, 1> GetFunctions(Any IR) { in GetFunctions() argument
1344 if (const auto *MaybeF = unwrapIR<Function>(IR)) { in GetFunctions()
1346 } else if (const auto *MaybeM = unwrapIR<Module>(IR)) { in GetFunctions()
1360 StringRef P, Any IR) mutable { in registerCallbacks() argument
1367 *const_cast<Module *>(unwrapModule(IR, /*Force=*/true))) in registerCallbacks()
1376 for (Function *F : GetFunctions(IR)) { in registerCallbacks()
1382 if (const auto *MPtr = unwrapIR<Module>(IR)) { in registerCallbacks()
1397 PIC.registerAfterPassCallback([this, &MAM](StringRef P, Any IR, in registerCallbacks()
1409 *const_cast<Module *>(unwrapModule(IR, /*Force=*/true))) in registerCallbacks()
1412 for (Function *F : GetFunctions(IR)) { in registerCallbacks()
1441 if (const auto *MPtr = unwrapIR<Module>(IR)) { in registerCallbacks()
1457 [this, MAM](StringRef P, Any IR, const PreservedAnalyses &PassPA) { in registerCallbacks() argument
1460 const auto *F = unwrapIR<Function>(IR); in registerCallbacks()
1462 if (const auto *L = unwrapIR<Loop>(IR)) in registerCallbacks()
1475 const auto *M = unwrapIR<Module>(IR); in registerCallbacks()
1477 if (const auto *C = unwrapIR<LazyCallGraph::SCC>(IR)) in registerCallbacks()
1491 if (auto *MF = unwrapIR<MachineFunction>(IR)) { in registerCallbacks()
1515 void InLineChangePrinter::generateIRRepresentation(Any IR, in generateIRRepresentation() argument
1518 IRComparer<EmptyData>::analyzeIR(IR, D); in generateIRRepresentation()
1524 Any IR) { in handleAfter() argument
1529 .compare(getModuleForComparison(IR), in handleAfter()
1575 [this](StringRef P, Any IR) { this->runBeforePass(P, IR); }); in registerCallbacks() argument
1577 [this](StringRef P, Any IR, const PreservedAnalyses &) { in registerCallbacks() argument
1585 [this](StringRef P, Any IR) { this->runBeforePass(P, IR); }); in registerCallbacks() argument
1587 [this](StringRef P, Any IR) { this->runAfterPass(); }, true); in registerCallbacks() argument
1590 void TimeProfilingPassesHandler::runBeforePass(StringRef PassID, Any IR) { in runBeforePass() argument
1591 timeTraceProfilerBegin(PassID, getIRName(IR)); in runBeforePass()
2287 void DotCfgChangeReporter::handleInitialIR(Any IR) { in handleInitialIR() argument
2295 IRComparer<DCData>::analyzeIR(IR, Data); in handleInitialIR()
2299 .compare(getModuleForComparison(IR), in handleInitialIR()
2311 void DotCfgChangeReporter::generateIRRepresentation(Any IR, StringRef PassID, in generateIRRepresentation() argument
2313 IRComparer<DCData>::analyzeIR(IR, Data); in generateIRRepresentation()
2327 const IRDataT<DCData> &After, Any IR) { in handleAfter() argument
2330 .compare(getModuleForComparison(IR), in handleAfter()
2502 [&PIC, this](StringRef PassID, Any IR) { in registerCallbacks() argument
2507 if (!isInteresting(IR, PassID, PIC.getPassNameForClassName(PassID))) { in registerCallbacks()
2512 unwrapAndPrint(OS, IR); in registerCallbacks()