[llvm-commits] CVS: llvm/include/llvm/CallGraphSCCPass.h Pass.h PassManagers.h PassSupport.h
Devang Patel
dpatel at apple.com
Tue May 1 14:17:58 PDT 2007
Changes in directory llvm/include/llvm:
CallGraphSCCPass.h updated: 1.12 -> 1.13
Pass.h updated: 1.86 -> 1.87
PassManagers.h updated: 1.16 -> 1.17
PassSupport.h updated: 1.38 -> 1.39
---
Log message:
Do not use typeinfo to identify pass in pass manager.
---
Diffs of the changes: (+29 -19)
CallGraphSCCPass.h | 2 ++
Pass.h | 16 +++++++++++-----
PassManagers.h | 4 +++-
PassSupport.h | 26 +++++++++++++-------------
4 files changed, 29 insertions(+), 19 deletions(-)
Index: llvm/include/llvm/CallGraphSCCPass.h
diff -u llvm/include/llvm/CallGraphSCCPass.h:1.12 llvm/include/llvm/CallGraphSCCPass.h:1.13
--- llvm/include/llvm/CallGraphSCCPass.h:1.12 Mon Apr 16 13:51:25 2007
+++ llvm/include/llvm/CallGraphSCCPass.h Tue May 1 16:15:46 2007
@@ -31,6 +31,8 @@
struct CallGraphSCCPass : public Pass {
+ CallGraphSCCPass(intptr_t pid) : Pass(pid) {}
+
/// doInitialization - This method is called before the SCC's of the program
/// has been processed, allowing the pass to do initialization as necessary.
virtual bool doInitialization(CallGraph &CG) {
Index: llvm/include/llvm/Pass.h
diff -u llvm/include/llvm/Pass.h:1.86 llvm/include/llvm/Pass.h:1.87
--- llvm/include/llvm/Pass.h:1.86 Thu Apr 26 16:33:41 2007
+++ llvm/include/llvm/Pass.h Tue May 1 16:15:46 2007
@@ -34,8 +34,8 @@
#include <deque>
#include <map>
#include <iosfwd>
-#include <typeinfo>
#include <cassert>
+#include <stdint.h>
namespace llvm {
@@ -77,7 +77,7 @@
///
class Pass {
AnalysisResolver *Resolver; // Used to resolve analysis
- const PassInfo *PassInfoCache;
+ intptr_t PassID;
// AnalysisImpls - This keeps track of which passes implement the interfaces
// that are required by the current pass (to implement getAnalysis()).
@@ -87,7 +87,7 @@
void operator=(const Pass&); // DO NOT IMPLEMENT
Pass(const Pass &); // DO NOT IMPLEMENT
public:
- Pass() : Resolver(0), PassInfoCache(0) {}
+ Pass(intptr_t pid) : Resolver(0), PassID(pid) {}
virtual ~Pass();
/// getPassName - Return a nice clean name for a pass. This usually
@@ -163,12 +163,12 @@
template<typename AnalysisClass>
static const PassInfo *getClassPassInfo() {
- return lookupPassInfo(typeid(AnalysisClass));
+ 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 std::type_info &TI);
+ static const PassInfo *lookupPassInfo(intptr_t TI);
/// getAnalysisToUpdate<AnalysisType>() - This function is used by subclasses
/// to get to the analysis information that might be around that needs to be
@@ -232,6 +232,7 @@
return PMT_ModulePassManager;
}
+ ModulePass(intptr_t pid) : Pass(pid) {}
// Force out-of-line virtual method.
virtual ~ModulePass();
};
@@ -256,6 +257,7 @@
///
virtual bool runOnModule(Module &M) { return false; }
+ ImmutablePass(intptr_t pid) : ModulePass(pid) {}
// Force out-of-line virtual method.
virtual ~ImmutablePass();
};
@@ -271,6 +273,8 @@
///
class FunctionPass : public Pass {
public:
+ FunctionPass(intptr_t pid) : Pass(pid) {}
+
/// doInitialization - Virtual method overridden by subclasses to do
/// any necessary per-module initialization.
///
@@ -320,6 +324,8 @@
///
class BasicBlockPass : public Pass {
public:
+ BasicBlockPass(intptr_t pid) : Pass(pid) {}
+
/// doInitialization - Virtual method overridden by subclasses to do
/// any necessary per-module initialization.
///
Index: llvm/include/llvm/PassManagers.h
diff -u llvm/include/llvm/PassManagers.h:1.16 llvm/include/llvm/PassManagers.h:1.17
--- llvm/include/llvm/PassManagers.h:1.16 Mon Apr 16 15:12:57 2007
+++ llvm/include/llvm/PassManagers.h Tue May 1 16:15:46 2007
@@ -336,7 +336,9 @@
class FPPassManager : public ModulePass, public PMDataManager {
public:
- explicit FPPassManager(int Depth) : PMDataManager(Depth) { }
+ static const int ID;
+ explicit FPPassManager(int Depth)
+ : ModulePass((intptr_t)&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.
Index: llvm/include/llvm/PassSupport.h
diff -u llvm/include/llvm/PassSupport.h:1.38 llvm/include/llvm/PassSupport.h:1.39
--- llvm/include/llvm/PassSupport.h:1.38 Mon Apr 16 13:10:22 2007
+++ llvm/include/llvm/PassSupport.h Tue May 1 16:15:46 2007
@@ -37,19 +37,19 @@
class PassInfo {
const char *PassName; // Nice name for Pass
const char *PassArgument; // Command Line argument to run this pass
- const std::type_info &TypeInfo; // type_info object for this Pass class
+ intptr_t PassID;
bool IsCFGOnlyPass; // Pass only looks at the CFG.
bool IsAnalysisGroup; // True if an analysis group.
std::vector<const PassInfo*> ItfImpl;// Interfaces implemented by this pass
- Pass *(*NormalCtor)(); // No argument ctor
+ Pass *(*NormalCtor)();
public:
/// PassInfo ctor - Do not call this directly, this should only be invoked
/// through RegisterPass.
- PassInfo(const char *name, const char *arg, const std::type_info &ti,
+ PassInfo(const char *name, const char *arg, intptr_t pi,
Pass *(*normal)() = 0, bool isCFGOnly = false)
- : PassName(name), PassArgument(arg), TypeInfo(ti),
+ : PassName(name), PassArgument(arg), PassID(pi),
IsCFGOnlyPass(isCFGOnly), IsAnalysisGroup(false), NormalCtor(normal) {
}
@@ -65,8 +65,8 @@
const char *getPassArgument() const { return PassArgument; }
/// getTypeInfo - Return the type_info object for the pass...
- ///
- const std::type_info &getTypeInfo() const { return TypeInfo; }
+ /// TODO : Rename
+ intptr_t getTypeInfo() const { return PassID; }
/// isAnalysisGroup - Return true if this is an analysis group, not a normal
/// pass.
@@ -139,12 +139,12 @@
typedef Pass* (*NormalCtor_t)();
- RegisterPassBase(const char *Name, const char *Arg, const std::type_info &TI,
+ RegisterPassBase(const char *Name, const char *Arg, intptr_t TI,
NormalCtor_t NormalCtor = 0, bool CFGOnly = false)
: PIObj(Name, Arg, TI, NormalCtor, CFGOnly) {
registerPass();
}
- RegisterPassBase(const std::type_info &TI)
+ RegisterPassBase(intptr_t TI)
: PIObj("", "", TI) {
// This ctor may only be used for analysis groups: it does not auto-register
// the pass.
@@ -165,7 +165,7 @@
// Register Pass using default constructor...
RegisterPass(const char *PassArg, const char *Name, bool CFGOnly = false)
- : RegisterPassBase(Name, PassArg, typeid(PassName),
+ : RegisterPassBase(Name, PassArg, (intptr_t)&PassName::ID,
(RegisterPassBase::NormalCtor_t)callDefaultCtor<PassName>, CFGOnly) {
}
};
@@ -195,8 +195,8 @@
const PassInfo *ImplementationInfo;
bool isDefaultImplementation;
protected:
- explicit RegisterAGBase(const std::type_info &Interface,
- const std::type_info *Pass = 0,
+ explicit RegisterAGBase(intptr_t InterfaceID,
+ intptr_t PassID = 0,
bool isDefault = false);
void setGroupName(const char *Name);
};
@@ -204,12 +204,12 @@
template<typename Interface, bool Default = false>
struct RegisterAnalysisGroup : public RegisterAGBase {
explicit RegisterAnalysisGroup(RegisterPassBase &RPB)
- : RegisterAGBase(typeid(Interface), &RPB.getPassInfo()->getTypeInfo(),
+ : RegisterAGBase((intptr_t) &Interface::ID, RPB.getPassInfo()->getTypeInfo(),
Default) {
}
explicit RegisterAnalysisGroup(const char *Name)
- : RegisterAGBase(typeid(Interface)) {
+ : RegisterAGBase((intptr_t) &Interface::ID) {
setGroupName(Name);
}
};
More information about the llvm-commits
mailing list