diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Analysis/ConstantFolding.h | 10 | ||||
-rw-r--r-- | include/llvm/Analysis/LoopPass.h | 1 | ||||
-rw-r--r-- | include/llvm/Analysis/ScalarEvolution.h | 2 | ||||
-rw-r--r-- | include/llvm/Analysis/ScalarEvolutionExpander.h | 6 | ||||
-rw-r--r-- | include/llvm/Analysis/ValueTracking.h | 4 | ||||
-rw-r--r-- | include/llvm/BasicBlock.h | 2 | ||||
-rw-r--r-- | include/llvm/CallGraphSCCPass.h | 1 | ||||
-rw-r--r-- | include/llvm/CodeGen/CallingConvLower.h | 6 | ||||
-rw-r--r-- | include/llvm/CodeGen/FastISel.h | 1 | ||||
-rw-r--r-- | include/llvm/Function.h | 2 | ||||
-rw-r--r-- | include/llvm/Instructions.h | 10 | ||||
-rw-r--r-- | include/llvm/Pass.h | 16 | ||||
-rw-r--r-- | include/llvm/Support/IRBuilder.h | 8 | ||||
-rw-r--r-- | include/llvm/Support/TargetFolder.h | 2 | ||||
-rw-r--r-- | include/llvm/Transforms/Utils/PromoteMemToReg.h | 2 | ||||
-rw-r--r-- | include/llvm/Transforms/Utils/ValueMapper.h | 2 | ||||
-rw-r--r-- | include/llvm/Value.h | 4 |
17 files changed, 34 insertions, 45 deletions
diff --git a/include/llvm/Analysis/ConstantFolding.h b/include/llvm/Analysis/ConstantFolding.h index 6c8acf0..3e393ff 100644 --- a/include/llvm/Analysis/ConstantFolding.h +++ b/include/llvm/Analysis/ConstantFolding.h @@ -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. diff --git a/include/llvm/Analysis/LoopPass.h b/include/llvm/Analysis/LoopPass.h index a6a23c6..7659b5b 100644 --- a/include/llvm/Analysis/LoopPass.h +++ b/include/llvm/Analysis/LoopPass.h @@ -37,7 +37,6 @@ public: // Initialization and finalization hooks. virtual bool doInitialization(Loop *L, LPPassManager &LPM) { - Context = L->getHeader()->getContext(); return false; } diff --git a/include/llvm/Analysis/ScalarEvolution.h b/include/llvm/Analysis/ScalarEvolution.h index d22f5e42..b2d9512 100644 --- a/include/llvm/Analysis/ScalarEvolution.h +++ b/include/llvm/Analysis/ScalarEvolution.h @@ -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 diff --git a/include/llvm/Analysis/ScalarEvolutionExpander.h b/include/llvm/Analysis/ScalarEvolutionExpander.h index 645ce9e..9266bf9 100644 --- a/include/llvm/Analysis/ScalarEvolutionExpander.h +++ b/include/llvm/Analysis/ScalarEvolutionExpander.h @@ -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. diff --git a/include/llvm/Analysis/ValueTracking.h b/include/llvm/Analysis/ValueTracking.h index ec04cb1..1ebd9c2 100644 --- a/include/llvm/Analysis/ValueTracking.h +++ b/include/llvm/Analysis/ValueTracking.h @@ -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); diff --git a/include/llvm/BasicBlock.h b/include/llvm/BasicBlock.h index 4f4da1c..a20309f 100644 --- a/include/llvm/BasicBlock.h +++ b/include/llvm/BasicBlock.h @@ -88,7 +88,7 @@ private: public: /// getContext - Get the context in which this basic block lives, /// or null if it is not currently attached to a function. - LLVMContext *getContext() const; + LLVMContext &getContext() const; /// Instruction iterators... typedef InstListType::iterator iterator; diff --git a/include/llvm/CallGraphSCCPass.h b/include/llvm/CallGraphSCCPass.h index 8d5d7c3..85e83e5 100644 --- a/include/llvm/CallGraphSCCPass.h +++ b/include/llvm/CallGraphSCCPass.h @@ -38,7 +38,6 @@ struct CallGraphSCCPass : public Pass { /// 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) { - Context = &CG.getModule().getContext(); return false; } diff --git a/include/llvm/CodeGen/CallingConvLower.h b/include/llvm/CodeGen/CallingConvLower.h index 67e2776..702ac14 100644 --- a/include/llvm/CodeGen/CallingConvLower.h +++ b/include/llvm/CodeGen/CallingConvLower.h @@ -142,19 +142,19 @@ class CCState { const TargetMachine &TM; const TargetRegisterInfo &TRI; SmallVector<CCValAssign, 16> &Locs; - LLVMContext *Context; + LLVMContext &Context; unsigned StackOffset; SmallVector<uint32_t, 16> UsedRegs; public: CCState(unsigned CC, bool isVarArg, const TargetMachine &TM, - SmallVector<CCValAssign, 16> &locs, LLVMContext *C); + SmallVector<CCValAssign, 16> &locs, LLVMContext &C); void addLoc(const CCValAssign &V) { Locs.push_back(V); } - LLVMContext *getContext() const { return Context; } + LLVMContext &getContext() const { return Context; } const TargetMachine &getTarget() const { return TM; } unsigned getCallingConv() const { return CallingConv; } bool isVarArg() const { return IsVarArg; } diff --git a/include/llvm/CodeGen/FastISel.h b/include/llvm/CodeGen/FastISel.h index 857267c..c7b1a42 100644 --- a/include/llvm/CodeGen/FastISel.h +++ b/include/llvm/CodeGen/FastISel.h @@ -60,7 +60,6 @@ protected: const TargetData &TD; const TargetInstrInfo &TII; const TargetLowering &TLI; - LLVMContext *Context; public: /// startNewBlock - Set the current block to which generated machine diff --git a/include/llvm/Function.h b/include/llvm/Function.h index 04c1442..3bf65ff 100644 --- a/include/llvm/Function.h +++ b/include/llvm/Function.h @@ -129,7 +129,7 @@ public: /// getContext - Return a pointer to the LLVMContext associated with this /// function, or NULL if this function is not bound to a context yet. - LLVMContext *getContext() const; + LLVMContext &getContext() const; /// isVarArg - Return true if this function takes a variable number of /// arguments. diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h index 5e60635..63a3dc0 100644 --- a/include/llvm/Instructions.h +++ b/include/llvm/Instructions.h @@ -645,8 +645,7 @@ public: Value *LHS, ///< The left-hand-side of the expression Value *RHS, ///< The right-hand-side of the expression const std::string &NameStr = "" ///< Name of the instruction - ) : CmpInst(InsertBefore->getParent()->getContext()-> - makeCmpResultType(LHS->getType()), + ) : CmpInst(InsertBefore->getContext().makeCmpResultType(LHS->getType()), Instruction::ICmp, pred, LHS, RHS, NameStr, InsertBefore) { assert(pred >= CmpInst::FIRST_ICMP_PREDICATE && @@ -667,7 +666,7 @@ public: Value *LHS, ///< The left-hand-side of the expression Value *RHS, ///< The right-hand-side of the expression const std::string &NameStr = "" ///< Name of the instruction - ) : CmpInst(InsertAtEnd.getContext()->makeCmpResultType(LHS->getType()), + ) : CmpInst(InsertAtEnd.getContext().makeCmpResultType(LHS->getType()), Instruction::ICmp, pred, LHS, RHS, NameStr, &InsertAtEnd) { assert(pred >= CmpInst::FIRST_ICMP_PREDICATE && @@ -821,8 +820,7 @@ public: Value *LHS, ///< The left-hand-side of the expression Value *RHS, ///< The right-hand-side of the expression const std::string &NameStr = "" ///< Name of the instruction - ) : CmpInst(InsertBefore->getParent()->getContext()-> - makeCmpResultType(LHS->getType()), + ) : CmpInst(InsertBefore->getContext().makeCmpResultType(LHS->getType()), Instruction::FCmp, pred, LHS, RHS, NameStr, InsertBefore) { assert(pred <= FCmpInst::LAST_FCMP_PREDICATE && @@ -841,7 +839,7 @@ public: Value *LHS, ///< The left-hand-side of the expression Value *RHS, ///< The right-hand-side of the expression const std::string &NameStr = "" ///< Name of the instruction - ) : CmpInst(InsertAtEnd.getContext()->makeCmpResultType(LHS->getType()), + ) : CmpInst(InsertAtEnd.getContext().makeCmpResultType(LHS->getType()), Instruction::FCmp, pred, LHS, RHS, NameStr, &InsertAtEnd) { assert(pred <= FCmpInst::LAST_FCMP_PREDICATE && diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h index 51186fa..3043fc0 100644 --- a/include/llvm/Pass.h +++ b/include/llvm/Pass.h @@ -48,7 +48,6 @@ class ImmutablePass; class PMStack; class AnalysisResolver; class PMDataManager; -class LLVMContext; // AnalysisID - Use the PassInfo to identify a pass... typedef const PassInfo* AnalysisID; @@ -78,9 +77,6 @@ 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"); @@ -281,11 +277,8 @@ public: /// doInitialization - Virtual method overridden by subclasses to do /// any necessary per-module initialization. /// - virtual bool doInitialization(Module &M) { - Context = &M.getContext(); - return false; - } - + virtual bool doInitialization(Module &M) { return false; } + /// runOnFunction - Virtual method overriden by subclasses to do the /// per-function processing of the pass. /// @@ -336,10 +329,7 @@ public: /// doInitialization - Virtual method overridden by subclasses to do /// any necessary per-module initialization. /// - virtual bool doInitialization(Module &M) { - Context = &M.getContext(); - return false; - } + virtual bool doInitialization(Module &M) { return false; } /// doInitialization - Virtual method overridden by BasicBlockPass subclasses /// to do any necessary per-function initialization. diff --git a/include/llvm/Support/IRBuilder.h b/include/llvm/Support/IRBuilder.h index 2ef13a7..835a286 100644 --- a/include/llvm/Support/IRBuilder.h +++ b/include/llvm/Support/IRBuilder.h @@ -51,22 +51,22 @@ public: IRBuilder(LLVMContext &C) : Context(C), Folder(C) { ClearInsertionPoint(); } explicit IRBuilder(BasicBlock *TheBB, const T& F) - : Context(*TheBB->getParent()->getContext()), Folder(F) { + : Context(TheBB->getContext()), Folder(F) { SetInsertPoint(TheBB); } explicit IRBuilder(BasicBlock *TheBB) - : Context(*TheBB->getParent()->getContext()), Folder(Context) { + : Context(TheBB->getContext()), Folder(Context) { SetInsertPoint(TheBB); } IRBuilder(BasicBlock *TheBB, BasicBlock::iterator IP, const T& F) - : Context(*TheBB->getParent()->getContext()), Folder(F) { + : Context(TheBB->getContext()), Folder(F) { SetInsertPoint(TheBB, IP); } IRBuilder(BasicBlock *TheBB, BasicBlock::iterator IP) - : Context(*TheBB->getParent()->getContext()), Folder(Context) { + : Context(TheBB->getContext()), Folder(Context) { SetInsertPoint(TheBB, IP); } diff --git a/include/llvm/Support/TargetFolder.h b/include/llvm/Support/TargetFolder.h index d2661ca..1e49850 100644 --- a/include/llvm/Support/TargetFolder.h +++ b/include/llvm/Support/TargetFolder.h @@ -35,7 +35,7 @@ class TargetFolder { /// Fold - Fold the constant using target specific information. Constant *Fold(Constant *C) const { if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) - if (Constant *CF = ConstantFoldConstantExpression(CE, &Context, TD)) + if (Constant *CF = ConstantFoldConstantExpression(CE, Context, TD)) return CF; return C; } diff --git a/include/llvm/Transforms/Utils/PromoteMemToReg.h b/include/llvm/Transforms/Utils/PromoteMemToReg.h index 91d51e2..71a077e 100644 --- a/include/llvm/Transforms/Utils/PromoteMemToReg.h +++ b/include/llvm/Transforms/Utils/PromoteMemToReg.h @@ -40,7 +40,7 @@ bool isAllocaPromotable(const AllocaInst *AI); /// void PromoteMemToReg(const std::vector<AllocaInst*> &Allocas, DominatorTree &DT, DominanceFrontier &DF, - LLVMContext *Context, + LLVMContext &Context, AliasSetTracker *AST = 0); } // End llvm namespace diff --git a/include/llvm/Transforms/Utils/ValueMapper.h b/include/llvm/Transforms/Utils/ValueMapper.h index dd294bb..d31edab 100644 --- a/include/llvm/Transforms/Utils/ValueMapper.h +++ b/include/llvm/Transforms/Utils/ValueMapper.h @@ -23,7 +23,7 @@ namespace llvm { class LLVMContext; typedef DenseMap<const Value *, Value *> ValueMapTy; - Value *MapValue(const Value *V, ValueMapTy &VM, LLVMContext *Context); + Value *MapValue(const Value *V, ValueMapTy &VM, LLVMContext &Context); void RemapInstruction(Instruction *I, ValueMapTy &VM); } // End llvm namespace diff --git a/include/llvm/Value.h b/include/llvm/Value.h index 7e7b415..b220930 100644 --- a/include/llvm/Value.h +++ b/include/llvm/Value.h @@ -40,6 +40,7 @@ typedef StringMapEntry<Value*> ValueName; class raw_ostream; class AssemblyAnnotationWriter; class ValueHandleBase; +class LLVMContext; //===----------------------------------------------------------------------===// // Value Class @@ -101,6 +102,9 @@ public: /// inline const Type *getType() const { return VTy; } + /// All values hold a context through their type. + LLVMContext &getContext() const; + // All values can potentially be named... inline bool hasName() const { return Name != 0; } ValueName *getValueName() const { return Name; } |