[llvm] [llvm] Support multiple save/restore points in mir (PR #119357)

Elizaveta Noskova via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 21 08:48:16 PDT 2025


================
@@ -631,6 +631,61 @@ LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::CalledGlobal)
 namespace llvm {
 namespace yaml {
 
+// Struct representing one save/restore point in the
+// 'savePoint' / 'restorePoint' list. One point consist of machine basic block
+// name and list of saved/restored in this basic block registers. Generally
+// 'registers' is not obligatory field, if this field is not specified, it is
+// assumed to be equal to the list of all CalleeSavedRegisters, calculated
+// during PEI
+struct SaveRestorePointEntry {
+  StringValue Point;
+  std::vector<StringValue> Registers;
+
+  bool operator==(const SaveRestorePointEntry &Other) const {
+    return Point == Other.Point && Registers == Other.Registers;
+  }
+};
+
+using SaveRestorePoints =
+    std::variant<std::vector<SaveRestorePointEntry>, StringValue>;
----------------
enoskova-sc wrote:

Several comments above (https://github.com/llvm/llvm-project/pull/119357#discussion_r1880985027) @preames suggested to make support for multiple save/restore points backward compatible with single save/restore point approach.
It helped to "cut out a huge amount of spurious diff". So, StringValue in this variant needed for backward compatibility.

https://github.com/llvm/llvm-project/pull/119357


More information about the llvm-commits mailing list