Regenerate.
[oota-llvm.git] / lib / AsmParser / llvmAsmParser.cpp.cvs
1 /* A Bison parser, made by GNU Bison 2.1.  */
2
3 /* Skeleton parser for Yacc-like parsing with Bison,
4    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2, or (at your option)
9    any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 51 Franklin Street, Fifth Floor,
19    Boston, MA 02110-1301, USA.  */
20
21 /* As a special exception, when this file is copied by Bison into a
22    Bison output file, you may use that output file without restriction.
23    This special exception was added by the Free Software Foundation
24    in version 1.24 of Bison.  */
25
26 /* Written by Richard Stallman by simplifying the original so called
27    ``semantic'' parser.  */
28
29 /* All symbols defined below should begin with yy or YY, to avoid
30    infringing on user name space.  This should be done even for local
31    variables, as they might otherwise be expanded by user macros.
32    There are some unavoidable exceptions within include files to
33    define necessary library symbols; they are noted "INFRINGES ON
34    USER NAME SPACE" below.  */
35
36 /* Identify Bison output.  */
37 #define YYBISON 1
38
39 /* Bison version.  */
40 #define YYBISON_VERSION "2.1"
41
42 /* Skeleton name.  */
43 #define YYSKELETON_NAME "yacc.c"
44
45 /* Pure parsers.  */
46 #define YYPURE 0
47
48 /* Using locations.  */
49 #define YYLSP_NEEDED 0
50
51 /* Substitute the variable and function names.  */
52 #define yyparse llvmAsmparse
53 #define yylex   llvmAsmlex
54 #define yyerror llvmAsmerror
55 #define yylval  llvmAsmlval
56 #define yychar  llvmAsmchar
57 #define yydebug llvmAsmdebug
58 #define yynerrs llvmAsmnerrs
59
60
61 /* Tokens.  */
62 #ifndef YYTOKENTYPE
63 # define YYTOKENTYPE
64    /* Put the tokens into the symbol table, so that GDB and other debuggers
65       know about them.  */
66    enum yytokentype {
67      ESINT64VAL = 258,
68      EUINT64VAL = 259,
69      SINTVAL = 260,
70      UINTVAL = 261,
71      FPVAL = 262,
72      VOID = 263,
73      BOOL = 264,
74      SBYTE = 265,
75      UBYTE = 266,
76      SHORT = 267,
77      USHORT = 268,
78      INT = 269,
79      UINT = 270,
80      LONG = 271,
81      ULONG = 272,
82      FLOAT = 273,
83      DOUBLE = 274,
84      TYPE = 275,
85      LABEL = 276,
86      VAR_ID = 277,
87      LABELSTR = 278,
88      STRINGCONSTANT = 279,
89      IMPLEMENTATION = 280,
90      ZEROINITIALIZER = 281,
91      TRUETOK = 282,
92      FALSETOK = 283,
93      BEGINTOK = 284,
94      ENDTOK = 285,
95      DECLARE = 286,
96      GLOBAL = 287,
97      CONSTANT = 288,
98      SECTION = 289,
99      VOLATILE = 290,
100      TO = 291,
101      DOTDOTDOT = 292,
102      NULL_TOK = 293,
103      UNDEF = 294,
104      CONST = 295,
105      INTERNAL = 296,
106      LINKONCE = 297,
107      WEAK = 298,
108      APPENDING = 299,
109      DLLIMPORT = 300,
110      DLLEXPORT = 301,
111      EXTERN_WEAK = 302,
112      OPAQUE = 303,
113      NOT = 304,
114      EXTERNAL = 305,
115      TARGET = 306,
116      TRIPLE = 307,
117      ENDIAN = 308,
118      POINTERSIZE = 309,
119      LITTLE = 310,
120      BIG = 311,
121      ALIGN = 312,
122      DEPLIBS = 313,
123      CALL = 314,
124      TAIL = 315,
125      ASM_TOK = 316,
126      MODULE = 317,
127      SIDEEFFECT = 318,
128      CC_TOK = 319,
129      CCC_TOK = 320,
130      CSRETCC_TOK = 321,
131      FASTCC_TOK = 322,
132      COLDCC_TOK = 323,
133      X86_STDCALLCC_TOK = 324,
134      X86_FASTCALLCC_TOK = 325,
135      DATALAYOUT = 326,
136      RET = 327,
137      BR = 328,
138      SWITCH = 329,
139      INVOKE = 330,
140      UNWIND = 331,
141      UNREACHABLE = 332,
142      ADD = 333,
143      SUB = 334,
144      MUL = 335,
145      UDIV = 336,
146      SDIV = 337,
147      FDIV = 338,
148      UREM = 339,
149      SREM = 340,
150      FREM = 341,
151      AND = 342,
152      OR = 343,
153      XOR = 344,
154      SETLE = 345,
155      SETGE = 346,
156      SETLT = 347,
157      SETGT = 348,
158      SETEQ = 349,
159      SETNE = 350,
160      ICMP = 351,
161      FCMP = 352,
162      EQ = 353,
163      NE = 354,
164      SLT = 355,
165      SGT = 356,
166      SLE = 357,
167      SGE = 358,
168      ULT = 359,
169      UGT = 360,
170      ULE = 361,
171      UGE = 362,
172      OEQ = 363,
173      ONE = 364,
174      OLT = 365,
175      OGT = 366,
176      OLE = 367,
177      OGE = 368,
178      ORD = 369,
179      UNO = 370,
180      UEQ = 371,
181      UNE = 372,
182      MALLOC = 373,
183      ALLOCA = 374,
184      FREE = 375,
185      LOAD = 376,
186      STORE = 377,
187      GETELEMENTPTR = 378,
188      TRUNC = 379,
189      ZEXT = 380,
190      SEXT = 381,
191      FPTRUNC = 382,
192      FPEXT = 383,
193      BITCAST = 384,
194      UITOFP = 385,
195      SITOFP = 386,
196      FPTOUI = 387,
197      FPTOSI = 388,
198      INTTOPTR = 389,
199      PTRTOINT = 390,
200      PHI_TOK = 391,
201      SELECT = 392,
202      SHL = 393,
203      LSHR = 394,
204      ASHR = 395,
205      VAARG = 396,
206      EXTRACTELEMENT = 397,
207      INSERTELEMENT = 398,
208      SHUFFLEVECTOR = 399,
209      VAARG_old = 400,
210      VANEXT_old = 401
211    };
212 #endif
213 /* Tokens.  */
214 #define ESINT64VAL 258
215 #define EUINT64VAL 259
216 #define SINTVAL 260
217 #define UINTVAL 261
218 #define FPVAL 262
219 #define VOID 263
220 #define BOOL 264
221 #define SBYTE 265
222 #define UBYTE 266
223 #define SHORT 267
224 #define USHORT 268
225 #define INT 269
226 #define UINT 270
227 #define LONG 271
228 #define ULONG 272
229 #define FLOAT 273
230 #define DOUBLE 274
231 #define TYPE 275
232 #define LABEL 276
233 #define VAR_ID 277
234 #define LABELSTR 278
235 #define STRINGCONSTANT 279
236 #define IMPLEMENTATION 280
237 #define ZEROINITIALIZER 281
238 #define TRUETOK 282
239 #define FALSETOK 283
240 #define BEGINTOK 284
241 #define ENDTOK 285
242 #define DECLARE 286
243 #define GLOBAL 287
244 #define CONSTANT 288
245 #define SECTION 289
246 #define VOLATILE 290
247 #define TO 291
248 #define DOTDOTDOT 292
249 #define NULL_TOK 293
250 #define UNDEF 294
251 #define CONST 295
252 #define INTERNAL 296
253 #define LINKONCE 297
254 #define WEAK 298
255 #define APPENDING 299
256 #define DLLIMPORT 300
257 #define DLLEXPORT 301
258 #define EXTERN_WEAK 302
259 #define OPAQUE 303
260 #define NOT 304
261 #define EXTERNAL 305
262 #define TARGET 306
263 #define TRIPLE 307
264 #define ENDIAN 308
265 #define POINTERSIZE 309
266 #define LITTLE 310
267 #define BIG 311
268 #define ALIGN 312
269 #define DEPLIBS 313
270 #define CALL 314
271 #define TAIL 315
272 #define ASM_TOK 316
273 #define MODULE 317
274 #define SIDEEFFECT 318
275 #define CC_TOK 319
276 #define CCC_TOK 320
277 #define CSRETCC_TOK 321
278 #define FASTCC_TOK 322
279 #define COLDCC_TOK 323
280 #define X86_STDCALLCC_TOK 324
281 #define X86_FASTCALLCC_TOK 325
282 #define DATALAYOUT 326
283 #define RET 327
284 #define BR 328
285 #define SWITCH 329
286 #define INVOKE 330
287 #define UNWIND 331
288 #define UNREACHABLE 332
289 #define ADD 333
290 #define SUB 334
291 #define MUL 335
292 #define UDIV 336
293 #define SDIV 337
294 #define FDIV 338
295 #define UREM 339
296 #define SREM 340
297 #define FREM 341
298 #define AND 342
299 #define OR 343
300 #define XOR 344
301 #define SETLE 345
302 #define SETGE 346
303 #define SETLT 347
304 #define SETGT 348
305 #define SETEQ 349
306 #define SETNE 350
307 #define ICMP 351
308 #define FCMP 352
309 #define EQ 353
310 #define NE 354
311 #define SLT 355
312 #define SGT 356
313 #define SLE 357
314 #define SGE 358
315 #define ULT 359
316 #define UGT 360
317 #define ULE 361
318 #define UGE 362
319 #define OEQ 363
320 #define ONE 364
321 #define OLT 365
322 #define OGT 366
323 #define OLE 367
324 #define OGE 368
325 #define ORD 369
326 #define UNO 370
327 #define UEQ 371
328 #define UNE 372
329 #define MALLOC 373
330 #define ALLOCA 374
331 #define FREE 375
332 #define LOAD 376
333 #define STORE 377
334 #define GETELEMENTPTR 378
335 #define TRUNC 379
336 #define ZEXT 380
337 #define SEXT 381
338 #define FPTRUNC 382
339 #define FPEXT 383
340 #define BITCAST 384
341 #define UITOFP 385
342 #define SITOFP 386
343 #define FPTOUI 387
344 #define FPTOSI 388
345 #define INTTOPTR 389
346 #define PTRTOINT 390
347 #define PHI_TOK 391
348 #define SELECT 392
349 #define SHL 393
350 #define LSHR 394
351 #define ASHR 395
352 #define VAARG 396
353 #define EXTRACTELEMENT 397
354 #define INSERTELEMENT 398
355 #define SHUFFLEVECTOR 399
356 #define VAARG_old 400
357 #define VANEXT_old 401
358
359
360
361
362 /* Copy the first part of user declarations.  */
363 #line 14 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
364
365 #include "ParserInternals.h"
366 #include "llvm/CallingConv.h"
367 #include "llvm/InlineAsm.h"
368 #include "llvm/Instructions.h"
369 #include "llvm/Module.h"
370 #include "llvm/SymbolTable.h"
371 #include "llvm/Support/GetElementPtrTypeIterator.h"
372 #include "llvm/ADT/STLExtras.h"
373 #include "llvm/Support/MathExtras.h"
374 #include "llvm/Support/Streams.h"
375 #include <algorithm>
376 #include <list>
377 #include <utility>
378
379 // The following is a gross hack. In order to rid the libAsmParser library of
380 // exceptions, we have to have a way of getting the yyparse function to go into
381 // an error situation. So, whenever we want an error to occur, the GenerateError
382 // function (see bottom of file) sets TriggerError. Then, at the end of each 
383 // production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR 
384 // (a goto) to put YACC in error state. Furthermore, several calls to 
385 // GenerateError are made from inside productions and they must simulate the
386 // previous exception behavior by exiting the production immediately. We have
387 // replaced these with the GEN_ERROR macro which calls GeneratError and then
388 // immediately invokes YYERROR. This would be so much cleaner if it was a 
389 // recursive descent parser.
390 static bool TriggerError = false;
391 #define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
392 #define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
393
394 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
395 int yylex();                       // declaration" of xxx warnings.
396 int yyparse();
397
398 namespace llvm {
399   std::string CurFilename;
400 }
401 using namespace llvm;
402
403 static Module *ParserResult;
404
405 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
406 // relating to upreferences in the input stream.
407 //
408 //#define DEBUG_UPREFS 1
409 #ifdef DEBUG_UPREFS
410 #define UR_OUT(X) llvm_cerr << X
411 #else
412 #define UR_OUT(X)
413 #endif
414
415 #define YYERROR_VERBOSE 1
416
417 static bool ObsoleteVarArgs;
418 static bool NewVarArgs;
419 static BasicBlock *CurBB;
420 static GlobalVariable *CurGV;
421
422
423 // This contains info used when building the body of a function.  It is
424 // destroyed when the function is completed.
425 //
426 typedef std::vector<Value *> ValueList;           // Numbered defs
427 static void 
428 ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers,
429                    std::map<const Type *,ValueList> *FutureLateResolvers = 0);
430
431 static struct PerModuleInfo {
432   Module *CurrentModule;
433   std::map<const Type *, ValueList> Values; // Module level numbered definitions
434   std::map<const Type *,ValueList> LateResolveValues;
435   std::vector<PATypeHolder>    Types;
436   std::map<ValID, PATypeHolder> LateResolveTypes;
437
438   /// PlaceHolderInfo - When temporary placeholder objects are created, remember
439   /// how they were referenced and on which line of the input they came from so
440   /// that we can resolve them later and print error messages as appropriate.
441   std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
442
443   // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
444   // references to global values.  Global values may be referenced before they
445   // are defined, and if so, the temporary object that they represent is held
446   // here.  This is used for forward references of GlobalValues.
447   //
448   typedef std::map<std::pair<const PointerType *,
449                              ValID>, GlobalValue*> GlobalRefsType;
450   GlobalRefsType GlobalRefs;
451
452   void ModuleDone() {
453     // If we could not resolve some functions at function compilation time
454     // (calls to functions before they are defined), resolve them now...  Types
455     // are resolved when the constant pool has been completely parsed.
456     //
457     ResolveDefinitions(LateResolveValues);
458     if (TriggerError)
459       return;
460
461     // Check to make sure that all global value forward references have been
462     // resolved!
463     //
464     if (!GlobalRefs.empty()) {
465       std::string UndefinedReferences = "Unresolved global references exist:\n";
466
467       for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
468            I != E; ++I) {
469         UndefinedReferences += "  " + I->first.first->getDescription() + " " +
470                                I->first.second.getName() + "\n";
471       }
472       GenerateError(UndefinedReferences);
473       return;
474     }
475
476     Values.clear();         // Clear out function local definitions
477     Types.clear();
478     CurrentModule = 0;
479   }
480
481   // GetForwardRefForGlobal - Check to see if there is a forward reference
482   // for this global.  If so, remove it from the GlobalRefs map and return it.
483   // If not, just return null.
484   GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
485     // Check to see if there is a forward reference to this global variable...
486     // if there is, eliminate it and patch the reference to use the new def'n.
487     GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
488     GlobalValue *Ret = 0;
489     if (I != GlobalRefs.end()) {
490       Ret = I->second;
491       GlobalRefs.erase(I);
492     }
493     return Ret;
494   }
495 } CurModule;
496
497 static struct PerFunctionInfo {
498   Function *CurrentFunction;     // Pointer to current function being created
499
500   std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
501   std::map<const Type*, ValueList> LateResolveValues;
502   bool isDeclare;                    // Is this function a forward declararation?
503   GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
504
505   /// BBForwardRefs - When we see forward references to basic blocks, keep
506   /// track of them here.
507   std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs;
508   std::vector<BasicBlock*> NumberedBlocks;
509   unsigned NextBBNum;
510
511   inline PerFunctionInfo() {
512     CurrentFunction = 0;
513     isDeclare = false;
514     Linkage = GlobalValue::ExternalLinkage;    
515   }
516
517   inline void FunctionStart(Function *M) {
518     CurrentFunction = M;
519     NextBBNum = 0;
520   }
521
522   void FunctionDone() {
523     NumberedBlocks.clear();
524
525     // Any forward referenced blocks left?
526     if (!BBForwardRefs.empty()) {
527       GenerateError("Undefined reference to label " +
528                      BBForwardRefs.begin()->first->getName());
529       return;
530     }
531
532     // Resolve all forward references now.
533     ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
534
535     Values.clear();         // Clear out function local definitions
536     CurrentFunction = 0;
537     isDeclare = false;
538     Linkage = GlobalValue::ExternalLinkage;
539   }
540 } CurFun;  // Info for the current function...
541
542 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
543
544
545 //===----------------------------------------------------------------------===//
546 //               Code to handle definitions of all the types
547 //===----------------------------------------------------------------------===//
548
549 static int InsertValue(Value *V,
550                   std::map<const Type*,ValueList> &ValueTab = CurFun.Values) {
551   if (V->hasName()) return -1;           // Is this a numbered definition?
552
553   // Yes, insert the value into the value table...
554   ValueList &List = ValueTab[V->getType()];
555   List.push_back(V);
556   return List.size()-1;
557 }
558
559 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
560   switch (D.Type) {
561   case ValID::NumberVal:               // Is it a numbered definition?
562     // Module constants occupy the lowest numbered slots...
563     if ((unsigned)D.Num < CurModule.Types.size())
564       return CurModule.Types[(unsigned)D.Num];
565     break;
566   case ValID::NameVal:                 // Is it a named definition?
567     if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
568       D.destroy();  // Free old strdup'd memory...
569       return N;
570     }
571     break;
572   default:
573     GenerateError("Internal parser error: Invalid symbol type reference!");
574     return 0;
575   }
576
577   // If we reached here, we referenced either a symbol that we don't know about
578   // or an id number that hasn't been read yet.  We may be referencing something
579   // forward, so just create an entry to be resolved later and get to it...
580   //
581   if (DoNotImprovise) return 0;  // Do we just want a null to be returned?
582
583
584   if (inFunctionScope()) {
585     if (D.Type == ValID::NameVal) {
586       GenerateError("Reference to an undefined type: '" + D.getName() + "'");
587       return 0;
588     } else {
589       GenerateError("Reference to an undefined type: #" + itostr(D.Num));
590       return 0;
591     }
592   }
593
594   std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
595   if (I != CurModule.LateResolveTypes.end())
596     return I->second;
597
598   Type *Typ = OpaqueType::get();
599   CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
600   return Typ;
601  }
602
603 static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) {
604   SymbolTable &SymTab =
605     inFunctionScope() ? CurFun.CurrentFunction->getSymbolTable() :
606                         CurModule.CurrentModule->getSymbolTable();
607   return SymTab.lookup(Ty, Name);
608 }
609
610 // getValNonImprovising - Look up the value specified by the provided type and
611 // the provided ValID.  If the value exists and has already been defined, return
612 // it.  Otherwise return null.
613 //
614 static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
615   if (isa<FunctionType>(Ty)) {
616     GenerateError("Functions are not values and "
617                    "must be referenced as pointers");
618     return 0;
619   }
620
621   switch (D.Type) {
622   case ValID::NumberVal: {                 // Is it a numbered definition?
623     unsigned Num = (unsigned)D.Num;
624
625     // Module constants occupy the lowest numbered slots...
626     std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
627     if (VI != CurModule.Values.end()) {
628       if (Num < VI->second.size())
629         return VI->second[Num];
630       Num -= VI->second.size();
631     }
632
633     // Make sure that our type is within bounds
634     VI = CurFun.Values.find(Ty);
635     if (VI == CurFun.Values.end()) return 0;
636
637     // Check that the number is within bounds...
638     if (VI->second.size() <= Num) return 0;
639
640     return VI->second[Num];
641   }
642
643   case ValID::NameVal: {                // Is it a named definition?
644     Value *N = lookupInSymbolTable(Ty, std::string(D.Name));
645     if (N == 0) return 0;
646
647     D.destroy();  // Free old strdup'd memory...
648     return N;
649   }
650
651   // Check to make sure that "Ty" is an integral type, and that our
652   // value will fit into the specified type...
653   case ValID::ConstSIntVal:    // Is it a constant pool reference??
654     if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
655       GenerateError("Signed integral constant '" +
656                      itostr(D.ConstPool64) + "' is invalid for type '" +
657                      Ty->getDescription() + "'!");
658       return 0;
659     }
660     return ConstantInt::get(Ty, D.ConstPool64);
661
662   case ValID::ConstUIntVal:     // Is it an unsigned const pool reference?
663     if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
664       if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
665         GenerateError("Integral constant '" + utostr(D.UConstPool64) +
666                        "' is invalid or out of range!");
667         return 0;
668       } else {     // This is really a signed reference.  Transmogrify.
669         return ConstantInt::get(Ty, D.ConstPool64);
670       }
671     } else {
672       return ConstantInt::get(Ty, D.UConstPool64);
673     }
674
675   case ValID::ConstFPVal:        // Is it a floating point const pool reference?
676     if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
677       GenerateError("FP constant invalid for type!!");
678       return 0;
679     }
680     return ConstantFP::get(Ty, D.ConstPoolFP);
681
682   case ValID::ConstNullVal:      // Is it a null value?
683     if (!isa<PointerType>(Ty)) {
684       GenerateError("Cannot create a a non pointer null!");
685       return 0;
686     }
687     return ConstantPointerNull::get(cast<PointerType>(Ty));
688
689   case ValID::ConstUndefVal:      // Is it an undef value?
690     return UndefValue::get(Ty);
691
692   case ValID::ConstZeroVal:      // Is it a zero value?
693     return Constant::getNullValue(Ty);
694     
695   case ValID::ConstantVal:       // Fully resolved constant?
696     if (D.ConstantValue->getType() != Ty) {
697       GenerateError("Constant expression type different from required type!");
698       return 0;
699     }
700     return D.ConstantValue;
701
702   case ValID::InlineAsmVal: {    // Inline asm expression
703     const PointerType *PTy = dyn_cast<PointerType>(Ty);
704     const FunctionType *FTy =
705       PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
706     if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
707       GenerateError("Invalid type for asm constraint string!");
708       return 0;
709     }
710     InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
711                                    D.IAD->HasSideEffects);
712     D.destroy();   // Free InlineAsmDescriptor.
713     return IA;
714   }
715   default:
716     assert(0 && "Unhandled case!");
717     return 0;
718   }   // End of switch
719
720   assert(0 && "Unhandled case!");
721   return 0;
722 }
723
724 // getVal - This function is identical to getValNonImprovising, except that if a
725 // value is not already defined, it "improvises" by creating a placeholder var
726 // that looks and acts just like the requested variable.  When the value is
727 // defined later, all uses of the placeholder variable are replaced with the
728 // real thing.
729 //
730 static Value *getVal(const Type *Ty, const ValID &ID) {
731   if (Ty == Type::LabelTy) {
732     GenerateError("Cannot use a basic block here");
733     return 0;
734   }
735
736   // See if the value has already been defined.
737   Value *V = getValNonImprovising(Ty, ID);
738   if (V) return V;
739   if (TriggerError) return 0;
740
741   if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
742     GenerateError("Invalid use of a composite type!");
743     return 0;
744   }
745
746   // If we reached here, we referenced either a symbol that we don't know about
747   // or an id number that hasn't been read yet.  We may be referencing something
748   // forward, so just create an entry to be resolved later and get to it...
749   //
750   V = new Argument(Ty);
751
752   // Remember where this forward reference came from.  FIXME, shouldn't we try
753   // to recycle these things??
754   CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
755                                                                llvmAsmlineno)));
756
757   if (inFunctionScope())
758     InsertValue(V, CurFun.LateResolveValues);
759   else
760     InsertValue(V, CurModule.LateResolveValues);
761   return V;
762 }
763
764 /// getBBVal - This is used for two purposes:
765 ///  * If isDefinition is true, a new basic block with the specified ID is being
766 ///    defined.
767 ///  * If isDefinition is true, this is a reference to a basic block, which may
768 ///    or may not be a forward reference.
769 ///
770 static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
771   assert(inFunctionScope() && "Can't get basic block at global scope!");
772
773   std::string Name;
774   BasicBlock *BB = 0;
775   switch (ID.Type) {
776   default: 
777     GenerateError("Illegal label reference " + ID.getName());
778     return 0;
779   case ValID::NumberVal:                // Is it a numbered definition?
780     if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size())
781       CurFun.NumberedBlocks.resize(ID.Num+1);
782     BB = CurFun.NumberedBlocks[ID.Num];
783     break;
784   case ValID::NameVal:                  // Is it a named definition?
785     Name = ID.Name;
786     if (Value *N = CurFun.CurrentFunction->
787                    getSymbolTable().lookup(Type::LabelTy, Name))
788       BB = cast<BasicBlock>(N);
789     break;
790   }
791
792   // See if the block has already been defined.
793   if (BB) {
794     // If this is the definition of the block, make sure the existing value was
795     // just a forward reference.  If it was a forward reference, there will be
796     // an entry for it in the PlaceHolderInfo map.
797     if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) {
798       // The existing value was a definition, not a forward reference.
799       GenerateError("Redefinition of label " + ID.getName());
800       return 0;
801     }
802
803     ID.destroy();                       // Free strdup'd memory.
804     return BB;
805   }
806
807   // Otherwise this block has not been seen before.
808   BB = new BasicBlock("", CurFun.CurrentFunction);
809   if (ID.Type == ValID::NameVal) {
810     BB->setName(ID.Name);
811   } else {
812     CurFun.NumberedBlocks[ID.Num] = BB;
813   }
814
815   // If this is not a definition, keep track of it so we can use it as a forward
816   // reference.
817   if (!isDefinition) {
818     // Remember where this forward reference came from.
819     CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno);
820   } else {
821     // The forward declaration could have been inserted anywhere in the
822     // function: insert it into the correct place now.
823     CurFun.CurrentFunction->getBasicBlockList().remove(BB);
824     CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
825   }
826   ID.destroy();
827   return BB;
828 }
829
830
831 //===----------------------------------------------------------------------===//
832 //              Code to handle forward references in instructions
833 //===----------------------------------------------------------------------===//
834 //
835 // This code handles the late binding needed with statements that reference
836 // values not defined yet... for example, a forward branch, or the PHI node for
837 // a loop body.
838 //
839 // This keeps a table (CurFun.LateResolveValues) of all such forward references
840 // and back patchs after we are done.
841 //
842
843 // ResolveDefinitions - If we could not resolve some defs at parsing
844 // time (forward branches, phi functions for loops, etc...) resolve the
845 // defs now...
846 //
847 static void 
848 ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
849                    std::map<const Type*,ValueList> *FutureLateResolvers) {
850   // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
851   for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(),
852          E = LateResolvers.end(); LRI != E; ++LRI) {
853     ValueList &List = LRI->second;
854     while (!List.empty()) {
855       Value *V = List.back();
856       List.pop_back();
857
858       std::map<Value*, std::pair<ValID, int> >::iterator PHI =
859         CurModule.PlaceHolderInfo.find(V);
860       assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
861
862       ValID &DID = PHI->second.first;
863
864       Value *TheRealValue = getValNonImprovising(LRI->first, DID);
865       if (TriggerError)
866         return;
867       if (TheRealValue) {
868         V->replaceAllUsesWith(TheRealValue);
869         delete V;
870         CurModule.PlaceHolderInfo.erase(PHI);
871       } else if (FutureLateResolvers) {
872         // Functions have their unresolved items forwarded to the module late
873         // resolver table
874         InsertValue(V, *FutureLateResolvers);
875       } else {
876         if (DID.Type == ValID::NameVal) {
877           GenerateError("Reference to an invalid definition: '" +DID.getName()+
878                          "' of type '" + V->getType()->getDescription() + "'",
879                          PHI->second.second);
880           return;
881         } else {
882           GenerateError("Reference to an invalid definition: #" +
883                          itostr(DID.Num) + " of type '" +
884                          V->getType()->getDescription() + "'",
885                          PHI->second.second);
886           return;
887         }
888       }
889     }
890   }
891
892   LateResolvers.clear();
893 }
894
895 // ResolveTypeTo - A brand new type was just declared.  This means that (if
896 // name is not null) things referencing Name can be resolved.  Otherwise, things
897 // refering to the number can be resolved.  Do this now.
898 //
899 static void ResolveTypeTo(char *Name, const Type *ToTy) {
900   ValID D;
901   if (Name) D = ValID::create(Name);
902   else      D = ValID::create((int)CurModule.Types.size());
903
904   std::map<ValID, PATypeHolder>::iterator I =
905     CurModule.LateResolveTypes.find(D);
906   if (I != CurModule.LateResolveTypes.end()) {
907     ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
908     CurModule.LateResolveTypes.erase(I);
909   }
910 }
911
912 // setValueName - Set the specified value to the name given.  The name may be
913 // null potentially, in which case this is a noop.  The string passed in is
914 // assumed to be a malloc'd string buffer, and is free'd by this function.
915 //
916 static void setValueName(Value *V, char *NameStr) {
917   if (NameStr) {
918     std::string Name(NameStr);      // Copy string
919     free(NameStr);                  // Free old string
920
921     if (V->getType() == Type::VoidTy) {
922       GenerateError("Can't assign name '" + Name+"' to value with void type!");
923       return;
924     }
925
926     assert(inFunctionScope() && "Must be in function scope!");
927     SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable();
928     if (ST.lookup(V->getType(), Name)) {
929       GenerateError("Redefinition of value named '" + Name + "' in the '" +
930                      V->getType()->getDescription() + "' type plane!");
931       return;
932     }
933
934     // Set the name.
935     V->setName(Name);
936   }
937 }
938
939 /// ParseGlobalVariable - Handle parsing of a global.  If Initializer is null,
940 /// this is a declaration, otherwise it is a definition.
941 static GlobalVariable *
942 ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage,
943                     bool isConstantGlobal, const Type *Ty,
944                     Constant *Initializer) {
945   if (isa<FunctionType>(Ty)) {
946     GenerateError("Cannot declare global vars of function type!");
947     return 0;
948   }
949
950   const PointerType *PTy = PointerType::get(Ty);
951
952   std::string Name;
953   if (NameStr) {
954     Name = NameStr;      // Copy string
955     free(NameStr);       // Free old string
956   }
957
958   // See if this global value was forward referenced.  If so, recycle the
959   // object.
960   ValID ID;
961   if (!Name.empty()) {
962     ID = ValID::create((char*)Name.c_str());
963   } else {
964     ID = ValID::create((int)CurModule.Values[PTy].size());
965   }
966
967   if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
968     // Move the global to the end of the list, from whereever it was
969     // previously inserted.
970     GlobalVariable *GV = cast<GlobalVariable>(FWGV);
971     CurModule.CurrentModule->getGlobalList().remove(GV);
972     CurModule.CurrentModule->getGlobalList().push_back(GV);
973     GV->setInitializer(Initializer);
974     GV->setLinkage(Linkage);
975     GV->setConstant(isConstantGlobal);
976     InsertValue(GV, CurModule.Values);
977     return GV;
978   }
979
980   // If this global has a name, check to see if there is already a definition
981   // of this global in the module.  If so, merge as appropriate.  Note that
982   // this is really just a hack around problems in the CFE.  :(
983   if (!Name.empty()) {
984     // We are a simple redefinition of a value, check to see if it is defined
985     // the same as the old one.
986     if (GlobalVariable *EGV =
987                 CurModule.CurrentModule->getGlobalVariable(Name, Ty)) {
988       // We are allowed to redefine a global variable in two circumstances:
989       // 1. If at least one of the globals is uninitialized or
990       // 2. If both initializers have the same value.
991       //
992       if (!EGV->hasInitializer() || !Initializer ||
993           EGV->getInitializer() == Initializer) {
994
995         // Make sure the existing global version gets the initializer!  Make
996         // sure that it also gets marked const if the new version is.
997         if (Initializer && !EGV->hasInitializer())
998           EGV->setInitializer(Initializer);
999         if (isConstantGlobal)
1000           EGV->setConstant(true);
1001         EGV->setLinkage(Linkage);
1002         return EGV;
1003       }
1004
1005       GenerateError("Redefinition of global variable named '" + Name +
1006                      "' in the '" + Ty->getDescription() + "' type plane!");
1007       return 0;
1008     }
1009   }
1010
1011   // Otherwise there is no existing GV to use, create one now.
1012   GlobalVariable *GV =
1013     new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1014                        CurModule.CurrentModule);
1015   InsertValue(GV, CurModule.Values);
1016   return GV;
1017 }
1018
1019 // setTypeName - Set the specified type to the name given.  The name may be
1020 // null potentially, in which case this is a noop.  The string passed in is
1021 // assumed to be a malloc'd string buffer, and is freed by this function.
1022 //
1023 // This function returns true if the type has already been defined, but is
1024 // allowed to be redefined in the specified context.  If the name is a new name
1025 // for the type plane, it is inserted and false is returned.
1026 static bool setTypeName(const Type *T, char *NameStr) {
1027   assert(!inFunctionScope() && "Can't give types function-local names!");
1028   if (NameStr == 0) return false;
1029  
1030   std::string Name(NameStr);      // Copy string
1031   free(NameStr);                  // Free old string
1032
1033   // We don't allow assigning names to void type
1034   if (T == Type::VoidTy) {
1035     GenerateError("Can't assign name '" + Name + "' to the void type!");
1036     return false;
1037   }
1038
1039   // Set the type name, checking for conflicts as we do so.
1040   bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1041
1042   if (AlreadyExists) {   // Inserting a name that is already defined???
1043     const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1044     assert(Existing && "Conflict but no matching type?");
1045
1046     // There is only one case where this is allowed: when we are refining an
1047     // opaque type.  In this case, Existing will be an opaque type.
1048     if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1049       // We ARE replacing an opaque type!
1050       const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1051       return true;
1052     }
1053
1054     // Otherwise, this is an attempt to redefine a type. That's okay if
1055     // the redefinition is identical to the original. This will be so if
1056     // Existing and T point to the same Type object. In this one case we
1057     // allow the equivalent redefinition.
1058     if (Existing == T) return true;  // Yes, it's equal.
1059
1060     // Any other kind of (non-equivalent) redefinition is an error.
1061     GenerateError("Redefinition of type named '" + Name + "' in the '" +
1062                    T->getDescription() + "' type plane!");
1063   }
1064
1065   return false;
1066 }
1067
1068 //===----------------------------------------------------------------------===//
1069 // Code for handling upreferences in type names...
1070 //
1071
1072 // TypeContains - Returns true if Ty directly contains E in it.
1073 //
1074 static bool TypeContains(const Type *Ty, const Type *E) {
1075   return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1076                    E) != Ty->subtype_end();
1077 }
1078
1079 namespace {
1080   struct UpRefRecord {
1081     // NestingLevel - The number of nesting levels that need to be popped before
1082     // this type is resolved.
1083     unsigned NestingLevel;
1084
1085     // LastContainedTy - This is the type at the current binding level for the
1086     // type.  Every time we reduce the nesting level, this gets updated.
1087     const Type *LastContainedTy;
1088
1089     // UpRefTy - This is the actual opaque type that the upreference is
1090     // represented with.
1091     OpaqueType *UpRefTy;
1092
1093     UpRefRecord(unsigned NL, OpaqueType *URTy)
1094       : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1095   };
1096 }
1097
1098 // UpRefs - A list of the outstanding upreferences that need to be resolved.
1099 static std::vector<UpRefRecord> UpRefs;
1100
1101 /// HandleUpRefs - Every time we finish a new layer of types, this function is
1102 /// called.  It loops through the UpRefs vector, which is a list of the
1103 /// currently active types.  For each type, if the up reference is contained in
1104 /// the newly completed type, we decrement the level count.  When the level
1105 /// count reaches zero, the upreferenced type is the type that is passed in:
1106 /// thus we can complete the cycle.
1107 ///
1108 static PATypeHolder HandleUpRefs(const Type *ty) {
1109   // If Ty isn't abstract, or if there are no up-references in it, then there is
1110   // nothing to resolve here.
1111   if (!ty->isAbstract() || UpRefs.empty()) return ty;
1112   
1113   PATypeHolder Ty(ty);
1114   UR_OUT("Type '" << Ty->getDescription() <<
1115          "' newly formed.  Resolving upreferences.\n" <<
1116          UpRefs.size() << " upreferences active!\n");
1117
1118   // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1119   // to zero), we resolve them all together before we resolve them to Ty.  At
1120   // the end of the loop, if there is anything to resolve to Ty, it will be in
1121   // this variable.
1122   OpaqueType *TypeToResolve = 0;
1123
1124   for (unsigned i = 0; i != UpRefs.size(); ++i) {
1125     UR_OUT("  UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1126            << UpRefs[i].second->getDescription() << ") = "
1127            << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1128     if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1129       // Decrement level of upreference
1130       unsigned Level = --UpRefs[i].NestingLevel;
1131       UpRefs[i].LastContainedTy = Ty;
1132       UR_OUT("  Uplevel Ref Level = " << Level << "\n");
1133       if (Level == 0) {                     // Upreference should be resolved!
1134         if (!TypeToResolve) {
1135           TypeToResolve = UpRefs[i].UpRefTy;
1136         } else {
1137           UR_OUT("  * Resolving upreference for "
1138                  << UpRefs[i].second->getDescription() << "\n";
1139                  std::string OldName = UpRefs[i].UpRefTy->getDescription());
1140           UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1141           UR_OUT("  * Type '" << OldName << "' refined upreference to: "
1142                  << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1143         }
1144         UpRefs.erase(UpRefs.begin()+i);     // Remove from upreference list...
1145         --i;                                // Do not skip the next element...
1146       }
1147     }
1148   }
1149
1150   if (TypeToResolve) {
1151     UR_OUT("  * Resolving upreference for "
1152            << UpRefs[i].second->getDescription() << "\n";
1153            std::string OldName = TypeToResolve->getDescription());
1154     TypeToResolve->refineAbstractTypeTo(Ty);
1155   }
1156
1157   return Ty;
1158 }
1159
1160 // common code from the two 'RunVMAsmParser' functions
1161 static Module* RunParser(Module * M) {
1162
1163   llvmAsmlineno = 1;      // Reset the current line number...
1164   ObsoleteVarArgs = false;
1165   NewVarArgs = false;
1166   CurModule.CurrentModule = M;
1167
1168   // Check to make sure the parser succeeded
1169   if (yyparse()) {
1170     if (ParserResult)
1171       delete ParserResult;
1172     return 0;
1173   }
1174
1175   // Check to make sure that parsing produced a result
1176   if (!ParserResult)
1177     return 0;
1178
1179   // Reset ParserResult variable while saving its value for the result.
1180   Module *Result = ParserResult;
1181   ParserResult = 0;
1182
1183   //Not all functions use vaarg, so make a second check for ObsoleteVarArgs
1184   {
1185     Function* F;
1186     if ((F = Result->getNamedFunction("llvm.va_start"))
1187         && F->getFunctionType()->getNumParams() == 0)
1188       ObsoleteVarArgs = true;
1189     if((F = Result->getNamedFunction("llvm.va_copy"))
1190        && F->getFunctionType()->getNumParams() == 1)
1191       ObsoleteVarArgs = true;
1192   }
1193
1194   if (ObsoleteVarArgs && NewVarArgs) {
1195     GenerateError(
1196       "This file is corrupt: it uses both new and old style varargs");
1197     return 0;
1198   }
1199
1200   if(ObsoleteVarArgs) {
1201     if(Function* F = Result->getNamedFunction("llvm.va_start")) {
1202       if (F->arg_size() != 0) {
1203         GenerateError("Obsolete va_start takes 0 argument!");
1204         return 0;
1205       }
1206       
1207       //foo = va_start()
1208       // ->
1209       //bar = alloca typeof(foo)
1210       //va_start(bar)
1211       //foo = load bar
1212
1213       const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
1214       const Type* ArgTy = F->getFunctionType()->getReturnType();
1215       const Type* ArgTyPtr = PointerType::get(ArgTy);
1216       Function* NF = Result->getOrInsertFunction("llvm.va_start", 
1217                                                  RetTy, ArgTyPtr, (Type *)0);
1218
1219       while (!F->use_empty()) {
1220         CallInst* CI = cast<CallInst>(F->use_back());
1221         AllocaInst* bar = new AllocaInst(ArgTy, 0, "vastart.fix.1", CI);
1222         new CallInst(NF, bar, "", CI);
1223         Value* foo = new LoadInst(bar, "vastart.fix.2", CI);
1224         CI->replaceAllUsesWith(foo);
1225         CI->getParent()->getInstList().erase(CI);
1226       }
1227       Result->getFunctionList().erase(F);
1228     }
1229     
1230     if(Function* F = Result->getNamedFunction("llvm.va_end")) {
1231       if(F->arg_size() != 1) {
1232         GenerateError("Obsolete va_end takes 1 argument!");
1233         return 0;
1234       }
1235
1236       //vaend foo
1237       // ->
1238       //bar = alloca 1 of typeof(foo)
1239       //vaend bar
1240       const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
1241       const Type* ArgTy = F->getFunctionType()->getParamType(0);
1242       const Type* ArgTyPtr = PointerType::get(ArgTy);
1243       Function* NF = Result->getOrInsertFunction("llvm.va_end", 
1244                                                  RetTy, ArgTyPtr, (Type *)0);
1245
1246       while (!F->use_empty()) {
1247         CallInst* CI = cast<CallInst>(F->use_back());
1248         AllocaInst* bar = new AllocaInst(ArgTy, 0, "vaend.fix.1", CI);
1249         new StoreInst(CI->getOperand(1), bar, CI);
1250         new CallInst(NF, bar, "", CI);
1251         CI->getParent()->getInstList().erase(CI);
1252       }
1253       Result->getFunctionList().erase(F);
1254     }
1255
1256     if(Function* F = Result->getNamedFunction("llvm.va_copy")) {
1257       if(F->arg_size() != 1) {
1258         GenerateError("Obsolete va_copy takes 1 argument!");
1259         return 0;
1260       }
1261       //foo = vacopy(bar)
1262       // ->
1263       //a = alloca 1 of typeof(foo)
1264       //b = alloca 1 of typeof(foo)
1265       //store bar -> b
1266       //vacopy(a, b)
1267       //foo = load a
1268       
1269       const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
1270       const Type* ArgTy = F->getFunctionType()->getReturnType();
1271       const Type* ArgTyPtr = PointerType::get(ArgTy);
1272       Function* NF = Result->getOrInsertFunction("llvm.va_copy", 
1273                                                  RetTy, ArgTyPtr, ArgTyPtr,
1274                                                  (Type *)0);
1275
1276       while (!F->use_empty()) {
1277         CallInst* CI = cast<CallInst>(F->use_back());
1278         AllocaInst* a = new AllocaInst(ArgTy, 0, "vacopy.fix.1", CI);
1279         AllocaInst* b = new AllocaInst(ArgTy, 0, "vacopy.fix.2", CI);
1280         new StoreInst(CI->getOperand(1), b, CI);
1281         new CallInst(NF, a, b, "", CI);
1282         Value* foo = new LoadInst(a, "vacopy.fix.3", CI);
1283         CI->replaceAllUsesWith(foo);
1284         CI->getParent()->getInstList().erase(CI);
1285       }
1286       Result->getFunctionList().erase(F);
1287     }
1288   }
1289
1290   return Result;
1291 }
1292
1293 //===----------------------------------------------------------------------===//
1294 //            RunVMAsmParser - Define an interface to this parser
1295 //===----------------------------------------------------------------------===//
1296 //
1297 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1298   set_scan_file(F);
1299
1300   CurFilename = Filename;
1301   return RunParser(new Module(CurFilename));
1302 }
1303
1304 Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1305   set_scan_string(AsmString);
1306
1307   CurFilename = "from_memory";
1308   if (M == NULL) {
1309     return RunParser(new Module (CurFilename));
1310   } else {
1311     return RunParser(M);
1312   }
1313 }
1314
1315
1316
1317 /* Enabling traces.  */
1318 #ifndef YYDEBUG
1319 # define YYDEBUG 0
1320 #endif
1321
1322 /* Enabling verbose error messages.  */
1323 #ifdef YYERROR_VERBOSE
1324 # undef YYERROR_VERBOSE
1325 # define YYERROR_VERBOSE 1
1326 #else
1327 # define YYERROR_VERBOSE 0
1328 #endif
1329
1330 /* Enabling the token table.  */
1331 #ifndef YYTOKEN_TABLE
1332 # define YYTOKEN_TABLE 0
1333 #endif
1334
1335 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1336 #line 967 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
1337 typedef union YYSTYPE {
1338   llvm::Module                           *ModuleVal;
1339   llvm::Function                         *FunctionVal;
1340   std::pair<llvm::PATypeHolder*, char*>  *ArgVal;
1341   llvm::BasicBlock                       *BasicBlockVal;
1342   llvm::TerminatorInst                   *TermInstVal;
1343   llvm::Instruction                      *InstVal;
1344   llvm::Constant                         *ConstVal;
1345
1346   const llvm::Type                       *PrimType;
1347   llvm::PATypeHolder                     *TypeVal;
1348   llvm::Value                            *ValueVal;
1349
1350   std::vector<std::pair<llvm::PATypeHolder*,char*> > *ArgList;
1351   std::vector<llvm::Value*>              *ValueList;
1352   std::list<llvm::PATypeHolder>          *TypeList;
1353   // Represent the RHS of PHI node
1354   std::list<std::pair<llvm::Value*,
1355                       llvm::BasicBlock*> > *PHIList;
1356   std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1357   std::vector<llvm::Constant*>           *ConstVector;
1358
1359   llvm::GlobalValue::LinkageTypes         Linkage;
1360   int64_t                           SInt64Val;
1361   uint64_t                          UInt64Val;
1362   int                               SIntVal;
1363   unsigned                          UIntVal;
1364   double                            FPVal;
1365   bool                              BoolVal;
1366
1367   char                             *StrVal;   // This memory is strdup'd!
1368   llvm::ValID                       ValIDVal; // strdup'd memory maybe!
1369
1370   llvm::Instruction::BinaryOps      BinaryOpVal;
1371   llvm::Instruction::TermOps        TermOpVal;
1372   llvm::Instruction::MemoryOps      MemOpVal;
1373   llvm::Instruction::CastOps        CastOpVal;
1374   llvm::Instruction::OtherOps       OtherOpVal;
1375   llvm::Module::Endianness          Endianness;
1376   llvm::ICmpInst::Predicate         IPredicate;
1377   llvm::FCmpInst::Predicate         FPredicate;
1378 } YYSTYPE;
1379 /* Line 196 of yacc.c.  */
1380 #line 1381 "llvmAsmParser.tab.c"
1381 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
1382 # define YYSTYPE_IS_DECLARED 1
1383 # define YYSTYPE_IS_TRIVIAL 1
1384 #endif
1385
1386
1387
1388 /* Copy the second part of user declarations.  */
1389
1390
1391 /* Line 219 of yacc.c.  */
1392 #line 1393 "llvmAsmParser.tab.c"
1393
1394 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1395 # define YYSIZE_T __SIZE_TYPE__
1396 #endif
1397 #if ! defined (YYSIZE_T) && defined (size_t)
1398 # define YYSIZE_T size_t
1399 #endif
1400 #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1401 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1402 # define YYSIZE_T size_t
1403 #endif
1404 #if ! defined (YYSIZE_T)
1405 # define YYSIZE_T unsigned int
1406 #endif
1407
1408 #ifndef YY_
1409 # if YYENABLE_NLS
1410 #  if ENABLE_NLS
1411 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1412 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
1413 #  endif
1414 # endif
1415 # ifndef YY_
1416 #  define YY_(msgid) msgid
1417 # endif
1418 #endif
1419
1420 #if ! defined (yyoverflow) || YYERROR_VERBOSE
1421
1422 /* The parser invokes alloca or malloc; define the necessary symbols.  */
1423
1424 # ifdef YYSTACK_USE_ALLOCA
1425 #  if YYSTACK_USE_ALLOCA
1426 #   ifdef __GNUC__
1427 #    define YYSTACK_ALLOC __builtin_alloca
1428 #   else
1429 #    define YYSTACK_ALLOC alloca
1430 #    if defined (__STDC__) || defined (__cplusplus)
1431 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1432 #     define YYINCLUDED_STDLIB_H
1433 #    endif
1434 #   endif
1435 #  endif
1436 # endif
1437
1438 # ifdef YYSTACK_ALLOC
1439    /* Pacify GCC's `empty if-body' warning. */
1440 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1441 #  ifndef YYSTACK_ALLOC_MAXIMUM
1442     /* The OS might guarantee only one guard page at the bottom of the stack,
1443        and a page size can be as small as 4096 bytes.  So we cannot safely
1444        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
1445        to allow for a few compiler-allocated temporary stack slots.  */
1446 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
1447 #  endif
1448 # else
1449 #  define YYSTACK_ALLOC YYMALLOC
1450 #  define YYSTACK_FREE YYFREE
1451 #  ifndef YYSTACK_ALLOC_MAXIMUM
1452 #   define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
1453 #  endif
1454 #  ifdef __cplusplus
1455 extern "C" {
1456 #  endif
1457 #  ifndef YYMALLOC
1458 #   define YYMALLOC malloc
1459 #   if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1460         && (defined (__STDC__) || defined (__cplusplus)))
1461 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1462 #   endif
1463 #  endif
1464 #  ifndef YYFREE
1465 #   define YYFREE free
1466 #   if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1467         && (defined (__STDC__) || defined (__cplusplus)))
1468 void free (void *); /* INFRINGES ON USER NAME SPACE */
1469 #   endif
1470 #  endif
1471 #  ifdef __cplusplus
1472 }
1473 #  endif
1474 # endif
1475 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
1476
1477
1478 #if (! defined (yyoverflow) \
1479      && (! defined (__cplusplus) \
1480          || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
1481
1482 /* A type that is properly aligned for any stack member.  */
1483 union yyalloc
1484 {
1485   short int yyss;
1486   YYSTYPE yyvs;
1487   };
1488
1489 /* The size of the maximum gap between one aligned stack and the next.  */
1490 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1491
1492 /* The size of an array large to enough to hold all stacks, each with
1493    N elements.  */
1494 # define YYSTACK_BYTES(N) \
1495      ((N) * (sizeof (short int) + sizeof (YYSTYPE))                     \
1496       + YYSTACK_GAP_MAXIMUM)
1497
1498 /* Copy COUNT objects from FROM to TO.  The source and destination do
1499    not overlap.  */
1500 # ifndef YYCOPY
1501 #  if defined (__GNUC__) && 1 < __GNUC__
1502 #   define YYCOPY(To, From, Count) \
1503       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1504 #  else
1505 #   define YYCOPY(To, From, Count)              \
1506       do                                        \
1507         {                                       \
1508           YYSIZE_T yyi;                         \
1509           for (yyi = 0; yyi < (Count); yyi++)   \
1510             (To)[yyi] = (From)[yyi];            \
1511         }                                       \
1512       while (0)
1513 #  endif
1514 # endif
1515
1516 /* Relocate STACK from its old location to the new one.  The
1517    local variables YYSIZE and YYSTACKSIZE give the old and new number of
1518    elements in the stack, and YYPTR gives the new location of the
1519    stack.  Advance YYPTR to a properly aligned location for the next
1520    stack.  */
1521 # define YYSTACK_RELOCATE(Stack)                                        \
1522     do                                                                  \
1523       {                                                                 \
1524         YYSIZE_T yynewbytes;                                            \
1525         YYCOPY (&yyptr->Stack, Stack, yysize);                          \
1526         Stack = &yyptr->Stack;                                          \
1527         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1528         yyptr += yynewbytes / sizeof (*yyptr);                          \
1529       }                                                                 \
1530     while (0)
1531
1532 #endif
1533
1534 #if defined (__STDC__) || defined (__cplusplus)
1535    typedef signed char yysigned_char;
1536 #else
1537    typedef short int yysigned_char;
1538 #endif
1539
1540 /* YYFINAL -- State number of the termination state. */
1541 #define YYFINAL  4
1542 /* YYLAST -- Last index in YYTABLE.  */
1543 #define YYLAST   1556
1544
1545 /* YYNTOKENS -- Number of terminals. */
1546 #define YYNTOKENS  161
1547 /* YYNNTS -- Number of nonterminals. */
1548 #define YYNNTS  78
1549 /* YYNRULES -- Number of rules. */
1550 #define YYNRULES  299
1551 /* YYNRULES -- Number of states. */
1552 #define YYNSTATES  586
1553
1554 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
1555 #define YYUNDEFTOK  2
1556 #define YYMAXUTOK   401
1557
1558 #define YYTRANSLATE(YYX)                                                \
1559   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1560
1561 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
1562 static const unsigned char yytranslate[] =
1563 {
1564        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1565        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1566        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1567        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1568      150,   151,   159,     2,   148,     2,     2,     2,     2,     2,
1569        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1570      155,   147,   156,     2,     2,     2,     2,     2,     2,     2,
1571        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1572        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1573        2,   152,   149,   154,     2,     2,     2,     2,     2,   160,
1574        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1575        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1576      153,     2,     2,   157,     2,   158,     2,     2,     2,     2,
1577        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1578        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1579        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1580        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1581        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1582        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1583        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1584        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1585        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1586        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1587        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1588        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1589        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
1590        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
1591       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
1592       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
1593       35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
1594       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
1595       55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
1596       65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
1597       75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
1598       85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
1599       95,    96,    97,    98,    99,   100,   101,   102,   103,   104,
1600      105,   106,   107,   108,   109,   110,   111,   112,   113,   114,
1601      115,   116,   117,   118,   119,   120,   121,   122,   123,   124,
1602      125,   126,   127,   128,   129,   130,   131,   132,   133,   134,
1603      135,   136,   137,   138,   139,   140,   141,   142,   143,   144,
1604      145,   146
1605 };
1606
1607 #if YYDEBUG
1608 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1609    YYRHS.  */
1610 static const unsigned short int yyprhs[] =
1611 {
1612        0,     0,     3,     5,     7,     9,    11,    13,    15,    17,
1613       19,    21,    23,    25,    27,    29,    31,    33,    35,    37,
1614       39,    41,    43,    45,    47,    49,    51,    53,    55,    57,
1615       59,    61,    63,    65,    67,    69,    71,    73,    75,    77,
1616       79,    81,    83,    85,    87,    89,    91,    93,    95,    97,
1617       99,   101,   103,   105,   107,   109,   111,   113,   115,   117,
1618      119,   121,   123,   125,   127,   129,   131,   133,   135,   137,
1619      139,   141,   143,   145,   147,   149,   151,   153,   156,   157,
1620      159,   161,   163,   165,   167,   169,   171,   172,   173,   175,
1621      177,   179,   181,   183,   185,   188,   189,   192,   193,   197,
1622      200,   201,   203,   204,   208,   210,   213,   215,   217,   219,
1623      221,   223,   225,   227,   229,   231,   233,   235,   237,   239,
1624      241,   243,   245,   247,   249,   251,   253,   255,   258,   263,
1625      269,   275,   279,   282,   285,   287,   291,   293,   297,   299,
1626      300,   305,   309,   313,   318,   323,   327,   330,   333,   336,
1627      339,   342,   345,   348,   351,   354,   357,   364,   370,   379,
1628      386,   393,   400,   408,   416,   423,   430,   439,   448,   452,
1629      454,   456,   458,   460,   463,   466,   471,   474,   476,   481,
1630      484,   489,   490,   498,   499,   507,   508,   516,   517,   525,
1631      529,   534,   535,   537,   539,   541,   545,   549,   553,   557,
1632      561,   565,   567,   568,   570,   572,   574,   575,   578,   582,
1633      584,   586,   590,   592,   593,   602,   604,   606,   610,   612,
1634      614,   617,   618,   620,   622,   623,   628,   629,   631,   633,
1635      635,   637,   639,   641,   643,   645,   647,   651,   653,   659,
1636      661,   663,   665,   667,   670,   673,   676,   680,   683,   684,
1637      686,   689,   692,   696,   706,   716,   725,   739,   741,   743,
1638      750,   756,   759,   766,   774,   776,   780,   782,   783,   786,
1639      788,   794,   800,   806,   813,   820,   823,   828,   833,   840,
1640      845,   850,   855,   860,   867,   874,   877,   885,   887,   890,
1641      891,   893,   894,   898,   905,   909,   916,   919,   924,   931
1642 };
1643
1644 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1645 static const short int yyrhs[] =
1646 {
1647      195,     0,    -1,     5,    -1,     6,    -1,     3,    -1,     4,
1648       -1,    78,    -1,    79,    -1,    80,    -1,    81,    -1,    82,
1649       -1,    83,    -1,    84,    -1,    85,    -1,    86,    -1,    87,
1650       -1,    88,    -1,    89,    -1,    90,    -1,    91,    -1,    92,
1651       -1,    93,    -1,    94,    -1,    95,    -1,   124,    -1,   125,
1652       -1,   126,    -1,   127,    -1,   128,    -1,   129,    -1,   130,
1653       -1,   131,    -1,   132,    -1,   133,    -1,   134,    -1,   135,
1654       -1,   138,    -1,   139,    -1,   140,    -1,    98,    -1,    99,
1655       -1,   100,    -1,   101,    -1,   102,    -1,   103,    -1,   104,
1656       -1,   105,    -1,   106,    -1,   107,    -1,   108,    -1,   109,
1657       -1,   110,    -1,   111,    -1,   112,    -1,   113,    -1,   114,
1658       -1,   115,    -1,   116,    -1,   117,    -1,   104,    -1,   105,
1659       -1,   106,    -1,   107,    -1,    27,    -1,    28,    -1,    16,
1660       -1,    14,    -1,    12,    -1,    10,    -1,    17,    -1,    15,
1661       -1,    13,    -1,    11,    -1,   171,    -1,   172,    -1,    18,
1662       -1,    19,    -1,   207,   147,    -1,    -1,    41,    -1,    42,
1663       -1,    43,    -1,    44,    -1,    45,    -1,    46,    -1,    47,
1664       -1,    -1,    -1,    65,    -1,    66,    -1,    67,    -1,    68,
1665       -1,    69,    -1,    70,    -1,    64,     4,    -1,    -1,    57,
1666        4,    -1,    -1,   148,    57,     4,    -1,    34,    24,    -1,
1667       -1,   180,    -1,    -1,   148,   183,   182,    -1,   180,    -1,
1668       57,     4,    -1,   186,    -1,     8,    -1,   188,    -1,     8,
1669       -1,   188,    -1,     9,    -1,    10,    -1,    11,    -1,    12,
1670       -1,    13,    -1,    14,    -1,    15,    -1,    16,    -1,    17,
1671       -1,    18,    -1,    19,    -1,    20,    -1,    21,    -1,    48,
1672       -1,   187,    -1,   222,    -1,   149,     4,    -1,   185,   150,
1673      190,   151,    -1,   152,     4,   153,   188,   154,    -1,   155,
1674        4,   153,   188,   156,    -1,   157,   189,   158,    -1,   157,
1675      158,    -1,   188,   159,    -1,   188,    -1,   189,   148,   188,
1676       -1,   189,    -1,   189,   148,    37,    -1,    37,    -1,    -1,
1677      186,   152,   193,   154,    -1,   186,   152,   154,    -1,   186,
1678      160,    24,    -1,   186,   155,   193,   156,    -1,   186,   157,
1679      193,   158,    -1,   186,   157,   158,    -1,   186,    38,    -1,
1680      186,    39,    -1,   186,   222,    -1,   186,   192,    -1,   186,
1681       26,    -1,   171,   163,    -1,   172,     4,    -1,     9,    27,
1682       -1,     9,    28,    -1,   174,     7,    -1,   167,   150,   191,
1683       36,   186,   151,    -1,   123,   150,   191,   236,   151,    -1,
1684      137,   150,   191,   148,   191,   148,   191,   151,    -1,   164,
1685      150,   191,   148,   191,   151,    -1,   165,   150,   191,   148,
1686      191,   151,    -1,   166,   150,   191,   148,   191,   151,    -1,
1687       96,   169,   150,   191,   148,   191,   151,    -1,    97,   170,
1688      150,   191,   148,   191,   151,    -1,   168,   150,   191,   148,
1689      191,   151,    -1,   142,   150,   191,   148,   191,   151,    -1,
1690      143,   150,   191,   148,   191,   148,   191,   151,    -1,   144,
1691      150,   191,   148,   191,   148,   191,   151,    -1,   193,   148,
1692      191,    -1,   191,    -1,    32,    -1,    33,    -1,   196,    -1,
1693      196,   216,    -1,   196,   218,    -1,   196,    62,    61,   202,
1694       -1,   196,    25,    -1,   197,    -1,   197,   175,    20,   184,
1695       -1,   197,   218,    -1,   197,    62,    61,   202,    -1,    -1,
1696      197,   175,   176,   194,   191,   198,   182,    -1,    -1,   197,
1697      175,    50,   194,   186,   199,   182,    -1,    -1,   197,   175,
1698       45,   194,   186,   200,   182,    -1,    -1,   197,   175,    47,
1699      194,   186,   201,   182,    -1,   197,    51,   204,    -1,   197,
1700       58,   147,   205,    -1,    -1,    24,    -1,    56,    -1,    55,
1701       -1,    53,   147,   203,    -1,    54,   147,     4,    -1,    52,
1702      147,    24,    -1,    71,   147,    24,    -1,   152,   206,   154,
1703       -1,   206,   148,    24,    -1,    24,    -1,    -1,    22,    -1,
1704       24,    -1,   207,    -1,    -1,   186,   208,    -1,   210,   148,
1705      209,    -1,   209,    -1,   210,    -1,   210,   148,    37,    -1,
1706       37,    -1,    -1,   177,   184,   207,   150,   211,   151,   181,
1707      178,    -1,    29,    -1,   157,    -1,   176,   212,   213,    -1,
1708       30,    -1,   158,    -1,   225,   215,    -1,    -1,    45,    -1,
1709       47,    -1,    -1,    31,   219,   217,   212,    -1,    -1,    63,
1710       -1,     3,    -1,     4,    -1,     7,    -1,    27,    -1,    28,
1711       -1,    38,    -1,    39,    -1,    26,    -1,   155,   193,   156,
1712       -1,   192,    -1,    61,   220,    24,   148,    24,    -1,   162,
1713       -1,   207,    -1,   222,    -1,   221,    -1,   186,   223,    -1,
1714      225,   226,    -1,   214,   226,    -1,   227,   175,   228,    -1,
1715      227,   230,    -1,    -1,    23,    -1,    72,   224,    -1,    72,
1716        8,    -1,    73,    21,   223,    -1,    73,     9,   223,   148,
1717       21,   223,   148,    21,   223,    -1,    74,   173,   223,   148,
1718       21,   223,   152,   229,   154,    -1,    74,   173,   223,   148,
1719       21,   223,   152,   154,    -1,    75,   177,   184,   223,   150,
1720      233,   151,    36,    21,   223,    76,    21,   223,    -1,    76,
1721       -1,    77,    -1,   229,   173,   221,   148,    21,   223,    -1,
1722      173,   221,   148,    21,   223,    -1,   175,   235,    -1,   186,
1723      152,   223,   148,   223,   154,    -1,   231,   148,   152,   223,
1724      148,   223,   154,    -1,   224,    -1,   232,   148,   224,    -1,
1725      232,    -1,    -1,    60,    59,    -1,    59,    -1,   164,   186,
1726      223,   148,   223,    -1,   165,   186,   223,   148,   223,    -1,
1727      166,   186,   223,   148,   223,    -1,    96,   169,   186,   223,
1728      148,   223,    -1,    97,   170,   186,   223,   148,   223,    -1,
1729       49,   224,    -1,   168,   224,   148,   224,    -1,   167,   224,
1730       36,   186,    -1,   137,   224,   148,   224,   148,   224,    -1,
1731      141,   224,   148,   186,    -1,   145,   224,   148,   186,    -1,
1732      146,   224,   148,   186,    -1,   142,   224,   148,   224,    -1,
1733      143,   224,   148,   224,   148,   224,    -1,   144,   224,   148,
1734      224,   148,   224,    -1,   136,   231,    -1,   234,   177,   184,
1735      223,   150,   233,   151,    -1,   238,    -1,   148,   232,    -1,
1736       -1,    35,    -1,    -1,   118,   186,   179,    -1,   118,   186,
1737      148,    15,   223,   179,    -1,   119,   186,   179,    -1,   119,
1738      186,   148,    15,   223,   179,    -1,   120,   224,    -1,   237,
1739      121,   186,   223,    -1,   237,   122,   224,   148,   186,   223,
1740       -1,   123,   186,   223,   236,    -1
1741 };
1742
1743 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
1744 static const unsigned short int yyrline[] =
1745 {
1746        0,  1103,  1103,  1104,  1112,  1113,  1123,  1123,  1123,  1123,
1747     1123,  1123,  1123,  1123,  1123,  1124,  1124,  1124,  1125,  1125,
1748     1125,  1125,  1125,  1125,  1126,  1126,  1126,  1126,  1126,  1126,
1749     1127,  1127,  1127,  1127,  1127,  1127,  1128,  1128,  1128,  1130,
1750     1130,  1131,  1131,  1132,  1132,  1133,  1133,  1134,  1134,  1138,
1751     1138,  1139,  1139,  1140,  1140,  1141,  1141,  1142,  1142,  1143,
1752     1143,  1144,  1144,  1145,  1146,  1151,  1151,  1151,  1151,  1152,
1753     1152,  1152,  1152,  1153,  1153,  1154,  1154,  1157,  1161,  1166,
1754     1167,  1168,  1169,  1170,  1171,  1172,  1173,  1175,  1176,  1177,
1755     1178,  1179,  1180,  1181,  1182,  1191,  1192,  1198,  1199,  1207,
1756     1215,  1216,  1221,  1222,  1223,  1228,  1242,  1242,  1243,  1243,
1757     1245,  1255,  1255,  1255,  1255,  1255,  1255,  1255,  1256,  1256,
1758     1256,  1256,  1256,  1256,  1257,  1261,  1265,  1273,  1281,  1294,
1759     1299,  1311,  1321,  1325,  1336,  1341,  1347,  1348,  1352,  1356,
1760     1367,  1393,  1407,  1437,  1463,  1484,  1497,  1507,  1512,  1573,
1761     1580,  1588,  1594,  1600,  1604,  1608,  1616,  1628,  1660,  1668,
1762     1692,  1703,  1709,  1714,  1719,  1728,  1734,  1740,  1749,  1753,
1763     1761,  1761,  1771,  1779,  1784,  1788,  1792,  1796,  1811,  1833,
1764     1836,  1839,  1839,  1847,  1847,  1855,  1855,  1863,  1863,  1872,
1765     1875,  1878,  1882,  1895,  1896,  1898,  1902,  1911,  1915,  1920,
1766     1922,  1927,  1932,  1941,  1941,  1942,  1942,  1944,  1951,  1957,
1767     1964,  1968,  1974,  1979,  1984,  2079,  2079,  2081,  2089,  2089,
1768     2091,  2096,  2097,  2098,  2100,  2100,  2110,  2114,  2119,  2123,
1769     2127,  2131,  2135,  2139,  2143,  2147,  2151,  2176,  2180,  2194,
1770     2198,  2204,  2204,  2210,  2215,  2219,  2228,  2239,  2248,  2260,
1771     2273,  2277,  2281,  2286,  2295,  2314,  2323,  2379,  2383,  2390,
1772     2401,  2414,  2423,  2432,  2442,  2446,  2453,  2453,  2455,  2459,
1773     2464,  2483,  2498,  2512,  2523,  2534,  2547,  2556,  2567,  2575,
1774     2581,  2601,  2624,  2630,  2636,  2642,  2657,  2716,  2723,  2726,
1775     2731,  2735,  2742,  2747,  2753,  2758,  2764,  2772,  2784,  2799
1776 };
1777 #endif
1778
1779 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1780 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1781    First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1782 static const char *const yytname[] =
1783 {
1784   "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL",
1785   "UINTVAL", "FPVAL", "VOID", "BOOL", "SBYTE", "UBYTE", "SHORT", "USHORT",
1786   "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE", "TYPE", "LABEL",
1787   "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION",
1788   "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK",
1789   "DECLARE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO",
1790   "DOTDOTDOT", "NULL_TOK", "UNDEF", "CONST", "INTERNAL", "LINKONCE",
1791   "WEAK", "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1792   "NOT", "EXTERNAL", "TARGET", "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE",
1793   "BIG", "ALIGN", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE",
1794   "SIDEEFFECT", "CC_TOK", "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK",
1795   "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT",
1796   "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB",
1797   "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR",
1798   "XOR", "SETLE", "SETGE", "SETLT", "SETGT", "SETEQ", "SETNE", "ICMP",
1799   "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1800   "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1801   "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1802   "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1803   "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1804   "SELECT", "SHL", "LSHR", "ASHR", "VAARG", "EXTRACTELEMENT",
1805   "INSERTELEMENT", "SHUFFLEVECTOR", "VAARG_old", "VANEXT_old", "'='",
1806   "','", "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'",
1807   "'}'", "'*'", "'c'", "$accept", "INTVAL", "EINT64VAL", "ArithmeticOps",
1808   "LogicalOps", "SetCondOps", "CastOps", "ShiftOps", "IPredicates",
1809   "FPredicates", "SIntType", "UIntType", "IntType", "FPType", "OptAssign",
1810   "OptLinkage", "OptCallingConv", "OptAlign", "OptCAlign", "SectionString",
1811   "OptSection", "GlobalVarAttributes", "GlobalVarAttribute", "TypesV",
1812   "UpRTypesV", "Types", "PrimType", "UpRTypes", "TypeListI",
1813   "ArgTypeListI", "ConstVal", "ConstExpr", "ConstVector", "GlobalType",
1814   "Module", "FunctionList", "ConstPool", "@1", "@2", "@3", "@4",
1815   "AsmBlock", "BigOrLittle", "TargetDefinition", "LibrariesDefinition",
1816   "LibList", "Name", "OptName", "ArgVal", "ArgListH", "ArgList",
1817   "FunctionHeaderH", "BEGIN", "FunctionHeader", "END", "Function",
1818   "FnDeclareLinkage", "FunctionProto", "@5", "OptSideEffect",
1819   "ConstValueRef", "SymbolicValueRef", "ValueRef", "ResolvedVal",
1820   "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst",
1821   "JumpTable", "Inst", "PHIList", "ValueRefList", "ValueRefListE",
1822   "OptTailCall", "InstVal", "IndexList", "OptVolatile", "MemoryInst", 0
1823 };
1824 #endif
1825
1826 # ifdef YYPRINT
1827 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1828    token YYLEX-NUM.  */
1829 static const unsigned short int yytoknum[] =
1830 {
1831        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
1832      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
1833      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
1834      285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
1835      295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
1836      305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
1837      315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
1838      325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
1839      335,   336,   337,   338,   339,   340,   341,   342,   343,   344,
1840      345,   346,   347,   348,   349,   350,   351,   352,   353,   354,
1841      355,   356,   357,   358,   359,   360,   361,   362,   363,   364,
1842      365,   366,   367,   368,   369,   370,   371,   372,   373,   374,
1843      375,   376,   377,   378,   379,   380,   381,   382,   383,   384,
1844      385,   386,   387,   388,   389,   390,   391,   392,   393,   394,
1845      395,   396,   397,   398,   399,   400,   401,    61,    44,    92,
1846       40,    41,    91,   120,    93,    60,    62,   123,   125,    42,
1847       99
1848 };
1849 # endif
1850
1851 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
1852 static const unsigned char yyr1[] =
1853 {
1854        0,   161,   162,   162,   163,   163,   164,   164,   164,   164,
1855      164,   164,   164,   164,   164,   165,   165,   165,   166,   166,
1856      166,   166,   166,   166,   167,   167,   167,   167,   167,   167,
1857      167,   167,   167,   167,   167,   167,   168,   168,   168,   169,
1858      169,   169,   169,   169,   169,   169,   169,   169,   169,   170,
1859      170,   170,   170,   170,   170,   170,   170,   170,   170,   170,
1860      170,   170,   170,   170,   170,   171,   171,   171,   171,   172,
1861      172,   172,   172,   173,   173,   174,   174,   175,   175,   176,
1862      176,   176,   176,   176,   176,   176,   176,   177,   177,   177,
1863      177,   177,   177,   177,   177,   178,   178,   179,   179,   180,
1864      181,   181,   182,   182,   183,   183,   184,   184,   185,   185,
1865      186,   187,   187,   187,   187,   187,   187,   187,   187,   187,
1866      187,   187,   187,   187,   188,   188,   188,   188,   188,   188,
1867      188,   188,   188,   188,   189,   189,   190,   190,   190,   190,
1868      191,   191,   191,   191,   191,   191,   191,   191,   191,   191,
1869      191,   191,   191,   191,   191,   191,   192,   192,   192,   192,
1870      192,   192,   192,   192,   192,   192,   192,   192,   193,   193,
1871      194,   194,   195,   196,   196,   196,   196,   196,   197,   197,
1872      197,   198,   197,   199,   197,   200,   197,   201,   197,   197,
1873      197,   197,   202,   203,   203,   204,   204,   204,   204,   205,
1874      206,   206,   206,   207,   207,   208,   208,   209,   210,   210,
1875      211,   211,   211,   211,   212,   213,   213,   214,   215,   215,
1876      216,   217,   217,   217,   219,   218,   220,   220,   221,   221,
1877      221,   221,   221,   221,   221,   221,   221,   221,   221,   222,
1878      222,   223,   223,   224,   225,   225,   226,   227,   227,   227,
1879      228,   228,   228,   228,   228,   228,   228,   228,   228,   229,
1880      229,   230,   231,   231,   232,   232,   233,   233,   234,   234,
1881      235,   235,   235,   235,   235,   235,   235,   235,   235,   235,
1882      235,   235,   235,   235,   235,   235,   235,   235,   236,   236,
1883      237,   237,   238,   238,   238,   238,   238,   238,   238,   238
1884 };
1885
1886 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
1887 static const unsigned char yyr2[] =
1888 {
1889        0,     2,     1,     1,     1,     1,     1,     1,     1,     1,
1890        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1891        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1892        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1893        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1894        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1895        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1896        1,     1,     1,     1,     1,     1,     1,     2,     0,     1,
1897        1,     1,     1,     1,     1,     1,     0,     0,     1,     1,
1898        1,     1,     1,     1,     2,     0,     2,     0,     3,     2,
1899        0,     1,     0,     3,     1,     2,     1,     1,     1,     1,
1900        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1901        1,     1,     1,     1,     1,     1,     1,     2,     4,     5,
1902        5,     3,     2,     2,     1,     3,     1,     3,     1,     0,
1903        4,     3,     3,     4,     4,     3,     2,     2,     2,     2,
1904        2,     2,     2,     2,     2,     2,     6,     5,     8,     6,
1905        6,     6,     7,     7,     6,     6,     8,     8,     3,     1,
1906        1,     1,     1,     2,     2,     4,     2,     1,     4,     2,
1907        4,     0,     7,     0,     7,     0,     7,     0,     7,     3,
1908        4,     0,     1,     1,     1,     3,     3,     3,     3,     3,
1909        3,     1,     0,     1,     1,     1,     0,     2,     3,     1,
1910        1,     3,     1,     0,     8,     1,     1,     3,     1,     1,
1911        2,     0,     1,     1,     0,     4,     0,     1,     1,     1,
1912        1,     1,     1,     1,     1,     1,     3,     1,     5,     1,
1913        1,     1,     1,     2,     2,     2,     3,     2,     0,     1,
1914        2,     2,     3,     9,     9,     8,    13,     1,     1,     6,
1915        5,     2,     6,     7,     1,     3,     1,     0,     2,     1,
1916        5,     5,     5,     6,     6,     2,     4,     4,     6,     4,
1917        4,     4,     4,     6,     6,     2,     7,     1,     2,     0,
1918        1,     0,     3,     6,     3,     6,     2,     4,     6,     4
1919 };
1920
1921 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1922    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
1923    means the default is an error.  */
1924 static const unsigned short int yydefact[] =
1925 {
1926      191,     0,    86,   177,     1,   176,   224,    79,    80,    81,
1927       82,    83,    84,    85,     0,    87,   248,   173,   174,   248,
1928      203,   204,     0,     0,     0,    86,     0,   179,   221,     0,
1929        0,    88,    89,    90,    91,    92,    93,     0,     0,   249,
1930      245,    78,   218,   219,   220,   244,     0,     0,     0,     0,
1931      189,     0,     0,     0,     0,     0,     0,     0,    77,   222,
1932      223,    87,   192,   175,    94,     2,     3,   107,   111,   112,
1933      113,   114,   115,   116,   117,   118,   119,   120,   121,   122,
1934      123,   124,     0,     0,     0,     0,   239,     0,     0,   106,
1935      125,   110,   240,   126,   215,   216,   217,   291,   247,     0,
1936        0,     0,     0,   202,   190,   180,   178,   170,   171,     0,
1937        0,     0,     0,   225,   127,     0,     0,   109,   132,   134,
1938        0,     0,   139,   133,   290,     0,   269,     0,     0,     0,
1939        0,    87,   257,   258,     6,     7,     8,     9,    10,    11,
1940       12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
1941       22,    23,     0,     0,     0,     0,     0,     0,    24,    25,
1942       26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
1943        0,     0,    36,    37,    38,     0,     0,     0,     0,     0,
1944        0,     0,     0,     0,     0,     0,   246,    87,   261,     0,
1945      287,   197,   194,   193,   195,   196,   198,   201,     0,   185,
1946      187,   183,   111,   112,   113,   114,   115,   116,   117,   118,
1947      119,   120,   121,     0,     0,     0,     0,   181,     0,     0,
1948        0,   131,   213,   138,   136,     0,     0,   275,   268,   251,
1949      250,     0,     0,    68,    72,    67,    71,    66,    70,    65,
1950       69,    73,    74,     0,     0,    39,    40,    41,    42,    43,
1951       44,    45,    46,    47,    48,     0,    63,    64,    59,    60,
1952       61,    62,    49,    50,    51,    52,    53,    54,    55,    56,
1953       57,    58,     0,    97,    97,   296,     0,     0,   285,     0,
1954        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1955        0,     0,     0,     0,     0,   199,   102,   102,   102,   153,
1956      154,     4,     5,   151,   152,   155,   150,   146,   147,     0,
1957        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1958        0,     0,     0,     0,     0,   149,   148,   102,   108,   108,
1959      135,   212,   206,   209,   210,     0,     0,   128,   228,   229,
1960      230,   235,   231,   232,   233,   234,   226,     0,   237,   242,
1961      241,   243,     0,   252,     0,     0,     0,     0,     0,   292,
1962        0,   294,   289,     0,     0,     0,     0,     0,     0,     0,
1963        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1964      200,     0,   186,   188,   184,     0,     0,     0,     0,     0,
1965        0,     0,   141,   169,     0,     0,   145,     0,   142,     0,
1966        0,     0,     0,     0,   182,   129,   130,   205,   207,     0,
1967      100,   137,   227,     0,     0,     0,     0,     0,     0,     0,
1968        0,     0,     0,     0,   299,     0,     0,     0,   279,   282,
1969        0,     0,   280,   281,     0,     0,     0,   277,   276,     0,
1970      297,     0,     0,     0,   104,   102,     0,     0,   289,     0,
1971        0,     0,     0,     0,   140,   143,   144,     0,     0,     0,
1972        0,     0,   211,   208,   101,    95,     0,   236,     0,     0,
1973      267,     0,     0,    97,    98,    97,   264,   288,     0,     0,
1974        0,     0,     0,   270,   271,   272,   267,     0,    99,   105,
1975      103,     0,     0,     0,     0,     0,     0,     0,   168,     0,
1976        0,     0,     0,     0,     0,   214,     0,     0,     0,   266,
1977        0,   273,   274,     0,   293,   295,     0,     0,     0,   278,
1978      283,   284,     0,   298,     0,     0,   157,     0,     0,     0,
1979        0,     0,     0,     0,     0,     0,    96,   238,     0,     0,
1980        0,   265,   262,     0,   286,     0,     0,     0,   165,     0,
1981        0,   159,   160,   161,   156,   164,     0,   255,     0,     0,
1982        0,   263,   162,   163,     0,     0,     0,   253,     0,   254,
1983        0,     0,   158,   166,   167,     0,     0,     0,     0,     0,
1984        0,   260,     0,     0,   259,   256
1985 };
1986
1987 /* YYDEFGOTO[NTERM-NUM]. */
1988 static const short int yydefgoto[] =
1989 {
1990       -1,    86,   303,   320,   321,   322,   323,   324,   255,   272,
1991      213,   214,   243,   215,    25,    15,    37,   505,   359,   444,
1992      465,   382,   445,    87,    88,   216,    90,    91,   120,   225,
1993      393,   348,   394,   109,     1,     2,     3,   327,   298,   296,
1994      297,    63,   194,    50,   104,   198,    92,   408,   333,   334,
1995      335,    38,    96,    16,    44,    17,    61,    18,    28,   413,
1996      349,    93,   351,   476,    19,    40,    41,   186,   559,    98,
1997      278,   509,   510,   187,   188,   424,   189,   190
1998 };
1999
2000 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2001    STATE-NUM.  */
2002 #define YYPACT_NINF -536
2003 static const short int yypact[] =
2004 {
2005     -536,    28,   149,   426,  -536,  -536,  -536,  -536,  -536,  -536,
2006     -536,  -536,  -536,  -536,   -16,   158,    41,  -536,  -536,    -1,
2007     -536,  -536,    14,   -67,    25,    80,   -31,  -536,    30,   130,
2008      155,  -536,  -536,  -536,  -536,  -536,  -536,  1242,    -4,  -536,
2009     -536,    65,  -536,  -536,  -536,  -536,    32,    36,    37,    39,
2010     -536,    35,   130,  1242,    69,    69,    69,    69,  -536,  -536,
2011     -536,   158,  -536,  -536,  -536,  -536,  -536,    38,  -536,  -536,
2012     -536,  -536,  -536,  -536,  -536,  -536,  -536,  -536,  -536,  -536,
2013     -536,  -536,   185,   193,   194,   659,  -536,    65,    50,  -536,
2014     -536,  -113,  -536,  -536,  -536,  -536,  -536,  1410,  -536,   177,
2015       59,   198,   179,   180,  -536,  -536,  -536,  -536,  -536,  1262,
2016     1262,  1262,  1303,  -536,  -536,    52,    57,  -536,  -536,  -113,
2017     -118,    62,  1047,  -536,  -536,  1262,  -536,   150,  1323,    15,
2018      151,   158,  -536,  -536,  -536,  -536,  -536,  -536,  -536,  -536,
2019     -536,  -536,  -536,  -536,  -536,  -536,  -536,  -536,  -536,  -536,
2020     -536,  -536,   399,   210,  1262,  1262,  1262,  1262,  -536,  -536,
2021     -536,  -536,  -536,  -536,  -536,  -536,  -536,  -536,  -536,  -536,
2022     1262,  1262,  -536,  -536,  -536,  1262,  1262,  1262,  1262,  1262,
2023     1262,  1262,  1262,  1262,  1262,  1262,  -536,   158,  -536,     7,
2024     -536,  -536,  -536,  -536,  -536,  -536,  -536,  -536,   -85,  -536,
2025     -536,  -536,   104,   152,   209,   167,   212,   172,   215,   174,
2026      216,   207,   225,   178,   229,   227,   566,  -536,  1262,  1262,
2027     1262,  -536,  1088,  -536,    91,    89,   757,  -536,  -536,    38,
2028     -536,   757,   757,  -536,  -536,  -536,  -536,  -536,  -536,  -536,
2029     -536,  -536,  -536,   757,  1242,  -536,  -536,  -536,  -536,  -536,
2030     -536,  -536,  -536,  -536,  -536,  1262,  -536,  -536,  -536,  -536,
2031     -536,  -536,  -536,  -536,  -536,  -536,  -536,  -536,  -536,  -536,
2032     -536,  -536,  1262,    94,   100,  -536,   757,    97,   102,   103,
2033      109,   110,   111,   112,   113,   114,   757,   757,   757,   232,
2034      117,  1242,  1262,  1262,   245,  -536,   122,   122,   122,  -536,
2035     -536,  -536,  -536,  -536,  -536,  -536,  -536,  -536,  -536,   399,
2036      210,   121,   124,   125,   126,   127,   992,  1303,   719,   248,
2037      128,   129,   131,   133,   134,  -536,  -536,   122,  -111,   -80,
2038     -113,  -536,    65,  -536,   132,   135,  1145,  -536,  -536,  -536,
2039     -536,  -536,  -536,  -536,  -536,  -536,   222,  1303,  -536,  -536,
2040     -536,  -536,   139,  -536,   140,   757,   757,   757,     0,  -536,
2041        2,  -536,   141,   757,   138,  1262,  1262,  1262,  1262,  1262,
2042     1262,  1262,   153,   154,   156,  1262,  1262,   757,   757,   162,
2043     -536,   -24,  -536,  -536,  -536,   148,   161,  1303,  1303,  1303,
2044     1303,  1303,  -536,  -536,   -70,   -98,  -536,  -117,  -536,  1303,
2045     1303,  1303,  1303,  1303,  -536,  -536,  -536,  -536,  -536,  1201,
2046      265,  -536,  -536,   276,   -86,   291,   316,   190,   195,   196,
2047      757,   337,   757,  1262,  -536,   197,   757,   201,  -536,  -536,
2048      202,   206,  -536,  -536,   757,   757,   757,  -536,  -536,   192,
2049     -536,  1262,   331,   356,  -536,   122,  1303,  1303,   141,   213,
2050      214,   217,   219,  1303,  -536,  -536,  -536,   220,   221,   223,
2051      327,   226,  -536,  -536,  -536,   307,   228,  -536,   757,   757,
2052     1262,   757,   757,   231,  -536,   231,  -536,   233,   757,   234,
2053     1262,  1262,  1262,  -536,  -536,  -536,  1262,   757,  -536,  -536,
2054     -536,   235,   236,   224,  1303,  1303,  1303,  1303,  -536,  1303,
2055     1303,  1303,  1262,  1303,   366,  -536,   361,   239,   237,   233,
2056      240,  -536,  -536,   323,  -536,  -536,  1262,   241,   757,  -536,
2057     -536,  -536,   242,  -536,  1303,  1303,  -536,   246,   247,   249,
2058      251,   257,   259,   260,   262,   267,  -536,  -536,   367,    82,
2059      354,  -536,  -536,   266,  -536,   268,   270,  1303,  -536,  1303,
2060     1303,  -536,  -536,  -536,  -536,  -536,   757,  -536,   899,    93,
2061      375,  -536,  -536,  -536,   271,   273,   274,  -536,   278,  -536,
2062      899,   757,  -536,  -536,  -536,   406,   280,   353,   757,   414,
2063      415,  -536,   757,   757,  -536,  -536
2064 };
2065
2066 /* YYPGOTO[NTERM-NUM].  */
2067 static const short int yypgoto[] =
2068 {
2069     -536,  -536,  -536,   342,   343,   344,   345,   350,   142,   144,
2070     -127,  -125,  -525,  -536,   411,   435,  -122,  -536,  -267,    51,
2071     -536,  -285,  -536,   -45,  -536,   -37,  -536,   -83,   340,  -536,
2072      -94,   250,  -298,    56,  -536,  -536,  -536,  -536,  -536,  -536,
2073     -536,   412,  -536,  -536,  -536,  -536,     3,  -536,    54,  -536,
2074     -536,   413,  -536,  -536,  -536,  -536,  -536,   472,  -536,  -536,
2075     -535,  -205,    60,  -124,  -536,   459,  -536,  -536,  -536,  -536,
2076     -536,    58,    -3,  -536,  -536,    42,  -536,  -536
2077 };
2078
2079 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
2080    positive, shift that token.  If negative, reduce the rule which
2081    number is the opposite.  If zero, do what YYDEFACT says.
2082    If YYTABLE_NINF, syntax error.  */
2083 #define YYTABLE_NINF -173
2084 static const short int yytable[] =
2085 {
2086       89,   227,   119,   241,   230,   242,    26,   361,   106,   244,
2087      442,   326,   383,   384,   558,   420,    89,   422,   217,   395,
2088      397,   350,    39,   568,   231,    94,   350,   350,     4,    42,
2089      220,   453,   275,   443,   570,   576,   232,  -108,   350,   119,
2090      221,   456,   404,   405,    26,    29,   123,   279,   123,   414,
2091      453,   280,   281,   282,   283,   284,   285,   421,   455,   421,
2092      289,   290,   453,   294,    39,   291,    46,    47,    48,   295,
2093      467,   350,   199,   200,   201,    59,   406,    60,   453,   123,
2094       51,   350,   350,   350,   454,    49,    52,    20,   226,    21,
2095      121,   226,   233,   234,   235,   236,   237,   238,   239,   240,
2096       53,   107,   108,   233,   234,   235,   236,   237,   238,   239,
2097      240,   110,   111,   112,   192,   193,    58,   273,   274,   226,
2098      276,     7,     8,     9,    10,    54,    12,    55,   292,   293,
2099       56,   299,   300,   277,   226,   328,   329,   330,   226,   226,
2100      226,   226,   226,   226,   286,   287,   288,   226,   226,  -172,
2101      350,   350,   350,    95,    62,   -68,   -68,    43,   350,    64,
2102      490,   233,   234,   235,   236,   237,   238,   239,   240,   379,
2103      -67,   -67,   350,   350,     5,   -66,   -66,   -65,   -65,    99,
2104        6,   301,   302,   100,   101,   332,   102,   103,  -109,   114,
2105        7,     8,     9,    10,    11,    12,    13,   115,   116,   355,
2106      122,   191,   195,   196,   197,   218,   514,    89,   515,   228,
2107      219,    14,   222,   -72,   -75,   350,   -71,   350,   356,   -70,
2108      -69,   350,    30,    31,    32,    33,    34,    35,    36,   350,
2109      350,   350,   -76,   304,   305,   357,   557,   256,   257,   336,
2110      337,   427,   358,   429,   430,   431,   377,   569,   360,   363,
2111      364,   365,   438,   330,    89,   378,   226,   366,   367,   368,
2112      369,   370,   371,   350,   350,   376,   350,   350,   375,   380,
2113      381,   387,   398,   350,   388,   389,   390,   391,   399,   400,
2114      409,   401,   350,   402,   403,   412,   410,   415,   416,   423,
2115      426,   352,   353,   448,   449,   450,   451,   452,   446,   442,
2116      466,   434,   435,   354,   436,   457,   458,   459,   460,   461,
2117      441,   447,   468,   350,   258,   259,   260,   261,   262,   263,
2118      264,   265,   266,   267,   268,   269,   270,   271,   226,   428,
2119      226,   226,   226,   432,   433,   407,   362,   469,   437,   226,
2120      470,   474,   486,   471,   472,   478,   372,   373,   374,   480,
2121      481,   350,   491,   492,   482,   488,   519,   520,   521,   498,
2122      489,   494,   495,   502,   504,   496,   350,   497,   499,   500,
2123      536,   501,   332,   350,   503,   526,   506,   350,   350,   513,
2124      421,   516,   518,   524,   525,   537,   226,   538,   556,   539,
2125      560,   540,   541,   544,   547,   542,   571,   549,   548,   550,
2126      527,   528,   529,   530,   487,   531,   532,   533,   551,   535,
2127      552,   553,   241,   554,   242,   417,   418,   419,   555,   562,
2128      561,   563,   572,   425,   573,   574,   575,   578,   579,   580,
2129      545,   546,   241,   226,   242,   582,   583,   439,   440,   181,
2130      182,   183,   184,   226,   226,   226,   -78,   185,    20,   226,
2131       21,   385,    97,   564,   386,   565,   566,     6,   -78,   -78,
2132       57,   464,   224,   463,   105,   534,   325,   -78,   -78,   -78,
2133      -78,   -78,   -78,   -78,   113,    27,   -78,    22,    45,   226,
2134      473,   477,   475,   522,    23,     0,   479,     0,    24,     0,
2135      493,     0,     0,     0,   483,   484,   485,   245,   246,   247,
2136      248,   249,   250,   251,   252,   253,   254,     0,     0,     0,
2137        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2138        0,     0,     0,     0,     0,     0,     0,     0,   507,   508,
2139        0,   511,   512,     0,     0,     0,     0,     0,   517,     0,
2140        0,     0,     0,     0,     0,     0,     0,   523,     0,     0,
2141        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2142        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2143        0,    65,    66,     0,     0,     0,     0,     0,   543,     0,
2144        0,     0,     0,     0,     0,     0,     0,     0,    20,     0,
2145       21,     0,   306,     0,     0,     0,     0,     0,     0,     0,
2146        0,     0,     0,     0,   307,   308,     0,     0,     0,     0,
2147        0,     0,     0,     0,     0,     0,   567,     0,     0,     0,
2148        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2149        0,   577,     0,     0,     0,     0,     0,     0,   581,     0,
2150        0,     0,   584,   585,   134,   135,   136,   137,   138,   139,
2151      140,   141,   142,   143,   144,   145,   146,   147,   148,   149,
2152      150,   151,   309,   310,    65,    66,     0,   117,    68,    69,
2153       70,    71,    72,    73,    74,    75,    76,    77,    78,    79,
2154       80,    20,     0,    21,     0,     0,     0,     0,     0,   311,
2155      158,   159,   160,   161,   162,   163,   164,   165,   166,   167,
2156      168,   169,     0,   312,   172,   173,   174,    81,   313,   314,
2157      315,     0,     0,     0,     0,     0,     0,     0,   316,     0,
2158        0,   317,     0,   318,    65,    66,   319,   117,   202,   203,
2159      204,   205,   206,   207,   208,   209,   210,   211,   212,    79,
2160       80,    20,     0,    21,     0,     0,     0,     0,     0,     0,
2161        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2162      338,   339,    65,    66,   340,     0,     0,    81,     0,     0,
2163        0,     0,     0,     0,     0,     0,     0,     0,     0,    20,
2164        0,    21,     0,   341,   342,   343,     0,     0,     0,     0,
2165        0,     0,     0,     0,     0,   344,   345,     0,     0,     0,
2166        0,     0,     0,     0,     0,     0,     0,     0,    82,     0,
2167        0,    83,     0,     0,    84,     0,    85,   118,   346,     0,
2168        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2169        0,     0,     0,     0,     0,   134,   135,   136,   137,   138,
2170      139,   140,   141,   142,   143,   144,   145,   146,   147,   148,
2171      149,   150,   151,   309,   310,     0,     0,     0,     0,     0,
2172        0,     0,     0,     0,     0,     0,     0,     0,    82,     0,
2173        0,    83,     0,     0,    84,     0,    85,   396,     0,     0,
2174      311,   158,   159,   160,   161,   162,   163,   164,   165,   166,
2175      167,   168,   169,     0,   312,   172,   173,   174,     0,   313,
2176      314,   315,   338,   339,     0,     0,   340,     0,     0,     0,
2177        0,     0,   347,     0,     0,     0,     0,     0,     0,     0,
2178        0,     0,     0,     0,     0,   341,   342,   343,     0,     0,
2179        0,     0,     0,     0,     0,     0,     0,   344,   345,     0,
2180        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2181        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2182      346,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2183        0,     0,     0,     0,     0,     0,     0,   134,   135,   136,
2184      137,   138,   139,   140,   141,   142,   143,   144,   145,   146,
2185      147,   148,   149,   150,   151,   309,   310,    65,    66,     0,
2186      117,   202,   203,   204,   205,   206,   207,   208,   209,   210,
2187      211,   212,    79,    80,    20,     0,    21,     0,     0,     0,
2188        0,     0,   311,   158,   159,   160,   161,   162,   163,   164,
2189      165,   166,   167,   168,   169,     0,   312,   172,   173,   174,
2190       81,   313,   314,   315,     0,     0,     0,     0,     0,     0,
2191        0,     0,    65,    66,   347,   117,    68,    69,    70,    71,
2192       72,    73,    74,    75,    76,    77,    78,    79,    80,    20,
2193        0,    21,     0,     0,     0,     0,     0,     0,     0,     0,
2194        0,     0,     0,     0,   223,     0,     0,     0,     0,     0,
2195        0,     0,     0,    65,    66,    81,   117,    68,    69,    70,
2196       71,    72,    73,    74,    75,    76,    77,    78,    79,    80,
2197       20,     0,    21,     0,     0,     0,     0,     0,     0,     0,
2198        0,     0,     0,     0,     0,   331,     0,     0,     0,     0,
2199        0,     0,     0,     0,     0,     0,    81,     0,     0,     0,
2200        0,    82,     0,     0,    83,     0,   392,    84,     0,    85,
2201       65,    66,     0,   117,    68,    69,    70,    71,    72,    73,
2202       74,    75,    76,    77,    78,    79,    80,    20,     0,    21,
2203        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2204        0,     0,   411,     0,     0,     0,     0,     0,     0,     0,
2205        0,     0,     0,    81,     0,     0,    82,     0,     0,    83,
2206        0,     0,    84,     0,    85,     0,    65,    66,     0,   117,
2207       68,    69,    70,    71,    72,    73,    74,    75,    76,    77,
2208       78,    79,    80,    20,     0,    21,     0,     0,     0,     0,
2209        0,     0,     0,     0,     0,     0,     0,    82,   462,     0,
2210       83,     0,     0,    84,     0,    85,     0,    65,    66,    81,
2211       67,    68,    69,    70,    71,    72,    73,    74,    75,    76,
2212       77,    78,    79,    80,    20,     0,    21,    65,    66,     0,
2213      117,    68,    69,    70,    71,    72,    73,    74,    75,    76,
2214       77,    78,    79,    80,    20,     0,    21,     0,     0,     0,
2215       81,     0,     0,     0,    82,     0,     0,    83,     0,     0,
2216       84,     0,    85,     0,     0,     0,     0,     0,    65,    66,
2217       81,   117,   202,   203,   204,   205,   206,   207,   208,   209,
2218      210,   211,   212,    79,    80,    20,     0,    21,    65,    66,
2219        0,   229,    68,    69,    70,    71,    72,    73,    74,    75,
2220       76,    77,    78,    79,    80,    20,     0,    21,     0,     0,
2221       82,    81,     0,    83,     0,     0,    84,     0,    85,     0,
2222        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2223        0,    81,     0,     0,     0,     0,     0,     0,     0,     0,
2224        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2225        0,    82,     0,     0,    83,     0,     0,    84,     0,    85,
2226        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2227        0,    82,     0,     0,    83,     0,     0,    84,     0,    85,
2228        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2229        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2230        0,     0,     0,     0,     0,   124,     0,     0,     0,     0,
2231        0,     0,    82,     0,     0,    83,     0,     0,    84,   125,
2232       85,     0,     0,     0,     0,     0,     0,     0,     0,   126,
2233      127,     0,    82,     0,     0,    83,     0,     0,    84,     0,
2234       85,     0,   128,   129,   130,   131,   132,   133,   134,   135,
2235      136,   137,   138,   139,   140,   141,   142,   143,   144,   145,
2236      146,   147,   148,   149,   150,   151,   152,   153,     0,     0,
2237        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2238        0,     0,     0,     0,     0,     0,     0,     0,   154,   155,
2239      156,     0,     0,   157,   158,   159,   160,   161,   162,   163,
2240      164,   165,   166,   167,   168,   169,   170,   171,   172,   173,
2241      174,   175,   176,   177,   178,   179,   180
2242 };
2243
2244 static const short int yycheck[] =
2245 {
2246       37,   125,    85,   130,   128,   130,     3,   274,    53,   131,
2247       34,   216,   297,   298,   539,    15,    53,    15,   112,   317,
2248      318,   226,    23,   558,     9,    29,   231,   232,     0,    30,
2249      148,   148,   156,    57,   559,   570,    21,   150,   243,   122,
2250      158,   158,   327,   154,    41,    61,   159,   171,   159,   347,
2251      148,   175,   176,   177,   178,   179,   180,    57,   156,    57,
2252      184,   185,   148,   148,    23,   187,    52,    53,    54,   154,
2253      156,   276,   109,   110,   111,    45,   156,    47,   148,   159,
2254      147,   286,   287,   288,   154,    71,    61,    22,   125,    24,
2255       87,   128,    10,    11,    12,    13,    14,    15,    16,    17,
2256       20,    32,    33,    10,    11,    12,    13,    14,    15,    16,
2257       17,    55,    56,    57,    55,    56,   147,   154,   155,   156,
2258      157,    41,    42,    43,    44,    45,    46,    47,   121,   122,
2259       50,    27,    28,   170,   171,   218,   219,   220,   175,   176,
2260      177,   178,   179,   180,   181,   182,   183,   184,   185,     0,
2261      355,   356,   357,   157,    24,     3,     4,   158,   363,     4,
2262      445,    10,    11,    12,    13,    14,    15,    16,    17,   293,
2263        3,     4,   377,   378,    25,     3,     4,     3,     4,   147,
2264       31,     3,     4,   147,   147,   222,   147,   152,   150,     4,
2265       41,    42,    43,    44,    45,    46,    47,     4,     4,   244,
2266      150,    24,     4,    24,    24,   153,   473,   244,   475,    59,
2267      153,    62,   150,     4,     7,   420,     4,   422,   255,     4,
2268        4,   426,    64,    65,    66,    67,    68,    69,    70,   434,
2269      435,   436,     7,     4,     7,   272,   154,    27,    28,   148,
2270      151,   365,   148,   367,   368,   369,   291,   154,   148,   152,
2271      148,   148,   376,   336,   291,   292,   293,   148,   148,   148,
2272      148,   148,   148,   468,   469,   148,   471,   472,    36,    24,
2273      148,   150,    24,   478,   150,   150,   150,   150,   150,   150,
2274      148,   150,   487,   150,   150,    63,   151,   148,   148,   148,
2275      152,   231,   232,   387,   388,   389,   390,   391,   150,    34,
2276       24,   148,   148,   243,   148,   399,   400,   401,   402,   403,
2277      148,   150,    21,   518,   104,   105,   106,   107,   108,   109,
2278      110,   111,   112,   113,   114,   115,   116,   117,   365,   366,
2279      367,   368,   369,   370,   371,   332,   276,    21,   375,   376,
2280      150,     4,   150,   148,   148,   148,   286,   287,   288,   148,
2281      148,   556,   446,   447,   148,    24,   480,   481,   482,   453,
2282        4,   148,   148,    36,    57,   148,   571,   148,   148,   148,
2283        4,   148,   409,   578,   148,   151,   148,   582,   583,   148,
2284       57,   148,   148,   148,   148,    24,   423,   148,    21,   152,
2285       36,   151,   516,   151,   148,   154,    21,   148,   151,   148,
2286      494,   495,   496,   497,   441,   499,   500,   501,   151,   503,
2287      151,   151,   539,   151,   539,   355,   356,   357,   151,   151,
2288      154,   151,   151,   363,   151,   151,   148,    21,   148,    76,
2289      524,   525,   559,   470,   559,    21,    21,   377,   378,    97,
2290       97,    97,    97,   480,   481,   482,    20,    97,    22,   486,
2291       24,   309,    41,   547,   310,   549,   550,    31,    32,    33,
2292       25,   410,   122,   409,    52,   502,   216,    41,    42,    43,
2293       44,    45,    46,    47,    61,     3,    50,    51,    19,   516,
2294      420,   423,   422,   486,    58,    -1,   426,    -1,    62,    -1,
2295      448,    -1,    -1,    -1,   434,   435,   436,    98,    99,   100,
2296      101,   102,   103,   104,   105,   106,   107,    -1,    -1,    -1,
2297       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2298       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   468,   469,
2299       -1,   471,   472,    -1,    -1,    -1,    -1,    -1,   478,    -1,
2300       -1,    -1,    -1,    -1,    -1,    -1,    -1,   487,    -1,    -1,
2301       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2302       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2303       -1,     5,     6,    -1,    -1,    -1,    -1,    -1,   518,    -1,
2304       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    22,    -1,
2305       24,    -1,    26,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2306       -1,    -1,    -1,    -1,    38,    39,    -1,    -1,    -1,    -1,
2307       -1,    -1,    -1,    -1,    -1,    -1,   556,    -1,    -1,    -1,
2308       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2309       -1,   571,    -1,    -1,    -1,    -1,    -1,    -1,   578,    -1,
2310       -1,    -1,   582,   583,    78,    79,    80,    81,    82,    83,
2311       84,    85,    86,    87,    88,    89,    90,    91,    92,    93,
2312       94,    95,    96,    97,     5,     6,    -1,     8,     9,    10,
2313       11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
2314       21,    22,    -1,    24,    -1,    -1,    -1,    -1,    -1,   123,
2315      124,   125,   126,   127,   128,   129,   130,   131,   132,   133,
2316      134,   135,    -1,   137,   138,   139,   140,    48,   142,   143,
2317      144,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   152,    -1,
2318       -1,   155,    -1,   157,     5,     6,   160,     8,     9,    10,
2319       11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
2320       21,    22,    -1,    24,    -1,    -1,    -1,    -1,    -1,    -1,
2321       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2322        3,     4,     5,     6,     7,    -1,    -1,    48,    -1,    -1,
2323       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    22,
2324       -1,    24,    -1,    26,    27,    28,    -1,    -1,    -1,    -1,
2325       -1,    -1,    -1,    -1,    -1,    38,    39,    -1,    -1,    -1,
2326       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   149,    -1,
2327       -1,   152,    -1,    -1,   155,    -1,   157,   158,    61,    -1,
2328       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2329       -1,    -1,    -1,    -1,    -1,    78,    79,    80,    81,    82,
2330       83,    84,    85,    86,    87,    88,    89,    90,    91,    92,
2331       93,    94,    95,    96,    97,    -1,    -1,    -1,    -1,    -1,
2332       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   149,    -1,
2333       -1,   152,    -1,    -1,   155,    -1,   157,   158,    -1,    -1,
2334      123,   124,   125,   126,   127,   128,   129,   130,   131,   132,
2335      133,   134,   135,    -1,   137,   138,   139,   140,    -1,   142,
2336      143,   144,     3,     4,    -1,    -1,     7,    -1,    -1,    -1,
2337       -1,    -1,   155,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2338       -1,    -1,    -1,    -1,    -1,    26,    27,    28,    -1,    -1,
2339       -1,    -1,    -1,    -1,    -1,    -1,    -1,    38,    39,    -1,
2340       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2341       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2342       61,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2343       -1,    -1,    -1,    -1,    -1,    -1,    -1,    78,    79,    80,
2344       81,    82,    83,    84,    85,    86,    87,    88,    89,    90,
2345       91,    92,    93,    94,    95,    96,    97,     5,     6,    -1,
2346        8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
2347       18,    19,    20,    21,    22,    -1,    24,    -1,    -1,    -1,
2348       -1,    -1,   123,   124,   125,   126,   127,   128,   129,   130,
2349      131,   132,   133,   134,   135,    -1,   137,   138,   139,   140,
2350       48,   142,   143,   144,    -1,    -1,    -1,    -1,    -1,    -1,
2351       -1,    -1,     5,     6,   155,     8,     9,    10,    11,    12,
2352       13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
2353       -1,    24,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2354       -1,    -1,    -1,    -1,    37,    -1,    -1,    -1,    -1,    -1,
2355       -1,    -1,    -1,     5,     6,    48,     8,     9,    10,    11,
2356       12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
2357       22,    -1,    24,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2358       -1,    -1,    -1,    -1,    -1,    37,    -1,    -1,    -1,    -1,
2359       -1,    -1,    -1,    -1,    -1,    -1,    48,    -1,    -1,    -1,
2360       -1,   149,    -1,    -1,   152,    -1,   154,   155,    -1,   157,
2361        5,     6,    -1,     8,     9,    10,    11,    12,    13,    14,
2362       15,    16,    17,    18,    19,    20,    21,    22,    -1,    24,
2363       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2364       -1,    -1,    37,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2365       -1,    -1,    -1,    48,    -1,    -1,   149,    -1,    -1,   152,
2366       -1,    -1,   155,    -1,   157,    -1,     5,     6,    -1,     8,
2367        9,    10,    11,    12,    13,    14,    15,    16,    17,    18,
2368       19,    20,    21,    22,    -1,    24,    -1,    -1,    -1,    -1,
2369       -1,    -1,    -1,    -1,    -1,    -1,    -1,   149,    37,    -1,
2370      152,    -1,    -1,   155,    -1,   157,    -1,     5,     6,    48,
2371        8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
2372       18,    19,    20,    21,    22,    -1,    24,     5,     6,    -1,
2373        8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
2374       18,    19,    20,    21,    22,    -1,    24,    -1,    -1,    -1,
2375       48,    -1,    -1,    -1,   149,    -1,    -1,   152,    -1,    -1,
2376      155,    -1,   157,    -1,    -1,    -1,    -1,    -1,     5,     6,
2377       48,     8,     9,    10,    11,    12,    13,    14,    15,    16,
2378       17,    18,    19,    20,    21,    22,    -1,    24,     5,     6,
2379       -1,     8,     9,    10,    11,    12,    13,    14,    15,    16,
2380       17,    18,    19,    20,    21,    22,    -1,    24,    -1,    -1,
2381      149,    48,    -1,   152,    -1,    -1,   155,    -1,   157,    -1,
2382       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2383       -1,    48,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2384       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2385       -1,   149,    -1,    -1,   152,    -1,    -1,   155,    -1,   157,
2386       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2387       -1,   149,    -1,    -1,   152,    -1,    -1,   155,    -1,   157,
2388       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2389       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2390       -1,    -1,    -1,    -1,    -1,    35,    -1,    -1,    -1,    -1,
2391       -1,    -1,   149,    -1,    -1,   152,    -1,    -1,   155,    49,
2392      157,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    59,
2393       60,    -1,   149,    -1,    -1,   152,    -1,    -1,   155,    -1,
2394      157,    -1,    72,    73,    74,    75,    76,    77,    78,    79,
2395       80,    81,    82,    83,    84,    85,    86,    87,    88,    89,
2396       90,    91,    92,    93,    94,    95,    96,    97,    -1,    -1,
2397       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2398       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   118,   119,
2399      120,    -1,    -1,   123,   124,   125,   126,   127,   128,   129,
2400      130,   131,   132,   133,   134,   135,   136,   137,   138,   139,
2401      140,   141,   142,   143,   144,   145,   146
2402 };
2403
2404 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2405    symbol of state STATE-NUM.  */
2406 static const unsigned char yystos[] =
2407 {
2408        0,   195,   196,   197,     0,    25,    31,    41,    42,    43,
2409       44,    45,    46,    47,    62,   176,   214,   216,   218,   225,
2410       22,    24,    51,    58,    62,   175,   207,   218,   219,    61,
2411       64,    65,    66,    67,    68,    69,    70,   177,   212,    23,
2412      226,   227,    30,   158,   215,   226,    52,    53,    54,    71,
2413      204,   147,    61,    20,    45,    47,    50,   176,   147,    45,
2414       47,   217,    24,   202,     4,     5,     6,     8,     9,    10,
2415       11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
2416       21,    48,   149,   152,   155,   157,   162,   184,   185,   186,
2417      187,   188,   207,   222,    29,   157,   213,   175,   230,   147,
2418      147,   147,   147,   152,   205,   202,   184,    32,    33,   194,
2419      194,   194,   194,   212,     4,     4,     4,     8,   158,   188,
2420      189,   207,   150,   159,    35,    49,    59,    60,    72,    73,
2421       74,    75,    76,    77,    78,    79,    80,    81,    82,    83,
2422       84,    85,    86,    87,    88,    89,    90,    91,    92,    93,
2423       94,    95,    96,    97,   118,   119,   120,   123,   124,   125,
2424      126,   127,   128,   129,   130,   131,   132,   133,   134,   135,
2425      136,   137,   138,   139,   140,   141,   142,   143,   144,   145,
2426      146,   164,   165,   166,   167,   168,   228,   234,   235,   237,
2427      238,    24,    55,    56,   203,     4,    24,    24,   206,   186,
2428      186,   186,     9,    10,    11,    12,    13,    14,    15,    16,
2429       17,    18,    19,   171,   172,   174,   186,   191,   153,   153,
2430      148,   158,   150,    37,   189,   190,   186,   224,    59,     8,
2431      224,     9,    21,    10,    11,    12,    13,    14,    15,    16,
2432       17,   171,   172,   173,   177,    98,    99,   100,   101,   102,
2433      103,   104,   105,   106,   107,   169,    27,    28,   104,   105,
2434      106,   107,   108,   109,   110,   111,   112,   113,   114,   115,
2435      116,   117,   170,   186,   186,   224,   186,   186,   231,   224,
2436      224,   224,   224,   224,   224,   224,   186,   186,   186,   224,
2437      224,   177,   121,   122,   148,   154,   200,   201,   199,    27,
2438       28,     3,     4,   163,     4,     7,    26,    38,    39,    96,
2439       97,   123,   137,   142,   143,   144,   152,   155,   157,   160,
2440      164,   165,   166,   167,   168,   192,   222,   198,   188,   188,
2441      188,    37,   186,   209,   210,   211,   148,   151,     3,     4,
2442        7,    26,    27,    28,    38,    39,    61,   155,   192,   221,
2443      222,   223,   223,   223,   223,   184,   186,   186,   148,   179,
2444      148,   179,   223,   152,   148,   148,   148,   148,   148,   148,
2445      148,   148,   223,   223,   223,    36,   148,   184,   186,   224,
2446       24,   148,   182,   182,   182,   169,   170,   150,   150,   150,
2447      150,   150,   154,   191,   193,   193,   158,   193,    24,   150,
2448      150,   150,   150,   150,   182,   154,   156,   207,   208,   148,
2449      151,    37,    63,   220,   193,   148,   148,   223,   223,   223,
2450       15,    57,    15,   148,   236,   223,   152,   224,   186,   224,
2451      224,   224,   186,   186,   148,   148,   148,   186,   224,   223,
2452      223,   148,    34,    57,   180,   183,   150,   150,   191,   191,
2453      191,   191,   191,   148,   154,   156,   158,   191,   191,   191,
2454      191,   191,    37,   209,   180,   181,    24,   156,    21,    21,
2455      150,   148,   148,   223,     4,   223,   224,   232,   148,   223,
2456      148,   148,   148,   223,   223,   223,   150,   186,    24,     4,
2457      182,   191,   191,   236,   148,   148,   148,   148,   191,   148,
2458      148,   148,    36,   148,    57,   178,   148,   223,   223,   232,
2459      233,   223,   223,   148,   179,   179,   148,   223,   148,   224,
2460      224,   224,   233,   223,   148,   148,   151,   191,   191,   191,
2461      191,   191,   191,   191,   186,   191,     4,    24,   148,   152,
2462      151,   224,   154,   223,   151,   191,   191,   148,   151,   148,
2463      148,   151,   151,   151,   151,   151,    21,   154,   173,   229,
2464       36,   154,   151,   151,   191,   191,   191,   223,   221,   154,
2465      173,    21,   151,   151,   151,   148,   221,   223,    21,   148,
2466       76,   223,    21,    21,   223,   223
2467 };
2468
2469 #define yyerrok         (yyerrstatus = 0)
2470 #define yyclearin       (yychar = YYEMPTY)
2471 #define YYEMPTY         (-2)
2472 #define YYEOF           0
2473
2474 #define YYACCEPT        goto yyacceptlab
2475 #define YYABORT         goto yyabortlab
2476 #define YYERROR         goto yyerrorlab
2477
2478
2479 /* Like YYERROR except do call yyerror.  This remains here temporarily
2480    to ease the transition to the new meaning of YYERROR, for GCC.
2481    Once GCC version 2 has supplanted version 1, this can go.  */
2482
2483 #define YYFAIL          goto yyerrlab
2484
2485 #define YYRECOVERING()  (!!yyerrstatus)
2486
2487 #define YYBACKUP(Token, Value)                                  \
2488 do                                                              \
2489   if (yychar == YYEMPTY && yylen == 1)                          \
2490     {                                                           \
2491       yychar = (Token);                                         \
2492       yylval = (Value);                                         \
2493       yytoken = YYTRANSLATE (yychar);                           \
2494       YYPOPSTACK;                                               \
2495       goto yybackup;                                            \
2496     }                                                           \
2497   else                                                          \
2498     {                                                           \
2499       yyerror (YY_("syntax error: cannot back up")); \
2500       YYERROR;                                                  \
2501     }                                                           \
2502 while (0)
2503
2504
2505 #define YYTERROR        1
2506 #define YYERRCODE       256
2507
2508
2509 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2510    If N is 0, then set CURRENT to the empty location which ends
2511    the previous symbol: RHS[0] (always defined).  */
2512
2513 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2514 #ifndef YYLLOC_DEFAULT
2515 # define YYLLOC_DEFAULT(Current, Rhs, N)                                \
2516     do                                                                  \
2517       if (N)                                                            \
2518         {                                                               \
2519           (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
2520           (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
2521           (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
2522           (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
2523         }                                                               \
2524       else                                                              \
2525         {                                                               \
2526           (Current).first_line   = (Current).last_line   =              \
2527             YYRHSLOC (Rhs, 0).last_line;                                \
2528           (Current).first_column = (Current).last_column =              \
2529             YYRHSLOC (Rhs, 0).last_column;                              \
2530         }                                                               \
2531     while (0)
2532 #endif
2533
2534
2535 /* YY_LOCATION_PRINT -- Print the location on the stream.
2536    This macro was not mandated originally: define only if we know
2537    we won't break user code: when these are the locations we know.  */
2538
2539 #ifndef YY_LOCATION_PRINT
2540 # if YYLTYPE_IS_TRIVIAL
2541 #  define YY_LOCATION_PRINT(File, Loc)                  \
2542      fprintf (File, "%d.%d-%d.%d",                      \
2543               (Loc).first_line, (Loc).first_column,     \
2544               (Loc).last_line,  (Loc).last_column)
2545 # else
2546 #  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2547 # endif
2548 #endif
2549
2550
2551 /* YYLEX -- calling `yylex' with the right arguments.  */
2552
2553 #ifdef YYLEX_PARAM
2554 # define YYLEX yylex (YYLEX_PARAM)
2555 #else
2556 # define YYLEX yylex ()
2557 #endif
2558
2559 /* Enable debugging if requested.  */
2560 #if YYDEBUG
2561
2562 # ifndef YYFPRINTF
2563 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2564 #  define YYFPRINTF fprintf
2565 # endif
2566
2567 # define YYDPRINTF(Args)                        \
2568 do {                                            \
2569   if (yydebug)                                  \
2570     YYFPRINTF Args;                             \
2571 } while (0)
2572
2573 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)          \
2574 do {                                                            \
2575   if (yydebug)                                                  \
2576     {                                                           \
2577       YYFPRINTF (stderr, "%s ", Title);                         \
2578       yysymprint (stderr,                                       \
2579                   Type, Value); \
2580       YYFPRINTF (stderr, "\n");                                 \
2581     }                                                           \
2582 } while (0)
2583
2584 /*------------------------------------------------------------------.
2585 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2586 | TOP (included).                                                   |
2587 `------------------------------------------------------------------*/
2588
2589 #if defined (__STDC__) || defined (__cplusplus)
2590 static void
2591 yy_stack_print (short int *bottom, short int *top)
2592 #else
2593 static void
2594 yy_stack_print (bottom, top)
2595     short int *bottom;
2596     short int *top;
2597 #endif
2598 {
2599   YYFPRINTF (stderr, "Stack now");
2600   for (/* Nothing. */; bottom <= top; ++bottom)
2601     YYFPRINTF (stderr, " %d", *bottom);
2602   YYFPRINTF (stderr, "\n");
2603 }
2604
2605 # define YY_STACK_PRINT(Bottom, Top)                            \
2606 do {                                                            \
2607   if (yydebug)                                                  \
2608     yy_stack_print ((Bottom), (Top));                           \
2609 } while (0)
2610
2611
2612 /*------------------------------------------------.
2613 | Report that the YYRULE is going to be reduced.  |
2614 `------------------------------------------------*/
2615
2616 #if defined (__STDC__) || defined (__cplusplus)
2617 static void
2618 yy_reduce_print (int yyrule)
2619 #else
2620 static void
2621 yy_reduce_print (yyrule)
2622     int yyrule;
2623 #endif
2624 {
2625   int yyi;
2626   unsigned long int yylno = yyrline[yyrule];
2627   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
2628              yyrule - 1, yylno);
2629   /* Print the symbols being reduced, and their result.  */
2630   for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2631     YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2632   YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
2633 }
2634
2635 # define YY_REDUCE_PRINT(Rule)          \
2636 do {                                    \
2637   if (yydebug)                          \
2638     yy_reduce_print (Rule);             \
2639 } while (0)
2640
2641 /* Nonzero means print parse trace.  It is left uninitialized so that
2642    multiple parsers can coexist.  */
2643 int yydebug;
2644 #else /* !YYDEBUG */
2645 # define YYDPRINTF(Args)
2646 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2647 # define YY_STACK_PRINT(Bottom, Top)
2648 # define YY_REDUCE_PRINT(Rule)
2649 #endif /* !YYDEBUG */
2650
2651
2652 /* YYINITDEPTH -- initial size of the parser's stacks.  */
2653 #ifndef YYINITDEPTH
2654 # define YYINITDEPTH 200
2655 #endif
2656
2657 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2658    if the built-in stack extension method is used).
2659
2660    Do not make this value too large; the results are undefined if
2661    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2662    evaluated with infinite-precision integer arithmetic.  */
2663
2664 #ifndef YYMAXDEPTH
2665 # define YYMAXDEPTH 10000
2666 #endif
2667
2668 \f
2669
2670 #if YYERROR_VERBOSE
2671
2672 # ifndef yystrlen
2673 #  if defined (__GLIBC__) && defined (_STRING_H)
2674 #   define yystrlen strlen
2675 #  else
2676 /* Return the length of YYSTR.  */
2677 static YYSIZE_T
2678 #   if defined (__STDC__) || defined (__cplusplus)
2679 yystrlen (const char *yystr)
2680 #   else
2681 yystrlen (yystr)
2682      const char *yystr;
2683 #   endif
2684 {
2685   const char *yys = yystr;
2686
2687   while (*yys++ != '\0')
2688     continue;
2689
2690   return yys - yystr - 1;
2691 }
2692 #  endif
2693 # endif
2694
2695 # ifndef yystpcpy
2696 #  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2697 #   define yystpcpy stpcpy
2698 #  else
2699 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2700    YYDEST.  */
2701 static char *
2702 #   if defined (__STDC__) || defined (__cplusplus)
2703 yystpcpy (char *yydest, const char *yysrc)
2704 #   else
2705 yystpcpy (yydest, yysrc)
2706      char *yydest;
2707      const char *yysrc;
2708 #   endif
2709 {
2710   char *yyd = yydest;
2711   const char *yys = yysrc;
2712
2713   while ((*yyd++ = *yys++) != '\0')
2714     continue;
2715
2716   return yyd - 1;
2717 }
2718 #  endif
2719 # endif
2720
2721 # ifndef yytnamerr
2722 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2723    quotes and backslashes, so that it's suitable for yyerror.  The
2724    heuristic is that double-quoting is unnecessary unless the string
2725    contains an apostrophe, a comma, or backslash (other than
2726    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
2727    null, do not copy; instead, return the length of what the result
2728    would have been.  */
2729 static YYSIZE_T
2730 yytnamerr (char *yyres, const char *yystr)
2731 {
2732   if (*yystr == '"')
2733     {
2734       size_t yyn = 0;
2735       char const *yyp = yystr;
2736
2737       for (;;)
2738         switch (*++yyp)
2739           {
2740           case '\'':
2741           case ',':
2742             goto do_not_strip_quotes;
2743
2744           case '\\':
2745             if (*++yyp != '\\')
2746               goto do_not_strip_quotes;
2747             /* Fall through.  */
2748           default:
2749             if (yyres)
2750               yyres[yyn] = *yyp;
2751             yyn++;
2752             break;
2753
2754           case '"':
2755             if (yyres)
2756               yyres[yyn] = '\0';
2757             return yyn;
2758           }
2759     do_not_strip_quotes: ;
2760     }
2761
2762   if (! yyres)
2763     return yystrlen (yystr);
2764
2765   return yystpcpy (yyres, yystr) - yyres;
2766 }
2767 # endif
2768
2769 #endif /* YYERROR_VERBOSE */
2770
2771 \f
2772
2773 #if YYDEBUG
2774 /*--------------------------------.
2775 | Print this symbol on YYOUTPUT.  |
2776 `--------------------------------*/
2777
2778 #if defined (__STDC__) || defined (__cplusplus)
2779 static void
2780 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
2781 #else
2782 static void
2783 yysymprint (yyoutput, yytype, yyvaluep)
2784     FILE *yyoutput;
2785     int yytype;
2786     YYSTYPE *yyvaluep;
2787 #endif
2788 {
2789   /* Pacify ``unused variable'' warnings.  */
2790   (void) yyvaluep;
2791
2792   if (yytype < YYNTOKENS)
2793     YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2794   else
2795     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2796
2797
2798 # ifdef YYPRINT
2799   if (yytype < YYNTOKENS)
2800     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2801 # endif
2802   switch (yytype)
2803     {
2804       default:
2805         break;
2806     }
2807   YYFPRINTF (yyoutput, ")");
2808 }
2809
2810 #endif /* ! YYDEBUG */
2811 /*-----------------------------------------------.
2812 | Release the memory associated to this symbol.  |
2813 `-----------------------------------------------*/
2814
2815 #if defined (__STDC__) || defined (__cplusplus)
2816 static void
2817 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
2818 #else
2819 static void
2820 yydestruct (yymsg, yytype, yyvaluep)
2821     const char *yymsg;
2822     int yytype;
2823     YYSTYPE *yyvaluep;
2824 #endif
2825 {
2826   /* Pacify ``unused variable'' warnings.  */
2827   (void) yyvaluep;
2828
2829   if (!yymsg)
2830     yymsg = "Deleting";
2831   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2832
2833   switch (yytype)
2834     {
2835
2836       default:
2837         break;
2838     }
2839 }
2840 \f
2841
2842 /* Prevent warnings from -Wmissing-prototypes.  */
2843
2844 #ifdef YYPARSE_PARAM
2845 # if defined (__STDC__) || defined (__cplusplus)
2846 int yyparse (void *YYPARSE_PARAM);
2847 # else
2848 int yyparse ();
2849 # endif
2850 #else /* ! YYPARSE_PARAM */
2851 #if defined (__STDC__) || defined (__cplusplus)
2852 int yyparse (void);
2853 #else
2854 int yyparse ();
2855 #endif
2856 #endif /* ! YYPARSE_PARAM */
2857
2858
2859
2860 /* The look-ahead symbol.  */
2861 int yychar;
2862
2863 /* The semantic value of the look-ahead symbol.  */
2864 YYSTYPE yylval;
2865
2866 /* Number of syntax errors so far.  */
2867 int yynerrs;
2868
2869
2870
2871 /*----------.
2872 | yyparse.  |
2873 `----------*/
2874
2875 #ifdef YYPARSE_PARAM
2876 # if defined (__STDC__) || defined (__cplusplus)
2877 int yyparse (void *YYPARSE_PARAM)
2878 # else
2879 int yyparse (YYPARSE_PARAM)
2880   void *YYPARSE_PARAM;
2881 # endif
2882 #else /* ! YYPARSE_PARAM */
2883 #if defined (__STDC__) || defined (__cplusplus)
2884 int
2885 yyparse (void)
2886 #else
2887 int
2888 yyparse ()
2889
2890 #endif
2891 #endif
2892 {
2893   
2894   int yystate;
2895   int yyn;
2896   int yyresult;
2897   /* Number of tokens to shift before error messages enabled.  */
2898   int yyerrstatus;
2899   /* Look-ahead token as an internal (translated) token number.  */
2900   int yytoken = 0;
2901
2902   /* Three stacks and their tools:
2903      `yyss': related to states,
2904      `yyvs': related to semantic values,
2905      `yyls': related to locations.
2906
2907      Refer to the stacks thru separate pointers, to allow yyoverflow
2908      to reallocate them elsewhere.  */
2909
2910   /* The state stack.  */
2911   short int yyssa[YYINITDEPTH];
2912   short int *yyss = yyssa;
2913   short int *yyssp;
2914
2915   /* The semantic value stack.  */
2916   YYSTYPE yyvsa[YYINITDEPTH];
2917   YYSTYPE *yyvs = yyvsa;
2918   YYSTYPE *yyvsp;
2919
2920
2921
2922 #define YYPOPSTACK   (yyvsp--, yyssp--)
2923
2924   YYSIZE_T yystacksize = YYINITDEPTH;
2925
2926   /* The variables used to return semantic value and location from the
2927      action routines.  */
2928   YYSTYPE yyval;
2929
2930
2931   /* When reducing, the number of symbols on the RHS of the reduced
2932      rule.  */
2933   int yylen;
2934
2935   YYDPRINTF ((stderr, "Starting parse\n"));
2936
2937   yystate = 0;
2938   yyerrstatus = 0;
2939   yynerrs = 0;
2940   yychar = YYEMPTY;             /* Cause a token to be read.  */
2941
2942   /* Initialize stack pointers.
2943      Waste one element of value and location stack
2944      so that they stay on the same level as the state stack.
2945      The wasted elements are never initialized.  */
2946
2947   yyssp = yyss;
2948   yyvsp = yyvs;
2949
2950   goto yysetstate;
2951
2952 /*------------------------------------------------------------.
2953 | yynewstate -- Push a new state, which is found in yystate.  |
2954 `------------------------------------------------------------*/
2955  yynewstate:
2956   /* In all cases, when you get here, the value and location stacks
2957      have just been pushed. so pushing a state here evens the stacks.
2958      */
2959   yyssp++;
2960
2961  yysetstate:
2962   *yyssp = yystate;
2963
2964   if (yyss + yystacksize - 1 <= yyssp)
2965     {
2966       /* Get the current used size of the three stacks, in elements.  */
2967       YYSIZE_T yysize = yyssp - yyss + 1;
2968
2969 #ifdef yyoverflow
2970       {
2971         /* Give user a chance to reallocate the stack. Use copies of
2972            these so that the &'s don't force the real ones into
2973            memory.  */
2974         YYSTYPE *yyvs1 = yyvs;
2975         short int *yyss1 = yyss;
2976
2977
2978         /* Each stack pointer address is followed by the size of the
2979            data in use in that stack, in bytes.  This used to be a
2980            conditional around just the two extra args, but that might
2981            be undefined if yyoverflow is a macro.  */
2982         yyoverflow (YY_("memory exhausted"),
2983                     &yyss1, yysize * sizeof (*yyssp),
2984                     &yyvs1, yysize * sizeof (*yyvsp),
2985
2986                     &yystacksize);
2987
2988         yyss = yyss1;
2989         yyvs = yyvs1;
2990       }
2991 #else /* no yyoverflow */
2992 # ifndef YYSTACK_RELOCATE
2993       goto yyexhaustedlab;
2994 # else
2995       /* Extend the stack our own way.  */
2996       if (YYMAXDEPTH <= yystacksize)
2997         goto yyexhaustedlab;
2998       yystacksize *= 2;
2999       if (YYMAXDEPTH < yystacksize)
3000         yystacksize = YYMAXDEPTH;
3001
3002       {
3003         short int *yyss1 = yyss;
3004         union yyalloc *yyptr =
3005           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3006         if (! yyptr)
3007           goto yyexhaustedlab;
3008         YYSTACK_RELOCATE (yyss);
3009         YYSTACK_RELOCATE (yyvs);
3010
3011 #  undef YYSTACK_RELOCATE
3012         if (yyss1 != yyssa)
3013           YYSTACK_FREE (yyss1);
3014       }
3015 # endif
3016 #endif /* no yyoverflow */
3017
3018       yyssp = yyss + yysize - 1;
3019       yyvsp = yyvs + yysize - 1;
3020
3021
3022       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3023                   (unsigned long int) yystacksize));
3024
3025       if (yyss + yystacksize - 1 <= yyssp)
3026         YYABORT;
3027     }
3028
3029   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
3030
3031   goto yybackup;
3032
3033 /*-----------.
3034 | yybackup.  |
3035 `-----------*/
3036 yybackup:
3037
3038 /* Do appropriate processing given the current state.  */
3039 /* Read a look-ahead token if we need one and don't already have one.  */
3040 /* yyresume: */
3041
3042   /* First try to decide what to do without reference to look-ahead token.  */
3043
3044   yyn = yypact[yystate];
3045   if (yyn == YYPACT_NINF)
3046     goto yydefault;
3047
3048   /* Not known => get a look-ahead token if don't already have one.  */
3049
3050   /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
3051   if (yychar == YYEMPTY)
3052     {
3053       YYDPRINTF ((stderr, "Reading a token: "));
3054       yychar = YYLEX;
3055     }
3056
3057   if (yychar <= YYEOF)
3058     {
3059       yychar = yytoken = YYEOF;
3060       YYDPRINTF ((stderr, "Now at end of input.\n"));
3061     }
3062   else
3063     {
3064       yytoken = YYTRANSLATE (yychar);
3065       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
3066     }
3067
3068   /* If the proper action on seeing token YYTOKEN is to reduce or to
3069      detect an error, take that action.  */
3070   yyn += yytoken;
3071   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
3072     goto yydefault;
3073   yyn = yytable[yyn];
3074   if (yyn <= 0)
3075     {
3076       if (yyn == 0 || yyn == YYTABLE_NINF)
3077         goto yyerrlab;
3078       yyn = -yyn;
3079       goto yyreduce;
3080     }
3081
3082   if (yyn == YYFINAL)
3083     YYACCEPT;
3084
3085   /* Shift the look-ahead token.  */
3086   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3087
3088   /* Discard the token being shifted unless it is eof.  */
3089   if (yychar != YYEOF)
3090     yychar = YYEMPTY;
3091
3092   *++yyvsp = yylval;
3093
3094
3095   /* Count tokens shifted since error; after three, turn off error
3096      status.  */
3097   if (yyerrstatus)
3098     yyerrstatus--;
3099
3100   yystate = yyn;
3101   goto yynewstate;
3102
3103
3104 /*-----------------------------------------------------------.
3105 | yydefault -- do the default action for the current state.  |
3106 `-----------------------------------------------------------*/
3107 yydefault:
3108   yyn = yydefact[yystate];
3109   if (yyn == 0)
3110     goto yyerrlab;
3111   goto yyreduce;
3112
3113
3114 /*-----------------------------.
3115 | yyreduce -- Do a reduction.  |
3116 `-----------------------------*/
3117 yyreduce:
3118   /* yyn is the number of a rule to reduce with.  */
3119   yylen = yyr2[yyn];
3120
3121   /* If YYLEN is nonzero, implement the default value of the action:
3122      `$$ = $1'.
3123
3124      Otherwise, the following line sets YYVAL to garbage.
3125      This behavior is undocumented and Bison
3126      users should not rely upon it.  Assigning to YYVAL
3127      unconditionally makes the parser a bit smaller, and it avoids a
3128      GCC warning that YYVAL may be used uninitialized.  */
3129   yyval = yyvsp[1-yylen];
3130
3131
3132   YY_REDUCE_PRINT (yyn);
3133   switch (yyn)
3134     {
3135         case 3:
3136 #line 1104 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3137     {
3138   if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX)     // Outside of my range!
3139     GEN_ERROR("Value too large for type!");
3140   (yyval.SIntVal) = (int32_t)(yyvsp[0].UIntVal);
3141   CHECK_FOR_ERROR
3142 ;}
3143     break;
3144
3145   case 5:
3146 #line 1113 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3147     {
3148   if ((yyvsp[0].UInt64Val) > (uint64_t)INT64_MAX)     // Outside of my range!
3149     GEN_ERROR("Value too large for type!");
3150   (yyval.SInt64Val) = (int64_t)(yyvsp[0].UInt64Val);
3151   CHECK_FOR_ERROR
3152 ;}
3153     break;
3154
3155   case 39:
3156 #line 1130 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3157     { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3158     break;
3159
3160   case 40:
3161 #line 1130 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3162     { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3163     break;
3164
3165   case 41:
3166 #line 1131 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3167     { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3168     break;
3169
3170   case 42:
3171 #line 1131 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3172     { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3173     break;
3174
3175   case 43:
3176 #line 1132 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3177     { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3178     break;
3179
3180   case 44:
3181 #line 1132 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3182     { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3183     break;
3184
3185   case 45:
3186 #line 1133 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3187     { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3188     break;
3189
3190   case 46:
3191 #line 1133 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3192     { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3193     break;
3194
3195   case 47:
3196 #line 1134 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3197     { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3198     break;
3199
3200   case 48:
3201 #line 1134 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3202     { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3203     break;
3204
3205   case 49:
3206 #line 1138 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3207     { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3208     break;
3209
3210   case 50:
3211 #line 1138 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3212     { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3213     break;
3214
3215   case 51:
3216 #line 1139 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3217     { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3218     break;
3219
3220   case 52:
3221 #line 1139 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3222     { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3223     break;
3224
3225   case 53:
3226 #line 1140 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3227     { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3228     break;
3229
3230   case 54:
3231 #line 1140 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3232     { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3233     break;
3234
3235   case 55:
3236 #line 1141 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3237     { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3238     break;
3239
3240   case 56:
3241 #line 1141 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3242     { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3243     break;
3244
3245   case 57:
3246 #line 1142 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3247     { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3248     break;
3249
3250   case 58:
3251 #line 1142 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3252     { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3253     break;
3254
3255   case 59:
3256 #line 1143 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3257     { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3258     break;
3259
3260   case 60:
3261 #line 1143 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3262     { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3263     break;
3264
3265   case 61:
3266 #line 1144 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3267     { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3268     break;
3269
3270   case 62:
3271 #line 1144 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3272     { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3273     break;
3274
3275   case 63:
3276 #line 1145 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3277     { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3278     break;
3279
3280   case 64:
3281 #line 1146 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3282     { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3283     break;
3284
3285   case 77:
3286 #line 1157 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3287     {
3288     (yyval.StrVal) = (yyvsp[-1].StrVal);
3289     CHECK_FOR_ERROR
3290   ;}
3291     break;
3292
3293   case 78:
3294 #line 1161 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3295     {
3296     (yyval.StrVal) = 0;
3297     CHECK_FOR_ERROR
3298   ;}
3299     break;
3300
3301   case 79:
3302 #line 1166 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3303     { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3304     break;
3305
3306   case 80:
3307 #line 1167 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3308     { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3309     break;
3310
3311   case 81:
3312 #line 1168 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3313     { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3314     break;
3315
3316   case 82:
3317 #line 1169 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3318     { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3319     break;
3320
3321   case 83:
3322 #line 1170 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3323     { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3324     break;
3325
3326   case 84:
3327 #line 1171 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3328     { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3329     break;
3330
3331   case 85:
3332 #line 1172 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3333     { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3334     break;
3335
3336   case 86:
3337 #line 1173 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3338     { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3339     break;
3340
3341   case 87:
3342 #line 1175 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3343     { (yyval.UIntVal) = CallingConv::C; ;}
3344     break;
3345
3346   case 88:
3347 #line 1176 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3348     { (yyval.UIntVal) = CallingConv::C; ;}
3349     break;
3350
3351   case 89:
3352 #line 1177 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3353     { (yyval.UIntVal) = CallingConv::CSRet; ;}
3354     break;
3355
3356   case 90:
3357 #line 1178 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3358     { (yyval.UIntVal) = CallingConv::Fast; ;}
3359     break;
3360
3361   case 91:
3362 #line 1179 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3363     { (yyval.UIntVal) = CallingConv::Cold; ;}
3364     break;
3365
3366   case 92:
3367 #line 1180 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3368     { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3369     break;
3370
3371   case 93:
3372 #line 1181 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3373     { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3374     break;
3375
3376   case 94:
3377 #line 1182 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3378     {
3379                    if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val))
3380                      GEN_ERROR("Calling conv too large!");
3381                    (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3382                   CHECK_FOR_ERROR
3383                  ;}
3384     break;
3385
3386   case 95:
3387 #line 1191 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3388     { (yyval.UIntVal) = 0; ;}
3389     break;
3390
3391   case 96:
3392 #line 1192 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3393     {
3394   (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3395   if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3396     GEN_ERROR("Alignment must be a power of two!");
3397   CHECK_FOR_ERROR
3398 ;}
3399     break;
3400
3401   case 97:
3402 #line 1198 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3403     { (yyval.UIntVal) = 0; ;}
3404     break;
3405
3406   case 98:
3407 #line 1199 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3408     {
3409   (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3410   if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3411     GEN_ERROR("Alignment must be a power of two!");
3412   CHECK_FOR_ERROR
3413 ;}
3414     break;
3415
3416   case 99:
3417 #line 1207 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3418     {
3419   for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i)
3420     if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\')
3421       GEN_ERROR("Invalid character in section name!");
3422   (yyval.StrVal) = (yyvsp[0].StrVal);
3423   CHECK_FOR_ERROR
3424 ;}
3425     break;
3426
3427   case 100:
3428 #line 1215 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3429     { (yyval.StrVal) = 0; ;}
3430     break;
3431
3432   case 101:
3433 #line 1216 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3434     { (yyval.StrVal) = (yyvsp[0].StrVal); ;}
3435     break;
3436
3437   case 102:
3438 #line 1221 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3439     {;}
3440     break;
3441
3442   case 103:
3443 #line 1222 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3444     {;}
3445     break;
3446
3447   case 104:
3448 #line 1223 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3449     {
3450     CurGV->setSection((yyvsp[0].StrVal));
3451     free((yyvsp[0].StrVal));
3452     CHECK_FOR_ERROR
3453   ;}
3454     break;
3455
3456   case 105:
3457 #line 1228 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3458     {
3459     if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val)))
3460       GEN_ERROR("Alignment must be a power of two!");
3461     CurGV->setAlignment((yyvsp[0].UInt64Val));
3462     CHECK_FOR_ERROR
3463   ;}
3464     break;
3465
3466   case 107:
3467 #line 1242 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3468     { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;}
3469     break;
3470
3471   case 109:
3472 #line 1243 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3473     { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;}
3474     break;
3475
3476   case 110:
3477 #line 1245 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3478     {
3479     if (!UpRefs.empty())
3480       GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
3481     (yyval.TypeVal) = (yyvsp[0].TypeVal);
3482     CHECK_FOR_ERROR
3483   ;}
3484     break;
3485
3486   case 124:
3487 #line 1257 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3488     {
3489     (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3490     CHECK_FOR_ERROR
3491   ;}
3492     break;
3493
3494   case 125:
3495 #line 1261 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3496     {
3497     (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType));
3498     CHECK_FOR_ERROR
3499   ;}
3500     break;
3501
3502   case 126:
3503 #line 1265 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3504     {            // Named types are also simple types...
3505   const Type* tmp = getTypeVal((yyvsp[0].ValIDVal));
3506   CHECK_FOR_ERROR
3507   (yyval.TypeVal) = new PATypeHolder(tmp);
3508 ;}
3509     break;
3510
3511   case 127:
3512 #line 1273 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3513     {                   // Type UpReference
3514     if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!");
3515     OpaqueType *OT = OpaqueType::get();        // Use temporary placeholder
3516     UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT));  // Add to vector...
3517     (yyval.TypeVal) = new PATypeHolder(OT);
3518     UR_OUT("New Upreference!\n");
3519     CHECK_FOR_ERROR
3520   ;}
3521     break;
3522
3523   case 128:
3524 #line 1281 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3525     {           // Function derived type?
3526     std::vector<const Type*> Params;
3527     for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3528            E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3529       Params.push_back(*I);
3530     bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3531     if (isVarArg) Params.pop_back();
3532
3533     (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FunctionType::get(*(yyvsp[-3].TypeVal),Params,isVarArg)));
3534     delete (yyvsp[-1].TypeList);      // Delete the argument list
3535     delete (yyvsp[-3].TypeVal);      // Delete the return type handle
3536     CHECK_FOR_ERROR
3537   ;}
3538     break;
3539
3540   case 129:
3541 #line 1294 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3542     {          // Sized array type?
3543     (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3544     delete (yyvsp[-1].TypeVal);
3545     CHECK_FOR_ERROR
3546   ;}
3547     break;
3548
3549   case 130:
3550 #line 1299 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3551     {          // Packed array type?
3552      const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get();
3553      if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val))
3554         GEN_ERROR("Unsigned result not equal to signed result");
3555      if (!ElemTy->isPrimitiveType())
3556         GEN_ERROR("Elemental type of a PackedType must be primitive");
3557      if (!isPowerOf2_32((yyvsp[-3].UInt64Val)))
3558        GEN_ERROR("Vector length should be a power of 2!");
3559      (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3560      delete (yyvsp[-1].TypeVal);
3561      CHECK_FOR_ERROR
3562   ;}
3563     break;
3564
3565   case 131:
3566 #line 1311 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3567     {                        // Structure type?
3568     std::vector<const Type*> Elements;
3569     for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3570            E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3571       Elements.push_back(*I);
3572
3573     (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3574     delete (yyvsp[-1].TypeList);
3575     CHECK_FOR_ERROR
3576   ;}
3577     break;
3578
3579   case 132:
3580 #line 1321 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3581     {                                  // Empty structure type?
3582     (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3583     CHECK_FOR_ERROR
3584   ;}
3585     break;
3586
3587   case 133:
3588 #line 1325 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3589     {                             // Pointer type?
3590     if (*(yyvsp[-1].TypeVal) == Type::LabelTy)
3591       GEN_ERROR("Cannot form a pointer to a basic block");
3592     (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal))));
3593     delete (yyvsp[-1].TypeVal);
3594     CHECK_FOR_ERROR
3595   ;}
3596     break;
3597
3598   case 134:
3599 #line 1336 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3600     {
3601     (yyval.TypeList) = new std::list<PATypeHolder>();
3602     (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3603     CHECK_FOR_ERROR
3604   ;}
3605     break;
3606
3607   case 135:
3608 #line 1341 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3609     {
3610     ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
3611     CHECK_FOR_ERROR
3612   ;}
3613     break;
3614
3615   case 137:
3616 #line 1348 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3617     {
3618     ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(Type::VoidTy);
3619     CHECK_FOR_ERROR
3620   ;}
3621     break;
3622
3623   case 138:
3624 #line 1352 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3625     {
3626     ((yyval.TypeList) = new std::list<PATypeHolder>())->push_back(Type::VoidTy);
3627     CHECK_FOR_ERROR
3628   ;}
3629     break;
3630
3631   case 139:
3632 #line 1356 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3633     {
3634     (yyval.TypeList) = new std::list<PATypeHolder>();
3635     CHECK_FOR_ERROR
3636   ;}
3637     break;
3638
3639   case 140:
3640 #line 1367 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3641     { // Nonempty unsized arr
3642     const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get());
3643     if (ATy == 0)
3644       GEN_ERROR("Cannot make array constant with type: '" + 
3645                      (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3646     const Type *ETy = ATy->getElementType();
3647     int NumElements = ATy->getNumElements();
3648
3649     // Verify that we have the correct size...
3650     if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3651       GEN_ERROR("Type mismatch: constant sized array initialized with " +
3652                      utostr((yyvsp[-1].ConstVector)->size()) +  " arguments, but has size of " + 
3653                      itostr(NumElements) + "!");
3654
3655     // Verify all elements are correct type!
3656     for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3657       if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3658         GEN_ERROR("Element #" + utostr(i) + " is not of type '" + 
3659                        ETy->getDescription() +"' as required!\nIt is of type '"+
3660                        (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3661     }
3662
3663     (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector));
3664     delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3665     CHECK_FOR_ERROR
3666   ;}
3667     break;
3668
3669   case 141:
3670 #line 1393 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3671     {
3672     const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3673     if (ATy == 0)
3674       GEN_ERROR("Cannot make array constant with type: '" + 
3675                      (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3676
3677     int NumElements = ATy->getNumElements();
3678     if (NumElements != -1 && NumElements != 0) 
3679       GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3680                      " arguments, but has size of " + itostr(NumElements) +"!");
3681     (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
3682     delete (yyvsp[-2].TypeVal);
3683     CHECK_FOR_ERROR
3684   ;}
3685     break;
3686
3687   case 142:
3688 #line 1407 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3689     {
3690     const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
3691     if (ATy == 0)
3692       GEN_ERROR("Cannot make array constant with type: '" + 
3693                      (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3694
3695     int NumElements = ATy->getNumElements();
3696     const Type *ETy = ATy->getElementType();
3697     char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
3698     if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal)))
3699       GEN_ERROR("Can't build string constant of size " + 
3700                      itostr((int)(EndStr-(yyvsp[0].StrVal))) +
3701                      " when array has size " + itostr(NumElements) + "!");
3702     std::vector<Constant*> Vals;
3703     if (ETy == Type::SByteTy) {
3704       for (signed char *C = (signed char *)(yyvsp[0].StrVal); C != (signed char *)EndStr; ++C)
3705         Vals.push_back(ConstantInt::get(ETy, *C));
3706     } else if (ETy == Type::UByteTy) {
3707       for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal); 
3708            C != (unsigned char*)EndStr; ++C)
3709         Vals.push_back(ConstantInt::get(ETy, *C));
3710     } else {
3711       free((yyvsp[0].StrVal));
3712       GEN_ERROR("Cannot build string arrays of non byte sized elements!");
3713     }
3714     free((yyvsp[0].StrVal));
3715     (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
3716     delete (yyvsp[-2].TypeVal);
3717     CHECK_FOR_ERROR
3718   ;}
3719     break;
3720
3721   case 143:
3722 #line 1437 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3723     { // Nonempty unsized arr
3724     const PackedType *PTy = dyn_cast<PackedType>((yyvsp[-3].TypeVal)->get());
3725     if (PTy == 0)
3726       GEN_ERROR("Cannot make packed constant with type: '" + 
3727                      (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3728     const Type *ETy = PTy->getElementType();
3729     int NumElements = PTy->getNumElements();
3730
3731     // Verify that we have the correct size...
3732     if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3733       GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3734                      utostr((yyvsp[-1].ConstVector)->size()) +  " arguments, but has size of " + 
3735                      itostr(NumElements) + "!");
3736
3737     // Verify all elements are correct type!
3738     for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3739       if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3740         GEN_ERROR("Element #" + utostr(i) + " is not of type '" + 
3741            ETy->getDescription() +"' as required!\nIt is of type '"+
3742            (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3743     }
3744
3745     (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[-1].ConstVector));
3746     delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3747     CHECK_FOR_ERROR
3748   ;}
3749     break;
3750
3751   case 144:
3752 #line 1463 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3753     {
3754     const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get());
3755     if (STy == 0)
3756       GEN_ERROR("Cannot make struct constant with type: '" + 
3757                      (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3758
3759     if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes())
3760       GEN_ERROR("Illegal number of initializers for structure type!");
3761
3762     // Check to ensure that constants are compatible with the type initializer!
3763     for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i)
3764       if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i))
3765         GEN_ERROR("Expected type '" +
3766                        STy->getElementType(i)->getDescription() +
3767                        "' for element #" + utostr(i) +
3768                        " of structure initializer!");
3769
3770     (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector));
3771     delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
3772     CHECK_FOR_ERROR
3773   ;}
3774     break;
3775
3776   case 145:
3777 #line 1484 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3778     {
3779     const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get());
3780     if (STy == 0)
3781       GEN_ERROR("Cannot make struct constant with type: '" + 
3782                      (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
3783
3784     if (STy->getNumContainedTypes() != 0)
3785       GEN_ERROR("Illegal number of initializers for structure type!");
3786
3787     (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3788     delete (yyvsp[-2].TypeVal);
3789     CHECK_FOR_ERROR
3790   ;}
3791     break;
3792
3793   case 146:
3794 #line 1497 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3795     {
3796     const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3797     if (PTy == 0)
3798       GEN_ERROR("Cannot make null pointer constant with type: '" + 
3799                      (*(yyvsp[-1].TypeVal))->getDescription() + "'!");
3800
3801     (yyval.ConstVal) = ConstantPointerNull::get(PTy);
3802     delete (yyvsp[-1].TypeVal);
3803     CHECK_FOR_ERROR
3804   ;}
3805     break;
3806
3807   case 147:
3808 #line 1507 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3809     {
3810     (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get());
3811     delete (yyvsp[-1].TypeVal);
3812     CHECK_FOR_ERROR
3813   ;}
3814     break;
3815
3816   case 148:
3817 #line 1512 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3818     {
3819     const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
3820     if (Ty == 0)
3821       GEN_ERROR("Global const reference must be a pointer type!");
3822
3823     // ConstExprs can exist in the body of a function, thus creating
3824     // GlobalValues whenever they refer to a variable.  Because we are in
3825     // the context of a function, getValNonImprovising will search the functions
3826     // symbol table instead of the module symbol table for the global symbol,
3827     // which throws things all off.  To get around this, we just tell
3828     // getValNonImprovising that we are at global scope here.
3829     //
3830     Function *SavedCurFn = CurFun.CurrentFunction;
3831     CurFun.CurrentFunction = 0;
3832
3833     Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal));
3834     CHECK_FOR_ERROR
3835
3836     CurFun.CurrentFunction = SavedCurFn;
3837
3838     // If this is an initializer for a constant pointer, which is referencing a
3839     // (currently) undefined variable, create a stub now that shall be replaced
3840     // in the future with the right type of variable.
3841     //
3842     if (V == 0) {
3843       assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3844       const PointerType *PT = cast<PointerType>(Ty);
3845
3846       // First check to see if the forward references value is already created!
3847       PerModuleInfo::GlobalRefsType::iterator I =
3848         CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal)));
3849     
3850       if (I != CurModule.GlobalRefs.end()) {
3851         V = I->second;             // Placeholder already exists, use it...
3852         (yyvsp[0].ValIDVal).destroy();
3853       } else {
3854         std::string Name;
3855         if ((yyvsp[0].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[0].ValIDVal).Name;
3856
3857         // Create the forward referenced global.
3858         GlobalValue *GV;
3859         if (const FunctionType *FTy = 
3860                  dyn_cast<FunctionType>(PT->getElementType())) {
3861           GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
3862                             CurModule.CurrentModule);
3863         } else {
3864           GV = new GlobalVariable(PT->getElementType(), false,
3865                                   GlobalValue::ExternalLinkage, 0,
3866                                   Name, CurModule.CurrentModule);
3867         }
3868
3869         // Keep track of the fact that we have a forward ref to recycle it
3870         CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV));
3871         V = GV;
3872       }
3873     }
3874
3875     (yyval.ConstVal) = cast<GlobalValue>(V);
3876     delete (yyvsp[-1].TypeVal);            // Free the type handle
3877     CHECK_FOR_ERROR
3878   ;}
3879     break;
3880
3881   case 149:
3882 #line 1573 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3883     {
3884     if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType())
3885       GEN_ERROR("Mismatched types for constant expression!");
3886     (yyval.ConstVal) = (yyvsp[0].ConstVal);
3887     delete (yyvsp[-1].TypeVal);
3888     CHECK_FOR_ERROR
3889   ;}
3890     break;
3891
3892   case 150:
3893 #line 1580 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3894     {
3895     const Type *Ty = (yyvsp[-1].TypeVal)->get();
3896     if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
3897       GEN_ERROR("Cannot create a null initialized value of this type!");
3898     (yyval.ConstVal) = Constant::getNullValue(Ty);
3899     delete (yyvsp[-1].TypeVal);
3900     CHECK_FOR_ERROR
3901   ;}
3902     break;
3903
3904   case 151:
3905 #line 1588 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3906     {      // integral constants
3907     if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)))
3908       GEN_ERROR("Constant value doesn't fit in type!");
3909     (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val));
3910     CHECK_FOR_ERROR
3911   ;}
3912     break;
3913
3914   case 152:
3915 #line 1594 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3916     {            // integral constants
3917     if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)))
3918       GEN_ERROR("Constant value doesn't fit in type!");
3919     (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val));
3920     CHECK_FOR_ERROR
3921   ;}
3922     break;
3923
3924   case 153:
3925 #line 1600 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3926     {                      // Boolean constants
3927     (yyval.ConstVal) = ConstantBool::getTrue();
3928     CHECK_FOR_ERROR
3929   ;}
3930     break;
3931
3932   case 154:
3933 #line 1604 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3934     {                     // Boolean constants
3935     (yyval.ConstVal) = ConstantBool::getFalse();
3936     CHECK_FOR_ERROR
3937   ;}
3938     break;
3939
3940   case 155:
3941 #line 1608 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3942     {                   // Float & Double constants
3943     if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal)))
3944       GEN_ERROR("Floating point constant invalid for type!!");
3945     (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal));
3946     CHECK_FOR_ERROR
3947   ;}
3948     break;
3949
3950   case 156:
3951 #line 1616 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3952     {
3953     Constant *Val = (yyvsp[-3].ConstVal);
3954     const Type *Ty = (yyvsp[-1].TypeVal)->get();
3955     if (!Val->getType()->isFirstClassType())
3956       GEN_ERROR("cast constant expression from a non-primitive type: '" +
3957                      Val->getType()->getDescription() + "'!");
3958     if (!Ty->isFirstClassType())
3959       GEN_ERROR("cast constant expression to a non-primitive type: '" +
3960                 Ty->getDescription() + "'!");
3961     (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].TypeVal)->get());
3962     delete (yyvsp[-1].TypeVal);
3963   ;}
3964     break;
3965
3966   case 157:
3967 #line 1628 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3968     {
3969     if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType()))
3970       GEN_ERROR("GetElementPtr requires a pointer operand!");
3971
3972     // LLVM 1.2 and earlier used ubyte struct indices.  Convert any ubyte struct
3973     // indices to uint struct indices for compatibility.
3974     generic_gep_type_iterator<std::vector<Value*>::iterator>
3975       GTI = gep_type_begin((yyvsp[-2].ConstVal)->getType(), (yyvsp[-1].ValueList)->begin(), (yyvsp[-1].ValueList)->end()),
3976       GTE = gep_type_end((yyvsp[-2].ConstVal)->getType(), (yyvsp[-1].ValueList)->begin(), (yyvsp[-1].ValueList)->end());
3977     for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e && GTI != GTE; ++i, ++GTI)
3978       if (isa<StructType>(*GTI))        // Only change struct indices
3979         if (ConstantInt *CUI = dyn_cast<ConstantInt>((*(yyvsp[-1].ValueList))[i]))
3980           if (CUI->getType() == Type::UByteTy)
3981             (*(yyvsp[-1].ValueList))[i] = ConstantExpr::getCast(CUI, Type::UIntTy);
3982
3983     const Type *IdxTy =
3984       GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), *(yyvsp[-1].ValueList), true);
3985     if (!IdxTy)
3986       GEN_ERROR("Index list invalid for constant getelementptr!");
3987
3988     std::vector<Constant*> IdxVec;
3989     for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i)
3990       if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i]))
3991         IdxVec.push_back(C);
3992       else
3993         GEN_ERROR("Indices to constant getelementptr must be constants!");
3994
3995     delete (yyvsp[-1].ValueList);
3996
3997     (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), IdxVec);
3998     CHECK_FOR_ERROR
3999   ;}
4000     break;
4001
4002   case 158:
4003 #line 1660 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4004     {
4005     if ((yyvsp[-5].ConstVal)->getType() != Type::BoolTy)
4006       GEN_ERROR("Select condition must be of boolean type!");
4007     if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4008       GEN_ERROR("Select operand types must match!");
4009     (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4010     CHECK_FOR_ERROR
4011   ;}
4012     break;
4013
4014   case 159:
4015 #line 1668 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4016     {
4017     if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4018       GEN_ERROR("Binary operator types must match!");
4019     CHECK_FOR_ERROR;
4020
4021     // HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs.
4022     // To retain backward compatibility with these early compilers, we emit a
4023     // cast to the appropriate integer type automatically if we are in the
4024     // broken case.  See PR424 for more information.
4025     if (!isa<PointerType>((yyvsp[-3].ConstVal)->getType())) {
4026       (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4027     } else {
4028       const Type *IntPtrTy = 0;
4029       switch (CurModule.CurrentModule->getPointerSize()) {
4030       case Module::Pointer32: IntPtrTy = Type::IntTy; break;
4031       case Module::Pointer64: IntPtrTy = Type::LongTy; break;
4032       default: GEN_ERROR("invalid pointer binary constant expr!");
4033       }
4034       (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), ConstantExpr::getCast((yyvsp[-3].ConstVal), IntPtrTy),
4035                              ConstantExpr::getCast((yyvsp[-1].ConstVal), IntPtrTy));
4036       (yyval.ConstVal) = ConstantExpr::getCast((yyval.ConstVal), (yyvsp[-3].ConstVal)->getType());
4037     }
4038     CHECK_FOR_ERROR
4039   ;}
4040     break;
4041
4042   case 160:
4043 #line 1692 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4044     {
4045     if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4046       GEN_ERROR("Logical operator types must match!");
4047     if (!(yyvsp[-3].ConstVal)->getType()->isIntegral()) {
4048       if (!isa<PackedType>((yyvsp[-3].ConstVal)->getType()) || 
4049           !cast<PackedType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isIntegral())
4050         GEN_ERROR("Logical operator requires integral operands!");
4051     }
4052     (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4053     CHECK_FOR_ERROR
4054   ;}
4055     break;
4056
4057   case 161:
4058 #line 1703 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4059     {
4060     if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4061       GEN_ERROR("setcc operand types must match!");
4062     (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4063     CHECK_FOR_ERROR
4064   ;}
4065     break;
4066
4067   case 162:
4068 #line 1709 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4069     {
4070     if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4071       GEN_ERROR("icmp operand types must match!");
4072     (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4073   ;}
4074     break;
4075
4076   case 163:
4077 #line 1714 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4078     {
4079     if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4080       GEN_ERROR("fcmp operand types must match!");
4081     (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4082   ;}
4083     break;
4084
4085   case 164:
4086 #line 1719 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4087     {
4088     if ((yyvsp[-1].ConstVal)->getType() != Type::UByteTy)
4089       GEN_ERROR("Shift count for shift constant must be unsigned byte!");
4090     if (!(yyvsp[-3].ConstVal)->getType()->isInteger())
4091       GEN_ERROR("Shift constant expression requires integer operand!");
4092     CHECK_FOR_ERROR;
4093     (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4094     CHECK_FOR_ERROR
4095   ;}
4096     break;
4097
4098   case 165:
4099 #line 1728 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4100     {
4101     if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4102       GEN_ERROR("Invalid extractelement operands!");
4103     (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4104     CHECK_FOR_ERROR
4105   ;}
4106     break;
4107
4108   case 166:
4109 #line 1734 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4110     {
4111     if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4112       GEN_ERROR("Invalid insertelement operands!");
4113     (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4114     CHECK_FOR_ERROR
4115   ;}
4116     break;
4117
4118   case 167:
4119 #line 1740 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4120     {
4121     if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4122       GEN_ERROR("Invalid shufflevector operands!");
4123     (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4124     CHECK_FOR_ERROR
4125   ;}
4126     break;
4127
4128   case 168:
4129 #line 1749 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4130     {
4131     ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal));
4132     CHECK_FOR_ERROR
4133   ;}
4134     break;
4135
4136   case 169:
4137 #line 1753 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4138     {
4139     (yyval.ConstVector) = new std::vector<Constant*>();
4140     (yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
4141     CHECK_FOR_ERROR
4142   ;}
4143     break;
4144
4145   case 170:
4146 #line 1761 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4147     { (yyval.BoolVal) = false; ;}
4148     break;
4149
4150   case 171:
4151 #line 1761 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4152     { (yyval.BoolVal) = true; ;}
4153     break;
4154
4155   case 172:
4156 #line 1771 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4157     {
4158   (yyval.ModuleVal) = ParserResult = (yyvsp[0].ModuleVal);
4159   CurModule.ModuleDone();
4160   CHECK_FOR_ERROR;
4161 ;}
4162     break;
4163
4164   case 173:
4165 #line 1779 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4166     {
4167     (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
4168     CurFun.FunctionDone();
4169     CHECK_FOR_ERROR
4170   ;}
4171     break;
4172
4173   case 174:
4174 #line 1784 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4175     {
4176     (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
4177     CHECK_FOR_ERROR
4178   ;}
4179     break;
4180
4181   case 175:
4182 #line 1788 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4183     {
4184     (yyval.ModuleVal) = (yyvsp[-3].ModuleVal);
4185     CHECK_FOR_ERROR
4186   ;}
4187     break;
4188
4189   case 176:
4190 #line 1792 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4191     {
4192     (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
4193     CHECK_FOR_ERROR
4194   ;}
4195     break;
4196
4197   case 177:
4198 #line 1796 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4199     {
4200     (yyval.ModuleVal) = CurModule.CurrentModule;
4201     // Emit an error if there are any unresolved types left.
4202     if (!CurModule.LateResolveTypes.empty()) {
4203       const ValID &DID = CurModule.LateResolveTypes.begin()->first;
4204       if (DID.Type == ValID::NameVal) {
4205         GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'");
4206       } else {
4207         GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num));
4208       }
4209     }
4210     CHECK_FOR_ERROR
4211   ;}
4212     break;
4213
4214   case 178:
4215 #line 1811 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4216     {
4217     // Eagerly resolve types.  This is not an optimization, this is a
4218     // requirement that is due to the fact that we could have this:
4219     //
4220     // %list = type { %list * }
4221     // %list = type { %list * }    ; repeated type decl
4222     //
4223     // If types are not resolved eagerly, then the two types will not be
4224     // determined to be the same type!
4225     //
4226     ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal));
4227
4228     if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4229       CHECK_FOR_ERROR
4230       // If this is a named type that is not a redefinition, add it to the slot
4231       // table.
4232       CurModule.Types.push_back(*(yyvsp[0].TypeVal));
4233     }
4234
4235     delete (yyvsp[0].TypeVal);
4236     CHECK_FOR_ERROR
4237   ;}
4238     break;
4239
4240   case 179:
4241 #line 1833 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4242     {       // Function prototypes can be in const pool
4243     CHECK_FOR_ERROR
4244   ;}
4245     break;
4246
4247   case 180:
4248 #line 1836 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4249     {  // Asm blocks can be in the const pool
4250     CHECK_FOR_ERROR
4251   ;}
4252     break;
4253
4254   case 181:
4255 #line 1839 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4256     {
4257     if ((yyvsp[0].ConstVal) == 0) 
4258       GEN_ERROR("Global value initializer is not a constant!");
4259     CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), (yyvsp[-2].Linkage), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
4260     CHECK_FOR_ERROR
4261   ;}
4262     break;
4263
4264   case 182:
4265 #line 1844 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4266     {
4267     CurGV = 0;
4268   ;}
4269     break;
4270
4271   case 183:
4272 #line 1847 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4273     {
4274     CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4275     CHECK_FOR_ERROR
4276     delete (yyvsp[0].TypeVal);
4277   ;}
4278     break;
4279
4280   case 184:
4281 #line 1851 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4282     {
4283     CurGV = 0;
4284     CHECK_FOR_ERROR
4285   ;}
4286     break;
4287
4288   case 185:
4289 #line 1855 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4290     {
4291     CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::DLLImportLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4292     CHECK_FOR_ERROR
4293     delete (yyvsp[0].TypeVal);
4294   ;}
4295     break;
4296
4297   case 186:
4298 #line 1859 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4299     {
4300     CurGV = 0;
4301     CHECK_FOR_ERROR
4302   ;}
4303     break;
4304
4305   case 187:
4306 #line 1863 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4307     {
4308     CurGV = 
4309       ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalWeakLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
4310     CHECK_FOR_ERROR
4311     delete (yyvsp[0].TypeVal);
4312   ;}
4313     break;
4314
4315   case 188:
4316 #line 1868 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4317     {
4318     CurGV = 0;
4319     CHECK_FOR_ERROR
4320   ;}
4321     break;
4322
4323   case 189:
4324 #line 1872 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4325     { 
4326     CHECK_FOR_ERROR
4327   ;}
4328     break;
4329
4330   case 190:
4331 #line 1875 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4332     {
4333     CHECK_FOR_ERROR
4334   ;}
4335     break;
4336
4337   case 191:
4338 #line 1878 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4339     { 
4340   ;}
4341     break;
4342
4343   case 192:
4344 #line 1882 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4345     {
4346   const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
4347   char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
4348   std::string NewAsm((yyvsp[0].StrVal), EndStr);
4349   free((yyvsp[0].StrVal));
4350
4351   if (AsmSoFar.empty())
4352     CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
4353   else
4354     CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
4355   CHECK_FOR_ERROR
4356 ;}
4357     break;
4358
4359   case 193:
4360 #line 1895 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4361     { (yyval.Endianness) = Module::BigEndian; ;}
4362     break;
4363
4364   case 194:
4365 #line 1896 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4366     { (yyval.Endianness) = Module::LittleEndian; ;}
4367     break;
4368
4369   case 195:
4370 #line 1898 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4371     {
4372     CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness));
4373     CHECK_FOR_ERROR
4374   ;}
4375     break;
4376
4377   case 196:
4378 #line 1902 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4379     {
4380     if ((yyvsp[0].UInt64Val) == 32)
4381       CurModule.CurrentModule->setPointerSize(Module::Pointer32);
4382     else if ((yyvsp[0].UInt64Val) == 64)
4383       CurModule.CurrentModule->setPointerSize(Module::Pointer64);
4384     else
4385       GEN_ERROR("Invalid pointer size: '" + utostr((yyvsp[0].UInt64Val)) + "'!");
4386     CHECK_FOR_ERROR
4387   ;}
4388     break;
4389
4390   case 197:
4391 #line 1911 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4392     {
4393     CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal));
4394     free((yyvsp[0].StrVal));
4395   ;}
4396     break;
4397
4398   case 198:
4399 #line 1915 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4400     {
4401     CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal));
4402     free((yyvsp[0].StrVal));
4403   ;}
4404     break;
4405
4406   case 200:
4407 #line 1922 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4408     {
4409           CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4410           free((yyvsp[0].StrVal));
4411           CHECK_FOR_ERROR
4412         ;}
4413     break;
4414
4415   case 201:
4416 #line 1927 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4417     {
4418           CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4419           free((yyvsp[0].StrVal));
4420           CHECK_FOR_ERROR
4421         ;}
4422     break;
4423
4424   case 202:
4425 #line 1932 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4426     {
4427           CHECK_FOR_ERROR
4428         ;}
4429     break;
4430
4431   case 206:
4432 #line 1942 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4433     { (yyval.StrVal) = 0; ;}
4434     break;
4435
4436   case 207:
4437 #line 1944 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4438     {
4439   if (*(yyvsp[-1].TypeVal) == Type::VoidTy)
4440     GEN_ERROR("void typed arguments are invalid!");
4441   (yyval.ArgVal) = new std::pair<PATypeHolder*, char*>((yyvsp[-1].TypeVal), (yyvsp[0].StrVal));
4442   CHECK_FOR_ERROR
4443 ;}
4444     break;
4445
4446   case 208:
4447 #line 1951 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4448     {
4449     (yyval.ArgList) = (yyvsp[-2].ArgList);
4450     (yyvsp[-2].ArgList)->push_back(*(yyvsp[0].ArgVal));
4451     delete (yyvsp[0].ArgVal);
4452     CHECK_FOR_ERROR
4453   ;}
4454     break;
4455
4456   case 209:
4457 #line 1957 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4458     {
4459     (yyval.ArgList) = new std::vector<std::pair<PATypeHolder*,char*> >();
4460     (yyval.ArgList)->push_back(*(yyvsp[0].ArgVal));
4461     delete (yyvsp[0].ArgVal);
4462     CHECK_FOR_ERROR
4463   ;}
4464     break;
4465
4466   case 210:
4467 #line 1964 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4468     {
4469     (yyval.ArgList) = (yyvsp[0].ArgList);
4470     CHECK_FOR_ERROR
4471   ;}
4472     break;
4473
4474   case 211:
4475 #line 1968 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4476     {
4477     (yyval.ArgList) = (yyvsp[-2].ArgList);
4478     (yyval.ArgList)->push_back(std::pair<PATypeHolder*,
4479                             char*>(new PATypeHolder(Type::VoidTy), 0));
4480     CHECK_FOR_ERROR
4481   ;}
4482     break;
4483
4484   case 212:
4485 #line 1974 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4486     {
4487     (yyval.ArgList) = new std::vector<std::pair<PATypeHolder*,char*> >();
4488     (yyval.ArgList)->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0));
4489     CHECK_FOR_ERROR
4490   ;}
4491     break;
4492
4493   case 213:
4494 #line 1979 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4495     {
4496     (yyval.ArgList) = 0;
4497     CHECK_FOR_ERROR
4498   ;}
4499     break;
4500
4501   case 214:
4502 #line 1985 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4503     {
4504   UnEscapeLexed((yyvsp[-5].StrVal));
4505   std::string FunctionName((yyvsp[-5].StrVal));
4506   free((yyvsp[-5].StrVal));  // Free strdup'd memory!
4507   
4508   if (!(*(yyvsp[-6].TypeVal))->isFirstClassType() && *(yyvsp[-6].TypeVal) != Type::VoidTy)
4509     GEN_ERROR("LLVM functions cannot return aggregate types!");
4510
4511   std::vector<const Type*> ParamTypeList;
4512   if ((yyvsp[-3].ArgList)) {   // If there are arguments...
4513     for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = (yyvsp[-3].ArgList)->begin();
4514          I != (yyvsp[-3].ArgList)->end(); ++I)
4515       ParamTypeList.push_back(I->first->get());
4516   }
4517
4518   bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4519   if (isVarArg) ParamTypeList.pop_back();
4520
4521   const FunctionType *FT = FunctionType::get(*(yyvsp[-6].TypeVal), ParamTypeList, isVarArg);
4522   const PointerType *PFT = PointerType::get(FT);
4523   delete (yyvsp[-6].TypeVal);
4524
4525   ValID ID;
4526   if (!FunctionName.empty()) {
4527     ID = ValID::create((char*)FunctionName.c_str());
4528   } else {
4529     ID = ValID::create((int)CurModule.Values[PFT].size());
4530   }
4531
4532   Function *Fn = 0;
4533   // See if this function was forward referenced.  If so, recycle the object.
4534   if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4535     // Move the function to the end of the list, from whereever it was 
4536     // previously inserted.
4537     Fn = cast<Function>(FWRef);
4538     CurModule.CurrentModule->getFunctionList().remove(Fn);
4539     CurModule.CurrentModule->getFunctionList().push_back(Fn);
4540   } else if (!FunctionName.empty() &&     // Merge with an earlier prototype?
4541              (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) {
4542     // If this is the case, either we need to be a forward decl, or it needs 
4543     // to be.
4544     if (!CurFun.isDeclare && !Fn->isExternal())
4545       GEN_ERROR("Redefinition of function '" + FunctionName + "'!");
4546     
4547     // Make sure to strip off any argument names so we can't get conflicts.
4548     if (Fn->isExternal())
4549       for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4550            AI != AE; ++AI)
4551         AI->setName("");
4552   } else  {  // Not already defined?
4553     Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
4554                       CurModule.CurrentModule);
4555
4556     InsertValue(Fn, CurModule.Values);
4557   }
4558
4559   CurFun.FunctionStart(Fn);
4560
4561   if (CurFun.isDeclare) {
4562     // If we have declaration, always overwrite linkage.  This will allow us to
4563     // correctly handle cases, when pointer to function is passed as argument to
4564     // another function.
4565     Fn->setLinkage(CurFun.Linkage);
4566   }
4567   Fn->setCallingConv((yyvsp[-7].UIntVal));
4568   Fn->setAlignment((yyvsp[0].UIntVal));
4569   if ((yyvsp[-1].StrVal)) {
4570     Fn->setSection((yyvsp[-1].StrVal));
4571     free((yyvsp[-1].StrVal));
4572   }
4573
4574   // Add all of the arguments we parsed to the function...
4575   if ((yyvsp[-3].ArgList)) {                     // Is null if empty...
4576     if (isVarArg) {  // Nuke the last entry
4577       assert((yyvsp[-3].ArgList)->back().first->get() == Type::VoidTy && (yyvsp[-3].ArgList)->back().second == 0&&
4578              "Not a varargs marker!");
4579       delete (yyvsp[-3].ArgList)->back().first;
4580       (yyvsp[-3].ArgList)->pop_back();  // Delete the last entry
4581     }
4582     Function::arg_iterator ArgIt = Fn->arg_begin();
4583     for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = (yyvsp[-3].ArgList)->begin();
4584          I != (yyvsp[-3].ArgList)->end(); ++I, ++ArgIt) {
4585       delete I->first;                          // Delete the typeholder...
4586
4587       setValueName(ArgIt, I->second);           // Insert arg into symtab...
4588       CHECK_FOR_ERROR
4589       InsertValue(ArgIt);
4590     }
4591
4592     delete (yyvsp[-3].ArgList);                     // We're now done with the argument list
4593   }
4594   CHECK_FOR_ERROR
4595 ;}
4596     break;
4597
4598   case 217:
4599 #line 2081 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4600     {
4601   (yyval.FunctionVal) = CurFun.CurrentFunction;
4602
4603   // Make sure that we keep track of the linkage type even if there was a
4604   // previous "declare".
4605   (yyval.FunctionVal)->setLinkage((yyvsp[-2].Linkage));
4606 ;}
4607     break;
4608
4609   case 220:
4610 #line 2091 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4611     {
4612   (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4613   CHECK_FOR_ERROR
4614 ;}
4615     break;
4616
4617   case 222:
4618 #line 2097 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4619     { CurFun.Linkage = GlobalValue::DLLImportLinkage; ;}
4620     break;
4621
4622   case 223:
4623 #line 2098 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4624     { CurFun.Linkage = GlobalValue::ExternalWeakLinkage; ;}
4625     break;
4626
4627   case 224:
4628 #line 2100 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4629     { CurFun.isDeclare = true; ;}
4630     break;
4631
4632   case 225:
4633 #line 2100 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4634     {
4635     (yyval.FunctionVal) = CurFun.CurrentFunction;
4636     CurFun.FunctionDone();
4637     CHECK_FOR_ERROR
4638   ;}
4639     break;
4640
4641   case 226:
4642 #line 2110 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4643     {
4644     (yyval.BoolVal) = false;
4645     CHECK_FOR_ERROR
4646   ;}
4647     break;
4648
4649   case 227:
4650 #line 2114 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4651     {
4652     (yyval.BoolVal) = true;
4653     CHECK_FOR_ERROR
4654   ;}
4655     break;
4656
4657   case 228:
4658 #line 2119 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4659     {    // A reference to a direct constant
4660     (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val));
4661     CHECK_FOR_ERROR
4662   ;}
4663     break;
4664
4665   case 229:
4666 #line 2123 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4667     {
4668     (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val));
4669     CHECK_FOR_ERROR
4670   ;}
4671     break;
4672
4673   case 230:
4674 #line 2127 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4675     {                     // Perhaps it's an FP constant?
4676     (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal));
4677     CHECK_FOR_ERROR
4678   ;}
4679     break;
4680
4681   case 231:
4682 #line 2131 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4683     {
4684     (yyval.ValIDVal) = ValID::create(ConstantBool::getTrue());
4685     CHECK_FOR_ERROR
4686   ;}
4687     break;
4688
4689   case 232:
4690 #line 2135 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4691     {
4692     (yyval.ValIDVal) = ValID::create(ConstantBool::getFalse());
4693     CHECK_FOR_ERROR
4694   ;}
4695     break;
4696
4697   case 233:
4698 #line 2139 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4699     {
4700     (yyval.ValIDVal) = ValID::createNull();
4701     CHECK_FOR_ERROR
4702   ;}
4703     break;
4704
4705   case 234:
4706 #line 2143 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4707     {
4708     (yyval.ValIDVal) = ValID::createUndef();
4709     CHECK_FOR_ERROR
4710   ;}
4711     break;
4712
4713   case 235:
4714 #line 2147 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4715     {     // A vector zero constant.
4716     (yyval.ValIDVal) = ValID::createZeroInit();
4717     CHECK_FOR_ERROR
4718   ;}
4719     break;
4720
4721   case 236:
4722 #line 2151 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4723     { // Nonempty unsized packed vector
4724     const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType();
4725     int NumElements = (yyvsp[-1].ConstVector)->size(); 
4726     
4727     PackedType* pt = PackedType::get(ETy, NumElements);
4728     PATypeHolder* PTy = new PATypeHolder(
4729                                          HandleUpRefs(
4730                                             PackedType::get(
4731                                                 ETy, 
4732                                                 NumElements)
4733                                             )
4734                                          );
4735     
4736     // Verify all elements are correct type!
4737     for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
4738       if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
4739         GEN_ERROR("Element #" + utostr(i) + " is not of type '" + 
4740                      ETy->getDescription() +"' as required!\nIt is of type '" +
4741                      (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
4742     }
4743
4744     (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[-1].ConstVector)));
4745     delete PTy; delete (yyvsp[-1].ConstVector);
4746     CHECK_FOR_ERROR
4747   ;}
4748     break;
4749
4750   case 237:
4751 #line 2176 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4752     {
4753     (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal));
4754     CHECK_FOR_ERROR
4755   ;}
4756     break;
4757
4758   case 238:
4759 #line 2180 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4760     {
4761     char *End = UnEscapeLexed((yyvsp[-2].StrVal), true);
4762     std::string AsmStr = std::string((yyvsp[-2].StrVal), End);
4763     End = UnEscapeLexed((yyvsp[0].StrVal), true);
4764     std::string Constraints = std::string((yyvsp[0].StrVal), End);
4765     (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal));
4766     free((yyvsp[-2].StrVal));
4767     free((yyvsp[0].StrVal));
4768     CHECK_FOR_ERROR
4769   ;}
4770     break;
4771
4772   case 239:
4773 #line 2194 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4774     {  // Is it an integer reference...?
4775     (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal));
4776     CHECK_FOR_ERROR
4777   ;}
4778     break;
4779
4780   case 240:
4781 #line 2198 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4782     {                   // Is it a named reference...?
4783     (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal));
4784     CHECK_FOR_ERROR
4785   ;}
4786     break;
4787
4788   case 243:
4789 #line 2210 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4790     {
4791     (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); delete (yyvsp[-1].TypeVal);
4792     CHECK_FOR_ERROR
4793   ;}
4794     break;
4795
4796   case 244:
4797 #line 2215 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4798     {
4799     (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4800     CHECK_FOR_ERROR
4801   ;}
4802     break;
4803
4804   case 245:
4805 #line 2219 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4806     { // Do not allow functions with 0 basic blocks   
4807     (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
4808     CHECK_FOR_ERROR
4809   ;}
4810     break;
4811
4812   case 246:
4813 #line 2228 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4814     {
4815     setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal));
4816     CHECK_FOR_ERROR
4817     InsertValue((yyvsp[0].TermInstVal));
4818
4819     (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal));
4820     InsertValue((yyvsp[-2].BasicBlockVal));
4821     (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal);
4822     CHECK_FOR_ERROR
4823   ;}
4824     break;
4825
4826   case 247:
4827 #line 2239 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4828     {
4829     if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal)))
4830       if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4831         if (CI2->getParent() == 0)
4832           (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2);
4833     (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal));
4834     (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal);
4835     CHECK_FOR_ERROR
4836   ;}
4837     break;
4838
4839   case 248:
4840 #line 2248 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4841     {
4842     (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true);
4843     CHECK_FOR_ERROR
4844
4845     // Make sure to move the basic block to the correct location in the
4846     // function, instead of leaving it inserted wherever it was first
4847     // referenced.
4848     Function::BasicBlockListType &BBL = 
4849       CurFun.CurrentFunction->getBasicBlockList();
4850     BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4851     CHECK_FOR_ERROR
4852   ;}
4853     break;
4854
4855   case 249:
4856 #line 2260 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4857     {
4858     (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((yyvsp[0].StrVal)), true);
4859     CHECK_FOR_ERROR
4860
4861     // Make sure to move the basic block to the correct location in the
4862     // function, instead of leaving it inserted wherever it was first
4863     // referenced.
4864     Function::BasicBlockListType &BBL = 
4865       CurFun.CurrentFunction->getBasicBlockList();
4866     BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4867     CHECK_FOR_ERROR
4868   ;}
4869     break;
4870
4871   case 250:
4872 #line 2273 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4873     {              // Return with a result...
4874     (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal));
4875     CHECK_FOR_ERROR
4876   ;}
4877     break;
4878
4879   case 251:
4880 #line 2277 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4881     {                                       // Return with no result...
4882     (yyval.TermInstVal) = new ReturnInst();
4883     CHECK_FOR_ERROR
4884   ;}
4885     break;
4886
4887   case 252:
4888 #line 2281 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4889     {                         // Unconditional Branch...
4890     BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
4891     CHECK_FOR_ERROR
4892     (yyval.TermInstVal) = new BranchInst(tmpBB);
4893   ;}
4894     break;
4895
4896   case 253:
4897 #line 2286 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4898     {  
4899     BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal));
4900     CHECK_FOR_ERROR
4901     BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal));
4902     CHECK_FOR_ERROR
4903     Value* tmpVal = getVal(Type::BoolTy, (yyvsp[-6].ValIDVal));
4904     CHECK_FOR_ERROR
4905     (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
4906   ;}
4907     break;
4908
4909   case 254:
4910 #line 2295 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4911     {
4912     Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal));
4913     CHECK_FOR_ERROR
4914     BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal));
4915     CHECK_FOR_ERROR
4916     SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size());
4917     (yyval.TermInstVal) = S;
4918
4919     std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(),
4920       E = (yyvsp[-1].JumpTable)->end();
4921     for (; I != E; ++I) {
4922       if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
4923           S->addCase(CI, I->second);
4924       else
4925         GEN_ERROR("Switch case is constant, but not a simple integer!");
4926     }
4927     delete (yyvsp[-1].JumpTable);
4928     CHECK_FOR_ERROR
4929   ;}
4930     break;
4931
4932   case 255:
4933 #line 2314 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4934     {
4935     Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal));
4936     CHECK_FOR_ERROR
4937     BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal));
4938     CHECK_FOR_ERROR
4939     SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
4940     (yyval.TermInstVal) = S;
4941     CHECK_FOR_ERROR
4942   ;}
4943     break;
4944
4945   case 256:
4946 #line 2324 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
4947     {
4948     const PointerType *PFTy;
4949     const FunctionType *Ty;
4950
4951     if (!(PFTy = dyn_cast<PointerType>((yyvsp[-10].TypeVal)->get())) ||
4952         !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4953       // Pull out the types of all of the arguments...
4954       std::vector<const Type*> ParamTypes;
4955       if ((yyvsp[-7].ValueList)) {
4956         for (std::vector<Value*>::iterator I = (yyvsp[-7].ValueList)->begin(), E = (yyvsp[-7].ValueList)->end();
4957              I != E; ++I)
4958           ParamTypes.push_back((*I)->getType());
4959       }
4960
4961       bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
4962       if (isVarArg) ParamTypes.pop_back();
4963
4964       Ty = FunctionType::get((yyvsp[-10].TypeVal)->get(), ParamTypes, isVarArg);
4965       PFTy = PointerType::get(Ty);
4966     }
4967
4968     Value *V = getVal(PFTy, (yyvsp[-9].ValIDVal));   // Get the function we're calling...
4969     CHECK_FOR_ERROR
4970     BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal));
4971     CHECK_FOR_ERROR
4972     BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal));
4973     CHECK_FOR_ERROR
4974
4975     // Create the call node...
4976     if (!(yyvsp[-7].ValueList)) {                                   // Has no arguments?
4977       (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, std::vector<Value*>());
4978     } else {                                     // Has arguments?
4979       // Loop through FunctionType's arguments and ensure they are specified
4980       // correctly!
4981       //
4982       FunctionType::param_iterator I = Ty->param_begin();
4983       FunctionType::param_iterator E = Ty->param_end();
4984       std::vector<Value*>::iterator ArgI = (yyvsp[-7].ValueList)->begin(), ArgE = (yyvsp[-7].ValueList)->end();
4985
4986       for (; ArgI != ArgE && I != E; ++ArgI, ++I)
4987         if ((*ArgI)->getType() != *I)
4988           GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" +
4989                          (*I)->getDescription() + "'!");
4990
4991       if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
4992         GEN_ERROR("Invalid number of parameters detected!");
4993
4994       (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, *(yyvsp[-7].ValueList));
4995     }
4996     cast<InvokeInst>((yyval.TermInstVal))->setCallingConv((yyvsp[-11].UIntVal));
4997   
4998     delete (yyvsp[-10].TypeVal);
4999     delete (yyvsp[-7].ValueList);
5000     CHECK_FOR_ERROR
5001   ;}
5002     break;
5003
5004   case 257:
5005 #line 2379 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5006     {
5007     (yyval.TermInstVal) = new UnwindInst();
5008     CHECK_FOR_ERROR
5009   ;}
5010     break;
5011
5012   case 258:
5013 #line 2383 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5014     {
5015     (yyval.TermInstVal) = new UnreachableInst();
5016     CHECK_FOR_ERROR
5017   ;}
5018     break;
5019
5020   case 259:
5021 #line 2390 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5022     {
5023     (yyval.JumpTable) = (yyvsp[-5].JumpTable);
5024     Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5025     CHECK_FOR_ERROR
5026     if (V == 0)
5027       GEN_ERROR("May only switch on a constant pool value!");
5028
5029     BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5030     CHECK_FOR_ERROR
5031     (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5032   ;}
5033     break;
5034
5035   case 260:
5036 #line 2401 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5037     {
5038     (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5039     Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
5040     CHECK_FOR_ERROR
5041
5042     if (V == 0)
5043       GEN_ERROR("May only switch on a constant pool value!");
5044
5045     BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
5046     CHECK_FOR_ERROR
5047     (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); 
5048   ;}
5049     break;
5050
5051   case 261:
5052 #line 2414 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5053     {
5054   // Is this definition named?? if so, assign the name...
5055   setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal));
5056   CHECK_FOR_ERROR
5057   InsertValue((yyvsp[0].InstVal));
5058   (yyval.InstVal) = (yyvsp[0].InstVal);
5059   CHECK_FOR_ERROR
5060 ;}
5061     break;
5062
5063   case 262:
5064 #line 2423 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5065     {    // Used for PHI nodes
5066     (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5067     Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal));
5068     CHECK_FOR_ERROR
5069     BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5070     CHECK_FOR_ERROR
5071     (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5072     delete (yyvsp[-5].TypeVal);
5073   ;}
5074     break;
5075
5076   case 263:
5077 #line 2432 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5078     {
5079     (yyval.PHIList) = (yyvsp[-6].PHIList);
5080     Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal));
5081     CHECK_FOR_ERROR
5082     BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5083     CHECK_FOR_ERROR
5084     (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5085   ;}
5086     break;
5087
5088   case 264:
5089 #line 2442 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5090     {    // Used for call statements, and memory insts...
5091     (yyval.ValueList) = new std::vector<Value*>();
5092     (yyval.ValueList)->push_back((yyvsp[0].ValueVal));
5093   ;}
5094     break;
5095
5096   case 265:
5097 #line 2446 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5098     {
5099     (yyval.ValueList) = (yyvsp[-2].ValueList);
5100     (yyvsp[-2].ValueList)->push_back((yyvsp[0].ValueVal));
5101     CHECK_FOR_ERROR
5102   ;}
5103     break;
5104
5105   case 267:
5106 #line 2453 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5107     { (yyval.ValueList) = 0; ;}
5108     break;
5109
5110   case 268:
5111 #line 2455 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5112     {
5113     (yyval.BoolVal) = true;
5114     CHECK_FOR_ERROR
5115   ;}
5116     break;
5117
5118   case 269:
5119 #line 2459 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5120     {
5121     (yyval.BoolVal) = false;
5122     CHECK_FOR_ERROR
5123   ;}
5124     break;
5125
5126   case 270:
5127 #line 2464 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5128     {
5129     if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() && 
5130         !isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5131       GEN_ERROR(
5132         "Arithmetic operator requires integer, FP, or packed operands!");
5133     if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()) && 
5134         ((yyvsp[-4].BinaryOpVal) == Instruction::URem || 
5135          (yyvsp[-4].BinaryOpVal) == Instruction::SRem ||
5136          (yyvsp[-4].BinaryOpVal) == Instruction::FRem))
5137       GEN_ERROR("U/S/FRem not supported on packed types!");
5138     Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); 
5139     CHECK_FOR_ERROR
5140     Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5141     CHECK_FOR_ERROR
5142     (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2);
5143     if ((yyval.InstVal) == 0)
5144       GEN_ERROR("binary operator returned null!");
5145     delete (yyvsp[-3].TypeVal);
5146   ;}
5147     break;
5148
5149   case 271:
5150 #line 2483 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5151     {
5152     if (!(*(yyvsp[-3].TypeVal))->isIntegral()) {
5153       if (!isa<PackedType>((yyvsp[-3].TypeVal)->get()) ||
5154           !cast<PackedType>((yyvsp[-3].TypeVal)->get())->getElementType()->isIntegral())
5155         GEN_ERROR("Logical operator requires integral operands!");
5156     }
5157     Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5158     CHECK_FOR_ERROR
5159     Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5160     CHECK_FOR_ERROR
5161     (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
5162     if ((yyval.InstVal) == 0)
5163       GEN_ERROR("binary operator returned null!");
5164     delete (yyvsp[-3].TypeVal);
5165   ;}
5166     break;
5167
5168   case 272:
5169 #line 2498 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5170     {
5171     if(isa<PackedType>((*(yyvsp[-3].TypeVal)).get())) {
5172       GEN_ERROR(
5173         "PackedTypes currently not supported in setcc instructions!");
5174     }
5175     Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5176     CHECK_FOR_ERROR
5177     Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5178     CHECK_FOR_ERROR
5179     (yyval.InstVal) = new SetCondInst((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
5180     if ((yyval.InstVal) == 0)
5181       GEN_ERROR("binary operator returned null!");
5182     delete (yyvsp[-3].TypeVal);
5183   ;}
5184     break;
5185
5186   case 273:
5187 #line 2512 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5188     {
5189     if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5190       GEN_ERROR("Packed types not supported by icmp instruction");
5191     Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5192     CHECK_FOR_ERROR
5193     Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5194     CHECK_FOR_ERROR
5195     (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2);
5196     if ((yyval.InstVal) == 0)
5197       GEN_ERROR("icmp operator returned null!");
5198   ;}
5199     break;
5200
5201   case 274:
5202 #line 2523 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5203     {
5204     if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5205       GEN_ERROR("Packed types not supported by fcmp instruction");
5206     Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5207     CHECK_FOR_ERROR
5208     Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5209     CHECK_FOR_ERROR
5210     (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2);
5211     if ((yyval.InstVal) == 0)
5212       GEN_ERROR("fcmp operator returned null!");
5213   ;}
5214     break;
5215
5216   case 275:
5217 #line 2534 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5218     {
5219     llvm_cerr << "WARNING: Use of eliminated 'not' instruction:"
5220               << " Replacing with 'xor'.\n";
5221
5222     Value *Ones = ConstantIntegral::getAllOnesValue((yyvsp[0].ValueVal)->getType());
5223     if (Ones == 0)
5224       GEN_ERROR("Expected integral type for not instruction!");
5225
5226     (yyval.InstVal) = BinaryOperator::create(Instruction::Xor, (yyvsp[0].ValueVal), Ones);
5227     if ((yyval.InstVal) == 0)
5228       GEN_ERROR("Could not create a xor instruction!");
5229     CHECK_FOR_ERROR
5230   ;}
5231     break;
5232
5233   case 276:
5234 #line 2547 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5235     {
5236     if ((yyvsp[0].ValueVal)->getType() != Type::UByteTy)
5237       GEN_ERROR("Shift amount must be ubyte!");
5238     if (!(yyvsp[-2].ValueVal)->getType()->isInteger())
5239       GEN_ERROR("Shift constant expression requires integer operand!");
5240     CHECK_FOR_ERROR;
5241     (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5242     CHECK_FOR_ERROR
5243   ;}
5244     break;
5245
5246   case 277:
5247 #line 2556 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5248     {
5249     Value* Val = (yyvsp[-2].ValueVal);
5250     const Type* Ty = (yyvsp[0].TypeVal)->get();
5251     if (!Val->getType()->isFirstClassType())
5252       GEN_ERROR("cast from a non-primitive type: '" +
5253                 Val->getType()->getDescription() + "'!");
5254     if (!Ty->isFirstClassType())
5255       GEN_ERROR("cast to a non-primitive type: '" + Ty->getDescription() +"'!");
5256     (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].TypeVal)->get());
5257     delete (yyvsp[0].TypeVal);
5258   ;}
5259     break;
5260
5261   case 278:
5262 #line 2567 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5263     {
5264     if ((yyvsp[-4].ValueVal)->getType() != Type::BoolTy)
5265       GEN_ERROR("select condition must be boolean!");
5266     if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType())
5267       GEN_ERROR("select value types should match!");
5268     (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5269     CHECK_FOR_ERROR
5270   ;}
5271     break;
5272
5273   case 279:
5274 #line 2575 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5275     {
5276     NewVarArgs = true;
5277     (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
5278     delete (yyvsp[0].TypeVal);
5279     CHECK_FOR_ERROR
5280   ;}
5281     break;
5282
5283   case 280:
5284 #line 2581 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5285     {
5286     ObsoleteVarArgs = true;
5287     const Type* ArgTy = (yyvsp[-2].ValueVal)->getType();
5288     Function* NF = CurModule.CurrentModule->
5289       getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0);
5290
5291     //b = vaarg a, t -> 
5292     //foo = alloca 1 of t
5293     //bar = vacopy a 
5294     //store bar -> foo
5295     //b = vaarg foo, t
5296     AllocaInst* foo = new AllocaInst(ArgTy, 0, "vaarg.fix");
5297     CurBB->getInstList().push_back(foo);
5298     CallInst* bar = new CallInst(NF, (yyvsp[-2].ValueVal));
5299     CurBB->getInstList().push_back(bar);
5300     CurBB->getInstList().push_back(new StoreInst(bar, foo));
5301     (yyval.InstVal) = new VAArgInst(foo, *(yyvsp[0].TypeVal));
5302     delete (yyvsp[0].TypeVal);
5303     CHECK_FOR_ERROR
5304   ;}
5305     break;
5306
5307   case 281:
5308 #line 2601 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5309     {
5310     ObsoleteVarArgs = true;
5311     const Type* ArgTy = (yyvsp[-2].ValueVal)->getType();
5312     Function* NF = CurModule.CurrentModule->
5313       getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0);
5314
5315     //b = vanext a, t ->
5316     //foo = alloca 1 of t
5317     //bar = vacopy a
5318     //store bar -> foo
5319     //tmp = vaarg foo, t
5320     //b = load foo
5321     AllocaInst* foo = new AllocaInst(ArgTy, 0, "vanext.fix");
5322     CurBB->getInstList().push_back(foo);
5323     CallInst* bar = new CallInst(NF, (yyvsp[-2].ValueVal));
5324     CurBB->getInstList().push_back(bar);
5325     CurBB->getInstList().push_back(new StoreInst(bar, foo));
5326     Instruction* tmp = new VAArgInst(foo, *(yyvsp[0].TypeVal));
5327     CurBB->getInstList().push_back(tmp);
5328     (yyval.InstVal) = new LoadInst(foo);
5329     delete (yyvsp[0].TypeVal);
5330     CHECK_FOR_ERROR
5331   ;}
5332     break;
5333
5334   case 282:
5335 #line 2624 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5336     {
5337     if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5338       GEN_ERROR("Invalid extractelement operands!");
5339     (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5340     CHECK_FOR_ERROR
5341   ;}
5342     break;
5343
5344   case 283:
5345 #line 2630 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5346     {
5347     if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5348       GEN_ERROR("Invalid insertelement operands!");
5349     (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5350     CHECK_FOR_ERROR
5351   ;}
5352     break;
5353
5354   case 284:
5355 #line 2636 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5356     {
5357     if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
5358       GEN_ERROR("Invalid shufflevector operands!");
5359     (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
5360     CHECK_FOR_ERROR
5361   ;}
5362     break;
5363
5364   case 285:
5365 #line 2642 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5366     {
5367     const Type *Ty = (yyvsp[0].PHIList)->front().first->getType();
5368     if (!Ty->isFirstClassType())
5369       GEN_ERROR("PHI node operands must be of first class type!");
5370     (yyval.InstVal) = new PHINode(Ty);
5371     ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size());
5372     while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) {
5373       if ((yyvsp[0].PHIList)->front().first->getType() != Ty) 
5374         GEN_ERROR("All elements of a PHI node must be of the same type!");
5375       cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second);
5376       (yyvsp[0].PHIList)->pop_front();
5377     }
5378     delete (yyvsp[0].PHIList);  // Free the list...
5379     CHECK_FOR_ERROR
5380   ;}
5381     break;
5382
5383   case 286:
5384 #line 2657 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5385     {
5386     const PointerType *PFTy = 0;
5387     const FunctionType *Ty = 0;
5388
5389     if (!(PFTy = dyn_cast<PointerType>((yyvsp[-4].TypeVal)->get())) ||
5390         !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5391       // Pull out the types of all of the arguments...
5392       std::vector<const Type*> ParamTypes;
5393       if ((yyvsp[-1].ValueList)) {
5394         for (std::vector<Value*>::iterator I = (yyvsp[-1].ValueList)->begin(), E = (yyvsp[-1].ValueList)->end();
5395              I != E; ++I)
5396           ParamTypes.push_back((*I)->getType());
5397       }
5398
5399       bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
5400       if (isVarArg) ParamTypes.pop_back();
5401
5402       if (!(*(yyvsp[-4].TypeVal))->isFirstClassType() && *(yyvsp[-4].TypeVal) != Type::VoidTy)
5403         GEN_ERROR("LLVM functions cannot return aggregate types!");
5404
5405       Ty = FunctionType::get((yyvsp[-4].TypeVal)->get(), ParamTypes, isVarArg);
5406       PFTy = PointerType::get(Ty);
5407     }
5408
5409     Value *V = getVal(PFTy, (yyvsp[-3].ValIDVal));   // Get the function we're calling...
5410     CHECK_FOR_ERROR
5411
5412     // Create the call node...
5413     if (!(yyvsp[-1].ValueList)) {                                   // Has no arguments?
5414       // Make sure no arguments is a good thing!
5415       if (Ty->getNumParams() != 0)
5416         GEN_ERROR("No arguments passed to a function that "
5417                        "expects arguments!");
5418
5419       (yyval.InstVal) = new CallInst(V, std::vector<Value*>());
5420     } else {                                     // Has arguments?
5421       // Loop through FunctionType's arguments and ensure they are specified
5422       // correctly!
5423       //
5424       FunctionType::param_iterator I = Ty->param_begin();
5425       FunctionType::param_iterator E = Ty->param_end();
5426       std::vector<Value*>::iterator ArgI = (yyvsp[-1].ValueList)->begin(), ArgE = (yyvsp[-1].ValueList)->end();
5427
5428       for (; ArgI != ArgE && I != E; ++ArgI, ++I)
5429         if ((*ArgI)->getType() != *I)
5430           GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" +
5431                          (*I)->getDescription() + "'!");
5432
5433       if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
5434         GEN_ERROR("Invalid number of parameters detected!");
5435
5436       (yyval.InstVal) = new CallInst(V, *(yyvsp[-1].ValueList));
5437     }
5438     cast<CallInst>((yyval.InstVal))->setTailCall((yyvsp[-6].BoolVal));
5439     cast<CallInst>((yyval.InstVal))->setCallingConv((yyvsp[-5].UIntVal));
5440     delete (yyvsp[-4].TypeVal);
5441     delete (yyvsp[-1].ValueList);
5442     CHECK_FOR_ERROR
5443   ;}
5444     break;
5445
5446   case 287:
5447 #line 2716 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5448     {
5449     (yyval.InstVal) = (yyvsp[0].InstVal);
5450     CHECK_FOR_ERROR
5451   ;}
5452     break;
5453
5454   case 288:
5455 #line 2723 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5456     { 
5457     (yyval.ValueList) = (yyvsp[0].ValueList); 
5458     CHECK_FOR_ERROR
5459   ;}
5460     break;
5461
5462   case 289:
5463 #line 2726 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5464     { 
5465     (yyval.ValueList) = new std::vector<Value*>(); 
5466     CHECK_FOR_ERROR
5467   ;}
5468     break;
5469
5470   case 290:
5471 #line 2731 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5472     {
5473     (yyval.BoolVal) = true;
5474     CHECK_FOR_ERROR
5475   ;}
5476     break;
5477
5478   case 291:
5479 #line 2735 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5480     {
5481     (yyval.BoolVal) = false;
5482     CHECK_FOR_ERROR
5483   ;}
5484     break;
5485
5486   case 292:
5487 #line 2742 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5488     {
5489     (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5490     delete (yyvsp[-1].TypeVal);
5491     CHECK_FOR_ERROR
5492   ;}
5493     break;
5494
5495   case 293:
5496 #line 2747 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5497     {
5498     Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5499     CHECK_FOR_ERROR
5500     (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5501     delete (yyvsp[-4].TypeVal);
5502   ;}
5503     break;
5504
5505   case 294:
5506 #line 2753 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5507     {
5508     (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5509     delete (yyvsp[-1].TypeVal);
5510     CHECK_FOR_ERROR
5511   ;}
5512     break;
5513
5514   case 295:
5515 #line 2758 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5516     {
5517     Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5518     CHECK_FOR_ERROR
5519     (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5520     delete (yyvsp[-4].TypeVal);
5521   ;}
5522     break;
5523
5524   case 296:
5525 #line 2764 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5526     {
5527     if (!isa<PointerType>((yyvsp[0].ValueVal)->getType()))
5528       GEN_ERROR("Trying to free nonpointer type " + 
5529                      (yyvsp[0].ValueVal)->getType()->getDescription() + "!");
5530     (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal));
5531     CHECK_FOR_ERROR
5532   ;}
5533     break;
5534
5535   case 297:
5536 #line 2772 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5537     {
5538     if (!isa<PointerType>((yyvsp[-1].TypeVal)->get()))
5539       GEN_ERROR("Can't load from nonpointer type: " +
5540                      (*(yyvsp[-1].TypeVal))->getDescription());
5541     if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType())
5542       GEN_ERROR("Can't load from pointer of non-first-class type: " +
5543                      (*(yyvsp[-1].TypeVal))->getDescription());
5544     Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5545     CHECK_FOR_ERROR
5546     (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal));
5547     delete (yyvsp[-1].TypeVal);
5548   ;}
5549     break;
5550
5551   case 298:
5552 #line 2784 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5553     {
5554     const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
5555     if (!PT)
5556       GEN_ERROR("Can't store to a nonpointer type: " +
5557                      (*(yyvsp[-1].TypeVal))->getDescription());
5558     const Type *ElTy = PT->getElementType();
5559     if (ElTy != (yyvsp[-3].ValueVal)->getType())
5560       GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() +
5561                      "' into space of type '" + ElTy->getDescription() + "'!");
5562
5563     Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
5564     CHECK_FOR_ERROR
5565     (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal));
5566     delete (yyvsp[-1].TypeVal);
5567   ;}
5568     break;
5569
5570   case 299:
5571 #line 2799 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5572     {
5573     if (!isa<PointerType>((yyvsp[-2].TypeVal)->get()))
5574       GEN_ERROR("getelementptr insn requires pointer operand!");
5575
5576     // LLVM 1.2 and earlier used ubyte struct indices.  Convert any ubyte struct
5577     // indices to uint struct indices for compatibility.
5578     generic_gep_type_iterator<std::vector<Value*>::iterator>
5579       GTI = gep_type_begin((yyvsp[-2].TypeVal)->get(), (yyvsp[0].ValueList)->begin(), (yyvsp[0].ValueList)->end()),
5580       GTE = gep_type_end((yyvsp[-2].TypeVal)->get(), (yyvsp[0].ValueList)->begin(), (yyvsp[0].ValueList)->end());
5581     for (unsigned i = 0, e = (yyvsp[0].ValueList)->size(); i != e && GTI != GTE; ++i, ++GTI)
5582       if (isa<StructType>(*GTI))        // Only change struct indices
5583         if (ConstantInt *CUI = dyn_cast<ConstantInt>((*(yyvsp[0].ValueList))[i]))
5584           if (CUI->getType() == Type::UByteTy)
5585             (*(yyvsp[0].ValueList))[i] = ConstantExpr::getCast(CUI, Type::UIntTy);
5586
5587     if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), *(yyvsp[0].ValueList), true))
5588       GEN_ERROR("Invalid getelementptr indices for type '" +
5589                      (*(yyvsp[-2].TypeVal))->getDescription()+ "'!");
5590     Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal));
5591     CHECK_FOR_ERROR
5592     (yyval.InstVal) = new GetElementPtrInst(tmpVal, *(yyvsp[0].ValueList));
5593     delete (yyvsp[-2].TypeVal); 
5594     delete (yyvsp[0].ValueList);
5595   ;}
5596     break;
5597
5598
5599       default: break;
5600     }
5601
5602 /* Line 1126 of yacc.c.  */
5603 #line 5604 "llvmAsmParser.tab.c"
5604 \f
5605   yyvsp -= yylen;
5606   yyssp -= yylen;
5607
5608
5609   YY_STACK_PRINT (yyss, yyssp);
5610
5611   *++yyvsp = yyval;
5612
5613
5614   /* Now `shift' the result of the reduction.  Determine what state
5615      that goes to, based on the state we popped back to and the rule
5616      number reduced by.  */
5617
5618   yyn = yyr1[yyn];
5619
5620   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5621   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
5622     yystate = yytable[yystate];
5623   else
5624     yystate = yydefgoto[yyn - YYNTOKENS];
5625
5626   goto yynewstate;
5627
5628
5629 /*------------------------------------.
5630 | yyerrlab -- here on detecting error |
5631 `------------------------------------*/
5632 yyerrlab:
5633   /* If not already recovering from an error, report this error.  */
5634   if (!yyerrstatus)
5635     {
5636       ++yynerrs;
5637 #if YYERROR_VERBOSE
5638       yyn = yypact[yystate];
5639
5640       if (YYPACT_NINF < yyn && yyn < YYLAST)
5641         {
5642           int yytype = YYTRANSLATE (yychar);
5643           YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
5644           YYSIZE_T yysize = yysize0;
5645           YYSIZE_T yysize1;
5646           int yysize_overflow = 0;
5647           char *yymsg = 0;
5648 #         define YYERROR_VERBOSE_ARGS_MAXIMUM 5
5649           char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
5650           int yyx;
5651
5652 #if 0
5653           /* This is so xgettext sees the translatable formats that are
5654              constructed on the fly.  */
5655           YY_("syntax error, unexpected %s");
5656           YY_("syntax error, unexpected %s, expecting %s");
5657           YY_("syntax error, unexpected %s, expecting %s or %s");
5658           YY_("syntax error, unexpected %s, expecting %s or %s or %s");
5659           YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
5660 #endif
5661           char *yyfmt;
5662           char const *yyf;
5663           static char const yyunexpected[] = "syntax error, unexpected %s";
5664           static char const yyexpecting[] = ", expecting %s";
5665           static char const yyor[] = " or %s";
5666           char yyformat[sizeof yyunexpected
5667                         + sizeof yyexpecting - 1
5668                         + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
5669                            * (sizeof yyor - 1))];
5670           char const *yyprefix = yyexpecting;
5671
5672           /* Start YYX at -YYN if negative to avoid negative indexes in
5673              YYCHECK.  */
5674           int yyxbegin = yyn < 0 ? -yyn : 0;
5675
5676           /* Stay within bounds of both yycheck and yytname.  */
5677           int yychecklim = YYLAST - yyn;
5678           int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
5679           int yycount = 1;
5680
5681           yyarg[0] = yytname[yytype];
5682           yyfmt = yystpcpy (yyformat, yyunexpected);
5683
5684           for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5685             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5686               {
5687                 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
5688                   {
5689                     yycount = 1;
5690                     yysize = yysize0;
5691                     yyformat[sizeof yyunexpected - 1] = '\0';
5692                     break;
5693                   }
5694                 yyarg[yycount++] = yytname[yyx];
5695                 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
5696                 yysize_overflow |= yysize1 < yysize;
5697                 yysize = yysize1;
5698                 yyfmt = yystpcpy (yyfmt, yyprefix);
5699                 yyprefix = yyor;
5700               }
5701
5702           yyf = YY_(yyformat);
5703           yysize1 = yysize + yystrlen (yyf);
5704           yysize_overflow |= yysize1 < yysize;
5705           yysize = yysize1;
5706
5707           if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
5708             yymsg = (char *) YYSTACK_ALLOC (yysize);
5709           if (yymsg)
5710             {
5711               /* Avoid sprintf, as that infringes on the user's name space.
5712                  Don't have undefined behavior even if the translation
5713                  produced a string with the wrong number of "%s"s.  */
5714               char *yyp = yymsg;
5715               int yyi = 0;
5716               while ((*yyp = *yyf))
5717                 {
5718                   if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
5719                     {
5720                       yyp += yytnamerr (yyp, yyarg[yyi++]);
5721                       yyf += 2;
5722                     }
5723                   else
5724                     {
5725                       yyp++;
5726                       yyf++;
5727                     }
5728                 }
5729               yyerror (yymsg);
5730               YYSTACK_FREE (yymsg);
5731             }
5732           else
5733             {
5734               yyerror (YY_("syntax error"));
5735               goto yyexhaustedlab;
5736             }
5737         }
5738       else
5739 #endif /* YYERROR_VERBOSE */
5740         yyerror (YY_("syntax error"));
5741     }
5742
5743
5744
5745   if (yyerrstatus == 3)
5746     {
5747       /* If just tried and failed to reuse look-ahead token after an
5748          error, discard it.  */
5749
5750       if (yychar <= YYEOF)
5751         {
5752           /* Return failure if at end of input.  */
5753           if (yychar == YYEOF)
5754             YYABORT;
5755         }
5756       else
5757         {
5758           yydestruct ("Error: discarding", yytoken, &yylval);
5759           yychar = YYEMPTY;
5760         }
5761     }
5762
5763   /* Else will try to reuse look-ahead token after shifting the error
5764      token.  */
5765   goto yyerrlab1;
5766
5767
5768 /*---------------------------------------------------.
5769 | yyerrorlab -- error raised explicitly by YYERROR.  |
5770 `---------------------------------------------------*/
5771 yyerrorlab:
5772
5773   /* Pacify compilers like GCC when the user code never invokes
5774      YYERROR and the label yyerrorlab therefore never appears in user
5775      code.  */
5776   if (0)
5777      goto yyerrorlab;
5778
5779 yyvsp -= yylen;
5780   yyssp -= yylen;
5781   yystate = *yyssp;
5782   goto yyerrlab1;
5783
5784
5785 /*-------------------------------------------------------------.
5786 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
5787 `-------------------------------------------------------------*/
5788 yyerrlab1:
5789   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
5790
5791   for (;;)
5792     {
5793       yyn = yypact[yystate];
5794       if (yyn != YYPACT_NINF)
5795         {
5796           yyn += YYTERROR;
5797           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5798             {
5799               yyn = yytable[yyn];
5800               if (0 < yyn)
5801                 break;
5802             }
5803         }
5804
5805       /* Pop the current state because it cannot handle the error token.  */
5806       if (yyssp == yyss)
5807         YYABORT;
5808
5809
5810       yydestruct ("Error: popping", yystos[yystate], yyvsp);
5811       YYPOPSTACK;
5812       yystate = *yyssp;
5813       YY_STACK_PRINT (yyss, yyssp);
5814     }
5815
5816   if (yyn == YYFINAL)
5817     YYACCEPT;
5818
5819   *++yyvsp = yylval;
5820
5821
5822   /* Shift the error token. */
5823   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
5824
5825   yystate = yyn;
5826   goto yynewstate;
5827
5828
5829 /*-------------------------------------.
5830 | yyacceptlab -- YYACCEPT comes here.  |
5831 `-------------------------------------*/
5832 yyacceptlab:
5833   yyresult = 0;
5834   goto yyreturn;
5835
5836 /*-----------------------------------.
5837 | yyabortlab -- YYABORT comes here.  |
5838 `-----------------------------------*/
5839 yyabortlab:
5840   yyresult = 1;
5841   goto yyreturn;
5842
5843 #ifndef yyoverflow
5844 /*-------------------------------------------------.
5845 | yyexhaustedlab -- memory exhaustion comes here.  |
5846 `-------------------------------------------------*/
5847 yyexhaustedlab:
5848   yyerror (YY_("memory exhausted"));
5849   yyresult = 2;
5850   /* Fall through.  */
5851 #endif
5852
5853 yyreturn:
5854   if (yychar != YYEOF && yychar != YYEMPTY)
5855      yydestruct ("Cleanup: discarding lookahead",
5856                  yytoken, &yylval);
5857   while (yyssp != yyss)
5858     {
5859       yydestruct ("Cleanup: popping",
5860                   yystos[*yyssp], yyvsp);
5861       YYPOPSTACK;
5862     }
5863 #ifndef yyoverflow
5864   if (yyss != yyssa)
5865     YYSTACK_FREE (yyss);
5866 #endif
5867   return yyresult;
5868 }
5869
5870
5871 #line 2825 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
5872
5873
5874 void llvm::GenerateError(const std::string &message, int LineNo) {
5875   if (LineNo == -1) LineNo = llvmAsmlineno;
5876   // TODO: column number in exception
5877   if (TheParseError)
5878     TheParseError->setError(CurFilename, message, LineNo);
5879   TriggerError = 1;
5880 }
5881
5882 int yyerror(const char *ErrorMsg) {
5883   std::string where 
5884     = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5885                   + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5886   std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading ";
5887   if (yychar == YYEMPTY || yychar == 0)
5888     errMsg += "end-of-file.";
5889   else
5890     errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'";
5891   GenerateError(errMsg);
5892   return 0;
5893 }
5894