Skip to content

Commit bf89a98

Browse files
committed
add some helper functions
1 parent df46f5f commit bf89a98

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

llvm/lib/Target/AMDGPU/SIInstrInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8809,11 +8809,11 @@ bool SIInstrInfo::isBasicBlockPrologue(const MachineInstr &MI,
88098809
IsNullOrVectorRegister = !RI.isSGPRClass(RI.getRegClassForReg(MRI, Reg));
88108810
}
88118811

8812-
uint16_t Opc = MI.getOpcode();
8812+
uint16_t Opcode = MI.getOpcode();
88138813
// FIXME: Copies inserted in the block prolog for live-range split should also
88148814
// be included.
88158815
return IsNullOrVectorRegister &&
8816-
(isSpillOpcode(Opc) || (!MI.isTerminator() && Opc != AMDGPU::COPY &&
8816+
(isSpill(Opcode) || (!MI.isTerminator() && Opcode != AMDGPU::COPY &&
88178817
MI.modifiesRegister(AMDGPU::EXEC, &RI)));
88188818
}
88198819

llvm/lib/Target/AMDGPU/SIInstrInfo.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -716,35 +716,35 @@ class SIInstrInfo final : public AMDGPUGenInstrInfo {
716716
static bool isVGPRSpill(const MachineInstr &MI) {
717717
return MI.getOpcode() != AMDGPU::SI_SPILL_S32_TO_VGPR &&
718718
MI.getOpcode() != AMDGPU::SI_RESTORE_S32_FROM_VGPR &&
719-
((MI.getDesc().TSFlags & SIInstrFlags::Spill) &&
720-
(MI.getDesc().TSFlags & SIInstrFlags::VALU));
719+
(isSpill(MI) & isVALU(MI));
721720
}
722721

723722
bool isVGPRSpill(uint16_t Opcode) const {
724723
return Opcode != AMDGPU::SI_SPILL_S32_TO_VGPR &&
725724
Opcode != AMDGPU::SI_RESTORE_S32_FROM_VGPR &&
726-
((get(Opcode).TSFlags & SIInstrFlags::Spill) &&
727-
(get(Opcode).TSFlags & SIInstrFlags::VALU));
725+
(isSpill(Opcode) & isVALU(Opcode));
728726
}
729727

730728
static bool isSGPRSpill(const MachineInstr &MI) {
731729
return MI.getOpcode() == AMDGPU::SI_SPILL_S32_TO_VGPR ||
732730
MI.getOpcode() == AMDGPU::SI_RESTORE_S32_FROM_VGPR ||
733-
((MI.getDesc().TSFlags & SIInstrFlags::Spill) &&
734-
(MI.getDesc().TSFlags & SIInstrFlags::SALU));
731+
(isSpill(MI) & isSALU(MI));
735732
}
736733

737734
bool isSGPRSpill(uint16_t Opcode) const {
738735
return Opcode == AMDGPU::SI_SPILL_S32_TO_VGPR ||
739736
Opcode == AMDGPU::SI_RESTORE_S32_FROM_VGPR ||
740-
((get(Opcode).TSFlags & SIInstrFlags::Spill) &&
741-
(get(Opcode).TSFlags & SIInstrFlags::SALU));
737+
(isSpill(Opcode) & isSALU(Opcode));
742738
}
743739

744-
bool isSpillOpcode(uint16_t Opcode) const {
740+
bool isSpill(uint16_t Opcode) const {
745741
return get(Opcode).TSFlags & SIInstrFlags::Spill;
746742
}
747743

744+
static bool isSpill(const MachineInstr &MI) {
745+
return MI.getDesc().TSFlags & SIInstrFlags::Spill;
746+
}
747+
748748
static bool isWWMRegSpillOpcode(uint16_t Opcode) {
749749
return Opcode == AMDGPU::SI_SPILL_WWM_V32_SAVE ||
750750
Opcode == AMDGPU::SI_SPILL_WWM_AV32_SAVE ||

0 commit comments

Comments
 (0)