diff options
author | Chris Lattner <sabre@nondot.org> | 2006-06-01 19:14:22 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-06-01 19:14:22 +0000 |
commit | 620fd68b1086b4d99b23951357299bee357aa62a (patch) | |
tree | 1aaf3320d1ed69be9f849c3dc6c9693d8dfaddd4 /lib/Linker/LinkModules.cpp | |
parent | 48fdf91d0f17b19bb7345156b928689df94d0c6c (diff) |
Fix linking of inline asm objects.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28640 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Linker/LinkModules.cpp')
-rw-r--r-- | lib/Linker/LinkModules.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index 26f56a7ec1..9054cd7142 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -262,20 +262,19 @@ static void PrintMap(const std::map<const Value*, Value*> &M) { // RemapOperand - Use ValueMap to convert references from one module to another. // This is somewhat sophisticated in that it can automatically handle constant -// references correctly as well... +// references correctly as well. static Value *RemapOperand(const Value *In, std::map<const Value*, Value*> &ValueMap) { std::map<const Value*,Value*>::const_iterator I = ValueMap.find(In); if (I != ValueMap.end()) return I->second; // Check to see if it's a constant that we are interesting in transforming. + Value *Result = 0; if (const Constant *CPV = dyn_cast<Constant>(In)) { if ((!isa<DerivedType>(CPV->getType()) && !isa<ConstantExpr>(CPV)) || isa<ConstantAggregateZero>(CPV)) return const_cast<Constant*>(CPV); // Simple constants stay identical. - Constant *Result = 0; - if (const ConstantArray *CPA = dyn_cast<ConstantArray>(CPV)) { std::vector<Constant*> Operands(CPA->getNumOperands()); for (unsigned i = 0, e = CPA->getNumOperands(); i != e; ++i) @@ -350,11 +349,16 @@ static Value *RemapOperand(const Value *In, } else { assert(0 && "Unknown type of derived type constant value!"); } - - // Cache the mapping in our local map structure... + } else if (isa<InlineAsm>(In)) { + Result = const_cast<Value*>(In); + } + + // Cache the mapping in our local map structure... + if (Result) { ValueMap.insert(std::make_pair(In, Result)); return Result; } + std::cerr << "LinkModules ValueMap: \n"; PrintMap(ValueMap); |