Skip to content

Commit 755aceb

Browse files
committed
Don't use PassInfo* as a type identifier for passes. Instead, use the address of the static
ID member as the sole unique type identifier. Clean up APIs related to this change. llvm-svn: 110396
1 parent ddb2d65 commit 755aceb

File tree

212 files changed

+484
-480
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

212 files changed

+484
-480
lines changed

llvm/include/llvm/Analysis/DOTGraphTraitsPass.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ template <class Analysis, bool Simple>
2222
struct DOTGraphTraitsViewer : public FunctionPass {
2323
std::string Name;
2424

25-
DOTGraphTraitsViewer(std::string GraphName, const void *ID) : FunctionPass(ID) {
25+
DOTGraphTraitsViewer(std::string GraphName, char &ID) : FunctionPass(ID) {
2626
Name = GraphName;
2727
}
2828

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

4949
std::string Name;
5050

51-
DOTGraphTraitsPrinter(std::string GraphName, const void *ID)
51+
DOTGraphTraitsPrinter(std::string GraphName, char &ID)
5252
: FunctionPass(ID) {
5353
Name = GraphName;
5454
}

llvm/include/llvm/Analysis/Dominators.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ class DominatorTree : public FunctionPass {
702702
static char ID; // Pass ID, replacement for typeid
703703
DominatorTreeBase<BasicBlock>* DT;
704704

705-
DominatorTree() : FunctionPass(&ID) {
705+
DominatorTree() : FunctionPass(ID) {
706706
DT = new DominatorTreeBase<BasicBlock>(false);
707707
}
708708

@@ -890,7 +890,7 @@ class DominanceFrontierBase : public FunctionPass {
890890
const bool IsPostDominators;
891891

892892
public:
893-
DominanceFrontierBase(void *ID, bool isPostDom)
893+
DominanceFrontierBase(char &ID, bool isPostDom)
894894
: FunctionPass(ID), IsPostDominators(isPostDom) {}
895895

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

10141014
BasicBlock *getRoot() const {
10151015
assert(Roots.size() == 1 && "Should always have entry node!");

llvm/include/llvm/Analysis/FindUsedTypes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class FindUsedTypes : public ModulePass {
2626
std::set<const Type *> UsedTypes;
2727
public:
2828
static char ID; // Pass identification, replacement for typeid
29-
FindUsedTypes() : ModulePass(&ID) {}
29+
FindUsedTypes() : ModulePass(ID) {}
3030

3131
/// getTypes - After the pass has been run, return the set containing all of
3232
/// the types used in the module.

llvm/include/llvm/Analysis/IntervalPartition.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class IntervalPartition : public FunctionPass {
4848
public:
4949
static char ID; // Pass identification, replacement for typeid
5050

51-
IntervalPartition() : FunctionPass(&ID), RootInterval(0) {}
51+
IntervalPartition() : FunctionPass(ID), RootInterval(0) {}
5252

5353
// run - Calculate the interval partition for this function
5454
virtual bool runOnFunction(Function &F);

llvm/include/llvm/Analysis/LazyValueInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class LazyValueInfo : public FunctionPass {
3131
void operator=(const LazyValueInfo&); // DO NOT IMPLEMENT.
3232
public:
3333
static char ID;
34-
LazyValueInfo() : FunctionPass(&ID), PImpl(0) {}
34+
LazyValueInfo() : FunctionPass(ID), PImpl(0) {}
3535
~LazyValueInfo() { assert(PImpl == 0 && "releaseMemory not called"); }
3636

3737
/// Tristate - This is used to return true/false/dunno results.

llvm/include/llvm/Analysis/LibCallAliasAnalysis.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ namespace llvm {
2828
LibCallInfo *LCI;
2929

3030
explicit LibCallAliasAnalysis(LibCallInfo *LC = 0)
31-
: FunctionPass(&ID), LCI(LC) {
31+
: FunctionPass(ID), LCI(LC) {
3232
}
33-
explicit LibCallAliasAnalysis(const void *ID, LibCallInfo *LC)
33+
explicit LibCallAliasAnalysis(char &ID, LibCallInfo *LC)
3434
: FunctionPass(ID), LCI(LC) {
3535
}
3636
~LibCallAliasAnalysis();
@@ -55,8 +55,8 @@ namespace llvm {
5555
/// an analysis interface through multiple inheritance. If needed, it
5656
/// should override this to adjust the this pointer as needed for the
5757
/// specified pass info.
58-
virtual void *getAdjustedAnalysisPointer(const PassInfo *PI) {
59-
if (PI->isPassID(&AliasAnalysis::ID))
58+
virtual void *getAdjustedAnalysisPointer(const void *PI) {
59+
if (PI == &AliasAnalysis::ID)
6060
return (AliasAnalysis*)this;
6161
return this;
6262
}

llvm/include/llvm/Analysis/LoopDependenceAnalysis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class LoopDependenceAnalysis : public LoopPass {
9191

9292
public:
9393
static char ID; // Class identification, replacement for typeinfo
94-
LoopDependenceAnalysis() : LoopPass(&ID) {}
94+
LoopDependenceAnalysis() : LoopPass(ID) {}
9595

9696
/// isDependencePair - Check whether two values can possibly give rise to
9797
/// a data dependence: that is the case if both are instructions accessing

llvm/include/llvm/Analysis/LoopInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ class LoopInfo : public FunctionPass {
940940
public:
941941
static char ID; // Pass identification, replacement for typeid
942942

943-
LoopInfo() : FunctionPass(&ID) {}
943+
LoopInfo() : FunctionPass(ID) {}
944944

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

llvm/include/llvm/Analysis/LoopPass.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ class PMStack;
2828

2929
class LoopPass : public Pass {
3030
public:
31-
explicit LoopPass(intptr_t pid) : Pass(PT_Loop, pid) {}
32-
explicit LoopPass(void *pid) : Pass(PT_Loop, pid) {}
31+
explicit LoopPass(char &pid) : Pass(PT_Loop, pid) {}
3332

3433
/// getPrinterPass - Get a pass to print the function corresponding
3534
/// to a Loop.

llvm/include/llvm/Analysis/Passes.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ namespace llvm {
9292
// file.
9393
//
9494
ModulePass *createProfileLoaderPass();
95-
extern const PassInfo *ProfileLoaderPassID;
95+
extern char &ProfileLoaderPassID;
9696

9797
//===--------------------------------------------------------------------===//
9898
//
@@ -106,7 +106,7 @@ namespace llvm {
106106
// instead of loading it from a previous run.
107107
//
108108
FunctionPass *createProfileEstimatorPass();
109-
extern const PassInfo *ProfileEstimatorPassID;
109+
extern char &ProfileEstimatorPassID;
110110

111111
//===--------------------------------------------------------------------===//
112112
//

llvm/include/llvm/Analysis/PostDominators.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ struct PostDominatorTree : public FunctionPass {
2525
static char ID; // Pass identification, replacement for typeid
2626
DominatorTreeBase<BasicBlock>* DT;
2727

28-
PostDominatorTree() : FunctionPass(&ID) {
28+
PostDominatorTree() : FunctionPass(ID) {
2929
DT = new DominatorTreeBase<BasicBlock>(true);
3030
}
3131

@@ -106,7 +106,7 @@ template <> struct GraphTraits<PostDominatorTree*>
106106
struct PostDominanceFrontier : public DominanceFrontierBase {
107107
static char ID;
108108
PostDominanceFrontier()
109-
: DominanceFrontierBase(&ID, true) {}
109+
: DominanceFrontierBase(ID, true) {}
110110

111111
virtual bool runOnFunction(Function &) {
112112
Frontiers.clear();

llvm/include/llvm/CallGraphSCCPass.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ class CallGraphSCC;
3333

3434
class CallGraphSCCPass : public Pass {
3535
public:
36-
explicit CallGraphSCCPass(intptr_t pid) : Pass(PT_CallGraphSCC, pid) {}
37-
explicit CallGraphSCCPass(void *pid) : Pass(PT_CallGraphSCC, pid) {}
36+
explicit CallGraphSCCPass(char &pid) : Pass(PT_CallGraphSCC, pid) {}
3837

3938
/// createPrinterPass - Get a pass that prints the Module
4039
/// corresponding to a CallGraph.

llvm/include/llvm/CodeGen/CalcSpillWeights.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace llvm {
2323
public:
2424
static char ID;
2525

26-
CalculateSpillWeights() : MachineFunctionPass(&ID) {}
26+
CalculateSpillWeights() : MachineFunctionPass(ID) {}
2727

2828
virtual void getAnalysisUsage(AnalysisUsage &au) const;
2929

llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ namespace llvm {
6868

6969
public:
7070
static char ID; // Pass identification, replacement for typeid
71-
LiveIntervals() : MachineFunctionPass(&ID) {}
71+
LiveIntervals() : MachineFunctionPass(ID) {}
7272

7373
// Calculate the spill weight to assign to a single instruction.
7474
static float getSpillWeight(bool isDef, bool isUse, unsigned loopDepth);

llvm/include/llvm/CodeGen/LiveStackAnalysis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace llvm {
3939

4040
public:
4141
static char ID; // Pass identification, replacement for typeid
42-
LiveStacks() : MachineFunctionPass(&ID) {}
42+
LiveStacks() : MachineFunctionPass(ID) {}
4343

4444
typedef SS2IntervalMap::iterator iterator;
4545
typedef SS2IntervalMap::const_iterator const_iterator;

llvm/include/llvm/CodeGen/LiveVariables.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class TargetRegisterInfo;
4646
class LiveVariables : public MachineFunctionPass {
4747
public:
4848
static char ID; // Pass identification, replacement for typeid
49-
LiveVariables() : MachineFunctionPass(&ID) {}
49+
LiveVariables() : MachineFunctionPass(ID) {}
5050

5151
/// VarInfo - This represents the regions where a virtual register is live in
5252
/// the program. We represent this with three different pieces of

llvm/include/llvm/CodeGen/MachineFunctionPass.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ class MachineFunction;
3131
/// override runOnMachineFunction.
3232
class MachineFunctionPass : public FunctionPass {
3333
protected:
34-
explicit MachineFunctionPass(intptr_t ID) : FunctionPass(ID) {}
35-
explicit MachineFunctionPass(void *ID) : FunctionPass(ID) {}
34+
explicit MachineFunctionPass(char &ID) : FunctionPass(ID) {}
3635

3736
/// runOnMachineFunction - This method must be overloaded to perform the
3837
/// desired machine code transformation or analysis.

llvm/include/llvm/CodeGen/MachineLoopInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class MachineLoopInfo : public MachineFunctionPass {
6767
public:
6868
static char ID; // Pass identification, replacement for typeid
6969

70-
MachineLoopInfo() : MachineFunctionPass(&ID) {}
70+
MachineLoopInfo() : MachineFunctionPass(ID) {}
7171

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

llvm/include/llvm/CodeGen/Passes.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,42 +43,42 @@ namespace llvm {
4343

4444
/// MachineLoopInfo pass - This pass is a loop analysis pass.
4545
///
46-
extern const PassInfo *const MachineLoopInfoID;
46+
extern char &MachineLoopInfoID;
4747

4848
/// MachineDominators pass - This pass is a machine dominators analysis pass.
4949
///
50-
extern const PassInfo *const MachineDominatorsID;
50+
extern char &MachineDominatorsID;
5151

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

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

67-
extern const PassInfo *const PreAllocSplittingID;
67+
extern char &PreAllocSplittingID;
6868

6969
/// SimpleRegisterCoalescing pass. Aggressively coalesces every register
7070
/// copy it can.
7171
///
72-
extern const PassInfo *const SimpleRegisterCoalescingID;
72+
extern char &SimpleRegisterCoalescingID;
7373

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

7979
/// UnreachableMachineBlockElimination pass - This pass removes unreachable
8080
/// machine basic blocks.
81-
extern const PassInfo *const UnreachableMachineBlockElimID;
81+
extern char &UnreachableMachineBlockElimID;
8282

8383
/// DeadMachineInstructionElim pass - This pass removes dead machine
8484
/// instructions.

llvm/include/llvm/CodeGen/ProcessImplicitDefs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace llvm {
3131
public:
3232
static char ID;
3333

34-
ProcessImplicitDefs() : MachineFunctionPass(&ID) {}
34+
ProcessImplicitDefs() : MachineFunctionPass(ID) {}
3535

3636
virtual void getAnalysisUsage(AnalysisUsage &au) const;
3737

llvm/include/llvm/CodeGen/SlotIndexes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ namespace llvm {
475475
public:
476476
static char ID;
477477

478-
SlotIndexes() : MachineFunctionPass(&ID), indexListHead(0) {}
478+
SlotIndexes() : MachineFunctionPass(ID), indexListHead(0) {}
479479

480480
virtual void getAnalysisUsage(AnalysisUsage &au) const;
481481
virtual void releaseMemory();

0 commit comments

Comments
 (0)