[llvm] [TableGen] Remove deprecated !getop and !setop (PR #175155)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 9 03:24:12 PST 2026


https://github.com/jayfoad created https://github.com/llvm/llvm-project/pull/175155

They have been deprecated for more than five years in favor of !getdagop
and !setdagop. See https://reviews.llvm.org/D89814.


>From fe50868a3d2596ae7b9fb1d81df59a1c084dbd32 Mon Sep 17 00:00:00 2001
From: Jay Foad <jay.foad at amd.com>
Date: Fri, 9 Jan 2026 11:19:24 +0000
Subject: [PATCH] [TableGen] Remove deprecated !getop and !setop

They have been deprecated for more than five years in favor of !getdagop
and !setdagop. See https://reviews.llvm.org/D89814.
---
 llvm/docs/ReleaseNotes.md                          | 3 +++
 llvm/docs/TableGen/ProgRef.rst                     | 4 ----
 llvm/lib/TableGen/TGLexer.cpp                      | 6 ++----
 llvm/test/TableGen/{getsetop.td => getsetdagop.td} | 7 ++-----
 4 files changed, 7 insertions(+), 13 deletions(-)
 rename llvm/test/TableGen/{getsetop.td => getsetdagop.td} (96%)

diff --git a/llvm/docs/ReleaseNotes.md b/llvm/docs/ReleaseNotes.md
index eb51bc1e44d94..5ac24286206db 100644
--- a/llvm/docs/ReleaseNotes.md
+++ b/llvm/docs/ReleaseNotes.md
@@ -85,6 +85,9 @@ Changes to building LLVM
 Changes to TableGen
 -------------------
 
+* The `!getop` and `!setop` bang operators have been removed in favor of
+  `!getdagop` and `!setdagop`.
+
 Changes to Interprocedural Optimizations
 ----------------------------------------
 
diff --git a/llvm/docs/TableGen/ProgRef.rst b/llvm/docs/TableGen/ProgRef.rst
index 0ff4cc764eaaf..2e66778b42ae1 100644
--- a/llvm/docs/TableGen/ProgRef.rst
+++ b/llvm/docs/TableGen/ProgRef.rst
@@ -1654,10 +1654,6 @@ operator produces a boolean result, the result value will be 1 for true or 0
 for false. When an operator tests a boolean argument, it interprets 0 as false
 and non-0 as true.
 
-.. warning::
-  The ``!getop`` and ``!setop`` bang operators are deprecated in favor of
-  ``!getdagop`` and ``!setdagop``.
-
 ``!add(``\ *a*\ ``,`` *b*\ ``, ...)``
     This operator adds *a*, *b*, etc., and produces the sum.
 
diff --git a/llvm/lib/TableGen/TGLexer.cpp b/llvm/lib/TableGen/TGLexer.cpp
index e8e64695e1ac4..3c88f107f790a 100644
--- a/llvm/lib/TableGen/TGLexer.cpp
+++ b/llvm/lib/TableGen/TGLexer.cpp
@@ -682,10 +682,8 @@ tgtok::TokKind TGLexer::LexExclaim() {
           .Case("instances", tgtok::XInstances)
           .Case("substr", tgtok::XSubstr)
           .Case("find", tgtok::XFind)
-          .Cases({"setdagop", "setop"},
-                 tgtok::XSetDagOp) // !setop is deprecated.
-          .Cases({"getdagop", "getop"},
-                 tgtok::XGetDagOp) // !getop is deprecated.
+          .Case("setdagop", tgtok::XSetDagOp)
+          .Case("getdagop", tgtok::XGetDagOp)
           .Case("setdagopname", tgtok::XSetDagOpName)
           .Case("getdagopname", tgtok::XGetDagOpName)
           .Case("getdagarg", tgtok::XGetDagArg)
diff --git a/llvm/test/TableGen/getsetop.td b/llvm/test/TableGen/getsetdagop.td
similarity index 96%
rename from llvm/test/TableGen/getsetop.td
rename to llvm/test/TableGen/getsetdagop.td
index 031606fc940d7..ede31ff73f3be 100644
--- a/llvm/test/TableGen/getsetop.td
+++ b/llvm/test/TableGen/getsetdagop.td
@@ -10,9 +10,6 @@
 // RUN: not llvm-tblgen -DERROR9 %s 2>&1 | FileCheck --check-prefix=ERROR9 %s
 // RUN: not llvm-tblgen -DERROR10 %s 2>&1 | FileCheck --check-prefix=ERROR10 %s
 
-// !setop and !getop are deprecated in favor of !setdagop and !getdagop.
-// Two tests retain the old names just to be sure they are still supported.
-
 class Base;
 class OtherBase;
 
@@ -31,13 +28,13 @@ def test {
   dag named = (foo:$root 1, 2:$a, $b);
 
   // CHECK: dag replaceWithBar = (bar 1, 2:$a, ?:$b);
-  dag replaceWithBar = !setop(orig, bar);
+  dag replaceWithBar = !setdagop(orig, bar);
 
   // CHECK: dag replaceWithBaz = (qux 1, 2:$a, ?:$b);
   dag replaceWithBaz = !setdagop(orig, qux);
 
   // CHECK: Base getopWithCast = foo;
-  Base getopWithCast = !getop<Base>(orig);
+  Base getopWithCast = !getdagop<Base>(orig);
 
   // CHECK: dag getopToSetop = (foo "hello", ?:$world);
   dag getopToSetop = !setdagop(another, !getdagop(orig));



More information about the llvm-commits mailing list