LLVM: lib/Target/LoongArch/LoongArchOptWInstrs.cpp File Reference (original) (raw)

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 (LoongArchOptWInstrs, 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)
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)

DEBUG_TYPE

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

LOONGARCH_OPT_W_INSTRS_NAME

#define LOONGARCH_OPT_W_INSTRS_NAME "LoongArch Optimize W Instructions"

getWOp()

hasAllNBitUsers()

Definition at line 98 of file LoongArchOptWInstrs.cpp.

References llvm::bit_width(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), llvm::MachineOperand::getImm(), llvm::MachineInstr::getOpcode(), llvm::MachineInstr::getOperand(), llvm::MachineInstr::getParent(), llvm::SmallSet< T, N, C >::insert(), llvm::Register::isVirtual(), llvm::Log2_32(), MI, MRI, OpIdx, P, llvm::SmallVectorImpl< T >::pop_back_val(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().

Referenced by hasAllWUsers().

hasAllWUsers()

INITIALIZE_PASS()

INITIALIZE_PASS ( LoongArchOptWInstrs ,
DEBUG_TYPE ,
LOONGARCH_OPT_W_INSTRS_NAME ,
false ,
false )

isSignExtendedW()

Definition at line 508 of file LoongArchOptWInstrs.cpp.

References assert(), B(), llvm::BitWidth, D(), llvm::dyn_cast(), llvm::dyn_cast_if_present(), E(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), llvm::MachineFunction::front(), llvm::MachineOperand::getGlobal(), llvm::MachineFunction::getInfo(), llvm::MachineInstr::getOperand(), llvm::MachineFunction::getRegInfo(), hasAllWUsers(), I, II, llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::SmallSet< T, N, C >::insert(), llvm::MachineInstr::isCall(), llvm::MachineOperand::isGlobal(), llvm::MachineRegisterInfo::isLiveIn(), llvm::LoongArchMachineFunctionInfo::isSExt32Register(), isSignExtendingOpW(), llvm::Register::isVirtual(), MBB, MI, MRI, llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and Reg.

isSignExtendingOpW()

STATISTIC() [1/2]

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

STATISTIC() [2/2]

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

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

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