Add way to test for generic TargetOpcodes
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 2 Oct 2015 18:58:33 +0000 (18:58 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 2 Oct 2015 18:58:33 +0000 (18:58 +0000)
The alternative would be to add a bit to the target's
InstrFlags but that seems like a waste of a bit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249169 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/TargetInstrInfo.h
include/llvm/Target/TargetOpcodes.h

index b9f85a133a36a09bdb925f1a5ff81fd4a7de41f6..0a35d4178d9cf11721c1dbe510a3477d13c3c074 100644 (file)
@@ -62,6 +62,10 @@ public:
 
   virtual ~TargetInstrInfo();
 
+  static bool isGenericOpcode(unsigned Opc) {
+    return Opc <= TargetOpcode::GENERIC_OP_END;
+  }
+
   /// Given a machine instruction descriptor, returns the register
   /// class constraint for OpNum, or NULL.
   const TargetRegisterClass *getRegClass(const MCInstrDesc &TID,
index a7e2aa82a28e0c242c1ff26e628a789c72abb0b4..db37bdb62582f35395d5137b57664023d51ce6a5 100644 (file)
@@ -128,6 +128,10 @@ enum {
   /// "zero cost" null checks in managed languages by allowing LLVM to fold
   /// comparisons into existing memory operations.
   FAULTING_LOAD_OP = 22,
+
+  /// BUILTIN_OP_END - This must be the last enum value in this list.
+  /// The target-specific post-isel opcode values start here.
+  GENERIC_OP_END = FAULTING_LOAD_OP,
 };
 } // end namespace TargetOpcode
 } // end namespace llvm