[PATCH] D134266: Generic atomic instructions identifier function

Yashwant Singh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 20 02:00:31 PDT 2022


yassingh created this revision.
Herald added a project: All.
yassingh requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Bounded generic atomic opcodes by markers that are used to check if a opcode is G_ATOMIC_ type


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134266

Files:
  llvm/include/llvm/CodeGen/TargetInstrInfo.h
  llvm/include/llvm/Support/TargetOpcodes.def


Index: llvm/include/llvm/Support/TargetOpcodes.def
===================================================================
--- llvm/include/llvm/Support/TargetOpcodes.def
+++ llvm/include/llvm/Support/TargetOpcodes.def
@@ -387,6 +387,14 @@
 HANDLE_TARGET_OPCODE(G_ATOMICRMW_FMAX)
 HANDLE_TARGET_OPCODE(G_ATOMICRMW_FMIN)
 
+// Marker for start of Generic Atomic opcodes
+HANDLE_TARGET_OPCODE_MARKER(PRE_ISEL_GENERIC_ATOMIC_OPCODE_START, G_ATOMIC_CMPXCHG_WITH_SUCCESS)
+HANDLE_TARGET_OPCODE_MARKER(GENERIC_ATOMIC_OP_START, PRE_ISEL_GENERIC_ATOMIC_OPCODE_START)
+
+// Marker of end of Generic Atomic opcodes
+HANDLE_TARGET_OPCODE_MARKER(PRE_ISEL_GENERIC_ATOMIC_OPCODE_END, G_ATOMICRMW_FMIN)
+HANDLE_TARGET_OPCODE_MARKER(GENERIC_ATOMIC_OP_END, PRE_ISEL_GENERIC_ATOMIC_OPCODE_END)
+
 // Generic atomic fence
 HANDLE_TARGET_OPCODE(G_FENCE)
 
Index: llvm/include/llvm/CodeGen/TargetInstrInfo.h
===================================================================
--- llvm/include/llvm/CodeGen/TargetInstrInfo.h
+++ llvm/include/llvm/CodeGen/TargetInstrInfo.h
@@ -110,6 +110,11 @@
     return Opc <= TargetOpcode::GENERIC_OP_END;
   }
 
+  static bool isGenericAtomicOpcode(unsigned Opc) {
+    return TargetOpcode::GENERIC_ATOMIC_OP_START <= Opc &&
+           Opc <= TargetOpcode::GENERIC_ATOMIC_OP_END;
+  }
+
   /// Given a machine instruction descriptor, returns the register
   /// class constraint for OpNum, or NULL.
   virtual


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134266.461498.patch
Type: text/x-patch
Size: 1423 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220920/b4a2ff2b/attachment.bin>


More information about the llvm-commits mailing list