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