[llvm] [NewPM] Adds a port for AArch64SIMDInstrOpt (PR #188177)

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 2 08:56:56 PDT 2026


================
@@ -196,27 +159,85 @@ struct AArch64SIMDInstrOpt : public MachineFunctionPass {
   /// instruction (2 for ST2 and 4 for ST4).
   unsigned determineSrcReg(MachineInstr &MI) const;
 
+  bool run(MachineFunction &MF);
+};
+
+struct AArch64SIMDInstrOptLegacy : public MachineFunctionPass {
+  static char ID;
+
+  AArch64SIMDInstrOptImpl::SIMDInstrTableMap SIMDInstrTable;
+  AArch64SIMDInstrOptImpl::InterlEarlyExitMap InterlEarlyExit;
+
+  AArch64SIMDInstrOptLegacy() : MachineFunctionPass(ID) {}
+
   bool runOnMachineFunction(MachineFunction &Fn) override;
 
   StringRef getPassName() const override {
     return AARCH64_VECTOR_BY_ELEMENT_OPT_NAME;
   }
 };
 
-char AArch64SIMDInstrOpt::ID = 0;
+char AArch64SIMDInstrOptLegacy::ID = 0;
+
+const std::vector<AArch64SIMDInstrOptImpl::InstReplInfo>
----------------
boomanaiden154 wrote:

This still ends up being a static constructor, which we want to avoid.

https://llvm.org/docs/CodingStandards.html#do-not-use-static-constructors

Can we just return this to how it was before and store an instance of the `Impl` class inside the pass classes?

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


More information about the llvm-commits mailing list