1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 13:11:39 +01:00

LiveRangeEdit.h - reduce AliasAnalysis.h include to forward declaration. NFC.

Move include to LiveRangeEdit.cpp and replace legacy AliasAnalysis typedef with AAResults where necessary.
This commit is contained in:
Simon Pilgrim 2020-06-25 18:12:55 +01:00
parent 44a4cd8a40
commit 2a154d7b05
2 changed files with 12 additions and 11 deletions

View File

@ -22,7 +22,6 @@
#include "llvm/ADT/SetVector.h" #include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/CodeGen/LiveInterval.h" #include "llvm/CodeGen/LiveInterval.h"
#include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineFunction.h"
@ -33,6 +32,7 @@
namespace llvm { namespace llvm {
class AAResults;
class LiveIntervals; class LiveIntervals;
class MachineBlockFrequencyInfo; class MachineBlockFrequencyInfo;
class MachineInstr; class MachineInstr;
@ -94,7 +94,7 @@ private:
SmallPtrSet<const VNInfo *, 4> Rematted; SmallPtrSet<const VNInfo *, 4> Rematted;
/// scanRemattable - Identify the Parent values that may rematerialize. /// scanRemattable - Identify the Parent values that may rematerialize.
void scanRemattable(AliasAnalysis *aa); void scanRemattable(AAResults *aa);
/// allUsesAvailableAt - Return true if all registers used by OrigMI at /// allUsesAvailableAt - Return true if all registers used by OrigMI at
/// OrigIdx are also available with the same value at UseIdx. /// OrigIdx are also available with the same value at UseIdx.
@ -110,7 +110,7 @@ private:
/// Helper for eliminateDeadDefs. /// Helper for eliminateDeadDefs.
void eliminateDeadDef(MachineInstr *MI, ToShrinkSet &ToShrink, void eliminateDeadDef(MachineInstr *MI, ToShrinkSet &ToShrink,
AliasAnalysis *AA); AAResults *AA);
/// MachineRegisterInfo callback to notify when new virtual /// MachineRegisterInfo callback to notify when new virtual
/// registers are created. /// registers are created.
@ -190,12 +190,12 @@ public:
/// anyRematerializable - Return true if any parent values may be /// anyRematerializable - Return true if any parent values may be
/// rematerializable. /// rematerializable.
/// This function must be called before any rematerialization is attempted. /// This function must be called before any rematerialization is attempted.
bool anyRematerializable(AliasAnalysis *); bool anyRematerializable(AAResults *);
/// checkRematerializable - Manually add VNI to the list of rematerializable /// checkRematerializable - Manually add VNI to the list of rematerializable
/// values if DefMI may be rematerializable. /// values if DefMI may be rematerializable.
bool checkRematerializable(VNInfo *VNI, const MachineInstr *DefMI, bool checkRematerializable(VNInfo *VNI, const MachineInstr *DefMI,
AliasAnalysis *); AAResults *);
/// Remat - Information needed to rematerialize at a specific location. /// Remat - Information needed to rematerialize at a specific location.
struct Remat { struct Remat {
@ -244,7 +244,7 @@ public:
/// as currently those new intervals are not guaranteed to spill. /// as currently those new intervals are not guaranteed to spill.
void eliminateDeadDefs(SmallVectorImpl<MachineInstr *> &Dead, void eliminateDeadDefs(SmallVectorImpl<MachineInstr *> &Dead,
ArrayRef<unsigned> RegsBeingSpilled = None, ArrayRef<unsigned> RegsBeingSpilled = None,
AliasAnalysis *AA = nullptr); AAResults *AA = nullptr);
/// calculateRegClassAndHint - Recompute register class and hint for each new /// calculateRegClassAndHint - Recompute register class and hint for each new
/// register. /// register.

View File

@ -12,6 +12,7 @@
#include "llvm/CodeGen/LiveRangeEdit.h" #include "llvm/CodeGen/LiveRangeEdit.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/CodeGen/CalcSpillWeights.h" #include "llvm/CodeGen/CalcSpillWeights.h"
#include "llvm/CodeGen/LiveIntervals.h" #include "llvm/CodeGen/LiveIntervals.h"
#include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/MachineRegisterInfo.h"
@ -69,7 +70,7 @@ unsigned LiveRangeEdit::createFrom(unsigned OldReg) {
bool LiveRangeEdit::checkRematerializable(VNInfo *VNI, bool LiveRangeEdit::checkRematerializable(VNInfo *VNI,
const MachineInstr *DefMI, const MachineInstr *DefMI,
AliasAnalysis *aa) { AAResults *aa) {
assert(DefMI && "Missing instruction"); assert(DefMI && "Missing instruction");
ScannedRemattable = true; ScannedRemattable = true;
if (!TII.isTriviallyReMaterializable(*DefMI, aa)) if (!TII.isTriviallyReMaterializable(*DefMI, aa))
@ -78,7 +79,7 @@ bool LiveRangeEdit::checkRematerializable(VNInfo *VNI,
return true; return true;
} }
void LiveRangeEdit::scanRemattable(AliasAnalysis *aa) { void LiveRangeEdit::scanRemattable(AAResults *aa) {
for (VNInfo *VNI : getParent().valnos) { for (VNInfo *VNI : getParent().valnos) {
if (VNI->isUnused()) if (VNI->isUnused())
continue; continue;
@ -95,7 +96,7 @@ void LiveRangeEdit::scanRemattable(AliasAnalysis *aa) {
ScannedRemattable = true; ScannedRemattable = true;
} }
bool LiveRangeEdit::anyRematerializable(AliasAnalysis *aa) { bool LiveRangeEdit::anyRematerializable(AAResults *aa) {
if (!ScannedRemattable) if (!ScannedRemattable)
scanRemattable(aa); scanRemattable(aa);
return !Remattable.empty(); return !Remattable.empty();
@ -259,7 +260,7 @@ bool LiveRangeEdit::useIsKill(const LiveInterval &LI,
/// Find all live intervals that need to shrink, then remove the instruction. /// Find all live intervals that need to shrink, then remove the instruction.
void LiveRangeEdit::eliminateDeadDef(MachineInstr *MI, ToShrinkSet &ToShrink, void LiveRangeEdit::eliminateDeadDef(MachineInstr *MI, ToShrinkSet &ToShrink,
AliasAnalysis *AA) { AAResults *AA) {
assert(MI->allDefsAreDead() && "Def isn't really dead"); assert(MI->allDefsAreDead() && "Def isn't really dead");
SlotIndex Idx = LIS.getInstructionIndex(*MI).getRegSlot(); SlotIndex Idx = LIS.getInstructionIndex(*MI).getRegSlot();
@ -392,7 +393,7 @@ void LiveRangeEdit::eliminateDeadDef(MachineInstr *MI, ToShrinkSet &ToShrink,
void LiveRangeEdit::eliminateDeadDefs(SmallVectorImpl<MachineInstr *> &Dead, void LiveRangeEdit::eliminateDeadDefs(SmallVectorImpl<MachineInstr *> &Dead,
ArrayRef<unsigned> RegsBeingSpilled, ArrayRef<unsigned> RegsBeingSpilled,
AliasAnalysis *AA) { AAResults *AA) {
ToShrinkSet ToShrink; ToShrinkSet ToShrink;
for (;;) { for (;;) {