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