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
69 #line 13 "llvmAsmParser.y"
71 #include "ParserInternals.h"
72 #include "llvm/BasicBlock.h"
73 #include "llvm/Method.h"
74 #include "llvm/SymbolTable.h"
75 #include "llvm/Module.h"
76 #include "llvm/Type.h"
77 #include "llvm/DerivedTypes.h"
78 #include "llvm/Assembly/Parser.h"
79 #include "llvm/ConstantPool.h"
80 #include "llvm/iTerminators.h"
81 #include "llvm/iMemory.h"
83 #include <utility> // Get definition of pair class
84 #include <stdio.h> // This embarasment is due to our flex lexer...
86 int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
87 int yylex(); // declaration" of xxx warnings.
90 static Module *ParserResult;
91 const ToolCommandLine *CurOptions = 0;
93 // This contains info used when building the body of a method. It is destroyed
94 // when the method is completed.
96 typedef vector<Value *> ValueList; // Numbered defs
97 static void ResolveDefinitions(vector<ValueList> &LateResolvers);
99 static struct PerModuleInfo {
100 Module *CurrentModule;
101 vector<ValueList> Values; // Module level numbered definitions
102 vector<ValueList> LateResolveValues;
105 // If we could not resolve some blocks at parsing time (forward branches)
106 // resolve the branches now...
107 ResolveDefinitions(LateResolveValues);
109 Values.clear(); // Clear out method local definitions
114 static struct PerMethodInfo {
115 Method *CurrentMethod; // Pointer to current method being created
117 vector<ValueList> Values; // Keep track of numbered definitions
118 vector<ValueList> LateResolveValues;
120 inline PerMethodInfo() {
124 inline ~PerMethodInfo() {}
126 inline void MethodStart(Method *M) {
131 // If we could not resolve some blocks at parsing time (forward branches)
132 // resolve the branches now...
133 ResolveDefinitions(LateResolveValues);
135 Values.clear(); // Clear out method local definitions
138 } CurMeth; // Info for the current method...
141 //===----------------------------------------------------------------------===//
142 // Code to handle definitions of all the types
143 //===----------------------------------------------------------------------===//
145 static void InsertValue(Value *D, vector<ValueList> &ValueTab = CurMeth.Values) {
146 if (!D->hasName()) { // Is this a numbered definition?
147 unsigned type = D->getType()->getUniqueID();
148 if (ValueTab.size() <= type)
149 ValueTab.resize(type+1, ValueList());
150 //printf("Values[%d][%d] = %d\n", type, ValueTab[type].size(), D);
151 ValueTab[type].push_back(D);
155 static Value *getVal(const Type *Type, ValID &D,
156 bool DoNotImprovise = false) {
158 case 0: { // Is it a numbered definition?
159 unsigned type = Type->getUniqueID();
160 unsigned Num = (unsigned)D.Num;
162 // Module constants occupy the lowest numbered slots...
163 if (type < CurModule.Values.size()) {
164 if (Num < CurModule.Values[type].size())
165 return CurModule.Values[type][Num];
167 Num -= CurModule.Values[type].size();
170 // Make sure that our type is within bounds
171 if (CurMeth.Values.size() <= type)
174 // Check that the number is within bounds...
175 if (CurMeth.Values[type].size() <= Num)
178 return CurMeth.Values[type][Num];
180 case 1: { // Is it a named definition?
182 SymbolTable *SymTab = 0;
183 if (CurMeth.CurrentMethod)
184 SymTab = CurMeth.CurrentMethod->getSymbolTable();
185 Value *N = SymTab ? SymTab->lookup(Type, Name) : 0;
188 SymTab = CurModule.CurrentModule->getSymbolTable();
190 N = SymTab->lookup(Type, Name);
194 D.destroy(); // Free old strdup'd memory...
198 case 2: // Is it a constant pool reference??
199 case 3: // Is it an unsigned const pool reference?
200 case 4:{ // Is it a string const pool reference?
201 ConstPoolVal *CPV = 0;
203 // Check to make sure that "Type" is an integral type, and that our
204 // value will fit into the specified type...
207 if (Type == Type::BoolTy) { // Special handling for boolean data
208 CPV = new ConstPoolBool(D.ConstPool64 != 0);
210 if (!ConstPoolSInt::isValueValidForType(Type, D.ConstPool64))
211 ThrowException("Symbolic constant pool reference is invalid!");
212 CPV = new ConstPoolSInt(Type, D.ConstPool64);
216 if (!ConstPoolUInt::isValueValidForType(Type, D.UConstPool64)) {
217 if (!ConstPoolSInt::isValueValidForType(Type, D.ConstPool64)) {
218 ThrowException("Symbolic constant pool reference is invalid!");
219 } else { // This is really a signed reference. Transmogrify.
220 CPV = new ConstPoolSInt(Type, D.ConstPool64);
223 CPV = new ConstPoolUInt(Type, D.UConstPool64);
227 cerr << "FIXME: TODO: String constants [sbyte] not implemented yet!\n";
229 //CPV = new ConstPoolString(D.Name);
230 D.destroy(); // Free the string memory
233 assert(CPV && "How did we escape creating a constant??");
235 // Scan through the constant table and see if we already have loaded this
238 ConstantPool &CP = CurMeth.CurrentMethod ?
239 CurMeth.CurrentMethod->getConstantPool() :
240 CurModule.CurrentModule->getConstantPool();
241 ConstPoolVal *C = CP.find(CPV); // Already have this constant?
243 delete CPV; // Didn't need this after all, oh well.
244 return C; // Yup, we already have one, recycle it!
248 // Success, everything is kosher. Lets go!
250 } // End of case 2,3,4
254 // If we reached here, we referenced either a symbol that we don't know about
255 // or an id number that hasn't been read yet. We may be referencing something
256 // forward, so just create an entry to be resolved later and get to it...
258 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
260 // TODO: Attempt to coallecse nodes that are the same with previous ones.
262 switch (Type->getPrimitiveID()) {
263 case Type::LabelTyID: d = new BBPlaceHolder(Type, D); break;
264 case Type::MethodTyID:
265 d = new MethPlaceHolder(Type, D);
266 InsertValue(d, CurModule.LateResolveValues);
268 //case Type::ClassTyID: d = new ClassPlaceHolder(Type, D); break;
269 default: d = new DefPlaceHolder(Type, D); break;
272 assert(d != 0 && "How did we not make something?");
273 InsertValue(d, CurMeth.LateResolveValues);
278 //===----------------------------------------------------------------------===//
279 // Code to handle forward references in instructions
280 //===----------------------------------------------------------------------===//
282 // This code handles the late binding needed with statements that reference
283 // values not defined yet... for example, a forward branch, or the PHI node for
286 // This keeps a table (CurMeth.LateResolveValues) of all such forward references
287 // and back patchs after we are done.
290 // ResolveDefinitions - If we could not resolve some defs at parsing
291 // time (forward branches, phi functions for loops, etc...) resolve the
294 static void ResolveDefinitions(vector<ValueList> &LateResolvers) {
295 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
296 for (unsigned ty = 0; ty < LateResolvers.size(); ty++) {
297 while (!LateResolvers[ty].empty()) {
298 Value *V = LateResolvers[ty].back();
299 LateResolvers[ty].pop_back();
300 ValID &DID = getValIDFromPlaceHolder(V);
302 Value *TheRealValue = getVal(Type::getUniqueIDType(ty), DID, true);
304 if (TheRealValue == 0 && DID.Type == 1)
305 ThrowException("Reference to an invalid definition: '" +DID.getName() +
306 "' of type '" + V->getType()->getName() + "'");
307 else if (TheRealValue == 0)
308 ThrowException("Reference to an invalid definition: #" +itostr(DID.Num)+
309 " of type '" + V->getType()->getName() + "'");
311 V->replaceAllUsesWith(TheRealValue);
312 assert(V->use_empty());
317 LateResolvers.clear();
320 // addConstValToConstantPool - This code is used to insert a constant into the
321 // current constant pool. This is designed to make maximal (but not more than
322 // possible) reuse (merging) of constants in the constant pool. This means that
323 // multiple references to %4, for example will all get merged.
325 static ConstPoolVal *addConstValToConstantPool(ConstPoolVal *C) {
326 vector<ValueList> &ValTab = CurMeth.CurrentMethod ?
327 CurMeth.Values : CurModule.Values;
328 ConstantPool &CP = CurMeth.CurrentMethod ?
329 CurMeth.CurrentMethod->getConstantPool() :
330 CurModule.CurrentModule->getConstantPool();
332 if (ConstPoolVal *CPV = CP.find(C)) {
333 // Constant already in constant pool. Try to merge the two constants
334 if (CPV->hasName() && !C->hasName()) {
335 // Merge the two values, we inherit the existing CPV's name.
336 // InsertValue requires that the value have no name to insert correctly
337 // (because we want to fill the slot this constant would have filled)
339 string Name = CPV->getName();
341 InsertValue(CPV, ValTab);
345 } else if (!CPV->hasName() && C->hasName()) {
346 // If we have a name on this value and there isn't one in the const
347 // pool val already, propogate it.
349 CPV->setName(C->getName());
350 delete C; // Sorry, you're toast
352 } else if (CPV->hasName() && C->hasName()) {
353 // Both values have distinct names. We cannot merge them.
355 InsertValue(C, ValTab);
357 } else if (!CPV->hasName() && !C->hasName()) {
358 // Neither value has a name, trivially merge them.
359 InsertValue(CPV, ValTab);
364 assert(0 && "Not reached!");
366 } else { // No duplication of value.
368 InsertValue(C, ValTab);
373 //===----------------------------------------------------------------------===//
374 // RunVMAsmParser - Define an interface to this parser
375 //===----------------------------------------------------------------------===//
377 Module *RunVMAsmParser(const ToolCommandLine &Opts, FILE *F) {
380 llvmAsmlineno = 1; // Reset the current line number...
382 CurModule.CurrentModule = new Module(); // Allocate a new module to read
383 yyparse(); // Parse the file.
384 Module *Result = ParserResult;
386 llvmAsmin = stdin; // F is about to go away, don't use it anymore...
393 #line 337 "llvmAsmParser.y"
397 MethodArgument *MethArgVal;
398 BasicBlock *BasicBlockVal;
399 TerminatorInst *TermInstVal;
400 Instruction *InstVal;
401 ConstPoolVal *ConstVal;
404 list<MethodArgument*> *MethodArgList;
405 list<Value*> *ValueList;
406 list<const Type*> *TypeList;
407 list<pair<Value*, BasicBlock*> > *PHIList; // Represent the RHS of PHI node
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) <= 310 ? 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, 64,
445 65, 66, 2, 63, 2, 2, 2, 2, 2, 2,
446 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
447 57, 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 58, 2, 59, 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, 60,
453 2, 2, 61, 2, 62, 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
475 static const short yyprhs[] = { 0,
476 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
477 20, 22, 24, 26, 28, 30, 32, 34, 36, 38,
478 40, 42, 44, 46, 48, 50, 52, 54, 56, 58,
479 60, 62, 64, 66, 68, 70, 72, 74, 76, 78,
480 80, 82, 84, 87, 88, 91, 94, 97, 100, 103,
481 106, 113, 119, 128, 136, 143, 148, 152, 154, 158,
482 159, 161, 164, 167, 169, 170, 173, 177, 179, 181,
483 182, 188, 192, 195, 197, 199, 201, 203, 205, 207,
484 209, 211, 213, 218, 222, 226, 232, 236, 239, 242,
485 244, 248, 251, 254, 257, 261, 264, 265, 269, 272,
486 276, 286, 296, 303, 309, 312, 319, 327, 330, 334,
487 336, 337, 343, 347, 353, 356, 363, 365, 368, 374,
491 static const short yyrhs[] = { 5,
492 0, 6, 0, 3, 0, 4, 0, 8, 0, 9,
493 0, 10, 0, 11, 0, 12, 0, 13, 0, 14,
494 0, 15, 0, 16, 0, 17, 0, 18, 0, 19,
495 0, 20, 0, 21, 0, 69, 0, 7, 0, 38,
496 0, 39, 0, 40, 0, 41, 0, 42, 0, 43,
497 0, 44, 0, 45, 0, 46, 0, 47, 0, 48,
498 0, 49, 0, 15, 0, 13, 0, 11, 0, 9,
499 0, 16, 0, 14, 0, 12, 0, 10, 0, 73,
500 0, 74, 0, 22, 57, 0, 0, 73, 68, 0,
501 74, 4, 0, 8, 26, 0, 8, 27, 0, 19,
502 24, 0, 20, 69, 0, 58, 69, 59, 58, 78,
503 59, 0, 58, 69, 59, 58, 59, 0, 58, 4,
504 60, 69, 59, 58, 78, 59, 0, 58, 4, 60,
505 69, 59, 58, 59, 0, 61, 91, 62, 61, 78,
506 62, 0, 61, 62, 61, 62, 0, 78, 63, 77,
507 0, 77, 0, 79, 76, 77, 0, 0, 81, 0,
508 81, 88, 0, 79, 25, 0, 22, 0, 0, 69,
509 82, 0, 83, 63, 84, 0, 83, 0, 84, 0,
510 0, 70, 24, 64, 85, 65, 0, 86, 79, 28,
511 0, 92, 29, 0, 3, 0, 4, 0, 26, 0,
512 27, 0, 24, 0, 67, 0, 22, 0, 89, 0,
513 90, 0, 70, 64, 91, 65, 0, 70, 64, 65,
514 0, 58, 69, 59, 0, 58, 4, 60, 69, 59,
515 0, 61, 91, 62, 0, 61, 62, 0, 69, 66,
516 0, 69, 0, 91, 63, 69, 0, 92, 93, 0,
517 87, 93, 0, 94, 95, 0, 23, 94, 95, 0,
518 94, 97, 0, 0, 35, 69, 90, 0, 35, 7,
519 0, 36, 21, 90, 0, 36, 8, 90, 63, 21,
520 90, 63, 21, 90, 0, 37, 75, 90, 63, 21,
521 90, 58, 96, 59, 0, 96, 75, 89, 63, 21,
522 90, 0, 75, 89, 63, 21, 90, 0, 76, 101,
523 0, 69, 58, 90, 63, 90, 59, 0, 98, 63,
524 58, 90, 63, 90, 59, 0, 69, 90, 0, 99,
525 63, 90, 0, 99, 0, 0, 72, 69, 90, 63,
526 90, 0, 71, 69, 90, 0, 34, 69, 90, 31,
527 69, 0, 32, 98, 0, 33, 69, 90, 64, 100,
528 65, 0, 102, 0, 50, 69, 0, 50, 69, 63,
529 14, 90, 0, 51, 69, 0, 51, 69, 63, 14,
536 static const short yyrline[] = { 0,
537 432, 433, 440, 441, 452, 452, 452, 452, 452, 452,
538 452, 453, 453, 453, 453, 453, 453, 453, 456, 456,
539 461, 462, 462, 462, 462, 462, 463, 463, 463, 463,
540 463, 463, 467, 467, 467, 467, 468, 468, 468, 468,
541 469, 469, 471, 474, 478, 483, 488, 491, 494, 500,
542 503, 516, 520, 538, 545, 553, 567, 570, 576, 584,
543 595, 600, 605, 614, 614, 616, 624, 628, 633, 636,
544 640, 667, 671, 680, 683, 686, 689, 692, 697, 700,
545 703, 710, 718, 723, 727, 730, 733, 738, 741, 746,
546 750, 755, 759, 768, 773, 782, 786, 790, 793, 796,
547 799, 804, 815, 823, 833, 841, 846, 853, 857, 863,
548 863, 865, 870, 875, 878, 889, 926, 930, 935, 944,
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","TO","PHI","CALL","CAST","RET","BR","SWITCH","NOT","ADD","SUB","MUL",
561 "DIV","REM","SETLE","SETGE","SETLT","SETGT","SETEQ","SETNE","MALLOC","ALLOCA",
562 "FREE","LOAD","STORE","GETFIELD","PUTFIELD","'='","'['","']'","'x'","'{'","'}'",
563 "','","'('","')'","'*'","INTVAL","EINT64VAL","Types","TypesV","UnaryOps","BinaryOps",
564 "SIntType","UIntType","IntType","OptAssign","ConstVal","ConstVector","ConstPool",
565 "Module","MethodList","OptVAR_ID","ArgVal","ArgListH","ArgList","MethodHeaderH",
566 "MethodHeader","Method","ConstValueRef","ValueRef","TypeList","BasicBlockList",
567 "BasicBlock","InstructionList","BBTerminatorInst","JumpTable","Inst","PHIList",
568 "ValueRefList","ValueRefListE","InstVal","MemoryInst", NULL
572 static const short yyr1[] = { 0,
573 67, 67, 68, 68, 69, 69, 69, 69, 69, 69,
574 69, 69, 69, 69, 69, 69, 69, 69, 70, 70,
575 71, 72, 72, 72, 72, 72, 72, 72, 72, 72,
576 72, 72, 73, 73, 73, 73, 74, 74, 74, 74,
577 75, 75, 76, 76, 77, 77, 77, 77, 77, 77,
578 77, 77, 77, 77, 77, 77, 78, 78, 79, 79,
579 80, 81, 81, 82, 82, 83, 84, 84, 85, 85,
580 86, 87, 88, 89, 89, 89, 89, 89, 90, 90,
581 90, 69, 69, 69, 69, 69, 69, 69, 69, 91,
582 91, 92, 92, 93, 93, 94, 94, 95, 95, 95,
583 95, 95, 96, 96, 97, 98, 98, 99, 99, 100,
584 100, 101, 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, 2, 0, 2, 2, 2, 2, 2, 2,
594 6, 5, 8, 7, 6, 4, 3, 1, 3, 0,
595 1, 2, 2, 1, 0, 2, 3, 1, 1, 0,
596 5, 3, 2, 1, 1, 1, 1, 1, 1, 1,
597 1, 1, 4, 3, 3, 5, 3, 2, 2, 1,
598 3, 2, 2, 2, 3, 2, 0, 3, 2, 3,
599 9, 9, 6, 5, 2, 6, 7, 2, 3, 1,
600 0, 5, 3, 5, 2, 6, 1, 2, 5, 2,
604 static const short yydefact[] = { 60,
605 44, 61, 0, 63, 0, 74, 75, 1, 2, 20,
606 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
607 15, 16, 17, 18, 80, 78, 76, 77, 0, 0,
608 79, 19, 0, 60, 97, 62, 81, 82, 97, 43,
609 0, 36, 40, 35, 39, 34, 38, 33, 37, 0,
610 0, 0, 0, 0, 0, 59, 75, 19, 0, 88,
611 90, 0, 89, 0, 0, 44, 97, 93, 44, 73,
612 92, 47, 48, 49, 50, 75, 19, 0, 0, 3,
613 4, 45, 46, 0, 85, 87, 0, 70, 84, 0,
614 72, 44, 0, 0, 0, 0, 94, 96, 0, 0,
615 0, 0, 19, 91, 65, 68, 69, 0, 83, 95,
616 99, 19, 0, 0, 41, 42, 0, 0, 0, 0,
617 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
618 31, 32, 0, 0, 0, 0, 0, 105, 117, 19,
619 0, 56, 0, 86, 64, 66, 0, 71, 98, 0,
620 100, 0, 19, 115, 19, 19, 118, 120, 19, 19,
621 19, 0, 52, 58, 0, 0, 67, 0, 0, 0,
622 0, 0, 0, 0, 0, 122, 113, 0, 0, 51,
623 0, 55, 0, 0, 0, 0, 111, 0, 0, 0,
624 0, 54, 0, 57, 0, 0, 0, 0, 19, 110,
625 0, 114, 119, 121, 112, 53, 0, 0, 0, 0,
626 108, 0, 116, 0, 0, 0, 106, 0, 109, 101,
627 0, 102, 0, 107, 0, 0, 0, 0, 104, 0,
631 static const short yydefgoto[] = { 31,
632 82, 61, 59, 136, 137, 54, 55, 117, 5, 164,
633 165, 1, 232, 2, 146, 106, 107, 108, 34, 35,
634 36, 37, 38, 62, 39, 68, 69, 97, 216, 98,
635 154, 200, 201, 138, 139
638 static const short yypact[] = {-32768,
639 7, 319, 12,-32768, 26,-32768,-32768,-32768,-32768,-32768,
640 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
641 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 378, 234,
642 -32768, 13, -21,-32768, 86,-32768,-32768,-32768, 85,-32768,
643 -22,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 88,
644 319, 403, 294, 64, 121,-32768, 66, 24, 74,-32768,
645 -12, 81,-32768, 83, 209, 102,-32768,-32768, 22,-32768,
646 -32768,-32768,-32768,-32768, -12, 68, 54, 87, 96,-32768,
647 -32768,-32768,-32768, 319,-32768,-32768, 319, 319,-32768, 92,
648 -32768, 22, 462, 45, 189, 239,-32768,-32768, 319, 108,
649 113, 115, 63, -12, -1, 119,-32768, 127,-32768,-32768,
650 125, 4, 157, 157,-32768,-32768, 157, 319, 319, 319,
651 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
652 -32768,-32768, 319, 319, 319, 319, 319,-32768,-32768, 80,
653 3,-32768, 26,-32768,-32768,-32768, 319,-32768,-32768, 143,
654 -32768, 144, -33, 146, 4, 4, 90, 124, 4, 4,
655 4, 152,-32768,-32768, -8, 106,-32768, 211, 213, 157,
656 199, 195, 231, 249, 250,-32768,-32768, 202, 91,-32768,
657 26,-32768, 157, 157, 203, 157, 319, 319, 157, 157,
658 157,-32768, 33,-32768, 205, 217, 157, 206, 4, 230,
659 229, -12,-32768,-32768,-32768,-32768, 255, 189, 258, 157,
660 -32768, 157,-32768, 157, 170, 62,-32768, 260,-32768,-32768,
661 279,-32768, 170,-32768, 323, 284, 157, 327,-32768, 157,
662 -32768, 349, 350,-32768
665 static const short yypgoto[] = {-32768,
666 -32768, -2, 351,-32768,-32768, -93, -89, -128, -45, -4,
667 -123, 317,-32768,-32768,-32768,-32768, 207,-32768,-32768,-32768,
668 -32768, -134, -19, -5,-32768, 318, 291, 267,-32768,-32768,
669 -32768,-32768,-32768,-32768,-32768
676 static const short yytable[] = { 32,
677 56, 115, 64, 72, 73, 116, 6, 7, 8, 9,
678 41, 42, 43, 44, 45, 46, 47, 48, 49, 166,
679 145, 50, 51, 96, 170, 25, 58, 26, 3, 27,
680 28, 4, 63, 41, 42, 43, 44, 45, 46, 47,
681 48, 49, 65, 3, 50, 51, 96, 79, 75, 77,
682 180, -19, 113, 63, 181, 193, 93, 94, 95, 90,
683 52, 163, -19, 53, 63, 114, 80, 81, 40, 63,
684 42, 43, 44, 45, 46, 47, 48, 49, 63, 215,
685 221, 103, 85, 52, 104, 105, 53, 223, 226, 63,
686 112, 206, 149, 150, 151, 181, 140, 152, 41, 42,
687 43, 44, 45, 46, 47, 48, 49, 67, 67, 50,
688 51, 74, 100, 70, 115, 153, 155, 156, 116, 63,
689 222, 144, 115, 3, 83, 84, 116, 99, 63, 91,
690 157, 158, 159, 160, 161, 172, 173, 65, 162, 176,
691 177, 178, 86, 87, 105, 63, 88, 101, 52, 192,
692 185, 53, 174, -19, 87, 63, 109, 102, 87, 6,
693 7, 8, 9, 195, 196, 141, 198, 182, 181, 203,
694 204, 205, 6, 7, 142, 143, 194, 209, 25, 211,
695 26, 147, 27, 28, 199, 202, 175, -19, -20, 63,
696 218, 148, 219, 26, 220, 27, 28, 42, 43, 44,
697 45, 46, 47, 48, 49, 168, 169, 229, 171, 179,
698 231, 6, 7, 8, 9, 10, 11, 12, 13, 14,
699 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
700 25, 183, 26, 184, 27, 28, 6, 7, 8, 9,
701 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
702 20, 21, 22, 23, 24, 25, 186, 26, 187, 27,
703 28, 188, 189, 190, 191, 197, 29, 207, 210, 30,
704 118, 119, 120, 89, 208, 214, 121, 122, 123, 124,
705 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
706 135, 29, 212, 213, 30, 60, 6, 7, 8, 9,
707 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
708 20, 21, 22, 23, 24, 25, 217, 26, 224, 27,
709 28, 6, 7, 8, 9, 10, 11, 12, 13, 14,
710 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
711 25, 225, 26, 227, 27, 28, 228, 230, 233, 234,
712 66, 29, 33, 167, 30, 78, 71, 92, 110, 0,
713 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
714 0, 0, 0, 0, 0, 0, 29, 0, 0, 30,
715 6, 57, 8, 9, 10, 11, 12, 13, 14, 15,
716 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
717 0, 26, 0, 27, 28, 6, 76, 8, 9, 10,
718 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
719 21, 22, 23, 24, 25, 0, 26, 0, 27, 28,
720 0, 0, 0, 0, 0, 29, 0, 0, 30, 0,
721 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
722 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
723 29, 0, 0, 30, 6, 7, 8, 9, 111, 11,
724 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
725 22, 23, 24, 25, 0, 26, 0, 27, 28, 0,
726 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
727 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
728 0, 0, 0, 0, 0, 0, 0, 0, 0, 29,
732 static const short yycheck[] = { 2,
733 5, 95, 24, 26, 27, 95, 3, 4, 5, 6,
734 8, 9, 10, 11, 12, 13, 14, 15, 16, 143,
735 22, 19, 20, 69, 58, 22, 29, 24, 22, 26,
736 27, 25, 66, 8, 9, 10, 11, 12, 13, 14,
737 15, 16, 64, 22, 19, 20, 92, 53, 51, 52,
738 59, 64, 8, 66, 63, 179, 35, 36, 37, 65,
739 58, 59, 64, 61, 66, 21, 3, 4, 57, 66,
740 9, 10, 11, 12, 13, 14, 15, 16, 66, 208,
741 215, 84, 59, 58, 87, 88, 61, 216, 223, 66,
742 93, 59, 112, 113, 114, 63, 99, 117, 8, 9,
743 10, 11, 12, 13, 14, 15, 16, 23, 23, 19,
744 20, 24, 59, 29, 208, 118, 119, 120, 208, 66,
745 59, 59, 216, 22, 4, 60, 216, 60, 66, 28,
746 133, 134, 135, 136, 137, 155, 156, 64, 59, 159,
747 160, 161, 62, 63, 147, 66, 64, 61, 58, 59,
748 170, 61, 63, 64, 63, 66, 65, 62, 63, 3,
749 4, 5, 6, 183, 184, 58, 186, 62, 63, 189,
750 190, 191, 3, 4, 62, 61, 181, 197, 22, 199,
751 24, 63, 26, 27, 187, 188, 63, 64, 64, 66,
752 210, 65, 212, 24, 214, 26, 27, 9, 10, 11,
753 12, 13, 14, 15, 16, 63, 63, 227, 63, 58,
754 230, 3, 4, 5, 6, 7, 8, 9, 10, 11,
755 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
756 22, 21, 24, 21, 26, 27, 3, 4, 5, 6,
757 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
758 17, 18, 19, 20, 21, 22, 58, 24, 64, 26,
759 27, 31, 14, 14, 63, 63, 58, 63, 63, 61,
760 32, 33, 34, 65, 58, 21, 38, 39, 40, 41,
761 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
762 52, 58, 63, 65, 61, 62, 3, 4, 5, 6,
763 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
764 17, 18, 19, 20, 21, 22, 59, 24, 59, 26,
765 27, 3, 4, 5, 6, 7, 8, 9, 10, 11,
766 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
767 22, 63, 24, 21, 26, 27, 63, 21, 0, 0,
768 34, 58, 2, 147, 61, 62, 39, 67, 92, -1,
769 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
770 -1, -1, -1, -1, -1, -1, 58, -1, -1, 61,
771 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
772 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
773 -1, 24, -1, 26, 27, 3, 4, 5, 6, 7,
774 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
775 18, 19, 20, 21, 22, -1, 24, -1, 26, 27,
776 -1, -1, -1, -1, -1, 58, -1, -1, 61, -1,
777 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
778 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
779 58, -1, -1, 61, 3, 4, 5, 6, 7, 8,
780 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
781 19, 20, 21, 22, -1, 24, -1, 26, 27, -1,
782 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
783 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
784 -1, -1, -1, -1, -1, -1, -1, -1, -1, 58,
787 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
788 #line 3 "/usr/dcs/software/supported/encap/bison-1.28/share/bison.simple"
789 /* This file comes from bison-1.28. */
791 /* Skeleton output parser for bison,
792 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
794 This program is free software; you can redistribute it and/or modify
795 it under the terms of the GNU General Public License as published by
796 the Free Software Foundation; either version 2, or (at your option)
799 This program is distributed in the hope that it will be useful,
800 but WITHOUT ANY WARRANTY; without even the implied warranty of
801 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
802 GNU General Public License for more details.
804 You should have received a copy of the GNU General Public License
805 along with this program; if not, write to the Free Software
806 Foundation, Inc., 59 Temple Place - Suite 330,
807 Boston, MA 02111-1307, USA. */
809 /* As a special exception, when this file is copied by Bison into a
810 Bison output file, you may use that output file without restriction.
811 This special exception was added by the Free Software Foundation
812 in version 1.24 of Bison. */
814 /* This is the parser code that is written into each bison parser
815 when the %semantic_parser declaration is not specified in the grammar.
816 It was written by Richard Stallman by simplifying the hairy parser
817 used when %semantic_parser is specified. */
819 #ifndef YYSTACK_USE_ALLOCA
821 #define YYSTACK_USE_ALLOCA
822 #else /* alloca not defined */
824 #define YYSTACK_USE_ALLOCA
825 #define alloca __builtin_alloca
826 #else /* not GNU C. */
827 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
828 #define YYSTACK_USE_ALLOCA
830 #else /* not sparc */
831 /* We think this test detects Watcom and Microsoft C. */
832 /* This used to test MSDOS, but that is a bad idea
833 since that symbol is in the user namespace. */
834 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
835 #if 0 /* No need for malloc.h, which pollutes the namespace;
836 instead, just don't use alloca. */
839 #else /* not MSDOS, or __TURBOC__ */
841 /* I don't know what this was needed for, but it pollutes the namespace.
842 So I turned it off. rms, 2 May 1997. */
843 /* #include <malloc.h> */
845 #define YYSTACK_USE_ALLOCA
846 #else /* not MSDOS, or __TURBOC__, or _AIX */
848 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
849 and on HPUX 10. Eventually we can turn this on. */
850 #define YYSTACK_USE_ALLOCA
851 #define alloca __builtin_alloca
854 #endif /* not _AIX */
855 #endif /* not MSDOS, or __TURBOC__ */
856 #endif /* not sparc */
857 #endif /* not GNU C */
858 #endif /* alloca not defined */
859 #endif /* YYSTACK_USE_ALLOCA not defined */
861 #ifdef YYSTACK_USE_ALLOCA
862 #define YYSTACK_ALLOC alloca
864 #define YYSTACK_ALLOC malloc
867 /* Note: there must be only one dollar sign in this file.
868 It is replaced by the list of actions, each action
869 as one case of the switch. */
871 #define yyerrok (yyerrstatus = 0)
872 #define yyclearin (yychar = YYEMPTY)
875 #define YYACCEPT goto yyacceptlab
876 #define YYABORT goto yyabortlab
877 #define YYERROR goto yyerrlab1
878 /* Like YYERROR except do call yyerror.
879 This remains here temporarily to ease the
880 transition to the new meaning of YYERROR, for GCC.
881 Once GCC version 2 has supplanted version 1, this can go. */
882 #define YYFAIL goto yyerrlab
883 #define YYRECOVERING() (!!yyerrstatus)
884 #define YYBACKUP(token, value) \
886 if (yychar == YYEMPTY && yylen == 1) \
887 { yychar = (token), yylval = (value); \
888 yychar1 = YYTRANSLATE (yychar); \
893 { yyerror ("syntax error: cannot back up"); YYERROR; } \
897 #define YYERRCODE 256
900 #define YYLEX yylex()
906 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
908 #define YYLEX yylex(&yylval, &yylloc)
910 #else /* not YYLSP_NEEDED */
912 #define YYLEX yylex(&yylval, YYLEX_PARAM)
914 #define YYLEX yylex(&yylval)
916 #endif /* not YYLSP_NEEDED */
919 /* If nonreentrant, generate the variables here */
923 int yychar; /* the lookahead symbol */
924 YYSTYPE yylval; /* the semantic value of the */
925 /* lookahead symbol */
928 YYLTYPE yylloc; /* location data for the lookahead */
932 int yynerrs; /* number of parse errors so far */
933 #endif /* not YYPURE */
936 int yydebug; /* nonzero means print parse trace */
937 /* Since this is uninitialized, it does not stop multiple parsers
941 /* YYINITDEPTH indicates the initial size of the parser's stacks */
944 #define YYINITDEPTH 200
947 /* YYMAXDEPTH is the maximum size the stacks can grow to
948 (effective only if the built-in stack extension method is used). */
955 #define YYMAXDEPTH 10000
958 /* Define __yy_memcpy. Note that the size argument
959 should be passed with type unsigned int, because that is what the non-GCC
960 definitions require. With GCC, __builtin_memcpy takes an arg
961 of type size_t, but it can handle unsigned int. */
963 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
964 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
965 #else /* not GNU C or C++ */
968 /* This is the most reliable way to avoid incompatibilities
969 in available built-in functions on various systems. */
971 __yy_memcpy (to, from, count)
976 register char *f = from;
977 register char *t = to;
978 register int i = count;
984 #else /* __cplusplus */
986 /* This is the most reliable way to avoid incompatibilities
987 in available built-in functions on various systems. */
989 __yy_memcpy (char *to, char *from, unsigned int count)
991 register char *t = to;
992 register char *f = from;
993 register int i = count;
1002 #line 217 "/usr/dcs/software/supported/encap/bison-1.28/share/bison.simple"
1004 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
1005 into yyparse. The argument should have type void *.
1006 It should actually point to an object.
1007 Grammar actions can access the variable by casting it
1008 to the proper pointer type. */
1010 #ifdef YYPARSE_PARAM
1012 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
1013 #define YYPARSE_PARAM_DECL
1014 #else /* not __cplusplus */
1015 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
1016 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
1017 #endif /* not __cplusplus */
1018 #else /* not YYPARSE_PARAM */
1019 #define YYPARSE_PARAM_ARG
1020 #define YYPARSE_PARAM_DECL
1021 #endif /* not YYPARSE_PARAM */
1023 /* Prevent warning if -Wstrict-prototypes. */
1025 #ifdef YYPARSE_PARAM
1026 int yyparse (void *);
1033 yyparse(YYPARSE_PARAM_ARG)
1036 register int yystate;
1038 register short *yyssp;
1039 register YYSTYPE *yyvsp;
1040 int yyerrstatus; /* number of tokens to shift before error messages enabled */
1041 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
1043 short yyssa[YYINITDEPTH]; /* the state stack */
1044 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
1046 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
1047 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
1050 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
1051 YYLTYPE *yyls = yylsa;
1054 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
1056 #define YYPOPSTACK (yyvsp--, yyssp--)
1059 int yystacksize = YYINITDEPTH;
1060 int yyfree_stacks = 0;
1071 YYSTYPE yyval; /* the variable used to return */
1072 /* semantic values from the action */
1079 fprintf(stderr, "Starting parse\n");
1085 yychar = YYEMPTY; /* Cause a token to be read. */
1087 /* Initialize stack pointers.
1088 Waste one element of value and location stack
1089 so that they stay on the same level as the state stack.
1090 The wasted elements are never initialized. */
1098 /* Push a new state, which is found in yystate . */
1099 /* In all cases, when you get here, the value and location stacks
1100 have just been pushed. so pushing a state here evens the stacks. */
1105 if (yyssp >= yyss + yystacksize - 1)
1107 /* Give user a chance to reallocate the stack */
1108 /* Use copies of these so that the &'s don't force the real ones into memory. */
1109 YYSTYPE *yyvs1 = yyvs;
1110 short *yyss1 = yyss;
1112 YYLTYPE *yyls1 = yyls;
1115 /* Get the current used size of the three stacks, in elements. */
1116 int size = yyssp - yyss + 1;
1119 /* Each stack pointer address is followed by the size of
1120 the data in use in that stack, in bytes. */
1122 /* This used to be a conditional around just the two extra args,
1123 but that might be undefined if yyoverflow is a macro. */
1124 yyoverflow("parser stack overflow",
1125 &yyss1, size * sizeof (*yyssp),
1126 &yyvs1, size * sizeof (*yyvsp),
1127 &yyls1, size * sizeof (*yylsp),
1130 yyoverflow("parser stack overflow",
1131 &yyss1, size * sizeof (*yyssp),
1132 &yyvs1, size * sizeof (*yyvsp),
1136 yyss = yyss1; yyvs = yyvs1;
1140 #else /* no yyoverflow */
1141 /* Extend the stack our own way. */
1142 if (yystacksize >= YYMAXDEPTH)
1144 yyerror("parser stack overflow");
1156 if (yystacksize > YYMAXDEPTH)
1157 yystacksize = YYMAXDEPTH;
1158 #ifndef YYSTACK_USE_ALLOCA
1161 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
1162 __yy_memcpy ((char *)yyss, (char *)yyss1,
1163 size * (unsigned int) sizeof (*yyssp));
1164 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
1165 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
1166 size * (unsigned int) sizeof (*yyvsp));
1168 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
1169 __yy_memcpy ((char *)yyls, (char *)yyls1,
1170 size * (unsigned int) sizeof (*yylsp));
1172 #endif /* no yyoverflow */
1174 yyssp = yyss + size - 1;
1175 yyvsp = yyvs + size - 1;
1177 yylsp = yyls + size - 1;
1182 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
1185 if (yyssp >= yyss + yystacksize - 1)
1191 fprintf(stderr, "Entering state %d\n", yystate);
1197 /* Do appropriate processing given the current state. */
1198 /* Read a lookahead token if we need one and don't already have one. */
1201 /* First try to decide what to do without reference to lookahead token. */
1203 yyn = yypact[yystate];
1207 /* Not known => get a lookahead token if don't already have one. */
1209 /* yychar is either YYEMPTY or YYEOF
1210 or a valid token in external form. */
1212 if (yychar == YYEMPTY)
1216 fprintf(stderr, "Reading a token: ");
1221 /* Convert token to internal form (in yychar1) for indexing tables with */
1223 if (yychar <= 0) /* This means end of input. */
1226 yychar = YYEOF; /* Don't call YYLEX any more */
1230 fprintf(stderr, "Now at end of input.\n");
1235 yychar1 = YYTRANSLATE(yychar);
1240 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
1241 /* Give the individual parser a way to print the precise meaning
1242 of a token, for further debugging info. */
1244 YYPRINT (stderr, yychar, yylval);
1246 fprintf (stderr, ")\n");
1252 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
1257 /* yyn is what to do for this token type in this state.
1258 Negative => reduce, -yyn is rule number.
1259 Positive => shift, yyn is new state.
1260 New state is final state => don't bother to shift,
1261 just return success.
1262 0, or most negative number => error. */
1277 /* Shift the lookahead token. */
1281 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
1284 /* Discard the token being shifted unless it is eof. */
1285 if (yychar != YYEOF)
1293 /* count tokens shifted since error; after three, turn off error status. */
1294 if (yyerrstatus) yyerrstatus--;
1299 /* Do the default action for the current state. */
1302 yyn = yydefact[yystate];
1306 /* Do a reduction. yyn is the number of a rule to reduce with. */
1310 yyval = yyvsp[1-yylen]; /* implement default value of the action */
1317 fprintf (stderr, "Reducing via rule %d (line %d), ",
1320 /* Print the symbols being reduced, and their result. */
1321 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
1322 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
1323 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1331 #line 433 "llvmAsmParser.y"
1333 if (yyvsp[0].UIntVal > (uint32_t)INT32_MAX) // Outside of my range!
1334 ThrowException("Value too large for type!");
1335 yyval.SIntVal = (int32_t)yyvsp[0].UIntVal;
1339 #line 441 "llvmAsmParser.y"
1341 if (yyvsp[0].UInt64Val > (uint64_t)INT64_MAX) // Outside of my range!
1342 ThrowException("Value too large for type!");
1343 yyval.SInt64Val = (int64_t)yyvsp[0].UInt64Val;
1347 #line 471 "llvmAsmParser.y"
1349 yyval.StrVal = yyvsp[-1].StrVal;
1353 #line 474 "llvmAsmParser.y"
1359 #line 478 "llvmAsmParser.y"
1360 { // integral constants
1361 if (!ConstPoolSInt::isValueValidForType(yyvsp[-1].TypeVal, yyvsp[0].SInt64Val))
1362 ThrowException("Constant value doesn't fit in type!");
1363 yyval.ConstVal = new ConstPoolSInt(yyvsp[-1].TypeVal, yyvsp[0].SInt64Val);
1367 #line 483 "llvmAsmParser.y"
1368 { // integral constants
1369 if (!ConstPoolUInt::isValueValidForType(yyvsp[-1].TypeVal, yyvsp[0].UInt64Val))
1370 ThrowException("Constant value doesn't fit in type!");
1371 yyval.ConstVal = new ConstPoolUInt(yyvsp[-1].TypeVal, yyvsp[0].UInt64Val);
1375 #line 488 "llvmAsmParser.y"
1376 { // Boolean constants
1377 yyval.ConstVal = new ConstPoolBool(true);
1381 #line 491 "llvmAsmParser.y"
1382 { // Boolean constants
1383 yyval.ConstVal = new ConstPoolBool(false);
1387 #line 494 "llvmAsmParser.y"
1388 { // String constants
1389 cerr << "FIXME: TODO: String constants [sbyte] not implemented yet!\n";
1391 //$$ = new ConstPoolString($2);
1392 free(yyvsp[0].StrVal);
1396 #line 500 "llvmAsmParser.y"
1398 yyval.ConstVal = new ConstPoolType(yyvsp[0].TypeVal);
1402 #line 503 "llvmAsmParser.y"
1403 { // Nonempty array constant
1404 // Verify all elements are correct type!
1405 const ArrayType *AT = ArrayType::getArrayType(yyvsp[-4].TypeVal);
1406 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
1407 if (yyvsp[-4].TypeVal != (*yyvsp[-1].ConstVector)[i]->getType())
1408 ThrowException("Element #" + utostr(i) + " is not of type '" +
1409 yyvsp[-4].TypeVal->getName() + "' as required!\nIt is of type '" +
1410 (*yyvsp[-1].ConstVector)[i]->getType()->getName() + "'.");
1413 yyval.ConstVal = new ConstPoolArray(AT, *yyvsp[-1].ConstVector);
1414 delete yyvsp[-1].ConstVector;
1418 #line 516 "llvmAsmParser.y"
1419 { // Empty array constant
1420 vector<ConstPoolVal*> Empty;
1421 yyval.ConstVal = new ConstPoolArray(ArrayType::getArrayType(yyvsp[-3].TypeVal), Empty);
1425 #line 520 "llvmAsmParser.y"
1427 // Verify all elements are correct type!
1428 const ArrayType *AT = ArrayType::getArrayType(yyvsp[-4].TypeVal, (int)yyvsp[-6].UInt64Val);
1429 if (yyvsp[-6].UInt64Val != yyvsp[-1].ConstVector->size())
1430 ThrowException("Type mismatch: constant sized array initialized with " +
1431 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
1432 itostr((int)yyvsp[-6].UInt64Val) + "!");
1434 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
1435 if (yyvsp[-4].TypeVal != (*yyvsp[-1].ConstVector)[i]->getType())
1436 ThrowException("Element #" + utostr(i) + " is not of type '" +
1437 yyvsp[-4].TypeVal->getName() + "' as required!\nIt is of type '" +
1438 (*yyvsp[-1].ConstVector)[i]->getType()->getName() + "'.");
1441 yyval.ConstVal = new ConstPoolArray(AT, *yyvsp[-1].ConstVector);
1442 delete yyvsp[-1].ConstVector;
1446 #line 538 "llvmAsmParser.y"
1448 if (yyvsp[-5].UInt64Val != 0)
1449 ThrowException("Type mismatch: constant sized array initialized with 0"
1450 " arguments, but has size of " + itostr((int)yyvsp[-5].UInt64Val) + "!");
1451 vector<ConstPoolVal*> Empty;
1452 yyval.ConstVal = new ConstPoolArray(ArrayType::getArrayType(yyvsp[-3].TypeVal, 0), Empty);
1456 #line 545 "llvmAsmParser.y"
1458 StructType::ElementTypes Types(yyvsp[-4].TypeList->begin(), yyvsp[-4].TypeList->end());
1459 delete yyvsp[-4].TypeList;
1461 const StructType *St = StructType::getStructType(Types);
1462 yyval.ConstVal = new ConstPoolStruct(St, *yyvsp[-1].ConstVector);
1463 delete yyvsp[-1].ConstVector;
1467 #line 553 "llvmAsmParser.y"
1469 const StructType *St =
1470 StructType::getStructType(StructType::ElementTypes());
1471 vector<ConstPoolVal*> Empty;
1472 yyval.ConstVal = new ConstPoolStruct(St, Empty);
1476 #line 567 "llvmAsmParser.y"
1478 (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(addConstValToConstantPool(yyvsp[0].ConstVal));
1482 #line 570 "llvmAsmParser.y"
1484 yyval.ConstVector = new vector<ConstPoolVal*>();
1485 yyval.ConstVector->push_back(addConstValToConstantPool(yyvsp[0].ConstVal));
1489 #line 576 "llvmAsmParser.y"
1491 if (yyvsp[-1].StrVal) {
1492 yyvsp[0].ConstVal->setName(yyvsp[-1].StrVal);
1493 free(yyvsp[-1].StrVal);
1496 addConstValToConstantPool(yyvsp[0].ConstVal);
1500 #line 584 "llvmAsmParser.y"
1505 #line 595 "llvmAsmParser.y"
1507 yyval.ModuleVal = ParserResult = yyvsp[0].ModuleVal;
1508 CurModule.ModuleDone();
1512 #line 600 "llvmAsmParser.y"
1514 yyvsp[-1].ModuleVal->getMethodList().push_back(yyvsp[0].MethodVal);
1515 CurMeth.MethodDone();
1516 yyval.ModuleVal = yyvsp[-1].ModuleVal;
1520 #line 605 "llvmAsmParser.y"
1522 yyval.ModuleVal = CurModule.CurrentModule;
1526 #line 614 "llvmAsmParser.y"
1527 { yyval.StrVal = 0; ;
1530 #line 616 "llvmAsmParser.y"
1532 yyval.MethArgVal = new MethodArgument(yyvsp[-1].TypeVal);
1533 if (yyvsp[0].StrVal) { // Was the argument named?
1534 yyval.MethArgVal->setName(yyvsp[0].StrVal);
1535 free(yyvsp[0].StrVal); // The string was strdup'd, so free it now.
1540 #line 624 "llvmAsmParser.y"
1542 yyval.MethodArgList = yyvsp[0].MethodArgList;
1543 yyvsp[0].MethodArgList->push_front(yyvsp[-2].MethArgVal);
1547 #line 628 "llvmAsmParser.y"
1549 yyval.MethodArgList = new list<MethodArgument*>();
1550 yyval.MethodArgList->push_front(yyvsp[0].MethArgVal);
1554 #line 633 "llvmAsmParser.y"
1556 yyval.MethodArgList = yyvsp[0].MethodArgList;
1560 #line 636 "llvmAsmParser.y"
1562 yyval.MethodArgList = 0;
1566 #line 640 "llvmAsmParser.y"
1568 MethodType::ParamTypes ParamTypeList;
1569 if (yyvsp[-1].MethodArgList)
1570 for (list<MethodArgument*>::iterator I = yyvsp[-1].MethodArgList->begin(); I != yyvsp[-1].MethodArgList->end(); ++I)
1571 ParamTypeList.push_back((*I)->getType());
1573 const MethodType *MT = MethodType::getMethodType(yyvsp[-4].TypeVal, ParamTypeList);
1575 Method *M = new Method(MT, yyvsp[-3].StrVal);
1576 free(yyvsp[-3].StrVal); // Free strdup'd memory!
1578 InsertValue(M, CurModule.Values);
1580 CurMeth.MethodStart(M);
1582 // Add all of the arguments we parsed to the method...
1583 if (yyvsp[-1].MethodArgList) { // Is null if empty...
1584 Method::ArgumentListType &ArgList = M->getArgumentList();
1586 for (list<MethodArgument*>::iterator I = yyvsp[-1].MethodArgList->begin(); I != yyvsp[-1].MethodArgList->end(); ++I) {
1588 ArgList.push_back(*I);
1590 delete yyvsp[-1].MethodArgList; // We're now done with the argument list
1595 #line 667 "llvmAsmParser.y"
1597 yyval.MethodVal = CurMeth.CurrentMethod;
1601 #line 671 "llvmAsmParser.y"
1603 yyval.MethodVal = yyvsp[-1].MethodVal;
1607 #line 680 "llvmAsmParser.y"
1608 { // A reference to a direct constant
1609 yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val);
1613 #line 683 "llvmAsmParser.y"
1615 yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val);
1619 #line 686 "llvmAsmParser.y"
1621 yyval.ValIDVal = ValID::create((int64_t)1);
1625 #line 689 "llvmAsmParser.y"
1627 yyval.ValIDVal = ValID::create((int64_t)0);
1631 #line 692 "llvmAsmParser.y"
1632 { // Quoted strings work too... especially for methods
1633 yyval.ValIDVal = ValID::create_conststr(yyvsp[0].StrVal);
1637 #line 697 "llvmAsmParser.y"
1638 { // Is it an integer reference...?
1639 yyval.ValIDVal = ValID::create(yyvsp[0].SIntVal);
1643 #line 700 "llvmAsmParser.y"
1644 { // It must be a named reference then...
1645 yyval.ValIDVal = ValID::create(yyvsp[0].StrVal);
1649 #line 703 "llvmAsmParser.y"
1651 yyval.ValIDVal = yyvsp[0].ValIDVal;
1655 #line 710 "llvmAsmParser.y"
1657 Value *D = getVal(Type::TypeTy, yyvsp[0].ValIDVal, true);
1658 if (D == 0) ThrowException("Invalid user defined type: " + yyvsp[0].ValIDVal.getName());
1660 // User defined type not in const pool!
1661 ConstPoolType *CPT = (ConstPoolType*)D->castConstantAsserting();
1662 yyval.TypeVal = CPT->getValue();
1666 #line 718 "llvmAsmParser.y"
1667 { // Method derived type?
1668 MethodType::ParamTypes Params(yyvsp[-1].TypeList->begin(), yyvsp[-1].TypeList->end());
1669 delete yyvsp[-1].TypeList;
1670 yyval.TypeVal = MethodType::getMethodType(yyvsp[-3].TypeVal, Params);
1674 #line 723 "llvmAsmParser.y"
1675 { // Method derived type?
1676 MethodType::ParamTypes Params; // Empty list
1677 yyval.TypeVal = MethodType::getMethodType(yyvsp[-2].TypeVal, Params);
1681 #line 727 "llvmAsmParser.y"
1683 yyval.TypeVal = ArrayType::getArrayType(yyvsp[-1].TypeVal);
1687 #line 730 "llvmAsmParser.y"
1689 yyval.TypeVal = ArrayType::getArrayType(yyvsp[-1].TypeVal, (int)yyvsp[-3].UInt64Val);
1693 #line 733 "llvmAsmParser.y"
1695 StructType::ElementTypes Elements(yyvsp[-1].TypeList->begin(), yyvsp[-1].TypeList->end());
1696 delete yyvsp[-1].TypeList;
1697 yyval.TypeVal = StructType::getStructType(Elements);
1701 #line 738 "llvmAsmParser.y"
1703 yyval.TypeVal = StructType::getStructType(StructType::ElementTypes());
1707 #line 741 "llvmAsmParser.y"
1709 yyval.TypeVal = PointerType::getPointerType(yyvsp[-1].TypeVal);
1713 #line 746 "llvmAsmParser.y"
1715 yyval.TypeList = new list<const Type*>();
1716 yyval.TypeList->push_back(yyvsp[0].TypeVal);
1720 #line 750 "llvmAsmParser.y"
1722 (yyval.TypeList=yyvsp[-2].TypeList)->push_back(yyvsp[0].TypeVal);
1726 #line 755 "llvmAsmParser.y"
1728 yyvsp[-1].MethodVal->getBasicBlocks().push_back(yyvsp[0].BasicBlockVal);
1729 yyval.MethodVal = yyvsp[-1].MethodVal;
1733 #line 759 "llvmAsmParser.y"
1734 { // Do not allow methods with 0 basic blocks
1735 yyval.MethodVal = yyvsp[-1].MethodVal; // in them...
1736 yyvsp[-1].MethodVal->getBasicBlocks().push_back(yyvsp[0].BasicBlockVal);
1740 #line 768 "llvmAsmParser.y"
1742 yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal);
1743 InsertValue(yyvsp[-1].BasicBlockVal);
1744 yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
1748 #line 773 "llvmAsmParser.y"
1750 yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal);
1751 yyvsp[-1].BasicBlockVal->setName(yyvsp[-2].StrVal);
1752 free(yyvsp[-2].StrVal); // Free the strdup'd memory...
1754 InsertValue(yyvsp[-1].BasicBlockVal);
1755 yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
1759 #line 782 "llvmAsmParser.y"
1761 yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal);
1762 yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
1766 #line 786 "llvmAsmParser.y"
1768 yyval.BasicBlockVal = new BasicBlock();
1772 #line 790 "llvmAsmParser.y"
1773 { // Return with a result...
1774 yyval.TermInstVal = new ReturnInst(getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal));
1778 #line 793 "llvmAsmParser.y"
1779 { // Return with no result...
1780 yyval.TermInstVal = new ReturnInst();
1784 #line 796 "llvmAsmParser.y"
1785 { // Unconditional Branch...
1786 yyval.TermInstVal = new BranchInst((BasicBlock*)getVal(Type::LabelTy, yyvsp[0].ValIDVal));
1790 #line 799 "llvmAsmParser.y"
1792 yyval.TermInstVal = new BranchInst((BasicBlock*)getVal(Type::LabelTy, yyvsp[-3].ValIDVal),
1793 (BasicBlock*)getVal(Type::LabelTy, yyvsp[0].ValIDVal),
1794 getVal(Type::BoolTy, yyvsp[-6].ValIDVal));
1798 #line 804 "llvmAsmParser.y"
1800 SwitchInst *S = new SwitchInst(getVal(yyvsp[-7].TypeVal, yyvsp[-6].ValIDVal),
1801 (BasicBlock*)getVal(Type::LabelTy, yyvsp[-3].ValIDVal));
1802 yyval.TermInstVal = S;
1804 list<pair<ConstPoolVal*, BasicBlock*> >::iterator I = yyvsp[-1].JumpTable->begin(),
1805 end = yyvsp[-1].JumpTable->end();
1806 for (; I != end; ++I)
1807 S->dest_push_back(I->first, I->second);
1811 #line 815 "llvmAsmParser.y"
1813 yyval.JumpTable = yyvsp[-5].JumpTable;
1814 ConstPoolVal *V = (ConstPoolVal*)getVal(yyvsp[-4].TypeVal, yyvsp[-3].ValIDVal, true);
1816 ThrowException("May only switch on a constant pool value!");
1818 yyval.JumpTable->push_back(make_pair(V, (BasicBlock*)getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal)));
1822 #line 823 "llvmAsmParser.y"
1824 yyval.JumpTable = new list<pair<ConstPoolVal*, BasicBlock*> >();
1825 ConstPoolVal *V = (ConstPoolVal*)getVal(yyvsp[-4].TypeVal, yyvsp[-3].ValIDVal, true);
1828 ThrowException("May only switch on a constant pool value!");
1830 yyval.JumpTable->push_back(make_pair(V, (BasicBlock*)getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal)));
1834 #line 833 "llvmAsmParser.y"
1836 if (yyvsp[-1].StrVal) // Is this definition named??
1837 yyvsp[0].InstVal->setName(yyvsp[-1].StrVal); // if so, assign the name...
1839 InsertValue(yyvsp[0].InstVal);
1840 yyval.InstVal = yyvsp[0].InstVal;
1844 #line 841 "llvmAsmParser.y"
1845 { // Used for PHI nodes
1846 yyval.PHIList = new list<pair<Value*, BasicBlock*> >();
1847 yyval.PHIList->push_back(make_pair(getVal(yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal),
1848 (BasicBlock*)getVal(Type::LabelTy, yyvsp[-1].ValIDVal)));
1852 #line 846 "llvmAsmParser.y"
1854 yyval.PHIList = yyvsp[-6].PHIList;
1855 yyvsp[-6].PHIList->push_back(make_pair(getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal),
1856 (BasicBlock*)getVal(Type::LabelTy, yyvsp[-1].ValIDVal)));
1860 #line 853 "llvmAsmParser.y"
1861 { // Used for call statements...
1862 yyval.ValueList = new list<Value*>();
1863 yyval.ValueList->push_back(getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal));
1867 #line 857 "llvmAsmParser.y"
1869 yyval.ValueList = yyvsp[-2].ValueList;
1870 yyvsp[-2].ValueList->push_back(getVal(yyvsp[-2].ValueList->front()->getType(), yyvsp[0].ValIDVal));
1874 #line 863 "llvmAsmParser.y"
1875 { yyval.ValueList = 0; ;
1878 #line 865 "llvmAsmParser.y"
1880 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, getVal(yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal), getVal(yyvsp[-3].TypeVal, yyvsp[0].ValIDVal));
1881 if (yyval.InstVal == 0)
1882 ThrowException("binary operator returned null!");
1886 #line 870 "llvmAsmParser.y"
1888 yyval.InstVal = UnaryOperator::create(yyvsp[-2].UnaryOpVal, getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal));
1889 if (yyval.InstVal == 0)
1890 ThrowException("unary operator returned null!");
1894 #line 875 "llvmAsmParser.y"
1896 yyval.InstVal = new CastInst(getVal(yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal), yyvsp[0].TypeVal);
1900 #line 878 "llvmAsmParser.y"
1902 const Type *Ty = yyvsp[0].PHIList->front().first->getType();
1903 yyval.InstVal = new PHINode(Ty);
1904 while (yyvsp[0].PHIList->begin() != yyvsp[0].PHIList->end()) {
1905 if (yyvsp[0].PHIList->front().first->getType() != Ty)
1906 ThrowException("All elements of a PHI node must be of the same type!");
1907 ((PHINode*)yyval.InstVal)->addIncoming(yyvsp[0].PHIList->front().first, yyvsp[0].PHIList->front().second);
1908 yyvsp[0].PHIList->pop_front();
1910 delete yyvsp[0].PHIList; // Free the list...
1914 #line 889 "llvmAsmParser.y"
1916 if (!yyvsp[-4].TypeVal->isMethodType())
1917 ThrowException("Can only call methods: invalid type '" +
1918 yyvsp[-4].TypeVal->getName() + "'!");
1920 const MethodType *Ty = (const MethodType*)yyvsp[-4].TypeVal;
1922 Value *V = getVal(Ty, yyvsp[-3].ValIDVal);
1923 if (!V->isMethod() || V->getType() != Ty)
1924 ThrowException("Cannot call: " + yyvsp[-3].ValIDVal.getName() + "!");
1926 // Create or access a new type that corresponds to the function call...
1927 vector<Value *> Params;
1929 if (yyvsp[-1].ValueList) {
1930 // Pull out just the arguments...
1931 Params.insert(Params.begin(), yyvsp[-1].ValueList->begin(), yyvsp[-1].ValueList->end());
1932 delete yyvsp[-1].ValueList;
1934 // Loop through MethodType's arguments and ensure they are specified
1937 MethodType::ParamTypes::const_iterator I = Ty->getParamTypes().begin();
1939 for (i = 0; i < Params.size() && I != Ty->getParamTypes().end(); ++i,++I){
1940 if (Params[i]->getType() != *I)
1941 ThrowException("Parameter " + utostr(i) + " is not of type '" +
1942 (*I)->getName() + "'!");
1945 if (i != Params.size() || I != Ty->getParamTypes().end())
1946 ThrowException("Invalid number of parameters detected!");
1949 // Create the call node...
1950 yyval.InstVal = new CallInst((Method*)V, Params);
1954 #line 926 "llvmAsmParser.y"
1956 yyval.InstVal = yyvsp[0].InstVal;
1960 #line 930 "llvmAsmParser.y"
1962 const Type *Ty = PointerType::getPointerType(yyvsp[0].TypeVal);
1963 addConstValToConstantPool(new ConstPoolType(Ty));
1964 yyval.InstVal = new MallocInst(Ty);
1968 #line 935 "llvmAsmParser.y"
1970 if (!yyvsp[-3].TypeVal->isArrayType() || ((const ArrayType*)yyvsp[-3].TypeVal)->isSized())
1971 ThrowException("Trying to allocate " + yyvsp[-3].TypeVal->getName() +
1972 " as unsized array!");
1973 const Type *Ty = PointerType::getPointerType(yyvsp[-3].TypeVal);
1974 addConstValToConstantPool(new ConstPoolType(Ty));
1975 Value *ArrSize = getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal);
1976 yyval.InstVal = new MallocInst(Ty, ArrSize);
1980 #line 944 "llvmAsmParser.y"
1982 const Type *Ty = PointerType::getPointerType(yyvsp[0].TypeVal);
1983 addConstValToConstantPool(new ConstPoolType(Ty));
1984 yyval.InstVal = new AllocaInst(Ty);
1988 #line 949 "llvmAsmParser.y"
1990 if (!yyvsp[-3].TypeVal->isArrayType() || ((const ArrayType*)yyvsp[-3].TypeVal)->isSized())
1991 ThrowException("Trying to allocate " + yyvsp[-3].TypeVal->getName() +
1992 " as unsized array!");
1993 const Type *Ty = PointerType::getPointerType(yyvsp[-3].TypeVal);
1994 addConstValToConstantPool(new ConstPoolType(Ty));
1995 Value *ArrSize = getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal);
1996 yyval.InstVal = new AllocaInst(Ty, ArrSize);
2000 #line 958 "llvmAsmParser.y"
2002 if (!yyvsp[-1].TypeVal->isPointerType())
2003 ThrowException("Trying to free nonpointer type " + yyvsp[-1].TypeVal->getName() + "!");
2004 yyval.InstVal = new FreeInst(getVal(yyvsp[-1].TypeVal, yyvsp[0].ValIDVal));
2008 /* the action file gets copied in in place of this dollarsign */
2009 #line 543 "/usr/dcs/software/supported/encap/bison-1.28/share/bison.simple"
2020 short *ssp1 = yyss - 1;
2021 fprintf (stderr, "state stack now");
2022 while (ssp1 != yyssp)
2023 fprintf (stderr, " %d", *++ssp1);
2024 fprintf (stderr, "\n");
2034 yylsp->first_line = yylloc.first_line;
2035 yylsp->first_column = yylloc.first_column;
2036 yylsp->last_line = (yylsp-1)->last_line;
2037 yylsp->last_column = (yylsp-1)->last_column;
2042 yylsp->last_line = (yylsp+yylen-1)->last_line;
2043 yylsp->last_column = (yylsp+yylen-1)->last_column;
2047 /* Now "shift" the result of the reduction.
2048 Determine what state that goes to,
2049 based on the state we popped back to
2050 and the rule number reduced by. */
2054 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
2055 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2056 yystate = yytable[yystate];
2058 yystate = yydefgoto[yyn - YYNTBASE];
2062 yyerrlab: /* here on detecting error */
2065 /* If not already recovering from an error, report this error. */
2069 #ifdef YYERROR_VERBOSE
2070 yyn = yypact[yystate];
2072 if (yyn > YYFLAG && yyn < YYLAST)
2079 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
2080 for (x = (yyn < 0 ? -yyn : 0);
2081 x < (sizeof(yytname) / sizeof(char *)); x++)
2082 if (yycheck[x + yyn] == x)
2083 size += strlen(yytname[x]) + 15, count++;
2084 msg = (char *) malloc(size + 15);
2087 strcpy(msg, "parse error");
2092 for (x = (yyn < 0 ? -yyn : 0);
2093 x < (sizeof(yytname) / sizeof(char *)); x++)
2094 if (yycheck[x + yyn] == x)
2096 strcat(msg, count == 0 ? ", expecting `" : " or `");
2097 strcat(msg, yytname[x]);
2106 yyerror ("parse error; also virtual memory exceeded");
2109 #endif /* YYERROR_VERBOSE */
2110 yyerror("parse error");
2114 yyerrlab1: /* here on error raised explicitly by an action */
2116 if (yyerrstatus == 3)
2118 /* if just tried and failed to reuse lookahead token after an error, discard it. */
2120 /* return failure if at end of input */
2121 if (yychar == YYEOF)
2126 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
2132 /* Else will try to reuse lookahead token
2133 after shifting the error token. */
2135 yyerrstatus = 3; /* Each real token shifted decrements this */
2139 yyerrdefault: /* current state does not do anything special for the error token. */
2142 /* This is wrong; only states that explicitly want error tokens
2143 should shift them. */
2144 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
2145 if (yyn) goto yydefault;
2148 yyerrpop: /* pop the current state because it cannot handle the error token */
2150 if (yyssp == yyss) YYABORT;
2160 short *ssp1 = yyss - 1;
2161 fprintf (stderr, "Error: state stack now");
2162 while (ssp1 != yyssp)
2163 fprintf (stderr, " %d", *++ssp1);
2164 fprintf (stderr, "\n");
2170 yyn = yypact[yystate];
2175 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
2194 fprintf(stderr, "Shifting error token, ");
2206 /* YYACCEPT comes here. */
2218 /* YYABORT comes here. */
2229 #line 964 "llvmAsmParser.y"
2231 int yyerror(const char *ErrorMsg) {
2232 ThrowException(string("Parse error: ") + ErrorMsg);