[llvm-commits] CVS: llvm/lib/Linker/LinkModules.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Jun 1 12:14:36 PDT 2006
Changes in directory llvm/lib/Linker:
LinkModules.cpp updated: 1.113 -> 1.114
---
Log message:
Fix linking of inline asm objects.
---
Diffs of the changes: (+9 -5)
LinkModules.cpp | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
Index: llvm/lib/Linker/LinkModules.cpp
diff -u llvm/lib/Linker/LinkModules.cpp:1.113 llvm/lib/Linker/LinkModules.cpp:1.114
--- llvm/lib/Linker/LinkModules.cpp:1.113 Fri Apr 7 20:19:47 2006
+++ llvm/lib/Linker/LinkModules.cpp Thu Jun 1 14:14:22 2006
@@ -262,20 +262,19 @@
// 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 @@
} 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);
More information about the llvm-commits
mailing list