[AMDGPU] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 310541
diff --git a/llvm/lib/Target/AMDGPU/GCNRegPressure.h b/llvm/lib/Target/AMDGPU/GCNRegPressure.h
index 5dfe440..32a199d 100644
--- a/llvm/lib/Target/AMDGPU/GCNRegPressure.h
+++ b/llvm/lib/Target/AMDGPU/GCNRegPressure.h
@@ -1,4 +1,4 @@
-//===---------------------- GCNRegPressure.h -*- C++ -*--------------------===//
+//===- GCNRegPressure.h -----------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -6,20 +6,26 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-//
-/// \file
-//
-//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_TARGET_AMDGPU_GCNREGPRESSURE_H
#define LLVM_LIB_TARGET_AMDGPU_GCNREGPRESSURE_H
#include "AMDGPUSubtarget.h"
-
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/CodeGen/LiveIntervalAnalysis.h"
+#include "llvm/CodeGen/MachineBasicBlock.h"
+#include "llvm/CodeGen/MachineInstr.h"
+#include "llvm/CodeGen/SlotIndexes.h"
+#include "llvm/MC/LaneBitmask.h"
+#include "llvm/Support/Debug.h"
+#include <algorithm>
#include <limits>
namespace llvm {
+class MachineRegisterInfo;
+class raw_ostream;
+
struct GCNRegPressure {
enum RegKind {
SGPR32,
@@ -68,7 +74,7 @@
return !(*this == O);
}
- void print(raw_ostream &OS, const SISubtarget *ST=nullptr) const;
+ void print(raw_ostream &OS, const SISubtarget *ST = nullptr) const;
void dump() const { print(dbgs()); }
private:
@@ -89,7 +95,7 @@
class GCNRPTracker {
public:
- typedef DenseMap<unsigned, LaneBitmask> LiveRegSet;
+ using LiveRegSet = DenseMap<unsigned, LaneBitmask>;
protected:
const LiveIntervals &LIS;
@@ -97,7 +103,9 @@
GCNRegPressure CurPressure, MaxPressure;
const MachineInstr *LastTrackedMI = nullptr;
mutable const MachineRegisterInfo *MRI = nullptr;
+
GCNRPTracker(const LiveIntervals &LIS_) : LIS(LIS_) {}
+
public:
// live regs for the current state
const decltype(LiveRegs) &getLiveRegs() const { return LiveRegs; }
@@ -111,9 +119,11 @@
MaxPressure.clear();
return Res;
}
+
decltype(LiveRegs) moveLiveRegs() {
return std::move(LiveRegs);
}
+
static void printLiveRegs(raw_ostream &OS, const LiveRegSet& LiveRegs,
const MachineRegisterInfo &MRI);
};
@@ -121,6 +131,7 @@
class GCNUpwardRPTracker : public GCNRPTracker {
public:
GCNUpwardRPTracker(const LiveIntervals &LIS_) : GCNRPTracker(LIS_) {}
+
// reset tracker to the point just below MI
// filling live regs upon this point using LIS
void reset(const MachineInstr &MI, const LiveRegSet *LiveRegs = nullptr);
@@ -202,6 +213,6 @@
const LiveIntervals &LIS,
const MachineRegisterInfo &MRI);
-} // End namespace llvm
+} // end namespace llvm
#endif // LLVM_LIB_TARGET_AMDGPU_GCNREGPRESSURE_H