@@ -41,10 +41,10 @@ static ArrayRef<MCPhysReg> getAllSGPR128(const GCNSubtarget &ST,
41
41
// but we would then have to make sure that we were in fact saving at least one
42
42
// callee-save register in the prologue, which is additional complexity that
43
43
// doesn't seem worth the benefit.
44
- static unsigned findScratchNonCalleeSaveRegister (MachineRegisterInfo &MRI,
45
- LivePhysRegs &LiveRegs,
46
- const TargetRegisterClass &RC,
47
- bool Unused = false ) {
44
+ static MCRegister findScratchNonCalleeSaveRegister (MachineRegisterInfo &MRI,
45
+ LivePhysRegs &LiveRegs,
46
+ const TargetRegisterClass &RC,
47
+ bool Unused = false ) {
48
48
// Mark callee saved registers as used so we will not choose them.
49
49
const MCPhysReg *CSRegs = MRI.getCalleeSavedRegs ();
50
50
for (unsigned i = 0 ; CSRegs[i]; ++i)
@@ -53,12 +53,12 @@ static unsigned findScratchNonCalleeSaveRegister(MachineRegisterInfo &MRI,
53
53
if (Unused) {
54
54
// We are looking for a register that can be used throughout the entire
55
55
// function, so any use is unacceptable.
56
- for (unsigned Reg : RC) {
56
+ for (MCRegister Reg : RC) {
57
57
if (!MRI.isPhysRegUsed (Reg) && LiveRegs.available (MRI, Reg))
58
58
return Reg;
59
59
}
60
60
} else {
61
- for (unsigned Reg : RC) {
61
+ for (MCRegister Reg : RC) {
62
62
if (LiveRegs.available (MRI, Reg))
63
63
return Reg;
64
64
}
@@ -70,7 +70,7 @@ static unsigned findScratchNonCalleeSaveRegister(MachineRegisterInfo &MRI,
70
70
if (!Unused)
71
71
report_fatal_error (" failed to find free scratch register" );
72
72
73
- return AMDGPU::NoRegister ;
73
+ return MCRegister () ;
74
74
}
75
75
76
76
static MCPhysReg findUnusedSGPRNonCalleeSaved (MachineRegisterInfo &MRI) {
@@ -85,8 +85,8 @@ static MCPhysReg findUnusedSGPRNonCalleeSaved(MachineRegisterInfo &MRI) {
85
85
// use.
86
86
static void buildPrologSpill (LivePhysRegs &LiveRegs, MachineBasicBlock &MBB,
87
87
MachineBasicBlock::iterator I,
88
- const SIInstrInfo *TII, unsigned SpillReg,
89
- unsigned ScratchRsrcReg, unsigned SPReg, int FI) {
88
+ const SIInstrInfo *TII, Register SpillReg,
89
+ Register ScratchRsrcReg, Register SPReg, int FI) {
90
90
MachineFunction *MF = MBB.getParent ();
91
91
MachineFrameInfo &MFI = MF->getFrameInfo ();
92
92
@@ -133,8 +133,8 @@ static void buildPrologSpill(LivePhysRegs &LiveRegs, MachineBasicBlock &MBB,
133
133
134
134
static void buildEpilogReload (LivePhysRegs &LiveRegs, MachineBasicBlock &MBB,
135
135
MachineBasicBlock::iterator I,
136
- const SIInstrInfo *TII, unsigned SpillReg,
137
- unsigned ScratchRsrcReg, unsigned SPReg, int FI) {
136
+ const SIInstrInfo *TII, Register SpillReg,
137
+ Register ScratchRsrcReg, Register SPReg, int FI) {
138
138
MachineFunction *MF = MBB.getParent ();
139
139
MachineFrameInfo &MFI = MF->getFrameInfo ();
140
140
int64_t Offset = MFI.getObjectOffset (FI);
@@ -595,8 +595,8 @@ void SIFrameLowering::emitPrologue(MachineFunction &MF,
595
595
const SIInstrInfo *TII = ST.getInstrInfo ();
596
596
const SIRegisterInfo &TRI = TII->getRegisterInfo ();
597
597
598
- unsigned StackPtrReg = FuncInfo->getStackPtrOffsetReg ();
599
- unsigned FramePtrReg = FuncInfo->getFrameOffsetReg ();
598
+ Register StackPtrReg = FuncInfo->getStackPtrOffsetReg ();
599
+ Register FramePtrReg = FuncInfo->getFrameOffsetReg ();
600
600
LivePhysRegs LiveRegs;
601
601
602
602
MachineBasicBlock::iterator MBBI = MBB.begin ();
@@ -607,10 +607,10 @@ void SIFrameLowering::emitPrologue(MachineFunction &MF,
607
607
uint32_t RoundedSize = NumBytes;
608
608
// To avoid clobbering VGPRs in lanes that weren't active on function entry,
609
609
// turn on all lanes before doing the spill to memory.
610
- unsigned ScratchExecCopy = AMDGPU::NoRegister ;
610
+ Register ScratchExecCopy;
611
611
612
612
// Emit the copy if we need an FP, and are using a free SGPR to save it.
613
- if (FuncInfo->SGPRForFPSaveRestoreCopy != AMDGPU::NoRegister ) {
613
+ if (FuncInfo->SGPRForFPSaveRestoreCopy ) {
614
614
BuildMI (MBB, MBBI, DL, TII->get (AMDGPU::COPY), FuncInfo->SGPRForFPSaveRestoreCopy )
615
615
.addReg (FramePtrReg)
616
616
.setMIFlag (MachineInstr::FrameSetup);
@@ -621,7 +621,7 @@ void SIFrameLowering::emitPrologue(MachineFunction &MF,
621
621
if (!Reg.FI .hasValue ())
622
622
continue ;
623
623
624
- if (ScratchExecCopy == AMDGPU::NoRegister ) {
624
+ if (! ScratchExecCopy) {
625
625
if (LiveRegs.empty ()) {
626
626
LiveRegs.init (TRI);
627
627
LiveRegs.addLiveIns (MBB);
@@ -650,7 +650,7 @@ void SIFrameLowering::emitPrologue(MachineFunction &MF,
650
650
if (ScratchExecCopy != AMDGPU::NoRegister) {
651
651
// FIXME: Split block and make terminator.
652
652
unsigned ExecMov = ST.isWave32 () ? AMDGPU::S_MOV_B32 : AMDGPU::S_MOV_B64;
653
- unsigned Exec = ST.isWave32 () ? AMDGPU::EXEC_LO : AMDGPU::EXEC;
653
+ MCRegister Exec = ST.isWave32 () ? AMDGPU::EXEC_LO : AMDGPU::EXEC;
654
654
BuildMI (MBB, MBBI, DL, TII->get (ExecMov), Exec)
655
655
.addReg (ScratchExecCopy, RegState::Kill);
656
656
LiveRegs.addReg (ScratchExecCopy);
@@ -685,7 +685,7 @@ void SIFrameLowering::emitPrologue(MachineFunction &MF,
685
685
LiveRegs.addReg (FuncInfo->SGPRForFPSaveRestoreCopy );
686
686
}
687
687
688
- unsigned ScratchSPReg = findScratchNonCalleeSaveRegister (
688
+ Register ScratchSPReg = findScratchNonCalleeSaveRegister (
689
689
MRI, LiveRegs, AMDGPU::SReg_32_XM0RegClass);
690
690
assert (ScratchSPReg != AMDGPU::NoRegister &&
691
691
ScratchSPReg != FuncInfo->SGPRForFPSaveRestoreCopy );
@@ -718,11 +718,11 @@ void SIFrameLowering::emitPrologue(MachineFunction &MF,
718
718
.setMIFlag (MachineInstr::FrameSetup);
719
719
}
720
720
721
- assert ((!HasFP || (FuncInfo->SGPRForFPSaveRestoreCopy != AMDGPU::NoRegister ||
721
+ assert ((!HasFP || (FuncInfo->SGPRForFPSaveRestoreCopy ||
722
722
FuncInfo->FramePointerSaveIndex )) &&
723
723
" Needed to save FP but didn't save it anywhere" );
724
724
725
- assert ((HasFP || (FuncInfo->SGPRForFPSaveRestoreCopy == AMDGPU::NoRegister &&
725
+ assert ((HasFP || (! FuncInfo->SGPRForFPSaveRestoreCopy &&
726
726
!FuncInfo->FramePointerSaveIndex )) &&
727
727
" Saved FP but didn't need it" );
728
728
}
@@ -747,14 +747,14 @@ void SIFrameLowering::emitEpilogue(MachineFunction &MF,
747
747
: NumBytes;
748
748
749
749
if (RoundedSize != 0 && hasFP (MF)) {
750
- const unsigned StackPtrReg = FuncInfo->getStackPtrOffsetReg ();
750
+ const Register StackPtrReg = FuncInfo->getStackPtrOffsetReg ();
751
751
BuildMI (MBB, MBBI, DL, TII->get (AMDGPU::S_SUB_U32), StackPtrReg)
752
752
.addReg (StackPtrReg)
753
753
.addImm (RoundedSize * ST.getWavefrontSize ())
754
754
.setMIFlag (MachineInstr::FrameDestroy);
755
755
}
756
756
757
- if (FuncInfo->SGPRForFPSaveRestoreCopy != AMDGPU::NoRegister ) {
757
+ if (FuncInfo->SGPRForFPSaveRestoreCopy ) {
758
758
BuildMI (MBB, MBBI, DL, TII->get (AMDGPU::COPY), FuncInfo->getFrameOffsetReg ())
759
759
.addReg (FuncInfo->SGPRForFPSaveRestoreCopy )
760
760
.setMIFlag (MachineInstr::FrameSetup);
@@ -775,7 +775,7 @@ void SIFrameLowering::emitEpilogue(MachineFunction &MF,
775
775
.addImm (Spill[0 ].Lane );
776
776
}
777
777
778
- unsigned ScratchExecCopy = AMDGPU::NoRegister ;
778
+ Register ScratchExecCopy;
779
779
for (const SIMachineFunctionInfo::SGPRSpillVGPRCSR &Reg
780
780
: FuncInfo->getSGPRSpillVGPRs ()) {
781
781
if (!Reg.FI .hasValue ())
@@ -1016,7 +1016,7 @@ MachineBasicBlock::iterator SIFrameLowering::eliminateCallFramePseudoInstr(
1016
1016
Amount = alignTo (Amount, getStackAlign ());
1017
1017
assert (isUInt<32 >(Amount) && " exceeded stack address space size" );
1018
1018
const SIMachineFunctionInfo *MFI = MF.getInfo <SIMachineFunctionInfo>();
1019
- unsigned SPReg = MFI->getStackPtrOffsetReg ();
1019
+ Register SPReg = MFI->getStackPtrOffsetReg ();
1020
1020
1021
1021
unsigned Op = IsDestroy ? AMDGPU::S_SUB_U32 : AMDGPU::S_ADD_U32;
1022
1022
BuildMI (MBB, I, DL, TII->get (Op), SPReg)
0 commit comments