[llvm] 59fe64a - Let IntrinsicEmitter free from CodeGenTarget.h

NAKAMURA Takumi via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 14 16:10:27 PDT 2023


Author: NAKAMURA Takumi
Date: 2023-03-15T08:09:44+09:00
New Revision: 59fe64ae47d29fd846f0753a6e61e3dc8d97ecdb

URL: https://github.com/llvm/llvm-project/commit/59fe64ae47d29fd846f0753a6e61e3dc8d97ecdb
DIFF: https://github.com/llvm/llvm-project/commit/59fe64ae47d29fd846f0753a6e61e3dc8d97ecdb.diff

LOG: Let IntrinsicEmitter free from CodeGenTarget.h

For now, I have introduced `llvm::tmp::getValueType(Rec)` as a copy from
`CodeGenTarget.cpp`. This will be removed in the near future, when
IntrinsicEmitter will not depend on MVT.

Differential Revision: https://reviews.llvm.org/D143844

Added: 
    

Modified: 
    llvm/utils/TableGen/CodeGenIntrinsics.cpp
    llvm/utils/TableGen/CodeGenIntrinsics.h
    llvm/utils/TableGen/IntrinsicEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/CodeGenIntrinsics.cpp b/llvm/utils/TableGen/CodeGenIntrinsics.cpp
index 602da4c0edab..73e40c7dd6b8 100644
--- a/llvm/utils/TableGen/CodeGenIntrinsics.cpp
+++ b/llvm/utils/TableGen/CodeGenIntrinsics.cpp
@@ -11,7 +11,6 @@
 //===----------------------------------------------------------------------===//
 
 #include "CodeGenIntrinsics.h"
-#include "CodeGenTarget.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/Twine.h"
@@ -21,6 +20,13 @@
 #include <algorithm>
 #include <cassert>
 using namespace llvm;
+using namespace llvm::tmp;
+
+/// getValueType - Return the MVT::SimpleValueType that the specified TableGen
+/// record corresponds to.
+MVT::SimpleValueType llvm::tmp::getValueType(Record *Rec) {
+  return (MVT::SimpleValueType)Rec->getValueAsInt("Value");
+}
 
 //===----------------------------------------------------------------------===//
 // CodeGenIntrinsic Implementation

diff  --git a/llvm/utils/TableGen/CodeGenIntrinsics.h b/llvm/utils/TableGen/CodeGenIntrinsics.h
index 2278216de137..d704b0e531d3 100644
--- a/llvm/utils/TableGen/CodeGenIntrinsics.h
+++ b/llvm/utils/TableGen/CodeGenIntrinsics.h
@@ -25,6 +25,13 @@ namespace llvm {
 class Record;
 class RecordKeeper;
 
+// FIXME: Sweep this in the near future.
+namespace tmp {
+/// getValueType - Return the MVT::SimpleValueType that the specified TableGen
+/// record corresponds to.
+MVT::SimpleValueType getValueType(Record *Rec);
+} // namespace tmp
+
 struct CodeGenIntrinsic {
   Record *TheDef;             // The actual record defining this intrinsic.
   std::string Name;           // The name of the LLVM function "llvm.bswap.i32"

diff  --git a/llvm/utils/TableGen/IntrinsicEmitter.cpp b/llvm/utils/TableGen/IntrinsicEmitter.cpp
index 9fce53e8dbd0..b759c7181112 100644
--- a/llvm/utils/TableGen/IntrinsicEmitter.cpp
+++ b/llvm/utils/TableGen/IntrinsicEmitter.cpp
@@ -11,7 +11,6 @@
 //===----------------------------------------------------------------------===//
 
 #include "CodeGenIntrinsics.h"
-#include "CodeGenTarget.h"
 #include "SequenceToOffsetTable.h"
 #include "TableGenBackends.h"
 #include "llvm/ADT/ArrayRef.h"
@@ -37,6 +36,7 @@
 #include <utility>
 #include <vector>
 using namespace llvm;
+using namespace llvm::tmp;
 
 cl::OptionCategory GenIntrinsicCat("Options for -gen-intrinsic-enums");
 cl::opt<std::string>


        


More information about the llvm-commits mailing list