LLVM 20.0.0git
Macros | Functions | Variables
RISCVOptWInstrs.cpp File Reference
#include "RISCV.h"
#include "RISCVMachineFunctionInfo.h"
#include "RISCVSubtarget.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/TargetInstrInfo.h"

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "riscv-opt-w-instrs"
 
#define RISCV_OPT_W_INSTRS_NAME   "RISC-V Optimize W Instructions"
 

Functions

 STATISTIC (NumRemovedSExtW, "Number of removed sign-extensions")
 
 STATISTIC (NumTransformedToWInstrs, "Number of instructions transformed to W-ops")
 
 INITIALIZE_PASS (RISCVOptWInstrs, DEBUG_TYPE, RISCV_OPT_W_INSTRS_NAME, false, false) FunctionPass *llvm
 
static bool vectorPseudoHasAllNBitUsers (const MachineOperand &UserOp, unsigned Bits)
 
static bool hasAllNBitUsers (const MachineInstr &OrigMI, const RISCVSubtarget &ST, const MachineRegisterInfo &MRI, unsigned OrigBits)
 
static bool hasAllWUsers (const MachineInstr &OrigMI, const RISCVSubtarget &ST, const MachineRegisterInfo &MRI)
 
static bool isSignExtendingOpW (const MachineInstr &MI, unsigned OpNo)
 
static bool isSignExtendedW (Register SrcReg, const RISCVSubtarget &ST, const MachineRegisterInfo &MRI, SmallPtrSetImpl< MachineInstr * > &FixableDef)
 
static unsigned getWOp (unsigned Opcode)
 

Variables

static cl::opt< boolDisableSExtWRemoval ("riscv-disable-sextw-removal", cl::desc("Disable removal of sext.w"), cl::init(false), cl::Hidden)
 
static cl::opt< boolDisableStripWSuffix ("riscv-disable-strip-w-suffix", cl::desc("Disable strip W suffix"), cl::init(false), cl::Hidden)
 

Macro Definition Documentation

◆ DEBUG_TYPE

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

Definition at line 45 of file RISCVOptWInstrs.cpp.

◆ RISCV_OPT_W_INSTRS_NAME

#define RISCV_OPT_W_INSTRS_NAME   "RISC-V Optimize W Instructions"

Definition at line 46 of file RISCVOptWInstrs.cpp.

Function Documentation

◆ getWOp()

static unsigned getWOp ( unsigned  Opcode)
static

Definition at line 617 of file RISCVOptWInstrs.cpp.

References llvm_unreachable.

◆ hasAllNBitUsers()

static bool hasAllNBitUsers ( const MachineInstr OrigMI,
const RISCVSubtarget ST,
const MachineRegisterInfo MRI,
unsigned  OrigBits 
)
static

◆ hasAllWUsers()

static bool hasAllWUsers ( const MachineInstr OrigMI,
const RISCVSubtarget ST,
const MachineRegisterInfo MRI 
)
static

Definition at line 352 of file RISCVOptWInstrs.cpp.

References hasAllNBitUsers(), and MRI.

Referenced by isSignExtendedW().

◆ INITIALIZE_PASS()

INITIALIZE_PASS ( RISCVOptWInstrs  ,
DEBUG_TYPE  ,
RISCV_OPT_W_INSTRS_NAME  ,
false  ,
false   
)

Definition at line 86 of file RISCVOptWInstrs.cpp.

◆ isSignExtendedW()

static bool isSignExtendedW ( Register  SrcReg,
const RISCVSubtarget ST,
const MachineRegisterInfo MRI,
SmallPtrSetImpl< MachineInstr * > &  FixableDef 
)
static

◆ isSignExtendingOpW()

static bool isSignExtendingOpW ( const MachineInstr MI,
unsigned  OpNo 
)
static

Definition at line 359 of file RISCVOptWInstrs.cpp.

References assert(), llvm::RISCVII::IsSignExtendingOpWMask, and MI.

Referenced by isSignExtendedW().

◆ STATISTIC() [1/2]

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

◆ STATISTIC() [2/2]

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

◆ vectorPseudoHasAllNBitUsers()

static bool vectorPseudoHasAllNBitUsers ( const MachineOperand UserOp,
unsigned  Bits 
)
static

Variable Documentation

◆ DisableSExtWRemoval

cl::opt< bool > DisableSExtWRemoval("riscv-disable-sextw-removal", cl::desc("Disable removal of sext.w"), cl::init(false), cl::Hidden) ( "riscv-disable-sextw-removal"  ,
cl::desc("Disable removal of sext.w")  ,
cl::init(false)  ,
cl::Hidden   
)
static

◆ DisableStripWSuffix

cl::opt< bool > DisableStripWSuffix("riscv-disable-strip-w-suffix", cl::desc("Disable strip W suffix"), cl::init(false), cl::Hidden) ( "riscv-disable-strip-w-suffix"  ,
cl::desc("Disable strip W suffix")  ,
cl::init(false)  ,
cl::Hidden   
)
static