================ @@ -603,14 +626,69 @@ class SIGfx12CacheControl : public SIGfx11CacheControl { SIAtomicAddrSpace AddrSpace, SIMemOp Op, bool IsVolatile, bool IsNonTemporal) const override; + + bool + handleNonAtomicForPreciseMemory(MachineBasicBlock::iterator &MI) override; + bool handleAtomicForPreciseMemory(MachineBasicBlock::iterator &MI, + bool ret) override; +}; + +#if 0 +class SIPreciseMemorySupport { +protected: + const GCNSubtarget &ST; + const SIInstrInfo *TII = nullptr; + + IsaVersion IV; + + SIPreciseMemorySupport(const GCNSubtarget &ST) : ST(ST) { + TII = ST.getInstrInfo(); + IV = getIsaVersion(ST.getCPU()); + } + +public: + static std::unique_ptr<SIPreciseMemorySupport> create(const GCNSubtarget &ST); + + virtual bool handleNonAtomic(MachineBasicBlock::iterator &MI) = 0; + /// Handles atomic instruction \p MI with \p ret indicating whether \p MI + /// returns a result. + virtual bool handleAtomic(MachineBasicBlock::iterator &MI, bool ret) = 0; +}; + +class SIGfx9PreciseMemorySupport : public SIPreciseMemorySupport { +public: + SIGfx9PreciseMemorySupport(const GCNSubtarget &ST) + : SIPreciseMemorySupport(ST) {} + bool handleNonAtomic(MachineBasicBlock::iterator &MI) override; + bool handleAtomic(MachineBasicBlock::iterator &MI, bool ret) override; }; +class SIGfx10And11PreciseMemorySupport : public SIPreciseMemorySupport { +public: + SIGfx10And11PreciseMemorySupport(const GCNSubtarget &ST) + : SIPreciseMemorySupport(ST) {} + bool handleNonAtomic(MachineBasicBlock::iterator &MI) override; + bool handleAtomic(MachineBasicBlock::iterator &MI, bool ret) override; +}; + +std::unique_ptr<SIPreciseMemorySupport> +SIPreciseMemorySupport::create(const GCNSubtarget &ST) { + GCNSubtarget::Generation Generation = ST.getGeneration(); + if (Generation < AMDGPUSubtarget::GFX10) + return std::make_unique<SIGfx9PreciseMemorySupport>(ST); + return std::make_unique<SIGfx10And11PreciseMemorySupport>(ST); +} +#endif + class SIMemoryLegalizer final : public MachineFunctionPass { private: /// Cache Control. std::unique_ptr<SICacheControl> CC = nullptr; + /// Precise Memory support. + bool PM = false; ---------------- Pierre-vh wrote:
PM is commonly used for PassManager so I'd just use `PrecMem` or something similar. Of course PassManager makes no sense here but I personally thought of that first before thinking PreciseMemory https://github.com/llvm/llvm-project/pull/79236 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits