llvm.org GIT mirror llvm / b92db75
Make a few helper functions static. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221930 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 6 years ago
2 changed file(s) with 18 addition(s) and 23 deletion(s). Raw diff Collapse all Expand all
489489 // Record Processing
490490 //===--------------------------------------------------------------------===//
491491
492 private:
493 void readAbbreviatedLiteral(const BitCodeAbbrevOp &Op,
494 SmallVectorImpl &Vals);
495 void readAbbreviatedField(const BitCodeAbbrevOp &Op,
496 SmallVectorImpl &Vals);
497 void skipAbbreviatedField(const BitCodeAbbrevOp &Op);
498
499492 public:
500493
501494 /// Return the abbreviation for the specified AbbrevId.
4949 return false;
5050 }
5151
52 void BitstreamCursor::readAbbreviatedLiteral(const BitCodeAbbrevOp &Op,
53 SmallVectorImpl &Vals) {
52 static void readAbbreviatedLiteral(const BitCodeAbbrevOp &Op,
53 SmallVectorImpl &Vals) {
5454 assert(Op.isLiteral() && "Not a literal");
5555 // If the abbrev specifies the literal value to use, use it.
5656 Vals.push_back(Op.getLiteralValue());
5757 }
5858
59 void BitstreamCursor::readAbbreviatedField(const BitCodeAbbrevOp &Op,
60 SmallVectorImpl &Vals) {
59 static void readAbbreviatedField(BitstreamCursor &Cursor,
60 const BitCodeAbbrevOp &Op,
61 SmallVectorImpl &Vals) {
6162 assert(!Op.isLiteral() && "Use ReadAbbreviatedLiteral for literals!");
6263
6364 // Decode the value as we are commanded.
6768 case BitCodeAbbrevOp::Blob:
6869 llvm_unreachable("Should not reach here");
6970 case BitCodeAbbrevOp::Fixed:
70 Val = Read((unsigned)Op.getEncodingData());
71 Val = Cursor.Read((unsigned)Op.getEncodingData());
7172 break;
7273 case BitCodeAbbrevOp::VBR:
73 Val = ReadVBR64((unsigned)Op.getEncodingData());
74 Val = Cursor.ReadVBR64((unsigned)Op.getEncodingData());
7475 break;
7576 case BitCodeAbbrevOp::Char6:
76 Val = BitCodeAbbrevOp::DecodeChar6(Read(6));
77 Val = BitCodeAbbrevOp::DecodeChar6(Cursor.Read(6));
7778 break;
7879 }
7980 Vals.push_back(Val);
8081 }
8182
82 void BitstreamCursor::skipAbbreviatedField(const BitCodeAbbrevOp &Op) {
83 static void skipAbbreviatedField(BitstreamCursor &Cursor,
84 const BitCodeAbbrevOp &Op) {
8385 assert(!Op.isLiteral() && "Use ReadAbbreviatedLiteral for literals!");
8486
8587 // Decode the value as we are commanded.
8890 case BitCodeAbbrevOp::Blob:
8991 llvm_unreachable("Should not reach here");
9092 case BitCodeAbbrevOp::Fixed:
91 (void)Read((unsigned)Op.getEncodingData());
93 Cursor.Read((unsigned)Op.getEncodingData());
9294 break;
9395 case BitCodeAbbrevOp::VBR:
94 (void)ReadVBR64((unsigned)Op.getEncodingData());
96 Cursor.ReadVBR64((unsigned)Op.getEncodingData());
9597 break;
9698 case BitCodeAbbrevOp::Char6:
97 (void)Read(6);
99 Cursor.Read(6);
98100 break;
99101 }
100102 }
122124
123125 if (Op.getEncoding() != BitCodeAbbrevOp::Array &&
124126 Op.getEncoding() != BitCodeAbbrevOp::Blob) {
125 skipAbbreviatedField(Op);
127 skipAbbreviatedField(*this, Op);
126128 continue;
127129 }
128130
136138
137139 // Read all the elements.
138140 for (; NumElts; --NumElts)
139 skipAbbreviatedField(EltEnc);
141 skipAbbreviatedField(*this, EltEnc);
140142 continue;
141143 }
142144
179181 if (CodeOp.isLiteral())
180182 readAbbreviatedLiteral(CodeOp, Vals);
181183 else
182 readAbbreviatedField(CodeOp, Vals);
184 readAbbreviatedField(*this, CodeOp, Vals);
183185 unsigned Code = (unsigned)Vals.pop_back_val();
184186
185187 for (unsigned i = 1, e = Abbv->getNumOperandInfos(); i != e; ++i) {
191193
192194 if (Op.getEncoding() != BitCodeAbbrevOp::Array &&
193195 Op.getEncoding() != BitCodeAbbrevOp::Blob) {
194 readAbbreviatedField(Op, Vals);
196 readAbbreviatedField(*this, Op, Vals);
195197 continue;
196198 }
197199
205207
206208 // Read all the elements.
207209 for (; NumElts; --NumElts)
208 readAbbreviatedField(EltEnc, Vals);
210 readAbbreviatedField(*this, EltEnc, Vals);
209211 continue;
210212 }
211213