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