[llvm] c32d2ee - [NFC][TableGen] Adopt CodeGenHelpers in CodeGenMapTable (#168592)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 18 16:46:34 PST 2025
Author: Rahul Joshi
Date: 2025-11-18T16:46:30-08:00
New Revision: c32d2ee4659170d281d0d89a1d396267e36fc7da
URL: https://github.com/llvm/llvm-project/commit/c32d2ee4659170d281d0d89a1d396267e36fc7da
DIFF: https://github.com/llvm/llvm-project/commit/c32d2ee4659170d281d0d89a1d396267e36fc7da.diff
LOG: [NFC][TableGen] Adopt CodeGenHelpers in CodeGenMapTable (#168592)
Adopt `IfDefEmitter` and `NamespaceEmitter` in CodeGenMapTable.cpp
Added:
Modified:
llvm/utils/TableGen/CodeGenMapTable.cpp
Removed:
################################################################################
diff --git a/llvm/utils/TableGen/CodeGenMapTable.cpp b/llvm/utils/TableGen/CodeGenMapTable.cpp
index e5025784d304d..35ec495b93ba2 100644
--- a/llvm/utils/TableGen/CodeGenMapTable.cpp
+++ b/llvm/utils/TableGen/CodeGenMapTable.cpp
@@ -80,6 +80,7 @@
#include "TableGenBackends.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/StringExtras.h"
+#include "llvm/TableGen/CodeGenHelpers.h"
#include "llvm/TableGen/Error.h"
#include "llvm/TableGen/Record.h"
@@ -549,9 +550,8 @@ void llvm::EmitMapTable(const RecordKeeper &Records, raw_ostream &OS) {
if (InstrMapVec.empty())
return;
- OS << "#ifdef GET_INSTRMAP_INFO\n";
- OS << "#undef GET_INSTRMAP_INFO\n";
- OS << "namespace llvm::" << NameSpace << " {\n\n";
+ IfDefEmitter IfDef(OS, "GET_INSTRMAP_INFO");
+ NamespaceEmitter NS(OS, ("llvm::" + NameSpace).str());
// Emit coulumn field names and their values as enums.
emitEnums(OS, Records);
@@ -574,6 +574,4 @@ void llvm::EmitMapTable(const RecordKeeper &Records, raw_ostream &OS) {
// Emit map tables and the functions to query them.
IMap.emitTablesWithFunc(OS);
}
- OS << "} // end namespace llvm::" << NameSpace << '\n';
- OS << "#endif // GET_INSTRMAP_INFO\n\n";
}
More information about the llvm-commits
mailing list