diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-11-27 20:28:19 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-11-27 20:28:19 +0000 |
commit | 19b52383c58322e6f00430672bc1ffbaabf21845 (patch) | |
tree | 5e7c43a5e095bdac3dbe472eb9ce36d5e5dd435e /llvm/lib/Transforms/Utils | |
parent | 54dd84d48fb585ff1c491ab24d19e5c30a85ed77 (diff) | |
download | bcm5719-llvm-19b52383c58322e6f00430672bc1ffbaabf21845.tar.gz bcm5719-llvm-19b52383c58322e6f00430672bc1ffbaabf21845.zip |
Simplify the linking of recursive data.
Now the ValueMapper has two callbacks. The first one maps the
declaration. The ValueMapper records the mapping and then materializes
the body/initializer.
llvm-svn: 254209
Diffstat (limited to 'llvm/lib/Transforms/Utils')
-rw-r--r-- | llvm/lib/Transforms/Utils/ValueMapper.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp index c8d13385b1d..0a63c1d5153 100644 --- a/llvm/lib/Transforms/Utils/ValueMapper.cpp +++ b/llvm/lib/Transforms/Utils/ValueMapper.cpp @@ -25,6 +25,8 @@ using namespace llvm; // Out of line method to get vtable etc for class. void ValueMapTypeRemapper::anchor() {} void ValueMaterializer::anchor() {} +void ValueMaterializer::materializeInitFor(GlobalValue *New, GlobalValue *Old) { +} Value *llvm::MapValue(const Value *V, ValueToValueMapTy &VM, RemapFlags Flags, ValueMapTypeRemapper *TypeMapper, @@ -36,8 +38,14 @@ Value *llvm::MapValue(const Value *V, ValueToValueMapTy &VM, RemapFlags Flags, // If we have a materializer and it can materialize a value, use that. if (Materializer) { - if (Value *NewV = Materializer->materializeValueFor(const_cast<Value*>(V))) - return VM[V] = NewV; + if (Value *NewV = + Materializer->materializeDeclFor(const_cast<Value *>(V))) { + VM[V] = NewV; + if (auto *GV = dyn_cast<GlobalValue>(V)) + Materializer->materializeInitFor(cast<GlobalValue>(NewV), + const_cast<GlobalValue *>(GV)); + return NewV; + } } // Global values do not need to be seeded into the VM if they |