[llvm] r249169 - Add way to test for generic TargetOpcodes

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 2 11:58:33 PDT 2015


Author: arsenm
Date: Fri Oct  2 13:58:33 2015
New Revision: 249169

URL: http://llvm.org/viewvc/llvm-project?rev=249169&view=rev
Log:
Add way to test for generic TargetOpcodes

The alternative would be to add a bit to the target's
InstrFlags but that seems like a waste of a bit.

Modified:
    llvm/trunk/include/llvm/Target/TargetInstrInfo.h
    llvm/trunk/include/llvm/Target/TargetOpcodes.h

Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrInfo.h?rev=249169&r1=249168&r2=249169&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetInstrInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetInstrInfo.h Fri Oct  2 13:58:33 2015
@@ -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,

Modified: llvm/trunk/include/llvm/Target/TargetOpcodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetOpcodes.h?rev=249169&r1=249168&r2=249169&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetOpcodes.h (original)
+++ llvm/trunk/include/llvm/Target/TargetOpcodes.h Fri Oct  2 13:58:33 2015
@@ -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




More information about the llvm-commits mailing list