blob: eec7105b52c34fc8501aeb3f95fbbad95e760441 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001
Dale Johannesencfb19e62007-11-05 21:20:28 +00002/* A Bison parser, made from /Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y
Dale Johannesen3afee192007-09-07 21:07:57 +00003 by GNU Bison version 1.28 */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004
Dale Johannesen3afee192007-09-07 21:07:57 +00005#define YYBISON 1 /* Identify Bison output. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006
7#define yyparse llvmAsmparse
Dale Johannesen3afee192007-09-07 21:07:57 +00008#define yylex llvmAsmlex
Dan Gohmanf17a25c2007-07-18 16:29:46 +00009#define yyerror llvmAsmerror
Dale Johannesen3afee192007-09-07 21:07:57 +000010#define yylval llvmAsmlval
11#define yychar llvmAsmchar
Dan Gohmanf17a25c2007-07-18 16:29:46 +000012#define yydebug llvmAsmdebug
13#define yynerrs llvmAsmnerrs
Dale Johannesen3afee192007-09-07 21:07:57 +000014#define ESINT64VAL 257
15#define EUINT64VAL 258
16#define ESAPINTVAL 259
17#define EUAPINTVAL 260
18#define LOCALVAL_ID 261
19#define GLOBALVAL_ID 262
20#define FPVAL 263
21#define VOID 264
22#define INTTYPE 265
23#define FLOAT 266
24#define DOUBLE 267
25#define X86_FP80 268
26#define FP128 269
27#define PPC_FP128 270
28#define LABEL 271
29#define TYPE 272
30#define LOCALVAR 273
31#define GLOBALVAR 274
32#define LABELSTR 275
33#define STRINGCONSTANT 276
34#define ATSTRINGCONSTANT 277
35#define PCTSTRINGCONSTANT 278
36#define ZEROINITIALIZER 279
37#define TRUETOK 280
38#define FALSETOK 281
39#define BEGINTOK 282
40#define ENDTOK 283
41#define DECLARE 284
42#define DEFINE 285
43#define GLOBAL 286
44#define CONSTANT 287
45#define SECTION 288
46#define ALIAS 289
47#define VOLATILE 290
48#define THREAD_LOCAL 291
49#define TO 292
50#define DOTDOTDOT 293
51#define NULL_TOK 294
52#define UNDEF 295
53#define INTERNAL 296
54#define LINKONCE 297
55#define WEAK 298
56#define APPENDING 299
57#define DLLIMPORT 300
58#define DLLEXPORT 301
59#define EXTERN_WEAK 302
60#define OPAQUE 303
61#define EXTERNAL 304
62#define TARGET 305
63#define TRIPLE 306
64#define ALIGN 307
65#define DEPLIBS 308
66#define CALL 309
67#define TAIL 310
68#define ASM_TOK 311
69#define MODULE 312
70#define SIDEEFFECT 313
71#define CC_TOK 314
72#define CCC_TOK 315
73#define FASTCC_TOK 316
74#define COLDCC_TOK 317
75#define X86_STDCALLCC_TOK 318
76#define X86_FASTCALLCC_TOK 319
77#define DATALAYOUT 320
78#define RET 321
79#define BR 322
80#define SWITCH 323
81#define INVOKE 324
82#define UNWIND 325
83#define UNREACHABLE 326
84#define ADD 327
85#define SUB 328
86#define MUL 329
87#define UDIV 330
88#define SDIV 331
89#define FDIV 332
90#define UREM 333
91#define SREM 334
92#define FREM 335
93#define AND 336
94#define OR 337
95#define XOR 338
96#define SHL 339
97#define LSHR 340
98#define ASHR 341
99#define ICMP 342
100#define FCMP 343
101#define EQ 344
102#define NE 345
103#define SLT 346
104#define SGT 347
105#define SLE 348
106#define SGE 349
107#define ULT 350
108#define UGT 351
109#define ULE 352
110#define UGE 353
111#define OEQ 354
112#define ONE 355
113#define OLT 356
114#define OGT 357
115#define OLE 358
116#define OGE 359
117#define ORD 360
118#define UNO 361
119#define UEQ 362
120#define UNE 363
121#define MALLOC 364
122#define ALLOCA 365
123#define FREE 366
124#define LOAD 367
125#define STORE 368
126#define GETELEMENTPTR 369
127#define TRUNC 370
128#define ZEXT 371
129#define SEXT 372
130#define FPTRUNC 373
131#define FPEXT 374
132#define BITCAST 375
133#define UITOFP 376
134#define SITOFP 377
135#define FPTOUI 378
136#define FPTOSI 379
137#define INTTOPTR 380
138#define PTRTOINT 381
139#define PHI_TOK 382
140#define SELECT 383
141#define VAARG 384
142#define EXTRACTELEMENT 385
143#define INSERTELEMENT 386
144#define SHUFFLEVECTOR 387
145#define SIGNEXT 388
146#define ZEROEXT 389
147#define NORETURN 390
148#define INREG 391
149#define SRET 392
150#define NOUNWIND 393
151#define NOALIAS 394
152#define BYVAL 395
153#define NEST 396
154#define DEFAULT 397
155#define HIDDEN 398
156#define PROTECTED 399
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000157
Dale Johannesencfb19e62007-11-05 21:20:28 +0000158#line 14 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000159
160#include "ParserInternals.h"
161#include "llvm/CallingConv.h"
162#include "llvm/InlineAsm.h"
163#include "llvm/Instructions.h"
164#include "llvm/Module.h"
165#include "llvm/ValueSymbolTable.h"
Chandler Carruth563d4a42007-08-04 01:56:21 +0000166#include "llvm/AutoUpgrade.h"
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000167#include "llvm/Support/GetElementPtrTypeIterator.h"
168#include "llvm/Support/CommandLine.h"
169#include "llvm/ADT/SmallVector.h"
170#include "llvm/ADT/STLExtras.h"
171#include "llvm/Support/MathExtras.h"
172#include "llvm/Support/Streams.h"
173#include <algorithm>
174#include <list>
175#include <map>
176#include <utility>
177#ifndef NDEBUG
178#define YYDEBUG 1
179#endif
180
181// The following is a gross hack. In order to rid the libAsmParser library of
182// exceptions, we have to have a way of getting the yyparse function to go into
183// an error situation. So, whenever we want an error to occur, the GenerateError
184// function (see bottom of file) sets TriggerError. Then, at the end of each
185// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
186// (a goto) to put YACC in error state. Furthermore, several calls to
187// GenerateError are made from inside productions and they must simulate the
188// previous exception behavior by exiting the production immediately. We have
189// replaced these with the GEN_ERROR macro which calls GeneratError and then
190// immediately invokes YYERROR. This would be so much cleaner if it was a
191// recursive descent parser.
192static bool TriggerError = false;
193#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
194#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
195
196int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
197int yylex(); // declaration" of xxx warnings.
198int yyparse();
199
200namespace llvm {
201 std::string CurFilename;
202#if YYDEBUG
203static cl::opt<bool>
204Debug("debug-yacc", cl::desc("Print yacc debug state changes"),
205 cl::Hidden, cl::init(false));
206#endif
207}
208using namespace llvm;
209
210static Module *ParserResult;
211
212// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
213// relating to upreferences in the input stream.
214//
215//#define DEBUG_UPREFS 1
216#ifdef DEBUG_UPREFS
217#define UR_OUT(X) cerr << X
218#else
219#define UR_OUT(X)
220#endif
221
222#define YYERROR_VERBOSE 1
223
224static GlobalVariable *CurGV;
225
226
227// This contains info used when building the body of a function. It is
228// destroyed when the function is completed.
229//
230typedef std::vector<Value *> ValueList; // Numbered defs
231
232static void
233ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
234
235static struct PerModuleInfo {
236 Module *CurrentModule;
237 ValueList Values; // Module level numbered definitions
238 ValueList LateResolveValues;
239 std::vector<PATypeHolder> Types;
240 std::map<ValID, PATypeHolder> LateResolveTypes;
241
242 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
243 /// how they were referenced and on which line of the input they came from so
244 /// that we can resolve them later and print error messages as appropriate.
245 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
246
247 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
248 // references to global values. Global values may be referenced before they
249 // are defined, and if so, the temporary object that they represent is held
250 // here. This is used for forward references of GlobalValues.
251 //
252 typedef std::map<std::pair<const PointerType *,
253 ValID>, GlobalValue*> GlobalRefsType;
254 GlobalRefsType GlobalRefs;
255
256 void ModuleDone() {
257 // If we could not resolve some functions at function compilation time
258 // (calls to functions before they are defined), resolve them now... Types
259 // are resolved when the constant pool has been completely parsed.
260 //
261 ResolveDefinitions(LateResolveValues);
262 if (TriggerError)
263 return;
264
265 // Check to make sure that all global value forward references have been
266 // resolved!
267 //
268 if (!GlobalRefs.empty()) {
269 std::string UndefinedReferences = "Unresolved global references exist:\n";
270
271 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
272 I != E; ++I) {
273 UndefinedReferences += " " + I->first.first->getDescription() + " " +
274 I->first.second.getName() + "\n";
275 }
276 GenerateError(UndefinedReferences);
277 return;
278 }
279
Chandler Carruth563d4a42007-08-04 01:56:21 +0000280 // Look for intrinsic functions and CallInst that need to be upgraded
281 for (Module::iterator FI = CurrentModule->begin(),
282 FE = CurrentModule->end(); FI != FE; )
283 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
284
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000285 Values.clear(); // Clear out function local definitions
286 Types.clear();
287 CurrentModule = 0;
288 }
289
290 // GetForwardRefForGlobal - Check to see if there is a forward reference
291 // for this global. If so, remove it from the GlobalRefs map and return it.
292 // If not, just return null.
293 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
294 // Check to see if there is a forward reference to this global variable...
295 // if there is, eliminate it and patch the reference to use the new def'n.
296 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
297 GlobalValue *Ret = 0;
298 if (I != GlobalRefs.end()) {
299 Ret = I->second;
300 GlobalRefs.erase(I);
301 }
302 return Ret;
303 }
304
305 bool TypeIsUnresolved(PATypeHolder* PATy) {
306 // If it isn't abstract, its resolved
307 const Type* Ty = PATy->get();
308 if (!Ty->isAbstract())
309 return false;
310 // Traverse the type looking for abstract types. If it isn't abstract then
311 // we don't need to traverse that leg of the type.
312 std::vector<const Type*> WorkList, SeenList;
313 WorkList.push_back(Ty);
314 while (!WorkList.empty()) {
315 const Type* Ty = WorkList.back();
316 SeenList.push_back(Ty);
317 WorkList.pop_back();
318 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
319 // Check to see if this is an unresolved type
320 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
321 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
322 for ( ; I != E; ++I) {
323 if (I->second.get() == OpTy)
324 return true;
325 }
326 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
327 const Type* TheTy = SeqTy->getElementType();
328 if (TheTy->isAbstract() && TheTy != Ty) {
329 std::vector<const Type*>::iterator I = SeenList.begin(),
330 E = SeenList.end();
331 for ( ; I != E; ++I)
332 if (*I == TheTy)
333 break;
334 if (I == E)
335 WorkList.push_back(TheTy);
336 }
337 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
338 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
339 const Type* TheTy = StrTy->getElementType(i);
340 if (TheTy->isAbstract() && TheTy != Ty) {
341 std::vector<const Type*>::iterator I = SeenList.begin(),
342 E = SeenList.end();
343 for ( ; I != E; ++I)
344 if (*I == TheTy)
345 break;
346 if (I == E)
347 WorkList.push_back(TheTy);
348 }
349 }
350 }
351 }
352 return false;
353 }
354} CurModule;
355
356static struct PerFunctionInfo {
357 Function *CurrentFunction; // Pointer to current function being created
358
359 ValueList Values; // Keep track of #'d definitions
360 unsigned NextValNum;
361 ValueList LateResolveValues;
362 bool isDeclare; // Is this function a forward declararation?
363 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
364 GlobalValue::VisibilityTypes Visibility;
365
366 /// BBForwardRefs - When we see forward references to basic blocks, keep
367 /// track of them here.
368 std::map<ValID, BasicBlock*> BBForwardRefs;
369
370 inline PerFunctionInfo() {
371 CurrentFunction = 0;
372 isDeclare = false;
373 Linkage = GlobalValue::ExternalLinkage;
374 Visibility = GlobalValue::DefaultVisibility;
375 }
376
377 inline void FunctionStart(Function *M) {
378 CurrentFunction = M;
379 NextValNum = 0;
380 }
381
382 void FunctionDone() {
383 // Any forward referenced blocks left?
384 if (!BBForwardRefs.empty()) {
385 GenerateError("Undefined reference to label " +
386 BBForwardRefs.begin()->second->getName());
387 return;
388 }
389
390 // Resolve all forward references now.
391 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
392
393 Values.clear(); // Clear out function local definitions
394 BBForwardRefs.clear();
395 CurrentFunction = 0;
396 isDeclare = false;
397 Linkage = GlobalValue::ExternalLinkage;
398 Visibility = GlobalValue::DefaultVisibility;
399 }
400} CurFun; // Info for the current function...
401
402static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
403
404
405//===----------------------------------------------------------------------===//
406// Code to handle definitions of all the types
407//===----------------------------------------------------------------------===//
408
409static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
410 // Things that have names or are void typed don't get slot numbers
411 if (V->hasName() || (V->getType() == Type::VoidTy))
412 return;
413
414 // In the case of function values, we have to allow for the forward reference
415 // of basic blocks, which are included in the numbering. Consequently, we keep
416 // track of the next insertion location with NextValNum. When a BB gets
417 // inserted, it could change the size of the CurFun.Values vector.
418 if (&ValueTab == &CurFun.Values) {
419 if (ValueTab.size() <= CurFun.NextValNum)
420 ValueTab.resize(CurFun.NextValNum+1);
421 ValueTab[CurFun.NextValNum++] = V;
422 return;
423 }
424 // For all other lists, its okay to just tack it on the back of the vector.
425 ValueTab.push_back(V);
426}
427
428static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
429 switch (D.Type) {
430 case ValID::LocalID: // Is it a numbered definition?
431 // Module constants occupy the lowest numbered slots...
432 if (D.Num < CurModule.Types.size())
433 return CurModule.Types[D.Num];
434 break;
435 case ValID::LocalName: // Is it a named definition?
436 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
437 D.destroy(); // Free old strdup'd memory...
438 return N;
439 }
440 break;
441 default:
442 GenerateError("Internal parser error: Invalid symbol type reference");
443 return 0;
444 }
445
446 // If we reached here, we referenced either a symbol that we don't know about
447 // or an id number that hasn't been read yet. We may be referencing something
448 // forward, so just create an entry to be resolved later and get to it...
449 //
450 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
451
452
453 if (inFunctionScope()) {
454 if (D.Type == ValID::LocalName) {
455 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
456 return 0;
457 } else {
458 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
459 return 0;
460 }
461 }
462
463 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
464 if (I != CurModule.LateResolveTypes.end())
465 return I->second;
466
467 Type *Typ = OpaqueType::get();
468 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
469 return Typ;
470 }
471
472// getExistingVal - Look up the value specified by the provided type and
473// the provided ValID. If the value exists and has already been defined, return
474// it. Otherwise return null.
475//
476static Value *getExistingVal(const Type *Ty, const ValID &D) {
477 if (isa<FunctionType>(Ty)) {
478 GenerateError("Functions are not values and "
479 "must be referenced as pointers");
480 return 0;
481 }
482
483 switch (D.Type) {
484 case ValID::LocalID: { // Is it a numbered definition?
485 // Check that the number is within bounds.
486 if (D.Num >= CurFun.Values.size())
487 return 0;
488 Value *Result = CurFun.Values[D.Num];
489 if (Ty != Result->getType()) {
490 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
491 Result->getType()->getDescription() + "' does not match "
492 "expected type, '" + Ty->getDescription() + "'");
493 return 0;
494 }
495 return Result;
496 }
497 case ValID::GlobalID: { // Is it a numbered definition?
498 if (D.Num >= CurModule.Values.size())
499 return 0;
500 Value *Result = CurModule.Values[D.Num];
501 if (Ty != Result->getType()) {
502 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
503 Result->getType()->getDescription() + "' does not match "
504 "expected type, '" + Ty->getDescription() + "'");
505 return 0;
506 }
507 return Result;
508 }
509
510 case ValID::LocalName: { // Is it a named definition?
511 if (!inFunctionScope())
512 return 0;
513 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
514 Value *N = SymTab.lookup(D.getName());
515 if (N == 0)
516 return 0;
517 if (N->getType() != Ty)
518 return 0;
519
520 D.destroy(); // Free old strdup'd memory...
521 return N;
522 }
523 case ValID::GlobalName: { // Is it a named definition?
524 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
525 Value *N = SymTab.lookup(D.getName());
526 if (N == 0)
527 return 0;
528 if (N->getType() != Ty)
529 return 0;
530
531 D.destroy(); // Free old strdup'd memory...
532 return N;
533 }
534
535 // Check to make sure that "Ty" is an integral type, and that our
536 // value will fit into the specified type...
537 case ValID::ConstSIntVal: // Is it a constant pool reference??
538 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
539 GenerateError("Signed integral constant '" +
540 itostr(D.ConstPool64) + "' is invalid for type '" +
541 Ty->getDescription() + "'");
542 return 0;
543 }
544 return ConstantInt::get(Ty, D.ConstPool64, true);
545
546 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
547 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
548 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
549 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
550 "' is invalid or out of range");
551 return 0;
552 } else { // This is really a signed reference. Transmogrify.
553 return ConstantInt::get(Ty, D.ConstPool64, true);
554 }
555 } else {
556 return ConstantInt::get(Ty, D.UConstPool64);
557 }
558
559 case ValID::ConstFPVal: // Is it a floating point const pool reference?
Dale Johannesen3afee192007-09-07 21:07:57 +0000560 if (!ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000561 GenerateError("FP constant invalid for type");
562 return 0;
563 }
Dale Johannesen255b8fe2007-09-11 18:33:39 +0000564 // Lexer has no type info, so builds all float and double FP constants
565 // as double. Fix this here. Long double does not need this.
566 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
567 Ty==Type::FloatTy)
Dale Johannesen3afee192007-09-07 21:07:57 +0000568 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
569 return ConstantFP::get(Ty, *D.ConstPoolFP);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000570
571 case ValID::ConstNullVal: // Is it a null value?
572 if (!isa<PointerType>(Ty)) {
573 GenerateError("Cannot create a a non pointer null");
574 return 0;
575 }
576 return ConstantPointerNull::get(cast<PointerType>(Ty));
577
578 case ValID::ConstUndefVal: // Is it an undef value?
579 return UndefValue::get(Ty);
580
581 case ValID::ConstZeroVal: // Is it a zero value?
582 return Constant::getNullValue(Ty);
583
584 case ValID::ConstantVal: // Fully resolved constant?
585 if (D.ConstantValue->getType() != Ty) {
586 GenerateError("Constant expression type different from required type");
587 return 0;
588 }
589 return D.ConstantValue;
590
591 case ValID::InlineAsmVal: { // Inline asm expression
592 const PointerType *PTy = dyn_cast<PointerType>(Ty);
593 const FunctionType *FTy =
594 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
595 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
596 GenerateError("Invalid type for asm constraint string");
597 return 0;
598 }
599 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
600 D.IAD->HasSideEffects);
601 D.destroy(); // Free InlineAsmDescriptor.
602 return IA;
603 }
604 default:
605 assert(0 && "Unhandled case!");
606 return 0;
607 } // End of switch
608
609 assert(0 && "Unhandled case!");
610 return 0;
611}
612
613// getVal - This function is identical to getExistingVal, except that if a
614// value is not already defined, it "improvises" by creating a placeholder var
615// that looks and acts just like the requested variable. When the value is
616// defined later, all uses of the placeholder variable are replaced with the
617// real thing.
618//
619static Value *getVal(const Type *Ty, const ValID &ID) {
620 if (Ty == Type::LabelTy) {
621 GenerateError("Cannot use a basic block here");
622 return 0;
623 }
624
625 // See if the value has already been defined.
626 Value *V = getExistingVal(Ty, ID);
627 if (V) return V;
628 if (TriggerError) return 0;
629
630 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
631 GenerateError("Invalid use of a composite type");
632 return 0;
633 }
634
635 // If we reached here, we referenced either a symbol that we don't know about
636 // or an id number that hasn't been read yet. We may be referencing something
637 // forward, so just create an entry to be resolved later and get to it...
638 //
639 switch (ID.Type) {
640 case ValID::GlobalName:
641 case ValID::GlobalID: {
642 const PointerType *PTy = dyn_cast<PointerType>(Ty);
643 if (!PTy) {
644 GenerateError("Invalid type for reference to global" );
645 return 0;
646 }
647 const Type* ElTy = PTy->getElementType();
648 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
649 V = new Function(FTy, GlobalValue::ExternalLinkage);
650 else
651 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage);
652 break;
653 }
654 default:
655 V = new Argument(Ty);
656 }
657
658 // Remember where this forward reference came from. FIXME, shouldn't we try
659 // to recycle these things??
660 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
661 llvmAsmlineno)));
662
663 if (inFunctionScope())
664 InsertValue(V, CurFun.LateResolveValues);
665 else
666 InsertValue(V, CurModule.LateResolveValues);
667 return V;
668}
669
670/// defineBBVal - This is a definition of a new basic block with the specified
671/// identifier which must be the same as CurFun.NextValNum, if its numeric.
672static BasicBlock *defineBBVal(const ValID &ID) {
673 assert(inFunctionScope() && "Can't get basic block at global scope!");
674
675 BasicBlock *BB = 0;
676
677 // First, see if this was forward referenced
678
679 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
680 if (BBI != CurFun.BBForwardRefs.end()) {
681 BB = BBI->second;
682 // The forward declaration could have been inserted anywhere in the
683 // function: insert it into the correct place now.
684 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
685 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
686
687 // We're about to erase the entry, save the key so we can clean it up.
688 ValID Tmp = BBI->first;
689
690 // Erase the forward ref from the map as its no longer "forward"
691 CurFun.BBForwardRefs.erase(ID);
692
693 // The key has been removed from the map but so we don't want to leave
694 // strdup'd memory around so destroy it too.
695 Tmp.destroy();
696
697 // If its a numbered definition, bump the number and set the BB value.
698 if (ID.Type == ValID::LocalID) {
699 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
700 InsertValue(BB);
701 }
702
703 ID.destroy();
704 return BB;
705 }
706
707 // We haven't seen this BB before and its first mention is a definition.
708 // Just create it and return it.
709 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
710 BB = new BasicBlock(Name, CurFun.CurrentFunction);
711 if (ID.Type == ValID::LocalID) {
712 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
713 InsertValue(BB);
714 }
715
716 ID.destroy(); // Free strdup'd memory
717 return BB;
718}
719
720/// getBBVal - get an existing BB value or create a forward reference for it.
721///
722static BasicBlock *getBBVal(const ValID &ID) {
723 assert(inFunctionScope() && "Can't get basic block at global scope!");
724
725 BasicBlock *BB = 0;
726
727 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
728 if (BBI != CurFun.BBForwardRefs.end()) {
729 BB = BBI->second;
730 } if (ID.Type == ValID::LocalName) {
731 std::string Name = ID.getName();
732 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
733 if (N)
734 if (N->getType()->getTypeID() == Type::LabelTyID)
735 BB = cast<BasicBlock>(N);
736 else
737 GenerateError("Reference to label '" + Name + "' is actually of type '"+
738 N->getType()->getDescription() + "'");
739 } else if (ID.Type == ValID::LocalID) {
740 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
741 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
742 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
743 else
744 GenerateError("Reference to label '%" + utostr(ID.Num) +
745 "' is actually of type '"+
746 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
747 }
748 } else {
749 GenerateError("Illegal label reference " + ID.getName());
750 return 0;
751 }
752
753 // If its already been defined, return it now.
754 if (BB) {
755 ID.destroy(); // Free strdup'd memory.
756 return BB;
757 }
758
759 // Otherwise, this block has not been seen before, create it.
760 std::string Name;
761 if (ID.Type == ValID::LocalName)
762 Name = ID.getName();
763 BB = new BasicBlock(Name, CurFun.CurrentFunction);
764
765 // Insert it in the forward refs map.
766 CurFun.BBForwardRefs[ID] = BB;
767
768 return BB;
769}
770
771
772//===----------------------------------------------------------------------===//
773// Code to handle forward references in instructions
774//===----------------------------------------------------------------------===//
775//
776// This code handles the late binding needed with statements that reference
777// values not defined yet... for example, a forward branch, or the PHI node for
778// a loop body.
779//
780// This keeps a table (CurFun.LateResolveValues) of all such forward references
781// and back patchs after we are done.
782//
783
784// ResolveDefinitions - If we could not resolve some defs at parsing
785// time (forward branches, phi functions for loops, etc...) resolve the
786// defs now...
787//
788static void
789ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
790 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
791 while (!LateResolvers.empty()) {
792 Value *V = LateResolvers.back();
793 LateResolvers.pop_back();
794
795 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
796 CurModule.PlaceHolderInfo.find(V);
797 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
798
799 ValID &DID = PHI->second.first;
800
801 Value *TheRealValue = getExistingVal(V->getType(), DID);
802 if (TriggerError)
803 return;
804 if (TheRealValue) {
805 V->replaceAllUsesWith(TheRealValue);
806 delete V;
807 CurModule.PlaceHolderInfo.erase(PHI);
808 } else if (FutureLateResolvers) {
809 // Functions have their unresolved items forwarded to the module late
810 // resolver table
811 InsertValue(V, *FutureLateResolvers);
812 } else {
813 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
814 GenerateError("Reference to an invalid definition: '" +DID.getName()+
815 "' of type '" + V->getType()->getDescription() + "'",
816 PHI->second.second);
817 return;
818 } else {
819 GenerateError("Reference to an invalid definition: #" +
820 itostr(DID.Num) + " of type '" +
821 V->getType()->getDescription() + "'",
822 PHI->second.second);
823 return;
824 }
825 }
826 }
827 LateResolvers.clear();
828}
829
830// ResolveTypeTo - A brand new type was just declared. This means that (if
831// name is not null) things referencing Name can be resolved. Otherwise, things
832// refering to the number can be resolved. Do this now.
833//
834static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
835 ValID D;
836 if (Name)
837 D = ValID::createLocalName(*Name);
838 else
839 D = ValID::createLocalID(CurModule.Types.size());
840
841 std::map<ValID, PATypeHolder>::iterator I =
842 CurModule.LateResolveTypes.find(D);
843 if (I != CurModule.LateResolveTypes.end()) {
844 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
845 CurModule.LateResolveTypes.erase(I);
846 }
847}
848
849// setValueName - Set the specified value to the name given. The name may be
850// null potentially, in which case this is a noop. The string passed in is
851// assumed to be a malloc'd string buffer, and is free'd by this function.
852//
853static void setValueName(Value *V, std::string *NameStr) {
854 if (!NameStr) return;
855 std::string Name(*NameStr); // Copy string
856 delete NameStr; // Free old string
857
858 if (V->getType() == Type::VoidTy) {
859 GenerateError("Can't assign name '" + Name+"' to value with void type");
860 return;
861 }
862
863 assert(inFunctionScope() && "Must be in function scope!");
864 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
865 if (ST.lookup(Name)) {
866 GenerateError("Redefinition of value '" + Name + "' of type '" +
867 V->getType()->getDescription() + "'");
868 return;
869 }
870
871 // Set the name.
872 V->setName(Name);
873}
874
875/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
876/// this is a declaration, otherwise it is a definition.
877static GlobalVariable *
878ParseGlobalVariable(std::string *NameStr,
879 GlobalValue::LinkageTypes Linkage,
880 GlobalValue::VisibilityTypes Visibility,
881 bool isConstantGlobal, const Type *Ty,
882 Constant *Initializer, bool IsThreadLocal) {
883 if (isa<FunctionType>(Ty)) {
884 GenerateError("Cannot declare global vars of function type");
885 return 0;
886 }
887
888 const PointerType *PTy = PointerType::get(Ty);
889
890 std::string Name;
891 if (NameStr) {
892 Name = *NameStr; // Copy string
893 delete NameStr; // Free old string
894 }
895
896 // See if this global value was forward referenced. If so, recycle the
897 // object.
898 ValID ID;
899 if (!Name.empty()) {
900 ID = ValID::createGlobalName(Name);
901 } else {
902 ID = ValID::createGlobalID(CurModule.Values.size());
903 }
904
905 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
906 // Move the global to the end of the list, from whereever it was
907 // previously inserted.
908 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
909 CurModule.CurrentModule->getGlobalList().remove(GV);
910 CurModule.CurrentModule->getGlobalList().push_back(GV);
911 GV->setInitializer(Initializer);
912 GV->setLinkage(Linkage);
913 GV->setVisibility(Visibility);
914 GV->setConstant(isConstantGlobal);
915 GV->setThreadLocal(IsThreadLocal);
916 InsertValue(GV, CurModule.Values);
917 return GV;
918 }
919
920 // If this global has a name
921 if (!Name.empty()) {
922 // if the global we're parsing has an initializer (is a definition) and
923 // has external linkage.
924 if (Initializer && Linkage != GlobalValue::InternalLinkage)
925 // If there is already a global with external linkage with this name
926 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
927 // If we allow this GVar to get created, it will be renamed in the
928 // symbol table because it conflicts with an existing GVar. We can't
929 // allow redefinition of GVars whose linking indicates that their name
930 // must stay the same. Issue the error.
931 GenerateError("Redefinition of global variable named '" + Name +
932 "' of type '" + Ty->getDescription() + "'");
933 return 0;
934 }
935 }
936
937 // Otherwise there is no existing GV to use, create one now.
938 GlobalVariable *GV =
939 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
940 CurModule.CurrentModule, IsThreadLocal);
941 GV->setVisibility(Visibility);
942 InsertValue(GV, CurModule.Values);
943 return GV;
944}
945
946// setTypeName - Set the specified type to the name given. The name may be
947// null potentially, in which case this is a noop. The string passed in is
948// assumed to be a malloc'd string buffer, and is freed by this function.
949//
950// This function returns true if the type has already been defined, but is
951// allowed to be redefined in the specified context. If the name is a new name
952// for the type plane, it is inserted and false is returned.
953static bool setTypeName(const Type *T, std::string *NameStr) {
954 assert(!inFunctionScope() && "Can't give types function-local names!");
955 if (NameStr == 0) return false;
956
957 std::string Name(*NameStr); // Copy string
958 delete NameStr; // Free old string
959
960 // We don't allow assigning names to void type
961 if (T == Type::VoidTy) {
962 GenerateError("Can't assign name '" + Name + "' to the void type");
963 return false;
964 }
965
966 // Set the type name, checking for conflicts as we do so.
967 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
968
969 if (AlreadyExists) { // Inserting a name that is already defined???
970 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
971 assert(Existing && "Conflict but no matching type?!");
972
973 // There is only one case where this is allowed: when we are refining an
974 // opaque type. In this case, Existing will be an opaque type.
975 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
976 // We ARE replacing an opaque type!
977 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
978 return true;
979 }
980
981 // Otherwise, this is an attempt to redefine a type. That's okay if
982 // the redefinition is identical to the original. This will be so if
983 // Existing and T point to the same Type object. In this one case we
984 // allow the equivalent redefinition.
985 if (Existing == T) return true; // Yes, it's equal.
986
987 // Any other kind of (non-equivalent) redefinition is an error.
988 GenerateError("Redefinition of type named '" + Name + "' of type '" +
989 T->getDescription() + "'");
990 }
991
992 return false;
993}
994
995//===----------------------------------------------------------------------===//
996// Code for handling upreferences in type names...
997//
998
999// TypeContains - Returns true if Ty directly contains E in it.
1000//
1001static bool TypeContains(const Type *Ty, const Type *E) {
1002 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1003 E) != Ty->subtype_end();
1004}
1005
1006namespace {
1007 struct UpRefRecord {
1008 // NestingLevel - The number of nesting levels that need to be popped before
1009 // this type is resolved.
1010 unsigned NestingLevel;
1011
1012 // LastContainedTy - This is the type at the current binding level for the
1013 // type. Every time we reduce the nesting level, this gets updated.
1014 const Type *LastContainedTy;
1015
1016 // UpRefTy - This is the actual opaque type that the upreference is
1017 // represented with.
1018 OpaqueType *UpRefTy;
1019
1020 UpRefRecord(unsigned NL, OpaqueType *URTy)
1021 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1022 };
1023}
1024
1025// UpRefs - A list of the outstanding upreferences that need to be resolved.
1026static std::vector<UpRefRecord> UpRefs;
1027
1028/// HandleUpRefs - Every time we finish a new layer of types, this function is
1029/// called. It loops through the UpRefs vector, which is a list of the
1030/// currently active types. For each type, if the up reference is contained in
1031/// the newly completed type, we decrement the level count. When the level
1032/// count reaches zero, the upreferenced type is the type that is passed in:
1033/// thus we can complete the cycle.
1034///
1035static PATypeHolder HandleUpRefs(const Type *ty) {
1036 // If Ty isn't abstract, or if there are no up-references in it, then there is
1037 // nothing to resolve here.
1038 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1039
1040 PATypeHolder Ty(ty);
1041 UR_OUT("Type '" << Ty->getDescription() <<
1042 "' newly formed. Resolving upreferences.\n" <<
1043 UpRefs.size() << " upreferences active!\n");
1044
1045 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1046 // to zero), we resolve them all together before we resolve them to Ty. At
1047 // the end of the loop, if there is anything to resolve to Ty, it will be in
1048 // this variable.
1049 OpaqueType *TypeToResolve = 0;
1050
1051 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1052 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1053 << UpRefs[i].second->getDescription() << ") = "
1054 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1055 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1056 // Decrement level of upreference
1057 unsigned Level = --UpRefs[i].NestingLevel;
1058 UpRefs[i].LastContainedTy = Ty;
1059 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1060 if (Level == 0) { // Upreference should be resolved!
1061 if (!TypeToResolve) {
1062 TypeToResolve = UpRefs[i].UpRefTy;
1063 } else {
1064 UR_OUT(" * Resolving upreference for "
1065 << UpRefs[i].second->getDescription() << "\n";
1066 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1067 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1068 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1069 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1070 }
1071 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1072 --i; // Do not skip the next element...
1073 }
1074 }
1075 }
1076
1077 if (TypeToResolve) {
1078 UR_OUT(" * Resolving upreference for "
1079 << UpRefs[i].second->getDescription() << "\n";
1080 std::string OldName = TypeToResolve->getDescription());
1081 TypeToResolve->refineAbstractTypeTo(Ty);
1082 }
1083
1084 return Ty;
1085}
1086
1087//===----------------------------------------------------------------------===//
1088// RunVMAsmParser - Define an interface to this parser
1089//===----------------------------------------------------------------------===//
1090//
1091static Module* RunParser(Module * M);
1092
1093Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1094 set_scan_file(F);
1095
1096 CurFilename = Filename;
1097 return RunParser(new Module(CurFilename));
1098}
1099
1100Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1101 set_scan_string(AsmString);
1102
1103 CurFilename = "from_memory";
1104 if (M == NULL) {
1105 return RunParser(new Module (CurFilename));
1106 } else {
1107 return RunParser(M);
1108 }
1109}
1110
1111
Dale Johannesencfb19e62007-11-05 21:20:28 +00001112#line 968 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00001113typedef union {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001114 llvm::Module *ModuleVal;
1115 llvm::Function *FunctionVal;
1116 llvm::BasicBlock *BasicBlockVal;
1117 llvm::TerminatorInst *TermInstVal;
1118 llvm::Instruction *InstVal;
1119 llvm::Constant *ConstVal;
1120
1121 const llvm::Type *PrimType;
1122 std::list<llvm::PATypeHolder> *TypeList;
1123 llvm::PATypeHolder *TypeVal;
1124 llvm::Value *ValueVal;
1125 std::vector<llvm::Value*> *ValueList;
1126 llvm::ArgListType *ArgList;
1127 llvm::TypeWithAttrs TypeWithAttrs;
1128 llvm::TypeWithAttrsList *TypeWithAttrsList;
Dale Johannesencfb19e62007-11-05 21:20:28 +00001129 llvm::ParamList *ParamList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001130
1131 // Represent the RHS of PHI node
1132 std::list<std::pair<llvm::Value*,
1133 llvm::BasicBlock*> > *PHIList;
1134 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1135 std::vector<llvm::Constant*> *ConstVector;
1136
1137 llvm::GlobalValue::LinkageTypes Linkage;
1138 llvm::GlobalValue::VisibilityTypes Visibility;
1139 uint16_t ParamAttrs;
1140 llvm::APInt *APIntVal;
1141 int64_t SInt64Val;
1142 uint64_t UInt64Val;
1143 int SIntVal;
1144 unsigned UIntVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00001145 llvm::APFloat *FPVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001146 bool BoolVal;
1147
1148 std::string *StrVal; // This memory must be deleted
1149 llvm::ValID ValIDVal;
1150
1151 llvm::Instruction::BinaryOps BinaryOpVal;
1152 llvm::Instruction::TermOps TermOpVal;
1153 llvm::Instruction::MemoryOps MemOpVal;
1154 llvm::Instruction::CastOps CastOpVal;
1155 llvm::Instruction::OtherOps OtherOpVal;
1156 llvm::ICmpInst::Predicate IPredicate;
1157 llvm::FCmpInst::Predicate FPredicate;
Chris Lattnerbb856a32007-08-06 21:00:46 +00001158} YYSTYPE;
Dale Johannesen3afee192007-09-07 21:07:57 +00001159#include <stdio.h>
1160
1161#ifndef __cplusplus
1162#ifndef __STDC__
1163#define const
1164#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001165#endif
1166
1167
1168
Dale Johannesencfb19e62007-11-05 21:20:28 +00001169#define YYFINAL 600
Dale Johannesen3afee192007-09-07 21:07:57 +00001170#define YYFLAG -32768
1171#define YYNTBASE 160
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001172
Dale Johannesen3afee192007-09-07 21:07:57 +00001173#define YYTRANSLATE(x) ((unsigned)(x) <= 399 ? yytranslate[x] : 241)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001174
Dale Johannesen3afee192007-09-07 21:07:57 +00001175static const short yytranslate[] = { 0,
1176 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1177 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1178 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1179 2, 2, 2, 2, 2, 2, 2, 2, 2, 150,
1180 151, 148, 2, 147, 2, 2, 2, 2, 2, 2,
1181 2, 2, 2, 2, 2, 2, 2, 2, 2, 155,
1182 146, 156, 2, 2, 2, 2, 2, 2, 2, 2,
1183 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1184 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1185 152, 149, 154, 2, 2, 2, 2, 2, 159, 2,
1186 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1187 2, 2, 2, 2, 2, 2, 2, 2, 2, 153,
1188 2, 2, 157, 2, 158, 2, 2, 2, 2, 2,
1189 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1190 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1191 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1192 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1193 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1194 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1195 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1196 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1197 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1198 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1199 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1200 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1201 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
1202 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
1203 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
1204 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1205 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
1206 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
1207 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
1208 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
1209 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
1210 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
1211 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
1212 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
1213 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
1214 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
1215 137, 138, 139, 140, 141, 142, 143, 144, 145
1216};
Reid Spenceraa8ae282007-07-31 03:50:36 +00001217
Dale Johannesen3afee192007-09-07 21:07:57 +00001218#if YYDEBUG != 0
1219static const short yyprhs[] = { 0,
1220 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
1221 20, 22, 24, 26, 28, 30, 32, 34, 36, 38,
1222 40, 42, 44, 46, 48, 50, 52, 54, 56, 58,
1223 60, 62, 64, 66, 68, 70, 72, 74, 76, 78,
1224 80, 82, 84, 86, 88, 90, 92, 94, 96, 98,
1225 100, 102, 104, 106, 108, 110, 112, 114, 116, 118,
1226 120, 122, 124, 126, 127, 130, 131, 133, 135, 137,
1227 138, 141, 143, 145, 147, 149, 151, 153, 155, 157,
1228 158, 160, 162, 164, 165, 167, 169, 170, 172, 174,
1229 176, 178, 179, 181, 183, 184, 186, 188, 190, 192,
1230 194, 197, 199, 201, 203, 205, 207, 209, 211, 213,
1231 215, 216, 219, 221, 223, 225, 227, 228, 231, 232,
1232 235, 236, 240, 243, 244, 246, 247, 251, 253, 256,
1233 258, 260, 262, 264, 266, 268, 270, 272, 274, 277,
1234 279, 282, 288, 294, 300, 306, 310, 313, 319, 324,
1235 327, 329, 331, 333, 337, 339, 343, 345, 346, 348,
1236 352, 357, 361, 365, 370, 375, 379, 386, 392, 395,
1237 398, 401, 404, 407, 410, 413, 416, 419, 422, 425,
1238 428, 435, 441, 450, 457, 464, 472, 480, 487, 496,
1239 505, 509, 511, 513, 515, 517, 518, 521, 528, 530,
1240 531, 533, 536, 537, 541, 542, 546, 550, 554, 558,
1241 559, 567, 568, 577, 578, 587, 593, 596, 600, 602,
1242 606, 610, 614, 618, 620, 621, 627, 631, 633, 637,
1243 639, 640, 650, 652, 654, 659, 661, 663, 666, 670,
1244 671, 673, 675, 677, 679, 681, 683, 685, 687, 689,
1245 693, 695, 701, 703, 705, 707, 709, 711, 713, 716,
1246 719, 722, 726, 729, 730, 732, 735, 738, 742, 752,
1247 762, 771, 786, 788, 790, 797, 803, 806, 813, 821,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001248 825, 829, 835, 841, 842, 843, 847, 850, 852, 858,
1249 864, 871, 878, 883, 890, 895, 900, 907, 914, 917,
1250 926, 928, 930, 931, 935, 942, 946, 953, 956, 962,
1251 970
Dale Johannesen3afee192007-09-07 21:07:57 +00001252};
Chris Lattnerbb856a32007-08-06 21:00:46 +00001253
Dale Johannesen3afee192007-09-07 21:07:57 +00001254static const short yyrhs[] = { 73,
1255 0, 74, 0, 75, 0, 76, 0, 77, 0, 78,
1256 0, 79, 0, 80, 0, 81, 0, 85, 0, 86,
1257 0, 87, 0, 82, 0, 83, 0, 84, 0, 116,
1258 0, 117, 0, 118, 0, 119, 0, 120, 0, 121,
1259 0, 122, 0, 123, 0, 124, 0, 125, 0, 126,
1260 0, 127, 0, 90, 0, 91, 0, 92, 0, 93,
1261 0, 94, 0, 95, 0, 96, 0, 97, 0, 98,
1262 0, 99, 0, 100, 0, 101, 0, 102, 0, 103,
1263 0, 104, 0, 105, 0, 106, 0, 107, 0, 108,
1264 0, 109, 0, 96, 0, 97, 0, 98, 0, 99,
1265 0, 26, 0, 27, 0, 11, 0, 12, 0, 13,
1266 0, 16, 0, 15, 0, 14, 0, 19, 0, 22,
1267 0, 24, 0, 167, 0, 0, 167, 146, 0, 0,
1268 20, 0, 23, 0, 172, 0, 0, 170, 146, 0,
1269 42, 0, 44, 0, 43, 0, 45, 0, 47, 0,
1270 46, 0, 48, 0, 50, 0, 0, 143, 0, 144,
1271 0, 145, 0, 0, 46, 0, 48, 0, 0, 42,
1272 0, 43, 0, 44, 0, 47, 0, 0, 44, 0,
1273 42, 0, 0, 61, 0, 62, 0, 63, 0, 64,
1274 0, 65, 0, 60, 4, 0, 135, 0, 117, 0,
1275 134, 0, 118, 0, 137, 0, 138, 0, 140, 0,
1276 141, 0, 142, 0, 0, 181, 180, 0, 136, 0,
1277 139, 0, 135, 0, 134, 0, 0, 183, 182, 0,
1278 0, 53, 4, 0, 0, 147, 53, 4, 0, 34,
1279 22, 0, 0, 186, 0, 0, 147, 189, 188, 0,
1280 186, 0, 53, 4, 0, 11, 0, 12, 0, 13,
1281 0, 16, 0, 15, 0, 14, 0, 17, 0, 49,
1282 0, 190, 0, 191, 148, 0, 225, 0, 149, 4,
1283 0, 191, 150, 195, 151, 183, 0, 10, 150, 195,
1284 151, 183, 0, 152, 4, 153, 191, 154, 0, 155,
1285 4, 153, 191, 156, 0, 157, 196, 158, 0, 157,
1286 158, 0, 155, 157, 196, 158, 156, 0, 155, 157,
1287 158, 156, 0, 191, 181, 0, 191, 0, 10, 0,
1288 192, 0, 194, 147, 192, 0, 194, 0, 194, 147,
1289 39, 0, 39, 0, 0, 191, 0, 196, 147, 191,
1290 0, 191, 152, 199, 154, 0, 191, 152, 154, 0,
1291 191, 159, 22, 0, 191, 155, 199, 156, 0, 191,
1292 157, 199, 158, 0, 191, 157, 158, 0, 191, 155,
1293 157, 199, 158, 156, 0, 191, 155, 157, 158, 156,
1294 0, 191, 40, 0, 191, 41, 0, 191, 225, 0,
1295 191, 198, 0, 191, 25, 0, 165, 3, 0, 165,
1296 5, 0, 165, 4, 0, 165, 6, 0, 11, 26,
1297 0, 11, 27, 0, 166, 9, 0, 162, 150, 197,
1298 38, 191, 151, 0, 115, 150, 197, 236, 151, 0,
1299 129, 150, 197, 147, 197, 147, 197, 151, 0, 160,
1300 150, 197, 147, 197, 151, 0, 161, 150, 197, 147,
1301 197, 151, 0, 88, 163, 150, 197, 147, 197, 151,
1302 0, 89, 164, 150, 197, 147, 197, 151, 0, 131,
1303 150, 197, 147, 197, 151, 0, 132, 150, 197, 147,
1304 197, 147, 197, 151, 0, 133, 150, 197, 147, 197,
1305 147, 197, 151, 0, 199, 147, 197, 0, 197, 0,
1306 32, 0, 33, 0, 37, 0, 0, 193, 225, 0,
1307 121, 150, 202, 38, 191, 151, 0, 204, 0, 0,
1308 205, 0, 204, 205, 0, 0, 31, 206, 221, 0,
1309 0, 30, 207, 222, 0, 58, 57, 211, 0, 169,
1310 18, 191, 0, 169, 18, 10, 0, 0, 171, 175,
1311 201, 200, 197, 208, 188, 0, 0, 171, 173, 175,
1312 201, 200, 197, 209, 188, 0, 0, 171, 174, 175,
1313 201, 200, 191, 210, 188, 0, 171, 175, 35, 178,
1314 202, 0, 51, 212, 0, 54, 146, 213, 0, 22,
1315 0, 52, 146, 22, 0, 66, 146, 22, 0, 152,
1316 214, 154, 0, 214, 147, 22, 0, 22, 0, 0,
1317 215, 147, 191, 181, 168, 0, 191, 181, 168, 0,
1318 215, 0, 215, 147, 39, 0, 39, 0, 0, 179,
1319 193, 170, 150, 216, 151, 183, 187, 184, 0, 28,
1320 0, 157, 0, 177, 175, 217, 218, 0, 29, 0,
1321 158, 0, 228, 220, 0, 176, 175, 217, 0, 0,
1322 59, 0, 3, 0, 4, 0, 9, 0, 26, 0,
1323 27, 0, 40, 0, 41, 0, 25, 0, 155, 199,
1324 156, 0, 198, 0, 57, 223, 22, 147, 22, 0,
1325 7, 0, 8, 0, 167, 0, 170, 0, 225, 0,
1326 224, 0, 191, 226, 0, 228, 229, 0, 219, 229,
1327 0, 230, 169, 231, 0, 230, 233, 0, 0, 21,
1328 0, 67, 227, 0, 67, 10, 0, 68, 17, 226,
1329 0, 68, 11, 226, 147, 17, 226, 147, 17, 226,
1330 0, 69, 165, 226, 147, 17, 226, 152, 232, 154,
1331 0, 69, 165, 226, 147, 17, 226, 152, 154, 0,
1332 70, 179, 193, 226, 150, 235, 151, 183, 38, 17,
1333 226, 71, 17, 226, 0, 71, 0, 72, 0, 232,
1334 165, 224, 147, 17, 226, 0, 165, 224, 147, 17,
1335 226, 0, 169, 238, 0, 191, 152, 226, 147, 226,
1336 154, 0, 234, 147, 152, 226, 147, 226, 154, 0,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001337 191, 226, 181, 0, 17, 226, 181, 0, 235, 147,
1338 191, 226, 181, 0, 235, 147, 17, 226, 181, 0,
Dale Johannesen3afee192007-09-07 21:07:57 +00001339 0, 0, 236, 147, 227, 0, 56, 55, 0, 55,
1340 0, 160, 191, 226, 147, 226, 0, 161, 191, 226,
1341 147, 226, 0, 88, 163, 191, 226, 147, 226, 0,
1342 89, 164, 191, 226, 147, 226, 0, 162, 227, 38,
1343 191, 0, 129, 227, 147, 227, 147, 227, 0, 130,
1344 227, 147, 191, 0, 131, 227, 147, 227, 0, 132,
1345 227, 147, 227, 147, 227, 0, 133, 227, 147, 227,
1346 147, 227, 0, 128, 234, 0, 237, 179, 193, 226,
1347 150, 235, 151, 183, 0, 240, 0, 36, 0, 0,
1348 110, 191, 185, 0, 110, 191, 147, 11, 226, 185,
1349 0, 111, 191, 185, 0, 111, 191, 147, 11, 226,
1350 185, 0, 112, 227, 0, 239, 113, 191, 226, 185,
1351 0, 239, 114, 227, 147, 191, 226, 185, 0, 115,
1352 191, 226, 236, 0
1353};
Chris Lattnerbb856a32007-08-06 21:00:46 +00001354
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001355#endif
1356
Dale Johannesen3afee192007-09-07 21:07:57 +00001357#if YYDEBUG != 0
1358static const short yyrline[] = { 0,
Dale Johannesen255b8fe2007-09-11 18:33:39 +00001359 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1128,
1360 1128, 1128, 1128, 1128, 1128, 1129, 1129, 1129, 1129, 1129,
1361 1129, 1129, 1130, 1130, 1130, 1130, 1130, 1133, 1133, 1134,
1362 1134, 1135, 1135, 1136, 1136, 1137, 1137, 1141, 1141, 1142,
1363 1142, 1143, 1143, 1144, 1144, 1145, 1145, 1146, 1146, 1147,
1364 1147, 1148, 1149, 1154, 1155, 1155, 1155, 1155, 1155, 1157,
1365 1157, 1157, 1158, 1158, 1162, 1166, 1171, 1171, 1173, 1174,
1366 1179, 1185, 1186, 1187, 1188, 1189, 1193, 1194, 1195, 1199,
1367 1200, 1201, 1202, 1206, 1207, 1208, 1212, 1213, 1214, 1215,
1368 1216, 1220, 1221, 1222, 1225, 1225, 1226, 1227, 1228, 1229,
1369 1230, 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245, 1246,
1370 1249, 1250, 1255, 1256, 1257, 1258, 1261, 1262, 1269, 1269,
1371 1276, 1276, 1285, 1293, 1293, 1299, 1299, 1301, 1306, 1319,
1372 1319, 1319, 1319, 1319, 1319, 1319, 1322, 1326, 1330, 1337,
1373 1342, 1350, 1380, 1411, 1416, 1428, 1438, 1442, 1452, 1459,
1374 1466, 1473, 1478, 1483, 1490, 1491, 1498, 1505, 1513, 1519,
1375 1531, 1559, 1575, 1602, 1630, 1656, 1676, 1702, 1722, 1734,
1376 1741, 1807, 1817, 1827, 1833, 1843, 1849, 1859, 1864, 1869,
1377 1882, 1894, 1916, 1924, 1930, 1941, 1946, 1951, 1957, 1963,
1378 1972, 1976, 1984, 1984, 1987, 1987, 1990, 2002, 2023, 2028,
1379 2036, 2037, 2041, 2041, 2045, 2045, 2048, 2051, 2075, 2086,
1380 2093, 2096, 2102, 2105, 2112, 2116, 2156, 2159, 2165, 2175,
1381 2179, 2184, 2186, 2191, 2196, 2205, 2215, 2226, 2230, 2239,
1382 2248, 2253, 2374, 2374, 2376, 2385, 2385, 2387, 2392, 2404,
1383 2408, 2413, 2417, 2421, 2425, 2429, 2433, 2437, 2441, 2445,
1384 2470, 2474, 2484, 2488, 2492, 2497, 2504, 2504, 2510, 2519,
1385 2523, 2532, 2541, 2550, 2554, 2561, 2565, 2569, 2574, 2584,
1386 2603, 2612, 2692, 2696, 2703, 2714, 2727, 2737, 2748, 2758,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001387 2767, 2773, 2782, 2788, 2791, 2792, 2799, 2803, 2808, 2829,
1388 2846, 2860, 2874, 2886, 2894, 2901, 2907, 2913, 2919, 2934,
1389 3019, 3024, 3028, 3035, 3042, 3050, 3057, 3065, 3073, 3087,
1390 3104
Dale Johannesen3afee192007-09-07 21:07:57 +00001391};
1392#endif
1393
1394
1395#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
1396
1397static const char * const yytname[] = { "$","error","$undefined.","ESINT64VAL",
1398"EUINT64VAL","ESAPINTVAL","EUAPINTVAL","LOCALVAL_ID","GLOBALVAL_ID","FPVAL",
1399"VOID","INTTYPE","FLOAT","DOUBLE","X86_FP80","FP128","PPC_FP128","LABEL","TYPE",
1400"LOCALVAR","GLOBALVAR","LABELSTR","STRINGCONSTANT","ATSTRINGCONSTANT","PCTSTRINGCONSTANT",
1401"ZEROINITIALIZER","TRUETOK","FALSETOK","BEGINTOK","ENDTOK","DECLARE","DEFINE",
1402"GLOBAL","CONSTANT","SECTION","ALIAS","VOLATILE","THREAD_LOCAL","TO","DOTDOTDOT",
1403"NULL_TOK","UNDEF","INTERNAL","LINKONCE","WEAK","APPENDING","DLLIMPORT","DLLEXPORT",
1404"EXTERN_WEAK","OPAQUE","EXTERNAL","TARGET","TRIPLE","ALIGN","DEPLIBS","CALL",
1405"TAIL","ASM_TOK","MODULE","SIDEEFFECT","CC_TOK","CCC_TOK","FASTCC_TOK","COLDCC_TOK",
1406"X86_STDCALLCC_TOK","X86_FASTCALLCC_TOK","DATALAYOUT","RET","BR","SWITCH","INVOKE",
1407"UNWIND","UNREACHABLE","ADD","SUB","MUL","UDIV","SDIV","FDIV","UREM","SREM",
1408"FREM","AND","OR","XOR","SHL","LSHR","ASHR","ICMP","FCMP","EQ","NE","SLT","SGT",
1409"SLE","SGE","ULT","UGT","ULE","UGE","OEQ","ONE","OLT","OGT","OLE","OGE","ORD",
1410"UNO","UEQ","UNE","MALLOC","ALLOCA","FREE","LOAD","STORE","GETELEMENTPTR","TRUNC",
1411"ZEXT","SEXT","FPTRUNC","FPEXT","BITCAST","UITOFP","SITOFP","FPTOUI","FPTOSI",
1412"INTTOPTR","PTRTOINT","PHI_TOK","SELECT","VAARG","EXTRACTELEMENT","INSERTELEMENT",
1413"SHUFFLEVECTOR","SIGNEXT","ZEROEXT","NORETURN","INREG","SRET","NOUNWIND","NOALIAS",
1414"BYVAL","NEST","DEFAULT","HIDDEN","PROTECTED","'='","','","'*'","'\\\\'","'('",
1415"')'","'['","'x'","']'","'<'","'>'","'{'","'}'","'c'","ArithmeticOps","LogicalOps",
1416"CastOps","IPredicates","FPredicates","IntType","FPType","LocalName","OptLocalName",
1417"OptLocalAssign","GlobalName","OptGlobalAssign","GlobalAssign","GVInternalLinkage",
1418"GVExternalLinkage","GVVisibilityStyle","FunctionDeclareLinkage","FunctionDefineLinkage",
1419"AliasLinkage","OptCallingConv","ParamAttr","OptParamAttrs","FuncAttr","OptFuncAttrs",
1420"OptAlign","OptCAlign","SectionString","OptSection","GlobalVarAttributes","GlobalVarAttribute",
1421"PrimType","Types","ArgType","ResultTypes","ArgTypeList","ArgTypeListI","TypeListI",
1422"ConstVal","ConstExpr","ConstVector","GlobalType","ThreadLocal","AliaseeRef",
1423"Module","DefinitionList","Definition","@1","@2","@3","@4","@5","AsmBlock","TargetDefinition",
1424"LibrariesDefinition","LibList","ArgListH","ArgList","FunctionHeaderH","BEGIN",
1425"FunctionHeader","END","Function","FunctionProto","OptSideEffect","ConstValueRef",
1426"SymbolicValueRef","ValueRef","ResolvedVal","BasicBlockList","BasicBlock","InstructionList",
Dale Johannesencfb19e62007-11-05 21:20:28 +00001427"BBTerminatorInst","JumpTable","Inst","PHIList","ParamList","IndexList","OptTailCall",
Dale Johannesen3afee192007-09-07 21:07:57 +00001428"InstVal","OptVolatile","MemoryInst", NULL
1429};
1430#endif
1431
1432static const short yyr1[] = { 0,
1433 160, 160, 160, 160, 160, 160, 160, 160, 160, 161,
1434 161, 161, 161, 161, 161, 162, 162, 162, 162, 162,
1435 162, 162, 162, 162, 162, 162, 162, 163, 163, 163,
1436 163, 163, 163, 163, 163, 163, 163, 164, 164, 164,
1437 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
1438 164, 164, 164, 165, 166, 166, 166, 166, 166, 167,
1439 167, 167, 168, 168, 169, 169, 170, 170, 171, 171,
1440 172, 173, 173, 173, 173, 173, 174, 174, 174, 175,
1441 175, 175, 175, 176, 176, 176, 177, 177, 177, 177,
1442 177, 178, 178, 178, 179, 179, 179, 179, 179, 179,
1443 179, 180, 180, 180, 180, 180, 180, 180, 180, 180,
1444 181, 181, 182, 182, 182, 182, 183, 183, 184, 184,
1445 185, 185, 186, 187, 187, 188, 188, 189, 189, 190,
1446 190, 190, 190, 190, 190, 190, 191, 191, 191, 191,
1447 191, 191, 191, 191, 191, 191, 191, 191, 191, 192,
1448 193, 193, 194, 194, 195, 195, 195, 195, 196, 196,
1449 197, 197, 197, 197, 197, 197, 197, 197, 197, 197,
1450 197, 197, 197, 197, 197, 197, 197, 197, 197, 197,
1451 198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
1452 199, 199, 200, 200, 201, 201, 202, 202, 203, 203,
1453 204, 204, 206, 205, 207, 205, 205, 205, 205, 208,
1454 205, 209, 205, 210, 205, 205, 205, 205, 211, 212,
1455 212, 213, 214, 214, 214, 215, 215, 216, 216, 216,
1456 216, 217, 218, 218, 219, 220, 220, 221, 222, 223,
1457 223, 224, 224, 224, 224, 224, 224, 224, 224, 224,
1458 224, 224, 225, 225, 225, 225, 226, 226, 227, 228,
1459 228, 229, 230, 230, 230, 231, 231, 231, 231, 231,
1460 231, 231, 231, 231, 232, 232, 233, 234, 234, 235,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001461 235, 235, 235, 235, 236, 236, 237, 237, 238, 238,
1462 238, 238, 238, 238, 238, 238, 238, 238, 238, 238,
1463 238, 239, 239, 240, 240, 240, 240, 240, 240, 240,
1464 240
Dale Johannesen3afee192007-09-07 21:07:57 +00001465};
1466
1467static const short yyr2[] = { 0,
1468 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1469 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1470 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1471 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1472 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1473 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1474 1, 1, 1, 0, 2, 0, 1, 1, 1, 0,
1475 2, 1, 1, 1, 1, 1, 1, 1, 1, 0,
1476 1, 1, 1, 0, 1, 1, 0, 1, 1, 1,
1477 1, 0, 1, 1, 0, 1, 1, 1, 1, 1,
1478 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1479 0, 2, 1, 1, 1, 1, 0, 2, 0, 2,
1480 0, 3, 2, 0, 1, 0, 3, 1, 2, 1,
1481 1, 1, 1, 1, 1, 1, 1, 1, 2, 1,
1482 2, 5, 5, 5, 5, 3, 2, 5, 4, 2,
1483 1, 1, 1, 3, 1, 3, 1, 0, 1, 3,
1484 4, 3, 3, 4, 4, 3, 6, 5, 2, 2,
1485 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1486 6, 5, 8, 6, 6, 7, 7, 6, 8, 8,
1487 3, 1, 1, 1, 1, 0, 2, 6, 1, 0,
1488 1, 2, 0, 3, 0, 3, 3, 3, 3, 0,
1489 7, 0, 8, 0, 8, 5, 2, 3, 1, 3,
1490 3, 3, 3, 1, 0, 5, 3, 1, 3, 1,
1491 0, 9, 1, 1, 4, 1, 1, 2, 3, 0,
1492 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
1493 1, 5, 1, 1, 1, 1, 1, 1, 2, 2,
1494 2, 3, 2, 0, 1, 2, 2, 3, 9, 9,
1495 8, 14, 1, 1, 6, 5, 2, 6, 7, 3,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001496 3, 5, 5, 0, 0, 3, 2, 1, 5, 5,
1497 6, 6, 4, 6, 4, 4, 6, 6, 2, 8,
1498 1, 1, 0, 3, 6, 3, 6, 2, 5, 7,
1499 4
Dale Johannesen3afee192007-09-07 21:07:57 +00001500};
1501
1502static const short yydefact[] = { 70,
1503 60, 67, 61, 68, 62, 205, 203, 0, 0, 0,
1504 0, 0, 0, 80, 69, 70, 201, 84, 87, 0,
1505 0, 217, 0, 0, 65, 0, 71, 72, 74, 73,
1506 75, 77, 76, 78, 79, 81, 82, 83, 80, 80,
1507 196, 202, 85, 86, 80, 206, 88, 89, 90, 91,
1508 80, 264, 204, 264, 0, 0, 225, 218, 219, 207,
1509 253, 254, 209, 130, 131, 132, 135, 134, 133, 136,
1510 137, 0, 0, 0, 0, 255, 256, 138, 208, 140,
1511 196, 196, 92, 195, 0, 95, 95, 265, 261, 66,
1512 236, 237, 238, 260, 220, 221, 224, 0, 158, 141,
1513 0, 0, 0, 0, 147, 159, 0, 139, 158, 0,
1514 0, 94, 93, 0, 193, 194, 0, 0, 96, 97,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001515 98, 99, 100, 0, 239, 0, 303, 263, 0, 222,
Dale Johannesen3afee192007-09-07 21:07:57 +00001516 157, 111, 153, 155, 0, 0, 0, 0, 0, 0,
1517 146, 0, 0, 0, 152, 0, 151, 0, 216, 130,
1518 131, 132, 135, 134, 133, 0, 0, 0, 210, 101,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001519 0, 233, 234, 235, 302, 288, 0, 0, 0, 0,
Dale Johannesen3afee192007-09-07 21:07:57 +00001520 95, 273, 274, 1, 2, 3, 4, 5, 6, 7,
1521 8, 9, 13, 14, 15, 10, 11, 12, 0, 0,
1522 0, 0, 0, 0, 16, 17, 18, 19, 20, 21,
1523 22, 23, 24, 25, 26, 27, 0, 0, 0, 0,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001524 0, 0, 0, 0, 0, 262, 95, 277, 0, 301,
Dale Johannesen3afee192007-09-07 21:07:57 +00001525 223, 150, 0, 117, 0, 0, 149, 0, 160, 117,
1526 212, 214, 0, 197, 178, 179, 174, 176, 175, 177,
1527 180, 173, 169, 170, 0, 0, 0, 0, 0, 0,
1528 0, 0, 0, 0, 0, 0, 0, 0, 172, 171,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001529 126, 0, 287, 267, 0, 266, 0, 0, 54, 0,
Dale Johannesen3afee192007-09-07 21:07:57 +00001530 0, 28, 29, 30, 31, 32, 33, 34, 35, 36,
1531 37, 0, 52, 53, 48, 49, 50, 51, 38, 39,
1532 40, 41, 42, 43, 44, 45, 46, 47, 0, 121,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001533 121, 308, 0, 0, 299, 0, 0, 0, 0, 0,
Dale Johannesen3afee192007-09-07 21:07:57 +00001534 0, 0, 0, 0, 0, 0, 103, 105, 104, 102,
1535 106, 107, 108, 109, 110, 112, 156, 154, 143, 144,
1536 145, 148, 142, 126, 126, 0, 0, 0, 0, 0,
1537 0, 0, 0, 162, 192, 0, 0, 0, 166, 0,
1538 163, 0, 0, 0, 0, 211, 231, 242, 243, 244,
1539 249, 245, 246, 247, 248, 240, 0, 251, 258, 257,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001540 259, 0, 268, 0, 0, 0, 0, 0, 304, 0,
1541 306, 285, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesen3afee192007-09-07 21:07:57 +00001542 0, 0, 0, 0, 0, 116, 115, 113, 114, 118,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001543 213, 215, 0, 0, 0, 285, 0, 0, 0, 0,
Dale Johannesen3afee192007-09-07 21:07:57 +00001544 0, 161, 147, 159, 0, 164, 165, 0, 0, 0,
1545 0, 0, 128, 126, 230, 111, 228, 0, 241, 0,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001546 0, 0, 0, 0, 0, 0, 0, 0, 0, 311,
1547 0, 0, 0, 295, 296, 0, 0, 0, 0, 293,
Dale Johannesen3afee192007-09-07 21:07:57 +00001548 0, 121, 0, 0, 0, 0, 0, 0, 0, 0,
1549 0, 191, 168, 0, 0, 0, 0, 123, 129, 127,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001550 64, 0, 117, 0, 250, 0, 0, 284, 0, 0,
1551 121, 122, 121, 0, 0, 0, 0, 0, 0, 289,
1552 290, 284, 0, 309, 0, 198, 0, 0, 182, 0,
Dale Johannesen3afee192007-09-07 21:07:57 +00001553 0, 0, 0, 167, 0, 0, 0, 63, 227, 229,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001554 111, 124, 0, 0, 0, 136, 0, 0, 291, 292,
1555 305, 307, 286, 0, 0, 294, 297, 298, 0, 121,
1556 0, 0, 0, 188, 0, 0, 184, 185, 181, 64,
1557 125, 119, 252, 0, 0, 111, 111, 0, 117, 278,
1558 0, 117, 310, 186, 187, 0, 0, 0, 226, 0,
1559 232, 0, 271, 0, 0, 281, 280, 136, 0, 0,
1560 279, 300, 183, 189, 190, 120, 269, 0, 270, 0,
1561 111, 111, 0, 0, 0, 283, 282, 0, 0, 0,
1562 0, 276, 0, 0, 275, 0, 272, 0, 0, 0
Dale Johannesen3afee192007-09-07 21:07:57 +00001563};
1564
1565static const short yydefgoto[] = { 256,
1566 257, 258, 282, 299, 156, 157, 76, 509, 12, 77,
1567 14, 15, 39, 40, 41, 45, 51, 114, 124, 326,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001568 222, 400, 329, 561, 379, 423, 542, 356, 424, 78,
Dale Johannesen3afee192007-09-07 21:07:57 +00001569 158, 133, 148, 134, 135, 107, 345, 368, 346, 117,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001570 85, 149, 598, 16, 17, 19, 18, 261, 334, 335,
Dale Johannesen3afee192007-09-07 21:07:57 +00001571 60, 22, 58, 98, 427, 428, 125, 164, 52, 93,
1572 53, 46, 430, 369, 80, 371, 266, 54, 89, 90,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001573 216, 565, 128, 305, 518, 440, 217, 218, 219, 220
Dale Johannesen3afee192007-09-07 21:07:57 +00001574};
1575
1576static const short yypact[] = { 42,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001577-32768,-32768,-32768,-32768,-32768,-32768,-32768, -8, -110, 13,
1578 -39, 104, 5, 167,-32768, 321,-32768, 83, 74, 12,
1579 17,-32768, 41, 148,-32768, 1305,-32768,-32768,-32768,-32768,
1580-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 117, 117,
1581 11,-32768,-32768,-32768, 117,-32768,-32768,-32768,-32768,-32768,
1582 117, 154,-32768, -10, 181, 204, 212,-32768,-32768,-32768,
1583-32768,-32768, 98,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1584-32768, 254, 259, 3, 958,-32768,-32768,-32768, 49,-32768,
1585 231, 231, 225,-32768, 65, 215, 215,-32768,-32768, 131,
1586-32768,-32768,-32768,-32768,-32768,-32768,-32768, -34, 1038,-32768,
1587 120, 128, 976, 98,-32768, 49, -123,-32768, 1038, 65,
1588 65,-32768,-32768, 1056,-32768,-32768, 1327, 280,-32768,-32768,
1589-32768,-32768,-32768, 1345,-32768, -16, 1663,-32768, 263,-32768,
1590-32768, 49,-32768, 139, 136, 1398, 1398, 132, -95, 1398,
1591-32768, 143, 1327, 1398, 98, 145, 49, 213,-32768, 50,
1592 287, 289, 298, 299, 300, 219, 304, 805,-32768,-32768,
1593 233,-32768,-32768,-32768,-32768,-32768, 260, 1496, 70, 303,
1594 215,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1595-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 396, 449,
1596 1398, 1398, 1398, 1398,-32768,-32768,-32768,-32768,-32768,-32768,
1597-32768,-32768,-32768,-32768,-32768,-32768, 1398, 1398, 1398, 1398,
1598 1398, 1398, 1398, 1398, 1398,-32768, 215,-32768, 125,-32768,
1599-32768, -32, 1078,-32768, 23, -105,-32768, 160, 49,-32768,
1600-32768, 49, 1056,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1601-32768,-32768,-32768,-32768, 396, 449, 168, 169, 170, 173,
1602 174, 1229, 1514, 998, 295, 175, 179, 183,-32768,-32768,
1603 187, 185,-32768, 98, 646,-32768, 780, 780,-32768, 780,
1604 1345,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1605-32768, 1398,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1606-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 1398, 97,
1607 102,-32768, 646, 24, 195, 203, 208, 209, 210, 211,
1608 646, 646, 332, 1345, 1398, 1398,-32768,-32768,-32768,-32768,
1609-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 10,-32768,
1610-32768,-32768, 10, 187, 187, 333, 186, 223, 1327, 1327,
1611 1327, 1327, 1327,-32768,-32768, -15, 1016, -55,-32768, -79,
1612-32768, 1327, 1327, 1327, -4,-32768, 1247,-32768,-32768,-32768,
1613-32768,-32768,-32768,-32768,-32768, 317, 1327,-32768,-32768,-32768,
1614-32768, 234,-32768, 235, 780, 646, 646, 4,-32768, 22,
1615-32768,-32768, 780, 207, 1398, 1398, 1398, 1398, 1398, 236,
1616 240, 1398, 780, 646, 241,-32768,-32768,-32768,-32768,-32768,
1617-32768,-32768, 1398, 1327, 1327,-32768, 244, 246, 247, 251,
1618 1327,-32768, 224, 805, -78,-32768,-32768, 252, 253, 363,
1619 380, 399,-32768, 187,-32768, 49, 257, 256,-32768, 386,
1620 -52, 392, 393, 261, 270, 275, 780, 422, 780, 282,
1621 283, 780, 284, 49,-32768, 285, 288, 780, 780, 49,
1622 277, 290, 1398, 30, 291, 292, -80, 1327, 1327, 1327,
1623 1327,-32768,-32768, 293, 1327, 1327, 1398,-32768,-32768,-32768,
1624 278, 1287,-32768, 294,-32768, 780, 780, 1554, 780, 780,
1625 290,-32768, 290, 1398, 780, 296, 1398, 1398, 1398,-32768,
1626-32768, 1554, 383,-32768, 646,-32768, 1327, 1327,-32768, 297,
1627 301, 307, 308,-32768, 305, 309, 68,-32768,-32768,-32768,
1628 49, -11, 418, 314, 313, 780, 646, -9,-32768,-32768,
1629-32768,-32768,-32768, 312, 780,-32768,-32768,-32768, 44, 290,
1630 318, 319, 1327,-32768, 1327, 1327,-32768,-32768,-32768, 278,
1631-32768, 395,-32768, 428, -7,-32768,-32768, 1572,-32768,-32768,
1632 320,-32768,-32768,-32768,-32768, 322, 328, 329,-32768, 442,
1633-32768, 780,-32768, 503, -2, -32, -32, 780, 646, 1,
1634-32768, 10,-32768,-32768,-32768,-32768,-32768, 325,-32768, 503,
1635-32768,-32768, 433, 451, 334, -32, -32, 780, 780, 466,
1636 413,-32768, 780, 479,-32768, 780,-32768, 500, 501,-32768
Dale Johannesen3afee192007-09-07 21:07:57 +00001637};
1638
Dale Johannesencfb19e62007-11-05 21:20:28 +00001639static const short yypgoto[] = { 375,
1640 376, 377, 264, 262, -168,-32768, 0, -30, 421, 18,
1641-32768,-32768,-32768,-32768, 43,-32768,-32768,-32768, -158,-32768,
1642 -420,-32768, -222,-32768, -287, 2,-32768, -294,-32768,-32768,
1643 -25, 302, -107,-32768, 404, 414, -112, -155, -233, 144,
1644 189, 286,-32768,-32768, 502,-32768,-32768,-32768,-32768,-32768,
1645-32768,-32768,-32768,-32768,-32768,-32768, 434,-32768,-32768,-32768,
1646-32768,-32768,-32768, -542, -111, 122, -183,-32768, 468,-32768,
1647-32768,-32768,-32768,-32768, 28, 118,-32768,-32768,-32768,-32768
Dale Johannesen3afee192007-09-07 21:07:57 +00001648};
1649
1650
Dale Johannesencfb19e62007-11-05 21:20:28 +00001651#define YYLAST 1796
Dale Johannesen3afee192007-09-07 21:07:57 +00001652
1653
1654static const short yytable[] = { 11,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001655 79, 270, 259, 269, 159, 471, 102, 333, 269, 302,
1656 88, 162, 271, 381, 437, 11, 161, 13, 91, 348,
1657 350, 578, 421, 140, 306, 307, 308, 309, 310, 421,
1658 231, 313, 439, 13, 141, 23, 234, 585, 583, 401,
1659 402, -200, 108, 20, 109, 83, 260, 84, 422, 106,
1660 331, 140, -54, -54, -54, -54, 438, 21, 314, -66,
1661 1, 2, 228, 3, 4, 5, 484, 411, 411, 24,
1662 499, 6, 7, 132, 438, 235, 236, 106, 417, 464,
1663 267, 81, 82, 132, 317, 318, 268, 86, 147, 11,
1664 540, 411, 8, 87, 411, 9, 115, 116, 147, 10,
1665 416, 319, 320, 475, 321, 322, 25, 323, 324, 325,
1666 225, 226, 129, 415, 229, 47, 48, 49, 232, 130,
1667 50, 26, 396, 397, 398, 566, 567, 399, 43, 470,
1668 44, 411, 395, 431, 396, 397, 398, 548, 412, 399,
1669 163, 549, 265, 396, 397, 398, 563, 92, 399, 1,
1670 27, 579, 3, 370, 5, 370, 370, 55, 370, 103,
1671 586, 587, 56, 375, 494, 300, 301, 265, 303, 59,
1672 108, 108, 109, 109, 88, 383, 330, 108, 262, 109,
1673 496, 304, 265, 265, 265, 265, 265, 311, 312, 265,
1674 548, 370, 57, 521, 552, 522, 108, 132, 109, 370,
1675 370, 443, 95, 445, 446, 447, 393, 147, 28, 29,
1676 30, 31, 32, 33, 34, 108, 35, 109, 539, 61,
1677 62, 237, 238, 239, 240, 96, 406, 407, 408, 409,
1678 410, 1, 2, 97, 3, 4, 5, 315, 316, 418,
1679 419, 420, 553, 378, 108, 147, 109, 99, 380, 108,
1680 512, 109, 2, 143, 144, 4, 376, 100, 259, 36,
1681 37, 38, 101, 370, 370, 370, 112, 84, 113, 110,
1682 111, 370, 136, 377, 118, 119, 120, 121, 122, 123,
1683 137, 370, 370, 160, 221, 223, 224, 227, 147, 394,
1684 265, 455, 456, 230, 233, -55, 1, -56, 462, 3,
1685 523, 5, 260, 526, 527, 528, -59, -58, -57, 36,
1686 37, 38, 241, 269, 263, 332, 351, 339, 340, 341,
1687 -199, 414, 342, 343, 352, 370, 570, 370, 353, 572,
1688 370, 426, 354, 355, 357, 404, 370, 370, -66, 1,
1689 2, 384, 3, 4, 5, 500, 501, 502, 503, 385,
1690 6, 7, 505, 506, 386, 387, 388, 389, 442, 265,
1691 444, 265, 265, 265, 370, 370, 450, 370, 370, 392,
1692 403, 8, 405, 370, 9, 429, 564, 454, 10, 463,
1693 432, 433, 448, 370, 531, 532, 449, 453, 372, 373,
1694 458, 374, 459, 460, 317, 318, 580, 461, 465, 466,
1695 467, 468, 469, 472, 370, 370, 473, 474, 476, 477,
1696 478, 319, 320, 370, 321, 322, 479, 323, 324, 325,
1697 556, 480, 557, 558, 382, 482, 492, 495, 484, 485,
1698 487, 488, 390, 391, 489, 438, 493, 497, 498, 543,
1699 513, 507, 525, 533, 562, 576, 511, 560, 504, 588,
1700 370, 534, 517, 535, 536, 537, 370, 370, 265, 538,
1701 544, 265, 265, 265, 545, 550, 517, 589, 554, 555,
1702 508, 584, 573, 571, 283, 284, 370, 370, 574, 575,
1703 590, 370, 593, 594, 370, 272, 273, 274, 275, 276,
1704 277, 278, 279, 280, 281, 596, 434, 435, 436, 599,
1705 600, 213, 214, 215, 441, 358, 359, 338, 337, 559,
1706 127, 360, 142, 541, 451, 452, 139, 42, 336, 529,
1707 126, 94, 569, 457, 328, 0, 0, 361, 362, 363,
1708 0, 0, 0, 0, 0, 0, 0, 0, 0, 508,
1709 0, 0, 364, 365, 285, 286, 287, 288, 289, 290,
1710 291, 292, 293, 294, 295, 296, 297, 298, 481, 366,
1711 483, 0, 0, 486, 0, 0, 0, 0, 0, 490,
1712 491, 0, 0, 0, 0, 174, 175, 176, 177, 178,
1713 179, 180, 181, 182, 183, 184, 185, 186, 187, 188,
1714 245, 246, 0, 0, 0, 0, 0, 514, 515, 0,
1715 519, 520, 0, 0, 0, 0, 524, 0, 0, 0,
1716 0, 0, 0, 0, 0, 0, 530, 247, 195, 196,
1717 197, 198, 199, 200, 201, 202, 203, 204, 205, 206,
1718 0, 248, 0, 249, 250, 251, 0, 546, 547, 0,
1719 0, 0, 0, 0, 0, 0, 551, 0, 358, 359,
1720 0, 0, 61, 62, 360, 0, 0, 367, 0, 0,
1721 0, 0, 0, 0, 1, 2, 0, 3, 4, 5,
1722 361, 362, 363, 0, 0, 0, 0, 0, 0, 0,
1723 0, 0, 0, 577, 0, 364, 365, 0, 0, 581,
1724 582, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1725 0, 0, 366, 0, 0, 0, 0, 0, 0, 591,
1726 592, 0, 0, 0, 595, 0, 0, 597, 174, 175,
1727 176, 177, 178, 179, 180, 181, 182, 183, 184, 185,
1728 186, 187, 188, 245, 246, 0, 0, 0, 0, 0,
1729 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1730 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1731 247, 195, 196, 197, 198, 199, 200, 201, 202, 203,
1732 204, 205, 206, 0, 248, 0, 249, 250, 251, 0,
1733 0, 0, 358, 359, 0, 0, 61, 62, 360, 0,
1734 0, 0, 0, 108, 0, 109, 0, 0, 1, 2,
1735 367, 3, 4, 5, 361, 362, 363, 0, 0, 0,
1736 0, 61, 62, 0, 0, 0, 0, 0, 0, 364,
1737 365, 0, 0, 1, 2, 0, 3, 4, 5, 242,
1738 0, 0, 0, 0, 0, 0, 366, 0, 0, 0,
1739 0, 0, 0, 0, 243, 244, 0, 0, 0, 0,
1740 0, 0, 174, 175, 176, 177, 178, 179, 180, 181,
1741 182, 183, 184, 185, 186, 187, 188, 245, 246, 0,
1742 0, 0, 0, 0, 0, 0, 0, 174, 175, 176,
Dale Johannesen3afee192007-09-07 21:07:57 +00001743 177, 178, 179, 180, 181, 182, 183, 184, 185, 186,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001744 187, 188, 245, 246, 247, 195, 196, 197, 198, 199,
1745 200, 201, 202, 203, 204, 205, 206, 0, 248, 0,
1746 249, 250, 251, 0, 0, 0, 0, 0, 0, 247,
Dale Johannesen3afee192007-09-07 21:07:57 +00001747 195, 196, 197, 198, 199, 200, 201, 202, 203, 204,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001748 205, 206, 0, 248, 367, 249, 250, 251, 0, 0,
Dale Johannesen3afee192007-09-07 21:07:57 +00001749 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001750 0, 0, 108, 0, 109, 0, 252, 0, 0, 253,
1751 0, 254, 0, 255, 61, 62, 0, 104, 64, 65,
1752 66, 67, 68, 69, 70, 0, 1, 2, 0, 3,
1753 4, 5, 61, 62, 0, 104, 64, 65, 66, 67,
1754 68, 69, 70, 0, 1, 2, 0, 3, 4, 5,
1755 0, 0, 0, 0, 61, 62, 71, 104, 150, 151,
1756 152, 153, 154, 155, 70, 0, 1, 2, 0, 3,
1757 4, 5, 61, 62, 71, 104, 150, 151, 152, 153,
1758 154, 155, 70, 0, 1, 2, 0, 3, 4, 5,
1759 0, 0, 0, 0, 61, 62, 71, 104, 64, 65,
1760 66, 67, 68, 69, 70, 0, 1, 2, 0, 3,
1761 4, 5, 61, 62, 71, 145, 64, 65, 66, 67,
1762 68, 69, 70, 0, 1, 2, 131, 3, 4, 5,
1763 0, 0, 0, 0, 61, 62, 71, 104, 64, 65,
1764 66, 67, 68, 69, 70, 0, 1, 2, 0, 3,
1765 4, 5, 0, 0, 71, 0, 72, 0, 0, 73,
1766 0, 0, 74, 0, 75, 105, 327, 0, 0, 0,
1767 0, 0, 0, 0, 72, 0, 71, 73, 0, 0,
1768 74, 0, 75, 138, 0, 0, 0, 0, 0, 0,
1769 0, 0, 0, 0, 0, 0, 72, 0, 0, 73,
1770 0, 0, 74, 0, 75, 349, 0, 0, 0, 0,
1771 0, 0, 0, 0, 72, 0, 0, 73, 0, 0,
1772 74, 0, 75, 413, 0, 0, 146, 0, 0, 0,
1773 0, 0, 0, 0, 0, 0, 72, 0, 0, 73,
1774 0, 0, 74, 0, 75, 0, 0, 0, 0, 0,
1775 0, 0, 0, 0, 72, 0, 0, 73, 0, 0,
1776 74, 0, 75, 0, 0, 0, 0, 0, 0, 0,
1777 0, 0, 0, 0, 0, 0, 72, 0, 0, 73,
1778 0, 0, 74, 0, 75, 61, 62, 0, 104, 150,
1779 151, 152, 153, 154, 155, 70, 0, 1, 2, 0,
1780 3, 4, 5, 61, 62, 0, 104, 64, 65, 66,
Dale Johannesen3afee192007-09-07 21:07:57 +00001781 67, 68, 69, 70, 0, 1, 2, 0, 3, 4,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001782 5, 0, 0, 0, 0, 0, 0, 71, 0, 0,
1783 0, 0, 0, 0, 0, 425, 0, 0, 0, 0,
Dale Johannesen3afee192007-09-07 21:07:57 +00001784 0, 0, 0, 61, 62, 71, 104, 64, 65, 66,
1785 67, 68, 69, 70, 0, 1, 2, 0, 3, 4,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001786 5, 61, 62, 0, 63, 64, 65, 66, 67, 68,
1787 69, 70, 0, 1, 2, 510, 3, 4, 5, 0,
1788 0, 0, 0, 61, 62, 71, 104, 150, 151, 152,
Dale Johannesen3afee192007-09-07 21:07:57 +00001789 153, 154, 155, 70, 0, 1, 2, 0, 3, 4,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001790 5, 61, 62, 71, 145, 64, 65, 66, 67, 68,
1791 69, 70, 0, 1, 2, 0, 3, 4, 5, 0,
1792 0, 0, 0, 0, 0, 71, 0, 72, 0, 0,
1793 73, 0, 344, 74, 0, 75, 0, 0, 0, 0,
1794 0, 0, 0, 71, 0, 72, 0, 0, 73, 0,
1795 0, 74, 0, 75, 61, 62, 0, 104, 64, 65,
1796 66, 67, 68, 69, 70, 0, 1, 2, 0, 3,
1797 4, 5, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesen3afee192007-09-07 21:07:57 +00001798 0, 0, 0, 0, 0, 72, 0, 0, 73, 0,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001799 0, 74, 0, 75, 0, 0, 71, 0, 0, 0,
1800 0, 0, 0, 72, 0, 0, 73, 0, 0, 74,
1801 0, 75, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesen3afee192007-09-07 21:07:57 +00001802 0, 0, 0, 0, 0, 72, 0, 0, 73, 0,
1803 0, 74, 0, 75, 0, 0, 0, 0, 0, 0,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001804 0, 0, 0, 72, 0, 0, 73, 0, 0, 74,
1805 0, 75, 61, 62, 0, 264, 64, 65, 66, 67,
1806 68, 69, 70, 0, 1, 2, 0, 3, 4, 5,
1807 61, 62, 0, 104, 150, 151, 152, 153, 154, 155,
1808 70, 0, 1, 2, 0, 3, 4, 5, 0, 0,
1809 0, 0, 0, 0, 71, 0, 72, 0, 0, 73,
1810 0, 0, 74, 0, 75, 0, 0, 0, 0, 0,
1811 61, 62, 71, 104, 64, 65, 66, 67, 68, 69,
1812 516, 0, 1, 2, 0, 3, 4, 5, 61, 62,
1813 0, 104, 64, 65, 66, 67, 68, 69, 568, 0,
1814 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
1815 0, 0, 71, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesen3afee192007-09-07 21:07:57 +00001816 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001817 71, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesen3afee192007-09-07 21:07:57 +00001818 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001819 0, 0, 0, 0, 72, 0, 0, 73, 0, 0,
1820 74, 0, 75, 0, 0, 0, 0, 0, 0, 0,
1821 0, 0, 72, 0, 0, 73, 0, 0, 74, 0,
1822 347, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesen3afee192007-09-07 21:07:57 +00001823 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001824 0, 0, 0, 0, 0, 0, 0, 0, 165, 0,
1825 0, 0, 72, 0, 0, 73, 0, 0, 74, 0,
1826 75, 0, 0, 0, 0, 0, 0, 166, 167, 0,
1827 72, 0, 0, 73, 0, 0, 74, 0, 75, 168,
1828 169, 170, 171, 172, 173, 174, 175, 176, 177, 178,
1829 179, 180, 181, 182, 183, 184, 185, 186, 187, 188,
1830 189, 190, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesen3afee192007-09-07 21:07:57 +00001831 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001832 0, 0, 191, 192, 193, 0, 0, 194, 195, 196,
1833 197, 198, 199, 200, 201, 202, 203, 204, 205, 206,
1834 207, 208, 209, 210, 211, 212
Dale Johannesen3afee192007-09-07 21:07:57 +00001835};
1836
1837static const short yycheck[] = { 0,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001838 26, 170, 158, 11, 117, 426, 4, 230, 11, 193,
1839 21, 28, 171, 301, 11, 16, 124, 0, 29, 253,
1840 254, 564, 34, 147, 208, 209, 210, 211, 212, 34,
1841 143, 215, 11, 16, 158, 146, 148, 580, 38, 334,
1842 335, 0, 148, 52, 150, 35, 158, 37, 53, 75,
1843 156, 147, 3, 4, 5, 6, 53, 66, 217, 18,
1844 19, 20, 158, 22, 23, 24, 147, 147, 147, 57,
1845 151, 30, 31, 99, 53, 26, 27, 103, 158, 158,
1846 11, 39, 40, 109, 117, 118, 17, 45, 114, 90,
1847 511, 147, 51, 51, 147, 54, 32, 33, 124, 58,
1848 156, 134, 135, 156, 137, 138, 146, 140, 141, 142,
1849 136, 137, 147, 347, 140, 42, 43, 44, 144, 154,
1850 47, 18, 134, 135, 136, 546, 547, 139, 46, 424,
1851 48, 147, 316, 367, 134, 135, 136, 147, 154, 139,
1852 157, 151, 168, 134, 135, 136, 154, 158, 139, 19,
1853 146, 154, 22, 265, 24, 267, 268, 146, 270, 157,
1854 581, 582, 146, 271, 452, 191, 192, 193, 194, 22,
1855 148, 148, 150, 150, 21, 152, 154, 148, 161, 150,
1856 151, 207, 208, 209, 210, 211, 212, 213, 214, 215,
1857 147, 303, 152, 481, 151, 483, 148, 223, 150, 311,
1858 312, 385, 22, 387, 388, 389, 314, 233, 42, 43,
1859 44, 45, 46, 47, 48, 148, 50, 150, 151, 7,
1860 8, 3, 4, 5, 6, 22, 339, 340, 341, 342,
1861 343, 19, 20, 22, 22, 23, 24, 113, 114, 352,
1862 353, 354, 530, 147, 148, 271, 150, 150, 147, 148,
1863 473, 150, 20, 110, 111, 23, 282, 4, 414, 143,
1864 144, 145, 4, 375, 376, 377, 42, 37, 44, 81,
1865 82, 383, 153, 299, 60, 61, 62, 63, 64, 65,
1866 153, 393, 394, 4, 22, 147, 151, 156, 314, 315,
1867 316, 404, 405, 151, 150, 9, 19, 9, 411, 22,
1868 484, 24, 414, 487, 488, 489, 9, 9, 9, 143,
1869 144, 145, 9, 11, 55, 156, 22, 150, 150, 150,
1870 0, 347, 150, 150, 150, 437, 549, 439, 150, 552,
1871 442, 357, 150, 147, 150, 150, 448, 449, 18, 19,
1872 20, 147, 22, 23, 24, 458, 459, 460, 461, 147,
1873 30, 31, 465, 466, 147, 147, 147, 147, 152, 385,
1874 386, 387, 388, 389, 476, 477, 392, 479, 480, 38,
1875 38, 51, 150, 485, 54, 59, 545, 403, 58, 156,
1876 147, 147, 147, 495, 497, 498, 147, 147, 267, 268,
1877 147, 270, 147, 147, 117, 118, 565, 147, 147, 147,
1878 38, 22, 4, 147, 516, 517, 151, 22, 17, 17,
1879 150, 134, 135, 525, 137, 138, 147, 140, 141, 142,
1880 533, 147, 535, 536, 303, 4, 150, 453, 147, 147,
1881 147, 147, 311, 312, 147, 53, 147, 147, 147, 22,
1882 147, 467, 147, 147, 17, 4, 472, 53, 156, 17,
1883 562, 151, 478, 147, 147, 151, 568, 569, 484, 151,
1884 147, 487, 488, 489, 152, 154, 492, 17, 151, 151,
1885 471, 147, 151, 154, 26, 27, 588, 589, 151, 151,
1886 147, 593, 17, 71, 596, 90, 91, 92, 93, 94,
1887 95, 96, 97, 98, 99, 17, 375, 376, 377, 0,
1888 0, 127, 127, 127, 383, 3, 4, 246, 245, 540,
1889 90, 9, 109, 512, 393, 394, 103, 16, 233, 492,
1890 87, 54, 548, 406, 223, -1, -1, 25, 26, 27,
1891 -1, -1, -1, -1, -1, -1, -1, -1, -1, 540,
1892 -1, -1, 40, 41, 96, 97, 98, 99, 100, 101,
1893 102, 103, 104, 105, 106, 107, 108, 109, 437, 57,
1894 439, -1, -1, 442, -1, -1, -1, -1, -1, 448,
1895 449, -1, -1, -1, -1, 73, 74, 75, 76, 77,
1896 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
1897 88, 89, -1, -1, -1, -1, -1, 476, 477, -1,
1898 479, 480, -1, -1, -1, -1, 485, -1, -1, -1,
1899 -1, -1, -1, -1, -1, -1, 495, 115, 116, 117,
1900 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
1901 -1, 129, -1, 131, 132, 133, -1, 516, 517, -1,
1902 -1, -1, -1, -1, -1, -1, 525, -1, 3, 4,
1903 -1, -1, 7, 8, 9, -1, -1, 155, -1, -1,
1904 -1, -1, -1, -1, 19, 20, -1, 22, 23, 24,
1905 25, 26, 27, -1, -1, -1, -1, -1, -1, -1,
1906 -1, -1, -1, 562, -1, 40, 41, -1, -1, 568,
1907 569, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1908 -1, -1, 57, -1, -1, -1, -1, -1, -1, 588,
1909 589, -1, -1, -1, 593, -1, -1, 596, 73, 74,
1910 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1911 85, 86, 87, 88, 89, -1, -1, -1, -1, -1,
1912 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1913 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1914 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1915 125, 126, 127, -1, 129, -1, 131, 132, 133, -1,
1916 -1, -1, 3, 4, -1, -1, 7, 8, 9, -1,
1917 -1, -1, -1, 148, -1, 150, -1, -1, 19, 20,
1918 155, 22, 23, 24, 25, 26, 27, -1, -1, -1,
1919 -1, 7, 8, -1, -1, -1, -1, -1, -1, 40,
1920 41, -1, -1, 19, 20, -1, 22, 23, 24, 25,
1921 -1, -1, -1, -1, -1, -1, 57, -1, -1, -1,
1922 -1, -1, -1, -1, 40, 41, -1, -1, -1, -1,
1923 -1, -1, 73, 74, 75, 76, 77, 78, 79, 80,
1924 81, 82, 83, 84, 85, 86, 87, 88, 89, -1,
1925 -1, -1, -1, -1, -1, -1, -1, 73, 74, 75,
Dale Johannesen3afee192007-09-07 21:07:57 +00001926 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001927 86, 87, 88, 89, 115, 116, 117, 118, 119, 120,
1928 121, 122, 123, 124, 125, 126, 127, -1, 129, -1,
1929 131, 132, 133, -1, -1, -1, -1, -1, -1, 115,
Dale Johannesen3afee192007-09-07 21:07:57 +00001930 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001931 126, 127, -1, 129, 155, 131, 132, 133, -1, -1,
Dale Johannesen3afee192007-09-07 21:07:57 +00001932 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001933 -1, -1, 148, -1, 150, -1, 152, -1, -1, 155,
1934 -1, 157, -1, 159, 7, 8, -1, 10, 11, 12,
1935 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
1936 23, 24, 7, 8, -1, 10, 11, 12, 13, 14,
1937 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
1938 -1, -1, -1, -1, 7, 8, 49, 10, 11, 12,
1939 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
1940 23, 24, 7, 8, 49, 10, 11, 12, 13, 14,
1941 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
1942 -1, -1, -1, -1, 7, 8, 49, 10, 11, 12,
1943 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
1944 23, 24, 7, 8, 49, 10, 11, 12, 13, 14,
1945 15, 16, 17, -1, 19, 20, 39, 22, 23, 24,
1946 -1, -1, -1, -1, 7, 8, 49, 10, 11, 12,
1947 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
1948 23, 24, -1, -1, 49, -1, 149, -1, -1, 152,
1949 -1, -1, 155, -1, 157, 158, 39, -1, -1, -1,
1950 -1, -1, -1, -1, 149, -1, 49, 152, -1, -1,
1951 155, -1, 157, 158, -1, -1, -1, -1, -1, -1,
1952 -1, -1, -1, -1, -1, -1, 149, -1, -1, 152,
1953 -1, -1, 155, -1, 157, 158, -1, -1, -1, -1,
1954 -1, -1, -1, -1, 149, -1, -1, 152, -1, -1,
1955 155, -1, 157, 158, -1, -1, 121, -1, -1, -1,
1956 -1, -1, -1, -1, -1, -1, 149, -1, -1, 152,
1957 -1, -1, 155, -1, 157, -1, -1, -1, -1, -1,
1958 -1, -1, -1, -1, 149, -1, -1, 152, -1, -1,
1959 155, -1, 157, -1, -1, -1, -1, -1, -1, -1,
1960 -1, -1, -1, -1, -1, -1, 149, -1, -1, 152,
1961 -1, -1, 155, -1, 157, 7, 8, -1, 10, 11,
Dale Johannesen3afee192007-09-07 21:07:57 +00001962 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
1963 22, 23, 24, 7, 8, -1, 10, 11, 12, 13,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001964 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1965 24, -1, -1, -1, -1, -1, -1, 49, -1, -1,
1966 -1, -1, -1, -1, -1, 39, -1, -1, -1, -1,
1967 -1, -1, -1, 7, 8, 49, 10, 11, 12, 13,
1968 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1969 24, 7, 8, -1, 10, 11, 12, 13, 14, 15,
1970 16, 17, -1, 19, 20, 39, 22, 23, 24, -1,
1971 -1, -1, -1, 7, 8, 49, 10, 11, 12, 13,
1972 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
1973 24, 7, 8, 49, 10, 11, 12, 13, 14, 15,
1974 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
1975 -1, -1, -1, -1, -1, 49, -1, 149, -1, -1,
1976 152, -1, 154, 155, -1, 157, -1, -1, -1, -1,
1977 -1, -1, -1, 49, -1, 149, -1, -1, 152, -1,
1978 -1, 155, -1, 157, 7, 8, -1, 10, 11, 12,
1979 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
1980 23, 24, -1, -1, -1, -1, -1, -1, -1, -1,
1981 -1, -1, -1, -1, -1, 149, -1, -1, 152, -1,
1982 -1, 155, -1, 157, -1, -1, 49, -1, -1, -1,
1983 -1, -1, -1, 149, -1, -1, 152, -1, -1, 155,
1984 -1, 157, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesen3afee192007-09-07 21:07:57 +00001985 -1, -1, -1, -1, -1, 149, -1, -1, 152, -1,
1986 -1, 155, -1, 157, -1, -1, -1, -1, -1, -1,
Dale Johannesencfb19e62007-11-05 21:20:28 +00001987 -1, -1, -1, 149, -1, -1, 152, -1, -1, 155,
1988 -1, 157, 7, 8, -1, 10, 11, 12, 13, 14,
1989 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
1990 7, 8, -1, 10, 11, 12, 13, 14, 15, 16,
1991 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
1992 -1, -1, -1, -1, 49, -1, 149, -1, -1, 152,
1993 -1, -1, 155, -1, 157, -1, -1, -1, -1, -1,
1994 7, 8, 49, 10, 11, 12, 13, 14, 15, 16,
1995 17, -1, 19, 20, -1, 22, 23, 24, 7, 8,
1996 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
1997 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
1998 -1, -1, 49, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesen3afee192007-09-07 21:07:57 +00001999 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesencfb19e62007-11-05 21:20:28 +00002000 49, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesen3afee192007-09-07 21:07:57 +00002001 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesencfb19e62007-11-05 21:20:28 +00002002 -1, -1, -1, -1, 149, -1, -1, 152, -1, -1,
2003 155, -1, 157, -1, -1, -1, -1, -1, -1, -1,
2004 -1, -1, 149, -1, -1, 152, -1, -1, 155, -1,
2005 157, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesen3afee192007-09-07 21:07:57 +00002006 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesencfb19e62007-11-05 21:20:28 +00002007 -1, -1, -1, -1, -1, -1, -1, -1, 36, -1,
2008 -1, -1, 149, -1, -1, 152, -1, -1, 155, -1,
2009 157, -1, -1, -1, -1, -1, -1, 55, 56, -1,
2010 149, -1, -1, 152, -1, -1, 155, -1, 157, 67,
2011 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
2012 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2013 88, 89, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesen3afee192007-09-07 21:07:57 +00002014 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesencfb19e62007-11-05 21:20:28 +00002015 -1, -1, 110, 111, 112, -1, -1, 115, 116, 117,
2016 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2017 128, 129, 130, 131, 132, 133
Dale Johannesen3afee192007-09-07 21:07:57 +00002018};
2019/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
2020#line 3 "/usr/share/bison.simple"
2021/* This file comes from bison-1.28. */
2022
2023/* Skeleton output parser for bison,
2024 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
2025
2026 This program is free software; you can redistribute it and/or modify
2027 it under the terms of the GNU General Public License as published by
2028 the Free Software Foundation; either version 2, or (at your option)
2029 any later version.
2030
2031 This program is distributed in the hope that it will be useful,
2032 but WITHOUT ANY WARRANTY; without even the implied warranty of
2033 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2034 GNU General Public License for more details.
2035
2036 You should have received a copy of the GNU General Public License
2037 along with this program; if not, write to the Free Software
2038 Foundation, Inc., 59 Temple Place - Suite 330,
2039 Boston, MA 02111-1307, USA. */
2040
2041/* As a special exception, when this file is copied by Bison into a
2042 Bison output file, you may use that output file without restriction.
2043 This special exception was added by the Free Software Foundation
2044 in version 1.24 of Bison. */
2045
2046/* This is the parser code that is written into each bison parser
2047 when the %semantic_parser declaration is not specified in the grammar.
2048 It was written by Richard Stallman by simplifying the hairy parser
2049 used when %semantic_parser is specified. */
2050
2051#ifndef YYSTACK_USE_ALLOCA
2052#ifdef alloca
2053#define YYSTACK_USE_ALLOCA
2054#else /* alloca not defined */
2055#ifdef __GNUC__
2056#define YYSTACK_USE_ALLOCA
2057#define alloca __builtin_alloca
2058#else /* not GNU C. */
2059#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
2060#define YYSTACK_USE_ALLOCA
2061#include <alloca.h>
2062#else /* not sparc */
2063/* We think this test detects Watcom and Microsoft C. */
2064/* This used to test MSDOS, but that is a bad idea
2065 since that symbol is in the user namespace. */
2066#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
2067#if 0 /* No need for malloc.h, which pollutes the namespace;
2068 instead, just don't use alloca. */
2069#include <malloc.h>
2070#endif
2071#else /* not MSDOS, or __TURBOC__ */
2072#if defined(_AIX)
2073/* I don't know what this was needed for, but it pollutes the namespace.
2074 So I turned it off. rms, 2 May 1997. */
2075/* #include <malloc.h> */
2076 #pragma alloca
2077#define YYSTACK_USE_ALLOCA
2078#else /* not MSDOS, or __TURBOC__, or _AIX */
2079#if 0
2080#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
2081 and on HPUX 10. Eventually we can turn this on. */
2082#define YYSTACK_USE_ALLOCA
2083#define alloca __builtin_alloca
2084#endif /* __hpux */
2085#endif
2086#endif /* not _AIX */
2087#endif /* not MSDOS, or __TURBOC__ */
2088#endif /* not sparc */
2089#endif /* not GNU C */
2090#endif /* alloca not defined */
2091#endif /* YYSTACK_USE_ALLOCA not defined */
2092
2093#ifdef YYSTACK_USE_ALLOCA
2094#define YYSTACK_ALLOC alloca
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002095#else
Dale Johannesen3afee192007-09-07 21:07:57 +00002096#define YYSTACK_ALLOC malloc
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002097#endif
2098
Dale Johannesen3afee192007-09-07 21:07:57 +00002099/* Note: there must be only one dollar sign in this file.
2100 It is replaced by the list of actions, each action
2101 as one case of the switch. */
David Greene9145dd22007-08-01 03:59:32 +00002102
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002103#define yyerrok (yyerrstatus = 0)
2104#define yyclearin (yychar = YYEMPTY)
Dale Johannesen3afee192007-09-07 21:07:57 +00002105#define YYEMPTY -2
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002106#define YYEOF 0
2107#define YYACCEPT goto yyacceptlab
Dale Johannesen3afee192007-09-07 21:07:57 +00002108#define YYABORT goto yyabortlab
2109#define YYERROR goto yyerrlab1
2110/* Like YYERROR except do call yyerror.
2111 This remains here temporarily to ease the
2112 transition to the new meaning of YYERROR, for GCC.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002113 Once GCC version 2 has supplanted version 1, this can go. */
2114#define YYFAIL goto yyerrlab
2115#define YYRECOVERING() (!!yyerrstatus)
Dale Johannesen3afee192007-09-07 21:07:57 +00002116#define YYBACKUP(token, value) \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002117do \
2118 if (yychar == YYEMPTY && yylen == 1) \
Dale Johannesen3afee192007-09-07 21:07:57 +00002119 { yychar = (token), yylval = (value); \
2120 yychar1 = YYTRANSLATE (yychar); \
Chris Lattnerbb856a32007-08-06 21:00:46 +00002121 YYPOPSTACK; \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002122 goto yybackup; \
2123 } \
2124 else \
Dale Johannesen3afee192007-09-07 21:07:57 +00002125 { yyerror ("syntax error: cannot back up"); YYERROR; } \
Chris Lattnerbb856a32007-08-06 21:00:46 +00002126while (0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002127
2128#define YYTERROR 1
2129#define YYERRCODE 256
2130
Dale Johannesen3afee192007-09-07 21:07:57 +00002131#ifndef YYPURE
2132#define YYLEX yylex()
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002133#endif
2134
Dale Johannesen3afee192007-09-07 21:07:57 +00002135#ifdef YYPURE
2136#ifdef YYLSP_NEEDED
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002137#ifdef YYLEX_PARAM
Dale Johannesen3afee192007-09-07 21:07:57 +00002138#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002139#else
Dale Johannesen3afee192007-09-07 21:07:57 +00002140#define YYLEX yylex(&yylval, &yylloc)
2141#endif
2142#else /* not YYLSP_NEEDED */
2143#ifdef YYLEX_PARAM
2144#define YYLEX yylex(&yylval, YYLEX_PARAM)
2145#else
2146#define YYLEX yylex(&yylval)
2147#endif
2148#endif /* not YYLSP_NEEDED */
Chris Lattnerbb856a32007-08-06 21:00:46 +00002149#endif
David Greene48556392007-09-04 18:46:50 +00002150
Dale Johannesen3afee192007-09-07 21:07:57 +00002151/* If nonreentrant, generate the variables here */
David Greene48556392007-09-04 18:46:50 +00002152
Dale Johannesen3afee192007-09-07 21:07:57 +00002153#ifndef YYPURE
David Greene48556392007-09-04 18:46:50 +00002154
Dale Johannesen3afee192007-09-07 21:07:57 +00002155int yychar; /* the lookahead symbol */
2156YYSTYPE yylval; /* the semantic value of the */
2157 /* lookahead symbol */
David Greene48556392007-09-04 18:46:50 +00002158
Dale Johannesen3afee192007-09-07 21:07:57 +00002159#ifdef YYLSP_NEEDED
2160YYLTYPE yylloc; /* location data for the lookahead */
2161 /* symbol */
Chris Lattnerbb856a32007-08-06 21:00:46 +00002162#endif
David Greene48556392007-09-04 18:46:50 +00002163
Dale Johannesen3afee192007-09-07 21:07:57 +00002164int yynerrs; /* number of parse errors so far */
2165#endif /* not YYPURE */
David Greene48556392007-09-04 18:46:50 +00002166
Dale Johannesen3afee192007-09-07 21:07:57 +00002167#if YYDEBUG != 0
2168int yydebug; /* nonzero means print parse trace */
2169/* Since this is uninitialized, it does not stop multiple parsers
2170 from coexisting. */
Dale Johannesenf325d9f2007-08-03 01:03:46 +00002171#endif
Chandler Carruth563d4a42007-08-04 01:56:21 +00002172
Dale Johannesen3afee192007-09-07 21:07:57 +00002173/* YYINITDEPTH indicates the initial size of the parser's stacks */
Chandler Carruth563d4a42007-08-04 01:56:21 +00002174
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002175#ifndef YYINITDEPTH
Dale Johannesen3afee192007-09-07 21:07:57 +00002176#define YYINITDEPTH 200
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002177#endif
2178
Dale Johannesen3afee192007-09-07 21:07:57 +00002179/* YYMAXDEPTH is the maximum size the stacks can grow to
2180 (effective only if the built-in stack extension method is used). */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002181
Dale Johannesen3afee192007-09-07 21:07:57 +00002182#if YYMAXDEPTH == 0
2183#undef YYMAXDEPTH
Chris Lattnerbb856a32007-08-06 21:00:46 +00002184#endif
David Greene9145dd22007-08-01 03:59:32 +00002185
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002186#ifndef YYMAXDEPTH
Dale Johannesen3afee192007-09-07 21:07:57 +00002187#define YYMAXDEPTH 10000
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002188#endif
2189
Dale Johannesen3afee192007-09-07 21:07:57 +00002190/* Define __yy_memcpy. Note that the size argument
2191 should be passed with type unsigned int, because that is what the non-GCC
2192 definitions require. With GCC, __builtin_memcpy takes an arg
2193 of type size_t, but it can handle unsigned int. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002194
Dale Johannesen3afee192007-09-07 21:07:57 +00002195#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
2196#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
2197#else /* not GNU C or C++ */
2198#ifndef __cplusplus
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002199
Dale Johannesen3afee192007-09-07 21:07:57 +00002200/* This is the most reliable way to avoid incompatibilities
2201 in available built-in functions on various systems. */
David Greene48556392007-09-04 18:46:50 +00002202static void
Dale Johannesen3afee192007-09-07 21:07:57 +00002203__yy_memcpy (to, from, count)
2204 char *to;
2205 char *from;
2206 unsigned int count;
2207{
2208 register char *f = from;
2209 register char *t = to;
2210 register int i = count;
2211
2212 while (i-- > 0)
2213 *t++ = *f++;
2214}
2215
2216#else /* __cplusplus */
2217
2218/* This is the most reliable way to avoid incompatibilities
2219 in available built-in functions on various systems. */
David Greene48556392007-09-04 18:46:50 +00002220static void
Dale Johannesen3afee192007-09-07 21:07:57 +00002221__yy_memcpy (char *to, char *from, unsigned int count)
2222{
2223 register char *t = to;
2224 register char *f = from;
2225 register int i = count;
2226
2227 while (i-- > 0)
2228 *t++ = *f++;
2229}
2230
Dale Johannesenf325d9f2007-08-03 01:03:46 +00002231#endif
David Greene48556392007-09-04 18:46:50 +00002232#endif
David Greene48556392007-09-04 18:46:50 +00002233
Dale Johannesen3afee192007-09-07 21:07:57 +00002234#line 217 "/usr/share/bison.simple"
David Greene48556392007-09-04 18:46:50 +00002235
Dale Johannesen3afee192007-09-07 21:07:57 +00002236/* The user can define YYPARSE_PARAM as the name of an argument to be passed
2237 into yyparse. The argument should have type void *.
2238 It should actually point to an object.
2239 Grammar actions can access the variable by casting it
2240 to the proper pointer type. */
David Greene48556392007-09-04 18:46:50 +00002241
2242#ifdef YYPARSE_PARAM
Dale Johannesen3afee192007-09-07 21:07:57 +00002243#ifdef __cplusplus
2244#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
2245#define YYPARSE_PARAM_DECL
2246#else /* not __cplusplus */
2247#define YYPARSE_PARAM_ARG YYPARSE_PARAM
2248#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
2249#endif /* not __cplusplus */
2250#else /* not YYPARSE_PARAM */
2251#define YYPARSE_PARAM_ARG
2252#define YYPARSE_PARAM_DECL
2253#endif /* not YYPARSE_PARAM */
2254
2255/* Prevent warning if -Wstrict-prototypes. */
2256#ifdef __GNUC__
2257#ifdef YYPARSE_PARAM
2258int yyparse (void *);
2259#else
David Greene48556392007-09-04 18:46:50 +00002260int yyparse (void);
David Greene48556392007-09-04 18:46:50 +00002261#endif
Dale Johannesen3afee192007-09-07 21:07:57 +00002262#endif
David Greene48556392007-09-04 18:46:50 +00002263
David Greene48556392007-09-04 18:46:50 +00002264int
Dale Johannesen3afee192007-09-07 21:07:57 +00002265yyparse(YYPARSE_PARAM_ARG)
2266 YYPARSE_PARAM_DECL
David Greene48556392007-09-04 18:46:50 +00002267{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002268 register int yystate;
2269 register int yyn;
2270 register short *yyssp;
2271 register YYSTYPE *yyvsp;
Dale Johannesen3afee192007-09-07 21:07:57 +00002272 int yyerrstatus; /* number of tokens to shift before error messages enabled */
2273 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
Chris Lattnerbb856a32007-08-06 21:00:46 +00002274
Dale Johannesen3afee192007-09-07 21:07:57 +00002275 short yyssa[YYINITDEPTH]; /* the state stack */
2276 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
Chris Lattnerbb856a32007-08-06 21:00:46 +00002277
Dale Johannesen3afee192007-09-07 21:07:57 +00002278 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
2279 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
Chris Lattnerbb856a32007-08-06 21:00:46 +00002280
Dale Johannesen3afee192007-09-07 21:07:57 +00002281#ifdef YYLSP_NEEDED
2282 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
2283 YYLTYPE *yyls = yylsa;
2284 YYLTYPE *yylsp;
2285
2286#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
2287#else
Chris Lattnerbb856a32007-08-06 21:00:46 +00002288#define YYPOPSTACK (yyvsp--, yyssp--)
Dale Johannesen3afee192007-09-07 21:07:57 +00002289#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002290
Dale Johannesen3afee192007-09-07 21:07:57 +00002291 int yystacksize = YYINITDEPTH;
2292 int yyfree_stacks = 0;
Chandler Carruth563d4a42007-08-04 01:56:21 +00002293
Dale Johannesen3afee192007-09-07 21:07:57 +00002294#ifdef YYPURE
2295 int yychar;
2296 YYSTYPE yylval;
2297 int yynerrs;
2298#ifdef YYLSP_NEEDED
2299 YYLTYPE yylloc;
2300#endif
2301#endif
Chandler Carruth563d4a42007-08-04 01:56:21 +00002302
Dale Johannesen3afee192007-09-07 21:07:57 +00002303 YYSTYPE yyval; /* the variable used to return */
2304 /* semantic values from the action */
2305 /* routines */
Chandler Carruth563d4a42007-08-04 01:56:21 +00002306
Chris Lattnerbb856a32007-08-06 21:00:46 +00002307 int yylen;
Chandler Carruth563d4a42007-08-04 01:56:21 +00002308
Dale Johannesen3afee192007-09-07 21:07:57 +00002309#if YYDEBUG != 0
2310 if (yydebug)
2311 fprintf(stderr, "Starting parse\n");
2312#endif
Chandler Carruth563d4a42007-08-04 01:56:21 +00002313
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002314 yystate = 0;
2315 yyerrstatus = 0;
2316 yynerrs = 0;
2317 yychar = YYEMPTY; /* Cause a token to be read. */
2318
2319 /* Initialize stack pointers.
2320 Waste one element of value and location stack
2321 so that they stay on the same level as the state stack.
2322 The wasted elements are never initialized. */
2323
Dale Johannesen3afee192007-09-07 21:07:57 +00002324 yyssp = yyss - 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002325 yyvsp = yyvs;
Dale Johannesen3afee192007-09-07 21:07:57 +00002326#ifdef YYLSP_NEEDED
2327 yylsp = yyls;
2328#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002329
Dale Johannesen3afee192007-09-07 21:07:57 +00002330/* Push a new state, which is found in yystate . */
2331/* In all cases, when you get here, the value and location stacks
2332 have just been pushed. so pushing a state here evens the stacks. */
2333yynewstate:
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002334
Dale Johannesen3afee192007-09-07 21:07:57 +00002335 *++yyssp = yystate;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002336
Dale Johannesen3afee192007-09-07 21:07:57 +00002337 if (yyssp >= yyss + yystacksize - 1)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002338 {
Dale Johannesen3afee192007-09-07 21:07:57 +00002339 /* Give user a chance to reallocate the stack */
2340 /* Use copies of these so that the &'s don't force the real ones into memory. */
2341 YYSTYPE *yyvs1 = yyvs;
2342 short *yyss1 = yyss;
2343#ifdef YYLSP_NEEDED
2344 YYLTYPE *yyls1 = yyls;
2345#endif
2346
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002347 /* Get the current used size of the three stacks, in elements. */
Dale Johannesen3afee192007-09-07 21:07:57 +00002348 int size = yyssp - yyss + 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002349
2350#ifdef yyoverflow
Dale Johannesen3afee192007-09-07 21:07:57 +00002351 /* Each stack pointer address is followed by the size of
2352 the data in use in that stack, in bytes. */
2353#ifdef YYLSP_NEEDED
2354 /* This used to be a conditional around just the two extra args,
2355 but that might be undefined if yyoverflow is a macro. */
2356 yyoverflow("parser stack overflow",
2357 &yyss1, size * sizeof (*yyssp),
2358 &yyvs1, size * sizeof (*yyvsp),
2359 &yyls1, size * sizeof (*yylsp),
2360 &yystacksize);
2361#else
2362 yyoverflow("parser stack overflow",
2363 &yyss1, size * sizeof (*yyssp),
2364 &yyvs1, size * sizeof (*yyvsp),
2365 &yystacksize);
2366#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002367
Dale Johannesen3afee192007-09-07 21:07:57 +00002368 yyss = yyss1; yyvs = yyvs1;
2369#ifdef YYLSP_NEEDED
2370 yyls = yyls1;
2371#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002372#else /* no yyoverflow */
2373 /* Extend the stack our own way. */
Dale Johannesen3afee192007-09-07 21:07:57 +00002374 if (yystacksize >= YYMAXDEPTH)
2375 {
2376 yyerror("parser stack overflow");
2377 if (yyfree_stacks)
2378 {
2379 free (yyss);
2380 free (yyvs);
2381#ifdef YYLSP_NEEDED
2382 free (yyls);
2383#endif
2384 }
2385 return 2;
2386 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002387 yystacksize *= 2;
Dale Johannesen3afee192007-09-07 21:07:57 +00002388 if (yystacksize > YYMAXDEPTH)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002389 yystacksize = YYMAXDEPTH;
Dale Johannesen3afee192007-09-07 21:07:57 +00002390#ifndef YYSTACK_USE_ALLOCA
2391 yyfree_stacks = 1;
2392#endif
2393 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
2394 __yy_memcpy ((char *)yyss, (char *)yyss1,
2395 size * (unsigned int) sizeof (*yyssp));
2396 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
2397 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
2398 size * (unsigned int) sizeof (*yyvsp));
2399#ifdef YYLSP_NEEDED
2400 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
2401 __yy_memcpy ((char *)yyls, (char *)yyls1,
2402 size * (unsigned int) sizeof (*yylsp));
2403#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002404#endif /* no yyoverflow */
2405
Dale Johannesen3afee192007-09-07 21:07:57 +00002406 yyssp = yyss + size - 1;
2407 yyvsp = yyvs + size - 1;
2408#ifdef YYLSP_NEEDED
2409 yylsp = yyls + size - 1;
2410#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002411
Dale Johannesen3afee192007-09-07 21:07:57 +00002412#if YYDEBUG != 0
2413 if (yydebug)
2414 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
2415#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002416
Dale Johannesen3afee192007-09-07 21:07:57 +00002417 if (yyssp >= yyss + yystacksize - 1)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002418 YYABORT;
2419 }
2420
Dale Johannesen3afee192007-09-07 21:07:57 +00002421#if YYDEBUG != 0
2422 if (yydebug)
2423 fprintf(stderr, "Entering state %d\n", yystate);
2424#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002425
2426 goto yybackup;
Dale Johannesen3afee192007-09-07 21:07:57 +00002427 yybackup:
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002428
Chris Lattnerbb856a32007-08-06 21:00:46 +00002429/* Do appropriate processing given the current state. */
2430/* Read a lookahead token if we need one and don't already have one. */
2431/* yyresume: */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002432
Chris Lattnerbb856a32007-08-06 21:00:46 +00002433 /* First try to decide what to do without reference to lookahead token. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002434
2435 yyn = yypact[yystate];
Dale Johannesen3afee192007-09-07 21:07:57 +00002436 if (yyn == YYFLAG)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002437 goto yydefault;
2438
Chris Lattnerbb856a32007-08-06 21:00:46 +00002439 /* Not known => get a lookahead token if don't already have one. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002440
Dale Johannesen3afee192007-09-07 21:07:57 +00002441 /* yychar is either YYEMPTY or YYEOF
2442 or a valid token in external form. */
2443
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002444 if (yychar == YYEMPTY)
2445 {
Dale Johannesen3afee192007-09-07 21:07:57 +00002446#if YYDEBUG != 0
2447 if (yydebug)
2448 fprintf(stderr, "Reading a token: ");
2449#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002450 yychar = YYLEX;
2451 }
2452
Dale Johannesen3afee192007-09-07 21:07:57 +00002453 /* Convert token to internal form (in yychar1) for indexing tables with */
2454
2455 if (yychar <= 0) /* This means end of input. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002456 {
Dale Johannesen3afee192007-09-07 21:07:57 +00002457 yychar1 = 0;
2458 yychar = YYEOF; /* Don't call YYLEX any more */
2459
2460#if YYDEBUG != 0
2461 if (yydebug)
2462 fprintf(stderr, "Now at end of input.\n");
2463#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002464 }
2465 else
2466 {
Dale Johannesen3afee192007-09-07 21:07:57 +00002467 yychar1 = YYTRANSLATE(yychar);
2468
2469#if YYDEBUG != 0
2470 if (yydebug)
2471 {
2472 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
2473 /* Give the individual parser a way to print the precise meaning
2474 of a token, for further debugging info. */
2475#ifdef YYPRINT
2476 YYPRINT (stderr, yychar, yylval);
2477#endif
2478 fprintf (stderr, ")\n");
2479 }
2480#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002481 }
2482
Dale Johannesen3afee192007-09-07 21:07:57 +00002483 yyn += yychar1;
2484 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002485 goto yydefault;
Dale Johannesen3afee192007-09-07 21:07:57 +00002486
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002487 yyn = yytable[yyn];
Dale Johannesen3afee192007-09-07 21:07:57 +00002488
2489 /* yyn is what to do for this token type in this state.
2490 Negative => reduce, -yyn is rule number.
2491 Positive => shift, yyn is new state.
2492 New state is final state => don't bother to shift,
2493 just return success.
2494 0, or most negative number => error. */
2495
2496 if (yyn < 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002497 {
Dale Johannesen3afee192007-09-07 21:07:57 +00002498 if (yyn == YYFLAG)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002499 goto yyerrlab;
2500 yyn = -yyn;
2501 goto yyreduce;
2502 }
Dale Johannesen3afee192007-09-07 21:07:57 +00002503 else if (yyn == 0)
2504 goto yyerrlab;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002505
2506 if (yyn == YYFINAL)
2507 YYACCEPT;
2508
Chris Lattnerbb856a32007-08-06 21:00:46 +00002509 /* Shift the lookahead token. */
Dale Johannesen3afee192007-09-07 21:07:57 +00002510
2511#if YYDEBUG != 0
2512 if (yydebug)
2513 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
2514#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002515
Chris Lattnerbb856a32007-08-06 21:00:46 +00002516 /* Discard the token being shifted unless it is eof. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002517 if (yychar != YYEOF)
2518 yychar = YYEMPTY;
2519
Chandler Carruth563d4a42007-08-04 01:56:21 +00002520 *++yyvsp = yylval;
Dale Johannesen3afee192007-09-07 21:07:57 +00002521#ifdef YYLSP_NEEDED
2522 *++yylsp = yylloc;
2523#endif
Chandler Carruth563d4a42007-08-04 01:56:21 +00002524
Dale Johannesen3afee192007-09-07 21:07:57 +00002525 /* count tokens shifted since error; after three, turn off error status. */
2526 if (yyerrstatus) yyerrstatus--;
Chris Lattnerbb856a32007-08-06 21:00:46 +00002527
2528 yystate = yyn;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002529 goto yynewstate;
2530
Dale Johannesen3afee192007-09-07 21:07:57 +00002531/* Do the default action for the current state. */
David Greene48556392007-09-04 18:46:50 +00002532yydefault:
Dale Johannesen3afee192007-09-07 21:07:57 +00002533
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002534 yyn = yydefact[yystate];
2535 if (yyn == 0)
2536 goto yyerrlab;
2537
Dale Johannesen3afee192007-09-07 21:07:57 +00002538/* Do a reduction. yyn is the number of a rule to reduce with. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002539yyreduce:
2540 yylen = yyr2[yyn];
Dale Johannesen3afee192007-09-07 21:07:57 +00002541 if (yylen > 0)
2542 yyval = yyvsp[1-yylen]; /* implement default value of the action */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002543
Dale Johannesen3afee192007-09-07 21:07:57 +00002544#if YYDEBUG != 0
2545 if (yydebug)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002546 {
Dale Johannesen3afee192007-09-07 21:07:57 +00002547 int i;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002548
Dale Johannesen3afee192007-09-07 21:07:57 +00002549 fprintf (stderr, "Reducing via rule %d (line %d), ",
2550 yyn, yyrline[yyn]);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002551
Dale Johannesen3afee192007-09-07 21:07:57 +00002552 /* Print the symbols being reduced, and their result. */
2553 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
2554 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
2555 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
2556 }
2557#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002558
2559
Dale Johannesen3afee192007-09-07 21:07:57 +00002560 switch (yyn) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002561
Dale Johannesen3afee192007-09-07 21:07:57 +00002562case 28:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002563#line 1133 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002564{ yyval.IPredicate = ICmpInst::ICMP_EQ; ;
2565 break;}
2566case 29:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002567#line 1133 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002568{ yyval.IPredicate = ICmpInst::ICMP_NE; ;
2569 break;}
2570case 30:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002571#line 1134 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002572{ yyval.IPredicate = ICmpInst::ICMP_SLT; ;
2573 break;}
2574case 31:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002575#line 1134 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002576{ yyval.IPredicate = ICmpInst::ICMP_SGT; ;
2577 break;}
2578case 32:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002579#line 1135 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002580{ yyval.IPredicate = ICmpInst::ICMP_SLE; ;
2581 break;}
2582case 33:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002583#line 1135 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002584{ yyval.IPredicate = ICmpInst::ICMP_SGE; ;
2585 break;}
2586case 34:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002587#line 1136 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002588{ yyval.IPredicate = ICmpInst::ICMP_ULT; ;
2589 break;}
2590case 35:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002591#line 1136 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002592{ yyval.IPredicate = ICmpInst::ICMP_UGT; ;
2593 break;}
2594case 36:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002595#line 1137 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002596{ yyval.IPredicate = ICmpInst::ICMP_ULE; ;
2597 break;}
2598case 37:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002599#line 1137 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002600{ yyval.IPredicate = ICmpInst::ICMP_UGE; ;
2601 break;}
2602case 38:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002603#line 1141 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002604{ yyval.FPredicate = FCmpInst::FCMP_OEQ; ;
2605 break;}
2606case 39:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002607#line 1141 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002608{ yyval.FPredicate = FCmpInst::FCMP_ONE; ;
2609 break;}
2610case 40:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002611#line 1142 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002612{ yyval.FPredicate = FCmpInst::FCMP_OLT; ;
2613 break;}
2614case 41:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002615#line 1142 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002616{ yyval.FPredicate = FCmpInst::FCMP_OGT; ;
2617 break;}
2618case 42:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002619#line 1143 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002620{ yyval.FPredicate = FCmpInst::FCMP_OLE; ;
2621 break;}
2622case 43:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002623#line 1143 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002624{ yyval.FPredicate = FCmpInst::FCMP_OGE; ;
2625 break;}
2626case 44:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002627#line 1144 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002628{ yyval.FPredicate = FCmpInst::FCMP_ORD; ;
2629 break;}
2630case 45:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002631#line 1144 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002632{ yyval.FPredicate = FCmpInst::FCMP_UNO; ;
2633 break;}
2634case 46:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002635#line 1145 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002636{ yyval.FPredicate = FCmpInst::FCMP_UEQ; ;
2637 break;}
2638case 47:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002639#line 1145 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002640{ yyval.FPredicate = FCmpInst::FCMP_UNE; ;
2641 break;}
2642case 48:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002643#line 1146 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002644{ yyval.FPredicate = FCmpInst::FCMP_ULT; ;
2645 break;}
2646case 49:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002647#line 1146 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002648{ yyval.FPredicate = FCmpInst::FCMP_UGT; ;
2649 break;}
2650case 50:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002651#line 1147 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002652{ yyval.FPredicate = FCmpInst::FCMP_ULE; ;
2653 break;}
2654case 51:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002655#line 1147 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002656{ yyval.FPredicate = FCmpInst::FCMP_UGE; ;
2657 break;}
2658case 52:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002659#line 1148 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002660{ yyval.FPredicate = FCmpInst::FCMP_TRUE; ;
2661 break;}
2662case 53:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002663#line 1149 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002664{ yyval.FPredicate = FCmpInst::FCMP_FALSE; ;
2665 break;}
2666case 64:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002667#line 1158 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002668{ yyval.StrVal = 0; ;
2669 break;}
2670case 65:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002671#line 1162 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002672{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002673 yyval.StrVal = yyvsp[-1].StrVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002674 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00002675 ;
2676 break;}
2677case 66:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002678#line 1166 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002679{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002680 yyval.StrVal = 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002681 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00002682 ;
2683 break;}
2684case 70:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002685#line 1174 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002686{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002687 yyval.StrVal = 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002688 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00002689 ;
2690 break;}
2691case 71:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002692#line 1179 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002693{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002694 yyval.StrVal = yyvsp[-1].StrVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002695 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00002696 ;
2697 break;}
2698case 72:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002699#line 1185 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002700{ yyval.Linkage = GlobalValue::InternalLinkage; ;
2701 break;}
2702case 73:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002703#line 1186 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002704{ yyval.Linkage = GlobalValue::WeakLinkage; ;
2705 break;}
2706case 74:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002707#line 1187 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002708{ yyval.Linkage = GlobalValue::LinkOnceLinkage; ;
2709 break;}
2710case 75:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002711#line 1188 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002712{ yyval.Linkage = GlobalValue::AppendingLinkage; ;
2713 break;}
2714case 76:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002715#line 1189 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002716{ yyval.Linkage = GlobalValue::DLLExportLinkage; ;
2717 break;}
2718case 77:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002719#line 1193 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002720{ yyval.Linkage = GlobalValue::DLLImportLinkage; ;
2721 break;}
2722case 78:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002723#line 1194 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002724{ yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;
2725 break;}
2726case 79:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002727#line 1195 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002728{ yyval.Linkage = GlobalValue::ExternalLinkage; ;
2729 break;}
2730case 80:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002731#line 1199 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002732{ yyval.Visibility = GlobalValue::DefaultVisibility; ;
2733 break;}
2734case 81:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002735#line 1200 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002736{ yyval.Visibility = GlobalValue::DefaultVisibility; ;
2737 break;}
2738case 82:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002739#line 1201 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002740{ yyval.Visibility = GlobalValue::HiddenVisibility; ;
2741 break;}
2742case 83:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002743#line 1202 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002744{ yyval.Visibility = GlobalValue::ProtectedVisibility; ;
2745 break;}
2746case 84:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002747#line 1206 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002748{ yyval.Linkage = GlobalValue::ExternalLinkage; ;
2749 break;}
2750case 85:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002751#line 1207 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002752{ yyval.Linkage = GlobalValue::DLLImportLinkage; ;
2753 break;}
2754case 86:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002755#line 1208 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002756{ yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;
2757 break;}
2758case 87:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002759#line 1212 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002760{ yyval.Linkage = GlobalValue::ExternalLinkage; ;
2761 break;}
2762case 88:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002763#line 1213 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002764{ yyval.Linkage = GlobalValue::InternalLinkage; ;
2765 break;}
2766case 89:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002767#line 1214 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002768{ yyval.Linkage = GlobalValue::LinkOnceLinkage; ;
2769 break;}
2770case 90:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002771#line 1215 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002772{ yyval.Linkage = GlobalValue::WeakLinkage; ;
2773 break;}
2774case 91:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002775#line 1216 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002776{ yyval.Linkage = GlobalValue::DLLExportLinkage; ;
2777 break;}
2778case 92:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002779#line 1220 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002780{ yyval.Linkage = GlobalValue::ExternalLinkage; ;
2781 break;}
2782case 93:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002783#line 1221 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002784{ yyval.Linkage = GlobalValue::WeakLinkage; ;
2785 break;}
2786case 94:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002787#line 1222 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002788{ yyval.Linkage = GlobalValue::InternalLinkage; ;
2789 break;}
2790case 95:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002791#line 1225 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002792{ yyval.UIntVal = CallingConv::C; ;
2793 break;}
2794case 96:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002795#line 1226 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002796{ yyval.UIntVal = CallingConv::C; ;
2797 break;}
2798case 97:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002799#line 1227 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002800{ yyval.UIntVal = CallingConv::Fast; ;
2801 break;}
2802case 98:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002803#line 1228 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002804{ yyval.UIntVal = CallingConv::Cold; ;
2805 break;}
2806case 99:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002807#line 1229 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002808{ yyval.UIntVal = CallingConv::X86_StdCall; ;
2809 break;}
2810case 100:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002811#line 1230 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002812{ yyval.UIntVal = CallingConv::X86_FastCall; ;
2813 break;}
2814case 101:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002815#line 1231 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002816{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002817 if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002818 GEN_ERROR("Calling conv too large");
Chris Lattnerbb856a32007-08-06 21:00:46 +00002819 yyval.UIntVal = yyvsp[0].UInt64Val;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002820 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00002821 ;
2822 break;}
2823case 102:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002824#line 1238 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002825{ yyval.ParamAttrs = ParamAttr::ZExt; ;
2826 break;}
2827case 103:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002828#line 1239 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002829{ yyval.ParamAttrs = ParamAttr::ZExt; ;
2830 break;}
2831case 104:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002832#line 1240 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002833{ yyval.ParamAttrs = ParamAttr::SExt; ;
2834 break;}
2835case 105:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002836#line 1241 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002837{ yyval.ParamAttrs = ParamAttr::SExt; ;
2838 break;}
2839case 106:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002840#line 1242 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002841{ yyval.ParamAttrs = ParamAttr::InReg; ;
2842 break;}
2843case 107:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002844#line 1243 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002845{ yyval.ParamAttrs = ParamAttr::StructRet; ;
2846 break;}
2847case 108:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002848#line 1244 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002849{ yyval.ParamAttrs = ParamAttr::NoAlias; ;
2850 break;}
2851case 109:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002852#line 1245 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002853{ yyval.ParamAttrs = ParamAttr::ByVal; ;
2854 break;}
2855case 110:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002856#line 1246 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002857{ yyval.ParamAttrs = ParamAttr::Nest; ;
2858 break;}
2859case 111:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002860#line 1249 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002861{ yyval.ParamAttrs = ParamAttr::None; ;
2862 break;}
2863case 112:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002864#line 1250 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002865{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002866 yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs;
Dale Johannesen3afee192007-09-07 21:07:57 +00002867 ;
2868 break;}
2869case 113:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002870#line 1255 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002871{ yyval.ParamAttrs = ParamAttr::NoReturn; ;
2872 break;}
2873case 114:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002874#line 1256 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002875{ yyval.ParamAttrs = ParamAttr::NoUnwind; ;
2876 break;}
2877case 115:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002878#line 1257 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002879{ yyval.ParamAttrs = ParamAttr::ZExt; ;
2880 break;}
2881case 116:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002882#line 1258 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002883{ yyval.ParamAttrs = ParamAttr::SExt; ;
2884 break;}
2885case 117:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002886#line 1261 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002887{ yyval.ParamAttrs = ParamAttr::None; ;
2888 break;}
2889case 118:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002890#line 1262 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002891{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002892 yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs;
Dale Johannesen3afee192007-09-07 21:07:57 +00002893 ;
2894 break;}
2895case 119:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002896#line 1269 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002897{ yyval.UIntVal = 0; ;
2898 break;}
2899case 120:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002900#line 1270 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002901{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002902 yyval.UIntVal = yyvsp[0].UInt64Val;
2903 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002904 GEN_ERROR("Alignment must be a power of two");
2905 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00002906;
2907 break;}
2908case 121:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002909#line 1276 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002910{ yyval.UIntVal = 0; ;
2911 break;}
2912case 122:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002913#line 1277 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002914{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002915 yyval.UIntVal = yyvsp[0].UInt64Val;
2916 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002917 GEN_ERROR("Alignment must be a power of two");
2918 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00002919;
2920 break;}
2921case 123:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002922#line 1285 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002923{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002924 for (unsigned i = 0, e = yyvsp[0].StrVal->length(); i != e; ++i)
2925 if ((*yyvsp[0].StrVal)[i] == '"' || (*yyvsp[0].StrVal)[i] == '\\')
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002926 GEN_ERROR("Invalid character in section name");
Chris Lattnerbb856a32007-08-06 21:00:46 +00002927 yyval.StrVal = yyvsp[0].StrVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002928 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00002929;
2930 break;}
2931case 124:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002932#line 1293 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002933{ yyval.StrVal = 0; ;
2934 break;}
2935case 125:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002936#line 1294 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002937{ yyval.StrVal = yyvsp[0].StrVal; ;
2938 break;}
2939case 126:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002940#line 1299 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002941{;
2942 break;}
2943case 127:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002944#line 1300 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002945{;
2946 break;}
2947case 128:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002948#line 1301 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002949{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002950 CurGV->setSection(*yyvsp[0].StrVal);
2951 delete yyvsp[0].StrVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002952 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00002953 ;
2954 break;}
2955case 129:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002956#line 1306 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002957{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002958 if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002959 GEN_ERROR("Alignment must be a power of two");
Chris Lattnerbb856a32007-08-06 21:00:46 +00002960 CurGV->setAlignment(yyvsp[0].UInt64Val);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002961 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00002962 ;
2963 break;}
2964case 137:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002965#line 1322 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002966{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002967 yyval.TypeVal = new PATypeHolder(OpaqueType::get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002968 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00002969 ;
2970 break;}
2971case 138:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002972#line 1326 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002973{
Chris Lattnerbb856a32007-08-06 21:00:46 +00002974 yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002975 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00002976 ;
2977 break;}
2978case 139:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002979#line 1330 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002980{ // Pointer type?
Chris Lattnerbb856a32007-08-06 21:00:46 +00002981 if (*yyvsp[-1].TypeVal == Type::LabelTy)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002982 GEN_ERROR("Cannot form a pointer to a basic block");
Chris Lattnerbb856a32007-08-06 21:00:46 +00002983 yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-1].TypeVal)));
2984 delete yyvsp[-1].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002985 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00002986 ;
2987 break;}
2988case 140:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002989#line 1337 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002990{ // Named types are also simple types...
Chris Lattnerbb856a32007-08-06 21:00:46 +00002991 const Type* tmp = getTypeVal(yyvsp[0].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002992 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00002993 yyval.TypeVal = new PATypeHolder(tmp);
Dale Johannesen3afee192007-09-07 21:07:57 +00002994 ;
2995 break;}
2996case 141:
Dale Johannesencfb19e62007-11-05 21:20:28 +00002997#line 1342 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00002998{ // Type UpReference
Chris Lattnerbb856a32007-08-06 21:00:46 +00002999 if (yyvsp[0].UInt64Val > (uint64_t)~0U) GEN_ERROR("Value out of range");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003000 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Chris Lattnerbb856a32007-08-06 21:00:46 +00003001 UpRefs.push_back(UpRefRecord((unsigned)yyvsp[0].UInt64Val, OT)); // Add to vector...
3002 yyval.TypeVal = new PATypeHolder(OT);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003003 UR_OUT("New Upreference!\n");
3004 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003005 ;
3006 break;}
3007case 142:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003008#line 1350 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003009{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003010 std::vector<const Type*> Params;
3011 ParamAttrsVector Attrs;
Chris Lattnerbb856a32007-08-06 21:00:46 +00003012 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
3013 ParamAttrsWithIndex X; X.index = 0; X.attrs = yyvsp[0].ParamAttrs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003014 Attrs.push_back(X);
3015 }
3016 unsigned index = 1;
Chris Lattnerbb856a32007-08-06 21:00:46 +00003017 TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003018 for (; I != E; ++I, ++index) {
3019 const Type *Ty = I->Ty->get();
3020 Params.push_back(Ty);
3021 if (Ty != Type::VoidTy)
3022 if (I->Attrs != ParamAttr::None) {
3023 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
3024 Attrs.push_back(X);
3025 }
3026 }
3027 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3028 if (isVarArg) Params.pop_back();
3029
3030 ParamAttrsList *ActualAttrs = 0;
3031 if (!Attrs.empty())
3032 ActualAttrs = ParamAttrsList::get(Attrs);
Chris Lattnerbb856a32007-08-06 21:00:46 +00003033 FunctionType *FT = FunctionType::get(*yyvsp[-4].TypeVal, Params, isVarArg, ActualAttrs);
3034 delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list
3035 delete yyvsp[-4].TypeVal; // Delete the return type handle
3036 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003037 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003038 ;
3039 break;}
3040case 143:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003041#line 1380 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003042{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003043 std::vector<const Type*> Params;
3044 ParamAttrsVector Attrs;
Chris Lattnerbb856a32007-08-06 21:00:46 +00003045 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
3046 ParamAttrsWithIndex X; X.index = 0; X.attrs = yyvsp[0].ParamAttrs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003047 Attrs.push_back(X);
3048 }
Chris Lattnerbb856a32007-08-06 21:00:46 +00003049 TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003050 unsigned index = 1;
3051 for ( ; I != E; ++I, ++index) {
3052 const Type* Ty = I->Ty->get();
3053 Params.push_back(Ty);
3054 if (Ty != Type::VoidTy)
3055 if (I->Attrs != ParamAttr::None) {
3056 ParamAttrsWithIndex X; X.index = index; X.attrs = I->Attrs;
3057 Attrs.push_back(X);
3058 }
3059 }
3060 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3061 if (isVarArg) Params.pop_back();
3062
3063 ParamAttrsList *ActualAttrs = 0;
3064 if (!Attrs.empty())
3065 ActualAttrs = ParamAttrsList::get(Attrs);
3066
Chris Lattnerbb856a32007-08-06 21:00:46 +00003067 FunctionType *FT = FunctionType::get(yyvsp[-4].PrimType, Params, isVarArg, ActualAttrs);
3068 delete yyvsp[-2].TypeWithAttrsList; // Delete the argument list
3069 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003070 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003071 ;
3072 break;}
3073case 144:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003074#line 1411 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003075{ // Sized array type?
Chris Lattnerbb856a32007-08-06 21:00:46 +00003076 yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
3077 delete yyvsp[-1].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003078 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003079 ;
3080 break;}
3081case 145:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003082#line 1416 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003083{ // Vector type?
Chris Lattnerbb856a32007-08-06 21:00:46 +00003084 const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get();
3085 if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003086 GEN_ERROR("Unsigned result not equal to signed result");
3087 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
3088 GEN_ERROR("Element type of a VectorType must be primitive");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003089 if (!isPowerOf2_32(yyvsp[-3].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003090 GEN_ERROR("Vector length should be a power of 2");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003091 yyval.TypeVal = new PATypeHolder(HandleUpRefs(VectorType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
3092 delete yyvsp[-1].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003093 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003094 ;
3095 break;}
3096case 146:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003097#line 1428 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003098{ // Structure type?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003099 std::vector<const Type*> Elements;
Chris Lattnerbb856a32007-08-06 21:00:46 +00003100 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-1].TypeList->begin(),
3101 E = yyvsp[-1].TypeList->end(); I != E; ++I)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003102 Elements.push_back(*I);
3103
Chris Lattnerbb856a32007-08-06 21:00:46 +00003104 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3105 delete yyvsp[-1].TypeList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003106 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003107 ;
3108 break;}
3109case 147:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003110#line 1438 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003111{ // Empty structure type?
Chris Lattnerbb856a32007-08-06 21:00:46 +00003112 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003113 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003114 ;
3115 break;}
3116case 148:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003117#line 1442 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003118{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003119 std::vector<const Type*> Elements;
Chris Lattnerbb856a32007-08-06 21:00:46 +00003120 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-2].TypeList->begin(),
3121 E = yyvsp[-2].TypeList->end(); I != E; ++I)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003122 Elements.push_back(*I);
3123
Chris Lattnerbb856a32007-08-06 21:00:46 +00003124 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3125 delete yyvsp[-2].TypeList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003126 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003127 ;
3128 break;}
3129case 149:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003130#line 1452 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003131{ // Empty structure type?
Chris Lattnerbb856a32007-08-06 21:00:46 +00003132 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003133 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003134 ;
3135 break;}
3136case 150:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003137#line 1459 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003138{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003139 yyval.TypeWithAttrs.Ty = yyvsp[-1].TypeVal;
3140 yyval.TypeWithAttrs.Attrs = yyvsp[0].ParamAttrs;
Dale Johannesen3afee192007-09-07 21:07:57 +00003141 ;
3142 break;}
3143case 151:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003144#line 1466 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003145{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003146 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003147 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3148 if (!(*yyvsp[0].TypeVal)->isFirstClassType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003149 GEN_ERROR("LLVM functions cannot return aggregate types");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003150 yyval.TypeVal = yyvsp[0].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00003151 ;
3152 break;}
3153case 152:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003154#line 1473 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003155{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003156 yyval.TypeVal = new PATypeHolder(Type::VoidTy);
Dale Johannesen3afee192007-09-07 21:07:57 +00003157 ;
3158 break;}
3159case 153:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003160#line 1478 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003161{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003162 yyval.TypeWithAttrsList = new TypeWithAttrsList();
3163 yyval.TypeWithAttrsList->push_back(yyvsp[0].TypeWithAttrs);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003164 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003165 ;
3166 break;}
3167case 154:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003168#line 1483 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003169{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003170 (yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList)->push_back(yyvsp[0].TypeWithAttrs);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003171 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003172 ;
3173 break;}
3174case 156:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003175#line 1491 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003176{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003177 yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003178 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3179 TWA.Ty = new PATypeHolder(Type::VoidTy);
Chris Lattnerbb856a32007-08-06 21:00:46 +00003180 yyval.TypeWithAttrsList->push_back(TWA);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003181 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003182 ;
3183 break;}
3184case 157:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003185#line 1498 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003186{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003187 yyval.TypeWithAttrsList = new TypeWithAttrsList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003188 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
3189 TWA.Ty = new PATypeHolder(Type::VoidTy);
Chris Lattnerbb856a32007-08-06 21:00:46 +00003190 yyval.TypeWithAttrsList->push_back(TWA);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003191 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003192 ;
3193 break;}
3194case 158:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003195#line 1505 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003196{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003197 yyval.TypeWithAttrsList = new TypeWithAttrsList();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003198 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003199 ;
3200 break;}
3201case 159:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003202#line 1513 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003203{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003204 yyval.TypeList = new std::list<PATypeHolder>();
3205 yyval.TypeList->push_back(*yyvsp[0].TypeVal);
3206 delete yyvsp[0].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003207 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003208 ;
3209 break;}
3210case 160:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003211#line 1519 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003212{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003213 (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal);
3214 delete yyvsp[0].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003215 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003216 ;
3217 break;}
3218case 161:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003219#line 1531 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003220{ // Nonempty unsized arr
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003221 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003222 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
3223 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-3].TypeVal->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003224 if (ATy == 0)
3225 GEN_ERROR("Cannot make array constant with type: '" +
Chris Lattnerbb856a32007-08-06 21:00:46 +00003226 (*yyvsp[-3].TypeVal)->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003227 const Type *ETy = ATy->getElementType();
3228 int NumElements = ATy->getNumElements();
3229
3230 // Verify that we have the correct size...
Chris Lattnerbb856a32007-08-06 21:00:46 +00003231 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003232 GEN_ERROR("Type mismatch: constant sized array initialized with " +
Chris Lattnerbb856a32007-08-06 21:00:46 +00003233 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003234 itostr(NumElements) + "");
3235
3236 // Verify all elements are correct type!
Chris Lattnerbb856a32007-08-06 21:00:46 +00003237 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3238 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003239 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3240 ETy->getDescription() +"' as required!\nIt is of type '"+
Chris Lattnerbb856a32007-08-06 21:00:46 +00003241 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003242 }
3243
Chris Lattnerbb856a32007-08-06 21:00:46 +00003244 yyval.ConstVal = ConstantArray::get(ATy, *yyvsp[-1].ConstVector);
3245 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003246 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003247 ;
3248 break;}
3249case 162:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003250#line 1559 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003251{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003252 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003253 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3254 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003255 if (ATy == 0)
3256 GEN_ERROR("Cannot make array constant with type: '" +
Chris Lattnerbb856a32007-08-06 21:00:46 +00003257 (*yyvsp[-2].TypeVal)->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003258
3259 int NumElements = ATy->getNumElements();
3260 if (NumElements != -1 && NumElements != 0)
3261 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3262 " arguments, but has size of " + itostr(NumElements) +"");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003263 yyval.ConstVal = ConstantArray::get(ATy, std::vector<Constant*>());
3264 delete yyvsp[-2].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003265 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003266 ;
3267 break;}
3268case 163:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003269#line 1575 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003270{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003271 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003272 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3273 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003274 if (ATy == 0)
3275 GEN_ERROR("Cannot make array constant with type: '" +
Chris Lattnerbb856a32007-08-06 21:00:46 +00003276 (*yyvsp[-2].TypeVal)->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003277
3278 int NumElements = ATy->getNumElements();
3279 const Type *ETy = ATy->getElementType();
Chris Lattnerbb856a32007-08-06 21:00:46 +00003280 if (NumElements != -1 && NumElements != int(yyvsp[0].StrVal->length()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003281 GEN_ERROR("Can't build string constant of size " +
Chris Lattnerbb856a32007-08-06 21:00:46 +00003282 itostr((int)(yyvsp[0].StrVal->length())) +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003283 " when array has size " + itostr(NumElements) + "");
3284 std::vector<Constant*> Vals;
3285 if (ETy == Type::Int8Ty) {
Chris Lattnerbb856a32007-08-06 21:00:46 +00003286 for (unsigned i = 0; i < yyvsp[0].StrVal->length(); ++i)
3287 Vals.push_back(ConstantInt::get(ETy, (*yyvsp[0].StrVal)[i]));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003288 } else {
Chris Lattnerbb856a32007-08-06 21:00:46 +00003289 delete yyvsp[0].StrVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003290 GEN_ERROR("Cannot build string arrays of non byte sized elements");
3291 }
Chris Lattnerbb856a32007-08-06 21:00:46 +00003292 delete yyvsp[0].StrVal;
3293 yyval.ConstVal = ConstantArray::get(ATy, Vals);
3294 delete yyvsp[-2].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003295 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003296 ;
3297 break;}
3298case 164:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003299#line 1602 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003300{ // Nonempty unsized arr
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003301 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003302 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
3303 const VectorType *PTy = dyn_cast<VectorType>(yyvsp[-3].TypeVal->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003304 if (PTy == 0)
3305 GEN_ERROR("Cannot make packed constant with type: '" +
Chris Lattnerbb856a32007-08-06 21:00:46 +00003306 (*yyvsp[-3].TypeVal)->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003307 const Type *ETy = PTy->getElementType();
3308 int NumElements = PTy->getNumElements();
3309
3310 // Verify that we have the correct size...
Chris Lattnerbb856a32007-08-06 21:00:46 +00003311 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003312 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
Chris Lattnerbb856a32007-08-06 21:00:46 +00003313 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003314 itostr(NumElements) + "");
3315
3316 // Verify all elements are correct type!
Chris Lattnerbb856a32007-08-06 21:00:46 +00003317 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3318 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003319 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3320 ETy->getDescription() +"' as required!\nIt is of type '"+
Chris Lattnerbb856a32007-08-06 21:00:46 +00003321 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003322 }
3323
Chris Lattnerbb856a32007-08-06 21:00:46 +00003324 yyval.ConstVal = ConstantVector::get(PTy, *yyvsp[-1].ConstVector);
3325 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003326 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003327 ;
3328 break;}
3329case 165:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003330#line 1630 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003331{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003332 const StructType *STy = dyn_cast<StructType>(yyvsp[-3].TypeVal->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003333 if (STy == 0)
3334 GEN_ERROR("Cannot make struct constant with type: '" +
Chris Lattnerbb856a32007-08-06 21:00:46 +00003335 (*yyvsp[-3].TypeVal)->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003336
Chris Lattnerbb856a32007-08-06 21:00:46 +00003337 if (yyvsp[-1].ConstVector->size() != STy->getNumContainedTypes())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003338 GEN_ERROR("Illegal number of initializers for structure type");
3339
3340 // Check to ensure that constants are compatible with the type initializer!
Chris Lattnerbb856a32007-08-06 21:00:46 +00003341 for (unsigned i = 0, e = yyvsp[-1].ConstVector->size(); i != e; ++i)
3342 if ((*yyvsp[-1].ConstVector)[i]->getType() != STy->getElementType(i))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003343 GEN_ERROR("Expected type '" +
3344 STy->getElementType(i)->getDescription() +
3345 "' for element #" + utostr(i) +
3346 " of structure initializer");
3347
3348 // Check to ensure that Type is not packed
3349 if (STy->isPacked())
3350 GEN_ERROR("Unpacked Initializer to vector type '" +
3351 STy->getDescription() + "'");
3352
Chris Lattnerbb856a32007-08-06 21:00:46 +00003353 yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-1].ConstVector);
3354 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003355 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003356 ;
3357 break;}
3358case 166:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003359#line 1656 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003360{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003361 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003362 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
3363 const StructType *STy = dyn_cast<StructType>(yyvsp[-2].TypeVal->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003364 if (STy == 0)
3365 GEN_ERROR("Cannot make struct constant with type: '" +
Chris Lattnerbb856a32007-08-06 21:00:46 +00003366 (*yyvsp[-2].TypeVal)->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003367
3368 if (STy->getNumContainedTypes() != 0)
3369 GEN_ERROR("Illegal number of initializers for structure type");
3370
3371 // Check to ensure that Type is not packed
3372 if (STy->isPacked())
3373 GEN_ERROR("Unpacked Initializer to vector type '" +
3374 STy->getDescription() + "'");
3375
Chris Lattnerbb856a32007-08-06 21:00:46 +00003376 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
3377 delete yyvsp[-2].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003378 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003379 ;
3380 break;}
3381case 167:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003382#line 1676 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003383{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003384 const StructType *STy = dyn_cast<StructType>(yyvsp[-5].TypeVal->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003385 if (STy == 0)
3386 GEN_ERROR("Cannot make struct constant with type: '" +
Chris Lattnerbb856a32007-08-06 21:00:46 +00003387 (*yyvsp[-5].TypeVal)->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003388
Chris Lattnerbb856a32007-08-06 21:00:46 +00003389 if (yyvsp[-2].ConstVector->size() != STy->getNumContainedTypes())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003390 GEN_ERROR("Illegal number of initializers for structure type");
3391
3392 // Check to ensure that constants are compatible with the type initializer!
Chris Lattnerbb856a32007-08-06 21:00:46 +00003393 for (unsigned i = 0, e = yyvsp[-2].ConstVector->size(); i != e; ++i)
3394 if ((*yyvsp[-2].ConstVector)[i]->getType() != STy->getElementType(i))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003395 GEN_ERROR("Expected type '" +
3396 STy->getElementType(i)->getDescription() +
3397 "' for element #" + utostr(i) +
3398 " of structure initializer");
3399
3400 // Check to ensure that Type is packed
3401 if (!STy->isPacked())
3402 GEN_ERROR("Vector initializer to non-vector type '" +
3403 STy->getDescription() + "'");
3404
Chris Lattnerbb856a32007-08-06 21:00:46 +00003405 yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-2].ConstVector);
3406 delete yyvsp[-5].TypeVal; delete yyvsp[-2].ConstVector;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003407 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003408 ;
3409 break;}
3410case 168:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003411#line 1702 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003412{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003413 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003414 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
3415 const StructType *STy = dyn_cast<StructType>(yyvsp[-4].TypeVal->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003416 if (STy == 0)
3417 GEN_ERROR("Cannot make struct constant with type: '" +
Chris Lattnerbb856a32007-08-06 21:00:46 +00003418 (*yyvsp[-4].TypeVal)->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003419
3420 if (STy->getNumContainedTypes() != 0)
3421 GEN_ERROR("Illegal number of initializers for structure type");
3422
3423 // Check to ensure that Type is packed
3424 if (!STy->isPacked())
3425 GEN_ERROR("Vector initializer to non-vector type '" +
3426 STy->getDescription() + "'");
3427
Chris Lattnerbb856a32007-08-06 21:00:46 +00003428 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
3429 delete yyvsp[-4].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003430 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003431 ;
3432 break;}
3433case 169:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003434#line 1722 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003435{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003436 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003437 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3438 const PointerType *PTy = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003439 if (PTy == 0)
3440 GEN_ERROR("Cannot make null pointer constant with type: '" +
Chris Lattnerbb856a32007-08-06 21:00:46 +00003441 (*yyvsp[-1].TypeVal)->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003442
Chris Lattnerbb856a32007-08-06 21:00:46 +00003443 yyval.ConstVal = ConstantPointerNull::get(PTy);
3444 delete yyvsp[-1].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003445 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003446 ;
3447 break;}
3448case 170:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003449#line 1734 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003450{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003451 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003452 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3453 yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get());
3454 delete yyvsp[-1].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003455 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003456 ;
3457 break;}
3458case 171:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003459#line 1741 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003460{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003461 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003462 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3463 const PointerType *Ty = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003464 if (Ty == 0)
3465 GEN_ERROR("Global const reference must be a pointer type");
3466
3467 // ConstExprs can exist in the body of a function, thus creating
3468 // GlobalValues whenever they refer to a variable. Because we are in
3469 // the context of a function, getExistingVal will search the functions
3470 // symbol table instead of the module symbol table for the global symbol,
3471 // which throws things all off. To get around this, we just tell
3472 // getExistingVal that we are at global scope here.
3473 //
3474 Function *SavedCurFn = CurFun.CurrentFunction;
3475 CurFun.CurrentFunction = 0;
3476
Chris Lattnerbb856a32007-08-06 21:00:46 +00003477 Value *V = getExistingVal(Ty, yyvsp[0].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003478 CHECK_FOR_ERROR
3479
3480 CurFun.CurrentFunction = SavedCurFn;
3481
3482 // If this is an initializer for a constant pointer, which is referencing a
3483 // (currently) undefined variable, create a stub now that shall be replaced
3484 // in the future with the right type of variable.
3485 //
3486 if (V == 0) {
3487 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3488 const PointerType *PT = cast<PointerType>(Ty);
3489
3490 // First check to see if the forward references value is already created!
3491 PerModuleInfo::GlobalRefsType::iterator I =
Chris Lattnerbb856a32007-08-06 21:00:46 +00003492 CurModule.GlobalRefs.find(std::make_pair(PT, yyvsp[0].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003493
3494 if (I != CurModule.GlobalRefs.end()) {
3495 V = I->second; // Placeholder already exists, use it...
Chris Lattnerbb856a32007-08-06 21:00:46 +00003496 yyvsp[0].ValIDVal.destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003497 } else {
3498 std::string Name;
Chris Lattnerbb856a32007-08-06 21:00:46 +00003499 if (yyvsp[0].ValIDVal.Type == ValID::GlobalName)
3500 Name = yyvsp[0].ValIDVal.getName();
3501 else if (yyvsp[0].ValIDVal.Type != ValID::GlobalID)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003502 GEN_ERROR("Invalid reference to global");
3503
3504 // Create the forward referenced global.
3505 GlobalValue *GV;
3506 if (const FunctionType *FTy =
3507 dyn_cast<FunctionType>(PT->getElementType())) {
3508 GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name,
3509 CurModule.CurrentModule);
3510 } else {
3511 GV = new GlobalVariable(PT->getElementType(), false,
3512 GlobalValue::ExternalWeakLinkage, 0,
3513 Name, CurModule.CurrentModule);
3514 }
3515
3516 // Keep track of the fact that we have a forward ref to recycle it
Chris Lattnerbb856a32007-08-06 21:00:46 +00003517 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, yyvsp[0].ValIDVal), GV));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003518 V = GV;
3519 }
3520 }
3521
Chris Lattnerbb856a32007-08-06 21:00:46 +00003522 yyval.ConstVal = cast<GlobalValue>(V);
3523 delete yyvsp[-1].TypeVal; // Free the type handle
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003524 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003525 ;
3526 break;}
3527case 172:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003528#line 1807 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003529{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003530 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003531 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3532 if (yyvsp[-1].TypeVal->get() != yyvsp[0].ConstVal->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003533 GEN_ERROR("Mismatched types for constant expression: " +
Chris Lattnerbb856a32007-08-06 21:00:46 +00003534 (*yyvsp[-1].TypeVal)->getDescription() + " and " + yyvsp[0].ConstVal->getType()->getDescription());
3535 yyval.ConstVal = yyvsp[0].ConstVal;
3536 delete yyvsp[-1].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003537 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003538 ;
3539 break;}
3540case 173:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003541#line 1817 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003542{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003543 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003544 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3545 const Type *Ty = yyvsp[-1].TypeVal->get();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003546 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
3547 GEN_ERROR("Cannot create a null initialized value of this type");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003548 yyval.ConstVal = Constant::getNullValue(Ty);
3549 delete yyvsp[-1].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003550 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003551 ;
3552 break;}
3553case 174:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003554#line 1827 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003555{ // integral constants
Chris Lattnerbb856a32007-08-06 21:00:46 +00003556 if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003557 GEN_ERROR("Constant value doesn't fit in type");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003558 yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].SInt64Val, true);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003559 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003560 ;
3561 break;}
3562case 175:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003563#line 1833 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003564{ // arbitrary precision integer constants
Chris Lattnerbb856a32007-08-06 21:00:46 +00003565 uint32_t BitWidth = cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth();
3566 if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003567 GEN_ERROR("Constant value does not fit in type");
3568 }
Chris Lattnerbb856a32007-08-06 21:00:46 +00003569 yyvsp[0].APIntVal->sextOrTrunc(BitWidth);
3570 yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal);
3571 delete yyvsp[0].APIntVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003572 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003573 ;
3574 break;}
3575case 176:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003576#line 1843 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003577{ // integral constants
Chris Lattnerbb856a32007-08-06 21:00:46 +00003578 if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003579 GEN_ERROR("Constant value doesn't fit in type");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003580 yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].UInt64Val, false);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003581 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003582 ;
3583 break;}
3584case 177:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003585#line 1849 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003586{ // arbitrary precision integer constants
Chris Lattnerbb856a32007-08-06 21:00:46 +00003587 uint32_t BitWidth = cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth();
3588 if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003589 GEN_ERROR("Constant value does not fit in type");
3590 }
Chris Lattnerbb856a32007-08-06 21:00:46 +00003591 yyvsp[0].APIntVal->zextOrTrunc(BitWidth);
3592 yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal);
3593 delete yyvsp[0].APIntVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003594 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003595 ;
3596 break;}
3597case 178:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003598#line 1859 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003599{ // Boolean constants
Chris Lattnerbb856a32007-08-06 21:00:46 +00003600 assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?");
3601 yyval.ConstVal = ConstantInt::getTrue();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003602 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003603 ;
3604 break;}
3605case 179:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003606#line 1864 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003607{ // Boolean constants
Chris Lattnerbb856a32007-08-06 21:00:46 +00003608 assert(cast<IntegerType>(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?");
3609 yyval.ConstVal = ConstantInt::getFalse();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003610 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003611 ;
3612 break;}
3613case 180:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003614#line 1869 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen043064d2007-09-12 03:31:28 +00003615{ // Floating point constants
Dale Johannesen3afee192007-09-07 21:07:57 +00003616 if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, *yyvsp[0].FPVal))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003617 GEN_ERROR("Floating point constant invalid for type");
Dale Johannesen255b8fe2007-09-11 18:33:39 +00003618 // Lexer has no type info, so builds all float and double FP constants
3619 // as double. Fix this here. Long double is done right.
3620 if (&yyvsp[0].FPVal->getSemantics()==&APFloat::IEEEdouble && yyvsp[-1].PrimType==Type::FloatTy)
Dale Johannesen3afee192007-09-07 21:07:57 +00003621 yyvsp[0].FPVal->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
3622 yyval.ConstVal = ConstantFP::get(yyvsp[-1].PrimType, *yyvsp[0].FPVal);
3623 delete yyvsp[0].FPVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003624 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003625 ;
3626 break;}
3627case 181:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003628#line 1882 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003629{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003630 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003631 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
3632 Constant *Val = yyvsp[-3].ConstVal;
3633 const Type *DestTy = yyvsp[-1].TypeVal->get();
3634 if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003635 GEN_ERROR("invalid cast opcode for cast from '" +
3636 Val->getType()->getDescription() + "' to '" +
3637 DestTy->getDescription() + "'");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003638 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy);
3639 delete yyvsp[-1].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00003640 ;
3641 break;}
3642case 182:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003643#line 1894 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003644{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003645 if (!isa<PointerType>(yyvsp[-2].ConstVal->getType()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003646 GEN_ERROR("GetElementPtr requires a pointer operand");
3647
3648 const Type *IdxTy =
David Greene48556392007-09-04 18:46:50 +00003649 GetElementPtrInst::getIndexedType(yyvsp[-2].ConstVal->getType(), yyvsp[-1].ValueList->begin(), yyvsp[-1].ValueList->end(),
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003650 true);
3651 if (!IdxTy)
3652 GEN_ERROR("Index list invalid for constant getelementptr");
3653
3654 SmallVector<Constant*, 8> IdxVec;
Chris Lattnerbb856a32007-08-06 21:00:46 +00003655 for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e; ++i)
3656 if (Constant *C = dyn_cast<Constant>((*yyvsp[-1].ValueList)[i]))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003657 IdxVec.push_back(C);
3658 else
3659 GEN_ERROR("Indices to constant getelementptr must be constants");
3660
Chris Lattnerbb856a32007-08-06 21:00:46 +00003661 delete yyvsp[-1].ValueList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003662
Chris Lattnerbb856a32007-08-06 21:00:46 +00003663 yyval.ConstVal = ConstantExpr::getGetElementPtr(yyvsp[-2].ConstVal, &IdxVec[0], IdxVec.size());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003664 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003665 ;
3666 break;}
3667case 183:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003668#line 1916 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003669{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003670 if (yyvsp[-5].ConstVal->getType() != Type::Int1Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003671 GEN_ERROR("Select condition must be of boolean type");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003672 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003673 GEN_ERROR("Select operand types must match");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003674 yyval.ConstVal = ConstantExpr::getSelect(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003675 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003676 ;
3677 break;}
3678case 184:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003679#line 1924 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003680{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003681 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003682 GEN_ERROR("Binary operator types must match");
3683 CHECK_FOR_ERROR;
Chris Lattnerbb856a32007-08-06 21:00:46 +00003684 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
Dale Johannesen3afee192007-09-07 21:07:57 +00003685 ;
3686 break;}
3687case 185:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003688#line 1930 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003689{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003690 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003691 GEN_ERROR("Logical operator types must match");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003692 if (!yyvsp[-3].ConstVal->getType()->isInteger()) {
3693 if (Instruction::isShift(yyvsp[-5].BinaryOpVal) || !isa<VectorType>(yyvsp[-3].ConstVal->getType()) ||
3694 !cast<VectorType>(yyvsp[-3].ConstVal->getType())->getElementType()->isInteger())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003695 GEN_ERROR("Logical operator requires integral operands");
3696 }
Chris Lattnerbb856a32007-08-06 21:00:46 +00003697 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003698 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003699 ;
3700 break;}
3701case 186:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003702#line 1941 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003703{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003704 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003705 GEN_ERROR("icmp operand types must match");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003706 yyval.ConstVal = ConstantExpr::getICmp(yyvsp[-5].IPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
Dale Johannesen3afee192007-09-07 21:07:57 +00003707 ;
3708 break;}
3709case 187:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003710#line 1946 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003711{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003712 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003713 GEN_ERROR("fcmp operand types must match");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003714 yyval.ConstVal = ConstantExpr::getFCmp(yyvsp[-5].FPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
Dale Johannesen3afee192007-09-07 21:07:57 +00003715 ;
3716 break;}
3717case 188:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003718#line 1951 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003719{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003720 if (!ExtractElementInst::isValidOperands(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003721 GEN_ERROR("Invalid extractelement operands");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003722 yyval.ConstVal = ConstantExpr::getExtractElement(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003723 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003724 ;
3725 break;}
3726case 189:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003727#line 1957 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003728{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003729 if (!InsertElementInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003730 GEN_ERROR("Invalid insertelement operands");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003731 yyval.ConstVal = ConstantExpr::getInsertElement(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003732 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003733 ;
3734 break;}
3735case 190:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003736#line 1963 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003737{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003738 if (!ShuffleVectorInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003739 GEN_ERROR("Invalid shufflevector operands");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003740 yyval.ConstVal = ConstantExpr::getShuffleVector(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003741 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003742 ;
3743 break;}
3744case 191:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003745#line 1972 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003746{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003747 (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003748 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003749 ;
3750 break;}
3751case 192:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003752#line 1976 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003753{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003754 yyval.ConstVector = new std::vector<Constant*>();
3755 yyval.ConstVector->push_back(yyvsp[0].ConstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003756 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003757 ;
3758 break;}
3759case 193:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003760#line 1984 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003761{ yyval.BoolVal = false; ;
3762 break;}
3763case 194:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003764#line 1984 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003765{ yyval.BoolVal = true; ;
3766 break;}
3767case 195:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003768#line 1987 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003769{ yyval.BoolVal = true; ;
3770 break;}
3771case 196:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003772#line 1987 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003773{ yyval.BoolVal = false; ;
3774 break;}
3775case 197:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003776#line 1990 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003777{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003778 const Type* VTy = yyvsp[-1].TypeVal->get();
3779 Value *V = getVal(VTy, yyvsp[0].ValIDVal);
3780 CHECK_FOR_ERROR
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003781 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
3782 if (!Aliasee)
3783 GEN_ERROR("Aliases can be created only to global values");
3784
Chris Lattnerbb856a32007-08-06 21:00:46 +00003785 yyval.ConstVal = Aliasee;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003786 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00003787 delete yyvsp[-1].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00003788 ;
3789 break;}
3790case 198:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003791#line 2002 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003792{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003793 Constant *Val = yyvsp[-3].ConstVal;
3794 const Type *DestTy = yyvsp[-1].TypeVal->get();
3795 if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003796 GEN_ERROR("invalid cast opcode for cast from '" +
3797 Val->getType()->getDescription() + "' to '" +
3798 DestTy->getDescription() + "'");
3799
Chris Lattnerbb856a32007-08-06 21:00:46 +00003800 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003801 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00003802 delete yyvsp[-1].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00003803 ;
3804 break;}
3805case 199:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003806#line 2023 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003807{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003808 yyval.ModuleVal = ParserResult = CurModule.CurrentModule;
Reid Spencer47470022007-07-31 14:41:17 +00003809 CurModule.ModuleDone();
3810 CHECK_FOR_ERROR;
Dale Johannesen3afee192007-09-07 21:07:57 +00003811 ;
3812 break;}
3813case 200:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003814#line 2028 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003815{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003816 yyval.ModuleVal = ParserResult = CurModule.CurrentModule;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003817 CurModule.ModuleDone();
3818 CHECK_FOR_ERROR;
Dale Johannesen3afee192007-09-07 21:07:57 +00003819 ;
3820 break;}
3821case 203:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003822#line 2041 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003823{ CurFun.isDeclare = false; ;
3824 break;}
3825case 204:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003826#line 2041 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003827{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003828 CurFun.FunctionDone();
3829 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003830 ;
3831 break;}
3832case 205:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003833#line 2045 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003834{ CurFun.isDeclare = true; ;
3835 break;}
3836case 206:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003837#line 2045 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003838{
Reid Spencer47470022007-07-31 14:41:17 +00003839 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003840 ;
3841 break;}
3842case 207:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003843#line 2048 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003844{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003845 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003846 ;
3847 break;}
3848case 208:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003849#line 2051 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003850{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003851 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003852 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003853 // Eagerly resolve types. This is not an optimization, this is a
3854 // requirement that is due to the fact that we could have this:
3855 //
3856 // %list = type { %list * }
3857 // %list = type { %list * } ; repeated type decl
3858 //
3859 // If types are not resolved eagerly, then the two types will not be
3860 // determined to be the same type!
3861 //
Chris Lattnerbb856a32007-08-06 21:00:46 +00003862 ResolveTypeTo(yyvsp[-2].StrVal, *yyvsp[0].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003863
Chris Lattnerbb856a32007-08-06 21:00:46 +00003864 if (!setTypeName(*yyvsp[0].TypeVal, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003865 CHECK_FOR_ERROR
3866 // If this is a named type that is not a redefinition, add it to the slot
3867 // table.
Chris Lattnerbb856a32007-08-06 21:00:46 +00003868 CurModule.Types.push_back(*yyvsp[0].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003869 }
3870
Chris Lattnerbb856a32007-08-06 21:00:46 +00003871 delete yyvsp[0].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003872 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003873 ;
3874 break;}
3875case 209:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003876#line 2075 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003877{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003878 ResolveTypeTo(yyvsp[-2].StrVal, yyvsp[0].PrimType);
Reid Spenceraa8ae282007-07-31 03:50:36 +00003879
Chris Lattnerbb856a32007-08-06 21:00:46 +00003880 if (!setTypeName(yyvsp[0].PrimType, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003881 CHECK_FOR_ERROR
3882 // If this is a named type that is not a redefinition, add it to the slot
3883 // table.
Chris Lattnerbb856a32007-08-06 21:00:46 +00003884 CurModule.Types.push_back(yyvsp[0].PrimType);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003885 }
3886 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003887 ;
3888 break;}
3889case 210:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003890#line 2086 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003891{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003892 /* "Externally Visible" Linkage */
Chris Lattnerbb856a32007-08-06 21:00:46 +00003893 if (yyvsp[0].ConstVal == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003894 GEN_ERROR("Global value initializer is not a constant");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003895 CurGV = ParseGlobalVariable(yyvsp[-4].StrVal, GlobalValue::ExternalLinkage,
3896 yyvsp[-3].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal, yyvsp[-2].BoolVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003897 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003898 ;
3899 break;}
3900case 211:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003901#line 2093 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003902{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003903 CurGV = 0;
Dale Johannesen3afee192007-09-07 21:07:57 +00003904 ;
3905 break;}
3906case 212:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003907#line 2097 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003908{
Chris Lattnerbb856a32007-08-06 21:00:46 +00003909 if (yyvsp[0].ConstVal == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003910 GEN_ERROR("Global value initializer is not a constant");
Chris Lattnerbb856a32007-08-06 21:00:46 +00003911 CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, yyvsp[-4].Linkage, yyvsp[-3].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal, yyvsp[-2].BoolVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003912 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003913 ;
3914 break;}
3915case 213:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003916#line 2102 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003917{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003918 CurGV = 0;
Dale Johannesen3afee192007-09-07 21:07:57 +00003919 ;
3920 break;}
3921case 214:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003922#line 2106 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003923{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003924 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003925 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3926 CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, yyvsp[-4].Linkage, yyvsp[-3].Visibility, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0, yyvsp[-2].BoolVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003927 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00003928 delete yyvsp[0].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00003929 ;
3930 break;}
3931case 215:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003932#line 2112 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003933{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003934 CurGV = 0;
3935 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003936 ;
3937 break;}
3938case 216:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003939#line 2116 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003940{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003941 std::string Name;
Chris Lattnerbb856a32007-08-06 21:00:46 +00003942 if (yyvsp[-4].StrVal) {
3943 Name = *yyvsp[-4].StrVal;
3944 delete yyvsp[-4].StrVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003945 }
3946 if (Name.empty())
3947 GEN_ERROR("Alias name cannot be empty");
3948
Chris Lattnerbb856a32007-08-06 21:00:46 +00003949 Constant* Aliasee = yyvsp[0].ConstVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003950 if (Aliasee == 0)
3951 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
3952
Chris Lattnerbb856a32007-08-06 21:00:46 +00003953 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), yyvsp[-1].Linkage, Name, Aliasee,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003954 CurModule.CurrentModule);
Chris Lattnerbb856a32007-08-06 21:00:46 +00003955 GA->setVisibility(yyvsp[-3].Visibility);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003956 InsertValue(GA, CurModule.Values);
Chris Lattner5eefce32007-09-10 23:24:14 +00003957
3958
3959 // If there was a forward reference of this alias, resolve it now.
3960
3961 ValID ID;
3962 if (!Name.empty())
3963 ID = ValID::createGlobalName(Name);
3964 else
3965 ID = ValID::createGlobalID(CurModule.Values.size()-1);
3966
3967 if (GlobalValue *FWGV =
3968 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
3969 // Replace uses of the fwdref with the actual alias.
3970 FWGV->replaceAllUsesWith(GA);
3971 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
3972 GV->eraseFromParent();
3973 else
3974 cast<Function>(FWGV)->eraseFromParent();
3975 }
3976 ID.destroy();
3977
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003978 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003979 ;
3980 break;}
3981case 217:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003982#line 2156 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003983{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003984 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003985 ;
3986 break;}
3987case 218:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003988#line 2159 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003989{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003990 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00003991 ;
3992 break;}
3993case 219:
Dale Johannesencfb19e62007-11-05 21:20:28 +00003994#line 2165 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00003995{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003996 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
3997 if (AsmSoFar.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00003998 CurModule.CurrentModule->setModuleInlineAsm(*yyvsp[0].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003999 else
Chris Lattnerbb856a32007-08-06 21:00:46 +00004000 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*yyvsp[0].StrVal);
4001 delete yyvsp[0].StrVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004002 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004003;
4004 break;}
4005case 220:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004006#line 2175 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004007{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004008 CurModule.CurrentModule->setTargetTriple(*yyvsp[0].StrVal);
4009 delete yyvsp[0].StrVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00004010 ;
4011 break;}
4012case 221:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004013#line 2179 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004014{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004015 CurModule.CurrentModule->setDataLayout(*yyvsp[0].StrVal);
4016 delete yyvsp[0].StrVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00004017 ;
4018 break;}
4019case 223:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004020#line 2186 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004021{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004022 CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal);
4023 delete yyvsp[0].StrVal;
Reid Spencer47470022007-07-31 14:41:17 +00004024 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004025 ;
4026 break;}
4027case 224:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004028#line 2191 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004029{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004030 CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal);
4031 delete yyvsp[0].StrVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004032 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004033 ;
4034 break;}
4035case 225:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004036#line 2196 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004037{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004038 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004039 ;
4040 break;}
4041case 226:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004042#line 2205 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004043{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004044 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00004045 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4046 if (*yyvsp[-2].TypeVal == Type::VoidTy)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004047 GEN_ERROR("void typed arguments are invalid");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004048 ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal;
4049 yyval.ArgList = yyvsp[-4].ArgList;
4050 yyvsp[-4].ArgList->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004051 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004052 ;
4053 break;}
4054case 227:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004055#line 2215 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004056{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004057 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00004058 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
4059 if (*yyvsp[-2].TypeVal == Type::VoidTy)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004060 GEN_ERROR("void typed arguments are invalid");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004061 ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal;
4062 yyval.ArgList = new ArgListType;
4063 yyval.ArgList->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004064 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004065 ;
4066 break;}
4067case 228:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004068#line 2226 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004069{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004070 yyval.ArgList = yyvsp[0].ArgList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004071 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004072 ;
4073 break;}
4074case 229:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004075#line 2230 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004076{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004077 yyval.ArgList = yyvsp[-2].ArgList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004078 struct ArgListEntry E;
4079 E.Ty = new PATypeHolder(Type::VoidTy);
4080 E.Name = 0;
4081 E.Attrs = ParamAttr::None;
Chris Lattnerbb856a32007-08-06 21:00:46 +00004082 yyval.ArgList->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004083 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004084 ;
4085 break;}
4086case 230:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004087#line 2239 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004088{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004089 yyval.ArgList = new ArgListType;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004090 struct ArgListEntry E;
4091 E.Ty = new PATypeHolder(Type::VoidTy);
4092 E.Name = 0;
4093 E.Attrs = ParamAttr::None;
Chris Lattnerbb856a32007-08-06 21:00:46 +00004094 yyval.ArgList->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004095 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004096 ;
4097 break;}
4098case 231:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004099#line 2248 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004100{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004101 yyval.ArgList = 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004102 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004103 ;
4104 break;}
4105case 232:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004106#line 2254 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004107{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004108 std::string FunctionName(*yyvsp[-6].StrVal);
4109 delete yyvsp[-6].StrVal; // Free strdup'd memory!
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004110
4111 // Check the function result for abstractness if this is a define. We should
4112 // have no abstract types at this point
Chris Lattnerbb856a32007-08-06 21:00:46 +00004113 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(yyvsp[-7].TypeVal))
4114 GEN_ERROR("Reference to abstract result: "+ yyvsp[-7].TypeVal->get()->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004115
4116 std::vector<const Type*> ParamTypeList;
4117 ParamAttrsVector Attrs;
Chris Lattnerbb856a32007-08-06 21:00:46 +00004118 if (yyvsp[-2].ParamAttrs != ParamAttr::None) {
4119 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[-2].ParamAttrs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004120 Attrs.push_back(PAWI);
4121 }
Chris Lattnerbb856a32007-08-06 21:00:46 +00004122 if (yyvsp[-4].ArgList) { // If there are arguments...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004123 unsigned index = 1;
Chris Lattnerbb856a32007-08-06 21:00:46 +00004124 for (ArgListType::iterator I = yyvsp[-4].ArgList->begin(); I != yyvsp[-4].ArgList->end(); ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004125 const Type* Ty = I->Ty->get();
4126 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
4127 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
4128 ParamTypeList.push_back(Ty);
4129 if (Ty != Type::VoidTy)
4130 if (I->Attrs != ParamAttr::None) {
4131 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
4132 Attrs.push_back(PAWI);
4133 }
4134 }
4135 }
4136
4137 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4138 if (isVarArg) ParamTypeList.pop_back();
4139
4140 ParamAttrsList *PAL = 0;
4141 if (!Attrs.empty())
4142 PAL = ParamAttrsList::get(Attrs);
4143
Chris Lattnerbb856a32007-08-06 21:00:46 +00004144 FunctionType *FT = FunctionType::get(*yyvsp[-7].TypeVal, ParamTypeList, isVarArg, PAL);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004145 const PointerType *PFT = PointerType::get(FT);
Chris Lattnerbb856a32007-08-06 21:00:46 +00004146 delete yyvsp[-7].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004147
4148 ValID ID;
4149 if (!FunctionName.empty()) {
4150 ID = ValID::createGlobalName((char*)FunctionName.c_str());
4151 } else {
4152 ID = ValID::createGlobalID(CurModule.Values.size());
4153 }
4154
4155 Function *Fn = 0;
4156 // See if this function was forward referenced. If so, recycle the object.
4157 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4158 // Move the function to the end of the list, from whereever it was
4159 // previously inserted.
4160 Fn = cast<Function>(FWRef);
4161 CurModule.CurrentModule->getFunctionList().remove(Fn);
4162 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4163 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4164 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
4165 if (Fn->getFunctionType() != FT) {
4166 // The existing function doesn't have the same type. This is an overload
4167 // error.
4168 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
4169 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
4170 // Neither the existing or the current function is a declaration and they
4171 // have the same name and same type. Clearly this is a redefinition.
4172 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
4173 } if (Fn->isDeclaration()) {
4174 // Make sure to strip off any argument names so we can't get conflicts.
4175 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4176 AI != AE; ++AI)
4177 AI->setName("");
4178 }
4179 } else { // Not already defined?
4180 Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
4181 CurModule.CurrentModule);
4182
4183 InsertValue(Fn, CurModule.Values);
4184 }
4185
4186 CurFun.FunctionStart(Fn);
4187
4188 if (CurFun.isDeclare) {
4189 // If we have declaration, always overwrite linkage. This will allow us to
4190 // correctly handle cases, when pointer to function is passed as argument to
4191 // another function.
4192 Fn->setLinkage(CurFun.Linkage);
4193 Fn->setVisibility(CurFun.Visibility);
4194 }
Chris Lattnerbb856a32007-08-06 21:00:46 +00004195 Fn->setCallingConv(yyvsp[-8].UIntVal);
4196 Fn->setAlignment(yyvsp[0].UIntVal);
4197 if (yyvsp[-1].StrVal) {
4198 Fn->setSection(*yyvsp[-1].StrVal);
4199 delete yyvsp[-1].StrVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004200 }
4201
4202 // Add all of the arguments we parsed to the function...
Chris Lattnerbb856a32007-08-06 21:00:46 +00004203 if (yyvsp[-4].ArgList) { // Is null if empty...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004204 if (isVarArg) { // Nuke the last entry
Chris Lattnerbb856a32007-08-06 21:00:46 +00004205 assert(yyvsp[-4].ArgList->back().Ty->get() == Type::VoidTy && yyvsp[-4].ArgList->back().Name == 0 &&
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004206 "Not a varargs marker!");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004207 delete yyvsp[-4].ArgList->back().Ty;
4208 yyvsp[-4].ArgList->pop_back(); // Delete the last entry
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004209 }
4210 Function::arg_iterator ArgIt = Fn->arg_begin();
4211 Function::arg_iterator ArgEnd = Fn->arg_end();
4212 unsigned Idx = 1;
Chris Lattnerbb856a32007-08-06 21:00:46 +00004213 for (ArgListType::iterator I = yyvsp[-4].ArgList->begin();
4214 I != yyvsp[-4].ArgList->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004215 delete I->Ty; // Delete the typeholder...
4216 setValueName(ArgIt, I->Name); // Insert arg into symtab...
4217 CHECK_FOR_ERROR
4218 InsertValue(ArgIt);
4219 Idx++;
4220 }
4221
Chris Lattnerbb856a32007-08-06 21:00:46 +00004222 delete yyvsp[-4].ArgList; // We're now done with the argument list
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004223 }
4224 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004225;
4226 break;}
4227case 235:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004228#line 2376 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004229{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004230 yyval.FunctionVal = CurFun.CurrentFunction;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004231
4232 // Make sure that we keep track of the linkage type even if there was a
4233 // previous "declare".
Chris Lattnerbb856a32007-08-06 21:00:46 +00004234 yyval.FunctionVal->setLinkage(yyvsp[-3].Linkage);
4235 yyval.FunctionVal->setVisibility(yyvsp[-2].Visibility);
Dale Johannesen3afee192007-09-07 21:07:57 +00004236;
4237 break;}
4238case 238:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004239#line 2387 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004240{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004241 yyval.FunctionVal = yyvsp[-1].FunctionVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004242 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004243;
4244 break;}
4245case 239:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004246#line 2392 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004247{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004248 CurFun.CurrentFunction->setLinkage(yyvsp[-2].Linkage);
4249 CurFun.CurrentFunction->setVisibility(yyvsp[-1].Visibility);
4250 yyval.FunctionVal = CurFun.CurrentFunction;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004251 CurFun.FunctionDone();
4252 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004253 ;
4254 break;}
4255case 240:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004256#line 2404 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004257{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004258 yyval.BoolVal = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004259 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004260 ;
4261 break;}
4262case 241:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004263#line 2408 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004264{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004265 yyval.BoolVal = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004266 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004267 ;
4268 break;}
4269case 242:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004270#line 2413 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004271{ // A reference to a direct constant
Chris Lattnerbb856a32007-08-06 21:00:46 +00004272 yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004273 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004274 ;
4275 break;}
4276case 243:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004277#line 2417 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004278{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004279 yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004280 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004281 ;
4282 break;}
4283case 244:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004284#line 2421 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004285{ // Perhaps it's an FP constant?
Chris Lattnerbb856a32007-08-06 21:00:46 +00004286 yyval.ValIDVal = ValID::create(yyvsp[0].FPVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004287 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004288 ;
4289 break;}
4290case 245:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004291#line 2425 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004292{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004293 yyval.ValIDVal = ValID::create(ConstantInt::getTrue());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004294 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004295 ;
4296 break;}
4297case 246:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004298#line 2429 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004299{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004300 yyval.ValIDVal = ValID::create(ConstantInt::getFalse());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004301 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004302 ;
4303 break;}
4304case 247:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004305#line 2433 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004306{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004307 yyval.ValIDVal = ValID::createNull();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004308 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004309 ;
4310 break;}
4311case 248:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004312#line 2437 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004313{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004314 yyval.ValIDVal = ValID::createUndef();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004315 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004316 ;
4317 break;}
4318case 249:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004319#line 2441 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004320{ // A vector zero constant.
Chris Lattnerbb856a32007-08-06 21:00:46 +00004321 yyval.ValIDVal = ValID::createZeroInit();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004322 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004323 ;
4324 break;}
4325case 250:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004326#line 2445 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004327{ // Nonempty unsized packed vector
Chris Lattnerbb856a32007-08-06 21:00:46 +00004328 const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType();
4329 int NumElements = yyvsp[-1].ConstVector->size();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004330
4331 VectorType* pt = VectorType::get(ETy, NumElements);
4332 PATypeHolder* PTy = new PATypeHolder(
4333 HandleUpRefs(
4334 VectorType::get(
4335 ETy,
4336 NumElements)
4337 )
4338 );
4339
4340 // Verify all elements are correct type!
Chris Lattnerbb856a32007-08-06 21:00:46 +00004341 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
4342 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004343 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4344 ETy->getDescription() +"' as required!\nIt is of type '" +
Chris Lattnerbb856a32007-08-06 21:00:46 +00004345 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004346 }
4347
Chris Lattnerbb856a32007-08-06 21:00:46 +00004348 yyval.ValIDVal = ValID::create(ConstantVector::get(pt, *yyvsp[-1].ConstVector));
4349 delete PTy; delete yyvsp[-1].ConstVector;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004350 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004351 ;
4352 break;}
4353case 251:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004354#line 2470 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004355{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004356 yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004357 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004358 ;
4359 break;}
4360case 252:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004361#line 2474 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004362{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004363 yyval.ValIDVal = ValID::createInlineAsm(*yyvsp[-2].StrVal, *yyvsp[0].StrVal, yyvsp[-3].BoolVal);
4364 delete yyvsp[-2].StrVal;
4365 delete yyvsp[0].StrVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004366 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004367 ;
4368 break;}
4369case 253:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004370#line 2484 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004371{ // Is it an integer reference...?
Chris Lattnerbb856a32007-08-06 21:00:46 +00004372 yyval.ValIDVal = ValID::createLocalID(yyvsp[0].UIntVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004373 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004374 ;
4375 break;}
4376case 254:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004377#line 2488 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004378{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004379 yyval.ValIDVal = ValID::createGlobalID(yyvsp[0].UIntVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004380 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004381 ;
4382 break;}
4383case 255:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004384#line 2492 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004385{ // Is it a named reference...?
Chris Lattnerbb856a32007-08-06 21:00:46 +00004386 yyval.ValIDVal = ValID::createLocalName(*yyvsp[0].StrVal);
4387 delete yyvsp[0].StrVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004388 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004389 ;
4390 break;}
4391case 256:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004392#line 2497 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004393{ // Is it a named reference...?
Chris Lattnerbb856a32007-08-06 21:00:46 +00004394 yyval.ValIDVal = ValID::createGlobalName(*yyvsp[0].StrVal);
4395 delete yyvsp[0].StrVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004396 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004397 ;
4398 break;}
4399case 259:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004400#line 2510 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004401{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004402 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00004403 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
4404 yyval.ValueVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal);
4405 delete yyvsp[-1].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004406 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004407 ;
4408 break;}
4409case 260:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004410#line 2519 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004411{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004412 yyval.FunctionVal = yyvsp[-1].FunctionVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004413 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004414 ;
4415 break;}
4416case 261:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004417#line 2523 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004418{ // Do not allow functions with 0 basic blocks
Chris Lattnerbb856a32007-08-06 21:00:46 +00004419 yyval.FunctionVal = yyvsp[-1].FunctionVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004420 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004421 ;
4422 break;}
4423case 262:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004424#line 2532 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004425{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004426 setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004427 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004428 InsertValue(yyvsp[0].TermInstVal);
4429 yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal);
4430 yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004431 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004432 ;
4433 break;}
4434case 263:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004435#line 2541 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004436{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004437 if (CastInst *CI1 = dyn_cast<CastInst>(yyvsp[0].InstVal))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004438 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4439 if (CI2->getParent() == 0)
Chris Lattnerbb856a32007-08-06 21:00:46 +00004440 yyvsp[-1].BasicBlockVal->getInstList().push_back(CI2);
4441 yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal);
4442 yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004443 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004444 ;
4445 break;}
4446case 264:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004447#line 2550 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004448{ // Empty space between instruction lists
Chris Lattnerbb856a32007-08-06 21:00:46 +00004449 yyval.BasicBlockVal = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004450 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004451 ;
4452 break;}
4453case 265:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004454#line 2554 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004455{ // Labelled (named) basic block
Chris Lattnerbb856a32007-08-06 21:00:46 +00004456 yyval.BasicBlockVal = defineBBVal(ValID::createLocalName(*yyvsp[0].StrVal));
4457 delete yyvsp[0].StrVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004458 CHECK_FOR_ERROR
4459
Dale Johannesen3afee192007-09-07 21:07:57 +00004460 ;
4461 break;}
4462case 266:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004463#line 2561 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004464{ // Return with a result...
Chris Lattnerbb856a32007-08-06 21:00:46 +00004465 yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal);
4466 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004467 ;
4468 break;}
4469case 267:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004470#line 2565 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004471{ // Return with no result...
Chris Lattnerbb856a32007-08-06 21:00:46 +00004472 yyval.TermInstVal = new ReturnInst();
4473 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004474 ;
4475 break;}
4476case 268:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004477#line 2569 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004478{ // Unconditional Branch...
Chris Lattnerbb856a32007-08-06 21:00:46 +00004479 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
4480 CHECK_FOR_ERROR
4481 yyval.TermInstVal = new BranchInst(tmpBB);
Dale Johannesen3afee192007-09-07 21:07:57 +00004482 ;
4483 break;}
4484case 269:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004485#line 2574 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004486{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004487 assert(cast<IntegerType>(yyvsp[-7].PrimType)->getBitWidth() == 1 && "Not Bool?");
4488 BasicBlock* tmpBBA = getBBVal(yyvsp[-3].ValIDVal);
4489 CHECK_FOR_ERROR
4490 BasicBlock* tmpBBB = getBBVal(yyvsp[0].ValIDVal);
4491 CHECK_FOR_ERROR
4492 Value* tmpVal = getVal(Type::Int1Ty, yyvsp[-6].ValIDVal);
4493 CHECK_FOR_ERROR
4494 yyval.TermInstVal = new BranchInst(tmpBBA, tmpBBB, tmpVal);
Dale Johannesen3afee192007-09-07 21:07:57 +00004495 ;
4496 break;}
4497case 270:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004498#line 2584 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004499{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004500 Value* tmpVal = getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal);
4501 CHECK_FOR_ERROR
4502 BasicBlock* tmpBB = getBBVal(yyvsp[-3].ValIDVal);
4503 CHECK_FOR_ERROR
4504 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, yyvsp[-1].JumpTable->size());
4505 yyval.TermInstVal = S;
Reid Spenceraa8ae282007-07-31 03:50:36 +00004506
Chris Lattnerbb856a32007-08-06 21:00:46 +00004507 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = yyvsp[-1].JumpTable->begin(),
4508 E = yyvsp[-1].JumpTable->end();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004509 for (; I != E; ++I) {
4510 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
4511 S->addCase(CI, I->second);
4512 else
4513 GEN_ERROR("Switch case is constant, but not a simple integer");
4514 }
Chris Lattnerbb856a32007-08-06 21:00:46 +00004515 delete yyvsp[-1].JumpTable;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004516 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004517 ;
4518 break;}
4519case 271:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004520#line 2603 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004521{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004522 Value* tmpVal = getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004523 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004524 BasicBlock* tmpBB = getBBVal(yyvsp[-2].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004525 CHECK_FOR_ERROR
4526 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
Chris Lattnerbb856a32007-08-06 21:00:46 +00004527 yyval.TermInstVal = S;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004528 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004529 ;
4530 break;}
4531case 272:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004532#line 2613 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004533{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004534
4535 // Handle the short syntax
4536 const PointerType *PFTy = 0;
4537 const FunctionType *Ty = 0;
Chris Lattnerbb856a32007-08-06 21:00:46 +00004538 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-11].TypeVal->get())) ||
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004539 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4540 // Pull out the types of all of the arguments...
4541 std::vector<const Type*> ParamTypes;
4542 ParamAttrsVector Attrs;
Chris Lattnerbb856a32007-08-06 21:00:46 +00004543 if (yyvsp[-6].ParamAttrs != ParamAttr::None) {
4544 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[-6].ParamAttrs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004545 Attrs.push_back(PAWI);
4546 }
Dale Johannesencfb19e62007-11-05 21:20:28 +00004547 ParamList::iterator I = yyvsp[-8].ParamList->begin(), E = yyvsp[-8].ParamList->end();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004548 unsigned index = 1;
4549 for (; I != E; ++I, ++index) {
4550 const Type *Ty = I->Val->getType();
4551 if (Ty == Type::VoidTy)
4552 GEN_ERROR("Short call syntax cannot be used with varargs");
4553 ParamTypes.push_back(Ty);
4554 if (I->Attrs != ParamAttr::None) {
4555 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
4556 Attrs.push_back(PAWI);
4557 }
4558 }
4559
4560 ParamAttrsList *PAL = 0;
4561 if (!Attrs.empty())
4562 PAL = ParamAttrsList::get(Attrs);
Chris Lattnerbb856a32007-08-06 21:00:46 +00004563 Ty = FunctionType::get(yyvsp[-11].TypeVal->get(), ParamTypes, false, PAL);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004564 PFTy = PointerType::get(Ty);
4565 }
4566
Chris Lattnerbb856a32007-08-06 21:00:46 +00004567 delete yyvsp[-11].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004568
Chris Lattnerbb856a32007-08-06 21:00:46 +00004569 Value *V = getVal(PFTy, yyvsp[-10].ValIDVal); // Get the function we're calling...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004570 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004571 BasicBlock *Normal = getBBVal(yyvsp[-3].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004572 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004573 BasicBlock *Except = getBBVal(yyvsp[0].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004574 CHECK_FOR_ERROR
4575
4576 // Check the arguments
4577 ValueList Args;
Dale Johannesencfb19e62007-11-05 21:20:28 +00004578 if (yyvsp[-8].ParamList->empty()) { // Has no arguments?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004579 // Make sure no arguments is a good thing!
4580 if (Ty->getNumParams() != 0)
4581 GEN_ERROR("No arguments passed to a function that "
4582 "expects arguments");
4583 } else { // Has arguments?
4584 // Loop through FunctionType's arguments and ensure they are specified
4585 // correctly!
4586 FunctionType::param_iterator I = Ty->param_begin();
4587 FunctionType::param_iterator E = Ty->param_end();
Dale Johannesencfb19e62007-11-05 21:20:28 +00004588 ParamList::iterator ArgI = yyvsp[-8].ParamList->begin(), ArgE = yyvsp[-8].ParamList->end();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004589
4590 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
4591 if (ArgI->Val->getType() != *I)
4592 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
4593 (*I)->getDescription() + "'");
4594 Args.push_back(ArgI->Val);
4595 }
4596
4597 if (Ty->isVarArg()) {
4598 if (I == E)
4599 for (; ArgI != ArgE; ++ArgI)
4600 Args.push_back(ArgI->Val); // push the remaining varargs
4601 } else if (I != E || ArgI != ArgE)
4602 GEN_ERROR("Invalid number of parameters detected");
4603 }
4604
4605 // Create the InvokeInst
Chris Lattnerd140ada2007-08-29 16:15:23 +00004606 InvokeInst *II = new InvokeInst(V, Normal, Except, Args.begin(), Args.end());
Chris Lattnerbb856a32007-08-06 21:00:46 +00004607 II->setCallingConv(yyvsp[-12].UIntVal);
4608 yyval.TermInstVal = II;
Dale Johannesencfb19e62007-11-05 21:20:28 +00004609 delete yyvsp[-8].ParamList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004610 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004611 ;
4612 break;}
4613case 273:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004614#line 2692 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004615{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004616 yyval.TermInstVal = new UnwindInst();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004617 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004618 ;
4619 break;}
4620case 274:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004621#line 2696 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004622{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004623 yyval.TermInstVal = new UnreachableInst();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004624 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004625 ;
4626 break;}
4627case 275:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004628#line 2703 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004629{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004630 yyval.JumpTable = yyvsp[-5].JumpTable;
4631 Constant *V = cast<Constant>(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004632 CHECK_FOR_ERROR
4633 if (V == 0)
4634 GEN_ERROR("May only switch on a constant pool value");
4635
Chris Lattnerbb856a32007-08-06 21:00:46 +00004636 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004637 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004638 yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
Dale Johannesen3afee192007-09-07 21:07:57 +00004639 ;
4640 break;}
4641case 276:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004642#line 2714 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004643{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004644 yyval.JumpTable = new std::vector<std::pair<Constant*, BasicBlock*> >();
4645 Constant *V = cast<Constant>(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004646 CHECK_FOR_ERROR
4647
4648 if (V == 0)
4649 GEN_ERROR("May only switch on a constant pool value");
4650
Chris Lattnerbb856a32007-08-06 21:00:46 +00004651 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004652 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004653 yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
Dale Johannesen3afee192007-09-07 21:07:57 +00004654 ;
4655 break;}
4656case 277:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004657#line 2727 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004658{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004659 // Is this definition named?? if so, assign the name...
Chris Lattnerbb856a32007-08-06 21:00:46 +00004660 setValueName(yyvsp[0].InstVal, yyvsp[-1].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004661 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004662 InsertValue(yyvsp[0].InstVal);
4663 yyval.InstVal = yyvsp[0].InstVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004664 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004665 ;
4666 break;}
4667case 278:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004668#line 2737 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004669{ // Used for PHI nodes
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004670 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00004671 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-5].TypeVal)->getDescription());
4672 yyval.PHIList = new std::list<std::pair<Value*, BasicBlock*> >();
4673 Value* tmpVal = getVal(*yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004674 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004675 BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004676 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004677 yyval.PHIList->push_back(std::make_pair(tmpVal, tmpBB));
4678 delete yyvsp[-5].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00004679 ;
4680 break;}
4681case 279:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004682#line 2748 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004683{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004684 yyval.PHIList = yyvsp[-6].PHIList;
4685 Value* tmpVal = getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004686 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004687 BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004688 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004689 yyvsp[-6].PHIList->push_back(std::make_pair(tmpVal, tmpBB));
Dale Johannesen3afee192007-09-07 21:07:57 +00004690 ;
4691 break;}
4692case 280:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004693#line 2758 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004694{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004695 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00004696 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004697 // Used for call and invoke instructions
Dale Johannesencfb19e62007-11-05 21:20:28 +00004698 yyval.ParamList = new ParamList();
4699 ParamListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-2].TypeVal->get(), yyvsp[-1].ValIDVal);
4700 yyval.ParamList->push_back(E);
Chris Lattnerbb856a32007-08-06 21:00:46 +00004701 delete yyvsp[-2].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00004702 ;
4703 break;}
4704case 281:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004705#line 2767 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4706{
4707 // Labels are only valid in ASMs
4708 yyval.ParamList = new ParamList();
4709 ParamListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getBBVal(yyvsp[-1].ValIDVal);
4710 yyval.ParamList->push_back(E);
4711 ;
4712 break;}
4713case 282:
4714#line 2773 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004715{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004716 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00004717 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
Dale Johannesencfb19e62007-11-05 21:20:28 +00004718 yyval.ParamList = yyvsp[-4].ParamList;
4719 ParamListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-2].TypeVal->get(), yyvsp[-1].ValIDVal);
4720 yyval.ParamList->push_back(E);
Chris Lattnerbb856a32007-08-06 21:00:46 +00004721 delete yyvsp[-2].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004722 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004723 ;
4724 break;}
Dale Johannesen3afee192007-09-07 21:07:57 +00004725case 283:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004726#line 2782 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4727{
4728 yyval.ParamList = yyvsp[-4].ParamList;
4729 ParamListEntry E; E.Attrs = yyvsp[0].ParamAttrs; E.Val = getBBVal(yyvsp[-1].ValIDVal);
4730 yyval.ParamList->push_back(E);
4731 CHECK_FOR_ERROR
4732 ;
Dale Johannesen3afee192007-09-07 21:07:57 +00004733 break;}
4734case 284:
Dale Johannesencfb19e62007-11-05 21:20:28 +00004735#line 2788 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4736{ yyval.ParamList = new ParamList(); ;
4737 break;}
4738case 285:
4739#line 2791 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
4740{ yyval.ValueList = new std::vector<Value*>(); ;
4741 break;}
4742case 286:
4743#line 2792 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004744{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004745 yyval.ValueList = yyvsp[-2].ValueList;
4746 yyval.ValueList->push_back(yyvsp[0].ValueVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004747 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004748 ;
4749 break;}
Dale Johannesencfb19e62007-11-05 21:20:28 +00004750case 287:
4751#line 2799 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004752{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004753 yyval.BoolVal = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004754 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004755 ;
4756 break;}
Dale Johannesencfb19e62007-11-05 21:20:28 +00004757case 288:
4758#line 2803 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004759{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004760 yyval.BoolVal = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004761 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004762 ;
4763 break;}
Dale Johannesencfb19e62007-11-05 21:20:28 +00004764case 289:
4765#line 2808 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004766{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004767 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00004768 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4769 if (!(*yyvsp[-3].TypeVal)->isInteger() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() &&
4770 !isa<VectorType>((*yyvsp[-3].TypeVal).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004771 GEN_ERROR(
4772 "Arithmetic operator requires integer, FP, or packed operands");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004773 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()) &&
4774 (yyvsp[-4].BinaryOpVal == Instruction::URem ||
4775 yyvsp[-4].BinaryOpVal == Instruction::SRem ||
4776 yyvsp[-4].BinaryOpVal == Instruction::FRem))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004777 GEN_ERROR("Remainder not supported on vector types");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004778 Value* val1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004779 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004780 Value* val2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004781 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004782 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, val1, val2);
4783 if (yyval.InstVal == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004784 GEN_ERROR("binary operator returned null");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004785 delete yyvsp[-3].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00004786 ;
4787 break;}
Dale Johannesencfb19e62007-11-05 21:20:28 +00004788case 290:
4789#line 2829 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004790{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004791 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00004792 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4793 if (!(*yyvsp[-3].TypeVal)->isInteger()) {
4794 if (Instruction::isShift(yyvsp[-4].BinaryOpVal) || !isa<VectorType>(yyvsp[-3].TypeVal->get()) ||
4795 !cast<VectorType>(yyvsp[-3].TypeVal->get())->getElementType()->isInteger())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004796 GEN_ERROR("Logical operator requires integral operands");
4797 }
Chris Lattnerbb856a32007-08-06 21:00:46 +00004798 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004799 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004800 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004801 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004802 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, tmpVal1, tmpVal2);
4803 if (yyval.InstVal == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004804 GEN_ERROR("binary operator returned null");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004805 delete yyvsp[-3].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00004806 ;
4807 break;}
Dale Johannesencfb19e62007-11-05 21:20:28 +00004808case 291:
4809#line 2846 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004810{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004811 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00004812 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4813 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004814 GEN_ERROR("Vector types not supported by icmp instruction");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004815 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004816 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004817 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004818 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004819 yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].IPredicate, tmpVal1, tmpVal2);
4820 if (yyval.InstVal == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004821 GEN_ERROR("icmp operator returned null");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004822 delete yyvsp[-3].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00004823 ;
4824 break;}
Dale Johannesencfb19e62007-11-05 21:20:28 +00004825case 292:
4826#line 2860 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004827{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004828 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00004829 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
4830 if (isa<VectorType>((*yyvsp[-3].TypeVal).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004831 GEN_ERROR("Vector types not supported by fcmp instruction");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004832 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004833 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004834 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004835 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00004836 yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].FPredicate, tmpVal1, tmpVal2);
4837 if (yyval.InstVal == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004838 GEN_ERROR("fcmp operator returned null");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004839 delete yyvsp[-3].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00004840 ;
4841 break;}
Dale Johannesencfb19e62007-11-05 21:20:28 +00004842case 293:
4843#line 2874 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004844{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004845 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00004846 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
4847 Value* Val = yyvsp[-2].ValueVal;
4848 const Type* DestTy = yyvsp[0].TypeVal->get();
4849 if (!CastInst::castIsValid(yyvsp[-3].CastOpVal, Val, DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004850 GEN_ERROR("invalid cast opcode for cast from '" +
4851 Val->getType()->getDescription() + "' to '" +
4852 DestTy->getDescription() + "'");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004853 yyval.InstVal = CastInst::create(yyvsp[-3].CastOpVal, Val, DestTy);
4854 delete yyvsp[0].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00004855 ;
4856 break;}
Dale Johannesencfb19e62007-11-05 21:20:28 +00004857case 294:
4858#line 2886 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004859{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004860 if (yyvsp[-4].ValueVal->getType() != Type::Int1Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004861 GEN_ERROR("select condition must be boolean");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004862 if (yyvsp[-2].ValueVal->getType() != yyvsp[0].ValueVal->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004863 GEN_ERROR("select value types should match");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004864 yyval.InstVal = new SelectInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004865 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004866 ;
4867 break;}
Dale Johannesencfb19e62007-11-05 21:20:28 +00004868case 295:
4869#line 2894 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004870{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004871 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00004872 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
4873 yyval.InstVal = new VAArgInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal);
4874 delete yyvsp[0].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004875 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004876 ;
4877 break;}
Dale Johannesencfb19e62007-11-05 21:20:28 +00004878case 296:
4879#line 2901 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004880{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004881 if (!ExtractElementInst::isValidOperands(yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004882 GEN_ERROR("Invalid extractelement operands");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004883 yyval.InstVal = new ExtractElementInst(yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004884 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004885 ;
4886 break;}
Dale Johannesencfb19e62007-11-05 21:20:28 +00004887case 297:
4888#line 2907 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004889{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004890 if (!InsertElementInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004891 GEN_ERROR("Invalid insertelement operands");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004892 yyval.InstVal = new InsertElementInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004893 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004894 ;
4895 break;}
Dale Johannesencfb19e62007-11-05 21:20:28 +00004896case 298:
4897#line 2913 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004898{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004899 if (!ShuffleVectorInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004900 GEN_ERROR("Invalid shufflevector operands");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004901 yyval.InstVal = new ShuffleVectorInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004902 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004903 ;
4904 break;}
Dale Johannesencfb19e62007-11-05 21:20:28 +00004905case 299:
4906#line 2919 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004907{
Chris Lattnerbb856a32007-08-06 21:00:46 +00004908 const Type *Ty = yyvsp[0].PHIList->front().first->getType();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004909 if (!Ty->isFirstClassType())
4910 GEN_ERROR("PHI node operands must be of first class type");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004911 yyval.InstVal = new PHINode(Ty);
4912 ((PHINode*)yyval.InstVal)->reserveOperandSpace(yyvsp[0].PHIList->size());
4913 while (yyvsp[0].PHIList->begin() != yyvsp[0].PHIList->end()) {
4914 if (yyvsp[0].PHIList->front().first->getType() != Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004915 GEN_ERROR("All elements of a PHI node must be of the same type");
Chris Lattnerbb856a32007-08-06 21:00:46 +00004916 cast<PHINode>(yyval.InstVal)->addIncoming(yyvsp[0].PHIList->front().first, yyvsp[0].PHIList->front().second);
4917 yyvsp[0].PHIList->pop_front();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004918 }
Chris Lattnerbb856a32007-08-06 21:00:46 +00004919 delete yyvsp[0].PHIList; // Free the list...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004920 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00004921 ;
4922 break;}
Dale Johannesencfb19e62007-11-05 21:20:28 +00004923case 300:
4924#line 2935 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00004925{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004926
4927 // Handle the short syntax
4928 const PointerType *PFTy = 0;
4929 const FunctionType *Ty = 0;
Chris Lattnerbb856a32007-08-06 21:00:46 +00004930 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-5].TypeVal->get())) ||
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004931 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4932 // Pull out the types of all of the arguments...
4933 std::vector<const Type*> ParamTypes;
4934 ParamAttrsVector Attrs;
Chris Lattnerbb856a32007-08-06 21:00:46 +00004935 if (yyvsp[0].ParamAttrs != ParamAttr::None) {
4936 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[0].ParamAttrs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004937 Attrs.push_back(PAWI);
4938 }
4939 unsigned index = 1;
Dale Johannesencfb19e62007-11-05 21:20:28 +00004940 ParamList::iterator I = yyvsp[-2].ParamList->begin(), E = yyvsp[-2].ParamList->end();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004941 for (; I != E; ++I, ++index) {
4942 const Type *Ty = I->Val->getType();
4943 if (Ty == Type::VoidTy)
4944 GEN_ERROR("Short call syntax cannot be used with varargs");
4945 ParamTypes.push_back(Ty);
4946 if (I->Attrs != ParamAttr::None) {
4947 ParamAttrsWithIndex PAWI; PAWI.index = index; PAWI.attrs = I->Attrs;
4948 Attrs.push_back(PAWI);
4949 }
4950 }
4951
4952 ParamAttrsList *PAL = 0;
4953 if (!Attrs.empty())
4954 PAL = ParamAttrsList::get(Attrs);
4955
Chris Lattnerbb856a32007-08-06 21:00:46 +00004956 Ty = FunctionType::get(yyvsp[-5].TypeVal->get(), ParamTypes, false, PAL);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004957 PFTy = PointerType::get(Ty);
4958 }
4959
Chris Lattnerbb856a32007-08-06 21:00:46 +00004960 Value *V = getVal(PFTy, yyvsp[-4].ValIDVal); // Get the function we're calling...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004961 CHECK_FOR_ERROR
4962
4963 // Check for call to invalid intrinsic to avoid crashing later.
4964 if (Function *theF = dyn_cast<Function>(V)) {
4965 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
4966 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
4967 !theF->getIntrinsicID(true))
4968 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
4969 theF->getName() + "'");
4970 }
4971
4972 // Check the arguments
4973 ValueList Args;
Dale Johannesencfb19e62007-11-05 21:20:28 +00004974 if (yyvsp[-2].ParamList->empty()) { // Has no arguments?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004975 // Make sure no arguments is a good thing!
4976 if (Ty->getNumParams() != 0)
4977 GEN_ERROR("No arguments passed to a function that "
4978 "expects arguments");
4979 } else { // Has arguments?
4980 // Loop through FunctionType's arguments and ensure they are specified
4981 // correctly!
4982 //
4983 FunctionType::param_iterator I = Ty->param_begin();
4984 FunctionType::param_iterator E = Ty->param_end();
Dale Johannesencfb19e62007-11-05 21:20:28 +00004985 ParamList::iterator ArgI = yyvsp[-2].ParamList->begin(), ArgE = yyvsp[-2].ParamList->end();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004986
4987 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
4988 if (ArgI->Val->getType() != *I)
4989 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
4990 (*I)->getDescription() + "'");
4991 Args.push_back(ArgI->Val);
4992 }
4993 if (Ty->isVarArg()) {
4994 if (I == E)
4995 for (; ArgI != ArgE; ++ArgI)
4996 Args.push_back(ArgI->Val); // push the remaining varargs
4997 } else if (I != E || ArgI != ArgE)
4998 GEN_ERROR("Invalid number of parameters detected");
4999 }
5000 // Create the call node
David Greene9145dd22007-08-01 03:59:32 +00005001 CallInst *CI = new CallInst(V, Args.begin(), Args.end());
Chris Lattnerbb856a32007-08-06 21:00:46 +00005002 CI->setTailCall(yyvsp[-7].BoolVal);
5003 CI->setCallingConv(yyvsp[-6].UIntVal);
5004 yyval.InstVal = CI;
Dale Johannesencfb19e62007-11-05 21:20:28 +00005005 delete yyvsp[-2].ParamList;
Chris Lattnerbb856a32007-08-06 21:00:46 +00005006 delete yyvsp[-5].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005007 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00005008 ;
5009 break;}
Dale Johannesencfb19e62007-11-05 21:20:28 +00005010case 301:
5011#line 3019 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00005012{
Chris Lattnerbb856a32007-08-06 21:00:46 +00005013 yyval.InstVal = yyvsp[0].InstVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005014 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00005015 ;
5016 break;}
Dale Johannesencfb19e62007-11-05 21:20:28 +00005017case 302:
5018#line 3024 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00005019{
Chris Lattnerbb856a32007-08-06 21:00:46 +00005020 yyval.BoolVal = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005021 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00005022 ;
5023 break;}
Dale Johannesencfb19e62007-11-05 21:20:28 +00005024case 303:
5025#line 3028 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00005026{
Chris Lattnerbb856a32007-08-06 21:00:46 +00005027 yyval.BoolVal = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005028 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00005029 ;
5030 break;}
Dale Johannesencfb19e62007-11-05 21:20:28 +00005031case 304:
5032#line 3035 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00005033{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005034 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00005035 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
5036 yyval.InstVal = new MallocInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
5037 delete yyvsp[-1].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005038 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00005039 ;
5040 break;}
Dale Johannesencfb19e62007-11-05 21:20:28 +00005041case 305:
5042#line 3042 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00005043{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005044 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00005045 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
5046 Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005047 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00005048 yyval.InstVal = new MallocInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
5049 delete yyvsp[-4].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00005050 ;
5051 break;}
Dale Johannesencfb19e62007-11-05 21:20:28 +00005052case 306:
5053#line 3050 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00005054{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005055 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00005056 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
5057 yyval.InstVal = new AllocaInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
5058 delete yyvsp[-1].TypeVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005059 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00005060 ;
5061 break;}
Dale Johannesencfb19e62007-11-05 21:20:28 +00005062case 307:
5063#line 3057 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00005064{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005065 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00005066 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
5067 Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005068 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00005069 yyval.InstVal = new AllocaInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
5070 delete yyvsp[-4].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00005071 ;
5072 break;}
Dale Johannesencfb19e62007-11-05 21:20:28 +00005073case 308:
5074#line 3065 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00005075{
Chris Lattnerbb856a32007-08-06 21:00:46 +00005076 if (!isa<PointerType>(yyvsp[0].ValueVal->getType()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005077 GEN_ERROR("Trying to free nonpointer type " +
Chris Lattnerbb856a32007-08-06 21:00:46 +00005078 yyvsp[0].ValueVal->getType()->getDescription() + "");
5079 yyval.InstVal = new FreeInst(yyvsp[0].ValueVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005080 CHECK_FOR_ERROR
Dale Johannesen3afee192007-09-07 21:07:57 +00005081 ;
5082 break;}
Dale Johannesencfb19e62007-11-05 21:20:28 +00005083case 309:
5084#line 3073 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00005085{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005086 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00005087 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5088 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005089 GEN_ERROR("Can't load from nonpointer type: " +
Chris Lattnerbb856a32007-08-06 21:00:46 +00005090 (*yyvsp[-2].TypeVal)->getDescription());
5091 if (!cast<PointerType>(yyvsp[-2].TypeVal->get())->getElementType()->isFirstClassType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005092 GEN_ERROR("Can't load from pointer of non-first-class type: " +
Chris Lattnerbb856a32007-08-06 21:00:46 +00005093 (*yyvsp[-2].TypeVal)->getDescription());
5094 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005095 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00005096 yyval.InstVal = new LoadInst(tmpVal, "", yyvsp[-4].BoolVal, yyvsp[0].UIntVal);
5097 delete yyvsp[-2].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00005098 ;
5099 break;}
Dale Johannesencfb19e62007-11-05 21:20:28 +00005100case 310:
5101#line 3087 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00005102{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005103 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00005104 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5105 const PointerType *PT = dyn_cast<PointerType>(yyvsp[-2].TypeVal->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005106 if (!PT)
5107 GEN_ERROR("Can't store to a nonpointer type: " +
Chris Lattnerbb856a32007-08-06 21:00:46 +00005108 (*yyvsp[-2].TypeVal)->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005109 const Type *ElTy = PT->getElementType();
Chris Lattnerbb856a32007-08-06 21:00:46 +00005110 if (ElTy != yyvsp[-4].ValueVal->getType())
5111 GEN_ERROR("Can't store '" + yyvsp[-4].ValueVal->getType()->getDescription() +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005112 "' into space of type '" + ElTy->getDescription() + "'");
5113
Chris Lattnerbb856a32007-08-06 21:00:46 +00005114 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005115 CHECK_FOR_ERROR
Chris Lattnerbb856a32007-08-06 21:00:46 +00005116 yyval.InstVal = new StoreInst(yyvsp[-4].ValueVal, tmpVal, yyvsp[-6].BoolVal, yyvsp[0].UIntVal);
5117 delete yyvsp[-2].TypeVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00005118 ;
5119 break;}
Dale Johannesencfb19e62007-11-05 21:20:28 +00005120case 311:
5121#line 3104 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen3afee192007-09-07 21:07:57 +00005122{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005123 if (!UpRefs.empty())
Chris Lattnerbb856a32007-08-06 21:00:46 +00005124 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
5125 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005126 GEN_ERROR("getelementptr insn requires pointer operand");
5127
David Greene48556392007-09-04 18:46:50 +00005128 if (!GetElementPtrInst::getIndexedType(*yyvsp[-2].TypeVal, yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end(), true))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005129 GEN_ERROR("Invalid getelementptr indices for type '" +
Chris Lattnerbb856a32007-08-06 21:00:46 +00005130 (*yyvsp[-2].TypeVal)->getDescription()+ "'");
5131 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005132 CHECK_FOR_ERROR
David Greene48556392007-09-04 18:46:50 +00005133 yyval.InstVal = new GetElementPtrInst(tmpVal, yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end());
Chris Lattnerbb856a32007-08-06 21:00:46 +00005134 delete yyvsp[-2].TypeVal;
5135 delete yyvsp[0].ValueList;
Dale Johannesen3afee192007-09-07 21:07:57 +00005136 ;
5137 break;}
5138}
5139 /* the action file gets copied in in place of this dollarsign */
5140#line 543 "/usr/share/bison.simple"
Chris Lattnerbb856a32007-08-06 21:00:46 +00005141
5142 yyvsp -= yylen;
5143 yyssp -= yylen;
Dale Johannesen3afee192007-09-07 21:07:57 +00005144#ifdef YYLSP_NEEDED
5145 yylsp -= yylen;
5146#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005147
Dale Johannesen3afee192007-09-07 21:07:57 +00005148#if YYDEBUG != 0
5149 if (yydebug)
5150 {
5151 short *ssp1 = yyss - 1;
5152 fprintf (stderr, "state stack now");
5153 while (ssp1 != yyssp)
5154 fprintf (stderr, " %d", *++ssp1);
5155 fprintf (stderr, "\n");
5156 }
5157#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005158
5159 *++yyvsp = yyval;
5160
Dale Johannesen3afee192007-09-07 21:07:57 +00005161#ifdef YYLSP_NEEDED
5162 yylsp++;
5163 if (yylen == 0)
5164 {
5165 yylsp->first_line = yylloc.first_line;
5166 yylsp->first_column = yylloc.first_column;
5167 yylsp->last_line = (yylsp-1)->last_line;
5168 yylsp->last_column = (yylsp-1)->last_column;
5169 yylsp->text = 0;
5170 }
5171 else
5172 {
5173 yylsp->last_line = (yylsp+yylen-1)->last_line;
5174 yylsp->last_column = (yylsp+yylen-1)->last_column;
5175 }
5176#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005177
Dale Johannesen3afee192007-09-07 21:07:57 +00005178 /* Now "shift" the result of the reduction.
5179 Determine what state that goes to,
5180 based on the state we popped back to
5181 and the rule number reduced by. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005182
5183 yyn = yyr1[yyn];
5184
Dale Johannesen3afee192007-09-07 21:07:57 +00005185 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
5186 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005187 yystate = yytable[yystate];
5188 else
Dale Johannesen3afee192007-09-07 21:07:57 +00005189 yystate = yydefgoto[yyn - YYNTBASE];
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005190
5191 goto yynewstate;
5192
Dale Johannesen3afee192007-09-07 21:07:57 +00005193yyerrlab: /* here on detecting error */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005194
Dale Johannesen3afee192007-09-07 21:07:57 +00005195 if (! yyerrstatus)
5196 /* If not already recovering from an error, report this error. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005197 {
5198 ++yynerrs;
Dale Johannesen3afee192007-09-07 21:07:57 +00005199
5200#ifdef YYERROR_VERBOSE
Chris Lattnerbb856a32007-08-06 21:00:46 +00005201 yyn = yypact[yystate];
5202
Dale Johannesen3afee192007-09-07 21:07:57 +00005203 if (yyn > YYFLAG && yyn < YYLAST)
Chris Lattnerbb856a32007-08-06 21:00:46 +00005204 {
Dale Johannesen3afee192007-09-07 21:07:57 +00005205 int size = 0;
5206 char *msg;
5207 int x, count;
Chris Lattnerbb856a32007-08-06 21:00:46 +00005208
Dale Johannesen3afee192007-09-07 21:07:57 +00005209 count = 0;
5210 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
5211 for (x = (yyn < 0 ? -yyn : 0);
5212 x < (sizeof(yytname) / sizeof(char *)); x++)
5213 if (yycheck[x + yyn] == x)
5214 size += strlen(yytname[x]) + 15, count++;
5215 msg = (char *) malloc(size + 15);
5216 if (msg != 0)
Chris Lattnerbb856a32007-08-06 21:00:46 +00005217 {
Dale Johannesen3afee192007-09-07 21:07:57 +00005218 strcpy(msg, "parse error");
Chris Lattnerbb856a32007-08-06 21:00:46 +00005219
Dale Johannesen3afee192007-09-07 21:07:57 +00005220 if (count < 5)
Chris Lattnerbb856a32007-08-06 21:00:46 +00005221 {
Dale Johannesen3afee192007-09-07 21:07:57 +00005222 count = 0;
5223 for (x = (yyn < 0 ? -yyn : 0);
5224 x < (sizeof(yytname) / sizeof(char *)); x++)
5225 if (yycheck[x + yyn] == x)
Chris Lattnerbb856a32007-08-06 21:00:46 +00005226 {
Dale Johannesen3afee192007-09-07 21:07:57 +00005227 strcat(msg, count == 0 ? ", expecting `" : " or `");
5228 strcat(msg, yytname[x]);
5229 strcat(msg, "'");
5230 count++;
Chris Lattnerbb856a32007-08-06 21:00:46 +00005231 }
5232 }
Dale Johannesen3afee192007-09-07 21:07:57 +00005233 yyerror(msg);
5234 free(msg);
Chris Lattnerbb856a32007-08-06 21:00:46 +00005235 }
5236 else
Dale Johannesen3afee192007-09-07 21:07:57 +00005237 yyerror ("parse error; also virtual memory exceeded");
Chris Lattnerbb856a32007-08-06 21:00:46 +00005238 }
5239 else
5240#endif /* YYERROR_VERBOSE */
Dale Johannesen3afee192007-09-07 21:07:57 +00005241 yyerror("parse error");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005242 }
5243
Dale Johannesen3afee192007-09-07 21:07:57 +00005244 goto yyerrlab1;
5245yyerrlab1: /* here on error raised explicitly by an action */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005246
5247 if (yyerrstatus == 3)
5248 {
Dale Johannesen3afee192007-09-07 21:07:57 +00005249 /* if just tried and failed to reuse lookahead token after an error, discard it. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005250
Dale Johannesen3afee192007-09-07 21:07:57 +00005251 /* return failure if at end of input */
5252 if (yychar == YYEOF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005253 YYABORT;
5254
Dale Johannesen3afee192007-09-07 21:07:57 +00005255#if YYDEBUG != 0
5256 if (yydebug)
5257 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
5258#endif
5259
5260 yychar = YYEMPTY;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005261 }
5262
Dale Johannesen3afee192007-09-07 21:07:57 +00005263 /* Else will try to reuse lookahead token
5264 after shifting the error token. */
5265
5266 yyerrstatus = 3; /* Each real token shifted decrements this */
5267
5268 goto yyerrhandle;
5269
5270yyerrdefault: /* current state does not do anything special for the error token. */
5271
5272#if 0
5273 /* This is wrong; only states that explicitly want error tokens
5274 should shift them. */
5275 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
5276 if (yyn) goto yydefault;
5277#endif
5278
5279yyerrpop: /* pop the current state because it cannot handle the error token */
5280
5281 if (yyssp == yyss) YYABORT;
5282 yyvsp--;
5283 yystate = *--yyssp;
5284#ifdef YYLSP_NEEDED
5285 yylsp--;
5286#endif
5287
5288#if YYDEBUG != 0
5289 if (yydebug)
5290 {
5291 short *ssp1 = yyss - 1;
5292 fprintf (stderr, "Error: state stack now");
5293 while (ssp1 != yyssp)
5294 fprintf (stderr, " %d", *++ssp1);
5295 fprintf (stderr, "\n");
5296 }
5297#endif
5298
5299yyerrhandle:
5300
5301 yyn = yypact[yystate];
5302 if (yyn == YYFLAG)
5303 goto yyerrdefault;
5304
5305 yyn += YYTERROR;
5306 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
5307 goto yyerrdefault;
5308
5309 yyn = yytable[yyn];
5310 if (yyn < 0)
5311 {
5312 if (yyn == YYFLAG)
5313 goto yyerrpop;
5314 yyn = -yyn;
5315 goto yyreduce;
5316 }
5317 else if (yyn == 0)
5318 goto yyerrpop;
5319
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005320 if (yyn == YYFINAL)
5321 YYACCEPT;
5322
Dale Johannesen3afee192007-09-07 21:07:57 +00005323#if YYDEBUG != 0
5324 if (yydebug)
5325 fprintf(stderr, "Shifting error token, ");
5326#endif
Chris Lattnerbb856a32007-08-06 21:00:46 +00005327
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005328 *++yyvsp = yylval;
Dale Johannesen3afee192007-09-07 21:07:57 +00005329#ifdef YYLSP_NEEDED
5330 *++yylsp = yylloc;
5331#endif
Reid Spenceraa8ae282007-07-31 03:50:36 +00005332
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005333 yystate = yyn;
5334 goto yynewstate;
5335
Dale Johannesen3afee192007-09-07 21:07:57 +00005336 yyacceptlab:
5337 /* YYACCEPT comes here. */
5338 if (yyfree_stacks)
5339 {
5340 free (yyss);
5341 free (yyvs);
5342#ifdef YYLSP_NEEDED
5343 free (yyls);
Chandler Carruth563d4a42007-08-04 01:56:21 +00005344#endif
Dale Johannesen3afee192007-09-07 21:07:57 +00005345 }
5346 return 0;
David Greene48556392007-09-04 18:46:50 +00005347
Dale Johannesen3afee192007-09-07 21:07:57 +00005348 yyabortlab:
5349 /* YYABORT comes here. */
5350 if (yyfree_stacks)
5351 {
5352 free (yyss);
5353 free (yyvs);
5354#ifdef YYLSP_NEEDED
5355 free (yyls);
David Greene48556392007-09-04 18:46:50 +00005356#endif
Dale Johannesen3afee192007-09-07 21:07:57 +00005357 }
5358 return 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005359}
Dale Johannesencfb19e62007-11-05 21:20:28 +00005360#line 3121 "/Volumes/MacOS9/gcc/llvm-gcc-main/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005361
5362
5363// common code from the two 'RunVMAsmParser' functions
5364static Module* RunParser(Module * M) {
5365
5366 llvmAsmlineno = 1; // Reset the current line number...
5367 CurModule.CurrentModule = M;
5368#if YYDEBUG
5369 yydebug = Debug;
5370#endif
5371
5372 // Check to make sure the parser succeeded
5373 if (yyparse()) {
5374 if (ParserResult)
5375 delete ParserResult;
5376 return 0;
5377 }
5378
5379 // Emit an error if there are any unresolved types left.
5380 if (!CurModule.LateResolveTypes.empty()) {
5381 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
5382 if (DID.Type == ValID::LocalName) {
5383 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
5384 } else {
5385 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
5386 }
5387 if (ParserResult)
5388 delete ParserResult;
5389 return 0;
5390 }
5391
5392 // Emit an error if there are any unresolved values left.
5393 if (!CurModule.LateResolveValues.empty()) {
5394 Value *V = CurModule.LateResolveValues.back();
5395 std::map<Value*, std::pair<ValID, int> >::iterator I =
5396 CurModule.PlaceHolderInfo.find(V);
5397
5398 if (I != CurModule.PlaceHolderInfo.end()) {
5399 ValID &DID = I->second.first;
5400 if (DID.Type == ValID::LocalName) {
5401 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
5402 } else {
5403 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
5404 }
5405 if (ParserResult)
5406 delete ParserResult;
5407 return 0;
5408 }
5409 }
5410
5411 // Check to make sure that parsing produced a result
5412 if (!ParserResult)
5413 return 0;
5414
5415 // Reset ParserResult variable while saving its value for the result.
5416 Module *Result = ParserResult;
5417 ParserResult = 0;
5418
5419 return Result;
5420}
5421
5422void llvm::GenerateError(const std::string &message, int LineNo) {
5423 if (LineNo == -1) LineNo = llvmAsmlineno;
5424 // TODO: column number in exception
5425 if (TheParseError)
5426 TheParseError->setError(CurFilename, message, LineNo);
5427 TriggerError = 1;
5428}
5429
5430int yyerror(const char *ErrorMsg) {
5431 std::string where
5432 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5433 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5434 std::string errMsg = where + "error: " + std::string(ErrorMsg);
5435 if (yychar != YYEMPTY && yychar != 0)
5436 errMsg += " while reading token: '" + std::string(llvmAsmtext, llvmAsmleng)+
5437 "'";
5438 GenerateError(errMsg);
5439 return 0;
5440}