LLVM 20.0.0git
Macros | Functions | Variables
LoongArchOptWInstrs.cpp File Reference
#include "LoongArch.h"
#include "LoongArchMachineFunctionInfo.h"
#include "LoongArchSubtarget.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   "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< boolDisableSExtWRemoval ("loongarch-disable-sextw-removal", cl::desc("Disable removal of sign-extend insn"), cl::init(false), cl::Hidden)
 
static cl::opt< boolDisableCvtToDSuffix ("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 42 of file LoongArchOptWInstrs.cpp.

◆ LOONGARCH_OPT_W_INSTRS_NAME

#define LOONGARCH_OPT_W_INSTRS_NAME   "LoongArch Optimize W Instructions"

Definition at line 43 of file LoongArchOptWInstrs.cpp.

Function Documentation

◆ getWOp()

static unsigned getWOp ( unsigned  Opcode)
static

Definition at line 692 of file LoongArchOptWInstrs.cpp.

References llvm_unreachable.

◆ hasAllNBitUsers()

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

◆ hasAllWUsers()

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

Definition at line 345 of file LoongArchOptWInstrs.cpp.

References hasAllNBitUsers(), and MRI.

Referenced by isSignExtendedW().

◆ INITIALIZE_PASS()

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

Definition at line 88 of file LoongArchOptWInstrs.cpp.

◆ isSignExtendedW()

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

◆ isSignExtendingOpW()

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

Definition at line 353 of file LoongArchOptWInstrs.cpp.

References 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"   
)

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

◆ 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