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