[llvm-commits] CVS: llvm/lib/Linker/LinkModules.cpp
Reid Spencer
reid at x10sys.com
Fri Jan 26 00:12:04 PST 2007
Changes in directory llvm/lib/Linker:
LinkModules.cpp updated: 1.126 -> 1.127
---
Log message:
For PR761: http://llvm.org/PR761 :
The Module::setEndianness and Module::setPointerSize methods have been
removed. Instead you can get/set the DataLayout. Adjust thise accordingly.
---
Diffs of the changes: (+14 -8)
LinkModules.cpp | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
Index: llvm/lib/Linker/LinkModules.cpp
diff -u llvm/lib/Linker/LinkModules.cpp:1.126 llvm/lib/Linker/LinkModules.cpp:1.127
--- llvm/lib/Linker/LinkModules.cpp:1.126 Fri Jan 12 01:05:13 2007
+++ llvm/lib/Linker/LinkModules.cpp Fri Jan 26 02:11:39 2007
@@ -849,19 +849,25 @@
assert(Dest != 0 && "Invalid Destination module");
assert(Src != 0 && "Invalid Source Module");
+ std::string DataLayout;
+
if (Dest->getEndianness() == Module::AnyEndianness)
- Dest->setEndianness(Src->getEndianness());
+ if (Src->getEndianness() == Module::BigEndian)
+ DataLayout.append("E");
+ else if (Src->getEndianness() == Module::LittleEndian)
+ DataLayout.append("e");
if (Dest->getPointerSize() == Module::AnyPointerSize)
- Dest->setPointerSize(Src->getPointerSize());
+ if (Src->getPointerSize() == Module::Pointer64)
+ DataLayout.append(DataLayout.length() == 0 ? "p:64:64" : "-p:64:64");
+ else if (Src->getPointerSize() == Module::Pointer32)
+ DataLayout.append(DataLayout.length() == 0 ? "p:32:32" : "-p:32:32");
if (Dest->getTargetTriple().empty())
Dest->setTargetTriple(Src->getTargetTriple());
+ Dest->setDataLayout(DataLayout);
- if (Src->getEndianness() != Module::AnyEndianness &&
- Dest->getEndianness() != Src->getEndianness())
- cerr << "WARNING: Linking two modules of different endianness!\n";
- if (Src->getPointerSize() != Module::AnyPointerSize &&
- Dest->getPointerSize() != Src->getPointerSize())
- cerr << "WARNING: Linking two modules of different pointer size!\n";
+ if (Src->getDataLayout().length() > 0 && Dest->getDataLayout().length() > 0 &&
+ Src->getDataLayout().compare(Dest->getDataLayout()) != 0)
+ cerr << "WARNING: Linking two modules of different data layouts!\n";
if (!Src->getTargetTriple().empty() &&
Dest->getTargetTriple() != Src->getTargetTriple())
cerr << "WARNING: Linking two modules of different target triples!\n";
More information about the llvm-commits
mailing list