2 /* A Bison parser, made from llvmAsmParser.y
3 by GNU Bison version 1.28 */
5 #define YYBISON 1 /* Identify Bison output. */
7 #define yyparse llvmAsmparse
8 #define yylex llvmAsmlex
9 #define yyerror llvmAsmerror
10 #define yylval llvmAsmlval
11 #define yychar llvmAsmchar
12 #define yydebug llvmAsmdebug
13 #define yynerrs llvmAsmnerrs
14 #define ESINT64VAL 257
15 #define EUINT64VAL 258
35 #define STRINGCONSTANT 278
36 #define IMPLEMENTATION 279
70 #line 13 "llvmAsmParser.y"
72 #include "ParserInternals.h"
73 #include "llvm/BasicBlock.h"
74 #include "llvm/Method.h"
75 #include "llvm/SymbolTable.h"
76 #include "llvm/Module.h"
77 #include "llvm/Type.h"
78 #include "llvm/DerivedTypes.h"
79 #include "llvm/Assembly/Parser.h"
80 #include "llvm/ConstantPool.h"
81 #include "llvm/iTerminators.h"
82 #include "llvm/iMemory.h"
84 #include <utility> // Get definition of pair class
85 #include <stdio.h> // This embarasment is due to our flex lexer...
87 int yyerror(char *ErrorMsg); // Forward declarations to prevent "implicit
88 int yylex(); // declaration" of xxx warnings.
91 static Module *ParserResult;
92 const ToolCommandLine *CurOptions = 0;
94 // This contains info used when building the body of a method. It is destroyed
95 // when the method is completed.
97 typedef vector<Value *> ValueList; // Numbered defs
98 static void ResolveDefinitions(vector<ValueList> &LateResolvers);
100 static struct PerModuleInfo {
101 Module *CurrentModule;
102 vector<ValueList> Values; // Module level numbered definitions
103 vector<ValueList> LateResolveValues;
106 // If we could not resolve some blocks at parsing time (forward branches)
107 // resolve the branches now...
108 ResolveDefinitions(LateResolveValues);
110 Values.clear(); // Clear out method local definitions
115 static struct PerMethodInfo {
116 Method *CurrentMethod; // Pointer to current method being created
118 vector<ValueList> Values; // Keep track of numbered definitions
119 vector<ValueList> LateResolveValues;
121 inline PerMethodInfo() {
125 inline ~PerMethodInfo() {}
127 inline void MethodStart(Method *M) {
132 // If we could not resolve some blocks at parsing time (forward branches)
133 // resolve the branches now...
134 ResolveDefinitions(LateResolveValues);
136 Values.clear(); // Clear out method local definitions
139 } CurMeth; // Info for the current method...
142 //===----------------------------------------------------------------------===//
143 // Code to handle definitions of all the types
144 //===----------------------------------------------------------------------===//
146 static void InsertValue(Value *D, vector<ValueList> &ValueTab = CurMeth.Values) {
147 if (!D->hasName()) { // Is this a numbered definition?
148 unsigned type = D->getType()->getUniqueID();
149 if (ValueTab.size() <= type)
150 ValueTab.resize(type+1, ValueList());
151 //printf("Values[%d][%d] = %d\n", type, ValueTab[type].size(), D);
152 ValueTab[type].push_back(D);
156 static Value *getVal(const Type *Type, ValID &D,
157 bool DoNotImprovise = false) {
159 case 0: { // Is it a numbered definition?
160 unsigned type = Type->getUniqueID();
161 unsigned Num = (unsigned)D.Num;
163 // Module constants occupy the lowest numbered slots...
164 if (type < CurModule.Values.size()) {
165 if (Num < CurModule.Values[type].size())
166 return CurModule.Values[type][Num];
168 Num -= CurModule.Values[type].size();
171 // Make sure that our type is within bounds
172 if (CurMeth.Values.size() <= type)
175 // Check that the number is within bounds...
176 if (CurMeth.Values[type].size() <= Num)
179 return CurMeth.Values[type][Num];
181 case 1: { // Is it a named definition?
183 SymbolTable *SymTab = 0;
184 if (CurMeth.CurrentMethod)
185 SymTab = CurMeth.CurrentMethod->getSymbolTable();
186 Value *N = SymTab ? SymTab->lookup(Type, Name) : 0;
189 SymTab = CurModule.CurrentModule->getSymbolTable();
191 N = SymTab->lookup(Type, Name);
195 D.destroy(); // Free old strdup'd memory...
199 case 2: // Is it a constant pool reference??
200 case 3: // Is it an unsigned const pool reference?
201 case 4:{ // Is it a string const pool reference?
202 ConstPoolVal *CPV = 0;
204 // Check to make sure that "Type" is an integral type, and that our
205 // value will fit into the specified type...
208 if (Type == Type::BoolTy) { // Special handling for boolean data
209 CPV = new ConstPoolBool(D.ConstPool64 != 0);
211 if (!ConstPoolSInt::isValueValidForType(Type, D.ConstPool64))
212 ThrowException("Symbolic constant pool reference is invalid!");
213 CPV = new ConstPoolSInt(Type, D.ConstPool64);
217 if (!ConstPoolUInt::isValueValidForType(Type, D.UConstPool64)) {
218 if (!ConstPoolSInt::isValueValidForType(Type, D.ConstPool64)) {
219 ThrowException("Symbolic constant pool reference is invalid!");
220 } else { // This is really a signed reference. Transmogrify.
221 CPV = new ConstPoolSInt(Type, D.ConstPool64);
224 CPV = new ConstPoolUInt(Type, D.UConstPool64);
228 cerr << "FIXME: TODO: String constants [sbyte] not implemented yet!\n";
230 //CPV = new ConstPoolString(D.Name);
231 D.destroy(); // Free the string memory
234 assert(CPV && "How did we escape creating a constant??");
236 // Scan through the constant table and see if we already have loaded this
239 ConstantPool &CP = CurMeth.CurrentMethod ?
240 CurMeth.CurrentMethod->getConstantPool() :
241 CurModule.CurrentModule->getConstantPool();
242 ConstPoolVal *C = CP.find(CPV); // Already have this constant?
244 delete CPV; // Didn't need this after all, oh well.
245 return C; // Yup, we already have one, recycle it!
249 // Success, everything is kosher. Lets go!
251 } // End of case 2,3,4
255 // If we reached here, we referenced either a symbol that we don't know about
256 // or an id number that hasn't been read yet. We may be referencing something
257 // forward, so just create an entry to be resolved later and get to it...
259 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
261 // TODO: Attempt to coallecse nodes that are the same with previous ones.
263 switch (Type->getPrimitiveID()) {
264 case Type::LabelTyID: d = new BBPlaceHolder(Type, D); break;
265 case Type::MethodTyID:
266 d = new MethPlaceHolder(Type, D);
267 InsertValue(d, CurModule.LateResolveValues);
269 //case Type::ClassTyID: d = new ClassPlaceHolder(Type, D); break;
270 default: d = new DefPlaceHolder(Type, D); break;
273 assert(d != 0 && "How did we not make something?");
274 InsertValue(d, CurMeth.LateResolveValues);
279 //===----------------------------------------------------------------------===//
280 // Code to handle forward references in instructions
281 //===----------------------------------------------------------------------===//
283 // This code handles the late binding needed with statements that reference
284 // values not defined yet... for example, a forward branch, or the PHI node for
287 // This keeps a table (CurMeth.LateResolveValues) of all such forward references
288 // and back patchs after we are done.
291 // ResolveDefinitions - If we could not resolve some defs at parsing
292 // time (forward branches, phi functions for loops, etc...) resolve the
295 static void ResolveDefinitions(vector<ValueList> &LateResolvers) {
296 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
297 for (unsigned ty = 0; ty < LateResolvers.size(); ty++) {
298 while (!LateResolvers[ty].empty()) {
299 Value *V = LateResolvers[ty].back();
300 LateResolvers[ty].pop_back();
301 ValID &DID = getValIDFromPlaceHolder(V);
303 Value *TheRealValue = getVal(Type::getUniqueIDType(ty), DID, true);
305 if (TheRealValue == 0 && DID.Type == 1)
306 ThrowException("Reference to an invalid definition: '" +DID.getName() +
307 "' of type '" + V->getType()->getName() + "'");
308 else if (TheRealValue == 0)
309 ThrowException("Reference to an invalid definition: #" +itostr(DID.Num)+
310 " of type '" + V->getType()->getName() + "'");
312 V->replaceAllUsesWith(TheRealValue);
313 assert(V->use_empty());
318 LateResolvers.clear();
321 // addConstValToConstantPool - This code is used to insert a constant into the
322 // current constant pool. This is designed to make maximal (but not more than
323 // possible) reuse (merging) of constants in the constant pool. This means that
324 // multiple references to %4, for example will all get merged.
326 static ConstPoolVal *addConstValToConstantPool(ConstPoolVal *C) {
327 vector<ValueList> &ValTab = CurMeth.CurrentMethod ?
328 CurMeth.Values : CurModule.Values;
329 ConstantPool &CP = CurMeth.CurrentMethod ?
330 CurMeth.CurrentMethod->getConstantPool() :
331 CurModule.CurrentModule->getConstantPool();
333 if (ConstPoolVal *CPV = CP.find(C)) {
334 // Constant already in constant pool. Try to merge the two constants
335 if (CPV->hasName() && !C->hasName()) {
336 // Merge the two values, we inherit the existing CPV's name.
337 // InsertValue requires that the value have no name to insert correctly
338 // (because we want to fill the slot this constant would have filled)
340 string Name = CPV->getName();
342 InsertValue(CPV, ValTab);
346 } else if (!CPV->hasName() && C->hasName()) {
347 // If we have a name on this value and there isn't one in the const
348 // pool val already, propogate it.
350 CPV->setName(C->getName());
351 delete C; // Sorry, you're toast
353 } else if (CPV->hasName() && C->hasName()) {
354 // Both values have distinct names. We cannot merge them.
356 InsertValue(C, ValTab);
358 } else if (!CPV->hasName() && !C->hasName()) {
359 // Neither value has a name, trivially merge them.
360 InsertValue(CPV, ValTab);
365 assert(0 && "Not reached!");
367 } else { // No duplication of value.
369 InsertValue(C, ValTab);
374 //===----------------------------------------------------------------------===//
375 // RunVMAsmParser - Define an interface to this parser
376 //===----------------------------------------------------------------------===//
378 Module *RunVMAsmParser(const ToolCommandLine &Opts, FILE *F) {
381 llvmAsmlineno = 1; // Reset the current line number...
383 CurModule.CurrentModule = new Module(); // Allocate a new module to read
384 yyparse(); // Parse the file.
385 Module *Result = ParserResult;
387 llvmAsmin = stdin; // F is about to go away, don't use it anymore...
394 #line 337 "llvmAsmParser.y"
398 MethodArgument *MethArgVal;
399 BasicBlock *BasicBlockVal;
400 TerminatorInst *TermInstVal;
401 Instruction *InstVal;
402 ConstPoolVal *ConstVal;
405 list<MethodArgument*> *MethodArgList;
406 list<Value*> *ValueList;
407 list<const Type*> *TypeList;
408 list<pair<ConstPoolVal*, BasicBlock*> > *JumpTable;
409 vector<ConstPoolVal*> *ConstVector;
416 char *StrVal; // This memory is allocated by strdup!
417 ValID ValIDVal; // May contain memory allocated by strdup
419 Instruction::UnaryOps UnaryOpVal;
420 Instruction::BinaryOps BinaryOpVal;
421 Instruction::TermOps TermOpVal;
422 Instruction::MemoryOps MemOpVal;
435 #define YYFLAG -32768
438 #define YYTRANSLATE(x) ((unsigned)(x) <= 311 ? yytranslate[x] : 103)
440 static const char yytranslate[] = { 0,
441 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
442 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
443 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
444 2, 2, 2, 2, 2, 2, 2, 2, 2, 65,
445 66, 67, 2, 64, 2, 2, 2, 2, 2, 2,
446 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
447 58, 2, 2, 2, 2, 2, 2, 2, 2, 2,
448 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
449 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
450 59, 2, 60, 2, 2, 2, 2, 2, 2, 2,
451 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
452 2, 2, 2, 2, 2, 2, 2, 2, 2, 61,
453 2, 2, 62, 2, 63, 2, 2, 2, 2, 2,
454 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
455 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
456 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
457 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
458 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
459 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
460 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
461 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
462 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
463 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
464 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
465 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
466 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
467 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
468 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
469 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
470 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
471 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
476 static const short yyprhs[] = { 0,
477 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
478 20, 22, 24, 26, 28, 30, 32, 34, 36, 38,
479 40, 42, 44, 46, 48, 50, 52, 54, 56, 58,
480 60, 62, 64, 66, 68, 70, 72, 74, 76, 78,
481 80, 82, 84, 86, 88, 90, 93, 94, 97, 100,
482 103, 106, 109, 112, 119, 125, 134, 142, 149, 154,
483 158, 160, 164, 165, 167, 170, 173, 175, 176, 179,
484 183, 185, 187, 188, 194, 198, 201, 203, 205, 207,
485 209, 211, 213, 215, 217, 219, 224, 228, 232, 238,
486 242, 245, 248, 250, 254, 257, 260, 263, 267, 270,
487 271, 275, 278, 282, 292, 302, 309, 315, 318, 321,
488 325, 327, 328, 334, 338, 341, 348, 350, 353, 359,
492 static const short yyrhs[] = { 5,
493 0, 6, 0, 3, 0, 4, 0, 8, 0, 9,
494 0, 10, 0, 11, 0, 12, 0, 13, 0, 14,
495 0, 15, 0, 16, 0, 17, 0, 18, 0, 19,
496 0, 20, 0, 21, 0, 70, 0, 7, 0, 36,
497 0, 37, 0, 38, 0, 39, 0, 40, 0, 41,
498 0, 42, 0, 43, 0, 44, 0, 45, 0, 46,
499 0, 47, 0, 48, 0, 49, 0, 50, 0, 15,
500 0, 13, 0, 11, 0, 9, 0, 16, 0, 14,
501 0, 12, 0, 10, 0, 74, 0, 75, 0, 22,
502 58, 0, 0, 74, 69, 0, 75, 4, 0, 8,
503 26, 0, 8, 27, 0, 19, 24, 0, 20, 70,
504 0, 59, 70, 60, 59, 79, 60, 0, 59, 70,
505 60, 59, 60, 0, 59, 4, 61, 70, 60, 59,
506 79, 60, 0, 59, 4, 61, 70, 60, 59, 60,
507 0, 62, 92, 63, 62, 79, 63, 0, 62, 63,
508 62, 63, 0, 79, 64, 78, 0, 78, 0, 80,
509 77, 78, 0, 0, 82, 0, 82, 89, 0, 80,
510 25, 0, 22, 0, 0, 70, 83, 0, 84, 64,
511 85, 0, 84, 0, 85, 0, 0, 71, 24, 65,
512 86, 66, 0, 87, 80, 28, 0, 93, 29, 0,
513 3, 0, 4, 0, 26, 0, 27, 0, 24, 0,
514 68, 0, 22, 0, 90, 0, 91, 0, 71, 65,
515 92, 66, 0, 71, 65, 66, 0, 59, 70, 60,
516 0, 59, 4, 61, 70, 60, 0, 62, 92, 63,
517 0, 62, 63, 0, 70, 67, 0, 70, 0, 92,
518 64, 70, 0, 93, 94, 0, 88, 94, 0, 95,
519 96, 0, 23, 95, 96, 0, 95, 98, 0, 0,
520 33, 70, 91, 0, 33, 7, 0, 34, 21, 91,
521 0, 34, 8, 91, 64, 21, 91, 64, 21, 91,
522 0, 35, 76, 91, 64, 21, 91, 59, 97, 60,
523 0, 97, 76, 90, 64, 21, 91, 0, 76, 90,
524 64, 21, 91, 0, 77, 101, 0, 70, 91, 0,
525 99, 64, 91, 0, 99, 0, 0, 73, 70, 91,
526 64, 91, 0, 72, 70, 91, 0, 31, 99, 0,
527 32, 70, 91, 65, 100, 66, 0, 102, 0, 51,
528 70, 0, 51, 70, 64, 14, 91, 0, 52, 70,
529 0, 52, 70, 64, 14, 91, 0, 53, 70, 91,
536 static const short yyrline[] = { 0,
537 433, 434, 441, 442, 453, 453, 453, 453, 453, 453,
538 453, 454, 454, 454, 454, 454, 454, 454, 457, 457,
539 462, 462, 462, 462, 463, 463, 463, 463, 463, 464,
540 464, 464, 464, 464, 464, 468, 468, 468, 468, 469,
541 469, 469, 469, 470, 470, 472, 475, 479, 484, 489,
542 492, 495, 501, 504, 517, 521, 539, 546, 554, 568,
543 571, 577, 585, 596, 601, 606, 615, 615, 617, 625,
544 629, 634, 637, 641, 668, 672, 681, 684, 687, 690,
545 693, 698, 701, 704, 711, 719, 724, 728, 731, 734,
546 739, 742, 747, 751, 756, 760, 769, 774, 783, 787,
547 791, 794, 797, 800, 805, 816, 824, 834, 842, 846,
548 852, 852, 854, 859, 864, 873, 910, 914, 919, 929,
554 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
556 static const char * const yytname[] = { "$","error","$undefined.","ESINT64VAL",
557 "EUINT64VAL","SINTVAL","UINTVAL","VOID","BOOL","SBYTE","UBYTE","SHORT","USHORT",
558 "INT","UINT","LONG","ULONG","FLOAT","DOUBLE","STRING","TYPE","LABEL","VAR_ID",
559 "LABELSTR","STRINGCONSTANT","IMPLEMENTATION","TRUE","FALSE","BEGINTOK","END",
560 "DECLARE","PHI","CALL","RET","BR","SWITCH","NEG","NOT","TOINT","TOUINT","ADD",
561 "SUB","MUL","DIV","REM","SETLE","SETGE","SETLT","SETGT","SETEQ","SETNE","MALLOC",
562 "ALLOCA","FREE","LOAD","STORE","GETFIELD","PUTFIELD","'='","'['","']'","'x'",
563 "'{'","'}'","','","'('","')'","'*'","INTVAL","EINT64VAL","Types","TypesV","UnaryOps",
564 "BinaryOps","SIntType","UIntType","IntType","OptAssign","ConstVal","ConstVector",
565 "ConstPool","Module","MethodList","OptVAR_ID","ArgVal","ArgListH","ArgList",
566 "MethodHeaderH","MethodHeader","Method","ConstValueRef","ValueRef","TypeList",
567 "BasicBlockList","BasicBlock","InstructionList","BBTerminatorInst","JumpTable",
568 "Inst","ValueRefList","ValueRefListE","InstVal","MemoryInst", NULL
572 static const short yyr1[] = { 0,
573 68, 68, 69, 69, 70, 70, 70, 70, 70, 70,
574 70, 70, 70, 70, 70, 70, 70, 70, 71, 71,
575 72, 72, 72, 72, 73, 73, 73, 73, 73, 73,
576 73, 73, 73, 73, 73, 74, 74, 74, 74, 75,
577 75, 75, 75, 76, 76, 77, 77, 78, 78, 78,
578 78, 78, 78, 78, 78, 78, 78, 78, 78, 79,
579 79, 80, 80, 81, 82, 82, 83, 83, 84, 85,
580 85, 86, 86, 87, 88, 89, 90, 90, 90, 90,
581 90, 91, 91, 91, 70, 70, 70, 70, 70, 70,
582 70, 70, 92, 92, 93, 93, 94, 94, 95, 95,
583 96, 96, 96, 96, 96, 97, 97, 98, 99, 99,
584 100, 100, 101, 101, 101, 101, 101, 102, 102, 102,
588 static const short yyr2[] = { 0,
589 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
590 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
591 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
592 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
593 1, 1, 1, 1, 1, 2, 0, 2, 2, 2,
594 2, 2, 2, 6, 5, 8, 7, 6, 4, 3,
595 1, 3, 0, 1, 2, 2, 1, 0, 2, 3,
596 1, 1, 0, 5, 3, 2, 1, 1, 1, 1,
597 1, 1, 1, 1, 1, 4, 3, 3, 5, 3,
598 2, 2, 1, 3, 2, 2, 2, 3, 2, 0,
599 3, 2, 3, 9, 9, 6, 5, 2, 2, 3,
600 1, 0, 5, 3, 2, 6, 1, 2, 5, 2,
604 static const short yydefact[] = { 63,
605 47, 64, 0, 66, 0, 77, 78, 1, 2, 20,
606 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
607 15, 16, 17, 18, 83, 81, 79, 80, 0, 0,
608 82, 19, 0, 63, 100, 65, 84, 85, 100, 46,
609 0, 39, 43, 38, 42, 37, 41, 36, 40, 0,
610 0, 0, 0, 0, 0, 62, 78, 19, 0, 91,
611 93, 0, 92, 0, 0, 47, 100, 96, 47, 76,
612 95, 50, 51, 52, 53, 78, 19, 0, 0, 3,
613 4, 48, 49, 0, 88, 90, 0, 73, 87, 0,
614 75, 47, 0, 0, 0, 0, 97, 99, 0, 0,
615 0, 0, 19, 94, 68, 71, 72, 0, 86, 98,
616 102, 19, 0, 0, 44, 45, 0, 0, 0, 21,
617 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
618 32, 33, 34, 35, 0, 0, 0, 0, 0, 108,
619 117, 19, 0, 59, 0, 89, 67, 69, 0, 74,
620 101, 0, 103, 0, 19, 115, 19, 118, 120, 19,
621 19, 19, 0, 55, 61, 0, 0, 70, 0, 0,
622 109, 0, 0, 0, 0, 122, 114, 0, 0, 54,
623 0, 58, 0, 0, 110, 112, 0, 0, 0, 57,
624 0, 60, 0, 0, 111, 0, 119, 121, 113, 56,
625 0, 0, 116, 0, 0, 0, 104, 0, 105, 0,
626 0, 0, 0, 0, 107, 0, 106, 0, 0, 0
629 static const short yydefgoto[] = { 31,
630 82, 61, 59, 138, 139, 54, 55, 117, 5, 165,
631 166, 1, 218, 2, 148, 106, 107, 108, 34, 35,
632 36, 37, 38, 62, 39, 68, 69, 97, 206, 98,
636 static const short yypact[] = {-32768,
637 59, 295, -23,-32768, 435,-32768,-32768,-32768,-32768,-32768,
638 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
639 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 320, 209,
640 -32768, -21, -20,-32768, 38,-32768,-32768,-32768, 83,-32768,
641 66,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 77,
642 295, 380, 234, 206, 122,-32768, 107, 29, 108,-32768,
643 167, 6,-32768, 111, 145, 101,-32768,-32768, 45,-32768,
644 -32768,-32768,-32768,-32768, 167, 142, 44, 121, 81,-32768,
645 -32768,-32768,-32768, 295,-32768,-32768, 295, 295,-32768, 193,
646 -32768, 45, 405, 1, 264, 149,-32768,-32768, 295, 205,
647 202, 204, 58, 167, 10, 203,-32768, 215,-32768,-32768,
648 217, 7, 116, 116,-32768,-32768, 116, 295, 295,-32768,
649 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
650 -32768,-32768,-32768,-32768, 295, 295, 295, 295, 295,-32768,
651 -32768, 72, 28,-32768, 435,-32768,-32768,-32768, 295,-32768,
652 -32768, 219,-32768, 220, 7, 221, 7, -59, 141, 7,
653 7, 7, 210,-32768,-32768, 110, 199,-32768, 249, 265,
654 -32768, 116, 222, 274, 275,-32768,-32768, 226, 43,-32768,
655 435,-32768, 116, 116,-32768, 295, 116, 116, 116,-32768,
656 115,-32768, 227, 233, 221, 228,-32768,-32768,-32768,-32768,
657 297, 264,-32768, 116, 104, 5,-32768, 231,-32768, 104,
658 299, 279, 116, 324,-32768, 116,-32768, 348, 349,-32768
661 static const short yypgoto[] = {-32768,
662 -32768, -2, 350,-32768,-32768, -93, -92, -24, -62, -4,
663 -119, 316,-32768,-32768,-32768,-32768, 207,-32768,-32768,-32768,
664 -32768, -64, -89, 11,-32768, 312, 286, 263,-32768,-32768,
665 172,-32768,-32768,-32768
672 static const short yytable[] = { 32,
673 56, 115, 116, 64, 174, -19, 96, 63, 113, 6,
674 7, 8, 9, 42, 43, 44, 45, 46, 47, 48,
675 49, 114, 151, 152, 153, 167, 58, 154, 25, 96,
676 26, 147, 27, 28, 40, 41, 42, 43, 44, 45,
677 46, 47, 48, 49, 65, 63, 50, 51, 75, 77,
678 41, 42, 43, 44, 45, 46, 47, 48, 49, 191,
679 67, 50, 51, 79, 209, 171, 3, 173, 86, 87,
680 176, 177, 178, 63, -19, 90, 63, 93, 94, 95,
681 3, 103, 185, 4, 104, 105, 52, 164, 85, 53,
682 112, 72, 73, 193, 194, 63, 142, 197, 198, 199,
683 74, 52, 190, 100, 53, 67, 6, 7, 115, 116,
684 63, 70, 115, 116, 207, 155, 157, 146, 6, 7,
685 8, 9, 3, 215, 63, 83, 217, 26, 91, 27,
686 28, 163, 158, 159, 160, 161, 162, 25, 63, 26,
687 208, 27, 28, 102, 87, 212, 105, 6, 7, 8,
688 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
689 19, 20, 21, 22, 23, 24, 25, 84, 26, 180,
690 27, 28, 65, 181, 200, 88, 192, 205, 181, 118,
691 119, 210, 101, 155, 120, 121, 122, 123, 124, 125,
692 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
693 136, 137, 99, 29, 175, -19, 30, 63, 80, 81,
694 89, 6, 7, 8, 9, 10, 11, 12, 13, 14,
695 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
696 25, -19, 26, 63, 27, 28, 6, 7, 8, 9,
697 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
698 20, 21, 22, 23, 24, 25, 87, 26, 109, 27,
699 28, 182, 181, 143, 144, 145, 149, 29, 179, 183,
700 30, 60, 42, 43, 44, 45, 46, 47, 48, 49,
701 150, -20, 169, 170, 172, 184, 186, 187, 188, 189,
702 201, 202, 29, 203, 211, 30, 78, 6, 7, 8,
703 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
704 19, 20, 21, 22, 23, 24, 25, 204, 26, 213,
705 27, 28, 6, 57, 8, 9, 10, 11, 12, 13,
706 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
707 24, 25, 214, 26, 216, 27, 28, 219, 220, 66,
708 71, 33, 92, 29, 110, 168, 30, 195, 0, 0,
709 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
710 0, 0, 0, 0, 0, 0, 0, 0, 29, 0,
711 0, 30, 6, 76, 8, 9, 10, 11, 12, 13,
712 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
713 24, 25, 0, 26, 0, 27, 28, 6, 7, 8,
714 9, 111, 11, 12, 13, 14, 15, 16, 17, 18,
715 19, 20, 21, 22, 23, 24, 25, 0, 26, 0,
716 27, 28, 0, 0, 0, 0, 0, 0, 29, 0,
717 0, 30, 41, 42, 43, 44, 45, 46, 47, 48,
718 49, 0, 0, 50, 51, 0, 0, 0, 0, 0,
719 0, 0, 0, 29, 0, 0, 30, 0, 0, 0,
720 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
721 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
722 0, 0, 0, 52, 0, 0, 53
725 static const short yycheck[] = { 2,
726 5, 95, 95, 24, 64, 65, 69, 67, 8, 3,
727 4, 5, 6, 9, 10, 11, 12, 13, 14, 15,
728 16, 21, 112, 113, 114, 145, 29, 117, 22, 92,
729 24, 22, 26, 27, 58, 8, 9, 10, 11, 12,
730 13, 14, 15, 16, 65, 67, 19, 20, 51, 52,
731 8, 9, 10, 11, 12, 13, 14, 15, 16, 179,
732 23, 19, 20, 53, 60, 155, 22, 157, 63, 64,
733 160, 161, 162, 67, 65, 65, 67, 33, 34, 35,
734 22, 84, 172, 25, 87, 88, 59, 60, 60, 62,
735 93, 26, 27, 183, 184, 67, 99, 187, 188, 189,
736 24, 59, 60, 60, 62, 23, 3, 4, 202, 202,
737 67, 29, 206, 206, 204, 118, 119, 60, 3, 4,
738 5, 6, 22, 213, 67, 4, 216, 24, 28, 26,
739 27, 60, 135, 136, 137, 138, 139, 22, 67, 24,
740 205, 26, 27, 63, 64, 210, 149, 3, 4, 5,
741 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
742 16, 17, 18, 19, 20, 21, 22, 61, 24, 60,
743 26, 27, 65, 64, 60, 65, 181, 202, 64, 31,
744 32, 206, 62, 186, 36, 37, 38, 39, 40, 41,
745 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
746 52, 53, 61, 59, 64, 65, 62, 67, 3, 4,
747 66, 3, 4, 5, 6, 7, 8, 9, 10, 11,
748 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
749 22, 65, 24, 67, 26, 27, 3, 4, 5, 6,
750 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
751 17, 18, 19, 20, 21, 22, 64, 24, 66, 26,
752 27, 63, 64, 59, 63, 62, 64, 59, 59, 21,
753 62, 63, 9, 10, 11, 12, 13, 14, 15, 16,
754 66, 65, 64, 64, 64, 21, 65, 14, 14, 64,
755 64, 59, 59, 66, 64, 62, 63, 3, 4, 5,
756 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
757 16, 17, 18, 19, 20, 21, 22, 21, 24, 21,
758 26, 27, 3, 4, 5, 6, 7, 8, 9, 10,
759 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
760 21, 22, 64, 24, 21, 26, 27, 0, 0, 34,
761 39, 2, 67, 59, 92, 149, 62, 186, -1, -1,
762 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
763 -1, -1, -1, -1, -1, -1, -1, -1, 59, -1,
764 -1, 62, 3, 4, 5, 6, 7, 8, 9, 10,
765 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
766 21, 22, -1, 24, -1, 26, 27, 3, 4, 5,
767 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
768 16, 17, 18, 19, 20, 21, 22, -1, 24, -1,
769 26, 27, -1, -1, -1, -1, -1, -1, 59, -1,
770 -1, 62, 8, 9, 10, 11, 12, 13, 14, 15,
771 16, -1, -1, 19, 20, -1, -1, -1, -1, -1,
772 -1, -1, -1, 59, -1, -1, 62, -1, -1, -1,
773 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
774 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
775 -1, -1, -1, 59, -1, -1, 62
777 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
778 #line 3 "/usr/dcs/software/supported/encap/bison-1.28/share/bison.simple"
779 /* This file comes from bison-1.28. */
781 /* Skeleton output parser for bison,
782 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
784 This program is free software; you can redistribute it and/or modify
785 it under the terms of the GNU General Public License as published by
786 the Free Software Foundation; either version 2, or (at your option)
789 This program is distributed in the hope that it will be useful,
790 but WITHOUT ANY WARRANTY; without even the implied warranty of
791 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
792 GNU General Public License for more details.
794 You should have received a copy of the GNU General Public License
795 along with this program; if not, write to the Free Software
796 Foundation, Inc., 59 Temple Place - Suite 330,
797 Boston, MA 02111-1307, USA. */
799 /* As a special exception, when this file is copied by Bison into a
800 Bison output file, you may use that output file without restriction.
801 This special exception was added by the Free Software Foundation
802 in version 1.24 of Bison. */
804 /* This is the parser code that is written into each bison parser
805 when the %semantic_parser declaration is not specified in the grammar.
806 It was written by Richard Stallman by simplifying the hairy parser
807 used when %semantic_parser is specified. */
809 #ifndef YYSTACK_USE_ALLOCA
811 #define YYSTACK_USE_ALLOCA
812 #else /* alloca not defined */
814 #define YYSTACK_USE_ALLOCA
815 #define alloca __builtin_alloca
816 #else /* not GNU C. */
817 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
818 #define YYSTACK_USE_ALLOCA
820 #else /* not sparc */
821 /* We think this test detects Watcom and Microsoft C. */
822 /* This used to test MSDOS, but that is a bad idea
823 since that symbol is in the user namespace. */
824 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
825 #if 0 /* No need for malloc.h, which pollutes the namespace;
826 instead, just don't use alloca. */
829 #else /* not MSDOS, or __TURBOC__ */
831 /* I don't know what this was needed for, but it pollutes the namespace.
832 So I turned it off. rms, 2 May 1997. */
833 /* #include <malloc.h> */
835 #define YYSTACK_USE_ALLOCA
836 #else /* not MSDOS, or __TURBOC__, or _AIX */
838 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
839 and on HPUX 10. Eventually we can turn this on. */
840 #define YYSTACK_USE_ALLOCA
841 #define alloca __builtin_alloca
844 #endif /* not _AIX */
845 #endif /* not MSDOS, or __TURBOC__ */
846 #endif /* not sparc */
847 #endif /* not GNU C */
848 #endif /* alloca not defined */
849 #endif /* YYSTACK_USE_ALLOCA not defined */
851 #ifdef YYSTACK_USE_ALLOCA
852 #define YYSTACK_ALLOC alloca
854 #define YYSTACK_ALLOC malloc
857 /* Note: there must be only one dollar sign in this file.
858 It is replaced by the list of actions, each action
859 as one case of the switch. */
861 #define yyerrok (yyerrstatus = 0)
862 #define yyclearin (yychar = YYEMPTY)
865 #define YYACCEPT goto yyacceptlab
866 #define YYABORT goto yyabortlab
867 #define YYERROR goto yyerrlab1
868 /* Like YYERROR except do call yyerror.
869 This remains here temporarily to ease the
870 transition to the new meaning of YYERROR, for GCC.
871 Once GCC version 2 has supplanted version 1, this can go. */
872 #define YYFAIL goto yyerrlab
873 #define YYRECOVERING() (!!yyerrstatus)
874 #define YYBACKUP(token, value) \
876 if (yychar == YYEMPTY && yylen == 1) \
877 { yychar = (token), yylval = (value); \
878 yychar1 = YYTRANSLATE (yychar); \
883 { yyerror ("syntax error: cannot back up"); YYERROR; } \
887 #define YYERRCODE 256
890 #define YYLEX yylex()
896 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
898 #define YYLEX yylex(&yylval, &yylloc)
900 #else /* not YYLSP_NEEDED */
902 #define YYLEX yylex(&yylval, YYLEX_PARAM)
904 #define YYLEX yylex(&yylval)
906 #endif /* not YYLSP_NEEDED */
909 /* If nonreentrant, generate the variables here */
913 int yychar; /* the lookahead symbol */
914 YYSTYPE yylval; /* the semantic value of the */
915 /* lookahead symbol */
918 YYLTYPE yylloc; /* location data for the lookahead */
922 int yynerrs; /* number of parse errors so far */
923 #endif /* not YYPURE */
926 int yydebug; /* nonzero means print parse trace */
927 /* Since this is uninitialized, it does not stop multiple parsers
931 /* YYINITDEPTH indicates the initial size of the parser's stacks */
934 #define YYINITDEPTH 200
937 /* YYMAXDEPTH is the maximum size the stacks can grow to
938 (effective only if the built-in stack extension method is used). */
945 #define YYMAXDEPTH 10000
948 /* Define __yy_memcpy. Note that the size argument
949 should be passed with type unsigned int, because that is what the non-GCC
950 definitions require. With GCC, __builtin_memcpy takes an arg
951 of type size_t, but it can handle unsigned int. */
953 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
954 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
955 #else /* not GNU C or C++ */
958 /* This is the most reliable way to avoid incompatibilities
959 in available built-in functions on various systems. */
961 __yy_memcpy (to, from, count)
966 register char *f = from;
967 register char *t = to;
968 register int i = count;
974 #else /* __cplusplus */
976 /* This is the most reliable way to avoid incompatibilities
977 in available built-in functions on various systems. */
979 __yy_memcpy (char *to, char *from, unsigned int count)
981 register char *t = to;
982 register char *f = from;
983 register int i = count;
992 #line 217 "/usr/dcs/software/supported/encap/bison-1.28/share/bison.simple"
994 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
995 into yyparse. The argument should have type void *.
996 It should actually point to an object.
997 Grammar actions can access the variable by casting it
998 to the proper pointer type. */
1000 #ifdef YYPARSE_PARAM
1002 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
1003 #define YYPARSE_PARAM_DECL
1004 #else /* not __cplusplus */
1005 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
1006 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
1007 #endif /* not __cplusplus */
1008 #else /* not YYPARSE_PARAM */
1009 #define YYPARSE_PARAM_ARG
1010 #define YYPARSE_PARAM_DECL
1011 #endif /* not YYPARSE_PARAM */
1013 /* Prevent warning if -Wstrict-prototypes. */
1015 #ifdef YYPARSE_PARAM
1016 int yyparse (void *);
1023 yyparse(YYPARSE_PARAM_ARG)
1026 register int yystate;
1028 register short *yyssp;
1029 register YYSTYPE *yyvsp;
1030 int yyerrstatus; /* number of tokens to shift before error messages enabled */
1031 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
1033 short yyssa[YYINITDEPTH]; /* the state stack */
1034 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
1036 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
1037 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
1040 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
1041 YYLTYPE *yyls = yylsa;
1044 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
1046 #define YYPOPSTACK (yyvsp--, yyssp--)
1049 int yystacksize = YYINITDEPTH;
1050 int yyfree_stacks = 0;
1061 YYSTYPE yyval; /* the variable used to return */
1062 /* semantic values from the action */
1069 fprintf(stderr, "Starting parse\n");
1075 yychar = YYEMPTY; /* Cause a token to be read. */
1077 /* Initialize stack pointers.
1078 Waste one element of value and location stack
1079 so that they stay on the same level as the state stack.
1080 The wasted elements are never initialized. */
1088 /* Push a new state, which is found in yystate . */
1089 /* In all cases, when you get here, the value and location stacks
1090 have just been pushed. so pushing a state here evens the stacks. */
1095 if (yyssp >= yyss + yystacksize - 1)
1097 /* Give user a chance to reallocate the stack */
1098 /* Use copies of these so that the &'s don't force the real ones into memory. */
1099 YYSTYPE *yyvs1 = yyvs;
1100 short *yyss1 = yyss;
1102 YYLTYPE *yyls1 = yyls;
1105 /* Get the current used size of the three stacks, in elements. */
1106 int size = yyssp - yyss + 1;
1109 /* Each stack pointer address is followed by the size of
1110 the data in use in that stack, in bytes. */
1112 /* This used to be a conditional around just the two extra args,
1113 but that might be undefined if yyoverflow is a macro. */
1114 yyoverflow("parser stack overflow",
1115 &yyss1, size * sizeof (*yyssp),
1116 &yyvs1, size * sizeof (*yyvsp),
1117 &yyls1, size * sizeof (*yylsp),
1120 yyoverflow("parser stack overflow",
1121 &yyss1, size * sizeof (*yyssp),
1122 &yyvs1, size * sizeof (*yyvsp),
1126 yyss = yyss1; yyvs = yyvs1;
1130 #else /* no yyoverflow */
1131 /* Extend the stack our own way. */
1132 if (yystacksize >= YYMAXDEPTH)
1134 yyerror("parser stack overflow");
1146 if (yystacksize > YYMAXDEPTH)
1147 yystacksize = YYMAXDEPTH;
1148 #ifndef YYSTACK_USE_ALLOCA
1151 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
1152 __yy_memcpy ((char *)yyss, (char *)yyss1,
1153 size * (unsigned int) sizeof (*yyssp));
1154 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
1155 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
1156 size * (unsigned int) sizeof (*yyvsp));
1158 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
1159 __yy_memcpy ((char *)yyls, (char *)yyls1,
1160 size * (unsigned int) sizeof (*yylsp));
1162 #endif /* no yyoverflow */
1164 yyssp = yyss + size - 1;
1165 yyvsp = yyvs + size - 1;
1167 yylsp = yyls + size - 1;
1172 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
1175 if (yyssp >= yyss + yystacksize - 1)
1181 fprintf(stderr, "Entering state %d\n", yystate);
1187 /* Do appropriate processing given the current state. */
1188 /* Read a lookahead token if we need one and don't already have one. */
1191 /* First try to decide what to do without reference to lookahead token. */
1193 yyn = yypact[yystate];
1197 /* Not known => get a lookahead token if don't already have one. */
1199 /* yychar is either YYEMPTY or YYEOF
1200 or a valid token in external form. */
1202 if (yychar == YYEMPTY)
1206 fprintf(stderr, "Reading a token: ");
1211 /* Convert token to internal form (in yychar1) for indexing tables with */
1213 if (yychar <= 0) /* This means end of input. */
1216 yychar = YYEOF; /* Don't call YYLEX any more */
1220 fprintf(stderr, "Now at end of input.\n");
1225 yychar1 = YYTRANSLATE(yychar);
1230 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
1231 /* Give the individual parser a way to print the precise meaning
1232 of a token, for further debugging info. */
1234 YYPRINT (stderr, yychar, yylval);
1236 fprintf (stderr, ")\n");
1242 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
1247 /* yyn is what to do for this token type in this state.
1248 Negative => reduce, -yyn is rule number.
1249 Positive => shift, yyn is new state.
1250 New state is final state => don't bother to shift,
1251 just return success.
1252 0, or most negative number => error. */
1267 /* Shift the lookahead token. */
1271 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
1274 /* Discard the token being shifted unless it is eof. */
1275 if (yychar != YYEOF)
1283 /* count tokens shifted since error; after three, turn off error status. */
1284 if (yyerrstatus) yyerrstatus--;
1289 /* Do the default action for the current state. */
1292 yyn = yydefact[yystate];
1296 /* Do a reduction. yyn is the number of a rule to reduce with. */
1300 yyval = yyvsp[1-yylen]; /* implement default value of the action */
1307 fprintf (stderr, "Reducing via rule %d (line %d), ",
1310 /* Print the symbols being reduced, and their result. */
1311 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
1312 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
1313 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1321 #line 434 "llvmAsmParser.y"
1323 if (yyvsp[0].UIntVal > (uint32_t)INT32_MAX) // Outside of my range!
1324 ThrowException("Value too large for type!");
1325 yyval.SIntVal = (int32_t)yyvsp[0].UIntVal;
1329 #line 442 "llvmAsmParser.y"
1331 if (yyvsp[0].UInt64Val > (uint64_t)INT64_MAX) // Outside of my range!
1332 ThrowException("Value too large for type!");
1333 yyval.SInt64Val = (int64_t)yyvsp[0].UInt64Val;
1337 #line 472 "llvmAsmParser.y"
1339 yyval.StrVal = yyvsp[-1].StrVal;
1343 #line 475 "llvmAsmParser.y"
1349 #line 479 "llvmAsmParser.y"
1350 { // integral constants
1351 if (!ConstPoolSInt::isValueValidForType(yyvsp[-1].TypeVal, yyvsp[0].SInt64Val))
1352 ThrowException("Constant value doesn't fit in type!");
1353 yyval.ConstVal = new ConstPoolSInt(yyvsp[-1].TypeVal, yyvsp[0].SInt64Val);
1357 #line 484 "llvmAsmParser.y"
1358 { // integral constants
1359 if (!ConstPoolUInt::isValueValidForType(yyvsp[-1].TypeVal, yyvsp[0].UInt64Val))
1360 ThrowException("Constant value doesn't fit in type!");
1361 yyval.ConstVal = new ConstPoolUInt(yyvsp[-1].TypeVal, yyvsp[0].UInt64Val);
1365 #line 489 "llvmAsmParser.y"
1366 { // Boolean constants
1367 yyval.ConstVal = new ConstPoolBool(true);
1371 #line 492 "llvmAsmParser.y"
1372 { // Boolean constants
1373 yyval.ConstVal = new ConstPoolBool(false);
1377 #line 495 "llvmAsmParser.y"
1378 { // String constants
1379 cerr << "FIXME: TODO: String constants [sbyte] not implemented yet!\n";
1381 //$$ = new ConstPoolString($2);
1382 free(yyvsp[0].StrVal);
1386 #line 501 "llvmAsmParser.y"
1388 yyval.ConstVal = new ConstPoolType(yyvsp[0].TypeVal);
1392 #line 504 "llvmAsmParser.y"
1393 { // Nonempty array constant
1394 // Verify all elements are correct type!
1395 const ArrayType *AT = ArrayType::getArrayType(yyvsp[-4].TypeVal);
1396 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
1397 if (yyvsp[-4].TypeVal != (*yyvsp[-1].ConstVector)[i]->getType())
1398 ThrowException("Element #" + utostr(i) + " is not of type '" +
1399 yyvsp[-4].TypeVal->getName() + "' as required!\nIt is of type '" +
1400 (*yyvsp[-1].ConstVector)[i]->getType()->getName() + "'.");
1403 yyval.ConstVal = new ConstPoolArray(AT, *yyvsp[-1].ConstVector);
1404 delete yyvsp[-1].ConstVector;
1408 #line 517 "llvmAsmParser.y"
1409 { // Empty array constant
1410 vector<ConstPoolVal*> Empty;
1411 yyval.ConstVal = new ConstPoolArray(ArrayType::getArrayType(yyvsp[-3].TypeVal), Empty);
1415 #line 521 "llvmAsmParser.y"
1417 // Verify all elements are correct type!
1418 const ArrayType *AT = ArrayType::getArrayType(yyvsp[-4].TypeVal, (int)yyvsp[-6].UInt64Val);
1419 if (yyvsp[-6].UInt64Val != yyvsp[-1].ConstVector->size())
1420 ThrowException("Type mismatch: constant sized array initialized with " +
1421 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
1422 itostr((int)yyvsp[-6].UInt64Val) + "!");
1424 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
1425 if (yyvsp[-4].TypeVal != (*yyvsp[-1].ConstVector)[i]->getType())
1426 ThrowException("Element #" + utostr(i) + " is not of type '" +
1427 yyvsp[-4].TypeVal->getName() + "' as required!\nIt is of type '" +
1428 (*yyvsp[-1].ConstVector)[i]->getType()->getName() + "'.");
1431 yyval.ConstVal = new ConstPoolArray(AT, *yyvsp[-1].ConstVector);
1432 delete yyvsp[-1].ConstVector;
1436 #line 539 "llvmAsmParser.y"
1438 if (yyvsp[-5].UInt64Val != 0)
1439 ThrowException("Type mismatch: constant sized array initialized with 0"
1440 " arguments, but has size of " + itostr((int)yyvsp[-5].UInt64Val) + "!");
1441 vector<ConstPoolVal*> Empty;
1442 yyval.ConstVal = new ConstPoolArray(ArrayType::getArrayType(yyvsp[-3].TypeVal, 0), Empty);
1446 #line 546 "llvmAsmParser.y"
1448 StructType::ElementTypes Types(yyvsp[-4].TypeList->begin(), yyvsp[-4].TypeList->end());
1449 delete yyvsp[-4].TypeList;
1451 const StructType *St = StructType::getStructType(Types);
1452 yyval.ConstVal = new ConstPoolStruct(St, *yyvsp[-1].ConstVector);
1453 delete yyvsp[-1].ConstVector;
1457 #line 554 "llvmAsmParser.y"
1459 const StructType *St =
1460 StructType::getStructType(StructType::ElementTypes());
1461 vector<ConstPoolVal*> Empty;
1462 yyval.ConstVal = new ConstPoolStruct(St, Empty);
1466 #line 568 "llvmAsmParser.y"
1468 (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(addConstValToConstantPool(yyvsp[0].ConstVal));
1472 #line 571 "llvmAsmParser.y"
1474 yyval.ConstVector = new vector<ConstPoolVal*>();
1475 yyval.ConstVector->push_back(addConstValToConstantPool(yyvsp[0].ConstVal));
1479 #line 577 "llvmAsmParser.y"
1481 if (yyvsp[-1].StrVal) {
1482 yyvsp[0].ConstVal->setName(yyvsp[-1].StrVal);
1483 free(yyvsp[-1].StrVal);
1486 addConstValToConstantPool(yyvsp[0].ConstVal);
1490 #line 585 "llvmAsmParser.y"
1495 #line 596 "llvmAsmParser.y"
1497 yyval.ModuleVal = ParserResult = yyvsp[0].ModuleVal;
1498 CurModule.ModuleDone();
1502 #line 601 "llvmAsmParser.y"
1504 yyvsp[-1].ModuleVal->getMethodList().push_back(yyvsp[0].MethodVal);
1505 CurMeth.MethodDone();
1506 yyval.ModuleVal = yyvsp[-1].ModuleVal;
1510 #line 606 "llvmAsmParser.y"
1512 yyval.ModuleVal = CurModule.CurrentModule;
1516 #line 615 "llvmAsmParser.y"
1517 { yyval.StrVal = 0; ;
1520 #line 617 "llvmAsmParser.y"
1522 yyval.MethArgVal = new MethodArgument(yyvsp[-1].TypeVal);
1523 if (yyvsp[0].StrVal) { // Was the argument named?
1524 yyval.MethArgVal->setName(yyvsp[0].StrVal);
1525 free(yyvsp[0].StrVal); // The string was strdup'd, so free it now.
1530 #line 625 "llvmAsmParser.y"
1532 yyval.MethodArgList = yyvsp[0].MethodArgList;
1533 yyvsp[0].MethodArgList->push_front(yyvsp[-2].MethArgVal);
1537 #line 629 "llvmAsmParser.y"
1539 yyval.MethodArgList = new list<MethodArgument*>();
1540 yyval.MethodArgList->push_front(yyvsp[0].MethArgVal);
1544 #line 634 "llvmAsmParser.y"
1546 yyval.MethodArgList = yyvsp[0].MethodArgList;
1550 #line 637 "llvmAsmParser.y"
1552 yyval.MethodArgList = 0;
1556 #line 641 "llvmAsmParser.y"
1558 MethodType::ParamTypes ParamTypeList;
1559 if (yyvsp[-1].MethodArgList)
1560 for (list<MethodArgument*>::iterator I = yyvsp[-1].MethodArgList->begin(); I != yyvsp[-1].MethodArgList->end(); I++)
1561 ParamTypeList.push_back((*I)->getType());
1563 const MethodType *MT = MethodType::getMethodType(yyvsp[-4].TypeVal, ParamTypeList);
1565 Method *M = new Method(MT, yyvsp[-3].StrVal);
1566 free(yyvsp[-3].StrVal); // Free strdup'd memory!
1568 InsertValue(M, CurModule.Values);
1570 CurMeth.MethodStart(M);
1572 // Add all of the arguments we parsed to the method...
1573 if (yyvsp[-1].MethodArgList) { // Is null if empty...
1574 Method::ArgumentListType &ArgList = M->getArgumentList();
1576 for (list<MethodArgument*>::iterator I = yyvsp[-1].MethodArgList->begin(); I != yyvsp[-1].MethodArgList->end(); I++) {
1578 ArgList.push_back(*I);
1580 delete yyvsp[-1].MethodArgList; // We're now done with the argument list
1585 #line 668 "llvmAsmParser.y"
1587 yyval.MethodVal = CurMeth.CurrentMethod;
1591 #line 672 "llvmAsmParser.y"
1593 yyval.MethodVal = yyvsp[-1].MethodVal;
1597 #line 681 "llvmAsmParser.y"
1598 { // A reference to a direct constant
1599 yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val);
1603 #line 684 "llvmAsmParser.y"
1605 yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val);
1609 #line 687 "llvmAsmParser.y"
1611 yyval.ValIDVal = ValID::create((int64_t)1);
1615 #line 690 "llvmAsmParser.y"
1617 yyval.ValIDVal = ValID::create((int64_t)0);
1621 #line 693 "llvmAsmParser.y"
1622 { // Quoted strings work too... especially for methods
1623 yyval.ValIDVal = ValID::create_conststr(yyvsp[0].StrVal);
1627 #line 698 "llvmAsmParser.y"
1628 { // Is it an integer reference...?
1629 yyval.ValIDVal = ValID::create(yyvsp[0].SIntVal);
1633 #line 701 "llvmAsmParser.y"
1634 { // It must be a named reference then...
1635 yyval.ValIDVal = ValID::create(yyvsp[0].StrVal);
1639 #line 704 "llvmAsmParser.y"
1641 yyval.ValIDVal = yyvsp[0].ValIDVal;
1645 #line 711 "llvmAsmParser.y"
1647 Value *D = getVal(Type::TypeTy, yyvsp[0].ValIDVal, true);
1648 if (D == 0) ThrowException("Invalid user defined type: " + yyvsp[0].ValIDVal.getName());
1649 assert (D->getValueType() == Value::ConstantVal &&
1650 "Internal error! User defined type not in const pool!");
1651 ConstPoolType *CPT = (ConstPoolType*)D;
1652 yyval.TypeVal = CPT->getValue();
1656 #line 719 "llvmAsmParser.y"
1657 { // Method derived type?
1658 MethodType::ParamTypes Params(yyvsp[-1].TypeList->begin(), yyvsp[-1].TypeList->end());
1659 delete yyvsp[-1].TypeList;
1660 yyval.TypeVal = MethodType::getMethodType(yyvsp[-3].TypeVal, Params);
1664 #line 724 "llvmAsmParser.y"
1665 { // Method derived type?
1666 MethodType::ParamTypes Params; // Empty list
1667 yyval.TypeVal = MethodType::getMethodType(yyvsp[-2].TypeVal, Params);
1671 #line 728 "llvmAsmParser.y"
1673 yyval.TypeVal = ArrayType::getArrayType(yyvsp[-1].TypeVal);
1677 #line 731 "llvmAsmParser.y"
1679 yyval.TypeVal = ArrayType::getArrayType(yyvsp[-1].TypeVal, (int)yyvsp[-3].UInt64Val);
1683 #line 734 "llvmAsmParser.y"
1685 StructType::ElementTypes Elements(yyvsp[-1].TypeList->begin(), yyvsp[-1].TypeList->end());
1686 delete yyvsp[-1].TypeList;
1687 yyval.TypeVal = StructType::getStructType(Elements);
1691 #line 739 "llvmAsmParser.y"
1693 yyval.TypeVal = StructType::getStructType(StructType::ElementTypes());
1697 #line 742 "llvmAsmParser.y"
1699 yyval.TypeVal = PointerType::getPointerType(yyvsp[-1].TypeVal);
1703 #line 747 "llvmAsmParser.y"
1705 yyval.TypeList = new list<const Type*>();
1706 yyval.TypeList->push_back(yyvsp[0].TypeVal);
1710 #line 751 "llvmAsmParser.y"
1712 (yyval.TypeList=yyvsp[-2].TypeList)->push_back(yyvsp[0].TypeVal);
1716 #line 756 "llvmAsmParser.y"
1718 yyvsp[-1].MethodVal->getBasicBlocks().push_back(yyvsp[0].BasicBlockVal);
1719 yyval.MethodVal = yyvsp[-1].MethodVal;
1723 #line 760 "llvmAsmParser.y"
1724 { // Do not allow methods with 0 basic blocks
1725 yyval.MethodVal = yyvsp[-1].MethodVal; // in them...
1726 yyvsp[-1].MethodVal->getBasicBlocks().push_back(yyvsp[0].BasicBlockVal);
1730 #line 769 "llvmAsmParser.y"
1732 yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal);
1733 InsertValue(yyvsp[-1].BasicBlockVal);
1734 yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
1738 #line 774 "llvmAsmParser.y"
1740 yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal);
1741 yyvsp[-1].BasicBlockVal->setName(yyvsp[-2].StrVal);
1742 free(yyvsp[-2].StrVal); // Free the strdup'd memory...
1744 InsertValue(yyvsp[-1].BasicBlockVal);
1745 yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
1749 #line 783 "llvmAsmParser.y"
1751 yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal);
1752 yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
1756 #line 787 "llvmAsmParser.y"
1758 yyval.BasicBlockVal = new BasicBlock();
1762 #line 791 "llvmAsmParser.y"
1763 { // Return with a result...
1764 yyval.TermInstVal = new ReturnInst(getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal));
1768 #line 794 "llvmAsmParser.y"
1769 { // Return with no result...
1770 yyval.TermInstVal = new ReturnInst();
1774 #line 797 "llvmAsmParser.y"
1775 { // Unconditional Branch...
1776 yyval.TermInstVal = new BranchInst((BasicBlock*)getVal(Type::LabelTy, yyvsp[0].ValIDVal));
1780 #line 800 "llvmAsmParser.y"
1782 yyval.TermInstVal = new BranchInst((BasicBlock*)getVal(Type::LabelTy, yyvsp[-3].ValIDVal),
1783 (BasicBlock*)getVal(Type::LabelTy, yyvsp[0].ValIDVal),
1784 getVal(Type::BoolTy, yyvsp[-6].ValIDVal));
1788 #line 805 "llvmAsmParser.y"
1790 SwitchInst *S = new SwitchInst(getVal(yyvsp[-7].TypeVal, yyvsp[-6].ValIDVal),
1791 (BasicBlock*)getVal(Type::LabelTy, yyvsp[-3].ValIDVal));
1792 yyval.TermInstVal = S;
1794 list<pair<ConstPoolVal*, BasicBlock*> >::iterator I = yyvsp[-1].JumpTable->begin(),
1795 end = yyvsp[-1].JumpTable->end();
1796 for (; I != end; I++)
1797 S->dest_push_back(I->first, I->second);
1801 #line 816 "llvmAsmParser.y"
1803 yyval.JumpTable = yyvsp[-5].JumpTable;
1804 ConstPoolVal *V = (ConstPoolVal*)getVal(yyvsp[-4].TypeVal, yyvsp[-3].ValIDVal, true);
1806 ThrowException("May only switch on a constant pool value!");
1808 yyval.JumpTable->push_back(make_pair(V, (BasicBlock*)getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal)));
1812 #line 824 "llvmAsmParser.y"
1814 yyval.JumpTable = new list<pair<ConstPoolVal*, BasicBlock*> >();
1815 ConstPoolVal *V = (ConstPoolVal*)getVal(yyvsp[-4].TypeVal, yyvsp[-3].ValIDVal, true);
1818 ThrowException("May only switch on a constant pool value!");
1820 yyval.JumpTable->push_back(make_pair(V, (BasicBlock*)getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal)));
1824 #line 834 "llvmAsmParser.y"
1826 if (yyvsp[-1].StrVal) // Is this definition named??
1827 yyvsp[0].InstVal->setName(yyvsp[-1].StrVal); // if so, assign the name...
1829 InsertValue(yyvsp[0].InstVal);
1830 yyval.InstVal = yyvsp[0].InstVal;
1834 #line 842 "llvmAsmParser.y"
1835 { // Used for PHI nodes and call statements...
1836 yyval.ValueList = new list<Value*>();
1837 yyval.ValueList->push_back(getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal));
1841 #line 846 "llvmAsmParser.y"
1843 yyval.ValueList = yyvsp[-2].ValueList;
1844 yyvsp[-2].ValueList->push_back(getVal(yyvsp[-2].ValueList->front()->getType(), yyvsp[0].ValIDVal));
1848 #line 852 "llvmAsmParser.y"
1849 { yyval.ValueList = 0; ;
1852 #line 854 "llvmAsmParser.y"
1854 yyval.InstVal = BinaryOperator::getBinaryOperator(yyvsp[-4].BinaryOpVal, getVal(yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal), getVal(yyvsp[-3].TypeVal, yyvsp[0].ValIDVal));
1855 if (yyval.InstVal == 0)
1856 ThrowException("binary operator returned null!");
1860 #line 859 "llvmAsmParser.y"
1862 yyval.InstVal = UnaryOperator::getUnaryOperator(yyvsp[-2].UnaryOpVal, getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal));
1863 if (yyval.InstVal == 0)
1864 ThrowException("unary operator returned null!");
1868 #line 864 "llvmAsmParser.y"
1870 yyval.InstVal = new PHINode(yyvsp[0].ValueList->front()->getType());
1871 while (yyvsp[0].ValueList->begin() != yyvsp[0].ValueList->end()) {
1872 // TODO: Ensure all types are the same...
1873 ((PHINode*)yyval.InstVal)->addIncoming(yyvsp[0].ValueList->front());
1874 yyvsp[0].ValueList->pop_front();
1876 delete yyvsp[0].ValueList; // Free the list...
1880 #line 873 "llvmAsmParser.y"
1882 if (!yyvsp[-4].TypeVal->isMethodType())
1883 ThrowException("Can only call methods: invalid type '" +
1884 yyvsp[-4].TypeVal->getName() + "'!");
1886 const MethodType *Ty = (const MethodType*)yyvsp[-4].TypeVal;
1888 Value *V = getVal(Ty, yyvsp[-3].ValIDVal);
1889 if (V->getValueType() != Value::MethodVal || V->getType() != Ty)
1890 ThrowException("Cannot call: " + yyvsp[-3].ValIDVal.getName() + "!");
1892 // Create or access a new type that corresponds to the function call...
1893 vector<Value *> Params;
1895 if (yyvsp[-1].ValueList) {
1896 // Pull out just the arguments...
1897 Params.insert(Params.begin(), yyvsp[-1].ValueList->begin(), yyvsp[-1].ValueList->end());
1898 delete yyvsp[-1].ValueList;
1900 // Loop through MethodType's arguments and ensure they are specified
1903 MethodType::ParamTypes::const_iterator I = Ty->getParamTypes().begin();
1905 for (i = 0; i < Params.size() && I != Ty->getParamTypes().end(); ++i,++I){
1906 if (Params[i]->getType() != *I)
1907 ThrowException("Parameter " + utostr(i) + " is not of type '" +
1908 (*I)->getName() + "'!");
1911 if (i != Params.size() || I != Ty->getParamTypes().end())
1912 ThrowException("Invalid number of parameters detected!");
1915 // Create the call node...
1916 yyval.InstVal = new CallInst((Method*)V, Params);
1920 #line 910 "llvmAsmParser.y"
1922 yyval.InstVal = yyvsp[0].InstVal;
1926 #line 914 "llvmAsmParser.y"
1928 ConstPoolVal *TyVal = new ConstPoolType(PointerType::getPointerType(yyvsp[0].TypeVal));
1929 TyVal = addConstValToConstantPool(TyVal);
1930 yyval.InstVal = new MallocInst((ConstPoolType*)TyVal);
1934 #line 919 "llvmAsmParser.y"
1936 if (!yyvsp[-3].TypeVal->isArrayType() || ((const ArrayType*)yyvsp[-3].TypeVal)->isSized())
1937 ThrowException("Trying to allocate " + yyvsp[-3].TypeVal->getName() +
1938 " as unsized array!");
1940 Value *ArrSize = getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal);
1941 ConstPoolVal *TyVal = new ConstPoolType(PointerType::getPointerType(yyvsp[-3].TypeVal));
1942 TyVal = addConstValToConstantPool(TyVal);
1943 yyval.InstVal = new MallocInst((ConstPoolType*)TyVal, ArrSize);
1947 #line 929 "llvmAsmParser.y"
1949 ConstPoolVal *TyVal = new ConstPoolType(PointerType::getPointerType(yyvsp[0].TypeVal));
1950 TyVal = addConstValToConstantPool(TyVal);
1951 yyval.InstVal = new AllocaInst((ConstPoolType*)TyVal);
1955 #line 934 "llvmAsmParser.y"
1957 if (!yyvsp[-3].TypeVal->isArrayType() || ((const ArrayType*)yyvsp[-3].TypeVal)->isSized())
1958 ThrowException("Trying to allocate " + yyvsp[-3].TypeVal->getName() +
1959 " as unsized array!");
1961 Value *ArrSize = getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal);
1962 ConstPoolVal *TyVal = new ConstPoolType(PointerType::getPointerType(yyvsp[-3].TypeVal));
1963 TyVal = addConstValToConstantPool(TyVal);
1964 yyval.InstVal = new AllocaInst((ConstPoolType*)TyVal, ArrSize);
1968 #line 944 "llvmAsmParser.y"
1970 if (!yyvsp[-1].TypeVal->isPointerType())
1971 ThrowException("Trying to free nonpointer type " + yyvsp[-1].TypeVal->getName() + "!");
1972 yyval.InstVal = new FreeInst(getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal));
1976 /* the action file gets copied in in place of this dollarsign */
1977 #line 543 "/usr/dcs/software/supported/encap/bison-1.28/share/bison.simple"
1988 short *ssp1 = yyss - 1;
1989 fprintf (stderr, "state stack now");
1990 while (ssp1 != yyssp)
1991 fprintf (stderr, " %d", *++ssp1);
1992 fprintf (stderr, "\n");
2002 yylsp->first_line = yylloc.first_line;
2003 yylsp->first_column = yylloc.first_column;
2004 yylsp->last_line = (yylsp-1)->last_line;
2005 yylsp->last_column = (yylsp-1)->last_column;
2010 yylsp->last_line = (yylsp+yylen-1)->last_line;
2011 yylsp->last_column = (yylsp+yylen-1)->last_column;
2015 /* Now "shift" the result of the reduction.
2016 Determine what state that goes to,
2017 based on the state we popped back to
2018 and the rule number reduced by. */
2022 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
2023 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2024 yystate = yytable[yystate];
2026 yystate = yydefgoto[yyn - YYNTBASE];
2030 yyerrlab: /* here on detecting error */
2033 /* If not already recovering from an error, report this error. */
2037 #ifdef YYERROR_VERBOSE
2038 yyn = yypact[yystate];
2040 if (yyn > YYFLAG && yyn < YYLAST)
2047 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
2048 for (x = (yyn < 0 ? -yyn : 0);
2049 x < (sizeof(yytname) / sizeof(char *)); x++)
2050 if (yycheck[x + yyn] == x)
2051 size += strlen(yytname[x]) + 15, count++;
2052 msg = (char *) malloc(size + 15);
2055 strcpy(msg, "parse error");
2060 for (x = (yyn < 0 ? -yyn : 0);
2061 x < (sizeof(yytname) / sizeof(char *)); x++)
2062 if (yycheck[x + yyn] == x)
2064 strcat(msg, count == 0 ? ", expecting `" : " or `");
2065 strcat(msg, yytname[x]);
2074 yyerror ("parse error; also virtual memory exceeded");
2077 #endif /* YYERROR_VERBOSE */
2078 yyerror("parse error");
2082 yyerrlab1: /* here on error raised explicitly by an action */
2084 if (yyerrstatus == 3)
2086 /* if just tried and failed to reuse lookahead token after an error, discard it. */
2088 /* return failure if at end of input */
2089 if (yychar == YYEOF)
2094 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
2100 /* Else will try to reuse lookahead token
2101 after shifting the error token. */
2103 yyerrstatus = 3; /* Each real token shifted decrements this */
2107 yyerrdefault: /* current state does not do anything special for the error token. */
2110 /* This is wrong; only states that explicitly want error tokens
2111 should shift them. */
2112 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
2113 if (yyn) goto yydefault;
2116 yyerrpop: /* pop the current state because it cannot handle the error token */
2118 if (yyssp == yyss) YYABORT;
2128 short *ssp1 = yyss - 1;
2129 fprintf (stderr, "Error: state stack now");
2130 while (ssp1 != yyssp)
2131 fprintf (stderr, " %d", *++ssp1);
2132 fprintf (stderr, "\n");
2138 yyn = yypact[yystate];
2143 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
2162 fprintf(stderr, "Shifting error token, ");
2174 /* YYACCEPT comes here. */
2186 /* YYABORT comes here. */
2197 #line 950 "llvmAsmParser.y"
2199 int yyerror(char *ErrorMsg) {
2200 ThrowException(string("Parse error: ") + ErrorMsg);