LLVM 20.0.0git
Macros | Functions
X86EncodingOptimization.cpp File Reference
#include "X86EncodingOptimization.h"
#include "X86BaseInfo.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/Support/Casting.h"
#include "X86EncodingOptimizationForImmediate.def"

Go to the source code of this file.

Macros

#define FROM_TO(FROM, TO, IDX1, IDX2)
 
#define TO_REV(FROM)   FROM_TO(FROM, FROM##_REV, 0, 1)
 
#define TO_REV(FROM)   FROM_TO(FROM, FROM##_REV, 0, 2)
 
#define TO_IMM1(FROM)
 
#define TO_IMM1(FROM)
 
#define FROM_TO(FROM, TO1, TO2)
 
#define FROM_TO(FROM, TO, R0, R1)
 
#define FROM_TO(FROM, TO)
 
#define ENTRY(LONG, SHORT)
 
#define ENTRY(LONG, SHORT)
 
#define ENTRY(LONG, SHORT)
 

Functions

static bool isARegister (MCRegister Reg)
 
static bool optimizeToFixedRegisterForm (MCInst &MI)
 Simplify FOO $imm, %{al,ax,eax,rax} to FOO $imm, for instruction with a short fixed-register form.
 
static bool optimizeToShortImmediateForm (MCInst &MI)
 

Macro Definition Documentation

◆ ENTRY [1/3]

#define ENTRY (   LONG,
  SHORT 
)
Value:
case X86::LONG: \
return X86::SHORT;

◆ ENTRY [2/3]

#define ENTRY (   LONG,
  SHORT 
)
Value:
case X86::SHORT: \
return X86::LONG;

◆ ENTRY [3/3]

#define ENTRY (   LONG,
  SHORT 
)
Value:
case X86::LONG: \
NewOpc = X86::SHORT; \
break;

◆ FROM_TO [1/4]

#define FROM_TO (   FROM,
  TO 
)
Value:
case X86::FROM: \
NewOpc = X86::TO; \
break;

◆ FROM_TO [2/4]

#define FROM_TO (   FROM,
  TO,
  IDX1,
  IDX2 
)
Value:
case X86::FROM: \
NewOpc = X86::TO; \
OpIdx1 = IDX1; \
OpIdx2 = IDX2; \
break;

◆ FROM_TO [3/4]

#define FROM_TO (   FROM,
  TO,
  R0,
  R1 
)
Value:
case X86::FROM: \
if (MI.getOperand(0).getReg() != X86::R0 || \
MI.getOperand(1).getReg() != X86::R1) \
return false; \
NewOpc = X86::TO; \
break;
IRTranslator LLVM IR MI

◆ FROM_TO [4/4]

#define FROM_TO (   FROM,
  TO1,
  TO2 
)
Value:
case X86::FROM: \
Opc1 = X86::TO1; \
Opc2 = X86::TO2; \
break;

◆ TO_IMM1 [1/2]

#define TO_IMM1 (   FROM)
Value:
case X86::FROM##i: \
NewOpc = X86::FROM##1; \
break; \
case X86::FROM##i_EVEX: \
NewOpc = X86::FROM##1_EVEX; \
break; \
case X86::FROM##i_ND: \
NewOpc = X86::FROM##1_ND; \
break;

◆ TO_IMM1 [2/2]

#define TO_IMM1 (   FROM)
Value:
case X86::FROM##i: \
NewOpc = X86::FROM##1; \
break; \
case X86::FROM##i_EVEX: \
NewOpc = X86::FROM##1_EVEX; \
break; \
case X86::FROM##i_NF: \
NewOpc = X86::FROM##1_NF; \
break; \
case X86::FROM##i_ND: \
NewOpc = X86::FROM##1_ND; \
break; \
case X86::FROM##i_NF_ND: \
NewOpc = X86::FROM##1_NF_ND; \
break;

◆ TO_REV [1/2]

#define TO_REV (   FROM)    FROM_TO(FROM, FROM##_REV, 0, 1)

◆ TO_REV [2/2]

#define TO_REV (   FROM)    FROM_TO(FROM, FROM##_REV, 0, 2)

Function Documentation

◆ isARegister()

static bool isARegister ( MCRegister  Reg)
static

◆ optimizeToFixedRegisterForm()

static bool optimizeToFixedRegisterForm ( MCInst MI)
static

Simplify FOO $imm, %{al,ax,eax,rax} to FOO $imm, for instruction with a short fixed-register form.

Definition at line 396 of file X86EncodingOptimization.cpp.

References FROM_TO, isARegister(), MI, and Saved.

Referenced by llvm::X86::optimizeToFixedRegisterOrShortImmediateForm().

◆ optimizeToShortImmediateForm()

static bool optimizeToShortImmediateForm ( MCInst MI)
static