blob: 79bb68f55593db9999199bda0920031c49517bb4 [file] [log] [blame]
Chris Lattnere9bb2df2001-12-03 22:26:30 +00001//===- ReadConst.cpp - Code to constants and constant pools ---------------===//
Chris Lattner00950542001-06-06 20:29:01 +00002//
3// This file implements functionality to deserialize constants and entire
4// constant pools.
5//
6// Note that this library should be as fast as possible, reentrant, and
7// threadsafe!!
8//
Chris Lattnere9bb2df2001-12-03 22:26:30 +00009//===----------------------------------------------------------------------===//
Chris Lattner00950542001-06-06 20:29:01 +000010
Chris Lattner7061dc52001-12-03 18:02:31 +000011#include "ReaderInternals.h"
Chris Lattner00950542001-06-06 20:29:01 +000012#include "llvm/Module.h"
13#include "llvm/BasicBlock.h"
Chris Lattnere9bb2df2001-12-03 22:26:30 +000014#include "llvm/ConstantVals.h"
Chris Lattner05950c32001-10-13 06:47:01 +000015#include "llvm/GlobalVariable.h"
Chris Lattner1d670cc2001-09-07 16:37:43 +000016#include <algorithm>
Chris Lattner697954c2002-01-20 22:54:45 +000017#include <iostream>
18using std::make_pair;
19using std::cerr;
Chris Lattner1d670cc2001-09-07 16:37:43 +000020
21const Type *BytecodeParser::parseTypeConstant(const uchar *&Buf,
22 const uchar *EndBuf) {
Chris Lattner00950542001-06-06 20:29:01 +000023 unsigned PrimType;
Chris Lattner1d670cc2001-09-07 16:37:43 +000024 if (read_vbr(Buf, EndBuf, PrimType)) return failure<const Type*>(0);
Chris Lattner00950542001-06-06 20:29:01 +000025
Chris Lattner1d670cc2001-09-07 16:37:43 +000026 const Type *Val = 0;
27 if ((Val = Type::getPrimitiveType((Type::PrimitiveID)PrimType)))
28 return Val;
Chris Lattner00950542001-06-06 20:29:01 +000029
30 switch (PrimType) {
Chris Lattnerc9aa7df2002-03-29 03:51:11 +000031 case Type::FunctionTyID: {
Chris Lattner00950542001-06-06 20:29:01 +000032 unsigned Typ;
Chris Lattner1d670cc2001-09-07 16:37:43 +000033 if (read_vbr(Buf, EndBuf, Typ)) return failure(Val);
Chris Lattner00950542001-06-06 20:29:01 +000034 const Type *RetType = getType(Typ);
Chris Lattner1d670cc2001-09-07 16:37:43 +000035 if (RetType == 0) return failure(Val);
Chris Lattner00950542001-06-06 20:29:01 +000036
Chris Lattnere5a57ee2001-07-25 22:47:55 +000037 unsigned NumParams;
Chris Lattner1d670cc2001-09-07 16:37:43 +000038 if (read_vbr(Buf, EndBuf, NumParams)) return failure(Val);
Chris Lattner00950542001-06-06 20:29:01 +000039
Chris Lattner697954c2002-01-20 22:54:45 +000040 std::vector<const Type*> Params;
Chris Lattnere5a57ee2001-07-25 22:47:55 +000041 while (NumParams--) {
Chris Lattner1d670cc2001-09-07 16:37:43 +000042 if (read_vbr(Buf, EndBuf, Typ)) return failure(Val);
Chris Lattner00950542001-06-06 20:29:01 +000043 const Type *Ty = getType(Typ);
Chris Lattner1d670cc2001-09-07 16:37:43 +000044 if (Ty == 0) return failure(Val);
Chris Lattner00950542001-06-06 20:29:01 +000045 Params.push_back(Ty);
Chris Lattner00950542001-06-06 20:29:01 +000046 }
47
Chris Lattner05950c32001-10-13 06:47:01 +000048 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
49 if (isVarArg) Params.pop_back();
50
Chris Lattnerc9aa7df2002-03-29 03:51:11 +000051 return FunctionType::get(RetType, Params, isVarArg);
Chris Lattner00950542001-06-06 20:29:01 +000052 }
53 case Type::ArrayTyID: {
54 unsigned ElTyp;
Chris Lattner1d670cc2001-09-07 16:37:43 +000055 if (read_vbr(Buf, EndBuf, ElTyp)) return failure(Val);
Chris Lattner00950542001-06-06 20:29:01 +000056 const Type *ElementType = getType(ElTyp);
Chris Lattner1d670cc2001-09-07 16:37:43 +000057 if (ElementType == 0) return failure(Val);
Chris Lattner00950542001-06-06 20:29:01 +000058
Chris Lattner90865152001-12-14 16:30:51 +000059 unsigned NumElements;
Chris Lattner1d670cc2001-09-07 16:37:43 +000060 if (read_vbr(Buf, EndBuf, NumElements)) return failure(Val);
Chris Lattner7eadfa12001-10-24 06:21:22 +000061
62 BCR_TRACE(5, "Array Type Constant #" << ElTyp << " size="
Chris Lattner697954c2002-01-20 22:54:45 +000063 << NumElements << "\n");
Chris Lattner7eadfa12001-10-24 06:21:22 +000064 return ArrayType::get(ElementType, NumElements);
Chris Lattner00950542001-06-06 20:29:01 +000065 }
66 case Type::StructTyID: {
67 unsigned Typ;
Chris Lattner697954c2002-01-20 22:54:45 +000068 std::vector<const Type*> Elements;
Chris Lattner00950542001-06-06 20:29:01 +000069
Chris Lattner1d670cc2001-09-07 16:37:43 +000070 if (read_vbr(Buf, EndBuf, Typ)) return failure(Val);
Chris Lattner00950542001-06-06 20:29:01 +000071 while (Typ) { // List is terminated by void/0 typeid
72 const Type *Ty = getType(Typ);
Chris Lattner1d670cc2001-09-07 16:37:43 +000073 if (Ty == 0) return failure(Val);
Chris Lattner00950542001-06-06 20:29:01 +000074 Elements.push_back(Ty);
75
Chris Lattner1d670cc2001-09-07 16:37:43 +000076 if (read_vbr(Buf, EndBuf, Typ)) return failure(Val);
Chris Lattner00950542001-06-06 20:29:01 +000077 }
78
Chris Lattner7eadfa12001-10-24 06:21:22 +000079 return StructType::get(Elements);
Chris Lattner00950542001-06-06 20:29:01 +000080 }
81 case Type::PointerTyID: {
82 unsigned ElTyp;
Chris Lattner1d670cc2001-09-07 16:37:43 +000083 if (read_vbr(Buf, EndBuf, ElTyp)) return failure(Val);
Chris Lattner697954c2002-01-20 22:54:45 +000084 BCR_TRACE(5, "Pointer Type Constant #" << (ElTyp-14) << "\n");
Chris Lattner00950542001-06-06 20:29:01 +000085 const Type *ElementType = getType(ElTyp);
Chris Lattner1d670cc2001-09-07 16:37:43 +000086 if (ElementType == 0) return failure(Val);
Chris Lattner7eadfa12001-10-24 06:21:22 +000087 return PointerType::get(ElementType);
Chris Lattner00950542001-06-06 20:29:01 +000088 }
89
Chris Lattnerd48d6c72001-10-23 01:53:01 +000090 case Type::OpaqueTyID: {
Chris Lattner7eadfa12001-10-24 06:21:22 +000091 return OpaqueType::get();
Chris Lattnerd48d6c72001-10-23 01:53:01 +000092 }
93
Chris Lattner00950542001-06-06 20:29:01 +000094 default:
95 cerr << __FILE__ << ":" << __LINE__ << ": Don't know how to deserialize"
Chris Lattner7eadfa12001-10-24 06:21:22 +000096 << " primitive Type " << PrimType << "\n";
Chris Lattner1d670cc2001-09-07 16:37:43 +000097 return failure(Val);
Chris Lattner00950542001-06-06 20:29:01 +000098 }
Chris Lattner1d670cc2001-09-07 16:37:43 +000099}
100
101// refineAbstractType - The callback method is invoked when one of the
102// elements of TypeValues becomes more concrete...
103//
104void BytecodeParser::refineAbstractType(const DerivedType *OldType,
105 const Type *NewType) {
Chris Lattnere244a252001-11-03 03:27:53 +0000106 if (OldType == NewType &&
107 OldType->isAbstract()) return; // Type is modified, but same
Chris Lattner05950c32001-10-13 06:47:01 +0000108
Chris Lattner1d670cc2001-09-07 16:37:43 +0000109 TypeValuesListTy::iterator I = find(MethodTypeValues.begin(),
110 MethodTypeValues.end(), OldType);
111 if (I == MethodTypeValues.end()) {
112 I = find(ModuleTypeValues.begin(), ModuleTypeValues.end(), OldType);
113 assert(I != ModuleTypeValues.end() &&
114 "Can't refine a type I don't know about!");
115 }
116
Chris Lattnere244a252001-11-03 03:27:53 +0000117 if (OldType == NewType) {
118 assert(!OldType->isAbstract());
119 I->removeUserFromConcrete();
120 } else {
121 *I = NewType; // Update to point to new, more refined type.
122 }
Chris Lattner1d670cc2001-09-07 16:37:43 +0000123}
124
125
126
127// parseTypeConstants - We have to use this wierd code to handle recursive
128// types. We know that recursive types will only reference the current slab of
129// values in the type plane, but they can forward reference types before they
130// have been read. For example, Type #0 might be '{ Ty#1 }' and Type #1 might
131// be 'Ty#0*'. When reading Type #0, type number one doesn't exist. To fix
132// this ugly problem, we pesimistically insert an opaque type for each type we
133// are about to read. This means that forward references will resolve to
134// something and when we reread the type later, we can replace the opaque type
135// with a new resolved concrete type.
136//
137bool BytecodeParser::parseTypeConstants(const uchar *&Buf, const uchar *EndBuf,
138 TypeValuesListTy &Tab,
139 unsigned NumEntries) {
Chris Lattner05950c32001-10-13 06:47:01 +0000140 assert(Tab.size() == 0 && "should not have read type constants in before!");
Chris Lattner1d670cc2001-09-07 16:37:43 +0000141
142 // Insert a bunch of opaque types to be resolved later...
Chris Lattner7eadfa12001-10-24 06:21:22 +0000143 for (unsigned i = 0; i < NumEntries; ++i)
Chris Lattner1d670cc2001-09-07 16:37:43 +0000144 Tab.push_back(PATypeHandle<Type>(OpaqueType::get(), this));
145
146 // Loop through reading all of the types. Forward types will make use of the
147 // opaque types just inserted.
148 //
Chris Lattner7eadfa12001-10-24 06:21:22 +0000149 for (unsigned i = 0; i < NumEntries; ++i) {
Chris Lattner05950c32001-10-13 06:47:01 +0000150 const Type *NewTy = parseTypeConstant(Buf, EndBuf), *OldTy = Tab[i].get();
Chris Lattner1d670cc2001-09-07 16:37:43 +0000151 if (NewTy == 0) return failure(true);
Chris Lattner7eadfa12001-10-24 06:21:22 +0000152 BCR_TRACE(4, "#" << i << ": Read Type Constant: '" << NewTy <<
153 "' Replacing: " << OldTy << "\n");
Chris Lattner1d670cc2001-09-07 16:37:43 +0000154
155 // Don't insertValue the new type... instead we want to replace the opaque
156 // type with the new concrete value...
157 //
158
159 // Refine the abstract type to the new type. This causes all uses of the
160 // abstract type to use the newty. This also will cause the opaque type
161 // to be deleted...
162 //
Chris Lattner05950c32001-10-13 06:47:01 +0000163 cast<DerivedType>(Tab[i].get())->refineAbstractTypeTo(NewTy);
Chris Lattner1d670cc2001-09-07 16:37:43 +0000164
165 // This should have replace the old opaque type with the new type in the
Chris Lattner05950c32001-10-13 06:47:01 +0000166 // value table... or with a preexisting type that was already in the system
167 assert(Tab[i] != OldTy && "refineAbstractType didn't work!");
Chris Lattner1d670cc2001-09-07 16:37:43 +0000168 }
169
170 BCR_TRACE(5, "Resulting types:\n");
Chris Lattner7eadfa12001-10-24 06:21:22 +0000171 for (unsigned i = 0; i < NumEntries; ++i) {
Chris Lattner05950c32001-10-13 06:47:01 +0000172 BCR_TRACE(5, cast<const Type>(Tab[i]) << "\n");
Chris Lattner1d670cc2001-09-07 16:37:43 +0000173 }
Chris Lattner00950542001-06-06 20:29:01 +0000174 return false;
175}
176
Chris Lattner1d670cc2001-09-07 16:37:43 +0000177
Chris Lattnere9bb2df2001-12-03 22:26:30 +0000178bool BytecodeParser::parseConstantValue(const uchar *&Buf, const uchar *EndBuf,
179 const Type *Ty, Constant *&V) {
Chris Lattner00950542001-06-06 20:29:01 +0000180 switch (Ty->getPrimitiveID()) {
181 case Type::BoolTyID: {
182 unsigned Val;
Chris Lattner3d3f2892001-07-28 17:50:18 +0000183 if (read_vbr(Buf, EndBuf, Val)) return failure(true);
184 if (Val != 0 && Val != 1) return failure(true);
Chris Lattnere9bb2df2001-12-03 22:26:30 +0000185 V = ConstantBool::get(Val == 1);
Chris Lattner00950542001-06-06 20:29:01 +0000186 break;
187 }
188
189 case Type::UByteTyID: // Unsigned integer types...
190 case Type::UShortTyID:
191 case Type::UIntTyID: {
192 unsigned Val;
Chris Lattner3d3f2892001-07-28 17:50:18 +0000193 if (read_vbr(Buf, EndBuf, Val)) return failure(true);
Chris Lattnere9bb2df2001-12-03 22:26:30 +0000194 if (!ConstantUInt::isValueValidForType(Ty, Val)) return failure(true);
195 V = ConstantUInt::get(Ty, Val);
Chris Lattner00950542001-06-06 20:29:01 +0000196 break;
197 }
198
199 case Type::ULongTyID: {
200 uint64_t Val;
Chris Lattner3d3f2892001-07-28 17:50:18 +0000201 if (read_vbr(Buf, EndBuf, Val)) return failure(true);
Chris Lattnere9bb2df2001-12-03 22:26:30 +0000202 V = ConstantUInt::get(Ty, Val);
Chris Lattner00950542001-06-06 20:29:01 +0000203 break;
204 }
205
206 case Type::SByteTyID: // Unsigned integer types...
207 case Type::ShortTyID:
208 case Type::IntTyID: {
209 int Val;
Chris Lattner3d3f2892001-07-28 17:50:18 +0000210 if (read_vbr(Buf, EndBuf, Val)) return failure(true);
Chris Lattnere9bb2df2001-12-03 22:26:30 +0000211 if (!ConstantSInt::isValueValidForType(Ty, Val)) return failure(true);
212 V = ConstantSInt::get(Ty, Val);
Chris Lattner00950542001-06-06 20:29:01 +0000213 break;
214 }
215
216 case Type::LongTyID: {
217 int64_t Val;
Chris Lattner3d3f2892001-07-28 17:50:18 +0000218 if (read_vbr(Buf, EndBuf, Val)) return failure(true);
Chris Lattnere9bb2df2001-12-03 22:26:30 +0000219 V = ConstantSInt::get(Ty, Val);
Chris Lattner00950542001-06-06 20:29:01 +0000220 break;
221 }
222
Chris Lattnera1375302001-07-15 00:17:18 +0000223 case Type::FloatTyID: {
224 float F;
Chris Lattner3d3f2892001-07-28 17:50:18 +0000225 if (input_data(Buf, EndBuf, &F, &F+1)) return failure(true);
Chris Lattnere9bb2df2001-12-03 22:26:30 +0000226 V = ConstantFP::get(Ty, F);
Chris Lattnera1375302001-07-15 00:17:18 +0000227 break;
228 }
229
230 case Type::DoubleTyID: {
231 double Val;
Chris Lattner3d3f2892001-07-28 17:50:18 +0000232 if (input_data(Buf, EndBuf, &Val, &Val+1)) return failure(true);
Chris Lattnere9bb2df2001-12-03 22:26:30 +0000233 V = ConstantFP::get(Ty, Val);
Chris Lattnera1375302001-07-15 00:17:18 +0000234 break;
235 }
236
Chris Lattner00950542001-06-06 20:29:01 +0000237 case Type::TypeTyID:
Chris Lattner1d670cc2001-09-07 16:37:43 +0000238 assert(0 && "Type constants should be handled seperately!!!");
239 abort();
Chris Lattner00950542001-06-06 20:29:01 +0000240
241 case Type::ArrayTyID: {
Chris Lattnerb00c5822001-10-02 03:41:24 +0000242 const ArrayType *AT = cast<const ArrayType>(Ty);
Chris Lattner90865152001-12-14 16:30:51 +0000243 unsigned NumElements = AT->getNumElements();
Chris Lattner00950542001-06-06 20:29:01 +0000244
Chris Lattner697954c2002-01-20 22:54:45 +0000245 std::vector<Constant*> Elements;
Chris Lattner00950542001-06-06 20:29:01 +0000246 while (NumElements--) { // Read all of the elements of the constant.
247 unsigned Slot;
Chris Lattner3d3f2892001-07-28 17:50:18 +0000248 if (read_vbr(Buf, EndBuf, Slot)) return failure(true);
Chris Lattner00950542001-06-06 20:29:01 +0000249 Value *V = getValue(AT->getElementType(), Slot, false);
Chris Lattnere9bb2df2001-12-03 22:26:30 +0000250 if (!V || !isa<Constant>(V)) return failure(true);
251 Elements.push_back(cast<Constant>(V));
Chris Lattner00950542001-06-06 20:29:01 +0000252 }
Chris Lattnere9bb2df2001-12-03 22:26:30 +0000253 V = ConstantArray::get(AT, Elements);
Chris Lattner00950542001-06-06 20:29:01 +0000254 break;
255 }
256
257 case Type::StructTyID: {
Chris Lattnerb00c5822001-10-02 03:41:24 +0000258 const StructType *ST = cast<StructType>(Ty);
Chris Lattner00950542001-06-06 20:29:01 +0000259 const StructType::ElementTypes &ET = ST->getElementTypes();
260
Chris Lattner697954c2002-01-20 22:54:45 +0000261 std::vector<Constant *> Elements;
Chris Lattner00950542001-06-06 20:29:01 +0000262 for (unsigned i = 0; i < ET.size(); ++i) {
263 unsigned Slot;
Chris Lattner3d3f2892001-07-28 17:50:18 +0000264 if (read_vbr(Buf, EndBuf, Slot)) return failure(true);
Chris Lattner00950542001-06-06 20:29:01 +0000265 Value *V = getValue(ET[i], Slot, false);
Chris Lattnere9bb2df2001-12-03 22:26:30 +0000266 if (!V || !isa<Constant>(V))
Chris Lattner3d3f2892001-07-28 17:50:18 +0000267 return failure(true);
Chris Lattnere9bb2df2001-12-03 22:26:30 +0000268 Elements.push_back(cast<Constant>(V));
Chris Lattner00950542001-06-06 20:29:01 +0000269 }
270
Chris Lattnere9bb2df2001-12-03 22:26:30 +0000271 V = ConstantStruct::get(ST, Elements);
Chris Lattner00950542001-06-06 20:29:01 +0000272 break;
273 }
274
Chris Lattner1a1cb112001-09-30 22:46:54 +0000275 case Type::PointerTyID: {
Chris Lattnerb00c5822001-10-02 03:41:24 +0000276 const PointerType *PT = cast<const PointerType>(Ty);
Chris Lattner1a1cb112001-09-30 22:46:54 +0000277 unsigned SubClass;
278 if (read_vbr(Buf, EndBuf, SubClass)) return failure(true);
Chris Lattner05950c32001-10-13 06:47:01 +0000279 switch (SubClass) {
Chris Lattnere9bb2df2001-12-03 22:26:30 +0000280 case 0: // ConstantPointerNull value...
281 V = ConstantPointerNull::get(PT);
Chris Lattner05950c32001-10-13 06:47:01 +0000282 break;
Chris Lattner1a1cb112001-09-30 22:46:54 +0000283
Chris Lattnere9bb2df2001-12-03 22:26:30 +0000284 case 1: { // ConstantPointerRef value...
Chris Lattner05950c32001-10-13 06:47:01 +0000285 unsigned Slot;
286 if (read_vbr(Buf, EndBuf, Slot)) return failure(true);
287 BCR_TRACE(4, "CPPR: Type: '" << Ty << "' slot: " << Slot << "\n");
Chris Lattner1a1cb112001-09-30 22:46:54 +0000288
Chris Lattner05950c32001-10-13 06:47:01 +0000289 // Check to see if we have already read this global variable yet...
290 Value *Val = getValue(PT, Slot, false);
291 GlobalValue *GV;
292 if (Val) {
293 if (!(GV = dyn_cast<GlobalValue>(Val))) return failure(true);
294 BCR_TRACE(5, "Value Found in ValueTable!\n");
295 } else { // Nope... see if we have previously forward ref'd it
296 GlobalRefsType::iterator I = GlobalRefs.find(make_pair(PT, Slot));
297 if (I != GlobalRefs.end()) {
298 BCR_TRACE(5, "Previous forward ref found!\n");
299 GV = I->second;
300 } else {
301 BCR_TRACE(5, "Creating new forward ref variable!\n");
302
303 // Create a placeholder for the global variable reference...
Chris Lattnerd23b1d32001-11-26 18:56:10 +0000304 GlobalVariable *GVar =
Chris Lattner7a176752001-12-04 00:03:30 +0000305 new GlobalVariable(PT->getElementType(), false, true);
Chris Lattner05950c32001-10-13 06:47:01 +0000306
307 // Keep track of the fact that we have a forward ref to recycle it
308 GlobalRefs.insert(make_pair(make_pair(PT, Slot), GVar));
309
310 // Must temporarily push this value into the module table...
311 TheModule->getGlobalList().push_back(GVar);
312 GV = GVar;
313 }
314 }
315
Chris Lattnere9bb2df2001-12-03 22:26:30 +0000316 V = ConstantPointerRef::get(GV);
Chris Lattner05950c32001-10-13 06:47:01 +0000317 break;
318 }
319 default:
Chris Lattner90865152001-12-14 16:30:51 +0000320 BCR_TRACE(5, "UNKNOWN Pointer Constant Type!\n");
Chris Lattner05950c32001-10-13 06:47:01 +0000321 return failure(true);
322 }
Chris Lattner1a1cb112001-09-30 22:46:54 +0000323 break;
324 }
325
Chris Lattner00950542001-06-06 20:29:01 +0000326 default:
327 cerr << __FILE__ << ":" << __LINE__
328 << ": Don't know how to deserialize constant value of type '"
329 << Ty->getName() << "'\n";
Chris Lattner3d3f2892001-07-28 17:50:18 +0000330 return failure(true);
Chris Lattner00950542001-06-06 20:29:01 +0000331 }
Chris Lattner1d670cc2001-09-07 16:37:43 +0000332
Chris Lattner00950542001-06-06 20:29:01 +0000333 return false;
334}
335
336bool BytecodeParser::ParseConstantPool(const uchar *&Buf, const uchar *EndBuf,
Chris Lattner1d670cc2001-09-07 16:37:43 +0000337 ValueTable &Tab,
338 TypeValuesListTy &TypeTab) {
Chris Lattner00950542001-06-06 20:29:01 +0000339 while (Buf < EndBuf) {
340 unsigned NumEntries, Typ;
341
342 if (read_vbr(Buf, EndBuf, NumEntries) ||
Chris Lattner3d3f2892001-07-28 17:50:18 +0000343 read_vbr(Buf, EndBuf, Typ)) return failure(true);
Chris Lattner00950542001-06-06 20:29:01 +0000344 const Type *Ty = getType(Typ);
Chris Lattner3d3f2892001-07-28 17:50:18 +0000345 if (Ty == 0) return failure(true);
Chris Lattner1d670cc2001-09-07 16:37:43 +0000346 BCR_TRACE(3, "Type: '" << Ty << "' NumEntries: " << NumEntries << "\n");
Chris Lattner00950542001-06-06 20:29:01 +0000347
Chris Lattner1d670cc2001-09-07 16:37:43 +0000348 if (Typ == Type::TypeTyID) {
349 if (parseTypeConstants(Buf, EndBuf, TypeTab, NumEntries)) return true;
350 } else {
Chris Lattner7eadfa12001-10-24 06:21:22 +0000351 for (unsigned i = 0; i < NumEntries; ++i) {
Chris Lattnere9bb2df2001-12-03 22:26:30 +0000352 Constant *I;
353 if (parseConstantValue(Buf, EndBuf, Ty, I)) return failure(true);
Chris Lattner1d670cc2001-09-07 16:37:43 +0000354 BCR_TRACE(4, "Read Constant: '" << I << "'\n");
Chris Lattner05950c32001-10-13 06:47:01 +0000355 if (insertValue(I, Tab) == -1) return failure(true);
Chris Lattner1d670cc2001-09-07 16:37:43 +0000356 }
Chris Lattner00950542001-06-06 20:29:01 +0000357 }
358 }
359
Chris Lattner3d3f2892001-07-28 17:50:18 +0000360 if (Buf > EndBuf) return failure(true);
361 return false;
Chris Lattner00950542001-06-06 20:29:01 +0000362}