21#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUNEXTUSEANALYSIS_H
22#define LLVM_LIB_TARGET_AMDGPU_AMDGPUNEXTUSEANALYSIS_H
99 if (W.isUnreachable())
101 constexpr int64_t MaxVal = std::numeric_limits<int64_t>::max();
102 if (Value != 0 && W.Value > MaxVal / Value)
111 return Value <
B.Value;
115 return Value >
B.Value;
119 return Value <=
B.Value;
123 return Value >=
B.Value;
127 return Value ==
B.Value;
131 return Value !=
B.Value;
141 OS <<
"<unreachable>";
148 return "<unreachable>";
168 const unsigned Shift = 7 *
Depth;
198 if (W.isUnreachable())
200 constexpr int64_t MaxVal = std::numeric_limits<int64_t>::max();
201 if (Value != 0 && W.Value > MaxVal / Value)
218 return A <
B ?
A :
B;
222 return A >
B ?
A :
B;
230class AMDGPUNextUseAnalysis {
236 std::unique_ptr<AMDGPUNextUseAnalysisImpl> Impl;
241 AMDGPUNextUseAnalysis(AMDGPUNextUseAnalysis &&
Other);
309 UseDistancePair *FurthestSubreg =
nullptr,
311 *RelevantUses =
nullptr)
const;
334 std::unique_ptr<AMDGPUNextUseAnalysis> NUA;
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
This header defines various interfaces for pass management in LLVM.
This file supports working with JSON data.
Remove Loads Into Fake Uses
Interface definition for SIInstrInfo.
Interface definition for SIRegisterInfo.
AMDGPUNextUseAnalysisLegacyPass()
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
AMDGPUNextUseAnalysis & getNextUseAnalysis()
bool runOnMachineFunction(MachineFunction &) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
const AMDGPUNextUseAnalysis & getNextUseAnalysis() const
Result run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
AMDGPUNextUseAnalysis Result
AMDGPUNextUseAnalysisPrinterLegacyPass()
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
bool runOnMachineFunction(MachineFunction &) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
AMDGPUNextUseAnalysisPrinterPass(raw_ostream &OS)
friend class AMDGPUNextUseAnalysisPrinterLegacyPass
void getReachableUses(Register LiveReg, LaneBitmask LaneMask, const MachineInstr &MI, SmallVector< const MachineOperand * > &Uses) const
friend class AMDGPUNextUseAnalysisPass
void getNextUseDistances(const DenseMap< unsigned, LaneBitmask > &LiveRegs, const MachineInstr &MI, UseDistancePair &Furthest, UseDistancePair *FurthestSubreg=nullptr, DenseMap< const MachineOperand *, UseDistancePair > *RelevantUses=nullptr) const
friend class AMDGPUNextUseAnalysisLegacyPass
NextUseDistance getShortestDistance(Register LiveReg, const MachineInstr &CurMI, const SmallVector< const MachineOperand * > &Uses, const MachineOperand **ShortestUseOut=nullptr, SmallVector< NextUseDistance > *Distances=nullptr) const
\Returns the shortest next-use distance from CurMI for LiveReg.
AMDGPUNextUseAnalysis & operator=(AMDGPUNextUseAnalysis &&Other)
friend class AMDGPUNextUseAnalysisPrinterPass
Represent the analysis usage information of a pass.
MachineFunctionPass(char &ID)
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
constexpr bool operator==(const NextUseDistance &B) const
constexpr bool operator!=(const NextUseDistance &B) const
json::Value toJsonValue() const
constexpr NextUseDistance & operator-=(const NextUseDistance &B)
std::string toString() const
constexpr NextUseDistance & operator=(const NextUseDistance &B)
constexpr NextUseDistance & operator+=(const NextUseDistance &B)
constexpr NextUseDistance(int V)
constexpr bool operator>(const NextUseDistance &B) const
static constexpr NextUseDistance fromSize(unsigned Size, unsigned Depth)
constexpr int64_t getRawValue() const
static constexpr NextUseDistance unreachable()
constexpr bool operator>=(const NextUseDistance &B) const
constexpr NextUseDistance(const NextUseDistance &B)
constexpr bool operator<(const NextUseDistance &B) const
friend class AMDGPUNextUseAnalysisImpl
constexpr NextUseDistance & operator=(int V)
constexpr NextUseDistance operator-() const
constexpr bool isReachable() const
void print(raw_ostream &OS) const
constexpr NextUseDistance applyLoopWeight() const
constexpr NextUseDistance(unsigned V)
format_object< int64_t > fmt() const
constexpr NextUseDistance & operator=(unsigned V)
constexpr bool operator<=(const NextUseDistance &B) const
constexpr bool isUnreachable() const
A set of analyses that are preserved following a run of a transformation pass.
Wrapper class representing virtual and physical registers.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
A Value is an JSON value of unknown type.
This class implements an extremely fast bulk output stream that can only output to a stream.
A raw_ostream that writes to an std::string.
std::string & str()
Returns the string's reference.
This is an optimization pass for GlobalISel generic memory operations.
constexpr NextUseDistance min(NextUseDistance A, NextUseDistance B)
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
constexpr NextUseDistance max(NextUseDistance A, NextUseDistance B)
APInt operator+(APInt a, const APInt &b)
static Config Graphics()
Named presets.
const MachineOperand * Use
UseDistancePair()=default
UseDistancePair(const MachineOperand *Use, NextUseDistance Dist)
A CRTP mix-in that provides informational APIs needed for analysis passes.
A special type used by analysis passes to provide an address that identifies that particular analysis...
A CRTP mix-in for passes that should not be skipped.