[llvm] eb05457 - [X86] Add function isPrefix()
Shengchen Kan via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 29 22:12:25 PST 2020
Author: Shengchen Kan
Date: 2020-01-30T14:11:50+08:00
New Revision: eb054577e9dd18dc99cc757307c1218b8e321a43
URL: https://github.com/llvm/llvm-project/commit/eb054577e9dd18dc99cc757307c1218b8e321a43
DIFF: https://github.com/llvm/llvm-project/commit/eb054577e9dd18dc99cc757307c1218b8e321a43.diff
LOG: [X86] Add function isPrefix()
Currently some prefixes are emitted as instructions, to distinguish them
from real instruction, fuction isPrefix() is added. The kinds of prefix
are consistent with X86GenInstrInfo.inc.
Differential Revision: https://reviews.llvm.org/D73013
Added:
Modified:
llvm/lib/Target/X86/MCTargetDesc/X86BaseInfo.h
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86BaseInfo.h b/llvm/lib/Target/X86/MCTargetDesc/X86BaseInfo.h
index eb94237180df..a1f73dd287d9 100644
--- a/llvm/lib/Target/X86/MCTargetDesc/X86BaseInfo.h
+++ b/llvm/lib/Target/X86/MCTargetDesc/X86BaseInfo.h
@@ -346,6 +346,33 @@ namespace X86 {
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,
More information about the llvm-commits
mailing list