summaryrefslogtreecommitdiff
path: root/include/llvm/PassSupport.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-07-30 03:55:01 +0000
committerChris Lattner <sabre@nondot.org>2002-07-30 03:55:01 +0000
commit5d1cf5b4ebff14861745e1216ea9095ea8e6bf71 (patch)
tree78975f102019159f9ec7bd3122e433424306e957 /include/llvm/PassSupport.h
parent67fcce2b1968494d776f79413c216777c3f30d7e (diff)
downloadllvm-5d1cf5b4ebff14861745e1216ea9095ea8e6bf71.tar.gz
llvm-5d1cf5b4ebff14861745e1216ea9095ea8e6bf71.tar.bz2
llvm-5d1cf5b4ebff14861745e1216ea9095ea8e6bf71.tar.xz
Add rough support for LLC passes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3144 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/PassSupport.h')
-rw-r--r--include/llvm/PassSupport.h37
1 files changed, 35 insertions, 2 deletions
diff --git a/include/llvm/PassSupport.h b/include/llvm/PassSupport.h
index f9360b7f08..aad2ee6998 100644
--- a/include/llvm/PassSupport.h
+++ b/include/llvm/PassSupport.h
@@ -18,6 +18,7 @@
#include <typeinfo>
class TargetData;
+class TargetMachine;
//===---------------------------------------------------------------------------
// PassInfo class - An instance of this class exists for every pass known by the
@@ -40,7 +41,7 @@ public:
// many of these flags or'd together.
//
enum {
- Analysis = 1, Optimization = 2
+ Analysis = 1, Optimization = 2, LLC = 4
};
// PassInfo ctor - Do not call this directly, this should only be invoked
@@ -154,7 +155,7 @@ struct RegisterPass : public RegisterPassBase {
template<typename CtorType>
RegisterPass(const char *PassArg, const char *Name, unsigned PassTy,
CtorType *Fn) {
- registerPass(new PassInfo(Name, PassArg, typeid(PassName), 0, 0));
+ registerPass(new PassInfo(Name, PassArg, typeid(PassName), PassTy, 0, 0));
}
};
@@ -208,6 +209,38 @@ struct RegisterAnalysis : public RegisterPassBase {
}
};
+// RegisterLLC - Register something that is to show up in LLC, this is just a
+// shortcut for specifying RegisterPass...
+//
+template<typename PassName>
+struct RegisterLLC : public RegisterPassBase {
+ RegisterLLC(const char *PassArg, const char *Name) {
+ registerPass(new PassInfo(Name, PassArg, typeid(PassName),
+ PassInfo::LLC,
+ callDefaultCtor<PassName>, 0));
+ }
+
+ // Register Pass using default constructor explicitly...
+ RegisterLLC(const char *PassArg, const char *Name, Pass *(*ctor)()) {
+ registerPass(new PassInfo(Name, PassArg, typeid(PassName),
+ PassInfo::LLC, ctor, 0));
+ }
+
+ // Register Pass using TargetData constructor...
+ RegisterLLC(const char *PassArg, const char *Name,
+ Pass *(*datactor)(const TargetData &)) {
+ registerPass(new PassInfo(Name, PassArg, typeid(PassName),
+ PassInfo::LLC, 0, datactor));
+ }
+
+ // Register Pass using TargetMachine constructor...
+ RegisterLLC(const char *PassArg, const char *Name,
+ Pass *(*datactor)(TargetMachine &)) {
+ registerPass(new PassInfo(Name, PassArg, typeid(PassName),
+ PassInfo::LLC, 0, 0));
+ }
+};
+
//===---------------------------------------------------------------------------
// PassRegistrationListener class - This class is meant to be derived from by