diff options
| author | Serge Pavlov <sepavloff@gmail.com> | 2025-09-27 01:25:01 +0700 |
|---|---|---|
| committer | Serge Pavlov <sepavloff@gmail.com> | 2025-10-12 22:31:44 +0700 |
| commit | 3ebfbac73029b99942da36eab605127dfbc2e8c5 (patch) | |
| tree | e30a734654b4610b8dcc1540bfe8260d47430ffa /llvm/utils/TableGen/SDNodeInfoEmitter.cpp | |
| parent | 63452220292b51b19c3fe98ec62c4098f35e9989 (diff) | |
[TableGen] Support for optional chain in Selection DAG nodesusers/spavloff/op-chain
This change adds a new property for Selection DAG nodes used in pattern
descriptions: SDNPMayHaveChain. A node with this property may have or
may not have a chain operand. For example, both of the following
variants become valid:
t3: f32,ch = fnearbyint t0, t2
t3: f32 = fnearbyint t2
The specific variant is determined during pattern matching, based on
whether the first operand is a chain (i.e. has the type MVT::Other).
This feature is intended to be used for floating point operations. They
have side effects in a strictfp environment and are pure functions in
the default FP environment. Currently each such operation requires two
opcodes - one for each kind of FP environment. These opcodes represent
the same operation and are processed similarly, which increase amount of
code. With this feature the support of strictfp environment should be
easier, as it can use the same opcode as the default environment.
Diffstat (limited to 'llvm/utils/TableGen/SDNodeInfoEmitter.cpp')
| -rw-r--r-- | llvm/utils/TableGen/SDNodeInfoEmitter.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/utils/TableGen/SDNodeInfoEmitter.cpp b/llvm/utils/TableGen/SDNodeInfoEmitter.cpp index 64f03dae83e7..e728c85d3e3b 100644 --- a/llvm/utils/TableGen/SDNodeInfoEmitter.cpp +++ b/llvm/utils/TableGen/SDNodeInfoEmitter.cpp @@ -67,7 +67,8 @@ static bool haveCompatibleDescriptions(const SDNodeInfo &N1, // and sometimes differ between nodes sharing the same enum name. constexpr unsigned PropMask = (1 << SDNPHasChain) | (1 << SDNPOutGlue) | (1 << SDNPInGlue) | (1 << SDNPOptInGlue) | - (1 << SDNPMemOperand) | (1 << SDNPVariadic); + (1 << SDNPMemOperand) | (1 << SDNPVariadic) | + (1 << SDNPMayHaveChain); return (N1.getProperties() & PropMask) == (N2.getProperties() & PropMask); } @@ -312,6 +313,8 @@ static void emitDesc(raw_ostream &OS, StringRef EnumName, OS << "|1<<SDNPVariadic"; if (Properties & (1 << SDNPMemOperand)) OS << "|1<<SDNPMemOperand"; + if (Properties & (1 << SDNPMayHaveChain)) + OS << "|1<<SDNPMayHaveChain"; OS << ", 0"; if (N.isStrictFP()) |
