LLVM 24.0.0git
LoongArchOptWInstrs.cpp File Reference

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "loongarch-opt-w-instrs"
#define LOONGARCH_OPT_W_INSTRS_NAME   "LoongArch Optimize W Instructions"

Functions

 STATISTIC (NumRemovedSExtW, "Number of removed sign-extensions")
 STATISTIC (NumTransformedToWInstrs, "Number of instructions transformed to W-ops")
 INITIALIZE_PASS (LoongArchOptWInstrsLegacy, DEBUG_TYPE, LOONGARCH_OPT_W_INSTRS_NAME, false, false) FunctionPass *llvm
static bool hasAllNBitUsers (const MachineInstr &OrigMI, const LoongArchSubtarget &ST, const MachineRegisterInfo &MRI, unsigned OrigBits)
static bool hasAllWUsers (const MachineInstr &OrigMI, const LoongArchSubtarget &ST, const MachineRegisterInfo &MRI)
static bool isSignExtendingOpW (const MachineInstr &MI, const MachineRegisterInfo &MRI, unsigned OpNo)
static bool isSignExtendedW (Register SrcReg, const LoongArchSubtarget &ST, const MachineRegisterInfo &MRI, SmallPtrSetImpl< MachineInstr * > &FixableDef)
static unsigned getWOp (unsigned Opcode)
static bool removeSExtWInstrs (MachineFunction &MF, const LoongArchInstrInfo &TII, const LoongArchSubtarget &ST, MachineRegisterInfo &MRI)
static bool convertToDSuffixes (MachineFunction &MF, const LoongArchInstrInfo &TII, const LoongArchSubtarget &ST, MachineRegisterInfo &MRI)
static bool convertToWSuffixes (MachineFunction &MF, const LoongArchInstrInfo &TII, const LoongArchSubtarget &ST, MachineRegisterInfo &MRI)
static bool optWInstrsInMF (MachineFunction &MF)

Variables

static cl::opt< bool > DisableSExtWRemoval ("loongarch-disable-sextw-removal", cl::desc("Disable removal of sign-extend insn"), cl::init(false), cl::Hidden)
static cl::opt< bool > DisableCvtToDSuffix ("loongarch-disable-cvt-to-d-suffix", cl::desc("Disable convert to D suffix"), cl::init(false), cl::Hidden)

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "loongarch-opt-w-instrs"

Definition at line 45 of file LoongArchOptWInstrs.cpp.

◆ LOONGARCH_OPT_W_INSTRS_NAME

#define LOONGARCH_OPT_W_INSTRS_NAME   "LoongArch Optimize W Instructions"

Definition at line 46 of file LoongArchOptWInstrs.cpp.

Referenced by INITIALIZE_PASS().

Function Documentation

◆ convertToDSuffixes()

bool convertToDSuffixes ( MachineFunction & MF,
const LoongArchInstrInfo & TII,
const LoongArchSubtarget & ST,
MachineRegisterInfo & MRI )
static

Definition at line 760 of file LoongArchOptWInstrs.cpp.

References hasAllWUsers(), MBB, MI, MRI, Opc, and TII.

Referenced by optWInstrsInMF().

◆ convertToWSuffixes()

◆ getWOp()

unsigned getWOp ( unsigned Opcode)
static

Definition at line 686 of file LoongArchOptWInstrs.cpp.

References llvm_unreachable.

Referenced by removeSExtWInstrs().

◆ hasAllNBitUsers()

◆ hasAllWUsers()

◆ INITIALIZE_PASS()

INITIALIZE_PASS ( LoongArchOptWInstrsLegacy ,
DEBUG_TYPE ,
LOONGARCH_OPT_W_INSTRS_NAME ,
false ,
false  )

◆ isSignExtendedW()

◆ isSignExtendingOpW()

bool isSignExtendingOpW ( const MachineInstr & MI,
const MachineRegisterInfo & MRI,
unsigned OpNo )
static

Definition at line 347 of file LoongArchOptWInstrs.cpp.

References MI, and MRI.

Referenced by isSignExtendedW().

◆ optWInstrsInMF()

◆ removeSExtWInstrs()

◆ STATISTIC() [1/2]

STATISTIC ( NumRemovedSExtW ,
"Number of removed sign-extensions"  )

◆ STATISTIC() [2/2]

STATISTIC ( NumTransformedToWInstrs ,
"Number of instructions transformed to W-ops"  )

Variable Documentation

◆ DisableCvtToDSuffix

cl::opt< bool > DisableCvtToDSuffix("loongarch-disable-cvt-to-d-suffix", cl::desc("Disable convert to D suffix"), cl::init(false), cl::Hidden) ( "loongarch-disable-cvt-to-d-suffix" ,
cl::desc("Disable convert to D suffix") ,
cl::init(false) ,
cl::Hidden  )
static

Referenced by optWInstrsInMF().

◆ DisableSExtWRemoval

cl::opt< bool > DisableSExtWRemoval("loongarch-disable-sextw-removal", cl::desc("Disable removal of sign-extend insn"), cl::init(false), cl::Hidden) ( "loongarch-disable-sextw-removal" ,
cl::desc("Disable removal of sign-extend insn") ,
cl::init(false) ,
cl::Hidden  )
static

Referenced by removeSExtWInstrs().