aboutsummaryrefslogtreecommitdiff
path: root/lib/Bitcode
diff options
context:
space:
mode:
authorMark Seaborn <mseaborn@chromium.org>2013-06-23 18:48:56 -0700
committerMark Seaborn <mseaborn@chromium.org>2013-06-23 18:48:56 -0700
commitae9f7fcc65aed800db82aaa55e5e72322f20af02 (patch)
treeeca0b1eeffb65890a1cefdfc203cb4f82afde025 /lib/Bitcode
parent7001e7af4b74a6a5f5ddc445975d657d443ef2cd (diff)
PNaCl wire format: Remove the top-level TRIPLE record
Currently, the triple that gets put into pexes is "armv7-none-linux-gnueabi". This is a wart that we don't want to keep. We can remove the triple entirely; PNaCl doesn't need it. We don't need to add a triple back at read time: (pnacl-)llc tells the backend explicitly what target to use. I'm leaving MODULE_CODE_TRIPLE defined in the enum for now because pnacl-bcanalyzer still refers to it. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3505 TEST=PNaCl toolchain trybots + GCC torture tests + Spec2k Review URL: https://codereview.chromium.org/17321009
Diffstat (limited to 'lib/Bitcode')
-rw-r--r--lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp53
-rw-r--r--lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h1
-rw-r--r--lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp8
3 files changed, 2 insertions, 60 deletions
diff --git a/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp b/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp
index f829642f20..c38df6c9ad 100644
--- a/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp
+++ b/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.cpp
@@ -1466,21 +1466,6 @@ bool NaClBitcodeReader::ParseModule(bool Resume) {
}
break;
}
- case naclbitc::MODULE_CODE_TRIPLE: { // TRIPLE: [strchr x N]
- std::string S;
- if (ConvertToString(Record, 0, S))
- return Error("Invalid MODULE_CODE_TRIPLE record");
-
- // @LOCALMOD-BEGIN
- // This hack is needed in order to get Clang compiled binaries
- // working with the Gold plugin, until PNaCl backend is introduced
- // in lib/Target/PNaCl.
- if (S == "le32-unknown-nacl")
- S = "armv7-none-linux-gnueabi";
- // @LOCALMOD-END
- TheModule->setTargetTriple(S);
- break;
- }
case naclbitc::MODULE_CODE_DATALAYOUT: { // DATALAYOUT: [strchr x N]
std::string S;
if (ConvertToString(Record, 0, S))
@@ -1689,44 +1674,6 @@ bool NaClBitcodeReader::ParseBitcodeInto(Module *M) {
}
}
-bool NaClBitcodeReader::ParseModuleTriple(std::string &Triple) {
- DEBUG(dbgs() << "-> ParseModuleTriple\n");
- if (Stream.EnterSubBlock(naclbitc::MODULE_BLOCK_ID))
- return Error("Malformed block record");
-
- SmallVector<uint64_t, 64> Record;
-
- // Read all the records for this module.
- while (1) {
- NaClBitstreamEntry Entry = Stream.advanceSkippingSubblocks();
-
- switch (Entry.Kind) {
- case NaClBitstreamEntry::SubBlock: // Handled for us already.
- case NaClBitstreamEntry::Error:
- return Error("malformed module block");
- case NaClBitstreamEntry::EndBlock:
- DEBUG(dbgs() << "<- ParseModuleTriple\n");
- return false;
- case NaClBitstreamEntry::Record:
- // The interesting case.
- break;
- }
-
- // Read a record.
- switch (Stream.readRecord(Entry.ID, Record)) {
- default: break; // Default behavior, ignore unknown content.
- case naclbitc::MODULE_CODE_TRIPLE: { // TRIPLE: [strchr x N]
- std::string S;
- if (ConvertToString(Record, 0, S))
- return Error("Invalid MODULE_CODE_TRIPLE record");
- Triple = S;
- break;
- }
- }
- Record.clear();
- }
-}
-
/// ParseMetadataAttachment - Parse metadata attachments.
bool NaClBitcodeReader::ParseMetadataAttachment() {
DEBUG(dbgs() << "-> ParseMetadataAttachment\n");
diff --git a/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h b/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h
index a291aaa941..a426c22f1d 100644
--- a/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h
+++ b/lib/Bitcode/NaCl/Reader/NaClBitcodeReader.h
@@ -328,7 +328,6 @@ private:
bool ResolveGlobalAndAliasInits();
bool ParseMetadata();
bool ParseMetadataAttachment();
- bool ParseModuleTriple(std::string &Triple);
bool ParseUseLists();
bool InitStream();
bool InitStreamFromBuffer();
diff --git a/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp b/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp
index 3fa90f88a0..82d6198fa6 100644
--- a/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp
+++ b/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp
@@ -16,7 +16,6 @@
#include "llvm/Bitcode/NaCl/NaClBitcodeHeader.h"
#include "llvm/Bitcode/NaCl/NaClReaderWriter.h"
#include "NaClValueEnumerator.h"
-#include "llvm/ADT/Triple.h"
#include "llvm/Bitcode/NaCl/NaClBitstreamWriter.h"
#include "llvm/Bitcode/NaCl/NaClLLVMBitCodes.h"
#include "llvm/IR/Constants.h"
@@ -425,15 +424,12 @@ static unsigned getEncodedThreadLocalMode(const GlobalVariable *GV) {
llvm_unreachable("Invalid TLS model");
}
-// Emit top-level description of module, including target triple, inline asm,
+// Emit top-level description of module, including inline asm,
// descriptors for global variables, and function prototype info.
static void WriteModuleInfo(const Module *M, const NaClValueEnumerator &VE,
NaClBitstreamWriter &Stream) {
DEBUG(dbgs() << "-> WriteModuleInfo\n");
// Emit various pieces of data attached to a module.
- if (!M->getTargetTriple().empty())
- WriteStringRecord(naclbitc::MODULE_CODE_TRIPLE, M->getTargetTriple(),
- 0/*TODO*/, Stream);
if (!M->getDataLayout().empty())
WriteStringRecord(naclbitc::MODULE_CODE_DATALAYOUT, M->getDataLayout(),
0/*TODO*/, Stream);
@@ -1780,7 +1776,7 @@ static void WriteModule(const Module *M, NaClBitstreamWriter &Stream) {
// Emit information describing all of the types in the module.
WriteTypeTable(VE, Stream);
- // Emit top-level description of module, including target triple, inline asm,
+ // Emit top-level description of module, including inline asm,
// descriptors for global variables, and function prototype info.
WriteModuleInfo(M, VE, Stream);