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