Get rid of the Pass+Context magic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76702 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson
2009-07-22 00:24:57 +00:00
parent 7cf12c7efd
commit e922c02019
120 changed files with 835 additions and 786 deletions

View File

@@ -29,13 +29,13 @@ namespace llvm {
/// is returned. Note that this function can only fail when attempting to fold
/// instructions like loads and stores, which have no constant expression form.
///
Constant *ConstantFoldInstruction(Instruction *I, LLVMContext *Context,
Constant *ConstantFoldInstruction(Instruction *I, LLVMContext &Context,
const TargetData *TD = 0);
/// ConstantFoldConstantExpression - Attempt to fold the constant expression
/// using the specified TargetData. If successful, the constant result is
/// result is returned, if not, null is returned.
Constant *ConstantFoldConstantExpression(ConstantExpr *CE, LLVMContext *Context,
Constant *ConstantFoldConstantExpression(ConstantExpr *CE, LLVMContext &Context,
const TargetData *TD = 0);
/// ConstantFoldInstOperands - Attempt to constant fold an instruction with the
@@ -46,7 +46,7 @@ Constant *ConstantFoldConstantExpression(ConstantExpr *CE, LLVMContext *Context,
///
Constant *ConstantFoldInstOperands(unsigned Opcode, const Type *DestTy,
Constant*const * Ops, unsigned NumOps,
LLVMContext *Context,
LLVMContext &Context,
const TargetData *TD = 0);
/// ConstantFoldCompareInstOperands - Attempt to constant fold a compare
@@ -55,7 +55,7 @@ Constant *ConstantFoldInstOperands(unsigned Opcode, const Type *DestTy,
///
Constant *ConstantFoldCompareInstOperands(unsigned Predicate,
Constant*const * Ops, unsigned NumOps,
LLVMContext *Context,
LLVMContext &Context,
const TargetData *TD = 0);
@@ -63,7 +63,7 @@ Constant *ConstantFoldCompareInstOperands(unsigned Predicate,
/// getelementptr constantexpr, return the constant value being addressed by the
/// constant expression, or null if something is funny and we can't decide.
Constant *ConstantFoldLoadThroughGEPConstantExpr(Constant *C, ConstantExpr *CE,
LLVMContext *Context);
LLVMContext &Context);
/// canConstantFoldCallTo - Return true if its even possible to fold a call to
/// the specified function.

View File

@@ -37,7 +37,6 @@ public:
// Initialization and finalization hooks.
virtual bool doInitialization(Loop *L, LPPassManager &LPM) {
Context = L->getHeader()->getContext();
return false;
}

View File

@@ -368,7 +368,7 @@ namespace llvm {
static char ID; // Pass identification, replacement for typeid
ScalarEvolution();
LLVMContext *getContext() const { return Context; }
LLVMContext &getContext() const { return F->getContext(); }
/// isSCEVable - Test if values of the given type are analyzable within
/// the SCEV framework. This primarily includes integer types, and it

View File

@@ -38,8 +38,8 @@ namespace llvm {
friend struct SCEVVisitor<SCEVExpander, Value*>;
public:
explicit SCEVExpander(ScalarEvolution &se)
: SE(se), Builder(*se.getContext(),
TargetFolder(se.TD, *se.getContext())) {}
: SE(se), Builder(se.getContext(),
TargetFolder(se.TD, se.getContext())) {}
/// clear - Erase the contents of the InsertedExpressions map so that users
/// trying to expand the same expression into multiple BasicBlocks or
@@ -61,7 +61,7 @@ namespace llvm {
}
private:
LLVMContext *getContext() const { return SE.getContext(); }
LLVMContext &getContext() const { return SE.getContext(); }
/// InsertBinop - Insert the specified binary operator, doing a small amount
/// of work to avoid inserting an obviously redundant operation.

View File

@@ -65,13 +65,13 @@ namespace llvm {
Value *FindInsertedValue(Value *V,
const unsigned *idx_begin,
const unsigned *idx_end,
LLVMContext *Context,
LLVMContext &Context,
Instruction *InsertBefore = 0);
/// This is a convenience wrapper for finding values indexed by a single index
/// only.
inline Value *FindInsertedValue(Value *V, const unsigned Idx,
LLVMContext *Context,
LLVMContext &Context,
Instruction *InsertBefore = 0) {
const unsigned Idxs[1] = { Idx };
return FindInsertedValue(V, &Idxs[0], &Idxs[1], Context, InsertBefore);