[llvm] [llvm] Support multiple save/restore points in mir (PR #119357)
Elizaveta Noskova via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 29 03:42:44 PDT 2025
================
@@ -646,6 +647,41 @@ void MIRPrinter::convert(yaml::MachineFunction &MF,
}
}
+void MIRPrinter::convert(ModuleSlotTracker &MST,
+ yaml::SaveRestorePoints &YamlSRPoints,
+ const llvm::SaveRestorePoints::PointsMap &SRPoints,
+ const TargetRegisterInfo *TRI) {
+ auto &Points =
+ std::get<std::vector<yaml::SaveRestorePointEntry>>(YamlSRPoints);
+ for (const auto &MBBEntry : SRPoints) {
+ SmallString<16> Str;
+ yaml::SaveRestorePointEntry Entry;
+ raw_svector_ostream StrOS(Str);
+ StrOS << printMBBReference(*MBBEntry.first);
+ Entry.Point = StrOS.str().str();
+ Str.clear();
+ for (const CalleeSavedInfo &Info : MBBEntry.second) {
+ if (Info.getReg()) {
+ StrOS << printReg(Info.getReg(), TRI);
+ Entry.Registers.push_back(StrOS.str().str());
+ Str.clear();
+ }
+ }
+ // Sort here needed for stable output for lit tests
+ std::sort(Entry.Registers.begin(), Entry.Registers.end(),
----------------
enoskova-sc wrote:
Unfortunately, llvm::sort doesn't work for fields of structures, created in yaml namespace.
yaml namespace has its own yaml::begin() and due to it call to begin() in adl_begin() becomes ambiguous.
https://github.com/llvm/llvm-project/pull/119357
More information about the llvm-commits
mailing list