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