Skip to content

Commit 2494a1d

Browse files
committed
Move isIGLPMutationOnly to SIInstrInfo
Change-Id: If3650ce24a1a047557b3e40363b72aefd909e873
1 parent a6fba9a commit 2494a1d

File tree

5 files changed

+14
-16
lines changed

5 files changed

+14
-16
lines changed

llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2698,13 +2698,6 @@ bool IGroupLPDAGMutation::initIGLPOpt(SUnit &SU) {
26982698

26992699
namespace llvm {
27002700

2701-
namespace AMDGPU {
2702-
bool isIGLPMutationOnly(unsigned Opcode) {
2703-
return Opcode == AMDGPU::SCHED_GROUP_BARRIER || Opcode == AMDGPU::IGLP_OPT;
2704-
}
2705-
2706-
} // end namespace AMDGPU
2707-
27082701
/// \p Phase specifes whether or not this is a reentry into the
27092702
/// IGroupLPDAGMutation. Since there may be multiple scheduling passes on the
27102703
/// same scheduling region (e.g. pre and post-RA scheduling / multiple

llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ namespace AMDGPU {
1919
// The current phase of instruction scheduling
2020
enum class SchedulingPhase { Initial, PreRAReentry, PostRA };
2121

22-
// Return true if the instruction is mutually exclusive with all non-IGLP DAG
23-
// mutations, requiring all other mutations to be disabled.
24-
bool isIGLPMutationOnly(unsigned Opcode);
25-
2622
} // namespace AMDGPU
2723

2824
std::unique_ptr<ScheduleDAGMutation>

llvm/lib/Target/AMDGPU/GCNIterativeScheduler.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ void GCNIterativeScheduler::printSchedRP(raw_ostream &OS,
121121

122122
void GCNIterativeScheduler::swapIGLPMutations(const Region &R, bool IsReentry) {
123123
bool HasIGLPInstrs = false;
124-
124+
const SIInstrInfo *SII = static_cast<const SIInstrInfo *>(TII);
125125
for (MachineBasicBlock::iterator I = R.Begin; I != R.End; I++) {
126-
if (AMDGPU::isIGLPMutationOnly(I->getOpcode())) {
126+
if (SII->isIGLPMutationOnly(I->getOpcode())) {
127127
HasIGLPInstrs = true;
128128
break;
129129
}
@@ -134,6 +134,7 @@ void GCNIterativeScheduler::swapIGLPMutations(const Region &R, bool IsReentry) {
134134
SavedMutations.swap(Mutations);
135135
auto SchedPhase = IsReentry ? AMDGPU::SchedulingPhase::PreRAReentry
136136
: AMDGPU::SchedulingPhase::Initial;
137+
137138
addMutation(createIGroupLPDAGMutation(SchedPhase));
138139
}
139140
}

llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,9 +1155,10 @@ bool GCNSchedStage::initGCNRegion() {
11551155
Unsched.reserve(DAG.NumRegionInstrs);
11561156
if (StageID == GCNSchedStageID::OccInitialSchedule ||
11571157
StageID == GCNSchedStageID::ILPInitialSchedule) {
1158+
const SIInstrInfo *SII = static_cast<const SIInstrInfo *>(DAG.TII);
11581159
for (auto &I : DAG) {
11591160
Unsched.push_back(&I);
1160-
if (AMDGPU::isIGLPMutationOnly(I.getOpcode()))
1161+
if (SII->isIGLPMutationOnly(I.getOpcode()))
11611162
DAG.RegionsWithIGLPInstrs[RegionIdx] = true;
11621163
}
11631164
} else {
@@ -2041,8 +2042,9 @@ void GCNScheduleDAGMILive::updateRegionBoundaries(
20412042
}
20422043

20432044
static bool hasIGLPInstrs(ScheduleDAGInstrs *DAG) {
2044-
return any_of(*DAG, [](MachineBasicBlock::iterator MI) {
2045-
return AMDGPU::isIGLPMutationOnly(MI->getOpcode());
2045+
const SIInstrInfo *SII = static_cast<const SIInstrInfo *>(DAG->TII);
2046+
return any_of(*DAG, [SII](MachineBasicBlock::iterator MI) {
2047+
return SII->isIGLPMutationOnly(MI->getOpcode());
20462048
});
20472049
}
20482050

llvm/lib/Target/AMDGPU/SIInstrInfo.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,12 @@ class SIInstrInfo final : public AMDGPUGenInstrInfo {
985985

986986
bool isIGLP(const MachineInstr &MI) const { return isIGLP(MI.getOpcode()); }
987987

988+
// Return true if the instruction is mutually exclusive with all non-IGLP DAG
989+
// mutations, requiring all other mutations to be disabled.
990+
bool isIGLPMutationOnly(unsigned Opcode) const {
991+
return Opcode == AMDGPU::SCHED_GROUP_BARRIER || Opcode == AMDGPU::IGLP_OPT;
992+
}
993+
988994
static unsigned getNonSoftWaitcntOpcode(unsigned Opcode) {
989995
switch (Opcode) {
990996
case AMDGPU::S_WAITCNT_soft:

0 commit comments

Comments
 (0)