mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-16 08:29:43 +00:00
Remove unused MachineLoopRanges analysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168659 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
277068fe40
commit
af650354a1
@ -1,112 +0,0 @@
|
||||
//===- MachineLoopRanges.h - Ranges of machine loops -----------*- c++ -*--===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file provides the interface to the MachineLoopRanges analysis.
|
||||
//
|
||||
// Provide on-demand information about the ranges of machine instructions
|
||||
// covered by a loop.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_CODEGEN_MACHINELOOPRANGES_H
|
||||
#define LLVM_CODEGEN_MACHINELOOPRANGES_H
|
||||
|
||||
#include "llvm/ADT/IntervalMap.h"
|
||||
#include "llvm/CodeGen/SlotIndexes.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class MachineLoop;
|
||||
class MachineLoopInfo;
|
||||
class raw_ostream;
|
||||
|
||||
/// MachineLoopRange - Range information for a single loop.
|
||||
class MachineLoopRange {
|
||||
friend class MachineLoopRanges;
|
||||
|
||||
public:
|
||||
typedef IntervalMap<SlotIndex, unsigned, 4> Map;
|
||||
typedef Map::Allocator Allocator;
|
||||
|
||||
private:
|
||||
/// The mapped loop.
|
||||
const MachineLoop *const Loop;
|
||||
|
||||
/// Map intervals to a bit mask.
|
||||
/// Bit 0 = inside loop block.
|
||||
Map Intervals;
|
||||
|
||||
/// Loop area as measured by SlotIndex::distance.
|
||||
unsigned Area;
|
||||
|
||||
/// Create a MachineLoopRange, only accessible to MachineLoopRanges.
|
||||
MachineLoopRange(const MachineLoop*, Allocator&, SlotIndexes&);
|
||||
|
||||
public:
|
||||
/// getLoop - Return the mapped machine loop.
|
||||
const MachineLoop *getLoop() const { return Loop; }
|
||||
|
||||
/// overlaps - Return true if this loop overlaps the given range of machine
|
||||
/// inteructions.
|
||||
bool overlaps(SlotIndex Start, SlotIndex Stop);
|
||||
|
||||
/// getNumber - Return the loop number. This is the same as the number of the
|
||||
/// header block.
|
||||
unsigned getNumber() const;
|
||||
|
||||
/// getArea - Return the loop area. This number is approximately proportional
|
||||
/// to the number of instructions in the loop.
|
||||
unsigned getArea() const { return Area; }
|
||||
|
||||
/// getMap - Allow public read-only access for IntervalMapOverlaps.
|
||||
const Map &getMap() { return Intervals; }
|
||||
|
||||
/// print - Print loop ranges on OS.
|
||||
void print(raw_ostream&) const;
|
||||
|
||||
/// byNumber - Comparator for array_pod_sort that sorts a list of
|
||||
/// MachineLoopRange pointers by number.
|
||||
static int byNumber(const void*, const void*);
|
||||
|
||||
/// byAreaDesc - Comparator for array_pod_sort that sorts a list of
|
||||
/// MachineLoopRange pointers by descending area, then by number.
|
||||
static int byAreaDesc(const void*, const void*);
|
||||
};
|
||||
|
||||
raw_ostream &operator<<(raw_ostream&, const MachineLoopRange&);
|
||||
|
||||
/// MachineLoopRanges - Analysis pass that provides on-demand per-loop range
|
||||
/// information.
|
||||
class MachineLoopRanges : public MachineFunctionPass {
|
||||
typedef DenseMap<const MachineLoop*, MachineLoopRange*> CacheMap;
|
||||
typedef MachineLoopRange::Allocator MapAllocator;
|
||||
|
||||
MapAllocator Allocator;
|
||||
SlotIndexes *Indexes;
|
||||
CacheMap Cache;
|
||||
|
||||
public:
|
||||
static char ID; // Pass identification, replacement for typeid
|
||||
|
||||
MachineLoopRanges() : MachineFunctionPass(ID), Indexes(0) {}
|
||||
~MachineLoopRanges() { releaseMemory(); }
|
||||
|
||||
/// getLoopRange - Return the range of loop.
|
||||
MachineLoopRange *getLoopRange(const MachineLoop *Loop);
|
||||
|
||||
private:
|
||||
virtual bool runOnMachineFunction(MachineFunction&);
|
||||
virtual void releaseMemory();
|
||||
virtual void getAnalysisUsage(AnalysisUsage&) const;
|
||||
};
|
||||
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_CODEGEN_MACHINELOOPRANGES_H
|
@ -288,9 +288,6 @@ namespace llvm {
|
||||
/// MachineLoopInfo - This pass is a loop analysis pass.
|
||||
extern char &MachineLoopInfoID;
|
||||
|
||||
/// MachineLoopRanges - This pass is an on-demand loop coverage analysis.
|
||||
extern char &MachineLoopRangesID;
|
||||
|
||||
/// MachineDominators - This pass is a machine dominators analysis pass.
|
||||
extern char &MachineDominatorsID;
|
||||
|
||||
|
@ -172,7 +172,6 @@ void initializeMachineDominatorTreePass(PassRegistry&);
|
||||
void initializeMachinePostDominatorTreePass(PassRegistry&);
|
||||
void initializeMachineLICMPass(PassRegistry&);
|
||||
void initializeMachineLoopInfoPass(PassRegistry&);
|
||||
void initializeMachineLoopRangesPass(PassRegistry&);
|
||||
void initializeMachineModuleInfoPass(PassRegistry&);
|
||||
void initializeMachineSchedulerPass(PassRegistry&);
|
||||
void initializeMachineSinkingPass(PassRegistry&);
|
||||
|
@ -54,7 +54,6 @@ add_llvm_library(LLVMCodeGen
|
||||
MachineInstrBundle.cpp
|
||||
MachineLICM.cpp
|
||||
MachineLoopInfo.cpp
|
||||
MachineLoopRanges.cpp
|
||||
MachineModuleInfo.cpp
|
||||
MachineModuleInfoImpls.cpp
|
||||
MachinePassRegistry.cpp
|
||||
|
@ -16,7 +16,6 @@
|
||||
#define DEBUG_TYPE "regalloc"
|
||||
#include "LiveIntervalUnion.h"
|
||||
#include "llvm/ADT/SparseBitVector.h"
|
||||
#include "llvm/CodeGen/MachineLoopRanges.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Target/TargetRegisterInfo.h"
|
||||
@ -182,33 +181,6 @@ collectInterferingVRegs(unsigned MaxInterferingRegs) {
|
||||
return InterferingVRegs.size();
|
||||
}
|
||||
|
||||
bool LiveIntervalUnion::Query::checkLoopInterference(MachineLoopRange *Loop) {
|
||||
// VirtReg is likely live throughout the loop, so start by checking LIU-Loop
|
||||
// overlaps.
|
||||
IntervalMapOverlaps<LiveIntervalUnion::Map, MachineLoopRange::Map>
|
||||
Overlaps(LiveUnion->getMap(), Loop->getMap());
|
||||
if (!Overlaps.valid())
|
||||
return false;
|
||||
|
||||
// The loop is overlapping an LIU assignment. Check VirtReg as well.
|
||||
LiveInterval::iterator VRI = VirtReg->find(Overlaps.start());
|
||||
|
||||
for (;;) {
|
||||
if (VRI == VirtReg->end())
|
||||
return false;
|
||||
if (VRI->start < Overlaps.stop())
|
||||
return true;
|
||||
|
||||
Overlaps.advanceTo(VRI->start);
|
||||
if (!Overlaps.valid())
|
||||
return false;
|
||||
if (Overlaps.start() < VRI->end)
|
||||
return true;
|
||||
|
||||
VRI = VirtReg->advanceTo(VRI, Overlaps.start());
|
||||
}
|
||||
}
|
||||
|
||||
void LiveIntervalUnion::Array::init(LiveIntervalUnion::Allocator &Alloc,
|
||||
unsigned NSize) {
|
||||
// Reuse existing allocation.
|
||||
|
@ -173,10 +173,6 @@ public:
|
||||
return InterferingVRegs;
|
||||
}
|
||||
|
||||
/// checkLoopInterference - Return true if there is interference overlapping
|
||||
/// Loop.
|
||||
bool checkLoopInterference(MachineLoopRange*);
|
||||
|
||||
private:
|
||||
Query(const Query&) LLVM_DELETED_FUNCTION;
|
||||
void operator=(const Query&) LLVM_DELETED_FUNCTION;
|
||||
|
@ -1,116 +0,0 @@
|
||||
//===- MachineLoopRanges.cpp - Ranges of machine loops --------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file provides the implementation of the MachineLoopRanges analysis.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/CodeGen/MachineLoopRanges.h"
|
||||
#include "llvm/CodeGen/MachineLoopInfo.h"
|
||||
#include "llvm/CodeGen/Passes.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
char MachineLoopRanges::ID = 0;
|
||||
INITIALIZE_PASS_BEGIN(MachineLoopRanges, "machine-loop-ranges",
|
||||
"Machine Loop Ranges", true, true)
|
||||
INITIALIZE_PASS_DEPENDENCY(SlotIndexes)
|
||||
INITIALIZE_PASS_DEPENDENCY(MachineLoopInfo)
|
||||
INITIALIZE_PASS_END(MachineLoopRanges, "machine-loop-ranges",
|
||||
"Machine Loop Ranges", true, true)
|
||||
|
||||
char &llvm::MachineLoopRangesID = MachineLoopRanges::ID;
|
||||
|
||||
void MachineLoopRanges::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.setPreservesAll();
|
||||
AU.addRequiredTransitive<SlotIndexes>();
|
||||
AU.addRequiredTransitive<MachineLoopInfo>();
|
||||
MachineFunctionPass::getAnalysisUsage(AU);
|
||||
}
|
||||
|
||||
/// runOnMachineFunction - Don't do much, loop ranges are computed on demand.
|
||||
bool MachineLoopRanges::runOnMachineFunction(MachineFunction &) {
|
||||
releaseMemory();
|
||||
Indexes = &getAnalysis<SlotIndexes>();
|
||||
return false;
|
||||
}
|
||||
|
||||
void MachineLoopRanges::releaseMemory() {
|
||||
DeleteContainerSeconds(Cache);
|
||||
Cache.clear();
|
||||
}
|
||||
|
||||
MachineLoopRange *MachineLoopRanges::getLoopRange(const MachineLoop *Loop) {
|
||||
MachineLoopRange *&Range = Cache[Loop];
|
||||
if (!Range)
|
||||
Range = new MachineLoopRange(Loop, Allocator, *Indexes);
|
||||
return Range;
|
||||
}
|
||||
|
||||
/// Create a MachineLoopRange, only accessible to MachineLoopRanges.
|
||||
MachineLoopRange::MachineLoopRange(const MachineLoop *loop,
|
||||
MachineLoopRange::Allocator &alloc,
|
||||
SlotIndexes &Indexes)
|
||||
: Loop(loop), Intervals(alloc), Area(0) {
|
||||
// Compute loop coverage.
|
||||
for (MachineLoop::block_iterator I = Loop->block_begin(),
|
||||
E = Loop->block_end(); I != E; ++I) {
|
||||
const std::pair<SlotIndex, SlotIndex> &Range = Indexes.getMBBRange(*I);
|
||||
Intervals.insert(Range.first, Range.second, 1u);
|
||||
Area += Range.first.distance(Range.second);
|
||||
}
|
||||
}
|
||||
|
||||
/// overlaps - Return true if this loop overlaps the given range of machine
|
||||
/// instructions.
|
||||
bool MachineLoopRange::overlaps(SlotIndex Start, SlotIndex Stop) {
|
||||
Map::const_iterator I = Intervals.find(Start);
|
||||
return I.valid() && Stop > I.start();
|
||||
}
|
||||
|
||||
unsigned MachineLoopRange::getNumber() const {
|
||||
return Loop->getHeader()->getNumber();
|
||||
}
|
||||
|
||||
/// byNumber - Comparator for array_pod_sort that sorts a list of
|
||||
/// MachineLoopRange pointers by number.
|
||||
int MachineLoopRange::byNumber(const void *pa, const void *pb) {
|
||||
const MachineLoopRange *a = *static_cast<MachineLoopRange *const *>(pa);
|
||||
const MachineLoopRange *b = *static_cast<MachineLoopRange *const *>(pb);
|
||||
unsigned na = a->getNumber();
|
||||
unsigned nb = b->getNumber();
|
||||
if (na < nb)
|
||||
return -1;
|
||||
if (na > nb)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// byAreaDesc - Comparator for array_pod_sort that sorts a list of
|
||||
/// MachineLoopRange pointers by:
|
||||
/// 1. Descending area.
|
||||
/// 2. Ascending number.
|
||||
int MachineLoopRange::byAreaDesc(const void *pa, const void *pb) {
|
||||
const MachineLoopRange *a = *static_cast<MachineLoopRange *const *>(pa);
|
||||
const MachineLoopRange *b = *static_cast<MachineLoopRange *const *>(pb);
|
||||
if (a->getArea() != b->getArea())
|
||||
return a->getArea() > b->getArea() ? -1 : 1;
|
||||
return byNumber(pa, pb);
|
||||
}
|
||||
|
||||
void MachineLoopRange::print(raw_ostream &OS) const {
|
||||
OS << "Loop#" << getNumber() << " =";
|
||||
for (Map::const_iterator I = Intervals.begin(); I.valid(); ++I)
|
||||
OS << " [" << I.start() << ';' << I.stop() << ')';
|
||||
}
|
||||
|
||||
raw_ostream &llvm::operator<<(raw_ostream &OS, const MachineLoopRange &MLR) {
|
||||
MLR.print(OS);
|
||||
return OS;
|
||||
}
|
Loading…
Reference in New Issue
Block a user