diff options
author | Owen Anderson <resistor@mac.com> | 2009-07-02 20:23:41 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-07-02 20:23:41 +0000 |
commit | a8185fe50bdc2de23c00c2ada1a632e17adcf6c5 (patch) | |
tree | c47a6e3563399026df4908e6af867cf7a6d37aa9 /include/llvm/Pass.h | |
parent | 033080cf6a6f6ca94f20c410204405471c19c535 (diff) | |
download | llvm-a8185fe50bdc2de23c00c2ada1a632e17adcf6c5.tar.gz llvm-a8185fe50bdc2de23c00c2ada1a632e17adcf6c5.tar.bz2 llvm-a8185fe50bdc2de23c00c2ada1a632e17adcf6c5.tar.xz |
Make the current LLVMContext available to passes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74724 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Pass.h')
-rw-r--r-- | include/llvm/Pass.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h index 923de658c3..eea99e028d 100644 --- a/include/llvm/Pass.h +++ b/include/llvm/Pass.h @@ -29,6 +29,7 @@ #ifndef LLVM_PASS_H #define LLVM_PASS_H +#include "llvm/Module.h" #include "llvm/Support/DataTypes.h" #include "llvm/Support/Streams.h" #include <cassert> @@ -47,6 +48,7 @@ class ImmutablePass; class PMStack; class AnalysisResolver; class PMDataManager; +class LLVMContext; // AnalysisID - Use the PassInfo to identify a pass... typedef const PassInfo* AnalysisID; @@ -75,6 +77,10 @@ class Pass { void operator=(const Pass&); // DO NOT IMPLEMENT Pass(const Pass &); // DO NOT IMPLEMENT + +protected: + LLVMContext* Context; + public: explicit Pass(intptr_t pid) : Resolver(0), PassID(pid) { assert(pid && "pid cannot be 0"); @@ -275,7 +281,10 @@ public: /// doInitialization - Virtual method overridden by subclasses to do /// any necessary per-module initialization. /// - virtual bool doInitialization(Module &) { return false; } + virtual bool doInitialization(Module &M) { + Context = &M.getContext(); + return false; + } /// runOnFunction - Virtual method overriden by subclasses to do the /// per-function processing of the pass. @@ -327,7 +336,10 @@ public: /// doInitialization - Virtual method overridden by subclasses to do /// any necessary per-module initialization. /// - virtual bool doInitialization(Module &) { return false; } + virtual bool doInitialization(Module &M) { + Context = &M.getContext(); + return false; + } /// doInitialization - Virtual method overridden by BasicBlockPass subclasses /// to do any necessary per-function initialization. |