[llvm] a365fc4 - Let IntrinsicEnums.inc conditional by GET_INTRINSIC_ENUM_VALUES

NAKAMURA Takumi via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 30 17:15:40 PDT 2023


Author: NAKAMURA Takumi
Date: 2023-03-31T09:15:08+09:00
New Revision: a365fc4e56f16ca12b7b13a409025eaabf7e32fc

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

LOG: Let IntrinsicEnums.inc conditional by GET_INTRINSIC_ENUM_VALUES

Part of https://reviews.llvm.org/D145873

Added: 
    

Modified: 
    llvm/utils/TableGen/IntrinsicEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/IntrinsicEmitter.cpp b/llvm/utils/TableGen/IntrinsicEmitter.cpp
index 704c12611fde6..e93182849173d 100644
--- a/llvm/utils/TableGen/IntrinsicEmitter.cpp
+++ b/llvm/utils/TableGen/IntrinsicEmitter.cpp
@@ -124,7 +124,9 @@ void IntrinsicEmitter::EmitEnumInfo(const CodeGenIntrinsicTable &Ints,
   }
 
   // Generate a complete header for target specific intrinsics.
-  if (!IntrinsicPrefix.empty()) {
+  if (IntrinsicPrefix.empty()) {
+    OS << "#ifdef GET_INTRINSIC_ENUM_VALUES\n";
+  } else {
     std::string UpperPrefix = StringRef(IntrinsicPrefix).upper();
     OS << "#ifndef LLVM_IR_INTRINSIC_" << UpperPrefix << "_ENUMS_H\n";
     OS << "#define LLVM_IR_INTRINSIC_" << UpperPrefix << "_ENUMS_H\n\n";
@@ -151,6 +153,7 @@ void IntrinsicEmitter::EmitEnumInfo(const CodeGenIntrinsicTable &Ints,
   // Emit num_intrinsics into the target neutral enum.
   if (IntrinsicPrefix.empty()) {
     OS << "    num_intrinsics = " << (Ints.size() + 1) << "\n";
+    OS << "#endif\n\n";
   } else {
     OS << "}; // enum\n";
     OS << "} // namespace Intrinsic\n";


        


More information about the llvm-commits mailing list