mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-06 21:29:27 +00:00
Make the current LLVMContext available to passes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74724 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
033080cf6a
commit
a8185fe50b
@ -29,6 +29,7 @@
|
|||||||
#ifndef LLVM_PASS_H
|
#ifndef LLVM_PASS_H
|
||||||
#define LLVM_PASS_H
|
#define LLVM_PASS_H
|
||||||
|
|
||||||
|
#include "llvm/Module.h"
|
||||||
#include "llvm/Support/DataTypes.h"
|
#include "llvm/Support/DataTypes.h"
|
||||||
#include "llvm/Support/Streams.h"
|
#include "llvm/Support/Streams.h"
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@ -47,6 +48,7 @@ class ImmutablePass;
|
|||||||
class PMStack;
|
class PMStack;
|
||||||
class AnalysisResolver;
|
class AnalysisResolver;
|
||||||
class PMDataManager;
|
class PMDataManager;
|
||||||
|
class LLVMContext;
|
||||||
|
|
||||||
// AnalysisID - Use the PassInfo to identify a pass...
|
// AnalysisID - Use the PassInfo to identify a pass...
|
||||||
typedef const PassInfo* AnalysisID;
|
typedef const PassInfo* AnalysisID;
|
||||||
@ -75,6 +77,10 @@ class Pass {
|
|||||||
|
|
||||||
void operator=(const Pass&); // DO NOT IMPLEMENT
|
void operator=(const Pass&); // DO NOT IMPLEMENT
|
||||||
Pass(const Pass &); // DO NOT IMPLEMENT
|
Pass(const Pass &); // DO NOT IMPLEMENT
|
||||||
|
|
||||||
|
protected:
|
||||||
|
LLVMContext* Context;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Pass(intptr_t pid) : Resolver(0), PassID(pid) {
|
explicit Pass(intptr_t pid) : Resolver(0), PassID(pid) {
|
||||||
assert(pid && "pid cannot be 0");
|
assert(pid && "pid cannot be 0");
|
||||||
@ -275,7 +281,10 @@ public:
|
|||||||
/// doInitialization - Virtual method overridden by subclasses to do
|
/// doInitialization - Virtual method overridden by subclasses to do
|
||||||
/// any necessary per-module initialization.
|
/// 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
|
/// runOnFunction - Virtual method overriden by subclasses to do the
|
||||||
/// per-function processing of the pass.
|
/// per-function processing of the pass.
|
||||||
@ -327,7 +336,10 @@ public:
|
|||||||
/// doInitialization - Virtual method overridden by subclasses to do
|
/// doInitialization - Virtual method overridden by subclasses to do
|
||||||
/// any necessary per-module initialization.
|
/// 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
|
/// doInitialization - Virtual method overridden by BasicBlockPass subclasses
|
||||||
/// to do any necessary per-function initialization.
|
/// to do any necessary per-function initialization.
|
||||||
|
Loading…
Reference in New Issue
Block a user