LLVM 20.0.0git
Macros | Functions | Variables
X86InstComments.cpp File Reference
#include "X86InstComments.h"
#include "X86ATTInstPrinter.h"
#include "X86BaseInfo.h"
#include "X86MCTargetDesc.h"
#include "X86ShuffleDecode.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/Support/raw_ostream.h"
#include <string_view>

Go to the source code of this file.

Macros

#define CASE_SSE_INS_COMMON(Inst, src)    case X86::Inst##src:
 
#define CASE_AVX_INS_COMMON(Inst, Suffix, src)    case X86::V##Inst##Suffix##src:
 
#define CASE_MASK_INS_COMMON(Inst, Suffix, src)    case X86::V##Inst##Suffix##src##k:
 
#define CASE_MASKZ_INS_COMMON(Inst, Suffix, src)    case X86::V##Inst##Suffix##src##kz:
 
#define CASE_AVX512_INS_COMMON(Inst, Suffix, src)
 
#define CASE_FPCLASS_PACKED(Inst, src)
 
#define CASE_FPCLASS_PACKED_MEM(Inst)
 
#define CASE_FPCLASS_SCALAR(Inst, src)
 
#define CASE_PTERNLOG(Inst, src)
 
#define CASE_MOVDUP(Inst, src)
 
#define CASE_MASK_MOVDUP(Inst, src)
 
#define CASE_MASKZ_MOVDUP(Inst, src)
 
#define CASE_PMOVZX(Inst, src)
 
#define CASE_UNPCK(Inst, src)
 
#define CASE_MASK_UNPCK(Inst, src)
 
#define CASE_MASKZ_UNPCK(Inst, src)
 
#define CASE_SHUF(Inst, suf)
 
#define CASE_MASK_SHUF(Inst, src)
 
#define CASE_MASKZ_SHUF(Inst, src)
 
#define CASE_VPERMILPI(Inst, src)
 
#define CASE_MASK_VPERMILPI(Inst, src)
 
#define CASE_MASKZ_VPERMILPI(Inst, src)
 
#define CASE_VPERM(Inst, src)
 
#define CASE_MASK_VPERM(Inst, src)
 
#define CASE_MASKZ_VPERM(Inst, src)
 
#define CASE_VSHUF(Inst, src)
 
#define CASE_MASK_VSHUF(Inst, src)
 
#define CASE_MASKZ_VSHUF(Inst, src)
 
#define CASE_AVX512_FMA(Inst, suf)
 
#define CASE_FMA(Inst, suf)
 
#define CASE_FMA_PACKED_REG(Inst)
 
#define CASE_FMA_PACKED_MEM(Inst)
 
#define CASE_FMA_SCALAR_REG(Inst)
 
#define CASE_FMA_SCALAR_MEM(Inst)
 
#define CASE_FMA4(Inst, suf)
 
#define CASE_FMA4_PACKED_RR(Inst)
 
#define CASE_FMA4_PACKED_RM(Inst)
 
#define CASE_FMA4_PACKED_MR(Inst)
 
#define CASE_FMA4_SCALAR_RR(Inst)
 
#define CASE_FMA4_SCALAR_RM(Inst)
 
#define CASE_FMA4_SCALAR_MR(Inst)
 

Functions

static unsigned getVectorRegSize (MCRegister Reg)
 
static unsigned getRegOperandNumElts (const MCInst *MI, unsigned ScalarSize, unsigned OperandIndex)
 
static const chargetRegName (MCRegister Reg)
 
static void printMasking (raw_ostream &OS, const MCInst *MI, const MCInstrInfo &MCII)
 Wraps the destination register name with AVX512 mask/maskz filtering.
 
static bool printFMAComments (const MCInst *MI, raw_ostream &OS, const MCInstrInfo &MCII)
 
static bool printPTERNLOGComments (const MCInst *MI, raw_ostream &OS, const MCInstrInfo &MCII)
 
static bool printFPCLASSComments (const MCInst *MI, raw_ostream &OS, const MCInstrInfo &MCII)
 

Variables

constexpr StringLiteral TernlogFunctions []
 

Macro Definition Documentation

◆ CASE_AVX512_FMA

#define CASE_AVX512_FMA (   Inst,
  suf 
)
Value:
CASE_AVX512_INS_COMMON(Inst, Z, suf) \
CASE_AVX512_INS_COMMON(Inst, Z256, suf) \
CASE_AVX512_INS_COMMON(Inst, Z128, suf)
#define CASE_AVX512_INS_COMMON(Inst, Suffix, src)

Definition at line 172 of file X86InstComments.cpp.

◆ CASE_AVX512_INS_COMMON

#define CASE_AVX512_INS_COMMON (   Inst,
  Suffix,
  src 
)
Value:
CASE_AVX_INS_COMMON(Inst, Suffix, src) \
CASE_MASK_INS_COMMON(Inst, Suffix, src) \
CASE_MASKZ_INS_COMMON(Inst, Suffix, src)
#define CASE_AVX_INS_COMMON(Inst, Suffix, src)

Definition at line 38 of file X86InstComments.cpp.

◆ CASE_AVX_INS_COMMON

#define CASE_AVX_INS_COMMON (   Inst,
  Suffix,
  src 
)     case X86::V##Inst##Suffix##src:

Definition at line 29 of file X86InstComments.cpp.

◆ CASE_FMA

#define CASE_FMA (   Inst,
  suf 
)
Value:
CASE_AVX512_FMA(Inst, suf) \
CASE_AVX_INS_COMMON(Inst, , suf) \
CASE_AVX_INS_COMMON(Inst, Y, suf)
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
#define CASE_AVX512_FMA(Inst, suf)

Definition at line 177 of file X86InstComments.cpp.

◆ CASE_FMA4

#define CASE_FMA4 (   Inst,
  suf 
)
Value:
CASE_AVX_INS_COMMON(Inst, 4, suf) \
CASE_AVX_INS_COMMON(Inst, 4Y, suf)

Definition at line 212 of file X86InstComments.cpp.

◆ CASE_FMA4_PACKED_MR

#define CASE_FMA4_PACKED_MR (   Inst)
Value:
CASE_FMA4(Inst##PD, mr) \
CASE_FMA4(Inst##PS, mr)
#define CASE_FMA4(Inst, suf)

Definition at line 224 of file X86InstComments.cpp.

◆ CASE_FMA4_PACKED_RM

#define CASE_FMA4_PACKED_RM (   Inst)
Value:
CASE_FMA4(Inst##PD, rm) \
CASE_FMA4(Inst##PS, rm)

Definition at line 220 of file X86InstComments.cpp.

◆ CASE_FMA4_PACKED_RR

#define CASE_FMA4_PACKED_RR (   Inst)
Value:
CASE_FMA4(Inst##PD, rr) \
CASE_FMA4(Inst##PS, rr)

Definition at line 216 of file X86InstComments.cpp.

◆ CASE_FMA4_SCALAR_MR

#define CASE_FMA4_SCALAR_MR (   Inst)
Value:
CASE_AVX_INS_COMMON(Inst##SD4, , mr) \
CASE_AVX_INS_COMMON(Inst##SS4, , mr) \
CASE_AVX_INS_COMMON(Inst##SD4, , mr_Int) \
CASE_AVX_INS_COMMON(Inst##SS4, , mr_Int)

Definition at line 240 of file X86InstComments.cpp.

◆ CASE_FMA4_SCALAR_RM

#define CASE_FMA4_SCALAR_RM (   Inst)
Value:
CASE_AVX_INS_COMMON(Inst##SD4, , rm) \
CASE_AVX_INS_COMMON(Inst##SS4, , rm) \
CASE_AVX_INS_COMMON(Inst##SD4, , rm_Int) \
CASE_AVX_INS_COMMON(Inst##SS4, , rm_Int)

Definition at line 234 of file X86InstComments.cpp.

◆ CASE_FMA4_SCALAR_RR

#define CASE_FMA4_SCALAR_RR (   Inst)
Value:
CASE_AVX_INS_COMMON(Inst##SD4, , rr) \
CASE_AVX_INS_COMMON(Inst##SS4, , rr) \
CASE_AVX_INS_COMMON(Inst##SD4, , rr_Int) \
CASE_AVX_INS_COMMON(Inst##SS4, , rr_Int)

Definition at line 228 of file X86InstComments.cpp.

◆ CASE_FMA_PACKED_MEM

#define CASE_FMA_PACKED_MEM (   Inst)
Value:
CASE_FMA(Inst##PD, m) \
CASE_FMA(Inst##PS, m) \
CASE_AVX512_FMA(Inst##PD, mb) \
CASE_AVX512_FMA(Inst##PS, mb)
#define CASE_FMA(Inst, suf)

Definition at line 186 of file X86InstComments.cpp.

◆ CASE_FMA_PACKED_REG

#define CASE_FMA_PACKED_REG (   Inst)
Value:
CASE_FMA(Inst##PD, r) \
CASE_FMA(Inst##PS, r)

Definition at line 182 of file X86InstComments.cpp.

◆ CASE_FMA_SCALAR_MEM

#define CASE_FMA_SCALAR_MEM (   Inst)
Value:
CASE_AVX_INS_COMMON(Inst##SD, , m) \
CASE_AVX_INS_COMMON(Inst##SS, , m) \
CASE_AVX_INS_COMMON(Inst##SD, , m_Int) \
CASE_AVX_INS_COMMON(Inst##SS, , m_Int) \
CASE_AVX_INS_COMMON(Inst##SD, Z, m) \
CASE_AVX_INS_COMMON(Inst##SS, Z, m) \
CASE_AVX512_INS_COMMON(Inst##SD, Z, m_Int) \
CASE_AVX512_INS_COMMON(Inst##SS, Z, m_Int)

Definition at line 202 of file X86InstComments.cpp.

◆ CASE_FMA_SCALAR_REG

#define CASE_FMA_SCALAR_REG (   Inst)
Value:
CASE_AVX_INS_COMMON(Inst##SD, , r) \
CASE_AVX_INS_COMMON(Inst##SS, , r) \
CASE_AVX_INS_COMMON(Inst##SD, , r_Int) \
CASE_AVX_INS_COMMON(Inst##SS, , r_Int) \
CASE_AVX_INS_COMMON(Inst##SD, Z, r) \
CASE_AVX_INS_COMMON(Inst##SS, Z, r) \
CASE_AVX512_INS_COMMON(Inst##SD, Z, r_Int) \
CASE_AVX512_INS_COMMON(Inst##SS, Z, r_Int)

Definition at line 192 of file X86InstComments.cpp.

◆ CASE_FPCLASS_PACKED

#define CASE_FPCLASS_PACKED (   Inst,
  src 
)
Value:
CASE_AVX_INS_COMMON(Inst, Z, src##i) \
CASE_AVX_INS_COMMON(Inst, Z256, src##i) \
CASE_AVX_INS_COMMON(Inst, Z128, src##i) \
CASE_MASK_INS_COMMON(Inst, Z, src##i)

Definition at line 43 of file X86InstComments.cpp.

◆ CASE_FPCLASS_PACKED_MEM

#define CASE_FPCLASS_PACKED_MEM (   Inst)
Value:
CASE_FPCLASS_PACKED(Inst, mb)
#define CASE_FPCLASS_PACKED(Inst, src)

Definition at line 49 of file X86InstComments.cpp.

◆ CASE_FPCLASS_SCALAR

#define CASE_FPCLASS_SCALAR (   Inst,
  src 
)
Value:
CASE_AVX_INS_COMMON(Inst, Z, src##i) \
CASE_MASK_INS_COMMON(Inst, Z, src##i)

Definition at line 53 of file X86InstComments.cpp.

◆ CASE_MASK_INS_COMMON

#define CASE_MASK_INS_COMMON (   Inst,
  Suffix,
  src 
)     case X86::V##Inst##Suffix##src##k:

Definition at line 32 of file X86InstComments.cpp.

◆ CASE_MASK_MOVDUP

#define CASE_MASK_MOVDUP (   Inst,
  src 
)
Value:
CASE_MASK_INS_COMMON(Inst, Z, r##src) \
CASE_MASK_INS_COMMON(Inst, Z256, r##src) \
CASE_MASK_INS_COMMON(Inst, Z128, r##src)
#define CASE_MASK_INS_COMMON(Inst, Suffix, src)

Definition at line 70 of file X86InstComments.cpp.

◆ CASE_MASK_SHUF

#define CASE_MASK_SHUF (   Inst,
  src 
)
Value:
CASE_MASK_INS_COMMON(Inst, Z, r##src##i) \
CASE_MASK_INS_COMMON(Inst, Z256, r##src##i) \
CASE_MASK_INS_COMMON(Inst, Z128, r##src##i)

Definition at line 114 of file X86InstComments.cpp.

◆ CASE_MASK_UNPCK

#define CASE_MASK_UNPCK (   Inst,
  src 
)
Value:
CASE_MASK_INS_COMMON(Inst, Z, r##src) \
CASE_MASK_INS_COMMON(Inst, Z256, r##src) \
CASE_MASK_INS_COMMON(Inst, Z128, r##src)

Definition at line 96 of file X86InstComments.cpp.

◆ CASE_MASK_VPERM

#define CASE_MASK_VPERM (   Inst,
  src 
)
Value:
CASE_MASK_INS_COMMON(Inst, Z, src##i) \
CASE_MASK_INS_COMMON(Inst, Z256, src##i)

Definition at line 146 of file X86InstComments.cpp.

◆ CASE_MASK_VPERMILPI

#define CASE_MASK_VPERMILPI (   Inst,
  src 
)
Value:
CASE_MASK_INS_COMMON(Inst, Z, src##i) \
CASE_MASK_INS_COMMON(Inst, Z256, src##i) \
CASE_MASK_INS_COMMON(Inst, Z128, src##i)

Definition at line 131 of file X86InstComments.cpp.

◆ CASE_MASK_VSHUF

#define CASE_MASK_VSHUF (   Inst,
  src 
)
Value:
CASE_MASK_INS_COMMON(SHUFF##Inst, Z, r##src##i) \
CASE_MASK_INS_COMMON(SHUFI##Inst, Z, r##src##i) \
CASE_MASK_INS_COMMON(SHUFF##Inst, Z256, r##src##i) \
CASE_MASK_INS_COMMON(SHUFI##Inst, Z256, r##src##i)

Definition at line 160 of file X86InstComments.cpp.

◆ CASE_MASKZ_INS_COMMON

#define CASE_MASKZ_INS_COMMON (   Inst,
  Suffix,
  src 
)     case X86::V##Inst##Suffix##src##kz:

Definition at line 35 of file X86InstComments.cpp.

◆ CASE_MASKZ_MOVDUP

#define CASE_MASKZ_MOVDUP (   Inst,
  src 
)
Value:
CASE_MASKZ_INS_COMMON(Inst, Z, r##src) \
CASE_MASKZ_INS_COMMON(Inst, Z256, r##src) \
CASE_MASKZ_INS_COMMON(Inst, Z128, r##src)
#define CASE_MASKZ_INS_COMMON(Inst, Suffix, src)

Definition at line 75 of file X86InstComments.cpp.

◆ CASE_MASKZ_SHUF

#define CASE_MASKZ_SHUF (   Inst,
  src 
)
Value:
CASE_MASKZ_INS_COMMON(Inst, Z, r##src##i) \
CASE_MASKZ_INS_COMMON(Inst, Z256, r##src##i) \
CASE_MASKZ_INS_COMMON(Inst, Z128, r##src##i)

Definition at line 119 of file X86InstComments.cpp.

◆ CASE_MASKZ_UNPCK

#define CASE_MASKZ_UNPCK (   Inst,
  src 
)
Value:
CASE_MASKZ_INS_COMMON(Inst, Z, r##src) \
CASE_MASKZ_INS_COMMON(Inst, Z256, r##src) \
CASE_MASKZ_INS_COMMON(Inst, Z128, r##src)

Definition at line 101 of file X86InstComments.cpp.

◆ CASE_MASKZ_VPERM

#define CASE_MASKZ_VPERM (   Inst,
  src 
)
Value:
CASE_MASKZ_INS_COMMON(Inst, Z, src##i) \
CASE_MASKZ_INS_COMMON(Inst, Z256, src##i)

Definition at line 150 of file X86InstComments.cpp.

◆ CASE_MASKZ_VPERMILPI

#define CASE_MASKZ_VPERMILPI (   Inst,
  src 
)
Value:
CASE_MASKZ_INS_COMMON(Inst, Z, src##i) \
CASE_MASKZ_INS_COMMON(Inst, Z256, src##i) \
CASE_MASKZ_INS_COMMON(Inst, Z128, src##i)

Definition at line 136 of file X86InstComments.cpp.

◆ CASE_MASKZ_VSHUF

#define CASE_MASKZ_VSHUF (   Inst,
  src 
)
Value:
CASE_MASKZ_INS_COMMON(SHUFF##Inst, Z, r##src##i) \
CASE_MASKZ_INS_COMMON(SHUFI##Inst, Z, r##src##i) \
CASE_MASKZ_INS_COMMON(SHUFF##Inst, Z256, r##src##i) \
CASE_MASKZ_INS_COMMON(SHUFI##Inst, Z256, r##src##i)

Definition at line 166 of file X86InstComments.cpp.

◆ CASE_MOVDUP

#define CASE_MOVDUP (   Inst,
  src 
)
Value:
CASE_AVX512_INS_COMMON(Inst, Z, r##src) \
CASE_AVX512_INS_COMMON(Inst, Z256, r##src) \
CASE_AVX512_INS_COMMON(Inst, Z128, r##src) \
CASE_AVX_INS_COMMON(Inst, , r##src) \
CASE_AVX_INS_COMMON(Inst, Y, r##src) \
CASE_SSE_INS_COMMON(Inst, r##src)

Definition at line 62 of file X86InstComments.cpp.

◆ CASE_PMOVZX

#define CASE_PMOVZX (   Inst,
  src 
)
Value:
CASE_AVX512_INS_COMMON(Inst, Z, r##src) \
CASE_AVX512_INS_COMMON(Inst, Z256, r##src) \
CASE_AVX512_INS_COMMON(Inst, Z128, r##src) \
CASE_AVX_INS_COMMON(Inst, , r##src) \
CASE_AVX_INS_COMMON(Inst, Y, r##src) \
CASE_SSE_INS_COMMON(Inst, r##src)

Definition at line 80 of file X86InstComments.cpp.

◆ CASE_PTERNLOG

#define CASE_PTERNLOG (   Inst,
  src 
)
Value:
CASE_AVX512_INS_COMMON(Inst, Z, r##src##i) \
CASE_AVX512_INS_COMMON(Inst, Z256, r##src##i) \
CASE_AVX512_INS_COMMON(Inst, Z128, r##src##i)

Definition at line 57 of file X86InstComments.cpp.

◆ CASE_SHUF

#define CASE_SHUF (   Inst,
  suf 
)
Value:
CASE_AVX512_INS_COMMON(Inst, Z, suf) \
CASE_AVX512_INS_COMMON(Inst, Z256, suf) \
CASE_AVX512_INS_COMMON(Inst, Z128, suf) \
CASE_AVX_INS_COMMON(Inst, , suf) \
CASE_AVX_INS_COMMON(Inst, Y, suf) \
CASE_SSE_INS_COMMON(Inst, suf)

Definition at line 106 of file X86InstComments.cpp.

◆ CASE_SSE_INS_COMMON

#define CASE_SSE_INS_COMMON (   Inst,
  src 
)     case X86::Inst##src:

Definition at line 26 of file X86InstComments.cpp.

◆ CASE_UNPCK

#define CASE_UNPCK (   Inst,
  src 
)
Value:
CASE_AVX512_INS_COMMON(Inst, Z, r##src) \
CASE_AVX512_INS_COMMON(Inst, Z256, r##src) \
CASE_AVX512_INS_COMMON(Inst, Z128, r##src) \
CASE_AVX_INS_COMMON(Inst, , r##src) \
CASE_AVX_INS_COMMON(Inst, Y, r##src) \
CASE_SSE_INS_COMMON(Inst, r##src)

Definition at line 88 of file X86InstComments.cpp.

◆ CASE_VPERM

#define CASE_VPERM (   Inst,
  src 
)
Value:
CASE_AVX512_INS_COMMON(Inst, Z, src##i) \
CASE_AVX512_INS_COMMON(Inst, Z256, src##i) \
CASE_AVX_INS_COMMON(Inst, Y, src##i)

Definition at line 141 of file X86InstComments.cpp.

◆ CASE_VPERMILPI

#define CASE_VPERMILPI (   Inst,
  src 
)
Value:
CASE_AVX512_INS_COMMON(Inst, Z, src##i) \
CASE_AVX512_INS_COMMON(Inst, Z256, src##i) \
CASE_AVX512_INS_COMMON(Inst, Z128, src##i) \
CASE_AVX_INS_COMMON(Inst, , src##i) \
CASE_AVX_INS_COMMON(Inst, Y, src##i)

Definition at line 124 of file X86InstComments.cpp.

◆ CASE_VSHUF

#define CASE_VSHUF (   Inst,
  src 
)
Value:
CASE_AVX512_INS_COMMON(SHUFF##Inst, Z, r##src##i) \
CASE_AVX512_INS_COMMON(SHUFI##Inst, Z, r##src##i) \
CASE_AVX512_INS_COMMON(SHUFF##Inst, Z256, r##src##i) \
CASE_AVX512_INS_COMMON(SHUFI##Inst, Z256, r##src##i)

Definition at line 154 of file X86InstComments.cpp.

Function Documentation

◆ getRegName()

static const char * getRegName ( MCRegister  Reg)
static

◆ getRegOperandNumElts()

static unsigned getRegOperandNumElts ( const MCInst MI,
unsigned  ScalarSize,
unsigned  OperandIndex 
)
static

Definition at line 259 of file X86InstComments.cpp.

References getVectorRegSize(), and MI.

Referenced by llvm::EmitAnyX86InstComments().

◆ getVectorRegSize()

static unsigned getVectorRegSize ( MCRegister  Reg)
static

◆ printFMAComments()

static bool printFMAComments ( const MCInst MI,
raw_ostream OS,
const MCInstrInfo MCII 
)
static

◆ printFPCLASSComments()

static bool printFPCLASSComments ( const MCInst MI,
raw_ostream OS,
const MCInstrInfo MCII 
)
static

◆ printMasking()

static void printMasking ( raw_ostream OS,
const MCInst MI,
const MCInstrInfo MCII 
)
static

Wraps the destination register name with AVX512 mask/maskz filtering.

Definition at line 270 of file X86InstComments.cpp.

References llvm::X86II::EVEX_K, llvm::X86II::EVEX_Z, llvm::MCInstrInfo::get(), getRegName(), MI, OS, and llvm::MCOI::TIED_TO.

Referenced by llvm::EmitAnyX86InstComments(), printFMAComments(), printFPCLASSComments(), and printPTERNLOGComments().

◆ printPTERNLOGComments()

static bool printPTERNLOGComments ( const MCInst MI,
raw_ostream OS,
const MCInstrInfo MCII 
)
static

Variable Documentation

◆ TernlogFunctions

constexpr StringLiteral TernlogFunctions[]
constexpr

Definition at line 645 of file X86InstComments.cpp.

Referenced by printPTERNLOGComments().