16 #define DEBUG_TYPE "si-i1-copies" 46 StringRef getPassName()
const override {
return "SI Lower i1 Copies"; }
57 "SI Lower i1 Copies",
false,
false)
64 return new SILowerI1Copies();
73 std::vector<unsigned> I1Defs;
80 for (I = MBB.
begin(); I != MBB.
end(); I = Next) {
84 if (MI.
getOpcode() == AMDGPU::IMPLICIT_DEF) {
87 if (RC == &AMDGPU::VReg_1RegClass)
107 if (DstRC == &AMDGPU::VReg_1RegClass &&
109 I1Defs.push_back(Dst.
getReg());
111 if (DefInst->
getOpcode() == AMDGPU::S_MOV_B64) {
113 I1Defs.push_back(Dst.
getReg());
116 assert(Val == 0 || Val == -1);
118 BuildMI(MBB, &MI, DL, TII->
get(AMDGPU::V_MOV_B32_e32))
127 BuildMI(MBB, &MI, DL, TII->
get(AMDGPU::COPY), TmpSrc)
129 BuildMI(MBB, &MI, DL, TII->
get(AMDGPU::V_CNDMASK_B32_e64))
136 SrcRC == &AMDGPU::VReg_1RegClass) {
137 if (DefInst->
getOpcode() == AMDGPU::V_CNDMASK_B32_e64 &&
146 &AMDGPU::SGPR_64RegClass) &&
148 BuildMI(MBB, &MI, DL, TII->
get(AMDGPU::S_AND_B64))
150 .addReg(AMDGPU::EXEC)
153 BuildMI(MBB, &MI, DL, TII->
get(AMDGPU::V_CMP_NE_U32_e64))
163 for (
unsigned Reg : I1Defs)
const TargetRegisterClass * getCommonSubClass(const TargetRegisterClass *A, const TargetRegisterClass *B, const MVT::SimpleValueType SVT=MVT::SimpleValueType::Any) const
Find the largest common subclass of A and B.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
AMDGPU specific subclass of TargetSubtarget.
const TargetRegisterClass * getRegClass(unsigned Reg) const
Return the register class of the specified virtual register.
Compute iterated dominance frontiers using a linear time algorithm.
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
unsigned getReg() const
getReg - Returns the register number.
#define DEBUG_TYPE
i1 values are usually inserted by the CFG Structurize pass and they are unique in that they can be co...
static bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
const SIInstrInfo * getInstrInfo() const override
unsigned const TargetRegisterInfo * TRI
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
const HexagonInstrInfo * TII
void eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
FunctionPass * createSILowerI1CopiesPass()
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)
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.
Represent the analysis usage information of a pass.
FunctionPass class - This class is used to implement most global optimizations.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
bool laneDominates(MachineBasicBlock *A, MachineBasicBlock *B)
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
Iterator for intrusive lists based on ilist_node.
MachineOperand class - Representation of each machine instruction operand.
void setPreservesCFG()
This function should be called by the pass, iff they do not:
MachineInstr * getUniqueVRegDef(unsigned Reg) const
getUniqueVRegDef - Return the unique machine instr that defines the specified virtual register or nul...
const MachineBasicBlock * getParent() const
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.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void setRegClass(unsigned Reg, const TargetRegisterClass *RC)
setRegClass - Set the register class of the specified virtual register.
StringRef - Represent a constant reference to a string, i.e.
void initializeSILowerI1CopiesPass(PassRegistry &)
const MachineOperand & getOperand(unsigned i) const
unsigned createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...