Index: lib/Bitcode/NaCl/Reader/NaClBitstreamReader.cpp |
diff --git a/lib/Bitcode/Reader/BitstreamReader.cpp b/lib/Bitcode/NaCl/Reader/NaClBitstreamReader.cpp |
similarity index 90% |
copy from lib/Bitcode/Reader/BitstreamReader.cpp |
copy to lib/Bitcode/NaCl/Reader/NaClBitstreamReader.cpp |
index 942346b44e32e8d85582929de55222b17d52c59f..9a1ad133d347c368303571ce50f474c5aa2e4a06 100644 |
--- a/lib/Bitcode/Reader/BitstreamReader.cpp |
+++ b/lib/Bitcode/NaCl/Reader/NaClBitstreamReader.cpp |
@@ -1,4 +1,5 @@ |
-//===- BitstreamReader.cpp - BitstreamReader implementation ---------------===// |
+//===- NaClBitstreamReader.cpp --------------------------------------------===// |
+// NaClBitstreamReader implementation |
// |
// The LLVM Compiler Infrastructure |
// |
@@ -7,15 +8,15 @@ |
// |
jvoung (off chromium)
2013/04/29 18:02:08
Should the merge script in native_client/pnacl/scr
Karl
2013/04/29 20:44:37
The problem (as I see it) is that the way I want t
|
//===----------------------------------------------------------------------===// |
-#include "llvm/Bitcode/BitstreamReader.h" |
+#include "llvm/Bitcode/NaCl/NaClBitstreamReader.h" |
using namespace llvm; |
//===----------------------------------------------------------------------===// |
-// BitstreamCursor implementation |
+// NaClBitstreamCursor implementation |
//===----------------------------------------------------------------------===// |
-void BitstreamCursor::operator=(const BitstreamCursor &RHS) { |
+void NaClBitstreamCursor::operator=(const NaClBitstreamCursor &RHS) { |
freeState(); |
BitStream = RHS.BitStream; |
@@ -38,7 +39,7 @@ void BitstreamCursor::operator=(const BitstreamCursor &RHS) { |
} |
} |
-void BitstreamCursor::freeState() { |
+void NaClBitstreamCursor::freeState() { |
// Free all the Abbrevs. |
for (size_t i = 0, e = CurAbbrevs.size(); i != e; ++i) |
CurAbbrevs[i]->dropRef(); |
@@ -55,13 +56,13 @@ void BitstreamCursor::freeState() { |
/// EnterSubBlock - Having read the ENTER_SUBBLOCK abbrevid, enter |
/// the block, and return true if the block has an error. |
-bool BitstreamCursor::EnterSubBlock(unsigned BlockID, unsigned *NumWordsP) { |
+bool NaClBitstreamCursor::EnterSubBlock(unsigned BlockID, unsigned *NumWordsP) { |
// Save the current block's state on BlockScope. |
BlockScope.push_back(Block(CurCodeSize)); |
BlockScope.back().PrevAbbrevs.swap(CurAbbrevs); |
// Add the abbrevs specific to this block to the CurAbbrevs list. |
- if (const BitstreamReader::BlockInfo *Info = |
+ if (const NaClBitstreamReader::BlockInfo *Info = |
BitStream->getBlockInfo(BlockID)) { |
for (size_t i = 0, e = Info->Abbrevs.size(); i != e; ++i) { |
CurAbbrevs.push_back(Info->Abbrevs[i]); |
@@ -82,15 +83,17 @@ bool BitstreamCursor::EnterSubBlock(unsigned BlockID, unsigned *NumWordsP) { |
return false; |
} |
-void BitstreamCursor::readAbbreviatedLiteral(const BitCodeAbbrevOp &Op, |
- SmallVectorImpl<uint64_t> &Vals) { |
+void NaClBitstreamCursor::readAbbreviatedLiteral( |
+ const BitCodeAbbrevOp &Op, |
+ SmallVectorImpl<uint64_t> &Vals) { |
assert(Op.isLiteral() && "Not a literal"); |
// If the abbrev specifies the literal value to use, use it. |
Vals.push_back(Op.getLiteralValue()); |
} |
-void BitstreamCursor::readAbbreviatedField(const BitCodeAbbrevOp &Op, |
- SmallVectorImpl<uint64_t> &Vals) { |
+void NaClBitstreamCursor::readAbbreviatedField( |
+ const BitCodeAbbrevOp &Op, |
+ SmallVectorImpl<uint64_t> &Vals) { |
assert(!Op.isLiteral() && "Use ReadAbbreviatedLiteral for literals!"); |
// Decode the value as we are commanded. |
@@ -110,7 +113,7 @@ void BitstreamCursor::readAbbreviatedField(const BitCodeAbbrevOp &Op, |
} |
} |
-void BitstreamCursor::skipAbbreviatedField(const BitCodeAbbrevOp &Op) { |
+void NaClBitstreamCursor::skipAbbreviatedField(const BitCodeAbbrevOp &Op) { |
assert(!Op.isLiteral() && "Use ReadAbbreviatedLiteral for literals!"); |
// Decode the value as we are commanded. |
@@ -133,7 +136,7 @@ void BitstreamCursor::skipAbbreviatedField(const BitCodeAbbrevOp &Op) { |
/// skipRecord - Read the current record and discard it. |
-void BitstreamCursor::skipRecord(unsigned AbbrevID) { |
+void NaClBitstreamCursor::skipRecord(unsigned AbbrevID) { |
// Skip unabbreviated records by reading past their entries. |
if (AbbrevID == bitc::UNABBREV_RECORD) { |
unsigned Code = ReadVBR(6); |
@@ -191,9 +194,9 @@ void BitstreamCursor::skipRecord(unsigned AbbrevID) { |
} |
} |
-unsigned BitstreamCursor::readRecord(unsigned AbbrevID, |
- SmallVectorImpl<uint64_t> &Vals, |
- StringRef *Blob) { |
+unsigned NaClBitstreamCursor::readRecord(unsigned AbbrevID, |
+ SmallVectorImpl<uint64_t> &Vals, |
+ StringRef *Blob) { |
if (AbbrevID == bitc::UNABBREV_RECORD) { |
unsigned Code = ReadVBR(6); |
unsigned NumElts = ReadVBR(6); |
@@ -270,7 +273,7 @@ unsigned BitstreamCursor::readRecord(unsigned AbbrevID, |
} |
-void BitstreamCursor::ReadAbbrevRecord() { |
+void NaClBitstreamCursor::ReadAbbrevRecord() { |
BitCodeAbbrev *Abbv = new BitCodeAbbrev(); |
unsigned NumOpInfo = ReadVBR(5); |
for (unsigned i = 0; i != NumOpInfo; ++i) { |
@@ -300,7 +303,7 @@ void BitstreamCursor::ReadAbbrevRecord() { |
CurAbbrevs.push_back(Abbv); |
} |
-bool BitstreamCursor::ReadBlockInfoBlock() { |
+bool NaClBitstreamCursor::ReadBlockInfoBlock() { |
// If this is the second stream to get to the block info block, skip it. |
if (BitStream->hasBlockInfoRecords()) |
return SkipBlock(); |
@@ -308,7 +311,7 @@ bool BitstreamCursor::ReadBlockInfoBlock() { |
if (EnterSubBlock(bitc::BLOCKINFO_BLOCK_ID)) return true; |
SmallVector<uint64_t, 64> Record; |
- BitstreamReader::BlockInfo *CurBlockInfo = 0; |
+ NaClBitstreamReader::BlockInfo *CurBlockInfo = 0; |
// Read all the records for this module. |
while (1) { |
@@ -368,4 +371,3 @@ bool BitstreamCursor::ReadBlockInfoBlock() { |
} |
} |
} |
- |