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