#include "SIShrinkInstructions.h"
#include "AMDGPU.h"
#include "GCNSubtarget.h"
#include "MCTargetDesc/AMDGPUMCTargetDesc.h"
#include "Utils/AMDGPUBaseInfo.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#define DEBUG_TYPE …
STATISTIC(NumInstructionsShrunk,
"Number of 64-bit instruction reduced to 32-bit.");
STATISTIC(NumLiteralConstantsFolded,
"Number of literal constants folded into 32-bit instructions.");
usingnamespacellvm;
namespace {
class SIShrinkInstructions { … };
class SIShrinkInstructionsLegacy : public MachineFunctionPass { … };
}
INITIALIZE_PASS(…)
char SIShrinkInstructionsLegacy::ID = …;
FunctionPass *llvm::createSIShrinkInstructionsLegacyPass() { … }
bool SIShrinkInstructions::foldImmediates(MachineInstr &MI,
bool TryToCommute) const { … }
bool SIShrinkInstructions::shouldShrinkTrue16(MachineInstr &MI) const { … }
bool SIShrinkInstructions::isKImmOperand(const MachineOperand &Src) const { … }
bool SIShrinkInstructions::isKUImmOperand(const MachineOperand &Src) const { … }
bool SIShrinkInstructions::isKImmOrKUImmOperand(const MachineOperand &Src,
bool &IsUnsigned) const { … }
static unsigned canModifyToInlineImmOp32(const SIInstrInfo *TII,
const MachineOperand &Src,
int32_t &ModifiedImm, bool Scalar) { … }
void SIShrinkInstructions::copyExtraImplicitOps(MachineInstr &NewMI,
MachineInstr &MI) const { … }
void SIShrinkInstructions::shrinkScalarCompare(MachineInstr &MI) const { … }
void SIShrinkInstructions::shrinkMIMG(MachineInstr &MI) const { … }
void SIShrinkInstructions::shrinkMadFma(MachineInstr &MI) const { … }
bool SIShrinkInstructions::shrinkScalarLogicOp(MachineInstr &MI) const { … }
bool SIShrinkInstructions::instAccessReg(
iterator_range<MachineInstr::const_mop_iterator> &&R, Register Reg,
unsigned SubReg) const { … }
bool SIShrinkInstructions::instReadsReg(const MachineInstr *MI, unsigned Reg,
unsigned SubReg) const { … }
bool SIShrinkInstructions::instModifiesReg(const MachineInstr *MI, unsigned Reg,
unsigned SubReg) const { … }
TargetInstrInfo::RegSubRegPair
SIShrinkInstructions::getSubRegForIndex(Register Reg, unsigned Sub,
unsigned I) const { … }
void SIShrinkInstructions::dropInstructionKeepingImpDefs(
MachineInstr &MI) const { … }
MachineInstr *SIShrinkInstructions::matchSwap(MachineInstr &MovT) const { … }
bool SIShrinkInstructions::tryReplaceDeadSDST(MachineInstr &MI) const { … }
bool SIShrinkInstructions::run(MachineFunction &MF) { … }
bool SIShrinkInstructionsLegacy::runOnMachineFunction(MachineFunction &MF) { … }
PreservedAnalyses
SIShrinkInstructionsPass::run(MachineFunction &MF,
MachineFunctionAnalysisManager &) { … }