summaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Utils/ValueMapper.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-03-27 05:50:18 +0000
committerChris Lattner <sabre@nondot.org>2006-03-27 05:50:18 +0000
commit49aaa6a8ee783e8a0a7b272ecdc6c71afd53c18d (patch)
tree51886799dc01ed3245eec7166df0acb255c88be4 /lib/Transforms/Utils/ValueMapper.cpp
parentfb143ce459bafde02a7c6d625cc8974966fa5dff (diff)
downloadexternal_llvm-49aaa6a8ee783e8a0a7b272ecdc6c71afd53c18d.zip
external_llvm-49aaa6a8ee783e8a0a7b272ecdc6c71afd53c18d.tar.gz
external_llvm-49aaa6a8ee783e8a0a7b272ecdc6c71afd53c18d.tar.bz2
teach the inliner to work with packed constants
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27161 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/ValueMapper.cpp')
-rw-r--r--lib/Transforms/Utils/ValueMapper.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/Transforms/Utils/ValueMapper.cpp b/lib/Transforms/Utils/ValueMapper.cpp
index 134a0a2..6db9ed5 100644
--- a/lib/Transforms/Utils/ValueMapper.cpp
+++ b/lib/Transforms/Utils/ValueMapper.cpp
@@ -92,6 +92,25 @@ Value *llvm::MapValue(const Value *V, std::map<const Value*, Value*> &VM) {
return VMSlot = ConstantExpr::get(CE->getOpcode(), MV1, MV2);
}
+ } else if (ConstantPacked *CP = dyn_cast<ConstantPacked>(C)) {
+ for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i) {
+ Value *MV = MapValue(CP->getOperand(i), VM);
+ if (MV != CP->getOperand(i)) {
+ // This packed value must contain a reference to a global, make a new
+ // packed constant and return it.
+ //
+ std::vector<Constant*> Values;
+ Values.reserve(CP->getNumOperands());
+ for (unsigned j = 0; j != i; ++j)
+ Values.push_back(CP->getOperand(j));
+ Values.push_back(cast<Constant>(MV));
+ for (++i; i != e; ++i)
+ Values.push_back(cast<Constant>(MapValue(CP->getOperand(i), VM)));
+ return VMSlot = ConstantPacked::get(Values);
+ }
+ }
+ return VMSlot = C;
+
} else {
assert(0 && "Unknown type of constant!");
}