Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(476)

Unified Diff: lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp

Issue 1122423005: Add (unsupported experimental) feature allowing byte aligned bitcode. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Fix nits. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp
diff --git a/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp b/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp
index fd9de4fa0e181fc732d5a8b2040abe1de9778cee..9d03699407f977d173b94777010a52a3a0999b4b 100644
--- a/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp
+++ b/lib/Bitcode/NaCl/Writer/NaClBitcodeWriter.cpp
@@ -40,6 +40,11 @@ PNaClVersion("pnacl-version",
cl::desc("Specify PNaCl bitcode version to write"),
cl::init(2));
+static cl::opt<bool>
+AlignBitcodeRecords("align-bitcode-records",
+ cl::desc("Align bitcode records in PNaCl bitcode files (experimental)"),
+ cl::init(false));
+
/// These are manifest constants used by the bitcode writer. They do
/// not need to be kept in sync with the reader, but need to be
/// consistent within this file.
@@ -1174,6 +1179,10 @@ void llvm::NaClWriteHeader(NaClBitstreamWriter &Stream,
Header.push_back(
new NaClBitcodeHeaderField(NaClBitcodeHeaderField::kPNaClVersion,
PNaClVersion));
+ if (AlignBitcodeRecords)
+ Header.push_back(new NaClBitcodeHeaderField(
+ NaClBitcodeHeaderField::kAlignBitcodeRecords));
+
Header.InstallFields();
if (!(Header.IsSupported() ||
(!AcceptSupportedOnly && Header.IsReadable()))) {
@@ -1185,6 +1194,8 @@ void llvm::NaClWriteHeader(NaClBitstreamWriter &Stream,
// Write out the given Header to the bitstream.
void llvm::NaClWriteHeader(const NaClBitcodeHeader &Header,
NaClBitstreamWriter &Stream) {
+ Stream.initFromHeader(Header);
+
// Emit the file magic number;
Stream.Emit((unsigned)'P', 8);
Stream.Emit((unsigned)'E', 8);
« no previous file with comments | « lib/Bitcode/NaCl/TestUtils/NaClBitcodeMungeReader.cpp ('k') | test/NaCl/Bitcode/pnacl-bcdis/no-abbreviations.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698