diff options
author | Eugene Zelenko <eugene.zelenko@gmail.com> | 2017-08-24 21:21:39 +0000 |
---|---|---|
committer | Eugene Zelenko <eugene.zelenko@gmail.com> | 2017-08-24 21:21:39 +0000 |
commit | 5df3d89009536306ef278a123feadc9ea0760a85 (patch) | |
tree | ea21a3b9a37204a53ef145030eed4f91e51b87cf /llvm/lib/CodeGen/LiveRangeCalc.cpp | |
parent | f98335e0b08868c05a91349edf9c60a2b014686c (diff) | |
download | llvm-5df3d89009536306ef278a123feadc9ea0760a85.zip llvm-5df3d89009536306ef278a123feadc9ea0760a85.tar.gz llvm-5df3d89009536306ef278a123feadc9ea0760a85.tar.bz2 |
[CodeGen] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 311703
Diffstat (limited to 'llvm/lib/CodeGen/LiveRangeCalc.cpp')
-rw-r--r-- | llvm/lib/CodeGen/LiveRangeCalc.cpp | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/LiveRangeCalc.cpp b/llvm/lib/CodeGen/LiveRangeCalc.cpp index 8c43c9f..befce35 100644 --- a/llvm/lib/CodeGen/LiveRangeCalc.cpp +++ b/llvm/lib/CodeGen/LiveRangeCalc.cpp @@ -1,4 +1,4 @@ -//===---- LiveRangeCalc.cpp - Calculate live ranges -----------------------===// +//===- LiveRangeCalc.cpp - Calculate live ranges --------------------------===// // // The LLVM Compiler Infrastructure // @@ -12,9 +12,27 @@ //===----------------------------------------------------------------------===// #include "LiveRangeCalc.h" +#include "llvm/ADT/BitVector.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SetVector.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/CodeGen/LiveInterval.h" +#include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineDominators.h" +#include "llvm/CodeGen/MachineFunction.h" +#include "llvm/CodeGen/MachineInstr.h" +#include "llvm/CodeGen/MachineOperand.h" #include "llvm/CodeGen/MachineRegisterInfo.h" +#include "llvm/CodeGen/SlotIndexes.h" +#include "llvm/MC/LaneBitmask.h" +#include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/raw_ostream.h" +#include "llvm/Target/TargetRegisterInfo.h" +#include <algorithm> +#include <cassert> +#include <iterator> +#include <tuple> +#include <utility> using namespace llvm; @@ -44,7 +62,6 @@ void LiveRangeCalc::reset(const MachineFunction *mf, LiveIn.clear(); } - static void createDeadDef(SlotIndexes &Indexes, VNInfo::Allocator &Alloc, LiveRange &LR, const MachineOperand &MO) { const MachineInstr &MI = *MO.getParent(); @@ -136,7 +153,6 @@ void LiveRangeCalc::createDeadDefs(LiveRange &LR, unsigned Reg) { createDeadDef(*Indexes, *Alloc, LR, MO); } - void LiveRangeCalc::extendToUses(LiveRange &LR, unsigned Reg, LaneBitmask Mask, LiveInterval *LI) { SmallVector<SlotIndex, 4> Undefs; @@ -197,7 +213,6 @@ void LiveRangeCalc::extendToUses(LiveRange &LR, unsigned Reg, LaneBitmask Mask, } } - void LiveRangeCalc::updateFromLiveIns() { LiveRangeUpdater Updater; for (const LiveInBlock &I : LiveIn) { @@ -248,7 +263,6 @@ void LiveRangeCalc::extend(LiveRange &LR, SlotIndex Use, unsigned PhysReg, calculateValues(); } - // This function is called by a client after using the low-level API to add // live-out and live-in blocks. The unique value optimization is not // available, SplitEditor::transferValues handles that case directly anyway. @@ -259,7 +273,6 @@ void LiveRangeCalc::calculateValues() { updateFromLiveIns(); } - bool LiveRangeCalc::isDefOnEntry(LiveRange &LR, ArrayRef<SlotIndex> Undefs, MachineBasicBlock &MBB, BitVector &DefOnEntry, BitVector &UndefOnEntry) { @@ -410,7 +423,7 @@ bool LiveRangeCalc::findReachingDefs(LiveRange &LR, MachineBasicBlock &UseMBB, LiveIn.clear(); FoundUndef |= (TheVNI == nullptr || TheVNI == &UndefVNI); - if (Undefs.size() > 0 && FoundUndef) + if (!Undefs.empty() && FoundUndef) UniqueVNI = false; // Both updateSSA() and LiveRangeUpdater benefit from ordered blocks, but @@ -454,7 +467,7 @@ bool LiveRangeCalc::findReachingDefs(LiveRange &LR, MachineBasicBlock &UseMBB, LiveIn.reserve(WorkList.size()); for (unsigned BN : WorkList) { MachineBasicBlock *MBB = MF->getBlockNumbered(BN); - if (Undefs.size() > 0 && + if (!Undefs.empty() && !isDefOnEntry(LR, Undefs, *MBB, DefOnEntry, UndefOnEntry)) continue; addLiveInBlock(LR, DomTree->getNode(MBB)); @@ -465,7 +478,6 @@ bool LiveRangeCalc::findReachingDefs(LiveRange &LR, MachineBasicBlock &UseMBB, return false; } - // This is essentially the same iterative algorithm that SSAUpdater uses, // except we already have a dominator tree, so we don't have to recompute it. void LiveRangeCalc::updateSSA() { |