forked from OSchip/llvm-project
AMDGPU: Make getSubRegFromChannel a static member of AMDGPURegisterInfo
Summary: This makes is possible to have R600RegisterInfo and SIRegisterInfo not inherit from AMDGPURegisterInfo. Reviewers: arsenm, nhaehnle Reviewed By: arsenm Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, llvm-commits, t-tye Differential Revision: https://reviews.llvm.org/D46280 llvm-svn: 331490
This commit is contained in:
parent
542b20d656
commit
b03c98d1a3
|
@ -25,7 +25,7 @@ AMDGPURegisterInfo::AMDGPURegisterInfo() : AMDGPUGenRegisterInfo(0) {}
|
|||
// they are not supported at this time.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
unsigned AMDGPURegisterInfo::getSubRegFromChannel(unsigned Channel) const {
|
||||
unsigned AMDGPURegisterInfo::getSubRegFromChannel(unsigned Channel) {
|
||||
static const unsigned SubRegs[] = {
|
||||
AMDGPU::sub0, AMDGPU::sub1, AMDGPU::sub2, AMDGPU::sub3, AMDGPU::sub4,
|
||||
AMDGPU::sub5, AMDGPU::sub6, AMDGPU::sub7, AMDGPU::sub8, AMDGPU::sub9,
|
||||
|
|
|
@ -31,7 +31,7 @@ struct AMDGPURegisterInfo : public AMDGPUGenRegisterInfo {
|
|||
|
||||
/// \returns the sub reg enum value for the given \p Channel
|
||||
/// (e.g. getSubRegFromChannel(0) -> AMDGPU::sub0)
|
||||
unsigned getSubRegFromChannel(unsigned Channel) const;
|
||||
static unsigned getSubRegFromChannel(unsigned Channel);
|
||||
|
||||
void reserveRegisterTuples(BitVector &, unsigned Reg) const;
|
||||
};
|
||||
|
|
|
@ -308,7 +308,7 @@ private:
|
|||
DstMI = Reg;
|
||||
else
|
||||
DstMI = TRI->getMatchingSuperReg(Reg,
|
||||
TRI->getSubRegFromChannel(TRI->getHWRegChan(Reg)),
|
||||
AMDGPURegisterInfo::getSubRegFromChannel(TRI->getHWRegChan(Reg)),
|
||||
&AMDGPU::R600_Reg128RegClass);
|
||||
}
|
||||
if (MO.isUse()) {
|
||||
|
@ -317,7 +317,7 @@ private:
|
|||
SrcMI = Reg;
|
||||
else
|
||||
SrcMI = TRI->getMatchingSuperReg(Reg,
|
||||
TRI->getSubRegFromChannel(TRI->getHWRegChan(Reg)),
|
||||
AMDGPURegisterInfo::getSubRegFromChannel(TRI->getHWRegChan(Reg)),
|
||||
&AMDGPU::R600_Reg128RegClass);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -218,13 +218,13 @@ bool R600ExpandSpecialInstrsPass::runOnMachineFunction(MachineFunction &MF) {
|
|||
}
|
||||
}
|
||||
if (IsReduction) {
|
||||
unsigned SubRegIndex = TRI.getSubRegFromChannel(Chan);
|
||||
unsigned SubRegIndex = AMDGPURegisterInfo::getSubRegFromChannel(Chan);
|
||||
Src0 = TRI.getSubReg(Src0, SubRegIndex);
|
||||
Src1 = TRI.getSubReg(Src1, SubRegIndex);
|
||||
} else if (IsCube) {
|
||||
static const int CubeSrcSwz[] = {2, 2, 0, 1};
|
||||
unsigned SubRegIndex0 = TRI.getSubRegFromChannel(CubeSrcSwz[Chan]);
|
||||
unsigned SubRegIndex1 = TRI.getSubRegFromChannel(CubeSrcSwz[3 - Chan]);
|
||||
unsigned SubRegIndex0 = AMDGPURegisterInfo::getSubRegFromChannel(CubeSrcSwz[Chan]);
|
||||
unsigned SubRegIndex1 = AMDGPURegisterInfo::getSubRegFromChannel(CubeSrcSwz[3 - Chan]);
|
||||
Src1 = TRI.getSubReg(Src0, SubRegIndex1);
|
||||
Src0 = TRI.getSubReg(Src0, SubRegIndex0);
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ bool R600ExpandSpecialInstrsPass::runOnMachineFunction(MachineFunction &MF) {
|
|||
bool Mask = false;
|
||||
bool NotLast = true;
|
||||
if (IsCube) {
|
||||
unsigned SubRegIndex = TRI.getSubRegFromChannel(Chan);
|
||||
unsigned SubRegIndex = AMDGPURegisterInfo::getSubRegFromChannel(Chan);
|
||||
DstReg = TRI.getSubReg(DstReg, SubRegIndex);
|
||||
} else {
|
||||
// Mask the write if the original instruction does not write to
|
||||
|
|
|
@ -72,7 +72,7 @@ void R600InstrInfo::copyPhysReg(MachineBasicBlock &MBB,
|
|||
|
||||
if (VectorComponents > 0) {
|
||||
for (unsigned I = 0; I < VectorComponents; I++) {
|
||||
unsigned SubRegIndex = RI.getSubRegFromChannel(I);
|
||||
unsigned SubRegIndex = AMDGPURegisterInfo::getSubRegFromChannel(I);
|
||||
buildDefaultInstruction(MBB, MI, AMDGPU::MOV,
|
||||
RI.getSubReg(DestReg, SubRegIndex),
|
||||
RI.getSubReg(SrcReg, SubRegIndex))
|
||||
|
|
Loading…
Reference in New Issue