diff options
author | Dan Gohman <gohman@apple.com> | 2009-10-24 23:37:16 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-10-24 23:37:16 +0000 |
commit | ef41a1ce3cbfb6f092ee6b3d540c29a278abbe2a (patch) | |
tree | c2bd6a59d318e43d9f8ece6337c14bb2eed9a00f /llvm/lib/Transforms/Utils/ValueMapper.cpp | |
parent | 8f4078ba391a091b7eb119db1865848c5c95a7b2 (diff) | |
download | bcm5719-llvm-ef41a1ce3cbfb6f092ee6b3d540c29a278abbe2a.tar.gz bcm5719-llvm-ef41a1ce3cbfb6f092ee6b3d540c29a278abbe2a.zip |
MapValue doesn't needs its LLVMContext argument.
llvm-svn: 85020
Diffstat (limited to 'llvm/lib/Transforms/Utils/ValueMapper.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/ValueMapper.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp index 2d8332f5252..5d1cdf7e984 100644 --- a/llvm/lib/Transforms/Utils/ValueMapper.cpp +++ b/llvm/lib/Transforms/Utils/ValueMapper.cpp @@ -18,13 +18,12 @@ #include "llvm/Constants.h" #include "llvm/GlobalValue.h" #include "llvm/Instruction.h" -#include "llvm/LLVMContext.h" #include "llvm/Metadata.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Support/ErrorHandling.h" using namespace llvm; -Value *llvm::MapValue(const Value *V, ValueMapTy &VM, LLVMContext &Context) { +Value *llvm::MapValue(const Value *V, ValueMapTy &VM) { Value *&VMSlot = VM[V]; if (VMSlot) return VMSlot; // Does it exist in the map yet? @@ -44,7 +43,7 @@ Value *llvm::MapValue(const Value *V, ValueMapTy &VM, LLVMContext &Context) { else if (ConstantArray *CA = dyn_cast<ConstantArray>(C)) { for (User::op_iterator b = CA->op_begin(), i = b, e = CA->op_end(); i != e; ++i) { - Value *MV = MapValue(*i, VM, Context); + Value *MV = MapValue(*i, VM); if (MV != *i) { // This array must contain a reference to a global, make a new array // and return it. @@ -55,7 +54,7 @@ Value *llvm::MapValue(const Value *V, ValueMapTy &VM, LLVMContext &Context) { Values.push_back(cast<Constant>(*j)); Values.push_back(cast<Constant>(MV)); for (++i; i != e; ++i) - Values.push_back(cast<Constant>(MapValue(*i, VM, Context))); + Values.push_back(cast<Constant>(MapValue(*i, VM))); return VM[V] = ConstantArray::get(CA->getType(), Values); } } @@ -64,7 +63,7 @@ Value *llvm::MapValue(const Value *V, ValueMapTy &VM, LLVMContext &Context) { } else if (ConstantStruct *CS = dyn_cast<ConstantStruct>(C)) { for (User::op_iterator b = CS->op_begin(), i = b, e = CS->op_end(); i != e; ++i) { - Value *MV = MapValue(*i, VM, Context); + Value *MV = MapValue(*i, VM); if (MV != *i) { // This struct must contain a reference to a global, make a new struct // and return it. @@ -75,7 +74,7 @@ Value *llvm::MapValue(const Value *V, ValueMapTy &VM, LLVMContext &Context) { Values.push_back(cast<Constant>(*j)); Values.push_back(cast<Constant>(MV)); for (++i; i != e; ++i) - Values.push_back(cast<Constant>(MapValue(*i, VM, Context))); + Values.push_back(cast<Constant>(MapValue(*i, VM))); return VM[V] = ConstantStruct::get(CS->getType(), Values); } } @@ -84,12 +83,12 @@ Value *llvm::MapValue(const Value *V, ValueMapTy &VM, LLVMContext &Context) { } else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) { std::vector<Constant*> Ops; for (User::op_iterator i = CE->op_begin(), e = CE->op_end(); i != e; ++i) - Ops.push_back(cast<Constant>(MapValue(*i, VM, Context))); + Ops.push_back(cast<Constant>(MapValue(*i, VM))); return VM[V] = CE->getWithOperands(Ops); } else if (ConstantVector *CP = dyn_cast<ConstantVector>(C)) { for (User::op_iterator b = CP->op_begin(), i = b, e = CP->op_end(); i != e; ++i) { - Value *MV = MapValue(*i, VM, Context); + Value *MV = MapValue(*i, VM); if (MV != *i) { // This vector value must contain a reference to a global, make a new // vector constant and return it. @@ -100,7 +99,7 @@ Value *llvm::MapValue(const Value *V, ValueMapTy &VM, LLVMContext &Context) { Values.push_back(cast<Constant>(*j)); Values.push_back(cast<Constant>(MV)); for (++i; i != e; ++i) - Values.push_back(cast<Constant>(MapValue(*i, VM, Context))); + Values.push_back(cast<Constant>(MapValue(*i, VM))); return VM[V] = ConstantVector::get(Values); } } @@ -118,7 +117,7 @@ Value *llvm::MapValue(const Value *V, ValueMapTy &VM, LLVMContext &Context) { /// void llvm::RemapInstruction(Instruction *I, ValueMapTy &ValueMap) { for (User::op_iterator op = I->op_begin(), E = I->op_end(); op != E; ++op) { - Value *V = MapValue(*op, ValueMap, I->getParent()->getContext()); + Value *V = MapValue(*op, ValueMap); assert(V && "Referenced value not in value map!"); *op = V; } |