[PATCH] D73013: [X86] Add function isPrefix()

Kan Shengchen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 29 22:13:29 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGeb054577e9dd: [X86] Add function isPrefix() (authored by skan).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73013/new/

https://reviews.llvm.org/D73013

Files:
  llvm/lib/Target/X86/MCTargetDesc/X86BaseInfo.h


Index: llvm/lib/Target/X86/MCTargetDesc/X86BaseInfo.h
===================================================================
--- llvm/lib/Target/X86/MCTargetDesc/X86BaseInfo.h
+++ llvm/lib/Target/X86/MCTargetDesc/X86BaseInfo.h
@@ -346,6 +346,33 @@
     llvm_unreachable("unknown fusion type");
   }
 
+  /// \returns true if the instruction with given opcode is a prefix.
+  inline bool isPrefix(unsigned Opcode) {
+    switch (Opcode) {
+    default:
+      return false;
+      // segment override prefix
+    case X86::CS_PREFIX:
+    case X86::DS_PREFIX:
+    case X86::ES_PREFIX:
+    case X86::FS_PREFIX:
+    case X86::GS_PREFIX:
+    case X86::SS_PREFIX:
+      // operand-size override prefix
+    case X86::DATA16_PREFIX:
+      // lock and repeat prefix
+    case X86::LOCK_PREFIX:
+    case X86::REPNE_PREFIX:
+    case X86::REP_PREFIX:
+      // rex64 prefix
+    case X86::REX64_PREFIX:
+      // acquire and release prefix
+    case X86::XACQUIRE_PREFIX:
+    case X86::XRELEASE_PREFIX:
+      return true;
+    }
+  }
+
   /// Defines the possible values of the branch boundary alignment mask.
   enum AlignBranchBoundaryKind : uint8_t {
     AlignBranchNone = 0,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73013.241350.patch
Type: text/x-patch
Size: 1177 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200130/11c9bf29/attachment.bin>


More information about the llvm-commits mailing list