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