[llvm] [AArch64] Add streaming-mode stack hazard optimization remarks (PR #101695)
David Green via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 5 00:42:10 PDT 2024
================
@@ -5029,3 +5050,171 @@ void AArch64FrameLowering::inlineStackProbe(MachineFunction &MF,
MI->eraseFromParent();
}
}
+
+struct StackAccess {
+ enum AccessType {
+ NotAccessed = 0, // Stack object not accessed by load/store instructions.
+ GPR = 1 << 0, // A general purpose register.
+ PPR = 1 << 1, // A predicate register.
+ FPR = 1 << 2, // A floating point/Neon/SVE register.
+ };
+
+ int Idx;
+ StackOffset Offset;
+ int64_t Size;
+ unsigned AccessTypes;
+
+ StackAccess() : Idx(0), Offset(), Size(0), AccessTypes(NotAccessed) {}
+
+ bool operator<(const StackAccess &Rhs) const {
+ return std::make_tuple(start(), Idx) <
+ std::make_tuple(Rhs.start(), Rhs.Idx);
+ }
+
+ bool isCPU() const {
+ // Predicate register load and store instructions execute on the CPU.
+ return AccessTypes & (AccessType::GPR | AccessType::PPR);
+ }
+ bool isSME() const { return AccessTypes & AccessType::FPR; }
+ bool isMixed() const { return ((AccessTypes & (AccessTypes - 1)) != 0); }
----------------
davemgreen wrote:
Does this handle GPR & PPR? Maybe make it simpler and just return `isCPU() && isSME()`
https://github.com/llvm/llvm-project/pull/101695
More information about the llvm-commits
mailing list