LLVM API Documentation

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

llvmAsmParser.cpp

Go to the documentation of this file.
00001 /* A Bison parser, made by GNU Bison 2.0.  */
00002 
00003 /* Skeleton parser for Yacc-like parsing with Bison,
00004    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2, or (at your option)
00009    any later version.
00010 
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with this program; if not, write to the Free Software
00018    Foundation, Inc., 59 Temple Place - Suite 330,
00019    Boston, MA 02111-1307, USA.  */
00020 
00021 /* As a special exception, when this file is copied by Bison into a
00022    Bison output file, you may use that output file without restriction.
00023    This special exception was added by the Free Software Foundation
00024    in version 1.24 of Bison.  */
00025 
00026 /* Written by Richard Stallman by simplifying the original so called
00027    ``semantic'' parser.  */
00028 
00029 /* All symbols defined below should begin with yy or YY, to avoid
00030    infringing on user name space.  This should be done even for local
00031    variables, as they might otherwise be expanded by user macros.
00032    There are some unavoidable exceptions within include files to
00033    define necessary library symbols; they are noted "INFRINGES ON
00034    USER NAME SPACE" below.  */
00035 
00036 /* Identify Bison output.  */
00037 #define YYBISON 1
00038 
00039 /* Skeleton name.  */
00040 #define YYSKELETON_NAME "yacc.c"
00041 
00042 /* Pure parsers.  */
00043 #define YYPURE 0
00044 
00045 /* Using locations.  */
00046 #define YYLSP_NEEDED 0
00047 
00048 /* Substitute the variable and function names.  */
00049 #define yyparse llvmAsmparse
00050 #define yylex   llvmAsmlex
00051 #define yyerror llvmAsmerror
00052 #define yylval  llvmAsmlval
00053 #define yychar  llvmAsmchar
00054 #define yydebug llvmAsmdebug
00055 #define yynerrs llvmAsmnerrs
00056 
00057 
00058 /* Tokens.  */
00059 #ifndef YYTOKENTYPE
00060 # define YYTOKENTYPE
00061    /* Put the tokens into the symbol table, so that GDB and other debuggers
00062       know about them.  */
00063    enum yytokentype {
00064      ESINT64VAL = 258,
00065      EUINT64VAL = 259,
00066      SINTVAL = 260,
00067      UINTVAL = 261,
00068      FPVAL = 262,
00069      VOID = 263,
00070      BOOL = 264,
00071      SBYTE = 265,
00072      UBYTE = 266,
00073      SHORT = 267,
00074      USHORT = 268,
00075      INT = 269,
00076      UINT = 270,
00077      LONG = 271,
00078      ULONG = 272,
00079      FLOAT = 273,
00080      DOUBLE = 274,
00081      TYPE = 275,
00082      LABEL = 276,
00083      VAR_ID = 277,
00084      LABELSTR = 278,
00085      STRINGCONSTANT = 279,
00086      IMPLEMENTATION = 280,
00087      ZEROINITIALIZER = 281,
00088      TRUETOK = 282,
00089      FALSETOK = 283,
00090      BEGINTOK = 284,
00091      ENDTOK = 285,
00092      DECLARE = 286,
00093      GLOBAL = 287,
00094      CONSTANT = 288,
00095      VOLATILE = 289,
00096      TO = 290,
00097      DOTDOTDOT = 291,
00098      NULL_TOK = 292,
00099      UNDEF = 293,
00100      CONST = 294,
00101      INTERNAL = 295,
00102      LINKONCE = 296,
00103      WEAK = 297,
00104      APPENDING = 298,
00105      OPAQUE = 299,
00106      NOT = 300,
00107      EXTERNAL = 301,
00108      TARGET = 302,
00109      TRIPLE = 303,
00110      ENDIAN = 304,
00111      POINTERSIZE = 305,
00112      LITTLE = 306,
00113      BIG = 307,
00114      DEPLIBS = 308,
00115      RET = 309,
00116      BR = 310,
00117      SWITCH = 311,
00118      INVOKE = 312,
00119      UNWIND = 313,
00120      UNREACHABLE = 314,
00121      ADD = 315,
00122      SUB = 316,
00123      MUL = 317,
00124      DIV = 318,
00125      REM = 319,
00126      AND = 320,
00127      OR = 321,
00128      XOR = 322,
00129      SETLE = 323,
00130      SETGE = 324,
00131      SETLT = 325,
00132      SETGT = 326,
00133      SETEQ = 327,
00134      SETNE = 328,
00135      MALLOC = 329,
00136      ALLOCA = 330,
00137      FREE = 331,
00138      LOAD = 332,
00139      STORE = 333,
00140      GETELEMENTPTR = 334,
00141      PHI_TOK = 335,
00142      CALL = 336,
00143      CAST = 337,
00144      SELECT = 338,
00145      SHL = 339,
00146      SHR = 340,
00147      VAARG = 341,
00148      VANEXT = 342,
00149      VA_ARG = 343
00150    };
00151 #endif
00152 #define ESINT64VAL 258
00153 #define EUINT64VAL 259
00154 #define SINTVAL 260
00155 #define UINTVAL 261
00156 #define FPVAL 262
00157 #define VOID 263
00158 #define BOOL 264
00159 #define SBYTE 265
00160 #define UBYTE 266
00161 #define SHORT 267
00162 #define USHORT 268
00163 #define INT 269
00164 #define UINT 270
00165 #define LONG 271
00166 #define ULONG 272
00167 #define FLOAT 273
00168 #define DOUBLE 274
00169 #define TYPE 275
00170 #define LABEL 276
00171 #define VAR_ID 277
00172 #define LABELSTR 278
00173 #define STRINGCONSTANT 279
00174 #define IMPLEMENTATION 280
00175 #define ZEROINITIALIZER 281
00176 #define TRUETOK 282
00177 #define FALSETOK 283
00178 #define BEGINTOK 284
00179 #define ENDTOK 285
00180 #define DECLARE 286
00181 #define GLOBAL 287
00182 #define CONSTANT 288
00183 #define VOLATILE 289
00184 #define TO 290
00185 #define DOTDOTDOT 291
00186 #define NULL_TOK 292
00187 #define UNDEF 293
00188 #define CONST 294
00189 #define INTERNAL 295
00190 #define LINKONCE 296
00191 #define WEAK 297
00192 #define APPENDING 298
00193 #define OPAQUE 299
00194 #define NOT 300
00195 #define EXTERNAL 301
00196 #define TARGET 302
00197 #define TRIPLE 303
00198 #define ENDIAN 304
00199 #define POINTERSIZE 305
00200 #define LITTLE 306
00201 #define BIG 307
00202 #define DEPLIBS 308
00203 #define RET 309
00204 #define BR 310
00205 #define SWITCH 311
00206 #define INVOKE 312
00207 #define UNWIND 313
00208 #define UNREACHABLE 314
00209 #define ADD 315
00210 #define SUB 316
00211 #define MUL 317
00212 #define DIV 318
00213 #define REM 319
00214 #define AND 320
00215 #define OR 321
00216 #define XOR 322
00217 #define SETLE 323
00218 #define SETGE 324
00219 #define SETLT 325
00220 #define SETGT 326
00221 #define SETEQ 327
00222 #define SETNE 328
00223 #define MALLOC 329
00224 #define ALLOCA 330
00225 #define FREE 331
00226 #define LOAD 332
00227 #define STORE 333
00228 #define GETELEMENTPTR 334
00229 #define PHI_TOK 335
00230 #define CALL 336
00231 #define CAST 337
00232 #define SELECT 338
00233 #define SHL 339
00234 #define SHR 340
00235 #define VAARG 341
00236 #define VANEXT 342
00237 #define VA_ARG 343
00238 
00239 
00240 
00241 
00242 /* Copy the first part of user declarations.  */
00243 #line 14 "llvmAsmParser.y"
00244 
00245 #include "ParserInternals.h"
00246 #include "llvm/Instructions.h"
00247 #include "llvm/Module.h"
00248 #include "llvm/SymbolTable.h"
00249 #include "llvm/Support/GetElementPtrTypeIterator.h"
00250 #include "llvm/ADT/STLExtras.h"
00251 #include <algorithm>
00252 #include <iostream>
00253 #include <list>
00254 #include <utility>
00255 
00256 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
00257 int yylex();                       // declaration" of xxx warnings.
00258 int yyparse();
00259 
00260 namespace llvm {
00261   std::string CurFilename;
00262 }
00263 using namespace llvm;
00264 
00265 static Module *ParserResult;
00266 
00267 // DEBUG_UPREFS - Define this symbol if you want to enable debugging output
00268 // relating to upreferences in the input stream.
00269 //
00270 //#define DEBUG_UPREFS 1
00271 #ifdef DEBUG_UPREFS
00272 #define UR_OUT(X) std::cerr << X
00273 #else
00274 #define UR_OUT(X)
00275 #endif
00276 
00277 #define YYERROR_VERBOSE 1
00278 
00279 // HACK ALERT: This variable is used to implement the automatic conversion of
00280 // variable argument instructions from their old to new forms.  When this
00281 // compatiblity "Feature" is removed, this should be too.
00282 //
00283 static BasicBlock *CurBB;
00284 static bool ObsoleteVarArgs;
00285 
00286 
00287 // This contains info used when building the body of a function.  It is
00288 // destroyed when the function is completed.
00289 //
00290 typedef std::vector<Value *> ValueList;           // Numbered defs
00291 static void ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers,
00292                                std::map<const Type *,ValueList> *FutureLateResolvers = 0);
00293 
00294 static struct PerModuleInfo {
00295   Module *CurrentModule;
00296   std::map<const Type *, ValueList> Values; // Module level numbered definitions
00297   std::map<const Type *,ValueList> LateResolveValues;
00298   std::vector<PATypeHolder>    Types;
00299   std::map<ValID, PATypeHolder> LateResolveTypes;
00300 
00301   /// PlaceHolderInfo - When temporary placeholder objects are created, remember
00302   /// how they were referenced and one which line of the input they came from so
00303   /// that we can resolve them later and print error messages as appropriate.
00304   std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
00305 
00306   // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
00307   // references to global values.  Global values may be referenced before they
00308   // are defined, and if so, the temporary object that they represent is held
00309   // here.  This is used for forward references of GlobalValues.
00310   //
00311   typedef std::map<std::pair<const PointerType *,
00312                              ValID>, GlobalValue*> GlobalRefsType;
00313   GlobalRefsType GlobalRefs;
00314 
00315   void ModuleDone() {
00316     // If we could not resolve some functions at function compilation time
00317     // (calls to functions before they are defined), resolve them now...  Types
00318     // are resolved when the constant pool has been completely parsed.
00319     //
00320     ResolveDefinitions(LateResolveValues);
00321 
00322     // Check to make sure that all global value forward references have been
00323     // resolved!
00324     //
00325     if (!GlobalRefs.empty()) {
00326       std::string UndefinedReferences = "Unresolved global references exist:\n";
00327       
00328       for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
00329            I != E; ++I) {
00330         UndefinedReferences += "  " + I->first.first->getDescription() + " " +
00331                                I->first.second.getName() + "\n";
00332       }
00333       ThrowException(UndefinedReferences);
00334     }
00335 
00336     Values.clear();         // Clear out function local definitions
00337     Types.clear();
00338     CurrentModule = 0;
00339   }
00340 
00341 
00342   // GetForwardRefForGlobal - Check to see if there is a forward reference
00343   // for this global.  If so, remove it from the GlobalRefs map and return it.
00344   // If not, just return null.
00345   GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
00346     // Check to see if there is a forward reference to this global variable...
00347     // if there is, eliminate it and patch the reference to use the new def'n.
00348     GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
00349     GlobalValue *Ret = 0;
00350     if (I != GlobalRefs.end()) {
00351       Ret = I->second;
00352       GlobalRefs.erase(I);
00353     }
00354     return Ret;
00355   }
00356 } CurModule;
00357 
00358 static struct PerFunctionInfo {
00359   Function *CurrentFunction;     // Pointer to current function being created
00360 
00361   std::map<const Type*, ValueList> Values;   // Keep track of #'d definitions
00362   std::map<const Type*, ValueList> LateResolveValues;
00363   std::vector<PATypeHolder> Types;
00364   std::map<ValID, PATypeHolder> LateResolveTypes;
00365   bool isDeclare;                // Is this function a forward declararation?
00366 
00367   /// BBForwardRefs - When we see forward references to basic blocks, keep
00368   /// track of them here.
00369   std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs;
00370   std::vector<BasicBlock*> NumberedBlocks;
00371   unsigned NextBBNum;
00372 
00373   inline PerFunctionInfo() {
00374     CurrentFunction = 0;
00375     isDeclare = false;
00376   }
00377 
00378   inline void FunctionStart(Function *M) {
00379     CurrentFunction = M;
00380     NextBBNum = 0;
00381   }
00382 
00383   void FunctionDone() {
00384     NumberedBlocks.clear();
00385 
00386     // Any forward referenced blocks left?
00387     if (!BBForwardRefs.empty())
00388       ThrowException("Undefined reference to label " +
00389                      BBForwardRefs.begin()->second.first.getName());
00390 
00391     // Resolve all forward references now.
00392     ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
00393 
00394     Values.clear();         // Clear out function local definitions
00395     Types.clear();          // Clear out function local types
00396     CurrentFunction = 0;
00397     isDeclare = false;
00398   }
00399 } CurFun;  // Info for the current function...
00400 
00401 static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
00402 
00403 
00404 //===----------------------------------------------------------------------===//
00405 //               Code to handle definitions of all the types
00406 //===----------------------------------------------------------------------===//
00407 
00408 static int InsertValue(Value *V,
00409                   std::map<const Type*,ValueList> &ValueTab = CurFun.Values) {
00410   if (V->hasName()) return -1;           // Is this a numbered definition?
00411 
00412   // Yes, insert the value into the value table...
00413   ValueList &List = ValueTab[V->getType()];
00414   List.push_back(V);
00415   return List.size()-1;
00416 }
00417 
00418 static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
00419   switch (D.Type) {
00420   case ValID::NumberVal:               // Is it a numbered definition?
00421     // Module constants occupy the lowest numbered slots...
00422     if ((unsigned)D.Num < CurModule.Types.size()) 
00423       return CurModule.Types[(unsigned)D.Num];
00424     break;
00425   case ValID::NameVal:                 // Is it a named definition?
00426     if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
00427       D.destroy();  // Free old strdup'd memory...
00428       return N;
00429     }
00430     break;
00431   default:
00432     ThrowException("Internal parser error: Invalid symbol type reference!");
00433   }
00434 
00435   // If we reached here, we referenced either a symbol that we don't know about
00436   // or an id number that hasn't been read yet.  We may be referencing something
00437   // forward, so just create an entry to be resolved later and get to it...
00438   //
00439   if (DoNotImprovise) return 0;  // Do we just want a null to be returned?
00440 
00441   std::map<ValID, PATypeHolder> &LateResolver = inFunctionScope() ? 
00442     CurFun.LateResolveTypes : CurModule.LateResolveTypes;
00443   
00444   std::map<ValID, PATypeHolder>::iterator I = LateResolver.find(D);
00445   if (I != LateResolver.end()) {
00446     return I->second;
00447   }
00448 
00449   Type *Typ = OpaqueType::get();
00450   LateResolver.insert(std::make_pair(D, Typ));
00451   return Typ;
00452 }
00453 
00454 static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) {
00455   SymbolTable &SymTab = 
00456     inFunctionScope() ? CurFun.CurrentFunction->getSymbolTable() :
00457                         CurModule.CurrentModule->getSymbolTable();
00458   return SymTab.lookup(Ty, Name);
00459 }
00460 
00461 // getValNonImprovising - Look up the value specified by the provided type and
00462 // the provided ValID.  If the value exists and has already been defined, return
00463 // it.  Otherwise return null.
00464 //
00465 static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
00466   if (isa<FunctionType>(Ty))
00467     ThrowException("Functions are not values and "
00468                    "must be referenced as pointers");
00469 
00470   switch (D.Type) {
00471   case ValID::NumberVal: {                 // Is it a numbered definition?
00472     unsigned Num = (unsigned)D.Num;
00473 
00474     // Module constants occupy the lowest numbered slots...
00475     std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
00476     if (VI != CurModule.Values.end()) {
00477       if (Num < VI->second.size()) 
00478         return VI->second[Num];
00479       Num -= VI->second.size();
00480     }
00481 
00482     // Make sure that our type is within bounds
00483     VI = CurFun.Values.find(Ty);
00484     if (VI == CurFun.Values.end()) return 0;
00485 
00486     // Check that the number is within bounds...
00487     if (VI->second.size() <= Num) return 0;
00488   
00489     return VI->second[Num];
00490   }
00491 
00492   case ValID::NameVal: {                // Is it a named definition?
00493     Value *N = lookupInSymbolTable(Ty, std::string(D.Name));
00494     if (N == 0) return 0;
00495 
00496     D.destroy();  // Free old strdup'd memory...
00497     return N;
00498   }
00499 
00500   // Check to make sure that "Ty" is an integral type, and that our 
00501   // value will fit into the specified type...
00502   case ValID::ConstSIntVal:    // Is it a constant pool reference??
00503     if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64))
00504       ThrowException("Signed integral constant '" +
00505                      itostr(D.ConstPool64) + "' is invalid for type '" + 
00506                      Ty->getDescription() + "'!");
00507     return ConstantSInt::get(Ty, D.ConstPool64);
00508 
00509   case ValID::ConstUIntVal:     // Is it an unsigned const pool reference?
00510     if (!ConstantUInt::isValueValidForType(Ty, D.UConstPool64)) {
00511       if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) {
00512         ThrowException("Integral constant '" + utostr(D.UConstPool64) +
00513                        "' is invalid or out of range!");
00514       } else {     // This is really a signed reference.  Transmogrify.
00515         return ConstantSInt::get(Ty, D.ConstPool64);
00516       }
00517     } else {
00518       return ConstantUInt::get(Ty, D.UConstPool64);
00519     }
00520 
00521   case ValID::ConstFPVal:        // Is it a floating point const pool reference?
00522     if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP))
00523       ThrowException("FP constant invalid for type!!");
00524     return ConstantFP::get(Ty, D.ConstPoolFP);
00525     
00526   case ValID::ConstNullVal:      // Is it a null value?
00527     if (!isa<PointerType>(Ty))
00528       ThrowException("Cannot create a a non pointer null!");
00529     return ConstantPointerNull::get(cast<PointerType>(Ty));
00530     
00531   case ValID::ConstUndefVal:      // Is it an undef value?
00532     return UndefValue::get(Ty);
00533     
00534   case ValID::ConstantVal:       // Fully resolved constant?
00535     if (D.ConstantValue->getType() != Ty)
00536       ThrowException("Constant expression type different from required type!");
00537     return D.ConstantValue;
00538 
00539   default:
00540     assert(0 && "Unhandled case!");
00541     return 0;
00542   }   // End of switch
00543 
00544   assert(0 && "Unhandled case!");
00545   return 0;
00546 }
00547 
00548 // getVal - This function is identical to getValNonImprovising, except that if a
00549 // value is not already defined, it "improvises" by creating a placeholder var
00550 // that looks and acts just like the requested variable.  When the value is
00551 // defined later, all uses of the placeholder variable are replaced with the
00552 // real thing.
00553 //
00554 static Value *getVal(const Type *Ty, const ValID &ID) {
00555   if (Ty == Type::LabelTy)
00556     ThrowException("Cannot use a basic block here");
00557 
00558   // See if the value has already been defined.
00559   Value *V = getValNonImprovising(Ty, ID);
00560   if (V) return V;
00561 
00562   // If we reached here, we referenced either a symbol that we don't know about
00563   // or an id number that hasn't been read yet.  We may be referencing something
00564   // forward, so just create an entry to be resolved later and get to it...
00565   //
00566   V = new Argument(Ty);
00567 
00568   // Remember where this forward reference came from.  FIXME, shouldn't we try
00569   // to recycle these things??
00570   CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
00571                                                                llvmAsmlineno)));
00572 
00573   if (inFunctionScope())
00574     InsertValue(V, CurFun.LateResolveValues);
00575   else 
00576     InsertValue(V, CurModule.LateResolveValues);
00577   return V;
00578 }
00579 
00580 /// getBBVal - This is used for two purposes:
00581 ///  * If isDefinition is true, a new basic block with the specified ID is being
00582 ///    defined.
00583 ///  * If isDefinition is true, this is a reference to a basic block, which may
00584 ///    or may not be a forward reference.
00585 ///
00586 static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
00587   assert(inFunctionScope() && "Can't get basic block at global scope!");
00588 
00589   std::string Name;
00590   BasicBlock *BB = 0;
00591   switch (ID.Type) {
00592   default: ThrowException("Illegal label reference " + ID.getName());
00593   case ValID::NumberVal:                // Is it a numbered definition?
00594     if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size())
00595       CurFun.NumberedBlocks.resize(ID.Num+1);
00596     BB = CurFun.NumberedBlocks[ID.Num];
00597     break;
00598   case ValID::NameVal:                  // Is it a named definition?
00599     Name = ID.Name;
00600     if (Value *N = CurFun.CurrentFunction->
00601                    getSymbolTable().lookup(Type::LabelTy, Name))
00602       BB = cast<BasicBlock>(N);
00603     break;
00604   }
00605 
00606   // See if the block has already been defined.
00607   if (BB) {
00608     // If this is the definition of the block, make sure the existing value was
00609     // just a forward reference.  If it was a forward reference, there will be
00610     // an entry for it in the PlaceHolderInfo map.
00611     if (isDefinition && !CurFun.BBForwardRefs.erase(BB))
00612       // The existing value was a definition, not a forward reference.
00613       ThrowException("Redefinition of label " + ID.getName());
00614 
00615     ID.destroy();                       // Free strdup'd memory.
00616     return BB;
00617   }
00618 
00619   // Otherwise this block has not been seen before.
00620   BB = new BasicBlock("", CurFun.CurrentFunction);
00621   if (ID.Type == ValID::NameVal) {
00622     BB->setName(ID.Name);
00623   } else {
00624     CurFun.NumberedBlocks[ID.Num] = BB;
00625   }
00626 
00627   // If this is not a definition, keep track of it so we can use it as a forward
00628   // reference.
00629   if (!isDefinition) {
00630     // Remember where this forward reference came from.
00631     CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno);
00632   } else {
00633     // The forward declaration could have been inserted anywhere in the
00634     // function: insert it into the correct place now.
00635     CurFun.CurrentFunction->getBasicBlockList().remove(BB);
00636     CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
00637   }
00638   ID.destroy();
00639   return BB;
00640 }
00641 
00642 
00643 //===----------------------------------------------------------------------===//
00644 //              Code to handle forward references in instructions
00645 //===----------------------------------------------------------------------===//
00646 //
00647 // This code handles the late binding needed with statements that reference
00648 // values not defined yet... for example, a forward branch, or the PHI node for
00649 // a loop body.
00650 //
00651 // This keeps a table (CurFun.LateResolveValues) of all such forward references
00652 // and back patchs after we are done.
00653 //
00654 
00655 // ResolveDefinitions - If we could not resolve some defs at parsing 
00656 // time (forward branches, phi functions for loops, etc...) resolve the 
00657 // defs now...
00658 //
00659 static void ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
00660                                std::map<const Type*,ValueList> *FutureLateResolvers) {
00661   // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
00662   for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(),
00663          E = LateResolvers.end(); LRI != E; ++LRI) {
00664     ValueList &List = LRI->second;
00665     while (!List.empty()) {
00666       Value *V = List.back();
00667       List.pop_back();
00668 
00669       std::map<Value*, std::pair<ValID, int> >::iterator PHI =
00670         CurModule.PlaceHolderInfo.find(V);
00671       assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
00672 
00673       ValID &DID = PHI->second.first;
00674 
00675       Value *TheRealValue = getValNonImprovising(LRI->first, DID);
00676       if (TheRealValue) {
00677         V->replaceAllUsesWith(TheRealValue);
00678         delete V;
00679         CurModule.PlaceHolderInfo.erase(PHI);
00680       } else if (FutureLateResolvers) {
00681         // Functions have their unresolved items forwarded to the module late
00682         // resolver table
00683         InsertValue(V, *FutureLateResolvers);
00684       } else {
00685         if (DID.Type == ValID::NameVal)
00686           ThrowException("Reference to an invalid definition: '" +DID.getName()+
00687                          "' of type '" + V->getType()->getDescription() + "'",
00688                          PHI->second.second);
00689         else
00690           ThrowException("Reference to an invalid definition: #" +
00691                          itostr(DID.Num) + " of type '" + 
00692                          V->getType()->getDescription() + "'",
00693                          PHI->second.second);
00694       }
00695     }
00696   }
00697 
00698   LateResolvers.clear();
00699 }
00700 
00701 // ResolveTypeTo - A brand new type was just declared.  This means that (if
00702 // name is not null) things referencing Name can be resolved.  Otherwise, things
00703 // refering to the number can be resolved.  Do this now.
00704 //
00705 static void ResolveTypeTo(char *Name, const Type *ToTy) {
00706   std::vector<PATypeHolder> &Types = inFunctionScope() ? 
00707      CurFun.Types : CurModule.Types;
00708 
00709    ValID D;
00710    if (Name) D = ValID::create(Name);
00711    else      D = ValID::create((int)Types.size());
00712 
00713    std::map<ValID, PATypeHolder> &LateResolver = inFunctionScope() ? 
00714      CurFun.LateResolveTypes : CurModule.LateResolveTypes;
00715   
00716    std::map<ValID, PATypeHolder>::iterator I = LateResolver.find(D);
00717    if (I != LateResolver.end()) {
00718      ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
00719      LateResolver.erase(I);
00720    }
00721 }
00722 
00723 // ResolveTypes - At this point, all types should be resolved.  Any that aren't
00724 // are errors.
00725 //
00726 static void ResolveTypes(std::map<ValID, PATypeHolder> &LateResolveTypes) {
00727   if (!LateResolveTypes.empty()) {
00728     const ValID &DID = LateResolveTypes.begin()->first;
00729 
00730     if (DID.Type == ValID::NameVal)
00731       ThrowException("Reference to an invalid type: '" +DID.getName() + "'");
00732     else
00733       ThrowException("Reference to an invalid type: #" + itostr(DID.Num));
00734   }
00735 }
00736 
00737 // setValueName - Set the specified value to the name given.  The name may be
00738 // null potentially, in which case this is a noop.  The string passed in is
00739 // assumed to be a malloc'd string buffer, and is free'd by this function.
00740 //
00741 static void setValueName(Value *V, char *NameStr) {
00742   if (NameStr) {
00743     std::string Name(NameStr);      // Copy string
00744     free(NameStr);                  // Free old string
00745 
00746     if (V->getType() == Type::VoidTy) 
00747       ThrowException("Can't assign name '" + Name+"' to value with void type!");
00748     
00749     assert(inFunctionScope() && "Must be in function scope!");
00750     SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable();
00751     if (ST.lookup(V->getType(), Name))
00752       ThrowException("Redefinition of value named '" + Name + "' in the '" +
00753                      V->getType()->getDescription() + "' type plane!");
00754     
00755     // Set the name.
00756     V->setName(Name, &ST);
00757   }
00758 }
00759 
00760 /// ParseGlobalVariable - Handle parsing of a global.  If Initializer is null,
00761 /// this is a declaration, otherwise it is a definition.
00762 static void ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage,
00763                                 bool isConstantGlobal, const Type *Ty,
00764                                 Constant *Initializer) {
00765   if (isa<FunctionType>(Ty))
00766     ThrowException("Cannot declare global vars of function type!");
00767 
00768   const PointerType *PTy = PointerType::get(Ty); 
00769 
00770   std::string Name;
00771   if (NameStr) {
00772     Name = NameStr;      // Copy string
00773     free(NameStr);       // Free old string
00774   }
00775 
00776   // See if this global value was forward referenced.  If so, recycle the
00777   // object.
00778   ValID ID; 
00779   if (!Name.empty()) {
00780     ID = ValID::create((char*)Name.c_str());
00781   } else {
00782     ID = ValID::create((int)CurModule.Values[PTy].size());
00783   }
00784 
00785   if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
00786     // Move the global to the end of the list, from whereever it was 
00787     // previously inserted.
00788     GlobalVariable *GV = cast<GlobalVariable>(FWGV);
00789     CurModule.CurrentModule->getGlobalList().remove(GV);
00790     CurModule.CurrentModule->getGlobalList().push_back(GV);
00791     GV->setInitializer(Initializer);
00792     GV->setLinkage(Linkage);
00793     GV->setConstant(isConstantGlobal);
00794     InsertValue(GV, CurModule.Values);
00795     return;
00796   }
00797 
00798   // If this global has a name, check to see if there is already a definition
00799   // of this global in the module.  If so, merge as appropriate.  Note that
00800   // this is really just a hack around problems in the CFE.  :(
00801   if (!Name.empty()) {
00802     // We are a simple redefinition of a value, check to see if it is defined
00803     // the same as the old one.
00804     if (GlobalVariable *EGV = 
00805                 CurModule.CurrentModule->getGlobalVariable(Name, Ty)) {
00806       // We are allowed to redefine a global variable in two circumstances:
00807       // 1. If at least one of the globals is uninitialized or 
00808       // 2. If both initializers have the same value.
00809       //
00810       if (!EGV->hasInitializer() || !Initializer ||
00811           EGV->getInitializer() == Initializer) {
00812 
00813         // Make sure the existing global version gets the initializer!  Make
00814         // sure that it also gets marked const if the new version is.
00815         if (Initializer && !EGV->hasInitializer())
00816           EGV->setInitializer(Initializer);
00817         if (isConstantGlobal)
00818           EGV->setConstant(true);
00819         EGV->setLinkage(Linkage);
00820         return;
00821       }
00822 
00823       ThrowException("Redefinition of global variable named '" + Name + 
00824                      "' in the '" + Ty->getDescription() + "' type plane!");
00825     }
00826   }
00827 
00828   // Otherwise there is no existing GV to use, create one now.
00829   GlobalVariable *GV =
00830     new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, 
00831                        CurModule.CurrentModule);
00832   InsertValue(GV, CurModule.Values);
00833 }
00834 
00835 // setTypeName - Set the specified type to the name given.  The name may be
00836 // null potentially, in which case this is a noop.  The string passed in is
00837 // assumed to be a malloc'd string buffer, and is freed by this function.
00838 //
00839 // This function returns true if the type has already been defined, but is
00840 // allowed to be redefined in the specified context.  If the name is a new name
00841 // for the type plane, it is inserted and false is returned.
00842 static bool setTypeName(const Type *T, char *NameStr) {
00843   assert(!inFunctionScope() && "Can't give types function-local names!");
00844   if (NameStr == 0) return false;
00845   
00846   std::string Name(NameStr);      // Copy string
00847   free(NameStr);                  // Free old string
00848 
00849   // We don't allow assigning names to void type
00850   if (T == Type::VoidTy) 
00851     ThrowException("Can't assign name '" + Name + "' to the void type!");
00852 
00853   // Set the type name, checking for conflicts as we do so.
00854   bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
00855 
00856   if (AlreadyExists) {   // Inserting a name that is already defined???
00857     const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
00858     assert(Existing && "Conflict but no matching type?");
00859 
00860     // There is only one case where this is allowed: when we are refining an
00861     // opaque type.  In this case, Existing will be an opaque type.
00862     if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
00863       // We ARE replacing an opaque type!
00864       const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
00865       return true;
00866     }
00867 
00868     // Otherwise, this is an attempt to redefine a type. That's okay if
00869     // the redefinition is identical to the original. This will be so if
00870     // Existing and T point to the same Type object. In this one case we
00871     // allow the equivalent redefinition.
00872     if (Existing == T) return true;  // Yes, it's equal.
00873 
00874     // Any other kind of (non-equivalent) redefinition is an error.
00875     ThrowException("Redefinition of type named '" + Name + "' in the '" +
00876                    T->getDescription() + "' type plane!");
00877   }
00878 
00879   return false;
00880 }
00881 
00882 //===----------------------------------------------------------------------===//
00883 // Code for handling upreferences in type names...
00884 //
00885 
00886 // TypeContains - Returns true if Ty directly contains E in it.
00887 //
00888 static bool TypeContains(const Type *Ty, const Type *E) {
00889   return find(Ty->subtype_begin(), Ty->subtype_end(), E) != Ty->subtype_end();
00890 }
00891 
00892 namespace {
00893   struct UpRefRecord {
00894     // NestingLevel - The number of nesting levels that need to be popped before
00895     // this type is resolved.
00896     unsigned NestingLevel;
00897     
00898     // LastContainedTy - This is the type at the current binding level for the
00899     // type.  Every time we reduce the nesting level, this gets updated.
00900     const Type *LastContainedTy;
00901 
00902     // UpRefTy - This is the actual opaque type that the upreference is
00903     // represented with.
00904     OpaqueType *UpRefTy;
00905 
00906     UpRefRecord(unsigned NL, OpaqueType *URTy)
00907       : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
00908   };
00909 }
00910 
00911 // UpRefs - A list of the outstanding upreferences that need to be resolved.
00912 static std::vector<UpRefRecord> UpRefs;
00913 
00914 /// HandleUpRefs - Every time we finish a new layer of types, this function is
00915 /// called.  It loops through the UpRefs vector, which is a list of the
00916 /// currently active types.  For each type, if the up reference is contained in
00917 /// the newly completed type, we decrement the level count.  When the level
00918 /// count reaches zero, the upreferenced type is the type that is passed in:
00919 /// thus we can complete the cycle.
00920 ///
00921 static PATypeHolder HandleUpRefs(const Type *ty) {
00922   if (!ty->isAbstract()) return ty;
00923   PATypeHolder Ty(ty);
00924   UR_OUT("Type '" << Ty->getDescription() << 
00925          "' newly formed.  Resolving upreferences.\n" <<
00926          UpRefs.size() << " upreferences active!\n");
00927 
00928   // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
00929   // to zero), we resolve them all together before we resolve them to Ty.  At
00930   // the end of the loop, if there is anything to resolve to Ty, it will be in
00931   // this variable.
00932   OpaqueType *TypeToResolve = 0;
00933 
00934   for (unsigned i = 0; i != UpRefs.size(); ++i) {
00935     UR_OUT("  UR#" << i << " - TypeContains(" << Ty->getDescription() << ", " 
00936            << UpRefs[i].second->getDescription() << ") = " 
00937            << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
00938     if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
00939       // Decrement level of upreference
00940       unsigned Level = --UpRefs[i].NestingLevel;
00941       UpRefs[i].LastContainedTy = Ty;
00942       UR_OUT("  Uplevel Ref Level = " << Level << "\n");
00943       if (Level == 0) {                     // Upreference should be resolved! 
00944         if (!TypeToResolve) {
00945           TypeToResolve = UpRefs[i].UpRefTy;
00946         } else {
00947           UR_OUT("  * Resolving upreference for "
00948                  << UpRefs[i].second->getDescription() << "\n";
00949                  std::string OldName = UpRefs[i].UpRefTy->getDescription());
00950           UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
00951           UR_OUT("  * Type '" << OldName << "' refined upreference to: "
00952                  << (const void*)Ty << ", " << Ty->getDescription() << "\n");
00953         }
00954         UpRefs.erase(UpRefs.begin()+i);     // Remove from upreference list...
00955         --i;                                // Do not skip the next element...
00956       }
00957     }
00958   }
00959 
00960   if (TypeToResolve) {
00961     UR_OUT("  * Resolving upreference for "
00962            << UpRefs[i].second->getDescription() << "\n";
00963            std::string OldName = TypeToResolve->getDescription());
00964     TypeToResolve->refineAbstractTypeTo(Ty);
00965   }
00966 
00967   return Ty;
00968 }
00969 
00970 
00971 //===----------------------------------------------------------------------===//
00972 //            RunVMAsmParser - Define an interface to this parser
00973 //===----------------------------------------------------------------------===//
00974 //
00975 Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
00976   llvmAsmin = F;
00977   CurFilename = Filename;
00978   llvmAsmlineno = 1;      // Reset the current line number...
00979   ObsoleteVarArgs = false;
00980 
00981   // Allocate a new module to read
00982   CurModule.CurrentModule = new Module(Filename);
00983 
00984   yyparse();       // Parse the file, potentially throwing exception
00985 
00986   Module *Result = ParserResult;
00987 
00988   // Check to see if they called va_start but not va_arg..
00989   if (!ObsoleteVarArgs)
00990     if (Function *F = Result->getNamedFunction("llvm.va_start"))
00991       if (F->asize() == 1) {
00992         std::cerr << "WARNING: this file uses obsolete features.  "
00993                   << "Assemble and disassemble to update it.\n";
00994         ObsoleteVarArgs = true;
00995       }
00996 
00997   if (ObsoleteVarArgs) {
00998     // If the user is making use of obsolete varargs intrinsics, adjust them for
00999     // the user.
01000     if (Function *F = Result->getNamedFunction("llvm.va_start")) {
01001       assert(F->asize() == 1 && "Obsolete va_start takes 1 argument!");
01002 
01003       const Type *RetTy = F->getFunctionType()->getParamType(0);
01004       RetTy = cast<PointerType>(RetTy)->getElementType();
01005       Function *NF = Result->getOrInsertFunction("llvm.va_start", RetTy, 0);
01006       
01007       while (!F->use_empty()) {
01008         CallInst *CI = cast<CallInst>(F->use_back());
01009         Value *V = new CallInst(NF, "", CI);
01010         new StoreInst(V, CI->getOperand(1), CI);
01011         CI->getParent()->getInstList().erase(CI);
01012       }
01013       Result->getFunctionList().erase(F);
01014     }
01015     
01016     if (Function *F = Result->getNamedFunction("llvm.va_end")) {
01017       assert(F->asize() == 1 && "Obsolete va_end takes 1 argument!");
01018       const Type *ArgTy = F->getFunctionType()->getParamType(0);
01019       ArgTy = cast<PointerType>(ArgTy)->getElementType();
01020       Function *NF = Result->getOrInsertFunction("llvm.va_end", Type::VoidTy,
01021                                                  ArgTy, 0);
01022 
01023       while (!F->use_empty()) {
01024         CallInst *CI = cast<CallInst>(F->use_back());
01025         Value *V = new LoadInst(CI->getOperand(1), "", CI);
01026         new CallInst(NF, V, "", CI);
01027         CI->getParent()->getInstList().erase(CI);
01028       }
01029       Result->getFunctionList().erase(F);
01030     }
01031 
01032     if (Function *F = Result->getNamedFunction("llvm.va_copy")) {
01033       assert(F->asize() == 2 && "Obsolete va_copy takes 2 argument!");
01034       const Type *ArgTy = F->getFunctionType()->getParamType(0);
01035       ArgTy = cast<PointerType>(ArgTy)->getElementType();
01036       Function *NF = Result->getOrInsertFunction("llvm.va_copy", ArgTy,
01037                                                  ArgTy, 0);
01038 
01039       while (!F->use_empty()) {
01040         CallInst *CI = cast<CallInst>(F->use_back());
01041         Value *V = new CallInst(NF, CI->getOperand(2), "", CI);
01042         new StoreInst(V, CI->getOperand(1), CI);
01043         CI->getParent()->getInstList().erase(CI);
01044       }
01045       Result->getFunctionList().erase(F);
01046     }
01047   }
01048 
01049   llvmAsmin = stdin;    // F is about to go away, don't use it anymore...
01050   ParserResult = 0;
01051 
01052   return Result;
01053 }
01054 
01055 
01056 
01057 /* Enabling traces.  */
01058 #ifndef YYDEBUG
01059 # define YYDEBUG 0
01060 #endif
01061 
01062 /* Enabling verbose error messages.  */
01063 #ifdef YYERROR_VERBOSE
01064 # undef YYERROR_VERBOSE
01065 # define YYERROR_VERBOSE 1
01066 #else
01067 # define YYERROR_VERBOSE 0
01068 #endif
01069 
01070 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
01071 #line 827 "llvmAsmParser.y"
01072 typedef union YYSTYPE {
01073   llvm::Module                           *ModuleVal;
01074   llvm::Function                         *FunctionVal;
01075   std::pair<llvm::PATypeHolder*, char*>  *ArgVal;
01076   llvm::BasicBlock                       *BasicBlockVal;
01077   llvm::TerminatorInst                   *TermInstVal;
01078   llvm::Instruction                      *InstVal;
01079   llvm::Constant                         *ConstVal;
01080 
01081   const llvm::Type                       *PrimType;
01082   llvm::PATypeHolder                     *TypeVal;
01083   llvm::Value                            *ValueVal;
01084 
01085   std::vector<std::pair<llvm::PATypeHolder*,char*> > *ArgList;
01086   std::vector<llvm::Value*>              *ValueList;
01087   std::list<llvm::PATypeHolder>          *TypeList;
01088   std::list<std::pair<llvm::Value*,
01089                       llvm::BasicBlock*> > *PHIList; // Represent the RHS of PHI node
01090   std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
01091   std::vector<llvm::Constant*>           *ConstVector;
01092 
01093   llvm::GlobalValue::LinkageTypes         Linkage;
01094   int64_t                           SInt64Val;
01095   uint64_t                          UInt64Val;
01096   int                               SIntVal;
01097   unsigned                          UIntVal;
01098   double                            FPVal;
01099   bool                              BoolVal;
01100 
01101   char                             *StrVal;   // This memory is strdup'd!
01102   llvm::ValID                             ValIDVal; // strdup'd memory maybe!
01103 
01104   llvm::Instruction::BinaryOps            BinaryOpVal;
01105   llvm::Instruction::TermOps              TermOpVal;
01106   llvm::Instruction::MemoryOps            MemOpVal;
01107   llvm::Instruction::OtherOps             OtherOpVal;
01108   llvm::Module::Endianness                Endianness;
01109 } YYSTYPE;
01110 /* Line 190 of yacc.c.  */
01111 #line 1112 "llvmAsmParser.tab.c"
01112 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
01113 # define YYSTYPE_IS_DECLARED 1
01114 # define YYSTYPE_IS_TRIVIAL 1
01115 #endif
01116 
01117 
01118 
01119 /* Copy the second part of user declarations.  */
01120 
01121 
01122 /* Line 213 of yacc.c.  */
01123 #line 1124 "llvmAsmParser.tab.c"
01124 
01125 #if ! defined (yyoverflow) || YYERROR_VERBOSE
01126 
01127 # ifndef YYFREE
01128 #  define YYFREE free
01129 # endif
01130 # ifndef YYMALLOC
01131 #  define YYMALLOC malloc
01132 # endif
01133 
01134 /* The parser invokes alloca or malloc; define the necessary symbols.  */
01135 
01136 # ifdef YYSTACK_USE_ALLOCA
01137 #  if YYSTACK_USE_ALLOCA
01138 #   ifdef __GNUC__
01139 #    define YYSTACK_ALLOC __builtin_alloca
01140 #   else
01141 #    define YYSTACK_ALLOC alloca
01142 #   endif
01143 #  endif
01144 # endif
01145 
01146 # ifdef YYSTACK_ALLOC
01147    /* Pacify GCC's `empty if-body' warning. */
01148 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
01149 # else
01150 #  if defined (__STDC__) || defined (__cplusplus)
01151 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
01152 #   define YYSIZE_T size_t
01153 #  endif
01154 #  define YYSTACK_ALLOC YYMALLOC
01155 #  define YYSTACK_FREE YYFREE
01156 # endif
01157 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
01158 
01159 
01160 #if (! defined (yyoverflow) \
01161      && (! defined (__cplusplus) \
01162    || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
01163 
01164 /* A type that is properly aligned for any stack member.  */
01165 union yyalloc
01166 {
01167   short int yyss;
01168   YYSTYPE yyvs;
01169   };
01170 
01171 /* The size of the maximum gap between one aligned stack and the next.  */
01172 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
01173 
01174 /* The size of an array large to enough to hold all stacks, each with
01175    N elements.  */
01176 # define YYSTACK_BYTES(N) \
01177      ((N) * (sizeof (short int) + sizeof (YYSTYPE))     \
01178       + YYSTACK_GAP_MAXIMUM)
01179 
01180 /* Copy COUNT objects from FROM to TO.  The source and destination do
01181    not overlap.  */
01182 # ifndef YYCOPY
01183 #  if defined (__GNUC__) && 1 < __GNUC__
01184 #   define YYCOPY(To, From, Count) \
01185       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
01186 #  else
01187 #   define YYCOPY(To, From, Count)    \
01188       do          \
01189   {         \
01190     register YYSIZE_T yyi;    \
01191     for (yyi = 0; yyi < (Count); yyi++) \
01192       (To)[yyi] = (From)[yyi];    \
01193   }         \
01194       while (0)
01195 #  endif
01196 # endif
01197 
01198 /* Relocate STACK from its old location to the new one.  The
01199    local variables YYSIZE and YYSTACKSIZE give the old and new number of
01200    elements in the stack, and YYPTR gives the new location of the
01201    stack.  Advance YYPTR to a properly aligned location for the next
01202    stack.  */
01203 # define YYSTACK_RELOCATE(Stack)          \
01204     do                  \
01205       {                 \
01206   YYSIZE_T yynewbytes;            \
01207   YYCOPY (&yyptr->Stack, Stack, yysize);        \
01208   Stack = &yyptr->Stack;            \
01209   yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
01210   yyptr += yynewbytes / sizeof (*yyptr);        \
01211       }                 \
01212     while (0)
01213 
01214 #endif
01215 
01216 #if defined (__STDC__) || defined (__cplusplus)
01217    typedef signed char yysigned_char;
01218 #else
01219    typedef short int yysigned_char;
01220 #endif
01221 
01222 /* YYFINAL -- State number of the termination state. */
01223 #define YYFINAL  4
01224 /* YYLAST -- Last index in YYTABLE.  */
01225 #define YYLAST   1211
01226 
01227 /* YYNTOKENS -- Number of terminals. */
01228 #define YYNTOKENS  103
01229 /* YYNNTS -- Number of nonterminals. */
01230 #define YYNNTS  60
01231 /* YYNRULES -- Number of rules. */
01232 #define YYNRULES  205
01233 /* YYNRULES -- Number of states. */
01234 #define YYNSTATES  408
01235 
01236 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
01237 #define YYUNDEFTOK  2
01238 #define YYMAXUTOK   343
01239 
01240 #define YYTRANSLATE(YYX)            \
01241   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
01242 
01243 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
01244 static const unsigned char yytranslate[] =
01245 {
01246        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01247        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01248        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01249        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01250       91,    92,   100,     2,   101,     2,     2,     2,     2,     2,
01251        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01252       96,    89,    97,     2,     2,     2,     2,     2,     2,     2,
01253        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01254        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01255        2,    93,    90,    95,     2,     2,     2,     2,     2,   102,
01256        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01257        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01258       94,     2,     2,    98,     2,    99,     2,     2,     2,     2,
01259        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01260        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01261        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01262        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01263        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01264        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01265        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01266        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01267        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01268        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01269        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01270        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01271        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
01272        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
01273       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
01274       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
01275       35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
01276       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
01277       55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
01278       65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
01279       75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
01280       85,    86,    87,    88
01281 };
01282 
01283 #if YYDEBUG
01284 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
01285    YYRHS.  */
01286 static const unsigned short int yyprhs[] =
01287 {
01288        0,     0,     3,     5,     7,     9,    11,    13,    15,    17,
01289       19,    21,    23,    25,    27,    29,    31,    33,    35,    37,
01290       39,    41,    43,    45,    47,    49,    51,    53,    55,    57,
01291       59,    61,    63,    65,    67,    70,    71,    73,    75,    77,
01292       79,    80,    82,    84,    86,    88,    90,    92,    94,    96,
01293       98,   100,   102,   104,   106,   108,   110,   112,   114,   116,
01294      118,   120,   122,   125,   130,   136,   142,   146,   149,   152,
01295      154,   158,   160,   164,   166,   167,   172,   176,   180,   185,
01296      190,   194,   197,   200,   203,   206,   209,   212,   215,   218,
01297      221,   224,   231,   237,   246,   253,   260,   267,   274,   278,
01298      280,   282,   284,   286,   289,   292,   295,   297,   302,   305,
01299      311,   317,   321,   326,   327,   329,   331,   335,   339,   343,
01300      347,   351,   353,   354,   356,   358,   360,   361,   364,   368,
01301      370,   372,   376,   378,   379,   385,   387,   389,   393,   395,
01302      397,   400,   401,   405,   407,   409,   411,   413,   415,   417,
01303      419,   423,   425,   427,   429,   431,   433,   436,   439,   442,
01304      446,   449,   450,   452,   455,   458,   462,   472,   482,   491,
01305      504,   506,   508,   515,   521,   524,   531,   539,   541,   545,
01306      547,   548,   554,   560,   566,   569,   574,   579,   586,   591,
01307      596,   601,   604,   611,   613,   616,   617,   619,   620,   623,
01308      629,   632,   638,   641,   646,   653
01309 };
01310 
01311 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
01312 static const short int yyrhs[] =
01313 {
01314      127,     0,    -1,     5,    -1,     6,    -1,     3,    -1,     4,
01315       -1,    60,    -1,    61,    -1,    62,    -1,    63,    -1,    64,
01316       -1,    65,    -1,    66,    -1,    67,    -1,    68,    -1,    69,
01317       -1,    70,    -1,    71,    -1,    72,    -1,    73,    -1,    84,
01318       -1,    85,    -1,    16,    -1,    14,    -1,    12,    -1,    10,
01319       -1,    17,    -1,    15,    -1,    13,    -1,    11,    -1,   110,
01320       -1,   111,    -1,    18,    -1,    19,    -1,   134,    89,    -1,
01321       -1,    40,    -1,    41,    -1,    42,    -1,    43,    -1,    -1,
01322      118,    -1,     8,    -1,   120,    -1,     8,    -1,   120,    -1,
01323        9,    -1,    10,    -1,    11,    -1,    12,    -1,    13,    -1,
01324       14,    -1,    15,    -1,    16,    -1,    17,    -1,    18,    -1,
01325       19,    -1,    20,    -1,    21,    -1,    44,    -1,   119,    -1,
01326      147,    -1,    90,     4,    -1,   117,    91,   122,    92,    -1,
01327       93,     4,    94,   120,    95,    -1,    96,     4,    94,   120,
01328       97,    -1,    98,   121,    99,    -1,    98,    99,    -1,   120,
01329      100,    -1,   120,    -1,   121,   101,   120,    -1,   121,    -1,
01330      121,   101,    36,    -1,    36,    -1,    -1,   118,    93,   125,
01331       95,    -1,   118,    93,    95,    -1,   118,   102,    24,    -1,
01332      118,    96,   125,    97,    -1,   118,    98,   125,    99,    -1,
01333      118,    98,    99,    -1,   118,    37,    -1,   118,    38,    -1,
01334      118,   147,    -1,   118,   124,    -1,   118,    26,    -1,   110,
01335      105,    -1,   111,     4,    -1,     9,    27,    -1,     9,    28,
01336       -1,   113,     7,    -1,    82,    91,   123,    35,   118,    92,
01337       -1,    79,    91,   123,   160,    92,    -1,    83,    91,   123,
01338      101,   123,   101,   123,    92,    -1,   106,    91,   123,   101,
01339      123,    92,    -1,   107,    91,   123,   101,   123,    92,    -1,
01340      108,    91,   123,   101,   123,    92,    -1,   109,    91,   123,
01341      101,   123,    92,    -1,   125,   101,   123,    -1,   123,    -1,
01342       32,    -1,    33,    -1,   128,    -1,   128,   143,    -1,   128,
01343      144,    -1,   128,    25,    -1,   129,    -1,   129,   114,    20,
01344      116,    -1,   129,   144,    -1,   129,   114,   115,   126,   123,
01345       -1,   129,   114,    46,   126,   118,    -1,   129,    47,   131,
01346       -1,   129,    53,    89,   132,    -1,    -1,    52,    -1,    51,
01347       -1,    49,    89,   130,    -1,    50,    89,     4,    -1,    48,
01348       89,    24,    -1,    93,   133,    95,    -1,   133,   101,    24,
01349       -1,    24,    -1,    -1,    22,    -1,    24,    -1,   134,    -1,
01350       -1,   118,   135,    -1,   137,   101,   136,    -1,   136,    -1,
01351      137,    -1,   137,   101,    36,    -1,    36,    -1,    -1,   116,
01352      134,    91,   138,    92,    -1,    29,    -1,    98,    -1,   115,
01353      139,   140,    -1,    30,    -1,    99,    -1,   150,   142,    -1,
01354       -1,    31,   145,   139,    -1,     3,    -1,     4,    -1,     7,
01355       -1,    27,    -1,    28,    -1,    37,    -1,    38,    -1,    96,
01356      125,    97,    -1,   124,    -1,   104,    -1,   134,    -1,   147,
01357       -1,   146,    -1,   118,   148,    -1,   150,   151,    -1,   141,
01358      151,    -1,   152,   114,   153,    -1,   152,   155,    -1,    -1,
01359       23,    -1,    54,   149,    -1,    54,     8,    -1,    55,    21,
01360      148,    -1,    55,     9,   148,   101,    21,   148,   101,    21,
01361      148,    -1,    56,   112,   148,   101,    21,   148,    93,   154,
01362       95,    -1,    56,   112,   148,   101,    21,   148,    93,    95,
01363       -1,    57,   116,   148,    91,   158,    92,    35,    21,   148,
01364       58,    21,   148,    -1,    58,    -1,    59,    -1,   154,   112,
01365      146,   101,    21,   148,    -1,   112,   146,   101,    21,   148,
01366       -1,   114,   159,    -1,   118,    93,   148,   101,   148,    95,
01367       -1,   156,   101,    93,   148,   101,   148,    95,    -1,   149,
01368       -1,   157,   101,   149,    -1,   157,    -1,    -1,   106,   118,
01369      148,   101,   148,    -1,   107,   118,   148,   101,   148,    -1,
01370      108,   118,   148,   101,   148,    -1,    45,   149,    -1,   109,
01371      149,   101,   149,    -1,    82,   149,    35,   118,    -1,    83,
01372      149,   101,   149,   101,   149,    -1,    88,   149,   101,   118,
01373       -1,    86,   149,   101,   118,    -1,    87,   149,   101,   118,
01374       -1,    80,   156,    -1,    81,   116,   148,    91,   158,    92,
01375       -1,   162,    -1,   101,   157,    -1,    -1,    34,    -1,    -1,
01376       74,   118,    -1,    74,   118,   101,    15,   148,    -1,    75,
01377      118,    -1,    75,   118,   101,    15,   148,    -1,    76,   149,
01378       -1,   161,    77,   118,   148,    -1,   161,    78,   149,   101,
01379      118,   148,    -1,    79,   118,   148,   160,    -1
01380 };
01381 
01382 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
01383 static const unsigned short int yyrline[] =
01384 {
01385        0,   939,   939,   940,   947,   948,   957,   957,   957,   957,
01386      957,   958,   958,   958,   959,   959,   959,   959,   959,   959,
01387      961,   961,   965,   965,   965,   965,   966,   966,   966,   966,
01388      967,   967,   968,   968,   971,   974,   978,   979,   980,   981,
01389      982,   991,   991,   992,   992,   994,  1003,  1003,  1003,  1003,
01390     1003,  1003,  1003,  1004,  1004,  1004,  1004,  1004,  1004,  1005,
01391     1008,  1011,  1017,  1024,  1035,  1039,  1050,  1058,  1061,  1069,
01392     1073,  1078,  1079,  1082,  1085,  1095,  1120,  1133,  1161,  1186,
01393     1206,  1218,  1227,  1231,  1290,  1296,  1304,  1309,  1314,  1317,
01394     1320,  1325,  1335,  1366,  1373,  1394,  1401,  1406,  1416,  1419,
01395     1426,  1426,  1436,  1443,  1447,  1450,  1453,  1460,  1483,  1485,
01396     1489,  1493,  1495,  1497,  1502,  1503,  1505,  1508,  1516,  1521,
01397     1523,  1527,  1531,  1539,  1539,  1540,  1540,  1542,  1548,  1553,
01398     1559,  1562,  1567,  1571,  1575,  1654,  1654,  1656,  1667,  1667,
01399     1669,  1673,  1673,  1682,  1685,  1688,  1691,  1694,  1697,  1700,
01400     1703,  1727,  1734,  1737,  1742,  1742,  1748,  1752,  1755,  1763,
01401     1772,  1776,  1785,  1795,  1798,  1801,  1804,  1807,  1817,  1821,
01402     1872,  1875,  1881,  1889,  1899,  1906,  1911,  1918,  1922,  1928,
01403     1928,  1930,  1944,  1952,  1962,  1974,  1981,  1988,  1995,  2018,
01404     2022,  2026,  2040,  2092,  2098,  2100,  2104,  2107,  2112,  2116,
01405     2120,  2124,  2128,  2135,  2145,  2158
01406 };
01407 #endif
01408 
01409 #if YYDEBUG || YYERROR_VERBOSE
01410 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
01411    First, the terminals, then, starting at YYNTOKENS, nonterminals. */
01412 static const char *const yytname[] =
01413 {
01414   "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL",
01415   "UINTVAL", "FPVAL", "VOID", "BOOL", "SBYTE", "UBYTE", "SHORT", "USHORT",
01416   "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE", "TYPE", "LABEL",
01417   "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION",
01418   "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK",
01419   "DECLARE", "GLOBAL", "CONSTANT", "VOLATILE", "TO", "DOTDOTDOT",
01420   "NULL_TOK", "UNDEF", "CONST", "INTERNAL", "LINKONCE", "WEAK",
01421   "APPENDING", "OPAQUE", "NOT", "EXTERNAL", "TARGET", "TRIPLE", "ENDIAN",
01422   "POINTERSIZE", "LITTLE", "BIG", "DEPLIBS", "RET", "BR", "SWITCH",
01423   "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB", "MUL", "DIV", "REM",
01424   "AND", "OR", "XOR", "SETLE", "SETGE", "SETLT", "SETGT", "SETEQ", "SETNE",
01425   "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", "PHI_TOK",
01426   "CALL", "CAST", "SELECT", "SHL", "SHR", "VAARG", "VANEXT", "VA_ARG",
01427   "'='", "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'",
01428   "'}'", "'*'", "','", "'c'", "$accept", "INTVAL", "EINT64VAL",
01429   "ArithmeticOps", "LogicalOps", "SetCondOps", "ShiftOps", "SIntType",
01430   "UIntType", "IntType", "FPType", "OptAssign", "OptLinkage", "TypesV",
01431   "UpRTypesV", "Types", "PrimType", "UpRTypes", "TypeListI",
01432   "ArgTypeListI", "ConstVal", "ConstExpr", "ConstVector", "GlobalType",
01433   "Module", "FunctionList", "ConstPool", "BigOrLittle", "TargetDefinition",
01434   "LibrariesDefinition", "LibList", "Name", "OptName", "ArgVal",
01435   "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader",
01436   "END", "Function", "FunctionProto", "@1", "ConstValueRef",
01437   "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList",
01438   "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst",
01439   "PHIList", "ValueRefList", "ValueRefListE", "InstVal", "IndexList",
01440   "OptVolatile", "MemoryInst", 0
01441 };
01442 #endif
01443 
01444 # ifdef YYPRINT
01445 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
01446    token YYLEX-NUM.  */
01447 static const unsigned short int yytoknum[] =
01448 {
01449        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
01450      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
01451      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
01452      285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
01453      295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
01454      305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
01455      315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
01456      325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
01457      335,   336,   337,   338,   339,   340,   341,   342,   343,    61,
01458       92,    40,    41,    91,   120,    93,    60,    62,   123,   125,
01459       42,    44,    99
01460 };
01461 # endif
01462 
01463 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
01464 static const unsigned char yyr1[] =
01465 {
01466        0,   103,   104,   104,   105,   105,   106,   106,   106,   106,
01467      106,   107,   107,   107,   108,   108,   108,   108,   108,   108,
01468      109,   109,   110,   110,   110,   110,   111,   111,   111,   111,
01469      112,   112,   113,   113,   114,   114,   115,   115,   115,   115,
01470      115,   116,   116,   117,   117,   118,   119,   119,   119,   119,
01471      119,   119,   119,   119,   119,   119,   119,   119,   119,   120,
01472      120,   120,   120,   120,   120,   120,   120,   120,   120,   121,
01473      121,   122,   122,   122,   122,   123,   123,   123,   123,   123,
01474      123,   123,   123,   123,   123,   123,   123,   123,   123,   123,
01475      123,   124,   124,   124,   124,   124,   124,   124,   125,   125,
01476      126,   126,   127,   128,   128,   128,   128,   129,   129,   129,
01477      129,   129,   129,   129,   130,   130,   131,   131,   131,   132,
01478      133,   133,   133,   134,   134,   135,   135,   136,   137,   137,
01479      138,   138,   138,   138,   139,   140,   140,   141,   142,   142,
01480      143,   145,   144,   146,   146,   146,   146,   146,   146,   146,
01481      146,   146,   147,   147,   148,   148,   149,   150,   150,   151,
01482      152,   152,   152,   153,   153,   153,   153,   153,   153,   153,
01483      153,   153,   154,   154,   155,   156,   156,   157,   157,   158,
01484      158,   159,   159,   159,   159,   159,   159,   159,   159,   159,
01485      159,   159,   159,   159,   160,   160,   161,   161,   162,   162,
01486      162,   162,   162,   162,   162,   162
01487 };
01488 
01489 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
01490 static const unsigned char yyr2[] =
01491 {
01492        0,     2,     1,     1,     1,     1,     1,     1,     1,     1,
01493        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
01494        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
01495        1,     1,     1,     1,     2,     0,     1,     1,     1,     1,
01496        0,     1,     1,     1,     1,     1,     1,     1,     1,     1,
01497        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
01498        1,     1,     2,     4,     5,     5,     3,     2,     2,     1,
01499        3,     1,     3,     1,     0,     4,     3,     3,     4,     4,
01500        3,     2,     2,     2,     2,     2,     2,     2,     2,     2,
01501        2,     6,     5,     8,     6,     6,     6,     6,     3,     1,
01502        1,     1,     1,     2,     2,     2,     1,     4,     2,     5,
01503        5,     3,     4,     0,     1,     1,     3,     3,     3,     3,
01504        3,     1,     0,     1,     1,     1,     0,     2,     3,     1,
01505        1,     3,     1,     0,     5,     1,     1,     3,     1,     1,
01506        2,     0,     3,     1,     1,     1,     1,     1,     1,     1,
01507        3,     1,     1,     1,     1,     1,     2,     2,     2,     3,
01508        2,     0,     1,     2,     2,     3,     9,     9,     8,    12,
01509        1,     1,     6,     5,     2,     6,     7,     1,     3,     1,
01510        0,     5,     5,     5,     2,     4,     4,     6,     4,     4,
01511        4,     2,     6,     1,     2,     0,     1,     0,     2,     5,
01512        2,     5,     2,     4,     6,     4
01513 };
01514 
01515 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
01516    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
01517    means the default is an error.  */
01518 static const unsigned char yydefact[] =
01519 {
01520      113,     0,    40,   106,     1,   105,   141,    36,    37,    38,
01521       39,     0,   161,   103,   104,   161,   123,   124,     0,     0,
01522       40,     0,   108,     0,     2,     3,    42,    46,    47,    48,
01523       49,    50,    51,    52,    53,    54,    55,    56,    57,    58,
01524       59,     0,     0,     0,     0,   152,     0,     0,    41,    60,
01525       45,   153,     0,    61,   162,   158,    35,   138,   139,   140,
01526      157,     0,     0,     0,   111,     0,     0,     0,     0,    34,
01527      142,    62,     0,     0,    44,    67,    69,     0,     0,    74,
01528       68,   135,   136,   137,   197,   160,     0,     0,     0,   122,
01529      112,   107,   100,   101,     0,     0,     0,     0,    66,     0,
01530      133,    73,    71,     0,   196,     0,     0,     0,     0,     0,
01531      170,   171,     6,     7,     8,     9,    10,    11,    12,    13,
01532       14,    15,    16,    17,    18,    19,     0,     0,     0,     0,
01533        0,     0,     0,     0,    20,    21,     0,     0,     0,     0,
01534        0,     0,     0,   159,   174,     0,   193,   118,   115,   114,
01535      116,   117,   121,     0,   110,    46,    47,    48,    49,    50,
01536       51,    52,    53,    54,    55,    56,     0,     0,     0,     0,
01537      109,    43,    43,    70,   132,   126,   129,   130,     0,     0,
01538       63,     0,   184,   164,   163,     0,     0,    25,    29,    24,
01539       28,    23,    27,    22,    26,    30,    31,     0,     0,   198,
01540      200,   202,     0,     0,   191,     0,     0,     0,     0,     0,
01541        0,     0,     0,     0,     0,     0,     0,   119,     0,    88,
01542       89,     4,     5,    86,    87,    90,    85,    81,    82,     0,
01543        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
01544       84,    83,    64,    65,   125,   127,     0,   134,    72,   143,
01545      144,   145,   146,   147,   148,   149,     0,   151,   155,   154,
01546      156,     0,   165,     0,     0,     0,     0,   195,     0,     0,
01547        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
01548        0,     0,   120,     0,     0,     0,    76,    99,     0,     0,
01549       80,     0,    77,     0,     0,     0,     0,   131,   128,     0,
01550        0,     0,   180,     0,     0,     0,   205,     0,     0,   180,
01551      186,     0,   189,   190,   188,     0,     0,     0,   185,   203,
01552        0,   195,     0,     0,    75,     0,    78,    79,     0,     0,
01553        0,     0,   150,     0,     0,   177,   179,     0,   199,   201,
01554      194,     0,     0,     0,     0,   181,   182,   183,     0,     0,
01555        0,     0,    98,     0,     0,     0,     0,     0,     0,     0,
01556        0,     0,     0,   192,   187,   204,    92,     0,     0,     0,
01557        0,     0,     0,     0,     0,   178,     0,   175,     0,    91,
01558        0,    94,    95,    96,    97,     0,   168,     0,     0,     0,
01559      176,     0,   166,     0,   167,     0,     0,    93,     0,     0,
01560        0,     0,     0,     0,   173,     0,   169,   172
01561 };
01562 
01563 /* YYDEFGOTO[NTERM-NUM]. */
01564 static const short int yydefgoto[] =
01565 {
01566       -1,    45,   223,   236,   237,   238,   239,   166,   167,   197,
01567      168,    20,    11,    46,    47,   169,    49,    50,    77,   103,
01568      287,   257,   288,    94,     1,     2,     3,   150,    64,    90,
01569      153,    51,   245,   176,   177,   178,    52,    83,    12,    59,
01570       13,    14,    23,   258,    53,   260,   335,    15,    55,    56,
01571      143,   388,    85,   204,   336,   337,   144,   306,   145,   146
01572 };
01573 
01574 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
01575    STATE-NUM.  */
01576 #define YYPACT_NINF -366
01577 static const short int yypact[] =
01578 {
01579     -366,     3,   123,   138,  -366,  -366,  -366,  -366,  -366,  -366,
01580     -366,   962,    26,  -366,  -366,    12,  -366,  -366,    43,   -35,
01581       10,    11,  -366,   962,  -366,  -366,    33,  -366,  -366,  -366,
01582     -366,  -366,  -366,  -366,  -366,  -366,  -366,  -366,  -366,  -366,
01583     -366,   145,   153,   155,    57,  -366,   118,    70,  -366,  -366,
01584      -69,  -366,   -16,  -366,  -366,  -366,   118,  -366,  -366,  -366,
01585     -366,    78,    85,    88,  -366,    93,   962,    53,    53,  -366,
01586     -366,  -366,   102,   103,  -366,  -366,   -69,    44,   107,   772,
01587     -366,  -366,  -366,  -366,  1123,  -366,   184,    62,   199,   190,
01588     -366,  -366,  -366,  -366,  1019,  1056,  1019,  1019,  -366,  1019,
01589      809,  -366,   112,   125,  -366,  1019,  1077,    18,   122,   962,
01590     -366,  -366,  -366,  -366,  -366,  -366,  -366,  -366,  -366,  -366,
01591     -366,  -366,  -366,  -366,  -366,  -366,  1019,  1019,  1019,  1019,
01592     1019,   962,  1019,  1019,  -366,  -366,  1019,  1019,  1019,  1019,
01593     1019,  1019,  1019,  -366,  -366,    19,  -366,  -366,  -366,  -366,
01594     -366,  -366,  -366,   -58,  -366,   124,   169,   211,   179,   212,
01595      185,   216,   189,   217,   215,   218,   191,   220,   221,   475,
01596     -366,   -90,   -10,   -69,  -366,   118,  -366,   126,   137,   867,
01597     -366,   612,  -366,    33,  -366,   612,   612,  -366,  -366,  -366,
01598     -366,  -366,  -366,  -366,  -366,  -366,  -366,   612,   612,   130,
01599      135,  -366,   612,   144,   141,   612,   195,   142,   143,   146,
01600      147,   612,   612,   612,   148,  1019,  1019,  -366,   214,  -366,
01601     -366,  -366,  -366,  -366,  -366,  -366,  -366,  -366,  -366,   154,
01602      159,   160,   904,  1056,   570,   222,   161,   162,   163,   165,
01603     -366,  -366,  -366,  -366,  -366,  -366,   925,  -366,  -366,  -366,
01604     -366,  -366,  -366,  -366,  -366,  -366,  1056,  -366,  -366,  -366,
01605     -366,   156,  -366,   157,   168,   224,   250,   174,   612,   173,
01606      186,  1019,  1019,  1019,  1019,  1019,   175,   177,   178,  1019,
01607      612,   180,  -366,  1056,  1056,  1056,  -366,  -366,   -55,   -37,
01608     -366,    45,  -366,  1056,  1056,  1056,  1056,  -366,  -366,   -17,
01609      259,   261,  1019,   612,   612,  1019,  -366,   182,   612,  1019,
01610     -366,   183,  -366,  -366,  -366,   612,   612,   612,  -366,  -366,
01611     1019,   174,   251,   192,  -366,  1056,  -366,  -366,   194,   196,
01612      198,   201,  -366,   612,   612,  -366,   202,   193,  -366,  -366,
01613      202,   612,   203,   200,  1019,  -366,  -366,  -366,   612,   208,
01614     1019,  1056,  -366,  1056,  1056,  1056,  1056,   204,   197,  1019,
01615      271,   213,   612,  -366,  -366,  -366,  -366,   219,   206,   225,
01616      226,   227,   228,   289,     4,  -366,   291,  -366,   233,  -366,
01617     1056,  -366,  -366,  -366,  -366,   612,  -366,   683,    92,   612,
01618     -366,   229,  -366,   231,  -366,   683,   255,  -366,   295,   234,
01619      301,   612,   302,   612,  -366,   612,  -366,  -366
01620 };
01621 
01622 /* YYPGOTO[NTERM-NUM].  */
01623 static const short int yypgoto[] =
01624 {
01625     -366,  -366,  -366,   246,   260,   262,   263,  -101,  -100,  -365,
01626     -366,   287,   325,   -21,  -366,   -11,  -366,   -38,   270,  -366,
01627      -84,   181,  -208,   283,  -366,  -366,  -366,  -366,  -366,  -366,
01628     -366,     1,  -366,   106,  -366,  -366,   330,  -366,  -366,  -366,
01629     -366,   353,  -366,  -351,    21,   129,  -104,  -366,   342,  -366,
01630     -366,  -366,  -366,  -366,    54,    49,  -366,    39,  -366,  -366
01631 };
01632 
01633 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
01634    positive, shift that token.  If negative, reduce the rule which
01635    number is the opposite.  If zero, do what YYDEFACT says.
01636    If YYTABLE_NINF, syntax error.  */
01637 #define YYTABLE_NINF -103
01638 static const short int yytable[] =
01639 {
01640       48,   182,   184,     4,    21,   242,    76,   195,   196,   387,
01641       80,   170,    48,    81,   187,   188,   189,   190,   191,   192,
01642      193,   194,   -43,   395,   201,   289,   291,   185,   206,   207,
01643       66,    80,   208,   209,   210,    54,   393,   217,   214,   186,
01644      324,    76,    57,   218,   399,    91,   325,    78,   299,    54,
01645        7,     8,     9,    10,    65,    48,    67,    21,   171,   172,
01646      326,   173,    24,    25,   325,    74,    27,    28,    29,    30,
01647       31,    32,    33,    34,    35,    36,    37,    38,    39,    16,
01648      332,    17,    82,   154,   325,    92,    93,   243,   198,   175,
01649       80,    61,    62,    63,   181,   181,   215,   216,    48,   386,
01650       69,    40,   187,   188,   189,   190,   191,   192,   193,   194,
01651      205,    58,   281,   148,   149,   199,   200,   181,   202,   203,
01652       48,   181,   181,  -102,   -44,   181,   181,   181,   211,   212,
01653      213,   181,   187,   188,   189,   190,   191,   192,   193,   194,
01654       16,   173,    17,    98,   327,    99,   325,    41,     5,    71,
01655       42,   219,   220,    43,     6,    44,    75,    72,   -35,    73,
01656       16,    79,    17,     7,     8,     9,    10,    86,   311,     6,
01657      -35,   -35,   -25,   -25,    87,   318,   244,    88,   -35,   -35,
01658      -35,   -35,   -24,   -24,   -35,    18,    89,   394,   -23,   -23,
01659      241,    19,   -22,   -22,   221,   222,    96,    97,   100,   321,
01660      322,   323,   259,   151,   280,   181,   259,   259,   147,   328,
01661      329,   330,   331,   179,   152,   -29,   -28,   180,   259,   259,
01662      -27,   -26,   -32,   259,   224,   -33,   259,   246,   225,   247,
01663      271,   265,   259,   259,   259,   175,   266,   268,   282,   303,
01664      364,   352,   269,   272,   273,   283,   292,   274,   275,   279,
01665      284,   285,   293,   294,   295,   375,   296,   300,   301,   302,
01666      310,   181,   312,   313,   314,   304,   308,   368,   181,   369,
01667      370,   371,   372,   195,   196,   305,   315,   309,   316,   317,
01668      333,   320,   334,   341,   344,   360,   350,   195,   196,   259,
01669      374,   181,   363,   351,   181,   353,   391,   354,   181,   355,
01670      366,   259,   356,   359,   362,   373,   376,   380,   377,   348,
01671      385,   379,   389,   400,   261,   262,   401,   381,   382,   383,
01672      384,   397,   403,   405,   259,   259,   263,   264,   390,   259,
01673      139,   267,   398,   181,   270,   402,   259,   259,   259,   367,
01674      276,   277,   278,    84,   140,    68,   141,   142,   181,   102,
01675      240,    95,   298,    70,   259,   259,    22,    60,   343,   340,
01676      349,     0,   259,     0,     0,     0,     0,     0,     0,   259,
01677        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
01678        0,     0,     0,   259,     0,     0,     0,     0,     0,     0,
01679        0,     0,     0,     0,     0,     0,     0,   307,     0,     0,
01680        0,     0,     0,     0,     0,     0,   259,     0,     0,   319,
01681      259,     0,     0,     0,     0,     0,     0,     0,     0,     0,
01682        0,     0,   259,     0,   259,     0,   259,     0,     0,     0,
01683        0,     0,   338,   339,     0,     0,     0,   342,     0,     0,
01684        0,     0,     0,     0,   345,   346,   347,     0,     0,     0,
01685        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
01686        0,     0,   357,   358,     0,     0,     0,     0,     0,     0,
01687      361,     0,     0,     0,     0,     0,     0,   365,     0,     0,
01688       24,    25,     0,     0,     0,     0,     0,     0,     0,     0,
01689        0,   378,     0,     0,     0,     0,     0,    16,     0,    17,
01690        0,   226,     0,     0,     0,     0,     0,     0,     0,     0,
01691        0,     0,   227,   228,   392,     0,     0,     0,   396,     0,
01692        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
01693      404,     0,   406,     0,   407,   112,   113,   114,   115,   116,
01694      117,   118,   119,   120,   121,   122,   123,   124,   125,     0,
01695        0,     0,     0,     0,   229,     0,     0,   230,   231,   134,
01696      135,     0,     0,     0,     0,     0,     0,     0,   232,     0,
01697        0,   233,     0,   234,     0,    24,    25,   235,    74,   155,
01698      156,   157,   158,   159,   160,   161,   162,   163,   164,   165,
01699       38,    39,    16,     0,    17,     0,     0,     0,     0,     0,
01700        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
01701        0,     0,     0,     0,    40,   249,   250,    24,    25,   251,
01702        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
01703        0,     0,     0,     0,    16,     0,    17,     0,     0,   252,
01704      253,     0,     0,     0,     0,     0,     0,     0,     0,   254,
01705      255,     0,     0,     0,     0,     0,     0,     0,     0,     0,
01706       41,     0,     0,    42,     0,     0,    43,     0,    44,   290,
01707        0,     0,   112,   113,   114,   115,   116,   117,   118,   119,
01708      120,   121,   122,   123,   124,   125,   249,   250,     0,     0,
01709      251,   229,     0,     0,   230,   231,   134,   135,     0,     0,
01710        0,     0,     0,     0,     0,     0,     0,     0,   256,     0,
01711      252,   253,     0,     0,     0,     0,     0,     0,     0,     0,
01712      254,   255,     0,     0,     0,     0,     0,     0,     0,     0,
01713        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
01714        0,     0,     0,   112,   113,   114,   115,   116,   117,   118,
01715      119,   120,   121,   122,   123,   124,   125,     0,     0,     0,
01716        0,     0,   229,     0,     0,   230,   231,   134,   135,     0,
01717        0,     0,     0,     0,     0,     0,     0,    24,    25,   256,
01718       74,    27,    28,    29,    30,    31,    32,    33,    34,    35,
01719       36,    37,    38,    39,    16,     0,    17,     0,     0,     0,
01720        0,     0,     0,     0,     0,     0,     0,     0,   101,     0,
01721        0,     0,     0,     0,    24,    25,    40,    74,    27,    28,
01722       29,    30,    31,    32,    33,    34,    35,    36,    37,    38,
01723       39,    16,     0,    17,     0,     0,     0,     0,     0,     0,
01724        0,     0,     0,     0,     0,   174,     0,     0,     0,     0,
01725        0,     0,     0,    40,     0,     0,     0,     0,     0,     0,
01726        0,     0,    41,     0,     0,    42,     0,     0,    43,     0,
01727       44,     0,    24,    25,     0,    74,    27,    28,    29,    30,
01728       31,    32,    33,    34,    35,    36,    37,    38,    39,    16,
01729        0,    17,     0,     0,     0,     0,     0,     0,     0,    41,
01730        0,     0,    42,   248,     0,    43,     0,    44,     0,    24,
01731       25,    40,    74,   155,   156,   157,   158,   159,   160,   161,
01732      162,   163,   164,   165,    38,    39,    16,     0,    17,     0,
01733       24,    25,     0,    74,    27,    28,    29,    30,    31,    32,
01734       33,    34,    35,    36,    37,    38,    39,    16,    40,    17,
01735        0,     0,     0,     0,     0,     0,     0,    41,     0,     0,
01736       42,   297,     0,    43,     0,    44,     0,    24,    25,    40,
01737       26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
01738       36,    37,    38,    39,    16,     0,    17,     0,     0,     0,
01739        0,     0,     0,     0,    41,     0,     0,    42,     0,   286,
01740       43,     0,    44,     0,     0,     0,    40,     0,     0,     0,
01741        0,     0,     0,     0,     0,    41,     0,     0,    42,     0,
01742        0,    43,     0,    44,    24,    25,     0,    74,    27,    28,
01743       29,    30,    31,    32,    33,    34,    35,    36,    37,    38,
01744       39,    16,     0,    17,     0,     0,     0,     0,     0,     0,
01745        0,     0,    41,     0,     0,    42,     0,     0,    43,     0,
01746       44,    24,    25,    40,    74,   155,   156,   157,   158,   159,
01747      160,   161,   162,   163,   164,   165,    38,    39,    16,     0,
01748       17,     0,    24,    25,     0,   183,    27,    28,    29,    30,
01749       31,    32,    33,    34,    35,    36,    37,    38,    39,    16,
01750       40,    17,     0,     0,     0,     0,     0,     0,     0,    41,
01751        0,     0,    42,     0,     0,    43,     0,    44,     0,     0,
01752        0,    40,     0,     0,     0,     0,     0,     0,     0,     0,
01753        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
01754        0,     0,     0,     0,     0,     0,    41,     0,     0,    42,
01755        0,     0,    43,     0,    44,     0,     0,   104,     0,     0,
01756        0,     0,     0,     0,     0,     0,     0,    41,   105,     0,
01757       42,     0,     0,    43,     0,    44,     0,   106,   107,   108,
01758      109,   110,   111,   112,   113,   114,   115,   116,   117,   118,
01759      119,   120,   121,   122,   123,   124,   125,   126,   127,   128,
01760        0,     0,   129,   130,   131,   132,   133,   134,   135,   136,
01761      137,   138
01762 };
01763 
01764 static const short int yycheck[] =
01765 {
01766       11,   105,   106,     0,     3,    95,    44,   108,   108,   374,
01767      100,    95,    23,    29,    10,    11,    12,    13,    14,    15,
01768       16,    17,    91,   388,   128,   233,   234,     9,   132,   133,
01769       20,   100,   136,   137,   138,    23,   387,    95,   142,    21,
01770       95,    79,    30,   101,   395,    66,   101,    46,   256,    23,
01771       40,    41,    42,    43,    89,    66,    46,    56,    96,    97,
01772       97,    99,     5,     6,   101,     8,     9,    10,    11,    12,
01773       13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
01774       97,    24,    98,    94,   101,    32,    33,    97,   109,   100,
01775      100,    48,    49,    50,   105,   106,    77,    78,   109,    95,
01776       89,    44,    10,    11,    12,    13,    14,    15,    16,    17,
01777      131,    99,   216,    51,    52,   126,   127,   128,   129,   130,
01778      131,   132,   133,     0,    91,   136,   137,   138,   139,   140,
01779      141,   142,    10,    11,    12,    13,    14,    15,    16,    17,
01780       22,   179,    24,    99,    99,   101,   101,    90,    25,     4,
01781       93,    27,    28,    96,    31,    98,    99,     4,    20,     4,
01782       22,    91,    24,    40,    41,    42,    43,    89,   272,    31,
01783       32,    33,     3,     4,    89,   279,   175,    89,    40,    41,
01784       42,    43,     3,     4,    46,    47,    93,    95,     3,     4,
01785      169,    53,     3,     4,     3,     4,    94,    94,    91,   283,
01786      284,   285,   181,     4,   215,   216,   185,   186,    24,   293,
01787      294,   295,   296,   101,    24,     4,     4,    92,   197,   198,
01788        4,     4,     7,   202,     4,     7,   205,   101,     7,    92,
01789       35,   101,   211,   212,   213,   246,   101,    93,    24,    15,
01790      344,   325,   101,   101,   101,    91,    24,   101,   101,   101,
01791       91,    91,    91,    91,    91,   359,    91,   101,   101,    91,
01792      271,   272,   273,   274,   275,    15,    93,   351,   279,   353,
01793      354,   355,   356,   374,   374,   101,   101,    91,   101,   101,
01794       21,   101,    21,   101,   101,    92,    35,   388,   388,   268,
01795       93,   302,    92,   101,   305,   101,   380,   101,   309,   101,
01796       92,   280,   101,   101,   101,   101,    35,   101,    95,   320,
01797       21,    92,    21,    58,   185,   186,    21,    92,    92,    92,
01798       92,    92,    21,    21,   303,   304,   197,   198,    95,   308,
01799       84,   202,   101,   344,   205,   101,   315,   316,   317,   350,
01800      211,   212,   213,    56,    84,    20,    84,    84,   359,    79,
01801      169,    68,   246,    23,   333,   334,     3,    15,   309,   305,
01802      321,    -1,   341,    -1,    -1,    -1,    -1,    -1,    -1,   348,
01803       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
01804       -1,    -1,    -1,   362,    -1,    -1,    -1,    -1,    -1,    -1,
01805       -1,    -1,    -1,    -1,    -1,    -1,    -1,   268,    -1,    -1,
01806       -1,    -1,    -1,    -1,    -1,    -1,   385,    -1,    -1,   280,
01807      389,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
01808       -1,    -1,   401,    -1,   403,    -1,   405,    -1,    -1,    -1,
01809       -1,    -1,   303,   304,    -1,    -1,    -1,   308,    -1,    -1,
01810       -1,    -1,    -1,    -1,   315,   316,   317,    -1,    -1,    -1,
01811       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
01812       -1,    -1,   333,   334,    -1,    -1,    -1,    -1,    -1,    -1,
01813      341,    -1,    -1,    -1,    -1,    -1,    -1,   348,    -1,    -1,
01814        5,     6,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
01815       -1,   362,    -1,    -1,    -1,    -1,    -1,    22,    -1,    24,
01816       -1,    26,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
01817       -1,    -1,    37,    38,   385,    -1,    -1,    -1,   389,    -1,
01818       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
01819      401,    -1,   403,    -1,   405,    60,    61,    62,    63,    64,
01820       65,    66,    67,    68,    69,    70,    71,    72,    73,    -1,
01821       -1,    -1,    -1,    -1,    79,    -1,    -1,    82,    83,    84,
01822       85,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    93,    -1,
01823       -1,    96,    -1,    98,    -1,     5,     6,   102,     8,     9,
01824       10,    11,    12,    13,    14,    15,    16,    17,    18,    19,
01825       20,    21,    22,    -1,    24,    -1,    -1,    -1,    -1,    -1,
01826       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
01827       -1,    -1,    -1,    -1,    44,     3,     4,     5,     6,     7,
01828       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
01829       -1,    -1,    -1,    -1,    22,    -1,    24,    -1,    -1,    27,
01830       28,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    37,
01831       38,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
01832       90,    -1,    -1,    93,    -1,    -1,    96,    -1,    98,    99,
01833       -1,    -1,    60,    61,    62,    63,    64,    65,    66,    67,
01834       68,    69,    70,    71,    72,    73,     3,     4,    -1,    -1,
01835        7,    79,    -1,    -1,    82,    83,    84,    85,    -1,    -1,
01836       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    96,    -1,
01837       27,    28,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
01838       37,    38,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
01839       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
01840       -1,    -1,    -1,    60,    61,    62,    63,    64,    65,    66,
01841       67,    68,    69,    70,    71,    72,    73,    -1,    -1,    -1,
01842       -1,    -1,    79,    -1,    -1,    82,    83,    84,    85,    -1,
01843       -1,    -1,    -1,    -1,    -1,    -1,    -1,     5,     6,    96,
01844        8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
01845       18,    19,    20,    21,    22,    -1,    24,    -1,    -1,    -1,
01846       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    36,    -1,
01847       -1,    -1,    -1,    -1,     5,     6,    44,     8,     9,    10,
01848       11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
01849       21,    22,    -1,    24,    -1,    -1,    -1,    -1,    -1,    -1,
01850       -1,    -1,    -1,    -1,    -1,    36,    -1,    -1,    -1,    -1,
01851       -1,    -1,    -1,    44,    -1,    -1,    -1,    -1,    -1,    -1,
01852       -1,    -1,    90,    -1,    -1,    93,    -1,    -1,    96,    -1,
01853       98,    -1,     5,     6,    -1,     8,     9,    10,    11,    12,
01854       13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
01855       -1,    24,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    90,
01856       -1,    -1,    93,    36,    -1,    96,    -1,    98,    -1,     5,
01857        6,    44,     8,     9,    10,    11,    12,    13,    14,    15,
01858       16,    17,    18,    19,    20,    21,    22,    -1,    24,    -1,
01859        5,     6,    -1,     8,     9,    10,    11,    12,    13,    14,
01860       15,    16,    17,    18,    19,    20,    21,    22,    44,    24,
01861       -1,    -1,    -1,    -1,    -1,    -1,    -1,    90,    -1,    -1,
01862       93,    36,    -1,    96,    -1,    98,    -1,     5,     6,    44,
01863        8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
01864       18,    19,    20,    21,    22,    -1,    24,    -1,    -1,    -1,
01865       -1,    -1,    -1,    -1,    90,    -1,    -1,    93,    -1,    95,
01866       96,    -1,    98,    -1,    -1,    -1,    44,    -1,    -1,    -1,
01867       -1,    -1,    -1,    -1,    -1,    90,    -1,    -1,    93,    -1,
01868       -1,    96,    -1,    98,     5,     6,    -1,     8,     9,    10,
01869       11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
01870       21,    22,    -1,    24,    -1,    -1,    -1,    -1,    -1,    -1,
01871       -1,    -1,    90,    -1,    -1,    93,    -1,    -1,    96,    -1,
01872       98,     5,     6,    44,     8,     9,    10,    11,    12,    13,
01873       14,    15,    16,    17,    18,    19,    20,    21,    22,    -1,
01874       24,    -1,     5,     6,    -1,     8,     9,    10,    11,    12,
01875       13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
01876       44,    24,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    90,
01877       -1,    -1,    93,    -1,    -1,    96,    -1,    98,    -1,    -1,
01878       -1,    44,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
01879       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
01880       -1,    -1,    -1,    -1,    -1,    -1,    90,    -1,    -1,    93,
01881       -1,    -1,    96,    -1,    98,    -1,    -1,    34,    -1,    -1,
01882       -1,    -1,    -1,    -1,    -1,    -1,    -1,    90,    45,    -1,
01883       93,    -1,    -1,    96,    -1,    98,    -1,    54,    55,    56,
01884       57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
01885       67,    68,    69,    70,    71,    72,    73,    74,    75,    76,
01886       -1,    -1,    79,    80,    81,    82,    83,    84,    85,    86,
01887       87,    88
01888 };
01889 
01890 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
01891    symbol of state STATE-NUM.  */
01892 static const unsigned char yystos[] =
01893 {
01894        0,   127,   128,   129,     0,    25,    31,    40,    41,    42,
01895       43,   115,   141,   143,   144,   150,    22,    24,    47,    53,
01896      114,   134,   144,   145,     5,     6,     8,     9,    10,    11,
01897       12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
01898       44,    90,    93,    96,    98,   104,   116,   117,   118,   119,
01899      120,   134,   139,   147,    23,   151,   152,    30,    99,   142,
01900      151,    48,    49,    50,   131,    89,    20,    46,   115,    89,
01901      139,     4,     4,     4,     8,    99,   120,   121,   134,    91,
01902      100,    29,    98,   140,   114,   155,    89,    89,    89,    93,
01903      132,   116,    32,    33,   126,   126,    94,    94,    99,   101,
01904       91,    36,   121,   122,    34,    45,    54,    55,    56,    57,
01905       58,    59,    60,    61,    62,    63,    64,    65,    66,    67,
01906       68,    69,    70,    71,    72,    73,    74,    75,    76,    79,
01907       80,    81,    82,    83,    84,    85,    86,    87,    88,   106,
01908      107,   108,   109,   153,   159,   161,   162,    24,    51,    52,
01909      130,     4,    24,   133,   118,     9,    10,    11,    12,    13,
01910       14,    15,    16,    17,    18,    19,   110,   111,   113,   118,
01911      123,   120,   120,   120,    36,   118,   136,   137,   138,   101,
01912       92,   118,   149,     8,   149,     9,    21,    10,    11,    12,
01913       13,    14,    15,    16,    17,   110,   111,   112,   116,   118,
01914      118,   149,   118,   118,   156,   116,   149,   149,   149,   149,
01915      149,   118,   118,   118,   149,    77,    78,    95,   101,    27,
01916       28,     3,     4,   105,     4,     7,    26,    37,    38,    79,
01917       82,    83,    93,    96,    98,   102,   106,   107,   108,   109,
01918      124,   147,    95,    97,   134,   135,   101,    92,    36,     3,
01919        4,     7,    27,    28,    37,    38,    96,   124,   146,   147,
01920      148,   148,   148,   148,   148,   101,   101,   148,    93,   101,
01921      148,    35,   101,   101,   101,   101,   148,   148,   148,   101,
01922      118,   149,    24,    91,    91,    91,    95,   123,   125,   125,
01923       99,   125,    24,    91,    91,    91,    91,    36,   136,   125,
01924      101,   101,    91,    15,    15,   101,   160,   148,    93,    91,
01925      118,   149,   118,   118,   118,   101,   101,   101,   149,   148,
01926      101,   123,   123,   123,    95,   101,    97,    99,   123,   123,
01927      123,   123,    97,    21,    21,   149,   157,   158,   148,   148,
01928      157,   101,   148,   158,   101,   148,   148,   148,   118,   160,
01929       35,   101,   123,   101,   101,   101,   101,   148,   148,   101,
01930       92,   148,   101,    92,   149,   148,    92,   118,   123,   123,
01931      123,   123,   123,   101,    93,   149,    35,    95,   148,    92,
01932      101,    92,    92,    92,    92,    21,    95,   112,   154,    21,
01933       95,   123,   148,   146,    95,   112,   148,    92,   101,   146,
01934       58,    21,   101,    21,   148,    21,   148,   148
01935 };
01936 
01937 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
01938 # define YYSIZE_T __SIZE_TYPE__
01939 #endif
01940 #if ! defined (YYSIZE_T) && defined (size_t)
01941 # define YYSIZE_T size_t
01942 #endif
01943 #if ! defined (YYSIZE_T)
01944 # if defined (__STDC__) || defined (__cplusplus)
01945 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
01946 #  define YYSIZE_T size_t
01947 # endif
01948 #endif
01949 #if ! defined (YYSIZE_T)
01950 # define YYSIZE_T unsigned int
01951 #endif
01952 
01953 #define yyerrok   (yyerrstatus = 0)
01954 #define yyclearin (yychar = YYEMPTY)
01955 #define YYEMPTY   (-2)
01956 #define YYEOF   0
01957 
01958 #define YYACCEPT  goto yyacceptlab
01959 #define YYABORT   goto yyabortlab
01960 #define YYERROR   goto yyerrorlab
01961 
01962 
01963 /* Like YYERROR except do call yyerror.  This remains here temporarily
01964    to ease the transition to the new meaning of YYERROR, for GCC.
01965    Once GCC version 2 has supplanted version 1, this can go.  */
01966 
01967 #define YYFAIL    goto yyerrlab
01968 
01969 #define YYRECOVERING()  (!!yyerrstatus)
01970 
01971 #define YYBACKUP(Token, Value)          \
01972 do                \
01973   if (yychar == YYEMPTY && yylen == 1)        \
01974     {               \
01975       yychar = (Token);           \
01976       yylval = (Value);           \
01977       yytoken = YYTRANSLATE (yychar);       \
01978       YYPOPSTACK;           \
01979       goto yybackup;            \
01980     }               \
01981   else                \
01982     {                 \
01983       yyerror ("syntax error: cannot back up");\
01984       YYERROR;              \
01985     }               \
01986 while (0)
01987 
01988 
01989 #define YYTERROR  1
01990 #define YYERRCODE 256
01991 
01992 
01993 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
01994    If N is 0, then set CURRENT to the empty location which ends
01995    the previous symbol: RHS[0] (always defined).  */
01996 
01997 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
01998 #ifndef YYLLOC_DEFAULT
01999 # define YYLLOC_DEFAULT(Current, Rhs, N)        \
02000     do                  \
02001       if (N)                \
02002   {               \
02003     (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;  \
02004     (Current).first_column = YYRHSLOC (Rhs, 1).first_column;  \
02005     (Current).last_line    = YYRHSLOC (Rhs, N).last_line;   \
02006     (Current).last_column  = YYRHSLOC (Rhs, N).last_column; \
02007   }               \
02008       else                \
02009   {               \
02010     (Current).first_line   = (Current).last_line   =    \
02011       YYRHSLOC (Rhs, 0).last_line;        \
02012     (Current).first_column = (Current).last_column =    \
02013       YYRHSLOC (Rhs, 0).last_column;        \
02014   }               \
02015     while (0)
02016 #endif
02017 
02018 
02019 /* YY_LOCATION_PRINT -- Print the location on the stream.
02020    This macro was not mandated originally: define only if we know
02021    we won't break user code: when these are the locations we know.  */
02022 
02023 #ifndef YY_LOCATION_PRINT
02024 # if YYLTYPE_IS_TRIVIAL
02025 #  define YY_LOCATION_PRINT(File, Loc)      \
02026      fprintf (File, "%d.%d-%d.%d",      \
02027               (Loc).first_line, (Loc).first_column, \
02028               (Loc).last_line,  (Loc).last_column)
02029 # else
02030 #  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
02031 # endif
02032 #endif
02033 
02034 
02035 /* YYLEX -- calling `yylex' with the right arguments.  */
02036 
02037 #ifdef YYLEX_PARAM
02038 # define YYLEX yylex (YYLEX_PARAM)
02039 #else
02040 # define YYLEX yylex ()
02041 #endif
02042 
02043 /* Enable debugging if requested.  */
02044 #if YYDEBUG
02045 
02046 # ifndef YYFPRINTF
02047 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
02048 #  define YYFPRINTF fprintf
02049 # endif
02050 
02051 # define YYDPRINTF(Args)      \
02052 do {            \
02053   if (yydebug)          \
02054     YYFPRINTF Args;       \
02055 } while (0)
02056 
02057 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)    \
02058 do {                \
02059   if (yydebug)              \
02060     {               \
02061       YYFPRINTF (stderr, "%s ", Title);       \
02062       yysymprint (stderr,           \
02063                   Type, Value); \
02064       YYFPRINTF (stderr, "\n");         \
02065     }               \
02066 } while (0)
02067 
02068 /*------------------------------------------------------------------.
02069 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
02070 | TOP (included).                                                   |
02071 `------------------------------------------------------------------*/
02072 
02073 #if defined (__STDC__) || defined (__cplusplus)
02074 static void
02075 yy_stack_print (short int *bottom, short int *top)
02076 #else
02077 static void
02078 yy_stack_print (bottom, top)
02079     short int *bottom;
02080     short int *top;
02081 #endif
02082 {
02083   YYFPRINTF (stderr, "Stack now");
02084   for (/* Nothing. */; bottom <= top; ++bottom)
02085     YYFPRINTF (stderr, " %d", *bottom);
02086   YYFPRINTF (stderr, "\n");
02087 }
02088 
02089 # define YY_STACK_PRINT(Bottom, Top)        \
02090 do {                \
02091   if (yydebug)              \
02092     yy_stack_print ((Bottom), (Top));       \
02093 } while (0)
02094 
02095 
02096 /*------------------------------------------------.
02097 | Report that the YYRULE is going to be reduced.  |
02098 `------------------------------------------------*/
02099 
02100 #if defined (__STDC__) || defined (__cplusplus)
02101 static void
02102 yy_reduce_print (int yyrule)
02103 #else
02104 static void
02105 yy_reduce_print (yyrule)
02106     int yyrule;
02107 #endif
02108 {
02109   int yyi;
02110   unsigned int yylno = yyrline[yyrule];
02111   YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
02112              yyrule - 1, yylno);
02113   /* Print the symbols being reduced, and their result.  */
02114   for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
02115     YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
02116   YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
02117 }
02118 
02119 # define YY_REDUCE_PRINT(Rule)    \
02120 do {          \
02121   if (yydebug)        \
02122     yy_reduce_print (Rule);   \
02123 } while (0)
02124 
02125 /* Nonzero means print parse trace.  It is left uninitialized so that
02126    multiple parsers can coexist.  */
02127 int yydebug;
02128 #else /* !YYDEBUG */
02129 # define YYDPRINTF(Args)
02130 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
02131 # define YY_STACK_PRINT(Bottom, Top)
02132 # define YY_REDUCE_PRINT(Rule)
02133 #endif /* !YYDEBUG */
02134 
02135 
02136 /* YYINITDEPTH -- initial size of the parser's stacks.  */
02137 #ifndef YYINITDEPTH
02138 # define YYINITDEPTH 200
02139 #endif
02140 
02141 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
02142    if the built-in stack extension method is used).
02143 
02144    Do not make this value too large; the results are undefined if
02145    SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
02146    evaluated with infinite-precision integer arithmetic.  */
02147 
02148 #ifndef YYMAXDEPTH
02149 # define YYMAXDEPTH 10000
02150 #endif
02151 
02152 
02153 
02154 #if YYERROR_VERBOSE
02155 
02156 # ifndef yystrlen
02157 #  if defined (__GLIBC__) && defined (_STRING_H)
02158 #   define yystrlen strlen
02159 #  else
02160 /* Return the length of YYSTR.  */
02161 static YYSIZE_T
02162 #   if defined (__STDC__) || defined (__cplusplus)
02163 yystrlen (const char *yystr)
02164 #   else
02165 yystrlen (yystr)
02166      const char *yystr;
02167 #   endif
02168 {
02169   register const char *yys = yystr;
02170 
02171   while (*yys++ != '\0')
02172     continue;
02173 
02174   return yys - yystr - 1;
02175 }
02176 #  endif
02177 # endif
02178 
02179 # ifndef yystpcpy
02180 #  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
02181 #   define yystpcpy stpcpy
02182 #  else
02183 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
02184    YYDEST.  */
02185 static char *
02186 #   if defined (__STDC__) || defined (__cplusplus)
02187 yystpcpy (char *yydest, const char *yysrc)
02188 #   else
02189 yystpcpy (yydest, yysrc)
02190      char *yydest;
02191      const char *yysrc;
02192 #   endif
02193 {
02194   register char *yyd = yydest;
02195   register const char *yys = yysrc;
02196 
02197   while ((*yyd++ = *yys++) != '\0')
02198     continue;
02199 
02200   return yyd - 1;
02201 }
02202 #  endif
02203 # endif
02204 
02205 #endif /* !YYERROR_VERBOSE */
02206 
02207 
02208 
02209 #if YYDEBUG
02210 /*--------------------------------.
02211 | Print this symbol on YYOUTPUT.  |
02212 `--------------------------------*/
02213 
02214 #if defined (__STDC__) || defined (__cplusplus)
02215 static void
02216 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
02217 #else
02218 static void
02219 yysymprint (yyoutput, yytype, yyvaluep)
02220     FILE *yyoutput;
02221     int yytype;
02222     YYSTYPE *yyvaluep;
02223 #endif
02224 {
02225   /* Pacify ``unused variable'' warnings.  */
02226   (void) yyvaluep;
02227 
02228   if (yytype < YYNTOKENS)
02229     YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
02230   else
02231     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
02232 
02233 
02234 # ifdef YYPRINT
02235   if (yytype < YYNTOKENS)
02236     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
02237 # endif
02238   switch (yytype)
02239     {
02240       default:
02241         break;
02242     }
02243   YYFPRINTF (yyoutput, ")");
02244 }
02245 
02246 #endif /* ! YYDEBUG */
02247 /*-----------------------------------------------.
02248 | Release the memory associated to this symbol.  |
02249 `-----------------------------------------------*/
02250 
02251 #if defined (__STDC__) || defined (__cplusplus)
02252 static void
02253 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
02254 #else
02255 static void
02256 yydestruct (yymsg, yytype, yyvaluep)
02257     const char *yymsg;
02258     int yytype;
02259     YYSTYPE *yyvaluep;
02260 #endif
02261 {
02262   /* Pacify ``unused variable'' warnings.  */
02263   (void) yyvaluep;
02264 
02265   if (!yymsg)
02266     yymsg = "Deleting";
02267   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
02268 
02269   switch (yytype)
02270     {
02271 
02272       default:
02273         break;
02274     }
02275 }
02276 
02277 
02278 /* Prevent warnings from -Wmissing-prototypes.  */
02279 
02280 #ifdef YYPARSE_PARAM
02281 # if defined (__STDC__) || defined (__cplusplus)
02282 int yyparse (void *YYPARSE_PARAM);
02283 # else
02284 int yyparse ();
02285 # endif
02286 #else /* ! YYPARSE_PARAM */
02287 #if defined (__STDC__) || defined (__cplusplus)
02288 int yyparse (void);
02289 #else
02290 int yyparse ();
02291 #endif
02292 #endif /* ! YYPARSE_PARAM */
02293 
02294 
02295 
02296 /* The look-ahead symbol.  */
02297 int yychar;
02298 
02299 /* The semantic value of the look-ahead symbol.  */
02300 YYSTYPE yylval;
02301 
02302 /* Number of syntax errors so far.  */
02303 int yynerrs;
02304 
02305 
02306 
02307 /*----------.
02308 | yyparse.  |
02309 `----------*/
02310 
02311 #ifdef YYPARSE_PARAM
02312 # if defined (__STDC__) || defined (__cplusplus)
02313 int yyparse (void *YYPARSE_PARAM)
02314 # else
02315 int yyparse (YYPARSE_PARAM)
02316   void *YYPARSE_PARAM;
02317 # endif
02318 #else /* ! YYPARSE_PARAM */
02319 #if defined (__STDC__) || defined (__cplusplus)
02320 int
02321 yyparse (void)
02322 #else
02323 int
02324 yyparse ()
02325 
02326 #endif
02327 #endif
02328 {
02329   
02330   register int yystate;
02331   register int yyn;
02332   int yyresult;
02333   /* Number of tokens to shift before error messages enabled.  */
02334   int yyerrstatus;
02335   /* Look-ahead token as an internal (translated) token number.  */
02336   int yytoken = 0;
02337 
02338   /* Three stacks and their tools:
02339      `yyss': related to states,
02340      `yyvs': related to semantic values,
02341      `yyls': related to locations.
02342 
02343      Refer to the stacks thru separate pointers, to allow yyoverflow
02344      to reallocate them elsewhere.  */
02345 
02346   /* The state stack.  */
02347   short int yyssa[YYINITDEPTH];
02348   short int *yyss = yyssa;
02349   register short int *yyssp;
02350 
02351   /* The semantic value stack.  */
02352   YYSTYPE yyvsa[YYINITDEPTH];
02353   YYSTYPE *yyvs = yyvsa;
02354   register YYSTYPE *yyvsp;
02355 
02356 
02357 
02358 #define YYPOPSTACK   (yyvsp--, yyssp--)
02359 
02360   YYSIZE_T yystacksize = YYINITDEPTH;
02361 
02362   /* The variables used to return semantic value and location from the
02363      action routines.  */
02364   YYSTYPE yyval;
02365 
02366 
02367   /* When reducing, the number of symbols on the RHS of the reduced
02368      rule.  */
02369   int yylen;
02370 
02371   YYDPRINTF ((stderr, "Starting parse\n"));
02372 
02373   yystate = 0;
02374   yyerrstatus = 0;
02375   yynerrs = 0;
02376   yychar = YYEMPTY;   /* Cause a token to be read.  */
02377 
02378   /* Initialize stack pointers.
02379      Waste one element of value and location stack
02380      so that they stay on the same level as the state stack.
02381      The wasted elements are never initialized.  */
02382 
02383   yyssp = yyss;
02384   yyvsp = yyvs;
02385 
02386 
02387   yyvsp[0] = yylval;
02388 
02389   goto yysetstate;
02390 
02391 /*------------------------------------------------------------.
02392 | yynewstate -- Push a new state, which is found in yystate.  |
02393 `------------------------------------------------------------*/
02394  yynewstate:
02395   /* In all cases, when you get here, the value and location stacks
02396      have just been pushed. so pushing a state here evens the stacks.
02397      */
02398   yyssp++;
02399 
02400  yysetstate:
02401   *yyssp = yystate;
02402 
02403   if (yyss + yystacksize - 1 <= yyssp)
02404     {
02405       /* Get the current used size of the three stacks, in elements.  */
02406       YYSIZE_T yysize = yyssp - yyss + 1;
02407 
02408 #ifdef yyoverflow
02409       {
02410   /* Give user a chance to reallocate the stack. Use copies of
02411      these so that the &'s don't force the real ones into
02412      memory.  */
02413   YYSTYPE *yyvs1 = yyvs;
02414   short int *yyss1 = yyss;
02415 
02416 
02417   /* Each stack pointer address is followed by the size of the
02418      data in use in that stack, in bytes.  This used to be a
02419      conditional around just the two extra args, but that might
02420      be undefined if yyoverflow is a macro.  */
02421   yyoverflow ("parser stack overflow",
02422         &yyss1, yysize * sizeof (*yyssp),
02423         &yyvs1, yysize * sizeof (*yyvsp),
02424 
02425         &yystacksize);
02426 
02427   yyss = yyss1;
02428   yyvs = yyvs1;
02429       }
02430 #else /* no yyoverflow */
02431 # ifndef YYSTACK_RELOCATE
02432       goto yyoverflowlab;
02433 # else
02434       /* Extend the stack our own way.  */
02435       if (YYMAXDEPTH <= yystacksize)
02436   goto yyoverflowlab;
02437       yystacksize *= 2;
02438       if (YYMAXDEPTH < yystacksize)
02439   yystacksize = YYMAXDEPTH;
02440 
02441       {
02442   short int *yyss1 = yyss;
02443   union yyalloc *yyptr =
02444     (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
02445   if (! yyptr)
02446     goto yyoverflowlab;
02447   YYSTACK_RELOCATE (yyss);
02448   YYSTACK_RELOCATE (yyvs);
02449 
02450 #  undef YYSTACK_RELOCATE
02451   if (yyss1 != yyssa)
02452     YYSTACK_FREE (yyss1);
02453       }
02454 # endif
02455 #endif /* no yyoverflow */
02456 
02457       yyssp = yyss + yysize - 1;
02458       yyvsp = yyvs + yysize - 1;
02459 
02460 
02461       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
02462       (unsigned long int) yystacksize));
02463 
02464       if (yyss + yystacksize - 1 <= yyssp)
02465   YYABORT;
02466     }
02467 
02468   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
02469 
02470   goto yybackup;
02471 
02472 /*-----------.
02473 | yybackup.  |
02474 `-----------*/
02475 yybackup:
02476 
02477 /* Do appropriate processing given the current state.  */
02478 /* Read a look-ahead token if we need one and don't already have one.  */
02479 /* yyresume: */
02480 
02481   /* First try to decide what to do without reference to look-ahead token.  */
02482 
02483   yyn = yypact[yystate];
02484   if (yyn == YYPACT_NINF)
02485     goto yydefault;
02486 
02487   /* Not known => get a look-ahead token if don't already have one.  */
02488 
02489   /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
02490   if (yychar == YYEMPTY)
02491     {
02492       YYDPRINTF ((stderr, "Reading a token: "));
02493       yychar = YYLEX;
02494     }
02495 
02496   if (yychar <= YYEOF)
02497     {
02498       yychar = yytoken = YYEOF;
02499       YYDPRINTF ((stderr, "Now at end of input.\n"));
02500     }
02501   else
02502     {
02503       yytoken = YYTRANSLATE (yychar);
02504       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
02505     }
02506 
02507   /* If the proper action on seeing token YYTOKEN is to reduce or to
02508      detect an error, take that action.  */
02509   yyn += yytoken;
02510   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
02511     goto yydefault;
02512   yyn = yytable[yyn];
02513   if (yyn <= 0)
02514     {
02515       if (yyn == 0 || yyn == YYTABLE_NINF)
02516   goto yyerrlab;
02517       yyn = -yyn;
02518       goto yyreduce;
02519     }
02520 
02521   if (yyn == YYFINAL)
02522     YYACCEPT;
02523 
02524   /* Shift the look-ahead token.  */
02525   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
02526 
02527   /* Discard the token being shifted unless it is eof.  */
02528   if (yychar != YYEOF)
02529     yychar = YYEMPTY;
02530 
02531   *++yyvsp = yylval;
02532 
02533 
02534   /* Count tokens shifted since error; after three, turn off error
02535      status.  */
02536   if (yyerrstatus)
02537     yyerrstatus--;
02538 
02539   yystate = yyn;
02540   goto yynewstate;
02541 
02542 
02543 /*-----------------------------------------------------------.
02544 | yydefault -- do the default action for the current state.  |
02545 `-----------------------------------------------------------*/
02546 yydefault:
02547   yyn = yydefact[yystate];
02548   if (yyn == 0)
02549     goto yyerrlab;
02550   goto yyreduce;
02551 
02552 
02553 /*-----------------------------.
02554 | yyreduce -- Do a reduction.  |
02555 `-----------------------------*/
02556 yyreduce:
02557   /* yyn is the number of a rule to reduce with.  */
02558   yylen = yyr2[yyn];
02559 
02560   /* If YYLEN is nonzero, implement the default value of the action:
02561      `$$ = $1'.
02562 
02563      Otherwise, the following line sets YYVAL to garbage.
02564      This behavior is undocumented and Bison
02565      users should not rely upon it.  Assigning to YYVAL
02566      unconditionally makes the parser a bit smaller, and it avoids a
02567      GCC warning that YYVAL may be used uninitialized.  */
02568   yyval = yyvsp[1-yylen];
02569 
02570 
02571   YY_REDUCE_PRINT (yyn);
02572   switch (yyn)
02573     {
02574         case 3:
02575 #line 940 "llvmAsmParser.y"
02576     {
02577   if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX)     // Outside of my range!
02578     ThrowException("Value too large for type!");
02579   (yyval.SIntVal) = (int32_t)(yyvsp[0].UIntVal);
02580 ;}
02581     break;
02582 
02583   case 5:
02584 #line 948 "llvmAsmParser.y"
02585     {
02586   if ((yyvsp[0].UInt64Val) > (uint64_t)INT64_MAX)     // Outside of my range!
02587     ThrowException("Value too large for type!");
02588   (yyval.SInt64Val) = (int64_t)(yyvsp[0].UInt64Val);
02589 ;}
02590     break;
02591 
02592   case 34:
02593 #line 971 "llvmAsmParser.y"
02594     {
02595     (yyval.StrVal) = (yyvsp[-1].StrVal);
02596   ;}
02597     break;
02598 
02599   case 35:
02600 #line 974 "llvmAsmParser.y"
02601     { 
02602     (yyval.StrVal) = 0; 
02603   ;}
02604     break;
02605 
02606   case 36:
02607 #line 978 "llvmAsmParser.y"
02608     { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
02609     break;
02610 
02611   case 37:
02612 #line 979 "llvmAsmParser.y"
02613     { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
02614     break;
02615 
02616   case 38:
02617 #line 980 "llvmAsmParser.y"
02618     { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
02619     break;
02620 
02621   case 39:
02622 #line 981 "llvmAsmParser.y"
02623     { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
02624     break;
02625 
02626   case 40:
02627 #line 982 "llvmAsmParser.y"
02628     { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
02629     break;
02630 
02631   case 42:
02632 #line 991 "llvmAsmParser.y"
02633     { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;}
02634     break;
02635 
02636   case 44:
02637 #line 992 "llvmAsmParser.y"
02638     { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;}
02639     break;
02640 
02641   case 45:
02642 #line 994 "llvmAsmParser.y"
02643     {
02644     if (!UpRefs.empty())
02645       ThrowException("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
02646     (yyval.TypeVal) = (yyvsp[0].TypeVal);
02647   ;}
02648     break;
02649 
02650   case 59:
02651 #line 1005 "llvmAsmParser.y"
02652     {
02653     (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
02654   ;}
02655     break;
02656 
02657   case 60:
02658 #line 1008 "llvmAsmParser.y"
02659     {
02660     (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType));
02661   ;}
02662     break;
02663 
02664   case 61:
02665 #line 1011 "llvmAsmParser.y"
02666     {            // Named types are also simple types...
02667   (yyval.TypeVal) = new PATypeHolder(getTypeVal((yyvsp[0].ValIDVal)));
02668 ;}
02669     break;
02670 
02671   case 62:
02672 #line 1017 "llvmAsmParser.y"
02673     {                   // Type UpReference
02674     if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) ThrowException("Value out of range!");
02675     OpaqueType *OT = OpaqueType::get();        // Use temporary placeholder
02676     UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT));  // Add to vector...
02677     (yyval.TypeVal) = new PATypeHolder(OT);
02678     UR_OUT("New Upreference!\n");
02679   ;}
02680     break;
02681 
02682   case 63:
02683 #line 1024 "llvmAsmParser.y"
02684     {           // Function derived type?
02685     std::vector<const Type*> Params;
02686     mapto((yyvsp[-1].TypeList)->begin(), (yyvsp[-1].TypeList)->end(), std::back_inserter(Params), 
02687           std::mem_fun_ref(&PATypeHolder::get));
02688     bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
02689     if (isVarArg) Params.pop_back();
02690 
02691     (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FunctionType::get(*(yyvsp[-3].TypeVal),Params,isVarArg)));
02692     delete (yyvsp[-1].TypeList);      // Delete the argument list
02693     delete (yyvsp[-3].TypeVal);      // Delete the return type handle
02694   ;}
02695     break;
02696 
02697   case 64:
02698 #line 1035 "llvmAsmParser.y"
02699     {          // Sized array type?
02700     (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
02701     delete (yyvsp[-1].TypeVal);
02702   ;}
02703     break;
02704 
02705   case 65:
02706 #line 1039 "llvmAsmParser.y"
02707     {          // Packed array type?
02708      const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get();
02709      if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val)) {
02710         ThrowException("Unsigned result not equal to signed result");
02711      }
02712      if(!ElemTy->isPrimitiveType()) {
02713         ThrowException("Elemental type of a PackedType must be primitive");
02714      }
02715      (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
02716      delete (yyvsp[-1].TypeVal);
02717   ;}
02718     break;
02719 
02720   case 66:
02721 #line 1050 "llvmAsmParser.y"
02722     {                        // Structure type?
02723     std::vector<const Type*> Elements;
02724     mapto((yyvsp[-1].TypeList)->begin(), (yyvsp[-1].TypeList)->end(), std::back_inserter(Elements), 
02725         std::mem_fun_ref(&PATypeHolder::get));
02726 
02727     (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
02728     delete (yyvsp[-1].TypeList);
02729   ;}
02730     break;
02731 
02732   case 67:
02733 #line 1058 "llvmAsmParser.y"
02734     {                                  // Empty structure type?
02735     (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
02736   ;}
02737     break;
02738 
02739   case 68:
02740 #line 1061 "llvmAsmParser.y"
02741     {                             // Pointer type?
02742     (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal))));
02743     delete (yyvsp[-1].TypeVal);
02744   ;}
02745     break;
02746 
02747   case 69:
02748 #line 1069 "llvmAsmParser.y"
02749     {
02750     (yyval.TypeList) = new std::list<PATypeHolder>();
02751     (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
02752   ;}
02753     break;
02754 
02755   case 70:
02756 #line 1073 "llvmAsmParser.y"
02757     {
02758     ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
02759   ;}
02760     break;
02761 
02762   case 72:
02763 #line 1079 "llvmAsmParser.y"
02764     {
02765     ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(Type::VoidTy);
02766   ;}
02767     break;
02768 
02769   case 73:
02770 #line 1082 "llvmAsmParser.y"
02771     {
02772     ((yyval.TypeList) = new std::list<PATypeHolder>())->push_back(Type::VoidTy);
02773   ;}
02774     break;
02775 
02776   case 74:
02777 #line 1085 "llvmAsmParser.y"
02778     {
02779     (yyval.TypeList) = new std::list<PATypeHolder>();
02780   ;}
02781     break;
02782 
02783   case 75:
02784 #line 1095 "llvmAsmParser.y"
02785     { // Nonempty unsized arr
02786     const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get());
02787     if (ATy == 0)
02788       ThrowException("Cannot make array constant with type: '" + 
02789                      (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
02790     const Type *ETy = ATy->getElementType();
02791     int NumElements = ATy->getNumElements();
02792 
02793     // Verify that we have the correct size...
02794     if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
02795       ThrowException("Type mismatch: constant sized array initialized with " +
02796                      utostr((yyvsp[-1].ConstVector)->size()) +  " arguments, but has size of " + 
02797                      itostr(NumElements) + "!");
02798 
02799     // Verify all elements are correct type!
02800     for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
02801       if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
02802         ThrowException("Element #" + utostr(i) + " is not of type '" + 
02803                        ETy->getDescription() +"' as required!\nIt is of type '"+
02804                        (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
02805     }
02806 
02807     (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector));
02808     delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
02809   ;}
02810     break;
02811 
02812   case 76:
02813 #line 1120 "llvmAsmParser.y"
02814     {
02815     const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
02816     if (ATy == 0)
02817       ThrowException("Cannot make array constant with type: '" + 
02818                      (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
02819 
02820     int NumElements = ATy->getNumElements();
02821     if (NumElements != -1 && NumElements != 0) 
02822       ThrowException("Type mismatch: constant sized array initialized with 0"
02823                      " arguments, but has size of " + itostr(NumElements) +"!");
02824     (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
02825     delete (yyvsp[-2].TypeVal);
02826   ;}
02827     break;
02828 
02829   case 77:
02830 #line 1133 "llvmAsmParser.y"
02831     {
02832     const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
02833     if (ATy == 0)
02834       ThrowException("Cannot make array constant with type: '" + 
02835                      (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
02836 
02837     int NumElements = ATy->getNumElements();
02838     const Type *ETy = ATy->getElementType();
02839     char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
02840     if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal)))
02841       ThrowException("Can't build string constant of size " + 
02842                      itostr((int)(EndStr-(yyvsp[0].StrVal))) +
02843                      " when array has size " + itostr(NumElements) + "!");
02844     std::vector<Constant*> Vals;
02845     if (ETy == Type::SByteTy) {
02846       for (char *C = (yyvsp[0].StrVal); C != EndStr; ++C)
02847         Vals.push_back(ConstantSInt::get(ETy, *C));
02848     } else if (ETy == Type::UByteTy) {
02849       for (char *C = (yyvsp[0].StrVal); C != EndStr; ++C)
02850         Vals.push_back(ConstantUInt::get(ETy, (unsigned char)*C));
02851     } else {
02852       free((yyvsp[0].StrVal));
02853       ThrowException("Cannot build string arrays of non byte sized elements!");
02854     }
02855     free((yyvsp[0].StrVal));
02856     (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
02857     delete (yyvsp[-2].TypeVal);
02858   ;}
02859     break;
02860 
02861   case 78:
02862 #line 1161 "llvmAsmParser.y"
02863     { // Nonempty unsized arr
02864     const PackedType *PTy = dyn_cast<PackedType>((yyvsp[-3].TypeVal)->get());
02865     if (PTy == 0)
02866       ThrowException("Cannot make packed constant with type: '" + 
02867                      (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
02868     const Type *ETy = PTy->getElementType();
02869     int NumElements = PTy->getNumElements();
02870 
02871     // Verify that we have the correct size...
02872     if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
02873       ThrowException("Type mismatch: constant sized packed initialized with " +
02874                      utostr((yyvsp[-1].ConstVector)->size()) +  " arguments, but has size of " + 
02875                      itostr(NumElements) + "!");
02876 
02877     // Verify all elements are correct type!
02878     for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
02879       if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
02880         ThrowException("Element #" + utostr(i) + " is not of type '" + 
02881            ETy->getDescription() +"' as required!\nIt is of type '"+
02882            (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
02883     }
02884 
02885     (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[-1].ConstVector));
02886     delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
02887   ;}
02888     break;
02889 
02890   case 79:
02891 #line 1186 "llvmAsmParser.y"
02892     {
02893     const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get());
02894     if (STy == 0)
02895       ThrowException("Cannot make struct constant with type: '" + 
02896                      (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
02897 
02898     if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes())
02899       ThrowException("Illegal number of initializers for structure type!");
02900 
02901     // Check to ensure that constants are compatible with the type initializer!
02902     for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i)
02903       if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i))
02904         ThrowException("Expected type '" +
02905                        STy->getElementType(i)->getDescription() +
02906                        "' for element #" + utostr(i) +
02907                        " of structure initializer!");
02908 
02909     (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector));
02910     delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
02911   ;}
02912     break;
02913 
02914   case 80:
02915 #line 1206 "llvmAsmParser.y"
02916     {
02917     const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get());
02918     if (STy == 0)
02919       ThrowException("Cannot make struct constant with type: '" + 
02920                      (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
02921 
02922     if (STy->getNumContainedTypes() != 0)
02923       ThrowException("Illegal number of initializers for structure type!");
02924 
02925     (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
02926     delete (yyvsp[-2].TypeVal);
02927   ;}
02928     break;
02929 
02930   case 81:
02931 #line 1218 "llvmAsmParser.y"
02932     {
02933     const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
02934     if (PTy == 0)
02935       ThrowException("Cannot make null pointer constant with type: '" + 
02936                      (*(yyvsp[-1].TypeVal))->getDescription() + "'!");
02937 
02938     (yyval.ConstVal) = ConstantPointerNull::get(PTy);
02939     delete (yyvsp[-1].TypeVal);
02940   ;}
02941     break;
02942 
02943   case 82:
02944 #line 1227 "llvmAsmParser.y"
02945     {
02946     (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get());
02947     delete (yyvsp[-1].TypeVal);
02948   ;}
02949     break;
02950 
02951   case 83:
02952 #line 1231 "llvmAsmParser.y"
02953     {
02954     const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
02955     if (Ty == 0)
02956       ThrowException("Global const reference must be a pointer type!");
02957 
02958     // ConstExprs can exist in the body of a function, thus creating
02959     // GlobalValues whenever they refer to a variable.  Because we are in
02960     // the context of a function, getValNonImprovising will search the functions
02961     // symbol table instead of the module symbol table for the global symbol,
02962     // which throws things all off.  To get around this, we just tell
02963     // getValNonImprovising that we are at global scope here.
02964     //
02965     Function *SavedCurFn = CurFun.CurrentFunction;
02966     CurFun.CurrentFunction = 0;
02967 
02968     Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal));
02969 
02970     CurFun.CurrentFunction = SavedCurFn;
02971 
02972     // If this is an initializer for a constant pointer, which is referencing a
02973     // (currently) undefined variable, create a stub now that shall be replaced
02974     // in the future with the right type of variable.
02975     //
02976     if (V == 0) {
02977       assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
02978       const PointerType *PT = cast<PointerType>(Ty);
02979 
02980       // First check to see if the forward references value is already created!
02981       PerModuleInfo::GlobalRefsType::iterator I =
02982         CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal)));
02983     
02984       if (I != CurModule.GlobalRefs.end()) {
02985         V = I->second;             // Placeholder already exists, use it...
02986         (yyvsp[0].ValIDVal).destroy();
02987       } else {
02988         std::string Name;
02989         if ((yyvsp[0].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[0].ValIDVal).Name;
02990 
02991         // Create the forward referenced global.
02992         GlobalValue *GV;
02993         if (const FunctionType *FTy = 
02994                  dyn_cast<FunctionType>(PT->getElementType())) {
02995           GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
02996                             CurModule.CurrentModule);
02997         } else {
02998           GV = new GlobalVariable(PT->getElementType(), false,
02999                                   GlobalValue::ExternalLinkage, 0,
03000                                   Name, CurModule.CurrentModule);
03001         }
03002 
03003         // Keep track of the fact that we have a forward ref to recycle it
03004         CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV));
03005         V = GV;
03006       }
03007     }
03008 
03009     (yyval.ConstVal) = cast<GlobalValue>(V);
03010     delete (yyvsp[-1].TypeVal);            // Free the type handle
03011   ;}
03012     break;
03013 
03014   case 84:
03015 #line 1290 "llvmAsmParser.y"
03016     {
03017     if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType())
03018       ThrowException("Mismatched types for constant expression!");
03019     (yyval.ConstVal) = (yyvsp[0].ConstVal);
03020     delete (yyvsp[-1].TypeVal);
03021   ;}
03022     break;
03023 
03024   case 85:
03025 #line 1296 "llvmAsmParser.y"
03026     {
03027     const Type *Ty = (yyvsp[-1].TypeVal)->get();
03028     if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
03029       ThrowException("Cannot create a null initialized value of this type!");
03030     (yyval.ConstVal) = Constant::getNullValue(Ty);
03031     delete (yyvsp[-1].TypeVal);
03032   ;}
03033     break;
03034 
03035   case 86:
03036 #line 1304 "llvmAsmParser.y"
03037     {      // integral constants
03038     if (!ConstantSInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)))
03039       ThrowException("Constant value doesn't fit in type!");
03040     (yyval.ConstVal) = ConstantSInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val));
03041   ;}
03042     break;
03043 
03044   case 87:
03045 #line 1309 "llvmAsmParser.y"
03046     {            // integral constants
03047     if (!ConstantUInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)))
03048       ThrowException("Constant value doesn't fit in type!");
03049     (yyval.ConstVal) = ConstantUInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val));
03050   ;}
03051     break;
03052 
03053   case 88:
03054 #line 1314 "llvmAsmParser.y"
03055     {                      // Boolean constants
03056     (yyval.ConstVal) = ConstantBool::True;
03057   ;}
03058     break;
03059 
03060   case 89:
03061 #line 1317 "llvmAsmParser.y"
03062     {                     // Boolean constants
03063     (yyval.ConstVal) = ConstantBool::False;
03064   ;}
03065     break;
03066 
03067   case 90:
03068 #line 1320 "llvmAsmParser.y"
03069     {                   // Float & Double constants
03070     (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal));
03071   ;}
03072     break;
03073 
03074   case 91:
03075 #line 1325 "llvmAsmParser.y"
03076     {
03077     if (!(yyvsp[-3].ConstVal)->getType()->isFirstClassType())
03078       ThrowException("cast constant expression from a non-primitive type: '" +
03079                      (yyvsp[-3].ConstVal)->getType()->getDescription() + "'!");
03080     if (!(yyvsp[-1].TypeVal)->get()->isFirstClassType())
03081       ThrowException("cast constant expression to a non-primitive type: '" +
03082                      (yyvsp[-1].TypeVal)->get()->getDescription() + "'!");
03083     (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-3].ConstVal), (yyvsp[-1].TypeVal)->get());
03084     delete (yyvsp[-1].TypeVal);
03085   ;}
03086     break;
03087 
03088   case 92:
03089 #line 1335 "llvmAsmParser.y"
03090     {
03091     if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType()))
03092       ThrowException("GetElementPtr requires a pointer operand!");
03093 
03094     // LLVM 1.2 and earlier used ubyte struct indices.  Convert any ubyte struct
03095     // indices to uint struct indices for compatibility.
03096     generic_gep_type_iterator<std::vector<Value*>::iterator>
03097       GTI = gep_type_begin((yyvsp[-2].ConstVal)->getType(), (yyvsp[-1].ValueList)->begin(), (yyvsp[-1].ValueList)->end()),
03098       GTE = gep_type_end((yyvsp[-2].ConstVal)->getType(), (yyvsp[-1].ValueList)->begin(), (yyvsp[-1].ValueList)->end());
03099     for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e && GTI != GTE; ++i, ++GTI)
03100       if (isa<StructType>(*GTI))        // Only change struct indices
03101         if (ConstantUInt *CUI = dyn_cast<ConstantUInt>((*(yyvsp[-1].ValueList))[i]))
03102           if (CUI->getType() == Type::UByteTy)
03103             (*(yyvsp[-1].ValueList))[i] = ConstantExpr::getCast(CUI, Type::UIntTy);
03104 
03105     const Type *IdxTy =
03106       GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), *(yyvsp[-1].ValueList), true);
03107     if (!IdxTy)
03108       ThrowException("Index list invalid for constant getelementptr!");
03109 
03110     std::vector<Constant*> IdxVec;
03111     for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i)
03112       if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i]))
03113         IdxVec.push_back(C);
03114       else
03115         ThrowException("Indices to constant getelementptr must be constants!");
03116 
03117     delete (yyvsp[-1].ValueList);
03118 
03119     (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), IdxVec);
03120   ;}
03121     break;
03122 
03123   case 93:
03124 #line 1366 "llvmAsmParser.y"
03125     {
03126     if ((yyvsp[-5].ConstVal)->getType() != Type::BoolTy)
03127       ThrowException("Select condition must be of boolean type!");
03128     if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
03129       ThrowException("Select operand types must match!");
03130     (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
03131   ;}
03132     break;
03133 
03134   case 94:
03135 #line 1373 "llvmAsmParser.y"
03136     {
03137     if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
03138       ThrowException("Binary operator types must match!");
03139     // HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs.
03140     // To retain backward compatibility with these early compilers, we emit a
03141     // cast to the appropriate integer type automatically if we are in the
03142     // broken case.  See PR424 for more information.
03143     if (!isa<PointerType>((yyvsp[-3].ConstVal)->getType())) {
03144       (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
03145     } else {
03146       const Type *IntPtrTy = 0;
03147       switch (CurModule.CurrentModule->getPointerSize()) {
03148       case Module::Pointer32: IntPtrTy = Type::IntTy; break;
03149       case Module::Pointer64: IntPtrTy = Type::LongTy; break;
03150       default: ThrowException("invalid pointer binary constant expr!");
03151       }
03152       (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), ConstantExpr::getCast((yyvsp[-3].ConstVal), IntPtrTy),
03153                              ConstantExpr::getCast((yyvsp[-1].ConstVal), IntPtrTy));
03154       (yyval.ConstVal) = ConstantExpr::getCast((yyval.ConstVal), (yyvsp[-3].ConstVal)->getType());
03155     }
03156   ;}
03157     break;
03158 
03159   case 95:
03160 #line 1394 "llvmAsmParser.y"
03161     {
03162     if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
03163       ThrowException("Logical operator types must match!");
03164     if (!(yyvsp[-3].ConstVal)->getType()->isIntegral())
03165       ThrowException("Logical operands must have integral types!");
03166     (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
03167   ;}
03168     break;
03169 
03170   case 96:
03171 #line 1401 "llvmAsmParser.y"
03172     {
03173     if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
03174       ThrowException("setcc operand types must match!");
03175     (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
03176   ;}
03177     break;
03178 
03179   case 97:
03180 #line 1406 "llvmAsmParser.y"
03181     {
03182     if ((yyvsp[-1].ConstVal)->getType() != Type::UByteTy)
03183       ThrowException("Shift count for shift constant must be unsigned byte!");
03184     if (!(yyvsp[-3].ConstVal)->getType()->isInteger())
03185       ThrowException("Shift constant expression requires integer operand!");
03186     (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
03187   ;}
03188     break;
03189 
03190   case 98:
03191 #line 1416 "llvmAsmParser.y"
03192     {
03193     ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal));
03194   ;}
03195     break;
03196 
03197   case 99:
03198 #line 1419 "llvmAsmParser.y"
03199     {
03200     (yyval.ConstVector) = new std::vector<Constant*>();
03201     (yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
03202   ;}
03203     break;
03204 
03205   case 100:
03206 #line 1426 "llvmAsmParser.y"
03207     { (yyval.BoolVal) = false; ;}
03208     break;
03209 
03210   case 101:
03211 #line 1426 "llvmAsmParser.y"
03212     { (yyval.BoolVal) = true; ;}
03213     break;
03214 
03215   case 102:
03216 #line 1436 "llvmAsmParser.y"
03217     {
03218   (yyval.ModuleVal) = ParserResult = (yyvsp[0].ModuleVal);
03219   CurModule.ModuleDone();
03220 ;}
03221     break;
03222 
03223   case 103:
03224 #line 1443 "llvmAsmParser.y"
03225     {
03226     (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
03227     CurFun.FunctionDone();
03228   ;}
03229     break;
03230 
03231   case 104:
03232 #line 1447 "llvmAsmParser.y"
03233     {
03234     (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
03235   ;}
03236     break;
03237 
03238   case 105:
03239 #line 1450 "llvmAsmParser.y"
03240     {
03241     (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
03242   ;}
03243     break;
03244 
03245   case 106:
03246 #line 1453 "llvmAsmParser.y"
03247     {
03248     (yyval.ModuleVal) = CurModule.CurrentModule;
03249     // Resolve circular types before we parse the body of the module
03250     ResolveTypes(CurModule.LateResolveTypes);
03251   ;}
03252     break;
03253 
03254   case 107:
03255 #line 1460 "llvmAsmParser.y"
03256     {  // Types can be defined in the const pool
03257     // Eagerly resolve types.  This is not an optimization, this is a
03258     // requirement that is due to the fact that we could have this:
03259     //
03260     // %list = type { %list * }
03261     // %list = type { %list * }    ; repeated type decl
03262     //
03263     // If types are not resolved eagerly, then the two types will not be
03264     // determined to be the same type!
03265     //
03266     ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal));
03267 
03268     if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
03269       // If this is a named type that is not a redefinition, add it to the slot
03270       // table.
03271       if (inFunctionScope())
03272         CurFun.Types.push_back(*(yyvsp[0].TypeVal));
03273       else
03274         CurModule.Types.push_back(*(yyvsp[0].TypeVal));
03275     }
03276 
03277     delete (yyvsp[0].TypeVal);
03278   ;}
03279     break;
03280 
03281   case 108:
03282 #line 1483 "llvmAsmParser.y"
03283     {       // Function prototypes can be in const pool
03284   ;}
03285     break;
03286 
03287   case 109:
03288 #line 1485 "llvmAsmParser.y"
03289     {
03290     if ((yyvsp[0].ConstVal) == 0) ThrowException("Global value initializer is not a constant!");
03291     ParseGlobalVariable((yyvsp[-3].StrVal), (yyvsp[-2].Linkage), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
03292   ;}
03293     break;
03294 
03295   case 110:
03296 #line 1489 "llvmAsmParser.y"
03297     {
03298     ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
03299     delete (yyvsp[0].TypeVal);
03300   ;}
03301     break;
03302 
03303   case 111:
03304 #line 1493 "llvmAsmParser.y"
03305     { 
03306   ;}
03307     break;
03308 
03309   case 112:
03310 #line 1495 "llvmAsmParser.y"
03311     {
03312   ;}
03313     break;
03314 
03315   case 113:
03316 #line 1497 "llvmAsmParser.y"
03317     { 
03318   ;}
03319     break;
03320 
03321   case 114:
03322 #line 1502 "llvmAsmParser.y"
03323     { (yyval.Endianness) = Module::BigEndian; ;}
03324     break;
03325 
03326   case 115:
03327 #line 1503 "llvmAsmParser.y"
03328     { (yyval.Endianness) = Module::LittleEndian; ;}
03329     break;
03330 
03331   case 116:
03332 #line 1505 "llvmAsmParser.y"
03333     {
03334     CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness));
03335   ;}
03336     break;
03337 
03338   case 117:
03339 #line 1508 "llvmAsmParser.y"
03340     {
03341     if ((yyvsp[0].UInt64Val) == 32)
03342       CurModule.CurrentModule->setPointerSize(Module::Pointer32);
03343     else if ((yyvsp[0].UInt64Val) == 64)
03344       CurModule.CurrentModule->setPointerSize(Module::Pointer64);
03345     else
03346       ThrowException("Invalid pointer size: '" + utostr((yyvsp[0].UInt64Val)) + "'!");
03347   ;}
03348     break;
03349 
03350   case 118:
03351 #line 1516 "llvmAsmParser.y"
03352     {
03353     CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal));
03354     free((yyvsp[0].StrVal));
03355   ;}
03356     break;
03357 
03358   case 120:
03359 #line 1523 "llvmAsmParser.y"
03360     {
03361           CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
03362           free((yyvsp[0].StrVal));
03363         ;}
03364     break;
03365 
03366   case 121:
03367 #line 1527 "llvmAsmParser.y"
03368     {
03369           CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
03370           free((yyvsp[0].StrVal));
03371         ;}
03372     break;
03373 
03374   case 122:
03375 #line 1531 "llvmAsmParser.y"
03376     {
03377         ;}
03378     break;
03379 
03380   case 126:
03381 #line 1540 "llvmAsmParser.y"
03382     { (yyval.StrVal) = 0; ;}
03383     break;
03384 
03385   case 127:
03386 #line 1542 "llvmAsmParser.y"
03387     {
03388   if (*(yyvsp[-1].TypeVal) == Type::VoidTy)
03389     ThrowException("void typed arguments are invalid!");
03390   (yyval.ArgVal) = new std::pair<PATypeHolder*, char*>((yyvsp[-1].TypeVal), (yyvsp[0].StrVal));
03391 ;}
03392     break;
03393 
03394   case 128:
03395 #line 1548 "llvmAsmParser.y"
03396     {
03397     (yyval.ArgList) = (yyvsp[-2].ArgList);
03398     (yyvsp[-2].ArgList)->push_back(*(yyvsp[0].ArgVal));
03399     delete (yyvsp[0].ArgVal);
03400   ;}
03401     break;
03402 
03403   case 129:
03404 #line 1553 "llvmAsmParser.y"
03405     {
03406     (yyval.ArgList) = new std::vector<std::pair<PATypeHolder*,char*> >();
03407     (yyval.ArgList)->push_back(*(yyvsp[0].ArgVal));
03408     delete (yyvsp[0].ArgVal);
03409   ;}
03410     break;
03411 
03412   case 130:
03413 #line 1559 "llvmAsmParser.y"
03414     {
03415     (yyval.ArgList) = (yyvsp[0].ArgList);
03416   ;}
03417     break;
03418 
03419   case 131:
03420 #line 1562 "llvmAsmParser.y"
03421     {
03422     (yyval.ArgList) = (yyvsp[-2].ArgList);
03423     (yyval.ArgList)->push_back(std::pair<PATypeHolder*,
03424                             char*>(new PATypeHolder(Type::VoidTy), 0));
03425   ;}
03426     break;
03427 
03428   case 132:
03429 #line 1567 "llvmAsmParser.y"
03430     {
03431     (yyval.ArgList) = new std::vector<std::pair<PATypeHolder*,char*> >();
03432     (yyval.ArgList)->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0));
03433   ;}
03434     break;
03435 
03436   case 133:
03437 #line 1571 "llvmAsmParser.y"
03438     {
03439     (yyval.ArgList) = 0;
03440   ;}
03441     break;
03442 
03443   case 134:
03444 #line 1575 "llvmAsmParser.y"
03445     {
03446   UnEscapeLexed((yyvsp[-3].StrVal));
03447   std::string FunctionName((yyvsp[-3].StrVal));
03448   free((yyvsp[-3].StrVal));  // Free strdup'd memory!
03449   
03450   if (!(*(yyvsp[-4].TypeVal))->isFirstClassType() && *(yyvsp[-4].TypeVal) != Type::VoidTy)
03451     ThrowException("LLVM functions cannot return aggregate types!");
03452 
03453   std::vector<const Type*> ParamTypeList;
03454   if ((yyvsp[-1].ArgList)) {   // If there are arguments...
03455     for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = (yyvsp[-1].ArgList)->begin();
03456          I != (yyvsp[-1].ArgList)->end(); ++I)
03457       ParamTypeList.push_back(I->first->get());
03458   }
03459 
03460   bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
03461   if (isVarArg) ParamTypeList.pop_back();
03462 
03463   const FunctionType *FT = FunctionType::get(*(yyvsp[-4].TypeVal), ParamTypeList, isVarArg);
03464   const PointerType *PFT = PointerType::get(FT);
03465   delete (yyvsp[-4].TypeVal);
03466 
03467   ValID ID;
03468   if (!FunctionName.empty()) {
03469     ID = ValID::create((char*)FunctionName.c_str());
03470   } else {
03471     ID = ValID::create((int)CurModule.Values[PFT].size());
03472   }
03473 
03474   Function *Fn = 0;
03475   // See if this function was forward referenced.  If so, recycle the object.
03476   if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
03477     // Move the function to the end of the list, from whereever it was 
03478     // previously inserted.
03479     Fn = cast<Function>(FWRef);
03480     CurModule.CurrentModule->getFunctionList().remove(Fn);
03481     CurModule.CurrentModule->getFunctionList().push_back(Fn);
03482   } else if (!FunctionName.empty() &&     // Merge with an earlier prototype?
03483              (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) {
03484     // If this is the case, either we need to be a forward decl, or it needs 
03485     // to be.
03486     if (!CurFun.isDeclare && !Fn->isExternal())
03487       ThrowException("Redefinition of function '" + FunctionName + "'!");
03488     
03489     // Make sure to strip off any argument names so we can't get conflicts.
03490     if (Fn->isExternal())
03491       for (Function::aiterator AI = Fn->abegin(), AE = Fn->aend();
03492            AI != AE; ++AI)
03493         AI->setName("");
03494 
03495   } else  {  // Not already defined?
03496     Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
03497                       CurModule.CurrentModule);
03498     InsertValue(Fn, CurModule.Values);
03499   }
03500 
03501   CurFun.FunctionStart(Fn);
03502 
03503   // Add all of the arguments we parsed to the function...
03504   if ((yyvsp[-1].ArgList)) {                     // Is null if empty...
03505     if (isVarArg) {  // Nuke the last entry
03506       assert((yyvsp[-1].ArgList)->back().first->get() == Type::VoidTy && (yyvsp[-1].ArgList)->back().second == 0&&
03507              "Not a varargs marker!");
03508       delete (yyvsp[-1].ArgList)->back().first;
03509       (yyvsp[-1].ArgList)->pop_back();  // Delete the last entry
03510     }
03511     Function::aiterator ArgIt = Fn->abegin();
03512     for (std::vector<std::pair<PATypeHolder*, char*> >::iterator I =(yyvsp[-1].ArgList)->begin();
03513          I != (yyvsp[-1].ArgList)->end(); ++I, ++ArgIt) {
03514       delete I->first;                          // Delete the typeholder...
03515 
03516       setValueName(ArgIt, I->second);           // Insert arg into symtab...
03517       InsertValue(ArgIt);
03518     }
03519 
03520     delete (yyvsp[-1].ArgList);                     // We're now done with the argument list
03521   }
03522 ;}
03523     break;
03524 
03525   case 137:
03526 #line 1656 "llvmAsmParser.y"
03527     {
03528   (yyval.FunctionVal) = CurFun.CurrentFunction;
03529 
03530   // Make sure that we keep track of the linkage type even if there was a
03531   // previous "declare".
03532   (yyval.FunctionVal)->setLinkage((yyvsp[-2].Linkage));
03533 
03534   // Resolve circular types before we parse the body of the function.
03535   ResolveTypes(CurFun.LateResolveTypes);
03536 ;}
03537     break;
03538 
03539   case 140:
03540 #line 1669 "llvmAsmParser.y"
03541     {
03542   (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
03543 ;}
03544     break;
03545 
03546   case 141:
03547 #line 1673 "llvmAsmParser.y"
03548     { CurFun.isDeclare = true; ;}
03549     break;
03550 
03551   case 142:
03552 #line 1673 "llvmAsmParser.y"
03553     {
03554   (yyval.FunctionVal) = CurFun.CurrentFunction;
03555   CurFun.FunctionDone();
03556 ;}
03557     break;
03558 
03559   case 143:
03560 #line 1682 "llvmAsmParser.y"
03561     {    // A reference to a direct constant
03562     (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val));
03563   ;}
03564     break;
03565 
03566   case 144:
03567 #line 1685 "llvmAsmParser.y"
03568     {
03569     (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val));
03570   ;}
03571     break;
03572 
03573   case 145:
03574 #line 1688 "llvmAsmParser.y"
03575     {                     // Perhaps it's an FP constant?
03576     (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal));
03577   ;}
03578     break;
03579 
03580   case 146:
03581 #line 1691 "llvmAsmParser.y"
03582     {
03583     (yyval.ValIDVal) = ValID::create(ConstantBool::True);
03584   ;}
03585     break;
03586 
03587   case 147:
03588 #line 1694 "llvmAsmParser.y"
03589     {
03590     (yyval.ValIDVal) = ValID::create(ConstantBool::False);
03591   ;}
03592     break;
03593 
03594   case 148:
03595 #line 1697 "llvmAsmParser.y"
03596     {
03597     (yyval.ValIDVal) = ValID::createNull();
03598   ;}
03599     break;
03600 
03601   case 149:
03602 #line 1700 "llvmAsmParser.y"
03603     {
03604     (yyval.ValIDVal) = ValID::createUndef();
03605   ;}
03606     break;
03607 
03608   case 150:
03609 #line 1703 "llvmAsmParser.y"
03610     { // Nonempty unsized packed vector
03611     const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType();
03612     int NumElements = (yyvsp[-1].ConstVector)->size(); 
03613     
03614     PackedType* pt = PackedType::get(ETy, NumElements);
03615     PATypeHolder* PTy = new PATypeHolder(
03616                                          HandleUpRefs(
03617                                             PackedType::get(
03618                                                 ETy, 
03619                                                 NumElements)
03620                                             )
03621                                          );
03622     
03623     // Verify all elements are correct type!
03624     for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
03625       if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
03626         ThrowException("Element #" + utostr(i) + " is not of type '" + 
03627                      ETy->getDescription() +"' as required!\nIt is of type '" +
03628                      (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
03629     }
03630 
03631     (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[-1].ConstVector)));
03632     delete PTy; delete (yyvsp[-1].ConstVector);
03633   ;}
03634     break;
03635 
03636   case 151:
03637 #line 1727 "llvmAsmParser.y"
03638     {
03639     (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal));
03640   ;}
03641     break;
03642 
03643   case 152:
03644 #line 1734 "llvmAsmParser.y"
03645     {  // Is it an integer reference...?
03646     (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal));
03647   ;}
03648     break;
03649 
03650   case 153:
03651 #line 1737 "llvmAsmParser.y"
03652     {                   // Is it a named reference...?
03653     (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal));
03654   ;}
03655     break;
03656 
03657   case 156:
03658 #line 1748 "llvmAsmParser.y"
03659     {
03660     (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); delete (yyvsp[-1].TypeVal);
03661   ;}
03662     break;
03663 
03664   case 157:
03665 #line 1752 "llvmAsmParser.y"
03666     {
03667     (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
03668   ;}
03669     break;
03670 
03671   case 158:
03672 #line 1755 "llvmAsmParser.y"
03673     { // Do not allow functions with 0 basic blocks   
03674     (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
03675   ;}
03676     break;
03677 
03678   case 159:
03679 #line 1763 "llvmAsmParser.y"
03680     {
03681     setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal));
03682     InsertValue((yyvsp[0].TermInstVal));
03683 
03684     (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal));
03685     InsertValue((yyvsp[-2].BasicBlockVal));
03686     (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal);
03687   ;}
03688     break;
03689 
03690   case 160:
03691 #line 1772 "llvmAsmParser.y"
03692     {
03693     (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal));
03694     (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal);
03695   ;}
03696     break;
03697 
03698   case 161:
03699 #line 1776 "llvmAsmParser.y"
03700     {
03701     (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true);
03702 
03703     // Make sure to move the basic block to the correct location in the
03704     // function, instead of leaving it inserted wherever it was first
03705     // referenced.
03706     CurFun.CurrentFunction->getBasicBlockList().remove(CurBB);
03707     CurFun.CurrentFunction->getBasicBlockList().push_back(CurBB);
03708   ;}
03709     break;
03710 
03711   case 162:
03712 #line 1785 "llvmAsmParser.y"
03713     {
03714     (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((yyvsp[0].StrVal)), true);
03715 
03716     // Make sure to move the basic block to the correct location in the
03717     // function, instead of leaving it inserted wherever it was first
03718     // referenced.
03719     CurFun.CurrentFunction->getBasicBlockList().remove(CurBB);
03720     CurFun.CurrentFunction->getBasicBlockList().push_back(CurBB);
03721   ;}
03722     break;
03723 
03724   case 163:
03725 #line 1795 "llvmAsmParser.y"
03726     {              // Return with a result...
03727     (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal));
03728   ;}
03729     break;
03730 
03731   case 164:
03732 #line 1798 "llvmAsmParser.y"
03733     {                                       // Return with no result...
03734     (yyval.TermInstVal) = new ReturnInst();
03735   ;}
03736     break;
03737 
03738   case 165:
03739 #line 1801 "llvmAsmParser.y"
03740     {                         // Unconditional Branch...
03741     (yyval.TermInstVal) = new BranchInst(getBBVal((yyvsp[0].ValIDVal)));
03742   ;}
03743     break;
03744 
03745   case 166:
03746 #line 1804 "llvmAsmParser.y"
03747     {  
03748     (yyval.TermInstVal) = new BranchInst(getBBVal((yyvsp[-3].ValIDVal)), getBBVal((yyvsp[0].ValIDVal)), getVal(Type::BoolTy, (yyvsp[-6].ValIDVal)));
03749   ;}
03750     break;
03751 
03752   case 167:
03753 #line 1807 "llvmAsmParser.y"
03754     {
03755     SwitchInst *S = new SwitchInst(getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal)), getBBVal((yyvsp[-3].ValIDVal)));
03756     (yyval.TermInstVal) = S;
03757 
03758     std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(),
03759       E = (yyvsp[-1].JumpTable)->end();
03760     for (; I != E; ++I)
03761       S->addCase(I->first, I->second);
03762     delete (yyvsp[-1].JumpTable);
03763   ;}
03764     break;
03765 
03766   case 168:
03767 #line 1817 "llvmAsmParser.y"
03768     {
03769     SwitchInst *S = new SwitchInst(getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal)), getBBVal((yyvsp[-2].ValIDVal)));
03770     (yyval.TermInstVal) = S;
03771   ;}
03772     break;
03773 
03774   case 169:
03775 #line 1822 "llvmAsmParser.y"
03776     {
03777     const PointerType *PFTy;
03778     const FunctionType *Ty;
03779 
03780     if (!(PFTy = dyn_cast<PointerType>((yyvsp[-10].TypeVal)->get())) ||
03781         !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
03782       // Pull out the types of all of the arguments...
03783       std::vector<const Type*> ParamTypes;
03784       if ((yyvsp[-7].ValueList)) {
03785         for (std::vector<Value*>::iterator I = (yyvsp[-7].ValueList)->begin(), E = (yyvsp[-7].ValueList)->end();
03786              I != E; ++I)
03787           ParamTypes.push_back((*I)->getType());
03788       }
03789 
03790       bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
03791       if (isVarArg) ParamTypes.pop_back();
03792 
03793       Ty = FunctionType::get((yyvsp[-10].TypeVal)->get(), ParamTypes, isVarArg);
03794       PFTy = PointerType::get(Ty);
03795     }
03796 
03797     Value *V = getVal(PFTy, (yyvsp[-9].ValIDVal));   // Get the function we're calling...
03798 
03799     BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal));
03800     BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal));
03801 
03802     // Create the call node...
03803     if (!(yyvsp[-7].ValueList)) {                                   // Has no arguments?
03804       (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, std::vector<Value*>());
03805     } else {                                     // Has arguments?
03806       // Loop through FunctionType's arguments and ensure they are specified
03807       // correctly!
03808       //
03809       FunctionType::param_iterator I = Ty->param_begin();
03810       FunctionType::param_iterator E = Ty->param_end();
03811       std::vector<Value*>::iterator ArgI = (yyvsp[-7].ValueList)->begin(), ArgE = (yyvsp[-7].ValueList)->end();
03812 
03813       for (; ArgI != ArgE && I != E; ++ArgI, ++I)
03814         if ((*ArgI)->getType() != *I)
03815           ThrowException("Parameter " +(*ArgI)->getName()+ " is not of type '" +
03816                          (*I)->getDescription() + "'!");
03817 
03818       if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
03819         ThrowException("Invalid number of parameters detected!");
03820 
03821       (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, *(yyvsp[-7].ValueList));
03822     }
03823     delete (yyvsp[-10].TypeVal);
03824     delete (yyvsp[-7].ValueList);
03825   ;}
03826     break;
03827 
03828   case 170:
03829 #line 1872 "llvmAsmParser.y"
03830     {
03831     (yyval.TermInstVal) = new UnwindInst();
03832   ;}
03833     break;
03834 
03835   case 171:
03836 #line 1875 "llvmAsmParser.y"
03837     {
03838     (yyval.TermInstVal) = new UnreachableInst();
03839   ;}
03840     break;
03841 
03842   case 172:
03843 #line 1881 "llvmAsmParser.y"
03844     {
03845     (yyval.JumpTable) = (yyvsp[-5].JumpTable);
03846     Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
03847     if (V == 0)
03848       ThrowException("May only switch on a constant pool value!");
03849 
03850     (yyval.JumpTable)->push_back(std::make_pair(V, getBBVal((yyvsp[0].ValIDVal))));
03851   ;}
03852     break;
03853 
03854   case 173:
03855 #line 1889 "llvmAsmParser.y"
03856     {
03857     (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
03858     Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
03859 
03860     if (V == 0)
03861       ThrowException("May only switch on a constant pool value!");
03862 
03863     (yyval.JumpTable)->push_back(std::make_pair(V, getBBVal((yyvsp[0].ValIDVal))));
03864   ;}
03865     break;
03866 
03867   case 174:
03868 #line 1899 "llvmAsmParser.y"
03869     {
03870   // Is this definition named?? if so, assign the name...
03871   setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal));
03872   InsertValue((yyvsp[0].InstVal));
03873   (yyval.InstVal) = (yyvsp[0].InstVal);
03874 ;}
03875     break;
03876 
03877   case 175:
03878 #line 1906 "llvmAsmParser.y"
03879     {    // Used for PHI nodes
03880     (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
03881     (yyval.PHIList)->push_back(std::make_pair(getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal)), getBBVal((yyvsp[-1].ValIDVal))));
03882     delete (yyvsp[-5].TypeVal);
03883   ;}
03884     break;
03885 
03886   case 176:
03887 #line 1911 "llvmAsmParser.y"
03888     {
03889     (yyval.PHIList) = (yyvsp[-6].PHIList);
03890     (yyvsp[-6].PHIList)->push_back(std::make_pair(getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal)),
03891                                  getBBVal((yyvsp[-1].ValIDVal))));
03892   ;}
03893     break;
03894 
03895   case 177:
03896 #line 1918 "llvmAsmParser.y"
03897     {    // Used for call statements, and memory insts...
03898     (yyval.ValueList) = new std::vector<Value*>();
03899     (yyval.ValueList)->push_back((yyvsp[0].ValueVal));
03900   ;}
03901     break;
03902 
03903   case 178:
03904 #line 1922 "llvmAsmParser.y"
03905     {
03906     (yyval.ValueList) = (yyvsp[-2].ValueList);
03907     (yyvsp[-2].ValueList)->push_back((yyvsp[0].ValueVal));
03908   ;}
03909     break;
03910 
03911   case 180:
03912 #line 1928 "llvmAsmParser.y"
03913     { (yyval.ValueList) = 0; ;}
03914     break;
03915 
03916   case 181:
03917 #line 1930 "llvmAsmParser.y"
03918     {
03919     if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() && 
03920         !isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
03921       ThrowException(
03922         "Arithmetic operator requires integer, FP, or packed operands!");
03923     if(isa<PackedType>((*(yyvsp[-3].TypeVal)).get()) && (yyvsp[-4].BinaryOpVal) == Instruction::Rem) {
03924       ThrowException(
03925         "Rem not supported on packed types!");
03926     }
03927     (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)), getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)));
03928     if ((yyval.InstVal) == 0)
03929       ThrowException("binary operator returned null!");
03930     delete (yyvsp[-3].TypeVal);
03931   ;}
03932     break;
03933 
03934   case 182:
03935 #line 1944 "llvmAsmParser.y"
03936     {
03937     if (!(*(yyvsp[-3].TypeVal))->isIntegral())
03938       ThrowException("Logical operator requires integral operands!");
03939     (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)), getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)));
03940     if ((yyval.InstVal) == 0)
03941       ThrowException("binary operator returned null!");
03942     delete (yyvsp[-3].TypeVal);
03943   ;}
03944     break;
03945 
03946   case 183:
03947 #line 1952 "llvmAsmParser.y"
03948     {
03949     if(isa<PackedType>((*(yyvsp[-3].TypeVal)).get())) {
03950       ThrowException(
03951         "PackedTypes currently not supported in setcc instructions!");
03952     }
03953     (yyval.InstVal) = new SetCondInst((yyvsp[-4].BinaryOpVal), getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)), getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)));
03954     if ((yyval.InstVal) == 0)
03955       ThrowException("binary operator returned null!");
03956     delete (yyvsp[-3].TypeVal);
03957   ;}
03958     break;
03959 
03960   case 184:
03961 #line 1962 "llvmAsmParser.y"
03962     {
03963     std::cerr << "WARNING: Use of eliminated 'not' instruction:"
03964               << " Replacing with 'xor'.\n";
03965 
03966     Value *Ones = ConstantIntegral::getAllOnesValue((yyvsp[0].ValueVal)->getType());
03967     if (Ones == 0)
03968       ThrowException("Expected integral type for not instruction!");
03969 
03970     (yyval.InstVal) = BinaryOperator::create(Instruction::Xor, (yyvsp[0].ValueVal), Ones);
03971     if ((yyval.InstVal) == 0)
03972       ThrowException("Could not create a xor instruction!");
03973   ;}
03974     break;
03975 
03976   case 185:
03977 #line 1974 "llvmAsmParser.y"
03978     {
03979     if ((yyvsp[0].ValueVal)->getType() != Type::UByteTy)
03980       ThrowException("Shift amount must be ubyte!");
03981     if (!(yyvsp[-2].ValueVal)->getType()->isInteger())
03982       ThrowException("Shift constant expression requires integer operand!");
03983     (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
03984   ;}
03985     break;
03986 
03987   case 186:
03988 #line 1981 "llvmAsmParser.y"
03989     {
03990     if (!(yyvsp[0].TypeVal)->get()->isFirstClassType())
03991       ThrowException("cast instruction to a non-primitive type: '" +
03992                      (yyvsp[0].TypeVal)->get()->getDescription() + "'!");
03993     (yyval.InstVal) = new CastInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
03994     delete (yyvsp[0].TypeVal);
03995   ;}
03996     break;
03997 
03998   case 187:
03999 #line 1988 "llvmAsmParser.y"
04000     {
04001     if ((yyvsp[-4].ValueVal)->getType() != Type::BoolTy)
04002       ThrowException("select condition must be boolean!");
04003     if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType())
04004       ThrowException("select value types should match!");
04005     (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
04006   ;}
04007     break;
04008 
04009   case 188:
04010 #line 1995 "llvmAsmParser.y"
04011     {
04012     // FIXME: This is emulation code for an obsolete syntax.  This should be
04013     // removed at some point.
04014     if (!ObsoleteVarArgs) {
04015       std::cerr << "WARNING: this file uses obsolete features.  "
04016                 << "Assemble and disassemble to update it.\n";
04017       ObsoleteVarArgs = true;
04018     }
04019 
04020     // First, load the valist...
04021     Instruction *CurVAList = new LoadInst((yyvsp[-2].ValueVal), "");
04022     CurBB->getInstList().push_back(CurVAList);
04023 
04024     // Emit the vaarg instruction.
04025     (yyval.InstVal) = new VAArgInst(CurVAList, *(yyvsp[0].TypeVal));
04026     
04027     // Now we must advance the pointer and update it in memory.
04028     Instruction *TheVANext = new VANextInst(CurVAList, *(yyvsp[0].TypeVal));
04029     CurBB->getInstList().push_back(TheVANext);
04030 
04031     CurBB->getInstList().push_back(new StoreInst(TheVANext, (yyvsp[-2].ValueVal)));
04032     delete (yyvsp[0].TypeVal);
04033   ;}
04034     break;
04035 
04036   case 189:
04037 #line 2018 "llvmAsmParser.y"
04038     {
04039     (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
04040     delete (yyvsp[0].TypeVal);
04041   ;}
04042     break;
04043 
04044   case 190:
04045 #line 2022 "llvmAsmParser.y"
04046     {
04047     (yyval.InstVal) = new VANextInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
04048     delete (yyvsp[0].TypeVal);
04049   ;}
04050     break;
04051 
04052   case 191:
04053 #line 2026 "llvmAsmParser.y"
04054     {
04055     const Type *Ty = (yyvsp[0].PHIList)->front().first->getType();
04056     if (!Ty->isFirstClassType())
04057       ThrowException("PHI node operands must be of first class type!");
04058     (yyval.InstVal) = new PHINode(Ty);
04059     (yyval.InstVal)->op_reserve((yyvsp[0].PHIList)->size()*2);
04060     while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) {
04061       if ((yyvsp[0].PHIList)->front().first->getType() != Ty) 
04062         ThrowException("All elements of a PHI node must be of the same type!");
04063       cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second);
04064       (yyvsp[0].PHIList)->pop_front();
04065     }
04066     delete (yyvsp[0].PHIList);  // Free the list...
04067   ;}
04068     break;
04069 
04070   case 192:
04071 #line 2040 "llvmAsmParser.y"
04072     {
04073     const PointerType *PFTy;
04074     const FunctionType *Ty;
04075 
04076     if (!(PFTy = dyn_cast<PointerType>((yyvsp[-4].TypeVal)->get())) ||
04077         !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
04078       // Pull out the types of all of the arguments...
04079       std::vector<const Type*> ParamTypes;
04080       if ((yyvsp[-1].ValueList)) {
04081         for (std::vector<Value*>::iterator I = (yyvsp[-1].ValueList)->begin(), E = (yyvsp[-1].ValueList)->end();
04082              I != E; ++I)
04083           ParamTypes.push_back((*I)->getType());
04084       }
04085 
04086       bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
04087       if (isVarArg) ParamTypes.pop_back();
04088 
04089       Ty = FunctionType::get((yyvsp[-4].TypeVal)->get(), ParamTypes, isVarArg);
04090       PFTy = PointerType::get(Ty);
04091     }
04092 
04093     Value *V = getVal(PFTy, (yyvsp[-3].ValIDVal));   // Get the function we're calling...
04094 
04095     // Create the call node...
04096     if (!(yyvsp[-1].ValueList)) {                                   // Has no arguments?
04097       // Make sure no arguments is a good thing!
04098       if (Ty->getNumParams() != 0)
04099         ThrowException("No arguments passed to a function that "
04100                        "expects arguments!");
04101 
04102       (yyval.InstVal) = new CallInst(V, std::vector<Value*>());
04103     } else {                                     // Has arguments?
04104       // Loop through FunctionType's arguments and ensure they are specified
04105       // correctly!
04106       //
04107       FunctionType::param_iterator I = Ty->param_begin();
04108       FunctionType::param_iterator E = Ty->param_end();
04109       std::vector<Value*>::iterator ArgI = (yyvsp[-1].ValueList)->begin(), ArgE = (yyvsp[-1].ValueList)->end();
04110 
04111       for (; ArgI != ArgE && I != E; ++ArgI, ++I)
04112         if ((*ArgI)->getType() != *I)
04113           ThrowException("Parameter " +(*ArgI)->getName()+ " is not of type '" +
04114                          (*I)->getDescription() + "'!");
04115 
04116       if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
04117         ThrowException("Invalid number of parameters detected!");
04118 
04119       (yyval.InstVal) = new CallInst(V, *(yyvsp[-1].ValueList));
04120     }
04121     delete (yyvsp[-4].TypeVal);
04122     delete (yyvsp[-1].ValueList);
04123   ;}
04124     break;
04125 
04126   case 193:
04127 #line 2092 "llvmAsmParser.y"
04128     {
04129     (yyval.InstVal) = (yyvsp[0].InstVal);
04130   ;}
04131     break;
04132 
04133   case 194:
04134 #line 2098 "llvmAsmParser.y"
04135     { 
04136     (yyval.ValueList) = (yyvsp[0].ValueList); 
04137   ;}
04138     break;
04139 
04140   case 195:
04141 #line 2100 "llvmAsmParser.y"
04142     { 
04143     (yyval.ValueList) = new std::vector<Value*>(); 
04144   ;}
04145     break;
04146 
04147   case 196:
04148 #line 2104 "llvmAsmParser.y"
04149     {
04150     (yyval.BoolVal) = true;
04151   ;}
04152     break;
04153 
04154   case 197:
04155 #line 2107 "llvmAsmParser.y"
04156     {
04157     (yyval.BoolVal) = false;
04158   ;}
04159     break;
04160 
04161   case 198:
04162 #line 2112 "llvmAsmParser.y"
04163     {
04164     (yyval.InstVal) = new MallocInst(*(yyvsp[0].TypeVal));
04165     delete (yyvsp[0].TypeVal);
04166   ;}
04167     break;
04168 
04169   case 199:
04170 #line 2116 "llvmAsmParser.y"
04171     {
04172     (yyval.InstVal) = new MallocInst(*(yyvsp[-3].TypeVal), getVal((yyvsp[-1].PrimType), (yyvsp[0].ValIDVal)));
04173     delete (yyvsp[-3].TypeVal);
04174   ;}
04175     break;
04176 
04177   case 200:
04178 #line 2120 "llvmAsmParser.y"
04179     {
04180     (yyval.InstVal) = new AllocaInst(*(yyvsp[0].TypeVal));
04181     delete (yyvsp[0].TypeVal);
04182   ;}
04183     break;
04184 
04185   case 201:
04186 #line 2124 "llvmAsmParser.y"
04187     {
04188     (yyval.InstVal) = new AllocaInst(*(yyvsp[-3].TypeVal), getVal((yyvsp[-1].PrimType), (yyvsp[0].ValIDVal)));
04189     delete (yyvsp[-3].TypeVal);
04190   ;}
04191     break;
04192 
04193   case 202:
04194 #line 2128 "llvmAsmParser.y"
04195     {
04196     if (!isa<PointerType>((yyvsp[0].ValueVal)->getType()))
04197       ThrowException("Trying to free nonpointer type " + 
04198                      (yyvsp[0].ValueVal)->getType()->getDescription() + "!");
04199     (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal));
04200   ;}
04201     break;
04202 
04203   case 203:
04204 #line 2135 "llvmAsmParser.y"
04205     {
04206     if (!isa<PointerType>((yyvsp[-1].TypeVal)->get()))
04207       ThrowException("Can't load from nonpointer type: " +
04208                      (*(yyvsp[-1].TypeVal))->getDescription());
04209     if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType())
04210       ThrowException("Can't load from pointer of non-first-class type: " +
04211                      (*(yyvsp[-1].TypeVal))->getDescription());
04212     (yyval.InstVal) = new LoadInst(getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)), "", (yyvsp[-3].BoolVal));
04213     delete (yyvsp[-1].TypeVal);
04214   ;}
04215     break;
04216 
04217   case 204:
04218 #line 2145 "llvmAsmParser.y"
04219     {
04220     const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
04221     if (!PT)
04222       ThrowException("Can't store to a nonpointer type: " +
04223                      (*(yyvsp[-1].TypeVal))->getDescription());
04224     const Type *ElTy = PT->getElementType();
04225     if (ElTy != (yyvsp[-3].ValueVal)->getType())
04226       ThrowException("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() +
04227                      "' into space of type '" + ElTy->getDescription() + "'!");
04228 
04229     (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)), (yyvsp[-5].BoolVal));
04230     delete (yyvsp[-1].TypeVal);
04231   ;}
04232     break;
04233 
04234   case 205:
04235 #line 2158 "llvmAsmParser.y"
04236     {
04237     if (!isa<PointerType>((yyvsp[-2].TypeVal)->get()))
04238       ThrowException("getelementptr insn requires pointer operand!");
04239 
04240     // LLVM 1.2 and earlier used ubyte struct indices.  Convert any ubyte struct
04241     // indices to uint struct indices for compatibility.
04242     generic_gep_type_iterator<std::vector<Value*>::iterator>
04243       GTI = gep_type_begin((yyvsp[-2].TypeVal)->get(), (yyvsp[0].ValueList)->begin(), (yyvsp[0].ValueList)->end()),
04244       GTE = gep_type_end((yyvsp[-2].TypeVal)->get(), (yyvsp[0].ValueList)->begin(), (yyvsp[0].ValueList)->end());
04245     for (unsigned i = 0, e = (yyvsp[0].ValueList)->size(); i != e && GTI != GTE; ++i, ++GTI)
04246       if (isa<StructType>(*GTI))        // Only change struct indices
04247         if (ConstantUInt *CUI = dyn_cast<ConstantUInt>((*(yyvsp[0].ValueList))[i]))
04248           if (CUI->getType() == Type::UByteTy)
04249             (*(yyvsp[0].ValueList))[i] = ConstantExpr::getCast(CUI, Type::UIntTy);
04250 
04251     if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), *(yyvsp[0].ValueList), true))
04252       ThrowException("Invalid getelementptr indices for type '" +
04253                      (*(yyvsp[-2].TypeVal))->getDescription()+ "'!");
04254     (yyval.InstVal) = new GetElementPtrInst(getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal)), *(yyvsp[0].ValueList));
04255     delete (yyvsp[-2].TypeVal); delete (yyvsp[0].ValueList);
04256   ;}
04257     break;
04258 
04259 
04260     }
04261 
04262 /* Line 1037 of yacc.c.  */
04263 #line 4264 "llvmAsmParser.tab.c"
04264 
04265   yyvsp -= yylen;
04266   yyssp -= yylen;
04267 
04268 
04269   YY_STACK_PRINT (yyss, yyssp);
04270 
04271   *++yyvsp = yyval;
04272 
04273 
04274   /* Now `shift' the result of the reduction.  Determine what state
04275      that goes to, based on the state we popped back to and the rule
04276      number reduced by.  */
04277 
04278   yyn = yyr1[yyn];
04279 
04280   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
04281   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
04282     yystate = yytable[yystate];
04283   else
04284     yystate = yydefgoto[yyn - YYNTOKENS];
04285 
04286   goto yynewstate;
04287 
04288 
04289 /*------------------------------------.
04290 | yyerrlab -- here on detecting error |
04291 `------------------------------------*/
04292 yyerrlab:
04293   /* If not already recovering from an error, report this error.  */
04294   if (!yyerrstatus)
04295     {
04296       ++yynerrs;
04297 #if YYERROR_VERBOSE
04298       yyn = yypact[yystate];
04299 
04300       if (YYPACT_NINF < yyn && yyn < YYLAST)
04301   {
04302     YYSIZE_T yysize = 0;
04303     int yytype = YYTRANSLATE (yychar);
04304     const char* yyprefix;
04305     char *yymsg;
04306     int yyx;
04307 
04308     /* Start YYX at -YYN if negative to avoid negative indexes in
04309        YYCHECK.  */
04310     int yyxbegin = yyn < 0 ? -yyn : 0;
04311 
04312     /* Stay within bounds of both yycheck and yytname.  */
04313     int yychecklim = YYLAST - yyn;
04314     int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
04315     int yycount = 0;
04316 
04317     yyprefix = ", expecting ";
04318     for (yyx = yyxbegin; yyx < yyxend; ++yyx)
04319       if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
04320         {
04321     yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
04322     yycount += 1;
04323     if (yycount == 5)
04324       {
04325         yysize = 0;
04326         break;
04327       }
04328         }
04329     yysize += (sizeof ("syntax error, unexpected ")
04330          + yystrlen (yytname[yytype]));
04331     yymsg = (char *) YYSTACK_ALLOC (yysize);
04332     if (yymsg != 0)
04333       {
04334         char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
04335         yyp = yystpcpy (yyp, yytname[yytype]);
04336 
04337         if (yycount < 5)
04338     {
04339       yyprefix = ", expecting ";
04340       for (yyx = yyxbegin; yyx < yyxend; ++yyx)
04341         if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
04342           {
04343       yyp = yystpcpy (yyp, yyprefix);
04344       yyp = yystpcpy (yyp, yytname[yyx]);
04345       yyprefix = " or ";
04346           }
04347     }
04348         yyerror (yymsg);
04349         YYSTACK_FREE (yymsg);
04350       }
04351     else
04352       yyerror ("syntax error; also virtual memory exhausted");
04353   }
04354       else
04355 #endif /* YYERROR_VERBOSE */
04356   yyerror ("syntax error");
04357     }
04358 
04359 
04360 
04361   if (yyerrstatus == 3)
04362     {
04363       /* If just tried and failed to reuse look-ahead token after an
04364    error, discard it.  */
04365 
04366       if (yychar <= YYEOF)
04367         {
04368           /* If at end of input, pop the error token,
04369        then the rest of the stack, then return failure.  */
04370     if (yychar == YYEOF)
04371        for (;;)
04372          {
04373 
04374      YYPOPSTACK;
04375      if (yyssp == yyss)
04376        YYABORT;
04377      yydestruct ("Error: popping",
04378                              yystos[*yyssp], yyvsp);
04379          }
04380         }
04381       else
04382   {
04383     yydestruct ("Error: discarding", yytoken, &yylval);
04384     yychar = YYEMPTY;
04385   }
04386     }
04387 
04388   /* Else will try to reuse look-ahead token after shifting the error
04389      token.  */
04390   goto yyerrlab1;
04391 
04392 
04393 /*---------------------------------------------------.
04394 | yyerrorlab -- error raised explicitly by YYERROR.  |
04395 `---------------------------------------------------*/
04396 yyerrorlab:
04397 
04398 #ifdef __GNUC__
04399   /* Pacify GCC when the user code never invokes YYERROR and the label
04400      yyerrorlab therefore never appears in user code.  */
04401   if (0)
04402      goto yyerrorlab;
04403 #endif
04404 
04405 yyvsp -= yylen;
04406   yyssp -= yylen;
04407   yystate = *yyssp;
04408   goto yyerrlab1;
04409 
04410 
04411 /*-------------------------------------------------------------.
04412 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
04413 `-------------------------------------------------------------*/
04414 yyerrlab1:
04415   yyerrstatus = 3;  /* Each real token shifted decrements this.  */
04416 
04417   for (;;)
04418     {
04419       yyn = yypact[yystate];
04420       if (yyn != YYPACT_NINF)
04421   {
04422     yyn += YYTERROR;
04423     if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
04424       {
04425         yyn = yytable[yyn];
04426         if (0 < yyn)
04427     break;
04428       }
04429   }
04430 
04431       /* Pop the current state because it cannot handle the error token.  */
04432       if (yyssp == yyss)
04433   YYABORT;
04434 
04435 
04436       yydestruct ("Error: popping", yystos[yystate], yyvsp);
04437       YYPOPSTACK;
04438       yystate = *yyssp;
04439       YY_STACK_PRINT (yyss, yyssp);
04440     }
04441 
04442   if (yyn == YYFINAL)
04443     YYACCEPT;
04444 
04445   *++yyvsp = yylval;
04446 
04447 
04448   /* Shift the error token. */
04449   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
04450 
04451   yystate = yyn;
04452   goto yynewstate;
04453 
04454 
04455 /*-------------------------------------.
04456 | yyacceptlab -- YYACCEPT comes here.  |
04457 `-------------------------------------*/
04458 yyacceptlab:
04459   yyresult = 0;
04460   goto yyreturn;
04461 
04462 /*-----------------------------------.
04463 | yyabortlab -- YYABORT comes here.  |
04464 `-----------------------------------*/
04465 yyabortlab:
04466   yydestruct ("Error: discarding lookahead",
04467               yytoken, &yylval);
04468   yychar = YYEMPTY;
04469   yyresult = 1;
04470   goto yyreturn;
04471 
04472 #ifndef yyoverflow
04473 /*----------------------------------------------.
04474 | yyoverflowlab -- parser overflow comes here.  |
04475 `----------------------------------------------*/
04476 yyoverflowlab:
04477   yyerror ("parser stack overflow");
04478   yyresult = 2;
04479   /* Fall through.  */
04480 #endif
04481 
04482 yyreturn:
04483 #ifndef yyoverflow
04484   if (yyss != yyssa)
04485     YYSTACK_FREE (yyss);
04486 #endif
04487   return yyresult;
04488 }
04489 
04490 
04491 #line 2181 "llvmAsmParser.y"
04492 
04493 int yyerror(const char *ErrorMsg) {
04494   std::string where 
04495     = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
04496                   + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
04497   std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading ";
04498   if (yychar == YYEMPTY || yychar == 0)
04499     errMsg += "end-of-file.";
04500   else
04501     errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'";
04502   ThrowException(errMsg);
04503   return 0;
04504 }
04505