From: Matt Arsenault Date: Fri, 24 Apr 2020 02:00:15 +0000 (-0400) Subject: AMDGPU: Use Register X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=50128f8a33d4fd50d3d4340945bcbed34d1f6d64;p=platform%2Fupstream%2Fllvm.git AMDGPU: Use Register --- diff --git a/llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp b/llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp index d22eeea..a37b3f0 100644 --- a/llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp +++ b/llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp @@ -183,8 +183,8 @@ class SILoadStoreOptimizer : public MachineFunctionPass { }; struct BaseRegisters { - unsigned LoReg = 0; - unsigned HiReg = 0; + Register LoReg; + Register HiReg; unsigned LoSubReg = 0; unsigned HiSubReg = 0; @@ -252,9 +252,9 @@ private: mergeTBufferStorePair(CombineInfo &CI, CombineInfo &Paired, const SmallVectorImpl &InstsToMove); - void updateBaseAndOffset(MachineInstr &I, unsigned NewBase, + void updateBaseAndOffset(MachineInstr &I, Register NewBase, int32_t NewOffset) const; - unsigned computeBase(MachineInstr &MI, const MemAddress &Addr) const; + Register computeBase(MachineInstr &MI, const MemAddress &Addr) const; MachineOperand createRegOrImm(int32_t Val, MachineInstr &MI) const; Optional extractConstOffset(const MachineOperand &Op) const; void processBaseWithConstOffset(const MachineOperand &Base, MemAddress &Addr) const; @@ -593,8 +593,8 @@ static void moveInstsAfter(MachineBasicBlock::iterator I, } static void addDefsUsesToList(const MachineInstr &MI, - DenseSet &RegDefs, - DenseSet &PhysRegUses) { + DenseSet &RegDefs, + DenseSet &PhysRegUses) { for (const MachineOperand &Op : MI.operands()) { if (Op.isReg()) { if (Op.isDef()) @@ -616,8 +616,8 @@ static bool memAccessesCanBeReordered(MachineBasicBlock::iterator A, // Add MI and its defs to the lists if MI reads one of the defs that are // already in the list. Returns true in that case. -static bool addToListsIfDependent(MachineInstr &MI, DenseSet &RegDefs, - DenseSet &PhysRegUses, +static bool addToListsIfDependent(MachineInstr &MI, DenseSet &RegDefs, + DenseSet &PhysRegUses, SmallVectorImpl &Insts) { for (MachineOperand &Use : MI.operands()) { // If one of the defs is read, then there is a use of Def between I and the @@ -878,8 +878,8 @@ bool SILoadStoreOptimizer::checkAndPrepareMerge( if (Swizzled != -1 && CI.I->getOperand(Swizzled).getImm()) return false; - DenseSet RegDefsToMove; - DenseSet PhysRegUsesToMove; + DenseSet RegDefsToMove; + DenseSet PhysRegUsesToMove; addDefsUsesToList(*CI.I, RegDefsToMove, PhysRegUsesToMove); MachineBasicBlock::iterator E = std::next(Paired.I); @@ -1636,7 +1636,7 @@ SILoadStoreOptimizer::createRegOrImm(int32_t Val, MachineInstr &MI) const { } // Compute base address using Addr and return the final register. -unsigned SILoadStoreOptimizer::computeBase(MachineInstr &MI, +Register SILoadStoreOptimizer::computeBase(MachineInstr &MI, const MemAddress &Addr) const { MachineBasicBlock *MBB = MI.getParent(); MachineBasicBlock::iterator MBBI = MI.getIterator(); @@ -1695,7 +1695,7 @@ unsigned SILoadStoreOptimizer::computeBase(MachineInstr &MI, // Update base and offset with the NewBase and NewOffset in MI. void SILoadStoreOptimizer::updateBaseAndOffset(MachineInstr &MI, - unsigned NewBase, + Register NewBase, int32_t NewOffset) const { auto Base = TII->getNamedOperand(MI, AMDGPU::OpName::vaddr); Base->setReg(NewBase); @@ -1907,7 +1907,7 @@ bool SILoadStoreOptimizer::promoteConstantOffsetToImm( << AnchorAddr.Offset << "\n\n"); // Instead of moving up, just re-compute anchor-instruction's base address. - unsigned Base = computeBase(MI, AnchorAddr); + Register Base = computeBase(MI, AnchorAddr); updateBaseAndOffset(MI, Base, MAddr.Offset - AnchorAddr.Offset); LLVM_DEBUG(dbgs() << " After promotion: "; MI.dump();); @@ -1986,7 +1986,7 @@ bool SILoadStoreOptimizer::collectMergeableInsts(MachineBasicBlock &MBB, // list try to find an instruction that can be merged with I. If an instruction // is found, it is stored in the Paired field. If no instructions are found, then // the CombineInfo object is deleted from the list. - + for (std::list>::iterator I = MergeableInsts.begin(), E = MergeableInsts.end(); I != E;) {