[llvm] [llvm] Support multiple save/restore points in mir (PR #119357)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 7 13:19:59 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>;
----------------
preames wrote:
I know I suggested the variant, but looking at the code, the complexity added seems like a bad tradeoff.
I'd be tempted to do a small change which "manually" parses and prints a single entry array, and updates all the tests to the new format. If you did that, you could rebase this one on top and add the non-single entry general case.
I'll note that I'm explicitly okay with leaving this as is. We can land this patch, then remove the complexity and do the test change in a follow up. (Note to other reviews, I'm committing to write that patch if needed.)
https://github.com/llvm/llvm-project/pull/119357
More information about the llvm-commits
mailing list