diff options
author | Matthias Braun <matze@braunis.de> | 2018-11-06 19:00:11 +0000 |
---|---|---|
committer | Matthias Braun <matze@braunis.de> | 2018-11-06 19:00:11 +0000 |
commit | c6613879ce57e9e9947b9a91f9f0a9ef7382fb2c (patch) | |
tree | f8f37a063acee6b133a37cb8381bfb40060e3717 /llvm/lib/CodeGen | |
parent | fa441730bb7651c7c3528fcfc705b437ac04befd (diff) | |
download | bcm5719-llvm-c6613879ce57e9e9947b9a91f9f0a9ef7382fb2c.tar.gz bcm5719-llvm-c6613879ce57e9e9947b9a91f9f0a9ef7382fb2c.zip |
LivePhysRegs/IfConversion: Change some types from unsigned to MCPhysReg; NFC
Change the type in a couple of lists and sets that only store physical
registers from unsigned to MCPhysRegs. The later is only 16bits and
saves us a bit of memory.
llvm-svn: 346254
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/IfConversion.cpp | 20 | ||||
-rw-r--r-- | llvm/lib/CodeGen/LivePhysRegs.cpp | 10 |
2 files changed, 15 insertions, 15 deletions
diff --git a/llvm/lib/CodeGen/IfConversion.cpp b/llvm/lib/CodeGen/IfConversion.cpp index f12d00071b2..5666626ab31 100644 --- a/llvm/lib/CodeGen/IfConversion.cpp +++ b/llvm/lib/CodeGen/IfConversion.cpp @@ -273,7 +273,7 @@ namespace { void PredicateBlock(BBInfo &BBI, MachineBasicBlock::iterator E, SmallVectorImpl<MachineOperand> &Cond, - SmallSet<unsigned, 4> *LaterRedefs = nullptr); + SmallSet<MCPhysReg, 4> *LaterRedefs = nullptr); void CopyAndPredicateBlock(BBInfo &ToBBI, BBInfo &FromBBI, SmallVectorImpl<MachineOperand> &Cond, bool IgnoreBr = false); @@ -1366,12 +1366,12 @@ static void UpdatePredRedefs(MachineInstr &MI, LivePhysRegs &Redefs) { // Before stepping forward past MI, remember which regs were live // before MI. This is needed to set the Undef flag only when reg is // dead. - SparseSet<unsigned> LiveBeforeMI; + SparseSet<MCPhysReg, identity<MCPhysReg>> LiveBeforeMI; LiveBeforeMI.setUniverse(TRI->getNumRegs()); for (unsigned Reg : Redefs) LiveBeforeMI.insert(Reg); - SmallVector<std::pair<unsigned, const MachineOperand*>, 4> Clobbers; + SmallVector<std::pair<MCPhysReg, const MachineOperand*>, 4> Clobbers; Redefs.stepForward(MI, Clobbers); // Now add the implicit uses for each of the clobbered values. @@ -1740,7 +1740,7 @@ bool IfConverter::IfConvertDiamondCommon( if (MRI->tracksLiveness()) { for (const MachineInstr &MI : make_range(MBB1.begin(), DI1)) { - SmallVector<std::pair<unsigned, const MachineOperand*>, 4> Dummy; + SmallVector<std::pair<MCPhysReg, const MachineOperand*>, 4> Dummy; Redefs.stepForward(MI, Dummy); } } @@ -1806,13 +1806,13 @@ bool IfConverter::IfConvertDiamondCommon( // generate: // sub r0, r1, #1 // addne r0, r1, #1 - SmallSet<unsigned, 4> RedefsByFalse; - SmallSet<unsigned, 4> ExtUses; + SmallSet<MCPhysReg, 4> RedefsByFalse; + SmallSet<MCPhysReg, 4> ExtUses; if (TII->isProfitableToUnpredicate(MBB1, MBB2)) { for (const MachineInstr &FI : make_range(MBB2.begin(), DI2)) { if (FI.isDebugInstr()) continue; - SmallVector<unsigned, 4> Defs; + SmallVector<MCPhysReg, 4> Defs; for (const MachineOperand &MO : FI.operands()) { if (!MO.isReg()) continue; @@ -1830,7 +1830,7 @@ bool IfConverter::IfConvertDiamondCommon( } } - for (unsigned Reg : Defs) { + for (MCPhysReg Reg : Defs) { if (!ExtUses.count(Reg)) { for (MCSubRegIterator SubRegs(Reg, TRI, /*IncludeSelf=*/true); SubRegs.isValid(); ++SubRegs) @@ -1976,7 +1976,7 @@ bool IfConverter::IfConvertDiamond(BBInfo &BBI, IfcvtKind Kind, } static bool MaySpeculate(const MachineInstr &MI, - SmallSet<unsigned, 4> &LaterRedefs) { + SmallSet<MCPhysReg, 4> &LaterRedefs) { bool SawStore = true; if (!MI.isSafeToMove(nullptr, SawStore)) return false; @@ -1999,7 +1999,7 @@ static bool MaySpeculate(const MachineInstr &MI, void IfConverter::PredicateBlock(BBInfo &BBI, MachineBasicBlock::iterator E, SmallVectorImpl<MachineOperand> &Cond, - SmallSet<unsigned, 4> *LaterRedefs) { + SmallSet<MCPhysReg, 4> *LaterRedefs) { bool AnyUnpred = false; bool MaySpec = LaterRedefs != nullptr; for (MachineInstr &I : make_range(BBI.BB->begin(), E)) { diff --git a/llvm/lib/CodeGen/LivePhysRegs.cpp b/llvm/lib/CodeGen/LivePhysRegs.cpp index 86c6c8e29f9..619643acb6d 100644 --- a/llvm/lib/CodeGen/LivePhysRegs.cpp +++ b/llvm/lib/CodeGen/LivePhysRegs.cpp @@ -29,8 +29,8 @@ using namespace llvm; /// The clobbers set will be the list of live registers clobbered /// by the regmask. void LivePhysRegs::removeRegsInMask(const MachineOperand &MO, - SmallVectorImpl<std::pair<unsigned, const MachineOperand*>> *Clobbers) { - SparseSet<unsigned>::iterator LRI = LiveRegs.begin(); + SmallVectorImpl<std::pair<MCPhysReg, const MachineOperand*>> *Clobbers) { + RegisterSet::iterator LRI = LiveRegs.begin(); while (LRI != LiveRegs.end()) { if (MO.clobbersPhysReg(*LRI)) { if (Clobbers) @@ -83,7 +83,7 @@ void LivePhysRegs::stepBackward(const MachineInstr &MI) { /// on accurate kill flags. If possible use stepBackward() instead of this /// function. void LivePhysRegs::stepForward(const MachineInstr &MI, - SmallVectorImpl<std::pair<unsigned, const MachineOperand*>> &Clobbers) { + SmallVectorImpl<std::pair<MCPhysReg, const MachineOperand*>> &Clobbers) { // Remove killed registers from the set. for (ConstMIBundleOperands O(MI); O.isValid(); ++O) { if (O->isReg() && !O->isDebug()) { @@ -142,7 +142,7 @@ LLVM_DUMP_METHOD void LivePhysRegs::dump() const { #endif bool LivePhysRegs::available(const MachineRegisterInfo &MRI, - unsigned Reg) const { + MCPhysReg Reg) const { if (LiveRegs.count(Reg)) return false; if (MRI.isReserved(Reg)) @@ -157,7 +157,7 @@ bool LivePhysRegs::available(const MachineRegisterInfo &MRI, /// Add live-in registers of basic block \p MBB to \p LiveRegs. void LivePhysRegs::addBlockLiveIns(const MachineBasicBlock &MBB) { for (const auto &LI : MBB.liveins()) { - unsigned Reg = LI.PhysReg; + MCPhysReg Reg = LI.PhysReg; LaneBitmask Mask = LI.LaneMask; MCSubRegIndexIterator S(Reg, TRI); assert(Mask.any() && "Invalid livein mask"); |