Skip to content

Commit

Permalink
Don't use PassInfo* as a type identifier for passes. Instead, use the…
Browse files Browse the repository at this point in the history
… address of the static

ID member as the sole unique type identifier.  Clean up APIs related to this change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110396 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
resistor committed Aug 5, 2010
1 parent 7365c09 commit 9ccaf53
Show file tree
Hide file tree
Showing 212 changed files with 484 additions and 480 deletions.
4 changes: 2 additions & 2 deletions include/llvm/Analysis/DOTGraphTraitsPass.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ template <class Analysis, bool Simple>
struct DOTGraphTraitsViewer : public FunctionPass {
std::string Name;

DOTGraphTraitsViewer(std::string GraphName, const void *ID) : FunctionPass(ID) {
DOTGraphTraitsViewer(std::string GraphName, char &ID) : FunctionPass(ID) {
Name = GraphName;
}

Expand All @@ -48,7 +48,7 @@ struct DOTGraphTraitsPrinter : public FunctionPass {

std::string Name;

DOTGraphTraitsPrinter(std::string GraphName, const void *ID)
DOTGraphTraitsPrinter(std::string GraphName, char &ID)
: FunctionPass(ID) {
Name = GraphName;
}
Expand Down
6 changes: 3 additions & 3 deletions include/llvm/Analysis/Dominators.h
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ class DominatorTree : public FunctionPass {
static char ID; // Pass ID, replacement for typeid
DominatorTreeBase<BasicBlock>* DT;

DominatorTree() : FunctionPass(&ID) {
DominatorTree() : FunctionPass(ID) {
DT = new DominatorTreeBase<BasicBlock>(false);
}

Expand Down Expand Up @@ -890,7 +890,7 @@ class DominanceFrontierBase : public FunctionPass {
const bool IsPostDominators;

public:
DominanceFrontierBase(void *ID, bool isPostDom)
DominanceFrontierBase(char &ID, bool isPostDom)
: FunctionPass(ID), IsPostDominators(isPostDom) {}

/// getRoots - Return the root blocks of the current CFG. This may include
Expand Down Expand Up @@ -1009,7 +1009,7 @@ class DominanceFrontier : public DominanceFrontierBase {
public:
static char ID; // Pass ID, replacement for typeid
DominanceFrontier() :
DominanceFrontierBase(&ID, false) {}
DominanceFrontierBase(ID, false) {}

BasicBlock *getRoot() const {
assert(Roots.size() == 1 && "Should always have entry node!");
Expand Down
2 changes: 1 addition & 1 deletion include/llvm/Analysis/FindUsedTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class FindUsedTypes : public ModulePass {
std::set<const Type *> UsedTypes;
public:
static char ID; // Pass identification, replacement for typeid
FindUsedTypes() : ModulePass(&ID) {}
FindUsedTypes() : ModulePass(ID) {}

/// getTypes - After the pass has been run, return the set containing all of
/// the types used in the module.
Expand Down
2 changes: 1 addition & 1 deletion include/llvm/Analysis/IntervalPartition.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class IntervalPartition : public FunctionPass {
public:
static char ID; // Pass identification, replacement for typeid

IntervalPartition() : FunctionPass(&ID), RootInterval(0) {}
IntervalPartition() : FunctionPass(ID), RootInterval(0) {}

// run - Calculate the interval partition for this function
virtual bool runOnFunction(Function &F);
Expand Down
2 changes: 1 addition & 1 deletion include/llvm/Analysis/LazyValueInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class LazyValueInfo : public FunctionPass {
void operator=(const LazyValueInfo&); // DO NOT IMPLEMENT.
public:
static char ID;
LazyValueInfo() : FunctionPass(&ID), PImpl(0) {}
LazyValueInfo() : FunctionPass(ID), PImpl(0) {}
~LazyValueInfo() { assert(PImpl == 0 && "releaseMemory not called"); }

/// Tristate - This is used to return true/false/dunno results.
Expand Down
8 changes: 4 additions & 4 deletions include/llvm/Analysis/LibCallAliasAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ namespace llvm {
LibCallInfo *LCI;

explicit LibCallAliasAnalysis(LibCallInfo *LC = 0)
: FunctionPass(&ID), LCI(LC) {
: FunctionPass(ID), LCI(LC) {
}
explicit LibCallAliasAnalysis(const void *ID, LibCallInfo *LC)
explicit LibCallAliasAnalysis(char &ID, LibCallInfo *LC)
: FunctionPass(ID), LCI(LC) {
}
~LibCallAliasAnalysis();
Expand All @@ -55,8 +55,8 @@ namespace llvm {
/// an analysis interface through multiple inheritance. If needed, it
/// should override this to adjust the this pointer as needed for the
/// specified pass info.
virtual void *getAdjustedAnalysisPointer(const PassInfo *PI) {
if (PI->isPassID(&AliasAnalysis::ID))
virtual void *getAdjustedAnalysisPointer(const void *PI) {
if (PI == &AliasAnalysis::ID)
return (AliasAnalysis*)this;
return this;
}
Expand Down
2 changes: 1 addition & 1 deletion include/llvm/Analysis/LoopDependenceAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class LoopDependenceAnalysis : public LoopPass {

public:
static char ID; // Class identification, replacement for typeinfo
LoopDependenceAnalysis() : LoopPass(&ID) {}
LoopDependenceAnalysis() : LoopPass(ID) {}

/// isDependencePair - Check whether two values can possibly give rise to
/// a data dependence: that is the case if both are instructions accessing
Expand Down
2 changes: 1 addition & 1 deletion include/llvm/Analysis/LoopInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,7 @@ class LoopInfo : public FunctionPass {
public:
static char ID; // Pass identification, replacement for typeid

LoopInfo() : FunctionPass(&ID) {}
LoopInfo() : FunctionPass(ID) {}

LoopInfoBase<BasicBlock, Loop>& getBase() { return LI; }

Expand Down
3 changes: 1 addition & 2 deletions include/llvm/Analysis/LoopPass.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ class PMStack;

class LoopPass : public Pass {
public:
explicit LoopPass(intptr_t pid) : Pass(PT_Loop, pid) {}
explicit LoopPass(void *pid) : Pass(PT_Loop, pid) {}
explicit LoopPass(char &pid) : Pass(PT_Loop, pid) {}

/// getPrinterPass - Get a pass to print the function corresponding
/// to a Loop.
Expand Down
4 changes: 2 additions & 2 deletions include/llvm/Analysis/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ namespace llvm {
// file.
//
ModulePass *createProfileLoaderPass();
extern const PassInfo *ProfileLoaderPassID;
extern char &ProfileLoaderPassID;

//===--------------------------------------------------------------------===//
//
Expand All @@ -106,7 +106,7 @@ namespace llvm {
// instead of loading it from a previous run.
//
FunctionPass *createProfileEstimatorPass();
extern const PassInfo *ProfileEstimatorPassID;
extern char &ProfileEstimatorPassID;

//===--------------------------------------------------------------------===//
//
Expand Down
4 changes: 2 additions & 2 deletions include/llvm/Analysis/PostDominators.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct PostDominatorTree : public FunctionPass {
static char ID; // Pass identification, replacement for typeid
DominatorTreeBase<BasicBlock>* DT;

PostDominatorTree() : FunctionPass(&ID) {
PostDominatorTree() : FunctionPass(ID) {
DT = new DominatorTreeBase<BasicBlock>(true);
}

Expand Down Expand Up @@ -106,7 +106,7 @@ template <> struct GraphTraits<PostDominatorTree*>
struct PostDominanceFrontier : public DominanceFrontierBase {
static char ID;
PostDominanceFrontier()
: DominanceFrontierBase(&ID, true) {}
: DominanceFrontierBase(ID, true) {}

virtual bool runOnFunction(Function &) {
Frontiers.clear();
Expand Down
3 changes: 1 addition & 2 deletions include/llvm/CallGraphSCCPass.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ class CallGraphSCC;

class CallGraphSCCPass : public Pass {
public:
explicit CallGraphSCCPass(intptr_t pid) : Pass(PT_CallGraphSCC, pid) {}
explicit CallGraphSCCPass(void *pid) : Pass(PT_CallGraphSCC, pid) {}
explicit CallGraphSCCPass(char &pid) : Pass(PT_CallGraphSCC, pid) {}

/// createPrinterPass - Get a pass that prints the Module
/// corresponding to a CallGraph.
Expand Down
2 changes: 1 addition & 1 deletion include/llvm/CodeGen/CalcSpillWeights.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace llvm {
public:
static char ID;

CalculateSpillWeights() : MachineFunctionPass(&ID) {}
CalculateSpillWeights() : MachineFunctionPass(ID) {}

virtual void getAnalysisUsage(AnalysisUsage &au) const;

Expand Down
2 changes: 1 addition & 1 deletion include/llvm/CodeGen/LiveIntervalAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace llvm {

public:
static char ID; // Pass identification, replacement for typeid
LiveIntervals() : MachineFunctionPass(&ID) {}
LiveIntervals() : MachineFunctionPass(ID) {}

// Calculate the spill weight to assign to a single instruction.
static float getSpillWeight(bool isDef, bool isUse, unsigned loopDepth);
Expand Down
2 changes: 1 addition & 1 deletion include/llvm/CodeGen/LiveStackAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace llvm {

public:
static char ID; // Pass identification, replacement for typeid
LiveStacks() : MachineFunctionPass(&ID) {}
LiveStacks() : MachineFunctionPass(ID) {}

typedef SS2IntervalMap::iterator iterator;
typedef SS2IntervalMap::const_iterator const_iterator;
Expand Down
2 changes: 1 addition & 1 deletion include/llvm/CodeGen/LiveVariables.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class TargetRegisterInfo;
class LiveVariables : public MachineFunctionPass {
public:
static char ID; // Pass identification, replacement for typeid
LiveVariables() : MachineFunctionPass(&ID) {}
LiveVariables() : MachineFunctionPass(ID) {}

/// VarInfo - This represents the regions where a virtual register is live in
/// the program. We represent this with three different pieces of
Expand Down
3 changes: 1 addition & 2 deletions include/llvm/CodeGen/MachineFunctionPass.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ class MachineFunction;
/// override runOnMachineFunction.
class MachineFunctionPass : public FunctionPass {
protected:
explicit MachineFunctionPass(intptr_t ID) : FunctionPass(ID) {}
explicit MachineFunctionPass(void *ID) : FunctionPass(ID) {}
explicit MachineFunctionPass(char &ID) : FunctionPass(ID) {}

/// runOnMachineFunction - This method must be overloaded to perform the
/// desired machine code transformation or analysis.
Expand Down
2 changes: 1 addition & 1 deletion include/llvm/CodeGen/MachineLoopInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class MachineLoopInfo : public MachineFunctionPass {
public:
static char ID; // Pass identification, replacement for typeid

MachineLoopInfo() : MachineFunctionPass(&ID) {}
MachineLoopInfo() : MachineFunctionPass(ID) {}

LoopInfoBase<MachineBasicBlock, MachineLoop>& getBase() { return LI; }

Expand Down
16 changes: 8 additions & 8 deletions include/llvm/CodeGen/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,42 +43,42 @@ namespace llvm {

/// MachineLoopInfo pass - This pass is a loop analysis pass.
///
extern const PassInfo *const MachineLoopInfoID;
extern char &MachineLoopInfoID;

/// MachineDominators pass - This pass is a machine dominators analysis pass.
///
extern const PassInfo *const MachineDominatorsID;
extern char &MachineDominatorsID;

/// PHIElimination pass - This pass eliminates machine instruction PHI nodes
/// by inserting copy instructions. This destroys SSA information, but is the
/// desired input for some register allocators. This pass is "required" by
/// these register allocator like this: AU.addRequiredID(PHIEliminationID);
///
extern const PassInfo *const PHIEliminationID;
extern char &PHIEliminationID;

/// StrongPHIElimination pass - This pass eliminates machine instruction PHI
/// nodes by inserting copy instructions. This destroys SSA information, but
/// is the desired input for some register allocators. This pass is
/// "required" by these register allocator like this:
/// AU.addRequiredID(PHIEliminationID);
/// This pass is still in development
extern const PassInfo *const StrongPHIEliminationID;
extern char &StrongPHIEliminationID;

extern const PassInfo *const PreAllocSplittingID;
extern char &PreAllocSplittingID;

/// SimpleRegisterCoalescing pass. Aggressively coalesces every register
/// copy it can.
///
extern const PassInfo *const SimpleRegisterCoalescingID;
extern char &SimpleRegisterCoalescingID;

/// TwoAddressInstruction pass - This pass reduces two-address instructions to
/// use two operands. This destroys SSA information but it is desired by
/// register allocators.
extern const PassInfo *const TwoAddressInstructionPassID;
extern char &TwoAddressInstructionPassID;

/// UnreachableMachineBlockElimination pass - This pass removes unreachable
/// machine basic blocks.
extern const PassInfo *const UnreachableMachineBlockElimID;
extern char &UnreachableMachineBlockElimID;

/// DeadMachineInstructionElim pass - This pass removes dead machine
/// instructions.
Expand Down
2 changes: 1 addition & 1 deletion include/llvm/CodeGen/ProcessImplicitDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace llvm {
public:
static char ID;

ProcessImplicitDefs() : MachineFunctionPass(&ID) {}
ProcessImplicitDefs() : MachineFunctionPass(ID) {}

virtual void getAnalysisUsage(AnalysisUsage &au) const;

Expand Down
2 changes: 1 addition & 1 deletion include/llvm/CodeGen/SlotIndexes.h
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ namespace llvm {
public:
static char ID;

SlotIndexes() : MachineFunctionPass(&ID), indexListHead(0) {}
SlotIndexes() : MachineFunctionPass(ID), indexListHead(0) {}

virtual void getAnalysisUsage(AnalysisUsage &au) const;
virtual void releaseMemory();
Expand Down
Loading

0 comments on commit 9ccaf53

Please sign in to comment.