Make a few helper functions static. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221930 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2014-11-13 21:54:59 +00:00
parent bea87dad5e
commit b92db75a03
2 changed files with 18 additions and 23 deletions

View File

@ -490,13 +490,6 @@ private:
// Record Processing // Record Processing
//===--------------------------------------------------------------------===// //===--------------------------------------------------------------------===//
private:
void readAbbreviatedLiteral(const BitCodeAbbrevOp &Op,
SmallVectorImpl<uint64_t> &Vals);
void readAbbreviatedField(const BitCodeAbbrevOp &Op,
SmallVectorImpl<uint64_t> &Vals);
void skipAbbreviatedField(const BitCodeAbbrevOp &Op);
public: public:
/// Return the abbreviation for the specified AbbrevId. /// Return the abbreviation for the specified AbbrevId.

View File

@ -50,15 +50,16 @@ bool BitstreamCursor::EnterSubBlock(unsigned BlockID, unsigned *NumWordsP) {
return false; return false;
} }
void BitstreamCursor::readAbbreviatedLiteral(const BitCodeAbbrevOp &Op, static void readAbbreviatedLiteral(const BitCodeAbbrevOp &Op,
SmallVectorImpl<uint64_t> &Vals) { SmallVectorImpl<uint64_t> &Vals) {
assert(Op.isLiteral() && "Not a literal"); assert(Op.isLiteral() && "Not a literal");
// If the abbrev specifies the literal value to use, use it. // If the abbrev specifies the literal value to use, use it.
Vals.push_back(Op.getLiteralValue()); Vals.push_back(Op.getLiteralValue());
} }
void BitstreamCursor::readAbbreviatedField(const BitCodeAbbrevOp &Op, static void readAbbreviatedField(BitstreamCursor &Cursor,
SmallVectorImpl<uint64_t> &Vals) { const BitCodeAbbrevOp &Op,
SmallVectorImpl<uint64_t> &Vals) {
assert(!Op.isLiteral() && "Use ReadAbbreviatedLiteral for literals!"); assert(!Op.isLiteral() && "Use ReadAbbreviatedLiteral for literals!");
// Decode the value as we are commanded. // Decode the value as we are commanded.
@ -68,19 +69,20 @@ void BitstreamCursor::readAbbreviatedField(const BitCodeAbbrevOp &Op,
case BitCodeAbbrevOp::Blob: case BitCodeAbbrevOp::Blob:
llvm_unreachable("Should not reach here"); llvm_unreachable("Should not reach here");
case BitCodeAbbrevOp::Fixed: case BitCodeAbbrevOp::Fixed:
Val = Read((unsigned)Op.getEncodingData()); Val = Cursor.Read((unsigned)Op.getEncodingData());
break; break;
case BitCodeAbbrevOp::VBR: case BitCodeAbbrevOp::VBR:
Val = ReadVBR64((unsigned)Op.getEncodingData()); Val = Cursor.ReadVBR64((unsigned)Op.getEncodingData());
break; break;
case BitCodeAbbrevOp::Char6: case BitCodeAbbrevOp::Char6:
Val = BitCodeAbbrevOp::DecodeChar6(Read(6)); Val = BitCodeAbbrevOp::DecodeChar6(Cursor.Read(6));
break; break;
} }
Vals.push_back(Val); Vals.push_back(Val);
} }
void BitstreamCursor::skipAbbreviatedField(const BitCodeAbbrevOp &Op) { static void skipAbbreviatedField(BitstreamCursor &Cursor,
const BitCodeAbbrevOp &Op) {
assert(!Op.isLiteral() && "Use ReadAbbreviatedLiteral for literals!"); assert(!Op.isLiteral() && "Use ReadAbbreviatedLiteral for literals!");
// Decode the value as we are commanded. // Decode the value as we are commanded.
@ -89,13 +91,13 @@ void BitstreamCursor::skipAbbreviatedField(const BitCodeAbbrevOp &Op) {
case BitCodeAbbrevOp::Blob: case BitCodeAbbrevOp::Blob:
llvm_unreachable("Should not reach here"); llvm_unreachable("Should not reach here");
case BitCodeAbbrevOp::Fixed: case BitCodeAbbrevOp::Fixed:
(void)Read((unsigned)Op.getEncodingData()); Cursor.Read((unsigned)Op.getEncodingData());
break; break;
case BitCodeAbbrevOp::VBR: case BitCodeAbbrevOp::VBR:
(void)ReadVBR64((unsigned)Op.getEncodingData()); Cursor.ReadVBR64((unsigned)Op.getEncodingData());
break; break;
case BitCodeAbbrevOp::Char6: case BitCodeAbbrevOp::Char6:
(void)Read(6); Cursor.Read(6);
break; break;
} }
} }
@ -123,7 +125,7 @@ void BitstreamCursor::skipRecord(unsigned AbbrevID) {
if (Op.getEncoding() != BitCodeAbbrevOp::Array && if (Op.getEncoding() != BitCodeAbbrevOp::Array &&
Op.getEncoding() != BitCodeAbbrevOp::Blob) { Op.getEncoding() != BitCodeAbbrevOp::Blob) {
skipAbbreviatedField(Op); skipAbbreviatedField(*this, Op);
continue; continue;
} }
@ -137,7 +139,7 @@ void BitstreamCursor::skipRecord(unsigned AbbrevID) {
// Read all the elements. // Read all the elements.
for (; NumElts; --NumElts) for (; NumElts; --NumElts)
skipAbbreviatedField(EltEnc); skipAbbreviatedField(*this, EltEnc);
continue; continue;
} }
@ -180,7 +182,7 @@ unsigned BitstreamCursor::readRecord(unsigned AbbrevID,
if (CodeOp.isLiteral()) if (CodeOp.isLiteral())
readAbbreviatedLiteral(CodeOp, Vals); readAbbreviatedLiteral(CodeOp, Vals);
else else
readAbbreviatedField(CodeOp, Vals); readAbbreviatedField(*this, CodeOp, Vals);
unsigned Code = (unsigned)Vals.pop_back_val(); unsigned Code = (unsigned)Vals.pop_back_val();
for (unsigned i = 1, e = Abbv->getNumOperandInfos(); i != e; ++i) { for (unsigned i = 1, e = Abbv->getNumOperandInfos(); i != e; ++i) {
@ -192,7 +194,7 @@ unsigned BitstreamCursor::readRecord(unsigned AbbrevID,
if (Op.getEncoding() != BitCodeAbbrevOp::Array && if (Op.getEncoding() != BitCodeAbbrevOp::Array &&
Op.getEncoding() != BitCodeAbbrevOp::Blob) { Op.getEncoding() != BitCodeAbbrevOp::Blob) {
readAbbreviatedField(Op, Vals); readAbbreviatedField(*this, Op, Vals);
continue; continue;
} }
@ -206,7 +208,7 @@ unsigned BitstreamCursor::readRecord(unsigned AbbrevID,
// Read all the elements. // Read all the elements.
for (; NumElts; --NumElts) for (; NumElts; --NumElts)
readAbbreviatedField(EltEnc, Vals); readAbbreviatedField(*this, EltEnc, Vals);
continue; continue;
} }