From 650d292f89643aad10a447747286ba4b07182635 Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Thu, 18 Jan 2007 23:24:24 +0000 Subject: [PATCH] For PR761: Implement reading and writing of the Module's data layout string. llvm-svn: 33346 --- llvm/lib/Bytecode/Reader/Reader.cpp | 7 +++++++ llvm/lib/Bytecode/Writer/Writer.cpp | 3 +++ 2 files changed, 10 insertions(+) diff --git a/llvm/lib/Bytecode/Reader/Reader.cpp b/llvm/lib/Bytecode/Reader/Reader.cpp index efdb4f17d266..355fc1df4c0c 100644 --- a/llvm/lib/Bytecode/Reader/Reader.cpp +++ b/llvm/lib/Bytecode/Reader/Reader.cpp @@ -2013,6 +2013,13 @@ void BytecodeReader::ParseModuleGlobalInfo() { TheModule->setTargetTriple(triple); if (Handler) Handler->handleTargetTriple(triple); + + // Read the data layout string and place into the module. + std::string datalayout = read_str(); + TheModule->setDataLayout(datalayout); + // FIXME: Implement + // if (Handler) + // Handler->handleDataLayout(datalayout); if (At != BlockEnd) { // If the file has section info in it, read the section names now. diff --git a/llvm/lib/Bytecode/Writer/Writer.cpp b/llvm/lib/Bytecode/Writer/Writer.cpp index 201352493901..aea900075492 100644 --- a/llvm/lib/Bytecode/Writer/Writer.cpp +++ b/llvm/lib/Bytecode/Writer/Writer.cpp @@ -1090,6 +1090,9 @@ void BytecodeWriter::outputModuleInfoBlock(const Module *M) { // Output the target triple from the module output(M->getTargetTriple()); + + // Output the data layout from the module + output(M->getDataLayout()); // Emit the table of section names. output_vbr((unsigned)SectionNames.size());