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