summaryrefslogtreecommitdiff
path: root/include/llvm
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2010-08-06 00:23:35 +0000
committerOwen Anderson <resistor@mac.com>2010-08-06 00:23:35 +0000
commit1f74590e9d1b9cf0f1f81a156efea73f76546e05 (patch)
treef3b2fa6368e824b1dd3ad04e8c1c4f070b4bb4a0 /include/llvm
parentf6d6df40060eef9af19b084b2fb7a8fd627415ae (diff)
downloadllvm-1f74590e9d1b9cf0f1f81a156efea73f76546e05.tar.gz
llvm-1f74590e9d1b9cf0f1f81a156efea73f76546e05.tar.bz2
llvm-1f74590e9d1b9cf0f1f81a156efea73f76546e05.tar.xz
Revert r110396 to fix buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110410 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/Analysis/DOTGraphTraitsPass.h4
-rw-r--r--include/llvm/Analysis/Dominators.h6
-rw-r--r--include/llvm/Analysis/FindUsedTypes.h2
-rw-r--r--include/llvm/Analysis/IntervalPartition.h2
-rw-r--r--include/llvm/Analysis/LazyValueInfo.h2
-rw-r--r--include/llvm/Analysis/LibCallAliasAnalysis.h8
-rw-r--r--include/llvm/Analysis/LoopDependenceAnalysis.h2
-rw-r--r--include/llvm/Analysis/LoopInfo.h2
-rw-r--r--include/llvm/Analysis/LoopPass.h3
-rw-r--r--include/llvm/Analysis/Passes.h4
-rw-r--r--include/llvm/Analysis/PostDominators.h4
-rw-r--r--include/llvm/CallGraphSCCPass.h3
-rw-r--r--include/llvm/CodeGen/CalcSpillWeights.h2
-rw-r--r--include/llvm/CodeGen/LiveIntervalAnalysis.h2
-rw-r--r--include/llvm/CodeGen/LiveStackAnalysis.h2
-rw-r--r--include/llvm/CodeGen/LiveVariables.h2
-rw-r--r--include/llvm/CodeGen/MachineFunctionPass.h3
-rw-r--r--include/llvm/CodeGen/MachineLoopInfo.h2
-rw-r--r--include/llvm/CodeGen/Passes.h16
-rw-r--r--include/llvm/CodeGen/ProcessImplicitDefs.h2
-rw-r--r--include/llvm/CodeGen/SlotIndexes.h2
-rw-r--r--include/llvm/Pass.h42
-rw-r--r--include/llvm/PassAnalysisSupport.h47
-rw-r--r--include/llvm/PassManagers.h4
-rw-r--r--include/llvm/PassRegistry.h6
-rw-r--r--include/llvm/PassSupport.h22
-rw-r--r--include/llvm/Target/TargetData.h4
-rw-r--r--include/llvm/Transforms/IPO/InlinerPass.h4
-rw-r--r--include/llvm/Transforms/Scalar.h16
-rw-r--r--include/llvm/Transforms/Utils/SSI.h2
-rw-r--r--include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h2
31 files changed, 120 insertions, 104 deletions
diff --git a/include/llvm/Analysis/DOTGraphTraitsPass.h b/include/llvm/Analysis/DOTGraphTraitsPass.h
index d8daf5196f..4828eba5b5 100644
--- a/include/llvm/Analysis/DOTGraphTraitsPass.h
+++ b/include/llvm/Analysis/DOTGraphTraitsPass.h
@@ -22,7 +22,7 @@ template <class Analysis, bool Simple>
struct DOTGraphTraitsViewer : public FunctionPass {
std::string Name;
- DOTGraphTraitsViewer(std::string GraphName, char &ID) : FunctionPass(ID) {
+ DOTGraphTraitsViewer(std::string GraphName, const void *ID) : FunctionPass(ID) {
Name = GraphName;
}
@@ -48,7 +48,7 @@ struct DOTGraphTraitsPrinter : public FunctionPass {
std::string Name;
- DOTGraphTraitsPrinter(std::string GraphName, char &ID)
+ DOTGraphTraitsPrinter(std::string GraphName, const void *ID)
: FunctionPass(ID) {
Name = GraphName;
}
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h
index 73c6e6286b..f79afdd1e9 100644
--- a/include/llvm/Analysis/Dominators.h
+++ b/include/llvm/Analysis/Dominators.h
@@ -702,7 +702,7 @@ public:
static char ID; // Pass ID, replacement for typeid
DominatorTreeBase<BasicBlock>* DT;
- DominatorTree() : FunctionPass(ID) {
+ DominatorTree() : FunctionPass(&ID) {
DT = new DominatorTreeBase<BasicBlock>(false);
}
@@ -890,7 +890,7 @@ protected:
const bool IsPostDominators;
public:
- DominanceFrontierBase(char &ID, bool isPostDom)
+ DominanceFrontierBase(void *ID, bool isPostDom)
: FunctionPass(ID), IsPostDominators(isPostDom) {}
/// getRoots - Return the root blocks of the current CFG. This may include
@@ -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!");
diff --git a/include/llvm/Analysis/FindUsedTypes.h b/include/llvm/Analysis/FindUsedTypes.h
index 8a78eb6249..1337385848 100644
--- a/include/llvm/Analysis/FindUsedTypes.h
+++ b/include/llvm/Analysis/FindUsedTypes.h
@@ -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.
diff --git a/include/llvm/Analysis/IntervalPartition.h b/include/llvm/Analysis/IntervalPartition.h
index 75a5cdf1f9..c1214e7427 100644
--- a/include/llvm/Analysis/IntervalPartition.h
+++ b/include/llvm/Analysis/IntervalPartition.h
@@ -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);
diff --git a/include/llvm/Analysis/LazyValueInfo.h b/include/llvm/Analysis/LazyValueInfo.h
index ac164c19c9..f59b2e3532 100644
--- a/include/llvm/Analysis/LazyValueInfo.h
+++ b/include/llvm/Analysis/LazyValueInfo.h
@@ -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.
diff --git a/include/llvm/Analysis/LibCallAliasAnalysis.h b/include/llvm/Analysis/LibCallAliasAnalysis.h
index c9adf3f36a..37abb77dc2 100644
--- a/include/llvm/Analysis/LibCallAliasAnalysis.h
+++ b/include/llvm/Analysis/LibCallAliasAnalysis.h
@@ -28,9 +28,9 @@ namespace llvm {
LibCallInfo *LCI;
explicit LibCallAliasAnalysis(LibCallInfo *LC = 0)
- : FunctionPass(ID), LCI(LC) {
+ : FunctionPass(&ID), LCI(LC) {
}
- explicit LibCallAliasAnalysis(char &ID, LibCallInfo *LC)
+ explicit LibCallAliasAnalysis(const void *ID, LibCallInfo *LC)
: FunctionPass(ID), LCI(LC) {
}
~LibCallAliasAnalysis();
@@ -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 void *PI) {
- if (PI == &AliasAnalysis::ID)
+ virtual void *getAdjustedAnalysisPointer(const PassInfo *PI) {
+ if (PI->isPassID(&AliasAnalysis::ID))
return (AliasAnalysis*)this;
return this;
}
diff --git a/include/llvm/Analysis/LoopDependenceAnalysis.h b/include/llvm/Analysis/LoopDependenceAnalysis.h
index 94fd990709..a1a563796f 100644
--- a/include/llvm/Analysis/LoopDependenceAnalysis.h
+++ b/include/llvm/Analysis/LoopDependenceAnalysis.h
@@ -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
diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h
index 462620f7e3..2e90a9631f 100644
--- a/include/llvm/Analysis/LoopInfo.h
+++ b/include/llvm/Analysis/LoopInfo.h
@@ -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; }
diff --git a/include/llvm/Analysis/LoopPass.h b/include/llvm/Analysis/LoopPass.h
index 3e1c2a9418..6f77d019b6 100644
--- a/include/llvm/Analysis/LoopPass.h
+++ b/include/llvm/Analysis/LoopPass.h
@@ -28,7 +28,8 @@ class PMStack;
class LoopPass : public Pass {
public:
- explicit LoopPass(char &pid) : Pass(PT_Loop, pid) {}
+ explicit LoopPass(intptr_t pid) : Pass(PT_Loop, pid) {}
+ explicit LoopPass(void *pid) : Pass(PT_Loop, pid) {}
/// getPrinterPass - Get a pass to print the function corresponding
/// to a Loop.
diff --git a/include/llvm/Analysis/Passes.h b/include/llvm/Analysis/Passes.h
index 37425ebe83..e8e77960ad 100644
--- a/include/llvm/Analysis/Passes.h
+++ b/include/llvm/Analysis/Passes.h
@@ -92,7 +92,7 @@ namespace llvm {
// file.
//
ModulePass *createProfileLoaderPass();
- extern char &ProfileLoaderPassID;
+ extern const PassInfo *ProfileLoaderPassID;
//===--------------------------------------------------------------------===//
//
@@ -106,7 +106,7 @@ namespace llvm {
// instead of loading it from a previous run.
//
FunctionPass *createProfileEstimatorPass();
- extern char &ProfileEstimatorPassID;
+ extern const PassInfo *ProfileEstimatorPassID;
//===--------------------------------------------------------------------===//
//
diff --git a/include/llvm/Analysis/PostDominators.h b/include/llvm/Analysis/PostDominators.h
index 46ce8200f9..5552017d91 100644
--- a/include/llvm/Analysis/PostDominators.h
+++ b/include/llvm/Analysis/PostDominators.h
@@ -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);
}
@@ -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();
diff --git a/include/llvm/CallGraphSCCPass.h b/include/llvm/CallGraphSCCPass.h
index 5fa8b0e574..e11b9677c7 100644
--- a/include/llvm/CallGraphSCCPass.h
+++ b/include/llvm/CallGraphSCCPass.h
@@ -33,7 +33,8 @@ class CallGraphSCC;
class CallGraphSCCPass : public Pass {
public:
- explicit CallGraphSCCPass(char &pid) : Pass(PT_CallGraphSCC, pid) {}
+ explicit CallGraphSCCPass(intptr_t pid) : Pass(PT_CallGraphSCC, pid) {}
+ explicit CallGraphSCCPass(void *pid) : Pass(PT_CallGraphSCC, pid) {}
/// createPrinterPass - Get a pass that prints the Module
/// corresponding to a CallGraph.
diff --git a/include/llvm/CodeGen/CalcSpillWeights.h b/include/llvm/CodeGen/CalcSpillWeights.h
index e5273c5497..2fc03bd41d 100644
--- a/include/llvm/CodeGen/CalcSpillWeights.h
+++ b/include/llvm/CodeGen/CalcSpillWeights.h
@@ -23,7 +23,7 @@ namespace llvm {
public:
static char ID;
- CalculateSpillWeights() : MachineFunctionPass(ID) {}
+ CalculateSpillWeights() : MachineFunctionPass(&ID) {}
virtual void getAnalysisUsage(AnalysisUsage &au) const;
diff --git a/include/llvm/CodeGen/LiveIntervalAnalysis.h b/include/llvm/CodeGen/LiveIntervalAnalysis.h
index b154bf1b05..8a59bf1428 100644
--- a/include/llvm/CodeGen/LiveIntervalAnalysis.h
+++ b/include/llvm/CodeGen/LiveIntervalAnalysis.h
@@ -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);
diff --git a/include/llvm/CodeGen/LiveStackAnalysis.h b/include/llvm/CodeGen/LiveStackAnalysis.h
index ad984db189..c6af6a1f89 100644
--- a/include/llvm/CodeGen/LiveStackAnalysis.h
+++ b/include/llvm/CodeGen/LiveStackAnalysis.h
@@ -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;
diff --git a/include/llvm/CodeGen/LiveVariables.h b/include/llvm/CodeGen/LiveVariables.h
index c8182e073b..fc5ea6f968 100644
--- a/include/llvm/CodeGen/LiveVariables.h
+++ b/include/llvm/CodeGen/LiveVariables.h
@@ -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
diff --git a/include/llvm/CodeGen/MachineFunctionPass.h b/include/llvm/CodeGen/MachineFunctionPass.h
index b7bf0a36c4..685e86824c 100644
--- a/include/llvm/CodeGen/MachineFunctionPass.h
+++ b/include/llvm/CodeGen/MachineFunctionPass.h
@@ -31,7 +31,8 @@ class MachineFunction;
/// override runOnMachineFunction.
class MachineFunctionPass : public FunctionPass {
protected:
- explicit MachineFunctionPass(char &ID) : FunctionPass(ID) {}
+ explicit MachineFunctionPass(intptr_t ID) : FunctionPass(ID) {}
+ explicit MachineFunctionPass(void *ID) : FunctionPass(ID) {}
/// runOnMachineFunction - This method must be overloaded to perform the
/// desired machine code transformation or analysis.
diff --git a/include/llvm/CodeGen/MachineLoopInfo.h b/include/llvm/CodeGen/MachineLoopInfo.h
index 9760eba7b8..3b3e31e02a 100644
--- a/include/llvm/CodeGen/MachineLoopInfo.h
+++ b/include/llvm/CodeGen/MachineLoopInfo.h
@@ -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; }
diff --git a/include/llvm/CodeGen/Passes.h b/include/llvm/CodeGen/Passes.h
index 5c14853662..c881d74c11 100644
--- a/include/llvm/CodeGen/Passes.h
+++ b/include/llvm/CodeGen/Passes.h
@@ -43,18 +43,18 @@ namespace llvm {
/// MachineLoopInfo pass - This pass is a loop analysis pass.
///
- extern char &MachineLoopInfoID;
+ extern const PassInfo *const MachineLoopInfoID;
/// MachineDominators pass - This pass is a machine dominators analysis pass.
///
- extern char &MachineDominatorsID;
+ extern const PassInfo *const 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 char &PHIEliminationID;
+ extern const PassInfo *const PHIEliminationID;
/// StrongPHIElimination pass - This pass eliminates machine instruction PHI
/// nodes by inserting copy instructions. This destroys SSA information, but
@@ -62,23 +62,23 @@ namespace llvm {
/// "required" by these register allocator like this:
/// AU.addRequiredID(PHIEliminationID);
/// This pass is still in development
- extern char &StrongPHIEliminationID;
+ extern const PassInfo *const StrongPHIEliminationID;
- extern char &PreAllocSplittingID;
+ extern const PassInfo *const PreAllocSplittingID;
/// SimpleRegisterCoalescing pass. Aggressively coalesces every register
/// copy it can.
///
- extern char &SimpleRegisterCoalescingID;
+ extern const PassInfo *const 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 char &TwoAddressInstructionPassID;
+ extern const PassInfo *const TwoAddressInstructionPassID;
/// UnreachableMachineBlockElimination pass - This pass removes unreachable
/// machine basic blocks.
- extern char &UnreachableMachineBlockElimID;
+ extern const PassInfo *const UnreachableMachineBlockElimID;
/// DeadMachineInstructionElim pass - This pass removes dead machine
/// instructions.
diff --git a/include/llvm/CodeGen/ProcessImplicitDefs.h b/include/llvm/CodeGen/ProcessImplicitDefs.h
index 1d743c1cba..30477b9b80 100644
--- a/include/llvm/CodeGen/ProcessImplicitDefs.h
+++ b/include/llvm/CodeGen/ProcessImplicitDefs.h
@@ -31,7 +31,7 @@ namespace llvm {
public:
static char ID;
- ProcessImplicitDefs() : MachineFunctionPass(ID) {}
+ ProcessImplicitDefs() : MachineFunctionPass(&ID) {}
virtual void getAnalysisUsage(AnalysisUsage &au) const;
diff --git a/include/llvm/CodeGen/SlotIndexes.h b/include/llvm/CodeGen/SlotIndexes.h
index fe3b0e2d5f..f150d853fc 100644
--- a/include/llvm/CodeGen/SlotIndexes.h
+++ b/include/llvm/CodeGen/SlotIndexes.h
@@ -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();
diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h
index e5c073cd94..5a5893140e 100644
--- a/include/llvm/Pass.h
+++ b/include/llvm/Pass.h
@@ -50,7 +50,7 @@ class raw_ostream;
class StringRef;
// AnalysisID - Use the PassInfo to identify a pass...
-typedef const void* AnalysisID;
+typedef const PassInfo* AnalysisID;
/// Different types of internal pass managers. External pass managers
/// (PassManager and FunctionPassManager) are not represented here.
@@ -82,13 +82,14 @@ enum PassKind {
///
class Pass {
AnalysisResolver *Resolver; // Used to resolve analysis
- const void *PassID;
+ intptr_t PassID;
PassKind Kind;
void operator=(const Pass&); // DO NOT IMPLEMENT
Pass(const Pass &); // DO NOT IMPLEMENT
public:
- explicit Pass(PassKind K, char &pid);
+ explicit Pass(PassKind K, intptr_t pid);
+ explicit Pass(PassKind K, const void *pid);
virtual ~Pass();
@@ -100,10 +101,10 @@ public:
///
virtual const char *getPassName() const;
- /// getPassID - Return the PassID number that corresponds to this pass.
- virtual AnalysisID getPassID() const {
- return PassID;
- }
+ /// getPassInfo - Return the PassInfo data structure that corresponds to this
+ /// pass... If the pass has not been registered, this will return null.
+ ///
+ const PassInfo *getPassInfo() const;
/// print - Print out the internal state of the pass. This is called by
/// Analyze to print out the contents of an analysis. Otherwise it is not
@@ -158,7 +159,7 @@ public:
/// 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(AnalysisID ID);
+ virtual void *getAdjustedAnalysisPointer(const PassInfo *);
virtual ImmutablePass *getAsImmutablePass();
virtual PMDataManager *getAsPMDataManager();
@@ -169,9 +170,14 @@ public:
// dumpPassStructure - Implement the -debug-passes=PassStructure option
virtual void dumpPassStructure(unsigned Offset = 0);
+ template<typename AnalysisClass>
+ static const PassInfo *getClassPassInfo() {
+ return lookupPassInfo(intptr_t(&AnalysisClass::ID));
+ }
+
// lookupPassInfo - Return the pass info object for the specified pass class,
// or null if it is not known.
- static const PassInfo *lookupPassInfo(const void *TI);
+ static const PassInfo *lookupPassInfo(intptr_t TI);
// lookupPassInfo - Return the pass info object for the pass with the given
// argument string, or null if it is not known.
@@ -194,7 +200,7 @@ public:
/// don't have the class name available (use getAnalysisIfAvailable if you
/// do), but it can tell you if you need to preserve the pass at least.
///
- bool mustPreserveAnalysisID(char &AID) const;
+ bool mustPreserveAnalysisID(const PassInfo *AnalysisID) const;
/// getAnalysis<AnalysisType>() - This function is used by subclasses to get
/// to the analysis information that they claim to use by overriding the
@@ -207,10 +213,10 @@ public:
AnalysisType &getAnalysis(Function &F); // Defined in PassAnalysisSupport.h
template<typename AnalysisType>
- AnalysisType &getAnalysisID(AnalysisID PI) const;
+ AnalysisType &getAnalysisID(const PassInfo *PI) const;
template<typename AnalysisType>
- AnalysisType &getAnalysisID(AnalysisID PI, Function &F);
+ AnalysisType &getAnalysisID(const PassInfo *PI, Function &F);
};
@@ -234,7 +240,8 @@ public:
/// Return what kind of Pass Manager can manage this pass.
virtual PassManagerType getPotentialPassManagerType() const;
- explicit ModulePass(char &pid) : Pass(PT_Module, pid) {}
+ explicit ModulePass(intptr_t pid) : Pass(PT_Module, pid) {}
+ explicit ModulePass(const void *pid) : Pass(PT_Module, pid) {}
// Force out-of-line virtual method.
virtual ~ModulePass();
};
@@ -261,7 +268,8 @@ public:
///
bool runOnModule(Module &) { return false; }
- explicit ImmutablePass(char &pid)
+ explicit ImmutablePass(intptr_t pid) : ModulePass(pid) {}
+ explicit ImmutablePass(const void *pid)
: ModulePass(pid) {}
// Force out-of-line virtual method.
@@ -279,7 +287,8 @@ public:
///
class FunctionPass : public Pass {
public:
- explicit FunctionPass(char &pid) : Pass(PT_Function, pid) {}
+ explicit FunctionPass(intptr_t pid) : Pass(PT_Function, pid) {}
+ explicit FunctionPass(const void *pid) : Pass(PT_Function, pid) {}
/// createPrinterPass - Get a function printer pass.
Pass *createPrinterPass(raw_ostream &O, const std::string &Banner) const;
@@ -331,7 +340,8 @@ public:
///
class BasicBlockPass : public Pass {
public:
- explicit BasicBlockPass(char &pid) : Pass(PT_BasicBlock, pid) {}
+ explicit BasicBlockPass(intptr_t pid) : Pass(PT_BasicBlock, pid) {}
+ explicit BasicBlockPass(const void *pid) : Pass(PT_BasicBlock, pid) {}
/// createPrinterPass - Get a function printer pass.
Pass *createPrinterPass(raw_ostream &O, const std::string &Banner) const;
diff --git a/include/llvm/PassAnalysisSupport.h b/include/llvm/PassAnalysisSupport.h
index a99a1ae871..977d4f4e30 100644
--- a/include/llvm/PassAnalysisSupport.h
+++ b/include/llvm/PassAnalysisSupport.h
@@ -49,37 +49,34 @@ public:
// addRequired - Add the specified ID to the required set of the usage info
// for a pass.
//
- AnalysisUsage &addRequiredID(const void *ID);
- AnalysisUsage &addRequiredID(char &ID);
+ AnalysisUsage &addRequiredID(AnalysisID ID);
template<class PassClass>
AnalysisUsage &addRequired() {
- return addRequiredID(PassClass::ID);
+ return addRequiredID(Pass::getClassPassInfo<PassClass>());
}
- AnalysisUsage &addRequiredTransitiveID(char &ID);
+ AnalysisUsage &addRequiredTransitiveID(AnalysisID ID);
template<class PassClass>
AnalysisUsage &addRequiredTransitive() {
- return addRequiredTransitiveID(PassClass::ID);
+ AnalysisID ID = Pass::getClassPassInfo<PassClass>();
+ return addRequiredTransitiveID(ID);
}
// addPreserved - Add the specified ID to the set of analyses preserved by
// this pass
//
- AnalysisUsage &addPreservedID(const void *ID) {
+ AnalysisUsage &addPreservedID(AnalysisID ID) {
Preserved.push_back(ID);
return *this;
}
- AnalysisUsage &addPreservedID(char &ID) {
- Preserved.push_back(&ID);
- return *this;
- }
// addPreserved - Add the specified Pass class to the set of analyses
// preserved by this pass.
//
template<class PassClass>
AnalysisUsage &addPreserved() {
- Preserved.push_back(&PassClass::ID);
+ assert(Pass::getClassPassInfo<PassClass>() && "Pass class not registered!");
+ Preserved.push_back(Pass::getClassPassInfo<PassClass>());
return *this;
}
@@ -88,7 +85,12 @@ public:
// This can be useful when a pass is trivially preserved, but may not be
// linked in. Be careful about spelling!
//
- AnalysisUsage &addPreserved(StringRef Arg);
+ AnalysisUsage &addPreserved(StringRef Arg) {
+ const PassInfo *PI = Pass::lookupPassInfo(Arg);
+ // If the pass exists, preserve it. Otherwise silently do nothing.
+ if (PI) Preserved.push_back(PI);
+ return *this;
+ }
// setPreservesAll - Set by analyses that do not transform their input at all
void setPreservesAll() { PreservesAll = true; }
@@ -128,7 +130,7 @@ public:
inline PMDataManager &getPMDataManager() { return PM; }
// Find pass that is implementing PI.
- Pass *findImplPass(AnalysisID PI) {
+ Pass *findImplPass(const PassInfo *PI) {
Pass *ResultPass = 0;
for (unsigned i = 0; i < AnalysisImpls.size() ; ++i) {
if (AnalysisImpls[i].first == PI) {
@@ -140,10 +142,10 @@ public:
}
// Find pass that is implementing PI. Initialize pass for Function F.
- Pass *findImplPass(Pass *P, AnalysisID PI, Function &F);
+ Pass *findImplPass(Pass *P, const PassInfo *PI, Function &F);
- void addAnalysisImplsPair(AnalysisID PI, Pass *P) {
- std::pair<AnalysisID, Pass*> pir = std::make_pair(PI,P);
+ void addAnalysisImplsPair(const PassInfo *PI, Pass *P) {
+ std::pair<const PassInfo*, Pass*> pir = std::make_pair(PI,P);
AnalysisImpls.push_back(pir);
}
@@ -158,7 +160,7 @@ public:
// AnalysisImpls - This keeps track of which passes implements the interfaces
// that are required by the current pass (to implement getAnalysis()).
- std::vector<std::pair<AnalysisID, Pass*> > AnalysisImpls;
+ std::vector<std::pair<const PassInfo*, Pass*> > AnalysisImpls;
private:
// PassManager that is used to resolve analysis info
@@ -177,7 +179,8 @@ template<typename AnalysisType>
AnalysisType *Pass::getAnalysisIfAvailable() const {
assert(Resolver && "Pass not resident in a PassManager object!");
- const void *PI = &AnalysisType::ID;
+ const PassInfo *PI = getClassPassInfo<AnalysisType>();
+ if (PI == 0) return 0;
Pass *ResultPass = Resolver->getAnalysisIfAvailable(PI, true);
if (ResultPass == 0) return 0;
@@ -196,11 +199,11 @@ AnalysisType *Pass::getAnalysisIfAvailable() const {
template<typename AnalysisType>
AnalysisType &Pass::getAnalysis() const {
assert(Resolver && "Pass has not been inserted into a PassManager object!");
- return getAnalysisID<AnalysisType>(&AnalysisType::ID);
+ return getAnalysisID<AnalysisType>(getClassPassInfo<AnalysisType>());
}
template<typename AnalysisType>
-AnalysisType &Pass::getAnalysisID(AnalysisID PI) const {
+AnalysisType &Pass::getAnalysisID(const PassInfo *PI) const {
assert(PI && "getAnalysis for unregistered pass!");
assert(Resolver&&"Pass has not been inserted into a PassManager object!");
// PI *must* appear in AnalysisImpls. Because the number of passes used
@@ -226,11 +229,11 @@ template<typename AnalysisType>
AnalysisType &Pass::getAnalysis(Function &F) {
assert(Resolver &&"Pass has not been inserted into a PassManager object!");
- return getAnalysisID<AnalysisType>(&AnalysisType::ID, F);
+ return getAnalysisID<AnalysisType>(getClassPassInfo<AnalysisType>(), F);
}
template<typename AnalysisType>
-AnalysisType &Pass::getAnalysisID(AnalysisID PI, Function &F) {
+AnalysisType &Pass::getAnalysisID(const PassInfo *PI, Function &F) {
assert(PI && "getAnalysis for unregistered pass!");
assert(Resolver && "Pass has not been inserted into a PassManager object!");
// PI *must* appear in AnalysisImpls. Because the number of passes used
diff --git a/include/llvm/PassManagers.h b/include/llvm/PassManagers.h
index 1f9b9821d5..81b7e7af81 100644
--- a/include/llvm/PassManagers.h
+++ b/include/llvm/PassManagers.h
@@ -302,7 +302,7 @@ public:
/// through getAnalysis interface.
virtual void addLowerLevelRequiredPass(Pass *P, Pass *RequiredPass);
- virtual Pass *getOnTheFlyPass(Pass *P, AnalysisID PI, Function &F);
+ virtual Pass *getOnTheFlyPass(Pass *P, const PassInfo *PI, Function &F);
/// Initialize available analysis information.
void initializeAnalysisInfo() {
@@ -414,7 +414,7 @@ class FPPassManager : public ModulePass, public PMDataManager {
public:
static char ID;
explicit FPPassManager(int Depth)
- : ModulePass(ID), PMDataManager(Depth) { }
+ : ModulePass(&ID), PMDataManager(Depth) { }
/// run - Execute all of the passes scheduled for execution. Keep track of
/// whether any of the passes modifies the module, and if so, return true.
diff --git a/include/llvm/PassRegistry.h b/include/llvm/PassRegistry.h
index 5907139152..193ecfd1b5 100644
--- a/include/llvm/PassRegistry.h
+++ b/include/llvm/PassRegistry.h
@@ -34,7 +34,7 @@ class PassRegistry {
mutable sys::SmartMutex<true> Lock;
/// PassInfoMap - Keep track of the PassInfo object for each registered pass.
- typedef std::map<const void*, const PassInfo*> MapType;
+ typedef std::map<intptr_t, const PassInfo*> MapType;
MapType PassInfoMap;
typedef StringMap<const PassInfo*> StringMapType;
@@ -51,14 +51,14 @@ class PassRegistry {
public:
static PassRegistry *getPassRegistry();
- const PassInfo *getPassInfo(const void *TI) const;
+ const PassInfo *getPassInfo(intptr_t TI) const;
const PassInfo *getPassInfo(StringRef Arg) const;
void registerPass(const PassInfo &PI);
void unregisterPass(const PassInfo &PI);
/// Analysis Group Mechanisms.
- void registerAnalysisGroup(const void *InterfaceID, const void *PassID,
+ void registerAnalysisGroup(intptr_t InterfaceID, intptr_t PassID,
PassInfo& Registeree, bool isDefault);
void enumerateWith(PassRegistrationListener *L);
diff --git a/include/llvm/PassSupport.h b/include/llvm/PassSupport.h
index ee98713172..07dc7f1d15 100644
--- a/include/llvm/PassSupport.h
+++ b/include/llvm/PassSupport.h
@@ -41,7 +41,7 @@ public:
private:
const char *const PassName; // Nice name for Pass
const char *const PassArgument; // Command Line argument to run this pass
- const void *PassID;
+ const intptr_t PassID;
const bool IsCFGOnlyPass; // Pass only looks at the CFG.
const bool IsAnalysis; // True if an analysis pass.
const bool IsAnalysisGroup; // True if an analysis group.
@@ -52,7 +52,7 @@ private:
public:
/// PassInfo ctor - Do not call this directly, this should only be invoked
/// through RegisterPass.
- PassInfo(const char *name, const char *arg, const void *pi,
+ PassInfo(const char *name, const char *arg, intptr_t pi,
NormalCtor_t normal = 0,
bool isCFGOnly = false, bool is_analysis = false)
: PassName(name), PassArgument(arg), PassID(pi),
@@ -63,7 +63,7 @@ public:
/// PassInfo ctor - Do not call this directly, this should only be invoked
/// through RegisterPass. This version is for use by analysis groups; it
/// does not auto-register the pass.
- PassInfo(const char *name, const void *pi)
+ PassInfo(const char *name, intptr_t pi)
: PassName(name), PassArgument(""), PassID(pi),
IsCFGOnlyPass(false),
IsAnalysis(false), IsAnalysisGroup(true), NormalCtor(0) {
@@ -81,11 +81,11 @@ public:
/// getTypeInfo - Return the id object for the pass...
/// TODO : Rename
- const void *getTypeInfo() const { return PassID; }
+ intptr_t getTypeInfo() const { return PassID; }
/// Return true if this PassID implements the specified ID pointer.
- bool isPassID(const void *IDPtr) const {
- return PassID == IDPtr;
+ bool isPassID(void *IDPtr) const {
+ return PassID == (intptr_t)IDPtr;
}
/// isAnalysisGroup - Return true if this is an analysis group, not a normal
@@ -161,7 +161,7 @@ struct RegisterPass : public PassInfo {
// Register Pass using default constructor...
RegisterPass(const char *PassArg, const char *Name, bool CFGOnly = false,
bool is_analysis = false)
- : PassInfo(Name, PassArg, &passName::ID,
+ : PassInfo(Name, PassArg, intptr_t(&passName::ID),
PassInfo::NormalCtor_t(callDefaultCtor<passName>),
CFGOnly, is_analysis) {
@@ -191,8 +191,8 @@ struct RegisterPass : public PassInfo {
class RegisterAGBase : public PassInfo {
protected:
RegisterAGBase(const char *Name,
- const void *InterfaceID,
- const void *PassID = 0,
+ intptr_t InterfaceID,
+ intptr_t PassID = 0,
bool isDefault = false);
};
@@ -200,12 +200,12 @@ template<typename Interface, bool Default = false>
struct RegisterAnalysisGroup : public RegisterAGBase {
explicit RegisterAnalysisGroup(PassInfo &RPB)
: RegisterAGBase(RPB.getPassName(),
- &Interface::ID, RPB.getTypeInfo(),
+ intptr_t(&Interface::ID), RPB.getTypeInfo(),
Default) {
}
explicit RegisterAnalysisGroup(const char *Name)
- : RegisterAGBase(Name, &Interface::ID) {
+ : RegisterAGBase(Name, intptr_t(&Interface::ID)) {
}
};
diff --git a/include/llvm/Target/TargetData.h b/include/llvm/Target/TargetData.h
index f72461f803..cc88dae9fa 100644
--- a/include/llvm/Target/TargetData.h
+++ b/include/llvm/Target/TargetData.h
@@ -110,7 +110,7 @@ public:
/// Constructs a TargetData from a specification string. See init().
explicit TargetData(StringRef TargetDescription)
- : ImmutablePass(ID) {
+ : ImmutablePass(&ID) {
init(TargetDescription);
}
@@ -118,7 +118,7 @@ public:
explicit TargetData(const Module *M);
TargetData(const TargetData &TD) :
- ImmutablePass(ID),
+ ImmutablePass(&ID),
LittleEndian(TD.isLittleEndian()),
PointerMemSize(TD.PointerMemSize),
PointerABIAlign(TD.PointerABIAlign),
diff --git a/include/llvm/Transforms/IPO/InlinerPass.h b/include/llvm/Transforms/IPO/InlinerPass.h
index 3ac4c591c9..6af7ed7bdb 100644
--- a/include/llvm/Transforms/IPO/InlinerPass.h
+++ b/include/llvm/Transforms/IPO/InlinerPass.h
@@ -30,8 +30,8 @@ namespace llvm {
/// perform the inlining operations that do not depend on the policy.
///
struct Inliner : public CallGraphSCCPass {
- explicit Inliner(char &ID);
- explicit Inliner(char &ID, int Threshold);
+ explicit Inliner(void *ID);
+ explicit Inliner(void *ID, int Threshold);
/// getAnalysisUsage - For this class, we declare that we require and preserve
/// the call graph. If the derived class implements this method, it should
diff --git a/include/llvm/Transforms/Scalar.h b/include/llvm/Transforms/Scalar.h
index bd5b16999f..4d1d8636f6 100644
--- a/include/llvm/Transforms/Scalar.h
+++ b/include/llvm/Transforms/Scalar.h
@@ -149,7 +149,7 @@ Pass *createLoopIndexSplitPass();
// ret i32 %Y
//
FunctionPass *createPromoteMemoryToRegisterPass();
-extern char &PromoteMemoryToRegisterID;
+extern const PassInfo *const PromoteMemoryToRegisterID;
//===----------------------------------------------------------------------===//
//
@@ -158,7 +158,7 @@ extern char &PromoteMemoryToRegisterID;
// hacking easier.
//
FunctionPass *createDemoteRegisterToMemoryPass();
-extern char &DemoteRegisterToMemoryID;
+extern const PassInfo *const DemoteRegisterToMemoryID;
//===----------------------------------------------------------------------===//
//
@@ -202,7 +202,7 @@ FunctionPass *createCFGSimplificationPass();
// (set, immediate dominators, tree, and frontier) information.
//
FunctionPass *createBreakCriticalEdgesPass();
-extern char &BreakCriticalEdgesID;
+extern const PassInfo *const BreakCriticalEdgesID;
//===----------------------------------------------------------------------===//
//
@@ -213,7 +213,7 @@ extern char &BreakCriticalEdgesID;
// AU.addRequiredID(LoopSimplifyID);
//
Pass *createLoopSimplifyPass();
-extern char &LoopSimplifyID;
+extern const PassInfo *const LoopSimplifyID;
//===----------------------------------------------------------------------===//
//
@@ -228,7 +228,7 @@ FunctionPass *createTailCallEliminationPass();
// chained binary branch instructions.
//
FunctionPass *createLowerSwitchPass();
-extern char &LowerSwitchID;
+extern const PassInfo *const LowerSwitchID;
//===----------------------------------------------------------------------===//
//
@@ -243,7 +243,7 @@ extern char &LowerSwitchID;
FunctionPass *createLowerInvokePass(const TargetLowering *TLI = 0);
FunctionPass *createLowerInvokePass(const TargetLowering *TLI,
bool useExpensiveEHSupport);
-extern char &LowerInvokePassID;
+extern const PassInfo *const LowerInvokePassID;
//===----------------------------------------------------------------------===//
//
@@ -258,7 +258,7 @@ FunctionPass *createBlockPlacementPass();
// optimizations.
//
Pass *createLCSSAPass();
-extern char &LCSSAID;
+extern const PassInfo *const LCSSAID;
//===----------------------------------------------------------------------===//
//
@@ -304,7 +304,7 @@ FunctionPass *createCodeGenPreparePass(const TargetLowering *TLI = 0);
// InstructionNamer - Give any unnamed non-void instructions "tmp" names.
//
FunctionPass *createInstructionNamerPass();
-extern char &InstructionNamerID;
+extern const PassInfo *const InstructionNamerID;
//===----------------------------------------------------------------------===//
//
diff --git a/include/llvm/Transforms/Utils/SSI.h b/include/llvm/Transforms/Utils/SSI.h
index 864e1197a9..198fc827bb 100644
--- a/include/llvm/Transforms/Utils/SSI.h
+++ b/include/llvm/Transforms/Utils/SSI.h
@@ -39,7 +39,7 @@ namespace llvm {
public:
static char ID; // Pass identification, replacement for typeid.
SSI() :
- FunctionPass(ID) {
+ FunctionPass(&ID) {
}
void getAnalysisUsage(AnalysisUsage &AU) const;
diff --git a/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h b/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h
index a5060e6f58..c2d09935e7 100644
--- a/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h
+++ b/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h
@@ -26,7 +26,7 @@ struct UnifyFunctionExitNodes : public FunctionPass {
BasicBlock *ReturnBlock, *UnwindBlock, *UnreachableBlock;
public:
static char ID; // Pass identification, replacement for typeid
- UnifyFunctionExitNodes() : FunctionPass(ID),
+ UnifyFunctionExitNodes() : FunctionPass(&ID),
ReturnBlock(0), UnwindBlock(0) {}
// We can preserve non-critical-edgeness when we unify function exit nodes