forked from OSchip/llvm-project
AMDGPU: Set mem operands for spill instructions
llvm-svn: 246357
This commit is contained in:
parent
5c004a7c61
commit
9a32cd3d3b
|
@ -508,14 +508,23 @@ void SIInstrInfo::storeRegToStackSlot(MachineBasicBlock &MBB,
|
|||
}
|
||||
|
||||
if (Opcode != -1) {
|
||||
MachinePointerInfo PtrInfo
|
||||
= MachinePointerInfo::getFixedStack(*MF, FrameIndex);
|
||||
unsigned Size = FrameInfo->getObjectSize(FrameIndex);
|
||||
unsigned Align = FrameInfo->getObjectAlignment(FrameIndex);
|
||||
MachineMemOperand *MMO
|
||||
= MF->getMachineMemOperand(PtrInfo, MachineMemOperand::MOStore,
|
||||
Size, Align);
|
||||
|
||||
FrameInfo->setObjectAlignment(FrameIndex, 4);
|
||||
BuildMI(MBB, MI, DL, get(Opcode))
|
||||
.addReg(SrcReg)
|
||||
.addFrameIndex(FrameIndex)
|
||||
// Place-holder registers, these will be filled in by
|
||||
// SIPrepareScratchRegs.
|
||||
.addReg(AMDGPU::SGPR0_SGPR1_SGPR2_SGPR3, RegState::Undef)
|
||||
.addReg(AMDGPU::SGPR0, RegState::Undef);
|
||||
.addReg(SrcReg)
|
||||
.addFrameIndex(FrameIndex)
|
||||
// Place-holder registers, these will be filled in by
|
||||
// SIPrepareScratchRegs.
|
||||
.addReg(AMDGPU::SGPR0_SGPR1_SGPR2_SGPR3, RegState::Undef)
|
||||
.addReg(AMDGPU::SGPR0, RegState::Undef)
|
||||
.addMemOperand(MMO);
|
||||
} else {
|
||||
LLVMContext &Ctx = MF->getFunction()->getContext();
|
||||
Ctx.emitError("SIInstrInfo::storeRegToStackSlot - Do not know how to"
|
||||
|
@ -556,14 +565,22 @@ void SIInstrInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
|
|||
}
|
||||
|
||||
if (Opcode != -1) {
|
||||
FrameInfo->setObjectAlignment(FrameIndex, 4);
|
||||
BuildMI(MBB, MI, DL, get(Opcode), DestReg)
|
||||
.addFrameIndex(FrameIndex)
|
||||
// Place-holder registers, these will be filled in by
|
||||
// SIPrepareScratchRegs.
|
||||
.addReg(AMDGPU::SGPR0_SGPR1_SGPR2_SGPR3, RegState::Undef)
|
||||
.addReg(AMDGPU::SGPR0, RegState::Undef);
|
||||
unsigned Align = 4;
|
||||
FrameInfo->setObjectAlignment(FrameIndex, Align);
|
||||
unsigned Size = FrameInfo->getObjectSize(FrameIndex);
|
||||
|
||||
MachinePointerInfo PtrInfo
|
||||
= MachinePointerInfo::getFixedStack(*MF, FrameIndex);
|
||||
MachineMemOperand *MMO = MF->getMachineMemOperand(
|
||||
PtrInfo, MachineMemOperand::MOLoad, Size, Align);
|
||||
|
||||
BuildMI(MBB, MI, DL, get(Opcode), DestReg)
|
||||
.addFrameIndex(FrameIndex)
|
||||
// Place-holder registers, these will be filled in by
|
||||
// SIPrepareScratchRegs.
|
||||
.addReg(AMDGPU::SGPR0_SGPR1_SGPR2_SGPR3, RegState::Undef)
|
||||
.addReg(AMDGPU::SGPR0, RegState::Undef)
|
||||
.addMemOperand(MMO);
|
||||
} else {
|
||||
LLVMContext &Ctx = MF->getFunction()->getContext();
|
||||
Ctx.emitError("SIInstrInfo::loadRegFromStackSlot - Do not know how to"
|
||||
|
|
|
@ -1992,13 +1992,19 @@ multiclass SI_SPILL_SGPR <RegisterClass sgpr_class> {
|
|||
(ins sgpr_class:$src, i32imm:$frame_idx, SReg_128:$scratch_rsrc,
|
||||
SReg_32:$scratch_offset),
|
||||
"", []
|
||||
>;
|
||||
> {
|
||||
let mayStore = 1;
|
||||
let mayLoad = 0;
|
||||
}
|
||||
|
||||
def _RESTORE : InstSI <
|
||||
(outs sgpr_class:$dst),
|
||||
(ins i32imm:$frame_idx, SReg_128:$scratch_rsrc, SReg_32:$scratch_offset),
|
||||
"", []
|
||||
>;
|
||||
> {
|
||||
let mayStore = 0;
|
||||
let mayLoad = 1;
|
||||
}
|
||||
} // End UseNamedOperandTable = 1
|
||||
}
|
||||
|
||||
|
@ -2018,13 +2024,19 @@ multiclass SI_SPILL_VGPR <RegisterClass vgpr_class> {
|
|||
(ins vgpr_class:$src, i32imm:$frame_idx, SReg_128:$scratch_rsrc,
|
||||
SReg_32:$scratch_offset),
|
||||
"", []
|
||||
>;
|
||||
> {
|
||||
let mayStore = 1;
|
||||
let mayLoad = 0;
|
||||
}
|
||||
|
||||
def _RESTORE : InstSI <
|
||||
(outs vgpr_class:$dst),
|
||||
(ins i32imm:$frame_idx, SReg_128:$scratch_rsrc, SReg_32:$scratch_offset),
|
||||
"", []
|
||||
>;
|
||||
> {
|
||||
let mayStore = 0;
|
||||
let mayLoad = 1;
|
||||
}
|
||||
} // End UseNamedOperandTable = 1, VGPRSpill = 1
|
||||
}
|
||||
|
||||
|
|
|
@ -177,14 +177,15 @@ void SIRegisterInfo::buildScratchLoadStore(MachineBasicBlock::iterator MI,
|
|||
bool IsKill = (i == e - 1);
|
||||
|
||||
BuildMI(*MBB, MI, DL, TII->get(LoadStoreOp))
|
||||
.addReg(SubReg, getDefRegState(IsLoad))
|
||||
.addReg(ScratchRsrcReg, getKillRegState(IsKill))
|
||||
.addReg(SOffset)
|
||||
.addImm(Offset)
|
||||
.addImm(0) // glc
|
||||
.addImm(0) // slc
|
||||
.addImm(0) // tfe
|
||||
.addReg(Value, RegState::Implicit | getDefRegState(IsLoad));
|
||||
.addReg(SubReg, getDefRegState(IsLoad))
|
||||
.addReg(ScratchRsrcReg, getKillRegState(IsKill))
|
||||
.addReg(SOffset)
|
||||
.addImm(Offset)
|
||||
.addImm(0) // glc
|
||||
.addImm(0) // slc
|
||||
.addImm(0) // tfe
|
||||
.addReg(Value, RegState::Implicit | getDefRegState(IsLoad))
|
||||
.setMemRefs(MI->memoperands_begin(), MI->memoperands_end());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue