30 #define DEBUG_TYPE "si-img-init" 74 for (I = MBB.
begin(); I != MBB.
end(); I = Next) {
79 if (TII->isMIMG(Opcode) && !MI.
mayStore()) {
80 MachineOperand *TFE = TII->getNamedOperand(MI, AMDGPU::OpName::tfe);
81 MachineOperand *LWE = TII->getNamedOperand(MI, AMDGPU::OpName::lwe);
82 MachineOperand *D16 = TII->getNamedOperand(MI, AMDGPU::OpName::d16);
86 assert( (TFE && LWE) &&
"Expected tfe and lwe operands in instruction");
88 unsigned TFEVal = TFE->
getImm();
89 unsigned LWEVal = LWE->
getImm();
90 unsigned D16Val = D16 ? D16->
getImm() : 0;
92 if (TFEVal || LWEVal) {
104 TII->getNamedOperand(MI, AMDGPU::OpName::dmask);
107 assert(MO_Dmask &&
"Expected dmask operand in instruction");
109 unsigned dmask = MO_Dmask->getImm();
112 unsigned ActiveLanes =
117 static_assert(AMDGPU::sub0 == 1 && AMDGPU::sub4 == 5,
"Subreg indices different from expected");
122 D16Val && Packed ? ((ActiveLanes + 1) >> 1) + 1 : ActiveLanes + 1;
128 RI->getRegSizeInBits(*TII->getOpRegClass(MI, DstIdx)) / 32;
129 if (DstSize < InitIdx)
145 BuildMI(MBB, MI, DL, TII->
get(AMDGPU::V_MOV_B32_e32), PrevDst)
149 BuildMI(MBB, MI, DL, TII->
get(AMDGPU::IMPLICIT_DEF), PrevDst);
150 for (; SizeLeft; SizeLeft--, CurrIdx++) {
159 BuildMI(MBB, I, DL, TII->
get(TargetOpcode::INSERT_SUBREG), NewDst)
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
AMDGPU specific subclass of TargetSubtarget.
This class represents lattice values for constants.
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
const SIInstrInfo * getInstrInfo() const override
FunctionPass * createSIAddIMGInitPass()
LLVM_READONLY int16_t getNamedOperandIdx(uint16_t Opcode, uint16_t NamedIdx)
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
const HexagonInstrInfo * TII
unsigned getNumOperands() const
Retuns the total number of operands.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata *> MDs)
bool mayStore(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly modify memory.
unsigned const MachineRegisterInfo * MRI
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
bool usePRTStrictNull() const
Represent the analysis usage information of a pass.
FunctionPass class - This class is used to implement most global optimizations.
void initializeSIAddIMGInitPass(PassRegistry &)
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
bool hasUnpackedD16VMem() const
Iterator for intrusive lists based on ilist_node.
unsigned countPopulation(T Value)
Count the number of set bits in a value.
MachineOperand class - Representation of each machine instruction operand.
void setPreservesCFG()
This function should be called by the pass, iff they do not:
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
Provides AMDGPU specific target descriptions.
Representation of each machine instruction.
Interface definition for SIInstrInfo.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
unsigned createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
void tieOperands(unsigned DefIdx, unsigned UseIdx)
Add a tie between the register operands at DefIdx and UseIdx.
const SIRegisterInfo * getRegisterInfo() const override