Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 2f8f367

Browse files
committed
[AMDGPU] More descriptive names in the memory legalizer
NFC. Differential Revision: https://reviews.llvm.org/D43054 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324712 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 3940160 commit 2f8f367

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

lib/Target/AMDGPU/SIMemoryLegalizer.cpp

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class SIMemOpInfo final {
107107
const MachineBasicBlock::iterator &MI);
108108
/// \returns Atomic cmpxchg/rmw info if \p MI is an atomic cmpxchg or
109109
/// rmw operation, "None" otherwise.
110-
static Optional<SIMemOpInfo> getAtomicCmpxchgInfo(
110+
static Optional<SIMemOpInfo> getAtomicCmpxchgOrRmwInfo(
111111
const MachineBasicBlock::iterator &MI);
112112

113113
/// \brief Reports unknown synchronization scope used in \p MI to LLVM
@@ -128,7 +128,7 @@ class SIMemoryLegalizer final : public MachineFunctionPass {
128128
unsigned Vmcnt0Immediate = 0;
129129

130130
/// \brief Opcode for cache invalidation instruction (L1).
131-
unsigned Wbinvl1Opcode = 0;
131+
unsigned VmemSIMDCacheInvalidateOpc = 0;
132132

133133
/// \brief List of atomic pseudo instructions.
134134
std::list<MachineBasicBlock::iterator> AtomicPseudoMIs;
@@ -163,8 +163,8 @@ class SIMemoryLegalizer final : public MachineFunctionPass {
163163

164164
/// \brief Inserts "buffer_wbinvl1_vol" instruction \p Before or after \p MI.
165165
/// Always returns true.
166-
bool insertBufferWbinvl1Vol(MachineBasicBlock::iterator &MI,
167-
bool Before = true) const;
166+
bool insertVmemSIMDCacheInvalidate(MachineBasicBlock::iterator &MI,
167+
bool Before = true) const;
168168
/// \brief Inserts "s_waitcnt vmcnt(0)" instruction \p Before or after \p MI.
169169
/// Always returns true.
170170
bool insertWaitcntVmcnt0(MachineBasicBlock::iterator &MI,
@@ -188,8 +188,8 @@ class SIMemoryLegalizer final : public MachineFunctionPass {
188188
MachineBasicBlock::iterator &MI);
189189
/// \brief Expands atomic cmpxchg or rmw operation \p MI. Returns true if
190190
/// instructions are added/deleted or \p MI is modified, false otherwise.
191-
bool expandAtomicCmpxchg(const SIMemOpInfo &MOI,
192-
MachineBasicBlock::iterator &MI);
191+
bool expandAtomicCmpxchgOrRmw(const SIMemOpInfo &MOI,
192+
MachineBasicBlock::iterator &MI);
193193

194194
public:
195195
static char ID;
@@ -297,7 +297,7 @@ Optional<SIMemOpInfo> SIMemOpInfo::getAtomicFenceInfo(
297297
}
298298

299299
/* static */
300-
Optional<SIMemOpInfo> SIMemOpInfo::getAtomicCmpxchgInfo(
300+
Optional<SIMemOpInfo> SIMemOpInfo::getAtomicCmpxchgOrRmwInfo(
301301
const MachineBasicBlock::iterator &MI) {
302302
assert(MI->getDesc().TSFlags & SIInstrFlags::maybeAtomic);
303303

@@ -322,15 +322,15 @@ void SIMemOpInfo::reportUnknownSyncScope(
322322
CTX->diagnose(Diag);
323323
}
324324

325-
bool SIMemoryLegalizer::insertBufferWbinvl1Vol(MachineBasicBlock::iterator &MI,
326-
bool Before) const {
325+
bool SIMemoryLegalizer::insertVmemSIMDCacheInvalidate(
326+
MachineBasicBlock::iterator &MI, bool Before) const {
327327
MachineBasicBlock &MBB = *MI->getParent();
328328
DebugLoc DL = MI->getDebugLoc();
329329

330330
if (!Before)
331331
++MI;
332332

333-
BuildMI(MBB, MI, DL, TII->get(Wbinvl1Opcode));
333+
BuildMI(MBB, MI, DL, TII->get(VmemSIMDCacheInvalidateOpc));
334334

335335
if (!Before)
336336
--MI;
@@ -385,7 +385,7 @@ bool SIMemoryLegalizer::expandLoad(const SIMemOpInfo &MOI,
385385
if (MOI.getOrdering() == AtomicOrdering::Acquire ||
386386
MOI.getOrdering() == AtomicOrdering::SequentiallyConsistent) {
387387
Changed |= insertWaitcntVmcnt0(MI, false);
388-
Changed |= insertBufferWbinvl1Vol(MI, false);
388+
Changed |= insertVmemSIMDCacheInvalidate(MI, false);
389389
}
390390

391391
return Changed;
@@ -463,7 +463,7 @@ bool SIMemoryLegalizer::expandAtomicFence(const SIMemOpInfo &MOI,
463463
if (MOI.getOrdering() == AtomicOrdering::Acquire ||
464464
MOI.getOrdering() == AtomicOrdering::AcquireRelease ||
465465
MOI.getOrdering() == AtomicOrdering::SequentiallyConsistent)
466-
Changed |= insertBufferWbinvl1Vol(MI);
466+
Changed |= insertVmemSIMDCacheInvalidate(MI);
467467

468468
AtomicPseudoMIs.push_back(MI);
469469
return Changed;
@@ -482,8 +482,8 @@ bool SIMemoryLegalizer::expandAtomicFence(const SIMemOpInfo &MOI,
482482
return Changed;
483483
}
484484

485-
bool SIMemoryLegalizer::expandAtomicCmpxchg(const SIMemOpInfo &MOI,
486-
MachineBasicBlock::iterator &MI) {
485+
bool SIMemoryLegalizer::expandAtomicCmpxchgOrRmw(const SIMemOpInfo &MOI,
486+
MachineBasicBlock::iterator &MI) {
487487
assert(MI->mayLoad() && MI->mayStore());
488488

489489
bool Changed = false;
@@ -503,7 +503,7 @@ bool SIMemoryLegalizer::expandAtomicCmpxchg(const SIMemOpInfo &MOI,
503503
MOI.getFailureOrdering() == AtomicOrdering::Acquire ||
504504
MOI.getFailureOrdering() == AtomicOrdering::SequentiallyConsistent) {
505505
Changed |= insertWaitcntVmcnt0(MI, false);
506-
Changed |= insertBufferWbinvl1Vol(MI, false);
506+
Changed |= insertVmemSIMDCacheInvalidate(MI, false);
507507
}
508508

509509
return Changed;
@@ -532,8 +532,9 @@ bool SIMemoryLegalizer::runOnMachineFunction(MachineFunction &MF) {
532532

533533
Vmcnt0Immediate =
534534
AMDGPU::encodeWaitcnt(IV, 0, getExpcntBitMask(IV), getLgkmcntBitMask(IV));
535-
Wbinvl1Opcode = ST.getGeneration() <= AMDGPUSubtarget::SOUTHERN_ISLANDS ?
536-
AMDGPU::BUFFER_WBINVL1 : AMDGPU::BUFFER_WBINVL1_VOL;
535+
VmemSIMDCacheInvalidateOpc =
536+
ST.getGeneration() <= AMDGPUSubtarget::SOUTHERN_ISLANDS ?
537+
AMDGPU::BUFFER_WBINVL1 : AMDGPU::BUFFER_WBINVL1_VOL;
537538

538539
for (auto &MBB : MF) {
539540
for (auto MI = MBB.begin(); MI != MBB.end(); ++MI) {
@@ -546,8 +547,8 @@ bool SIMemoryLegalizer::runOnMachineFunction(MachineFunction &MF) {
546547
Changed |= expandStore(MOI.getValue(), MI);
547548
else if (const auto &MOI = SIMemOpInfo::getAtomicFenceInfo(MI))
548549
Changed |= expandAtomicFence(MOI.getValue(), MI);
549-
else if (const auto &MOI = SIMemOpInfo::getAtomicCmpxchgInfo(MI))
550-
Changed |= expandAtomicCmpxchg(MOI.getValue(), MI);
550+
else if (const auto &MOI = SIMemOpInfo::getAtomicCmpxchgOrRmwInfo(MI))
551+
Changed |= expandAtomicCmpxchgOrRmw(MOI.getValue(), MI);
551552
}
552553
}
553554

0 commit comments

Comments
 (0)