diff options
| author | Craig Topper <craig.topper@sifive.com> | 2025-04-25 15:45:43 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-25 15:45:43 -0700 |
| commit | 9cf08b409cf06cf109109cff2afa0a392fbc097f (patch) | |
| tree | c049e07c973aefeb2e131b7739c124057c2c2917 /llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp | |
| parent | d4898b562a5af19b4d79e9f7327d139bd7bd5021 (diff) | |
[TableGen][SelectionDAG][GISel][RISCV] Support IsNonExtLoad for IsAtomic PatFrags. (#137401)
Use it for RISC-V as a demonstration. Other targets will follow.
Diffstat (limited to 'llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp')
| -rw-r--r-- | llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp index a4fa063ae61c..615c077fe4bd 100644 --- a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp +++ b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp @@ -933,21 +933,19 @@ std::string TreePredicateFn::getPredCode() const { getMinAlignment() < 1) PrintFatalError(getOrigPatFragRecord()->getRecord()->getLoc(), "IsLoad cannot be used by itself"); - } else { + } else if (!isAtomic()) { if (isNonExtLoad()) PrintFatalError(getOrigPatFragRecord()->getRecord()->getLoc(), - "IsNonExtLoad requires IsLoad"); - if (!isAtomic()) { - if (isAnyExtLoad()) - PrintFatalError(getOrigPatFragRecord()->getRecord()->getLoc(), - "IsAnyExtLoad requires IsLoad or IsAtomic"); - if (isSignExtLoad()) - PrintFatalError(getOrigPatFragRecord()->getRecord()->getLoc(), - "IsSignExtLoad requires IsLoad or IsAtomic"); - if (isZeroExtLoad()) - PrintFatalError(getOrigPatFragRecord()->getRecord()->getLoc(), - "IsZeroExtLoad requires IsLoad or IsAtomic"); - } + "IsNonExtLoad requires IsLoad or IsAtomic"); + if (isAnyExtLoad()) + PrintFatalError(getOrigPatFragRecord()->getRecord()->getLoc(), + "IsAnyExtLoad requires IsLoad or IsAtomic"); + if (isSignExtLoad()) + PrintFatalError(getOrigPatFragRecord()->getRecord()->getLoc(), + "IsSignExtLoad requires IsLoad or IsAtomic"); + if (isZeroExtLoad()) + PrintFatalError(getOrigPatFragRecord()->getRecord()->getLoc(), + "IsZeroExtLoad requires IsLoad or IsAtomic"); } if (isStore()) { @@ -966,10 +964,10 @@ std::string TreePredicateFn::getPredCode() const { } if (isAtomic()) { - if (getMemoryVT() == nullptr && !isAtomicOrderingMonotonic() && - getAddressSpaces() == nullptr && + if (getMemoryVT() == nullptr && getAddressSpaces() == nullptr && // FIXME: Should atomic loads be IsLoad, IsAtomic, or both? - !isAnyExtLoad() && !isZeroExtLoad() && !isSignExtLoad() && + !isNonExtLoad() && !isAnyExtLoad() && !isZeroExtLoad() && + !isSignExtLoad() && !isAtomicOrderingMonotonic() && !isAtomicOrderingAcquire() && !isAtomicOrderingRelease() && !isAtomicOrderingAcquireRelease() && !isAtomicOrderingSequentiallyConsistent() && @@ -1076,11 +1074,16 @@ std::string TreePredicateFn::getPredCode() const { "return false;\n"; if (isAtomic()) { - if ((isAnyExtLoad() + isSignExtLoad() + isZeroExtLoad()) > 1) - PrintFatalError(getOrigPatFragRecord()->getRecord()->getLoc(), - "IsAnyExtLoad, IsSignExtLoad, and IsZeroExtLoad are " - "mutually exclusive"); + if ((isNonExtLoad() + isAnyExtLoad() + isSignExtLoad() + isZeroExtLoad()) > + 1) + PrintFatalError( + getOrigPatFragRecord()->getRecord()->getLoc(), + "IsNonExtLoad, IsAnyExtLoad, IsSignExtLoad, and IsZeroExtLoad are " + "mutually exclusive"); + if (isNonExtLoad()) + Code += "if (cast<AtomicSDNode>(N)->getExtensionType() != " + "ISD::NON_EXTLOAD) return false;\n"; if (isAnyExtLoad()) Code += "if (cast<AtomicSDNode>(N)->getExtensionType() != ISD::EXTLOAD) " "return false;\n"; |
