[PATCH] D12464: Add way to test for builtin TargetOpcode

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 28 18:20:37 PDT 2015


arsenm created this revision.
arsenm added a subscriber: llvm-commits.

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

http://reviews.llvm.org/D12464

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

Index: include/llvm/Target/TargetOpcodes.h
===================================================================
--- include/llvm/Target/TargetOpcodes.h
+++ include/llvm/Target/TargetOpcodes.h
@@ -128,6 +128,10 @@
   /// "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.
+  BUILTIN_OP_END = FAULTING_LOAD_OP,
 };
 } // end namespace TargetOpcode
 } // end namespace llvm
Index: include/llvm/Target/TargetInstrInfo.h
===================================================================
--- include/llvm/Target/TargetInstrInfo.h
+++ include/llvm/Target/TargetInstrInfo.h
@@ -61,6 +61,10 @@
 
   virtual ~TargetInstrInfo();
 
+  static bool isBuiltinOpcode(unsigned Opc) {
+    return Opc < TargetOpcode::BUILTIN_OP_END;
+  }
+
   /// Given a machine instruction descriptor, returns the register
   /// class constraint for OpNum, or NULL.
   const TargetRegisterClass *getRegClass(const MCInstrDesc &TID,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12464.33505.patch
Type: text/x-patch
Size: 1134 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150829/dfff9050/attachment.bin>


More information about the llvm-commits mailing list