From 5df3d89009536306ef278a123feadc9ea0760a85 Mon Sep 17 00:00:00 2001 From: Eugene Zelenko Date: Thu, 24 Aug 2017 21:21:39 +0000 Subject: [CodeGen] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). llvm-svn: 311703 --- llvm/lib/CodeGen/LiveInterval.cpp | 46 +++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 16 deletions(-) (limited to 'llvm/lib/CodeGen/LiveInterval.cpp') diff --git a/llvm/lib/CodeGen/LiveInterval.cpp b/llvm/lib/CodeGen/LiveInterval.cpp index 9ef9f238fdc..ac19d7b0139 100644 --- a/llvm/lib/CodeGen/LiveInterval.cpp +++ b/llvm/lib/CodeGen/LiveInterval.cpp @@ -1,4 +1,4 @@ -//===-- LiveInterval.cpp - Live Interval Representation -------------------===// +//===- LiveInterval.cpp - Live Interval Representation --------------------===// // // The LLVM Compiler Infrastructure // @@ -19,20 +19,34 @@ //===----------------------------------------------------------------------===// #include "llvm/CodeGen/LiveInterval.h" - #include "LiveRangeUtils.h" #include "RegisterCoalescer.h" +#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/STLExtras.h" -#include "llvm/ADT/SmallSet.h" +#include "llvm/ADT/SmallPtrSet.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/iterator_range.h" #include "llvm/CodeGen/LiveIntervalAnalysis.h" +#include "llvm/CodeGen/MachineBasicBlock.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/Compiler.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetRegisterInfo.h" #include +#include +#include +#include +#include + using namespace llvm; namespace { + //===----------------------------------------------------------------------===// // Implementation of various methods necessary for calculation of live ranges. // The implementation of the methods abstracts from the concrete type of the @@ -56,8 +70,8 @@ protected: CalcLiveRangeUtilBase(LiveRange *LR) : LR(LR) {} public: - typedef LiveRange::Segment Segment; - typedef IteratorT iterator; + using Segment = LiveRange::Segment; + using iterator = IteratorT; /// A counterpart of LiveRange::createDeadDef: Make sure the range has a /// value defined at @p Def. @@ -265,8 +279,9 @@ private: //===----------------------------------------------------------------------===// class CalcLiveRangeUtilVector; -typedef CalcLiveRangeUtilBase CalcLiveRangeUtilVectorBase; +using CalcLiveRangeUtilVectorBase = + CalcLiveRangeUtilBase; class CalcLiveRangeUtilVector : public CalcLiveRangeUtilVectorBase { public: @@ -292,9 +307,9 @@ private: //===----------------------------------------------------------------------===// class CalcLiveRangeUtilSet; -typedef CalcLiveRangeUtilBase CalcLiveRangeUtilSetBase; +using CalcLiveRangeUtilSetBase = + CalcLiveRangeUtilBase; class CalcLiveRangeUtilSet : public CalcLiveRangeUtilSetBase { public: @@ -327,7 +342,8 @@ private: return I; } }; -} // namespace + +} // end anonymous namespace //===----------------------------------------------------------------------===// // LiveRange methods @@ -444,7 +460,7 @@ bool LiveRange::overlaps(const LiveRange &Other, const CoalescerPair &CP, if (J == JE) return false; - for (;;) { + while (true) { // J has just been advanced to satisfy: assert(J->end >= I->start); // Check for an overlap. @@ -865,7 +881,6 @@ void LiveInterval::clearSubRanges() { void LiveInterval::refineSubRanges(BumpPtrAllocator &Allocator, LaneBitmask LaneMask, std::function Apply) { - LaneBitmask ToApply = LaneMask; for (SubRange &SR : subranges()) { LaneBitmask SRMask = SR.LaneMask; @@ -925,8 +940,8 @@ void LiveInterval::computeSubRangeUndefs(SmallVectorImpl &Undefs, } } -raw_ostream& llvm::operator<<(raw_ostream& os, const LiveRange::Segment &S) { - return os << '[' << S.start << ',' << S.end << ':' << S.valno->id << ')'; +raw_ostream& llvm::operator<<(raw_ostream& OS, const LiveRange::Segment &S) { + return OS << '[' << S.start << ',' << S.end << ':' << S.valno->id << ')'; } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) @@ -1033,7 +1048,6 @@ void LiveInterval::verify(const MachineRegisterInfo *MRI) const { } #endif - //===----------------------------------------------------------------------===// // LiveRangeUpdater class //===----------------------------------------------------------------------===// -- cgit v1.2.3