blob: 3d09b362ff211cf55530464a20c41f2cd5cb297b [file] [log] [blame]
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001/* A Bison parser, made by GNU Bison 2.3. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003/* Skeleton implementation for Bison's Yacc-like parsers in C
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007
Anton Korobeynikov66e28652007-11-14 09:53:48 +00008 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
22
23/* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
32
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
35
36/* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
38
39/* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
45
46/* Identify Bison output. */
47#define YYBISON 1
48
49/* Bison version. */
50#define YYBISON_VERSION "2.3"
51
52/* Skeleton name. */
53#define YYSKELETON_NAME "yacc.c"
54
55/* Pure parsers. */
56#define YYPURE 0
57
58/* Using locations. */
59#define YYLSP_NEEDED 0
60
61/* Substitute the variable and function names. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +000062#define yyparse llvmAsmparse
Anton Korobeynikov66e28652007-11-14 09:53:48 +000063#define yylex llvmAsmlex
Dan Gohmanf17a25c2007-07-18 16:29:46 +000064#define yyerror llvmAsmerror
Anton Korobeynikov66e28652007-11-14 09:53:48 +000065#define yylval llvmAsmlval
66#define yychar llvmAsmchar
Dan Gohmanf17a25c2007-07-18 16:29:46 +000067#define yydebug llvmAsmdebug
68#define yynerrs llvmAsmnerrs
Dan Gohmanf17a25c2007-07-18 16:29:46 +000069
Anton Korobeynikov66e28652007-11-14 09:53:48 +000070
71/* Tokens. */
72#ifndef YYTOKENTYPE
73# define YYTOKENTYPE
74 /* Put the tokens into the symbol table, so that GDB and other debuggers
75 know about them. */
76 enum yytokentype {
77 ESINT64VAL = 258,
78 EUINT64VAL = 259,
79 ESAPINTVAL = 260,
80 EUAPINTVAL = 261,
81 LOCALVAL_ID = 262,
82 GLOBALVAL_ID = 263,
83 FPVAL = 264,
84 VOID = 265,
85 INTTYPE = 266,
86 FLOAT = 267,
87 DOUBLE = 268,
88 X86_FP80 = 269,
89 FP128 = 270,
90 PPC_FP128 = 271,
91 LABEL = 272,
92 TYPE = 273,
93 LOCALVAR = 274,
94 GLOBALVAR = 275,
95 LABELSTR = 276,
96 STRINGCONSTANT = 277,
97 ATSTRINGCONSTANT = 278,
98 PCTSTRINGCONSTANT = 279,
99 ZEROINITIALIZER = 280,
100 TRUETOK = 281,
101 FALSETOK = 282,
102 BEGINTOK = 283,
103 ENDTOK = 284,
104 DECLARE = 285,
105 DEFINE = 286,
106 GLOBAL = 287,
107 CONSTANT = 288,
108 SECTION = 289,
109 ALIAS = 290,
110 VOLATILE = 291,
111 THREAD_LOCAL = 292,
112 TO = 293,
113 DOTDOTDOT = 294,
114 NULL_TOK = 295,
115 UNDEF = 296,
116 INTERNAL = 297,
117 LINKONCE = 298,
118 WEAK = 299,
119 APPENDING = 300,
120 DLLIMPORT = 301,
121 DLLEXPORT = 302,
122 EXTERN_WEAK = 303,
123 OPAQUE = 304,
124 EXTERNAL = 305,
125 TARGET = 306,
126 TRIPLE = 307,
127 ALIGN = 308,
128 DEPLIBS = 309,
129 CALL = 310,
130 TAIL = 311,
131 ASM_TOK = 312,
132 MODULE = 313,
133 SIDEEFFECT = 314,
134 CC_TOK = 315,
135 CCC_TOK = 316,
136 FASTCC_TOK = 317,
137 COLDCC_TOK = 318,
138 X86_STDCALLCC_TOK = 319,
139 X86_FASTCALLCC_TOK = 320,
140 DATALAYOUT = 321,
141 RET = 322,
142 BR = 323,
143 SWITCH = 324,
144 INVOKE = 325,
145 UNWIND = 326,
146 UNREACHABLE = 327,
147 ADD = 328,
148 SUB = 329,
149 MUL = 330,
150 UDIV = 331,
151 SDIV = 332,
152 FDIV = 333,
153 UREM = 334,
154 SREM = 335,
155 FREM = 336,
156 AND = 337,
157 OR = 338,
158 XOR = 339,
159 SHL = 340,
160 LSHR = 341,
161 ASHR = 342,
162 ICMP = 343,
163 FCMP = 344,
164 EQ = 345,
165 NE = 346,
166 SLT = 347,
167 SGT = 348,
168 SLE = 349,
169 SGE = 350,
170 ULT = 351,
171 UGT = 352,
172 ULE = 353,
173 UGE = 354,
174 OEQ = 355,
175 ONE = 356,
176 OLT = 357,
177 OGT = 358,
178 OLE = 359,
179 OGE = 360,
180 ORD = 361,
181 UNO = 362,
182 UEQ = 363,
183 UNE = 364,
184 MALLOC = 365,
185 ALLOCA = 366,
186 FREE = 367,
187 LOAD = 368,
188 STORE = 369,
189 GETELEMENTPTR = 370,
190 TRUNC = 371,
191 ZEXT = 372,
192 SEXT = 373,
193 FPTRUNC = 374,
194 FPEXT = 375,
195 BITCAST = 376,
196 UITOFP = 377,
197 SITOFP = 378,
198 FPTOUI = 379,
199 FPTOSI = 380,
200 INTTOPTR = 381,
201 PTRTOINT = 382,
202 PHI_TOK = 383,
203 SELECT = 384,
204 VAARG = 385,
205 EXTRACTELEMENT = 386,
206 INSERTELEMENT = 387,
207 SHUFFLEVECTOR = 388,
208 SIGNEXT = 389,
209 ZEROEXT = 390,
210 NORETURN = 391,
211 INREG = 392,
212 SRET = 393,
213 NOUNWIND = 394,
214 NOALIAS = 395,
215 BYVAL = 396,
216 NEST = 397,
Duncan Sandsf5588dc2007-11-27 13:23:08 +0000217 READNONE = 398,
218 READONLY = 399,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +0000219 GC = 400,
220 DEFAULT = 401,
221 HIDDEN = 402,
222 PROTECTED = 403
Anton Korobeynikov66e28652007-11-14 09:53:48 +0000223 };
224#endif
225/* Tokens. */
226#define ESINT64VAL 258
227#define EUINT64VAL 259
228#define ESAPINTVAL 260
229#define EUAPINTVAL 261
230#define LOCALVAL_ID 262
231#define GLOBALVAL_ID 263
232#define FPVAL 264
233#define VOID 265
234#define INTTYPE 266
235#define FLOAT 267
236#define DOUBLE 268
237#define X86_FP80 269
238#define FP128 270
239#define PPC_FP128 271
240#define LABEL 272
241#define TYPE 273
242#define LOCALVAR 274
243#define GLOBALVAR 275
244#define LABELSTR 276
245#define STRINGCONSTANT 277
246#define ATSTRINGCONSTANT 278
247#define PCTSTRINGCONSTANT 279
248#define ZEROINITIALIZER 280
249#define TRUETOK 281
250#define FALSETOK 282
251#define BEGINTOK 283
252#define ENDTOK 284
253#define DECLARE 285
254#define DEFINE 286
255#define GLOBAL 287
256#define CONSTANT 288
257#define SECTION 289
258#define ALIAS 290
259#define VOLATILE 291
260#define THREAD_LOCAL 292
261#define TO 293
262#define DOTDOTDOT 294
263#define NULL_TOK 295
264#define UNDEF 296
265#define INTERNAL 297
266#define LINKONCE 298
267#define WEAK 299
268#define APPENDING 300
269#define DLLIMPORT 301
270#define DLLEXPORT 302
271#define EXTERN_WEAK 303
272#define OPAQUE 304
273#define EXTERNAL 305
274#define TARGET 306
275#define TRIPLE 307
276#define ALIGN 308
277#define DEPLIBS 309
278#define CALL 310
279#define TAIL 311
280#define ASM_TOK 312
281#define MODULE 313
282#define SIDEEFFECT 314
283#define CC_TOK 315
284#define CCC_TOK 316
285#define FASTCC_TOK 317
286#define COLDCC_TOK 318
287#define X86_STDCALLCC_TOK 319
288#define X86_FASTCALLCC_TOK 320
289#define DATALAYOUT 321
290#define RET 322
291#define BR 323
292#define SWITCH 324
293#define INVOKE 325
294#define UNWIND 326
295#define UNREACHABLE 327
296#define ADD 328
297#define SUB 329
298#define MUL 330
299#define UDIV 331
300#define SDIV 332
301#define FDIV 333
302#define UREM 334
303#define SREM 335
304#define FREM 336
305#define AND 337
306#define OR 338
307#define XOR 339
308#define SHL 340
309#define LSHR 341
310#define ASHR 342
311#define ICMP 343
312#define FCMP 344
313#define EQ 345
314#define NE 346
315#define SLT 347
316#define SGT 348
317#define SLE 349
318#define SGE 350
319#define ULT 351
320#define UGT 352
321#define ULE 353
322#define UGE 354
323#define OEQ 355
324#define ONE 356
325#define OLT 357
326#define OGT 358
327#define OLE 359
328#define OGE 360
329#define ORD 361
330#define UNO 362
331#define UEQ 363
332#define UNE 364
333#define MALLOC 365
334#define ALLOCA 366
335#define FREE 367
336#define LOAD 368
337#define STORE 369
338#define GETELEMENTPTR 370
339#define TRUNC 371
340#define ZEXT 372
341#define SEXT 373
342#define FPTRUNC 374
343#define FPEXT 375
344#define BITCAST 376
345#define UITOFP 377
346#define SITOFP 378
347#define FPTOUI 379
348#define FPTOSI 380
349#define INTTOPTR 381
350#define PTRTOINT 382
351#define PHI_TOK 383
352#define SELECT 384
353#define VAARG 385
354#define EXTRACTELEMENT 386
355#define INSERTELEMENT 387
356#define SHUFFLEVECTOR 388
357#define SIGNEXT 389
358#define ZEROEXT 390
359#define NORETURN 391
360#define INREG 392
361#define SRET 393
362#define NOUNWIND 394
363#define NOALIAS 395
364#define BYVAL 396
365#define NEST 397
Duncan Sandsf5588dc2007-11-27 13:23:08 +0000366#define READNONE 398
367#define READONLY 399
Gordon Henriksen13fe5e32007-12-10 03:18:06 +0000368#define GC 400
369#define DEFAULT 401
370#define HIDDEN 402
371#define PROTECTED 403
Anton Korobeynikov66e28652007-11-14 09:53:48 +0000372
373
374
375
376/* Copy the first part of user declarations. */
Gordon Henriksen13fe5e32007-12-10 03:18:06 +0000377#line 14 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000378
379#include "ParserInternals.h"
380#include "llvm/CallingConv.h"
381#include "llvm/InlineAsm.h"
382#include "llvm/Instructions.h"
383#include "llvm/Module.h"
384#include "llvm/ValueSymbolTable.h"
Chandler Carruth563d4a42007-08-04 01:56:21 +0000385#include "llvm/AutoUpgrade.h"
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000386#include "llvm/Support/GetElementPtrTypeIterator.h"
387#include "llvm/Support/CommandLine.h"
388#include "llvm/ADT/SmallVector.h"
389#include "llvm/ADT/STLExtras.h"
390#include "llvm/Support/MathExtras.h"
391#include "llvm/Support/Streams.h"
392#include <algorithm>
393#include <list>
394#include <map>
395#include <utility>
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000396
397// The following is a gross hack. In order to rid the libAsmParser library of
398// exceptions, we have to have a way of getting the yyparse function to go into
399// an error situation. So, whenever we want an error to occur, the GenerateError
400// function (see bottom of file) sets TriggerError. Then, at the end of each
401// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
402// (a goto) to put YACC in error state. Furthermore, several calls to
403// GenerateError are made from inside productions and they must simulate the
404// previous exception behavior by exiting the production immediately. We have
405// replaced these with the GEN_ERROR macro which calls GeneratError and then
406// immediately invokes YYERROR. This would be so much cleaner if it was a
407// recursive descent parser.
408static bool TriggerError = false;
409#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
410#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
411
412int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
413int yylex(); // declaration" of xxx warnings.
414int yyparse();
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000415using namespace llvm;
416
417static Module *ParserResult;
418
419// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
420// relating to upreferences in the input stream.
421//
422//#define DEBUG_UPREFS 1
423#ifdef DEBUG_UPREFS
424#define UR_OUT(X) cerr << X
425#else
426#define UR_OUT(X)
427#endif
428
429#define YYERROR_VERBOSE 1
430
431static GlobalVariable *CurGV;
432
433
434// This contains info used when building the body of a function. It is
435// destroyed when the function is completed.
436//
437typedef std::vector<Value *> ValueList; // Numbered defs
438
439static void
440ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
441
442static struct PerModuleInfo {
443 Module *CurrentModule;
444 ValueList Values; // Module level numbered definitions
445 ValueList LateResolveValues;
446 std::vector<PATypeHolder> Types;
447 std::map<ValID, PATypeHolder> LateResolveTypes;
448
449 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
450 /// how they were referenced and on which line of the input they came from so
451 /// that we can resolve them later and print error messages as appropriate.
452 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
453
454 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
455 // references to global values. Global values may be referenced before they
456 // are defined, and if so, the temporary object that they represent is held
457 // here. This is used for forward references of GlobalValues.
458 //
459 typedef std::map<std::pair<const PointerType *,
460 ValID>, GlobalValue*> GlobalRefsType;
461 GlobalRefsType GlobalRefs;
462
463 void ModuleDone() {
464 // If we could not resolve some functions at function compilation time
465 // (calls to functions before they are defined), resolve them now... Types
466 // are resolved when the constant pool has been completely parsed.
467 //
468 ResolveDefinitions(LateResolveValues);
469 if (TriggerError)
470 return;
471
472 // Check to make sure that all global value forward references have been
473 // resolved!
474 //
475 if (!GlobalRefs.empty()) {
476 std::string UndefinedReferences = "Unresolved global references exist:\n";
477
478 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
479 I != E; ++I) {
480 UndefinedReferences += " " + I->first.first->getDescription() + " " +
481 I->first.second.getName() + "\n";
482 }
483 GenerateError(UndefinedReferences);
484 return;
485 }
486
Chandler Carruth563d4a42007-08-04 01:56:21 +0000487 // Look for intrinsic functions and CallInst that need to be upgraded
488 for (Module::iterator FI = CurrentModule->begin(),
489 FE = CurrentModule->end(); FI != FE; )
490 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
491
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000492 Values.clear(); // Clear out function local definitions
493 Types.clear();
494 CurrentModule = 0;
495 }
496
497 // GetForwardRefForGlobal - Check to see if there is a forward reference
498 // for this global. If so, remove it from the GlobalRefs map and return it.
499 // If not, just return null.
500 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
501 // Check to see if there is a forward reference to this global variable...
502 // if there is, eliminate it and patch the reference to use the new def'n.
503 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
504 GlobalValue *Ret = 0;
505 if (I != GlobalRefs.end()) {
506 Ret = I->second;
507 GlobalRefs.erase(I);
508 }
509 return Ret;
510 }
511
512 bool TypeIsUnresolved(PATypeHolder* PATy) {
513 // If it isn't abstract, its resolved
514 const Type* Ty = PATy->get();
515 if (!Ty->isAbstract())
516 return false;
517 // Traverse the type looking for abstract types. If it isn't abstract then
518 // we don't need to traverse that leg of the type.
519 std::vector<const Type*> WorkList, SeenList;
520 WorkList.push_back(Ty);
521 while (!WorkList.empty()) {
522 const Type* Ty = WorkList.back();
523 SeenList.push_back(Ty);
524 WorkList.pop_back();
525 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
526 // Check to see if this is an unresolved type
527 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
528 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
529 for ( ; I != E; ++I) {
530 if (I->second.get() == OpTy)
531 return true;
532 }
533 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
534 const Type* TheTy = SeqTy->getElementType();
535 if (TheTy->isAbstract() && TheTy != Ty) {
536 std::vector<const Type*>::iterator I = SeenList.begin(),
537 E = SeenList.end();
538 for ( ; I != E; ++I)
539 if (*I == TheTy)
540 break;
541 if (I == E)
542 WorkList.push_back(TheTy);
543 }
544 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
545 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
546 const Type* TheTy = StrTy->getElementType(i);
547 if (TheTy->isAbstract() && TheTy != Ty) {
548 std::vector<const Type*>::iterator I = SeenList.begin(),
549 E = SeenList.end();
550 for ( ; I != E; ++I)
551 if (*I == TheTy)
552 break;
553 if (I == E)
554 WorkList.push_back(TheTy);
555 }
556 }
557 }
558 }
559 return false;
560 }
561} CurModule;
562
563static struct PerFunctionInfo {
564 Function *CurrentFunction; // Pointer to current function being created
565
566 ValueList Values; // Keep track of #'d definitions
567 unsigned NextValNum;
568 ValueList LateResolveValues;
569 bool isDeclare; // Is this function a forward declararation?
570 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
571 GlobalValue::VisibilityTypes Visibility;
572
573 /// BBForwardRefs - When we see forward references to basic blocks, keep
574 /// track of them here.
575 std::map<ValID, BasicBlock*> BBForwardRefs;
576
577 inline PerFunctionInfo() {
578 CurrentFunction = 0;
579 isDeclare = false;
580 Linkage = GlobalValue::ExternalLinkage;
581 Visibility = GlobalValue::DefaultVisibility;
582 }
583
584 inline void FunctionStart(Function *M) {
585 CurrentFunction = M;
586 NextValNum = 0;
587 }
588
589 void FunctionDone() {
590 // Any forward referenced blocks left?
591 if (!BBForwardRefs.empty()) {
592 GenerateError("Undefined reference to label " +
593 BBForwardRefs.begin()->second->getName());
594 return;
595 }
596
597 // Resolve all forward references now.
598 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
599
600 Values.clear(); // Clear out function local definitions
601 BBForwardRefs.clear();
602 CurrentFunction = 0;
603 isDeclare = false;
604 Linkage = GlobalValue::ExternalLinkage;
605 Visibility = GlobalValue::DefaultVisibility;
606 }
607} CurFun; // Info for the current function...
608
609static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
610
611
612//===----------------------------------------------------------------------===//
613// Code to handle definitions of all the types
614//===----------------------------------------------------------------------===//
615
616static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
617 // Things that have names or are void typed don't get slot numbers
618 if (V->hasName() || (V->getType() == Type::VoidTy))
619 return;
620
621 // In the case of function values, we have to allow for the forward reference
622 // of basic blocks, which are included in the numbering. Consequently, we keep
623 // track of the next insertion location with NextValNum. When a BB gets
624 // inserted, it could change the size of the CurFun.Values vector.
625 if (&ValueTab == &CurFun.Values) {
626 if (ValueTab.size() <= CurFun.NextValNum)
627 ValueTab.resize(CurFun.NextValNum+1);
628 ValueTab[CurFun.NextValNum++] = V;
629 return;
630 }
631 // For all other lists, its okay to just tack it on the back of the vector.
632 ValueTab.push_back(V);
633}
634
635static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
636 switch (D.Type) {
637 case ValID::LocalID: // Is it a numbered definition?
638 // Module constants occupy the lowest numbered slots...
639 if (D.Num < CurModule.Types.size())
640 return CurModule.Types[D.Num];
641 break;
642 case ValID::LocalName: // Is it a named definition?
643 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
644 D.destroy(); // Free old strdup'd memory...
645 return N;
646 }
647 break;
648 default:
649 GenerateError("Internal parser error: Invalid symbol type reference");
650 return 0;
651 }
652
653 // If we reached here, we referenced either a symbol that we don't know about
654 // or an id number that hasn't been read yet. We may be referencing something
655 // forward, so just create an entry to be resolved later and get to it...
656 //
657 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
658
659
660 if (inFunctionScope()) {
661 if (D.Type == ValID::LocalName) {
662 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
663 return 0;
664 } else {
665 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
666 return 0;
667 }
668 }
669
670 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
671 if (I != CurModule.LateResolveTypes.end())
672 return I->second;
673
674 Type *Typ = OpaqueType::get();
675 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
676 return Typ;
677 }
678
679// getExistingVal - Look up the value specified by the provided type and
680// the provided ValID. If the value exists and has already been defined, return
681// it. Otherwise return null.
682//
683static Value *getExistingVal(const Type *Ty, const ValID &D) {
684 if (isa<FunctionType>(Ty)) {
685 GenerateError("Functions are not values and "
686 "must be referenced as pointers");
687 return 0;
688 }
689
690 switch (D.Type) {
691 case ValID::LocalID: { // Is it a numbered definition?
692 // Check that the number is within bounds.
693 if (D.Num >= CurFun.Values.size())
694 return 0;
695 Value *Result = CurFun.Values[D.Num];
696 if (Ty != Result->getType()) {
697 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
698 Result->getType()->getDescription() + "' does not match "
699 "expected type, '" + Ty->getDescription() + "'");
700 return 0;
701 }
702 return Result;
703 }
704 case ValID::GlobalID: { // Is it a numbered definition?
705 if (D.Num >= CurModule.Values.size())
706 return 0;
707 Value *Result = CurModule.Values[D.Num];
708 if (Ty != Result->getType()) {
709 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
710 Result->getType()->getDescription() + "' does not match "
711 "expected type, '" + Ty->getDescription() + "'");
712 return 0;
713 }
714 return Result;
715 }
716
717 case ValID::LocalName: { // Is it a named definition?
718 if (!inFunctionScope())
719 return 0;
720 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
721 Value *N = SymTab.lookup(D.getName());
722 if (N == 0)
723 return 0;
724 if (N->getType() != Ty)
725 return 0;
726
727 D.destroy(); // Free old strdup'd memory...
728 return N;
729 }
730 case ValID::GlobalName: { // Is it a named definition?
731 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
732 Value *N = SymTab.lookup(D.getName());
733 if (N == 0)
734 return 0;
735 if (N->getType() != Ty)
736 return 0;
737
738 D.destroy(); // Free old strdup'd memory...
739 return N;
740 }
741
742 // Check to make sure that "Ty" is an integral type, and that our
743 // value will fit into the specified type...
744 case ValID::ConstSIntVal: // Is it a constant pool reference??
745 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
746 GenerateError("Signed integral constant '" +
747 itostr(D.ConstPool64) + "' is invalid for type '" +
748 Ty->getDescription() + "'");
749 return 0;
750 }
751 return ConstantInt::get(Ty, D.ConstPool64, true);
752
753 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
754 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
755 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
756 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
757 "' is invalid or out of range");
758 return 0;
759 } else { // This is really a signed reference. Transmogrify.
760 return ConstantInt::get(Ty, D.ConstPool64, true);
761 }
762 } else {
763 return ConstantInt::get(Ty, D.UConstPool64);
764 }
765
766 case ValID::ConstFPVal: // Is it a floating point const pool reference?
Dale Johannesen3afee192007-09-07 21:07:57 +0000767 if (!ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000768 GenerateError("FP constant invalid for type");
769 return 0;
770 }
Dale Johannesen255b8fe2007-09-11 18:33:39 +0000771 // Lexer has no type info, so builds all float and double FP constants
772 // as double. Fix this here. Long double does not need this.
773 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
774 Ty==Type::FloatTy)
Dale Johannesen3afee192007-09-07 21:07:57 +0000775 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
776 return ConstantFP::get(Ty, *D.ConstPoolFP);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000777
778 case ValID::ConstNullVal: // Is it a null value?
779 if (!isa<PointerType>(Ty)) {
780 GenerateError("Cannot create a a non pointer null");
781 return 0;
782 }
783 return ConstantPointerNull::get(cast<PointerType>(Ty));
784
785 case ValID::ConstUndefVal: // Is it an undef value?
786 return UndefValue::get(Ty);
787
788 case ValID::ConstZeroVal: // Is it a zero value?
789 return Constant::getNullValue(Ty);
790
791 case ValID::ConstantVal: // Fully resolved constant?
792 if (D.ConstantValue->getType() != Ty) {
793 GenerateError("Constant expression type different from required type");
794 return 0;
795 }
796 return D.ConstantValue;
797
798 case ValID::InlineAsmVal: { // Inline asm expression
799 const PointerType *PTy = dyn_cast<PointerType>(Ty);
800 const FunctionType *FTy =
801 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
802 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
803 GenerateError("Invalid type for asm constraint string");
804 return 0;
805 }
806 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
807 D.IAD->HasSideEffects);
808 D.destroy(); // Free InlineAsmDescriptor.
809 return IA;
810 }
811 default:
812 assert(0 && "Unhandled case!");
813 return 0;
814 } // End of switch
815
816 assert(0 && "Unhandled case!");
817 return 0;
818}
819
820// getVal - This function is identical to getExistingVal, except that if a
821// value is not already defined, it "improvises" by creating a placeholder var
822// that looks and acts just like the requested variable. When the value is
823// defined later, all uses of the placeholder variable are replaced with the
824// real thing.
825//
826static Value *getVal(const Type *Ty, const ValID &ID) {
827 if (Ty == Type::LabelTy) {
828 GenerateError("Cannot use a basic block here");
829 return 0;
830 }
831
832 // See if the value has already been defined.
833 Value *V = getExistingVal(Ty, ID);
834 if (V) return V;
835 if (TriggerError) return 0;
836
837 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
838 GenerateError("Invalid use of a composite type");
839 return 0;
840 }
841
842 // If we reached here, we referenced either a symbol that we don't know about
843 // or an id number that hasn't been read yet. We may be referencing something
844 // forward, so just create an entry to be resolved later and get to it...
845 //
846 switch (ID.Type) {
847 case ValID::GlobalName:
848 case ValID::GlobalID: {
849 const PointerType *PTy = dyn_cast<PointerType>(Ty);
850 if (!PTy) {
851 GenerateError("Invalid type for reference to global" );
852 return 0;
853 }
854 const Type* ElTy = PTy->getElementType();
855 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
856 V = new Function(FTy, GlobalValue::ExternalLinkage);
857 else
858 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage);
859 break;
860 }
861 default:
862 V = new Argument(Ty);
863 }
864
865 // Remember where this forward reference came from. FIXME, shouldn't we try
866 // to recycle these things??
867 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
Duncan Sandsf5588dc2007-11-27 13:23:08 +0000868 LLLgetLineNo())));
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000869
870 if (inFunctionScope())
871 InsertValue(V, CurFun.LateResolveValues);
872 else
873 InsertValue(V, CurModule.LateResolveValues);
874 return V;
875}
876
877/// defineBBVal - This is a definition of a new basic block with the specified
878/// identifier which must be the same as CurFun.NextValNum, if its numeric.
879static BasicBlock *defineBBVal(const ValID &ID) {
880 assert(inFunctionScope() && "Can't get basic block at global scope!");
881
882 BasicBlock *BB = 0;
883
884 // First, see if this was forward referenced
885
886 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
887 if (BBI != CurFun.BBForwardRefs.end()) {
888 BB = BBI->second;
889 // The forward declaration could have been inserted anywhere in the
890 // function: insert it into the correct place now.
891 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
892 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
893
894 // We're about to erase the entry, save the key so we can clean it up.
895 ValID Tmp = BBI->first;
896
897 // Erase the forward ref from the map as its no longer "forward"
898 CurFun.BBForwardRefs.erase(ID);
899
900 // The key has been removed from the map but so we don't want to leave
901 // strdup'd memory around so destroy it too.
902 Tmp.destroy();
903
904 // If its a numbered definition, bump the number and set the BB value.
905 if (ID.Type == ValID::LocalID) {
906 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
907 InsertValue(BB);
908 }
909
910 ID.destroy();
911 return BB;
912 }
913
914 // We haven't seen this BB before and its first mention is a definition.
915 // Just create it and return it.
916 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
917 BB = new BasicBlock(Name, CurFun.CurrentFunction);
918 if (ID.Type == ValID::LocalID) {
919 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
920 InsertValue(BB);
921 }
922
923 ID.destroy(); // Free strdup'd memory
924 return BB;
925}
926
927/// getBBVal - get an existing BB value or create a forward reference for it.
928///
929static BasicBlock *getBBVal(const ValID &ID) {
930 assert(inFunctionScope() && "Can't get basic block at global scope!");
931
932 BasicBlock *BB = 0;
933
934 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
935 if (BBI != CurFun.BBForwardRefs.end()) {
936 BB = BBI->second;
937 } if (ID.Type == ValID::LocalName) {
938 std::string Name = ID.getName();
939 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
940 if (N)
941 if (N->getType()->getTypeID() == Type::LabelTyID)
942 BB = cast<BasicBlock>(N);
943 else
944 GenerateError("Reference to label '" + Name + "' is actually of type '"+
945 N->getType()->getDescription() + "'");
946 } else if (ID.Type == ValID::LocalID) {
947 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
948 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
949 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
950 else
951 GenerateError("Reference to label '%" + utostr(ID.Num) +
952 "' is actually of type '"+
953 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
954 }
955 } else {
956 GenerateError("Illegal label reference " + ID.getName());
957 return 0;
958 }
959
960 // If its already been defined, return it now.
961 if (BB) {
962 ID.destroy(); // Free strdup'd memory.
963 return BB;
964 }
965
966 // Otherwise, this block has not been seen before, create it.
967 std::string Name;
968 if (ID.Type == ValID::LocalName)
969 Name = ID.getName();
970 BB = new BasicBlock(Name, CurFun.CurrentFunction);
971
972 // Insert it in the forward refs map.
973 CurFun.BBForwardRefs[ID] = BB;
974
975 return BB;
976}
977
978
979//===----------------------------------------------------------------------===//
980// Code to handle forward references in instructions
981//===----------------------------------------------------------------------===//
982//
983// This code handles the late binding needed with statements that reference
984// values not defined yet... for example, a forward branch, or the PHI node for
985// a loop body.
986//
987// This keeps a table (CurFun.LateResolveValues) of all such forward references
988// and back patchs after we are done.
989//
990
991// ResolveDefinitions - If we could not resolve some defs at parsing
992// time (forward branches, phi functions for loops, etc...) resolve the
993// defs now...
994//
995static void
996ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
997 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
998 while (!LateResolvers.empty()) {
999 Value *V = LateResolvers.back();
1000 LateResolvers.pop_back();
1001
1002 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1003 CurModule.PlaceHolderInfo.find(V);
1004 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
1005
1006 ValID &DID = PHI->second.first;
1007
1008 Value *TheRealValue = getExistingVal(V->getType(), DID);
1009 if (TriggerError)
1010 return;
1011 if (TheRealValue) {
1012 V->replaceAllUsesWith(TheRealValue);
1013 delete V;
1014 CurModule.PlaceHolderInfo.erase(PHI);
1015 } else if (FutureLateResolvers) {
1016 // Functions have their unresolved items forwarded to the module late
1017 // resolver table
1018 InsertValue(V, *FutureLateResolvers);
1019 } else {
1020 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1021 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1022 "' of type '" + V->getType()->getDescription() + "'",
1023 PHI->second.second);
1024 return;
1025 } else {
1026 GenerateError("Reference to an invalid definition: #" +
1027 itostr(DID.Num) + " of type '" +
1028 V->getType()->getDescription() + "'",
1029 PHI->second.second);
1030 return;
1031 }
1032 }
1033 }
1034 LateResolvers.clear();
1035}
1036
1037// ResolveTypeTo - A brand new type was just declared. This means that (if
1038// name is not null) things referencing Name can be resolved. Otherwise, things
1039// refering to the number can be resolved. Do this now.
1040//
1041static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1042 ValID D;
1043 if (Name)
1044 D = ValID::createLocalName(*Name);
1045 else
1046 D = ValID::createLocalID(CurModule.Types.size());
1047
1048 std::map<ValID, PATypeHolder>::iterator I =
1049 CurModule.LateResolveTypes.find(D);
1050 if (I != CurModule.LateResolveTypes.end()) {
1051 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1052 CurModule.LateResolveTypes.erase(I);
1053 }
1054}
1055
1056// setValueName - Set the specified value to the name given. The name may be
1057// null potentially, in which case this is a noop. The string passed in is
1058// assumed to be a malloc'd string buffer, and is free'd by this function.
1059//
1060static void setValueName(Value *V, std::string *NameStr) {
1061 if (!NameStr) return;
1062 std::string Name(*NameStr); // Copy string
1063 delete NameStr; // Free old string
1064
1065 if (V->getType() == Type::VoidTy) {
1066 GenerateError("Can't assign name '" + Name+"' to value with void type");
1067 return;
1068 }
1069
1070 assert(inFunctionScope() && "Must be in function scope!");
1071 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1072 if (ST.lookup(Name)) {
1073 GenerateError("Redefinition of value '" + Name + "' of type '" +
1074 V->getType()->getDescription() + "'");
1075 return;
1076 }
1077
1078 // Set the name.
1079 V->setName(Name);
1080}
1081
1082/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1083/// this is a declaration, otherwise it is a definition.
1084static GlobalVariable *
1085ParseGlobalVariable(std::string *NameStr,
1086 GlobalValue::LinkageTypes Linkage,
1087 GlobalValue::VisibilityTypes Visibility,
1088 bool isConstantGlobal, const Type *Ty,
1089 Constant *Initializer, bool IsThreadLocal) {
1090 if (isa<FunctionType>(Ty)) {
1091 GenerateError("Cannot declare global vars of function type");
1092 return 0;
1093 }
1094
1095 const PointerType *PTy = PointerType::get(Ty);
1096
1097 std::string Name;
1098 if (NameStr) {
1099 Name = *NameStr; // Copy string
1100 delete NameStr; // Free old string
1101 }
1102
1103 // See if this global value was forward referenced. If so, recycle the
1104 // object.
1105 ValID ID;
1106 if (!Name.empty()) {
1107 ID = ValID::createGlobalName(Name);
1108 } else {
1109 ID = ValID::createGlobalID(CurModule.Values.size());
1110 }
1111
1112 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1113 // Move the global to the end of the list, from whereever it was
1114 // previously inserted.
1115 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1116 CurModule.CurrentModule->getGlobalList().remove(GV);
1117 CurModule.CurrentModule->getGlobalList().push_back(GV);
1118 GV->setInitializer(Initializer);
1119 GV->setLinkage(Linkage);
1120 GV->setVisibility(Visibility);
1121 GV->setConstant(isConstantGlobal);
1122 GV->setThreadLocal(IsThreadLocal);
1123 InsertValue(GV, CurModule.Values);
1124 return GV;
1125 }
1126
1127 // If this global has a name
1128 if (!Name.empty()) {
1129 // if the global we're parsing has an initializer (is a definition) and
1130 // has external linkage.
1131 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1132 // If there is already a global with external linkage with this name
1133 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1134 // If we allow this GVar to get created, it will be renamed in the
1135 // symbol table because it conflicts with an existing GVar. We can't
1136 // allow redefinition of GVars whose linking indicates that their name
1137 // must stay the same. Issue the error.
1138 GenerateError("Redefinition of global variable named '" + Name +
1139 "' of type '" + Ty->getDescription() + "'");
1140 return 0;
1141 }
1142 }
1143
1144 // Otherwise there is no existing GV to use, create one now.
1145 GlobalVariable *GV =
1146 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1147 CurModule.CurrentModule, IsThreadLocal);
1148 GV->setVisibility(Visibility);
1149 InsertValue(GV, CurModule.Values);
1150 return GV;
1151}
1152
1153// setTypeName - Set the specified type to the name given. The name may be
1154// null potentially, in which case this is a noop. The string passed in is
1155// assumed to be a malloc'd string buffer, and is freed by this function.
1156//
1157// This function returns true if the type has already been defined, but is
1158// allowed to be redefined in the specified context. If the name is a new name
1159// for the type plane, it is inserted and false is returned.
1160static bool setTypeName(const Type *T, std::string *NameStr) {
1161 assert(!inFunctionScope() && "Can't give types function-local names!");
1162 if (NameStr == 0) return false;
1163
1164 std::string Name(*NameStr); // Copy string
1165 delete NameStr; // Free old string
1166
1167 // We don't allow assigning names to void type
1168 if (T == Type::VoidTy) {
1169 GenerateError("Can't assign name '" + Name + "' to the void type");
1170 return false;
1171 }
1172
1173 // Set the type name, checking for conflicts as we do so.
1174 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1175
1176 if (AlreadyExists) { // Inserting a name that is already defined???
1177 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1178 assert(Existing && "Conflict but no matching type?!");
1179
1180 // There is only one case where this is allowed: when we are refining an
1181 // opaque type. In this case, Existing will be an opaque type.
1182 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1183 // We ARE replacing an opaque type!
1184 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1185 return true;
1186 }
1187
1188 // Otherwise, this is an attempt to redefine a type. That's okay if
1189 // the redefinition is identical to the original. This will be so if
1190 // Existing and T point to the same Type object. In this one case we
1191 // allow the equivalent redefinition.
1192 if (Existing == T) return true; // Yes, it's equal.
1193
1194 // Any other kind of (non-equivalent) redefinition is an error.
1195 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1196 T->getDescription() + "'");
1197 }
1198
1199 return false;
1200}
1201
1202//===----------------------------------------------------------------------===//
1203// Code for handling upreferences in type names...
1204//
1205
1206// TypeContains - Returns true if Ty directly contains E in it.
1207//
1208static bool TypeContains(const Type *Ty, const Type *E) {
1209 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1210 E) != Ty->subtype_end();
1211}
1212
1213namespace {
1214 struct UpRefRecord {
1215 // NestingLevel - The number of nesting levels that need to be popped before
1216 // this type is resolved.
1217 unsigned NestingLevel;
1218
1219 // LastContainedTy - This is the type at the current binding level for the
1220 // type. Every time we reduce the nesting level, this gets updated.
1221 const Type *LastContainedTy;
1222
1223 // UpRefTy - This is the actual opaque type that the upreference is
1224 // represented with.
1225 OpaqueType *UpRefTy;
1226
1227 UpRefRecord(unsigned NL, OpaqueType *URTy)
1228 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1229 };
1230}
1231
1232// UpRefs - A list of the outstanding upreferences that need to be resolved.
1233static std::vector<UpRefRecord> UpRefs;
1234
1235/// HandleUpRefs - Every time we finish a new layer of types, this function is
1236/// called. It loops through the UpRefs vector, which is a list of the
1237/// currently active types. For each type, if the up reference is contained in
1238/// the newly completed type, we decrement the level count. When the level
1239/// count reaches zero, the upreferenced type is the type that is passed in:
1240/// thus we can complete the cycle.
1241///
1242static PATypeHolder HandleUpRefs(const Type *ty) {
1243 // If Ty isn't abstract, or if there are no up-references in it, then there is
1244 // nothing to resolve here.
1245 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1246
1247 PATypeHolder Ty(ty);
1248 UR_OUT("Type '" << Ty->getDescription() <<
1249 "' newly formed. Resolving upreferences.\n" <<
1250 UpRefs.size() << " upreferences active!\n");
1251
1252 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1253 // to zero), we resolve them all together before we resolve them to Ty. At
1254 // the end of the loop, if there is anything to resolve to Ty, it will be in
1255 // this variable.
1256 OpaqueType *TypeToResolve = 0;
1257
1258 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1259 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1260 << UpRefs[i].second->getDescription() << ") = "
1261 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1262 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1263 // Decrement level of upreference
1264 unsigned Level = --UpRefs[i].NestingLevel;
1265 UpRefs[i].LastContainedTy = Ty;
1266 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1267 if (Level == 0) { // Upreference should be resolved!
1268 if (!TypeToResolve) {
1269 TypeToResolve = UpRefs[i].UpRefTy;
1270 } else {
1271 UR_OUT(" * Resolving upreference for "
1272 << UpRefs[i].second->getDescription() << "\n";
1273 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1274 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1275 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1276 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1277 }
1278 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1279 --i; // Do not skip the next element...
1280 }
1281 }
1282 }
1283
1284 if (TypeToResolve) {
1285 UR_OUT(" * Resolving upreference for "
1286 << UpRefs[i].second->getDescription() << "\n";
1287 std::string OldName = TypeToResolve->getDescription());
1288 TypeToResolve->refineAbstractTypeTo(Ty);
1289 }
1290
1291 return Ty;
1292}
1293
1294//===----------------------------------------------------------------------===//
1295// RunVMAsmParser - Define an interface to this parser
1296//===----------------------------------------------------------------------===//
1297//
1298static Module* RunParser(Module * M);
1299
Duncan Sandsf5588dc2007-11-27 13:23:08 +00001300Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1301 InitLLLexer(MB);
1302 Module *M = RunParser(new Module(LLLgetFilename()));
1303 FreeLexer();
1304 return M;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001305}
1306
1307
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001308
1309/* Enabling traces. */
1310#ifndef YYDEBUG
1311# define YYDEBUG 0
1312#endif
1313
1314/* Enabling verbose error messages. */
1315#ifdef YYERROR_VERBOSE
1316# undef YYERROR_VERBOSE
1317# define YYERROR_VERBOSE 1
1318#else
1319# define YYERROR_VERBOSE 0
1320#endif
1321
1322/* Enabling the token table. */
1323#ifndef YYTOKEN_TABLE
1324# define YYTOKEN_TABLE 0
1325#endif
1326
1327#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1328typedef union YYSTYPE
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00001329#line 945 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001330{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001331 llvm::Module *ModuleVal;
1332 llvm::Function *FunctionVal;
1333 llvm::BasicBlock *BasicBlockVal;
1334 llvm::TerminatorInst *TermInstVal;
1335 llvm::Instruction *InstVal;
1336 llvm::Constant *ConstVal;
1337
1338 const llvm::Type *PrimType;
1339 std::list<llvm::PATypeHolder> *TypeList;
1340 llvm::PATypeHolder *TypeVal;
1341 llvm::Value *ValueVal;
1342 std::vector<llvm::Value*> *ValueList;
1343 llvm::ArgListType *ArgList;
1344 llvm::TypeWithAttrs TypeWithAttrs;
1345 llvm::TypeWithAttrsList *TypeWithAttrsList;
Dale Johannesencfb19e62007-11-05 21:20:28 +00001346 llvm::ParamList *ParamList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001347
1348 // Represent the RHS of PHI node
1349 std::list<std::pair<llvm::Value*,
1350 llvm::BasicBlock*> > *PHIList;
1351 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1352 std::vector<llvm::Constant*> *ConstVector;
1353
1354 llvm::GlobalValue::LinkageTypes Linkage;
1355 llvm::GlobalValue::VisibilityTypes Visibility;
1356 uint16_t ParamAttrs;
1357 llvm::APInt *APIntVal;
1358 int64_t SInt64Val;
1359 uint64_t UInt64Val;
1360 int SIntVal;
1361 unsigned UIntVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00001362 llvm::APFloat *FPVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001363 bool BoolVal;
1364
1365 std::string *StrVal; // This memory must be deleted
1366 llvm::ValID ValIDVal;
1367
1368 llvm::Instruction::BinaryOps BinaryOpVal;
1369 llvm::Instruction::TermOps TermOpVal;
1370 llvm::Instruction::MemoryOps MemOpVal;
1371 llvm::Instruction::CastOps CastOpVal;
1372 llvm::Instruction::OtherOps OtherOpVal;
1373 llvm::ICmpInst::Predicate IPredicate;
1374 llvm::FCmpInst::Predicate FPredicate;
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001375}
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00001376/* Line 193 of yacc.c. */
1377#line 1378 "llvmAsmParser.tab.c"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001378 YYSTYPE;
1379# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1380# define YYSTYPE_IS_DECLARED 1
1381# define YYSTYPE_IS_TRIVIAL 1
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001382#endif
1383
1384
1385
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001386/* Copy the second part of user declarations. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001387
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001388
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001389/* Line 216 of yacc.c. */
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00001390#line 1391 "llvmAsmParser.tab.c"
Reid Spenceraa8ae282007-07-31 03:50:36 +00001391
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001392#ifdef short
1393# undef short
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001394#endif
1395
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001396#ifdef YYTYPE_UINT8
1397typedef YYTYPE_UINT8 yytype_uint8;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001398#else
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001399typedef unsigned char yytype_uint8;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001400#endif
1401
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001402#ifdef YYTYPE_INT8
1403typedef YYTYPE_INT8 yytype_int8;
1404#elif (defined __STDC__ || defined __C99__FUNC__ \
1405 || defined __cplusplus || defined _MSC_VER)
1406typedef signed char yytype_int8;
1407#else
1408typedef short int yytype_int8;
1409#endif
1410
1411#ifdef YYTYPE_UINT16
1412typedef YYTYPE_UINT16 yytype_uint16;
1413#else
1414typedef unsigned short int yytype_uint16;
1415#endif
1416
1417#ifdef YYTYPE_INT16
1418typedef YYTYPE_INT16 yytype_int16;
1419#else
1420typedef short int yytype_int16;
1421#endif
1422
1423#ifndef YYSIZE_T
1424# ifdef __SIZE_TYPE__
1425# define YYSIZE_T __SIZE_TYPE__
1426# elif defined size_t
1427# define YYSIZE_T size_t
1428# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1429 || defined __cplusplus || defined _MSC_VER)
1430# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1431# define YYSIZE_T size_t
1432# else
1433# define YYSIZE_T unsigned int
1434# endif
1435#endif
1436
1437#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1438
1439#ifndef YY_
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00001440# if defined YYENABLE_NLS && YYENABLE_NLS
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001441# if ENABLE_NLS
1442# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1443# define YY_(msgid) dgettext ("bison-runtime", msgid)
1444# endif
1445# endif
1446# ifndef YY_
1447# define YY_(msgid) msgid
1448# endif
1449#endif
1450
1451/* Suppress unused-variable warnings by "using" E. */
1452#if ! defined lint || defined __GNUC__
1453# define YYUSE(e) ((void) (e))
1454#else
1455# define YYUSE(e) /* empty */
1456#endif
1457
1458/* Identity function, used to suppress warnings about constant conditions. */
1459#ifndef lint
1460# define YYID(n) (n)
1461#else
1462#if (defined __STDC__ || defined __C99__FUNC__ \
1463 || defined __cplusplus || defined _MSC_VER)
1464static int
1465YYID (int i)
1466#else
1467static int
1468YYID (i)
1469 int i;
1470#endif
1471{
1472 return i;
1473}
1474#endif
1475
1476#if ! defined yyoverflow || YYERROR_VERBOSE
1477
1478/* The parser invokes alloca or malloc; define the necessary symbols. */
1479
1480# ifdef YYSTACK_USE_ALLOCA
1481# if YYSTACK_USE_ALLOCA
1482# ifdef __GNUC__
1483# define YYSTACK_ALLOC __builtin_alloca
1484# elif defined __BUILTIN_VA_ARG_INCR
1485# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1486# elif defined _AIX
1487# define YYSTACK_ALLOC __alloca
1488# elif defined _MSC_VER
1489# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1490# define alloca _alloca
1491# else
1492# define YYSTACK_ALLOC alloca
1493# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1494 || defined __cplusplus || defined _MSC_VER)
1495# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1496# ifndef _STDLIB_H
1497# define _STDLIB_H 1
1498# endif
1499# endif
1500# endif
1501# endif
1502# endif
1503
1504# ifdef YYSTACK_ALLOC
1505 /* Pacify GCC's `empty if-body' warning. */
1506# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1507# ifndef YYSTACK_ALLOC_MAXIMUM
1508 /* The OS might guarantee only one guard page at the bottom of the stack,
1509 and a page size can be as small as 4096 bytes. So we cannot safely
1510 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1511 to allow for a few compiler-allocated temporary stack slots. */
1512# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1513# endif
1514# else
1515# define YYSTACK_ALLOC YYMALLOC
1516# define YYSTACK_FREE YYFREE
1517# ifndef YYSTACK_ALLOC_MAXIMUM
1518# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1519# endif
1520# if (defined __cplusplus && ! defined _STDLIB_H \
1521 && ! ((defined YYMALLOC || defined malloc) \
1522 && (defined YYFREE || defined free)))
1523# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1524# ifndef _STDLIB_H
1525# define _STDLIB_H 1
1526# endif
1527# endif
1528# ifndef YYMALLOC
1529# define YYMALLOC malloc
1530# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1531 || defined __cplusplus || defined _MSC_VER)
1532void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1533# endif
1534# endif
1535# ifndef YYFREE
1536# define YYFREE free
1537# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1538 || defined __cplusplus || defined _MSC_VER)
1539void free (void *); /* INFRINGES ON USER NAME SPACE */
1540# endif
1541# endif
1542# endif
1543#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1544
1545
1546#if (! defined yyoverflow \
1547 && (! defined __cplusplus \
1548 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1549
1550/* A type that is properly aligned for any stack member. */
1551union yyalloc
1552{
1553 yytype_int16 yyss;
1554 YYSTYPE yyvs;
1555 };
1556
1557/* The size of the maximum gap between one aligned stack and the next. */
1558# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1559
1560/* The size of an array large to enough to hold all stacks, each with
1561 N elements. */
1562# define YYSTACK_BYTES(N) \
1563 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1564 + YYSTACK_GAP_MAXIMUM)
1565
1566/* Copy COUNT objects from FROM to TO. The source and destination do
1567 not overlap. */
1568# ifndef YYCOPY
1569# if defined __GNUC__ && 1 < __GNUC__
1570# define YYCOPY(To, From, Count) \
1571 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1572# else
1573# define YYCOPY(To, From, Count) \
1574 do \
1575 { \
1576 YYSIZE_T yyi; \
1577 for (yyi = 0; yyi < (Count); yyi++) \
1578 (To)[yyi] = (From)[yyi]; \
1579 } \
1580 while (YYID (0))
1581# endif
1582# endif
1583
1584/* Relocate STACK from its old location to the new one. The
1585 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1586 elements in the stack, and YYPTR gives the new location of the
1587 stack. Advance YYPTR to a properly aligned location for the next
1588 stack. */
1589# define YYSTACK_RELOCATE(Stack) \
1590 do \
1591 { \
1592 YYSIZE_T yynewbytes; \
1593 YYCOPY (&yyptr->Stack, Stack, yysize); \
1594 Stack = &yyptr->Stack; \
1595 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1596 yyptr += yynewbytes / sizeof (*yyptr); \
1597 } \
1598 while (YYID (0))
1599
1600#endif
1601
1602/* YYFINAL -- State number of the termination state. */
1603#define YYFINAL 43
1604/* YYLAST -- Last index in YYTABLE. */
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00001605#define YYLAST 1820
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001606
1607/* YYNTOKENS -- Number of terminals. */
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00001608#define YYNTOKENS 163
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001609/* YYNNTS -- Number of nonterminals. */
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00001610#define YYNNTS 83
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001611/* YYNRULES -- Number of rules. */
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00001612#define YYNRULES 316
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001613/* YYNRULES -- Number of states. */
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00001614#define YYNSTATES 611
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001615
1616/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1617#define YYUNDEFTOK 2
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00001618#define YYMAXUTOK 403
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001619
1620#define YYTRANSLATE(YYX) \
1621 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1622
1623/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1624static const yytype_uint8 yytranslate[] =
1625{
1626 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1627 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1628 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1629 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00001630 153, 154, 151, 2, 150, 2, 2, 2, 2, 2,
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001631 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00001632 158, 149, 159, 2, 2, 2, 2, 2, 2, 2,
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001633 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1634 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00001635 2, 155, 152, 157, 2, 2, 2, 2, 2, 162,
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001636 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1637 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00001638 156, 2, 2, 160, 2, 161, 2, 2, 2, 2,
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001639 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1640 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1641 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1642 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1643 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1644 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1645 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1646 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1647 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1648 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1649 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1650 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1651 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1652 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1653 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1654 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1655 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1656 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1657 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1658 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1659 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1660 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1661 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1662 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1663 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1664 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1665 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00001666 145, 146, 147, 148
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001667};
1668
1669#if YYDEBUG
1670/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1671 YYRHS. */
1672static const yytype_uint16 yyprhs[] =
1673{
1674 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1675 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1676 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1677 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1678 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1679 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1680 119, 121, 123, 125, 127, 129, 130, 133, 134, 136,
1681 138, 140, 141, 144, 146, 148, 150, 152, 154, 156,
1682 158, 160, 161, 163, 165, 167, 168, 170, 172, 173,
1683 175, 177, 179, 181, 182, 184, 186, 187, 189, 191,
1684 193, 195, 197, 200, 202, 204, 206, 208, 210, 212,
1685 214, 216, 218, 219, 222, 224, 226, 228, 230, 232,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00001686 234, 235, 238, 239, 242, 243, 246, 247, 251, 254,
1687 255, 257, 258, 262, 264, 267, 269, 271, 273, 275,
1688 277, 279, 281, 283, 285, 288, 290, 293, 299, 305,
1689 311, 317, 321, 324, 330, 335, 338, 340, 342, 344,
1690 348, 350, 354, 356, 357, 359, 363, 368, 372, 376,
1691 381, 386, 390, 397, 403, 406, 409, 412, 415, 418,
1692 421, 424, 427, 430, 433, 436, 439, 446, 452, 461,
1693 468, 475, 483, 491, 498, 507, 516, 520, 522, 524,
1694 526, 528, 529, 532, 539, 541, 542, 544, 547, 548,
1695 552, 553, 557, 561, 565, 569, 570, 578, 579, 588,
1696 589, 598, 604, 607, 611, 613, 617, 621, 625, 629,
1697 631, 632, 638, 642, 644, 648, 650, 651, 662, 664,
1698 666, 671, 673, 675, 678, 682, 683, 685, 687, 689,
1699 691, 693, 695, 697, 699, 701, 705, 707, 713, 715,
1700 717, 719, 721, 723, 725, 728, 731, 734, 738, 741,
1701 742, 744, 747, 750, 754, 764, 774, 783, 798, 800,
1702 802, 809, 815, 818, 825, 833, 838, 843, 850, 857,
1703 858, 859, 863, 866, 868, 874, 880, 887, 894, 899,
1704 906, 911, 916, 923, 930, 933, 942, 944, 946, 947,
1705 951, 958, 962, 969, 972, 978, 986
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001706};
1707
1708/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1709static const yytype_int16 yyrhs[] =
1710{
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00001711 208, 0, -1, 73, -1, 74, -1, 75, -1, 76,
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001712 -1, 77, -1, 78, -1, 79, -1, 80, -1, 81,
1713 -1, 85, -1, 86, -1, 87, -1, 82, -1, 83,
1714 -1, 84, -1, 116, -1, 117, -1, 118, -1, 119,
1715 -1, 120, -1, 121, -1, 122, -1, 123, -1, 124,
1716 -1, 125, -1, 126, -1, 127, -1, 90, -1, 91,
1717 -1, 92, -1, 93, -1, 94, -1, 95, -1, 96,
1718 -1, 97, -1, 98, -1, 99, -1, 100, -1, 101,
1719 -1, 102, -1, 103, -1, 104, -1, 105, -1, 106,
1720 -1, 107, -1, 108, -1, 109, -1, 96, -1, 97,
1721 -1, 98, -1, 99, -1, 26, -1, 27, -1, 11,
1722 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00001723 -1, 19, -1, 22, -1, 24, -1, 171, -1, -1,
1724 171, 149, -1, -1, 20, -1, 23, -1, 176, -1,
1725 -1, 174, 149, -1, 42, -1, 44, -1, 43, -1,
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001726 45, -1, 47, -1, 46, -1, 48, -1, 50, -1,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00001727 -1, 146, -1, 147, -1, 148, -1, -1, 46, -1,
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001728 48, -1, -1, 42, -1, 43, -1, 44, -1, 47,
1729 -1, -1, 44, -1, 42, -1, -1, 61, -1, 62,
1730 -1, 63, -1, 64, -1, 65, -1, 60, 4, -1,
1731 135, -1, 117, -1, 134, -1, 118, -1, 137, -1,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00001732 138, -1, 140, -1, 141, -1, 142, -1, -1, 185,
1733 184, -1, 136, -1, 139, -1, 135, -1, 134, -1,
1734 143, -1, 144, -1, -1, 187, 186, -1, -1, 145,
1735 22, -1, -1, 53, 4, -1, -1, 150, 53, 4,
1736 -1, 34, 22, -1, -1, 191, -1, -1, 150, 194,
1737 193, -1, 191, -1, 53, 4, -1, 11, -1, 12,
1738 -1, 13, -1, 16, -1, 15, -1, 14, -1, 17,
1739 -1, 49, -1, 195, -1, 196, 151, -1, 230, -1,
1740 152, 4, -1, 196, 153, 200, 154, 187, -1, 10,
1741 153, 200, 154, 187, -1, 155, 4, 156, 196, 157,
1742 -1, 158, 4, 156, 196, 159, -1, 160, 201, 161,
1743 -1, 160, 161, -1, 158, 160, 201, 161, 159, -1,
1744 158, 160, 161, 159, -1, 196, 185, -1, 196, -1,
1745 10, -1, 197, -1, 199, 150, 197, -1, 199, -1,
1746 199, 150, 39, -1, 39, -1, -1, 196, -1, 201,
1747 150, 196, -1, 196, 155, 204, 157, -1, 196, 155,
1748 157, -1, 196, 162, 22, -1, 196, 158, 204, 159,
1749 -1, 196, 160, 204, 161, -1, 196, 160, 161, -1,
1750 196, 158, 160, 204, 161, 159, -1, 196, 158, 160,
1751 161, 159, -1, 196, 40, -1, 196, 41, -1, 196,
1752 230, -1, 196, 203, -1, 196, 25, -1, 169, 3,
1753 -1, 169, 5, -1, 169, 4, -1, 169, 6, -1,
1754 11, 26, -1, 11, 27, -1, 170, 9, -1, 166,
1755 153, 202, 38, 196, 154, -1, 115, 153, 202, 241,
1756 154, -1, 129, 153, 202, 150, 202, 150, 202, 154,
1757 -1, 164, 153, 202, 150, 202, 154, -1, 165, 153,
1758 202, 150, 202, 154, -1, 88, 167, 153, 202, 150,
1759 202, 154, -1, 89, 168, 153, 202, 150, 202, 154,
1760 -1, 131, 153, 202, 150, 202, 154, -1, 132, 153,
1761 202, 150, 202, 150, 202, 154, -1, 133, 153, 202,
1762 150, 202, 150, 202, 154, -1, 204, 150, 202, -1,
1763 202, -1, 32, -1, 33, -1, 37, -1, -1, 198,
1764 230, -1, 121, 153, 207, 38, 196, 154, -1, 209,
1765 -1, -1, 210, -1, 209, 210, -1, -1, 31, 211,
1766 226, -1, -1, 30, 212, 227, -1, 58, 57, 216,
1767 -1, 173, 18, 196, -1, 173, 18, 10, -1, -1,
1768 175, 179, 206, 205, 202, 213, 193, -1, -1, 175,
1769 177, 179, 206, 205, 202, 214, 193, -1, -1, 175,
1770 178, 179, 206, 205, 196, 215, 193, -1, 175, 179,
1771 35, 182, 207, -1, 51, 217, -1, 54, 149, 218,
1772 -1, 22, -1, 52, 149, 22, -1, 66, 149, 22,
1773 -1, 155, 219, 157, -1, 219, 150, 22, -1, 22,
1774 -1, -1, 220, 150, 196, 185, 172, -1, 196, 185,
1775 172, -1, 220, -1, 220, 150, 39, -1, 39, -1,
1776 -1, 183, 198, 174, 153, 221, 154, 187, 192, 189,
1777 188, -1, 28, -1, 160, -1, 181, 179, 222, 223,
1778 -1, 29, -1, 161, -1, 233, 225, -1, 180, 179,
1779 222, -1, -1, 59, -1, 3, -1, 4, -1, 9,
1780 -1, 26, -1, 27, -1, 40, -1, 41, -1, 25,
1781 -1, 158, 204, 159, -1, 203, -1, 57, 228, 22,
1782 150, 22, -1, 7, -1, 8, -1, 171, -1, 174,
1783 -1, 230, -1, 229, -1, 196, 231, -1, 233, 234,
1784 -1, 224, 234, -1, 235, 173, 236, -1, 235, 238,
1785 -1, -1, 21, -1, 67, 232, -1, 67, 10, -1,
1786 68, 17, 231, -1, 68, 11, 231, 150, 17, 231,
1787 150, 17, 231, -1, 69, 169, 231, 150, 17, 231,
1788 155, 237, 157, -1, 69, 169, 231, 150, 17, 231,
1789 155, 157, -1, 70, 183, 198, 231, 153, 240, 154,
1790 187, 38, 17, 231, 71, 17, 231, -1, 71, -1,
1791 72, -1, 237, 169, 229, 150, 17, 231, -1, 169,
1792 229, 150, 17, 231, -1, 173, 243, -1, 196, 155,
1793 231, 150, 231, 157, -1, 239, 150, 155, 231, 150,
1794 231, 157, -1, 196, 185, 231, 185, -1, 17, 185,
1795 231, 185, -1, 240, 150, 196, 185, 231, 185, -1,
1796 240, 150, 17, 185, 231, 185, -1, -1, -1, 241,
1797 150, 232, -1, 56, 55, -1, 55, -1, 164, 196,
1798 231, 150, 231, -1, 165, 196, 231, 150, 231, -1,
1799 88, 167, 196, 231, 150, 231, -1, 89, 168, 196,
1800 231, 150, 231, -1, 166, 232, 38, 196, -1, 129,
1801 232, 150, 232, 150, 232, -1, 130, 232, 150, 196,
1802 -1, 131, 232, 150, 232, -1, 132, 232, 150, 232,
1803 150, 232, -1, 133, 232, 150, 232, 150, 232, -1,
1804 128, 239, -1, 242, 183, 198, 231, 153, 240, 154,
1805 187, -1, 245, -1, 36, -1, -1, 110, 196, 190,
1806 -1, 110, 196, 150, 11, 231, 190, -1, 111, 196,
1807 190, -1, 111, 196, 150, 11, 231, 190, -1, 112,
1808 232, -1, 244, 113, 196, 231, 190, -1, 244, 114,
1809 232, 150, 196, 231, 190, -1, 115, 196, 231, 241,
1810 -1
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001811};
1812
1813/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1814static const yytype_uint16 yyrline[] =
1815{
Duncan Sandsf5588dc2007-11-27 13:23:08 +00001816 0, 1105, 1105, 1105, 1105, 1105, 1105, 1105, 1105, 1105,
1817 1105, 1106, 1106, 1106, 1106, 1106, 1106, 1107, 1107, 1107,
1818 1107, 1107, 1107, 1108, 1108, 1108, 1108, 1108, 1108, 1111,
1819 1111, 1112, 1112, 1113, 1113, 1114, 1114, 1115, 1115, 1119,
1820 1119, 1120, 1120, 1121, 1121, 1122, 1122, 1123, 1123, 1124,
1821 1124, 1125, 1125, 1126, 1127, 1132, 1133, 1133, 1133, 1133,
1822 1133, 1135, 1135, 1135, 1136, 1136, 1140, 1144, 1149, 1149,
1823 1151, 1152, 1157, 1163, 1164, 1165, 1166, 1167, 1171, 1172,
1824 1173, 1177, 1178, 1179, 1180, 1184, 1185, 1186, 1190, 1191,
1825 1192, 1193, 1194, 1198, 1199, 1200, 1203, 1204, 1205, 1206,
1826 1207, 1208, 1209, 1216, 1217, 1218, 1219, 1220, 1221, 1222,
1827 1223, 1224, 1227, 1228, 1233, 1234, 1235, 1236, 1237, 1238,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00001828 1241, 1242, 1247, 1248, 1255, 1256, 1262, 1263, 1271, 1279,
1829 1280, 1285, 1286, 1287, 1292, 1305, 1305, 1305, 1305, 1305,
1830 1305, 1305, 1308, 1312, 1316, 1323, 1328, 1336, 1366, 1391,
1831 1396, 1406, 1416, 1420, 1430, 1437, 1446, 1453, 1458, 1463,
1832 1470, 1471, 1478, 1485, 1493, 1499, 1511, 1539, 1555, 1582,
1833 1610, 1636, 1656, 1682, 1702, 1714, 1721, 1787, 1797, 1807,
1834 1813, 1823, 1829, 1839, 1844, 1849, 1862, 1874, 1896, 1904,
1835 1910, 1921, 1926, 1931, 1937, 1943, 1952, 1956, 1964, 1964,
1836 1967, 1967, 1970, 1982, 2003, 2008, 2016, 2017, 2021, 2021,
1837 2025, 2025, 2028, 2031, 2055, 2066, 2066, 2077, 2076, 2086,
1838 2085, 2096, 2136, 2139, 2145, 2155, 2159, 2164, 2166, 2171,
1839 2176, 2185, 2195, 2206, 2210, 2219, 2228, 2233, 2367, 2367,
1840 2369, 2378, 2378, 2380, 2385, 2397, 2401, 2406, 2410, 2414,
1841 2418, 2422, 2426, 2430, 2434, 2438, 2463, 2467, 2477, 2481,
1842 2485, 2490, 2497, 2497, 2503, 2512, 2516, 2525, 2534, 2543,
1843 2547, 2554, 2558, 2562, 2567, 2577, 2596, 2605, 2689, 2693,
1844 2700, 2711, 2724, 2734, 2745, 2755, 2766, 2774, 2784, 2791,
1845 2794, 2795, 2802, 2806, 2811, 2827, 2844, 2858, 2872, 2884,
1846 2892, 2899, 2905, 2911, 2917, 2932, 3023, 3028, 3032, 3039,
1847 3046, 3054, 3061, 3069, 3077, 3091, 3108
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001848};
1849#endif
1850
1851#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1852/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1853 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1854static const char *const yytname[] =
1855{
1856 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1857 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1858 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1859 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1860 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1861 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1862 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1863 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1864 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1865 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "DEPLIBS", "CALL", "TAIL",
1866 "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", "FASTCC_TOK",
1867 "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT",
1868 "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB",
1869 "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR",
1870 "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT",
1871 "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT",
1872 "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE",
1873 "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC",
1874 "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR",
1875 "PTRTOINT", "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT",
1876 "INSERTELEMENT", "SHUFFLEVECTOR", "SIGNEXT", "ZEROEXT", "NORETURN",
Duncan Sandsf5588dc2007-11-27 13:23:08 +00001877 "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL", "NEST", "READNONE",
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00001878 "READONLY", "GC", "DEFAULT", "HIDDEN", "PROTECTED", "'='", "','", "'*'",
Duncan Sandsf5588dc2007-11-27 13:23:08 +00001879 "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'",
1880 "'c'", "$accept", "ArithmeticOps", "LogicalOps", "CastOps",
1881 "IPredicates", "FPredicates", "IntType", "FPType", "LocalName",
1882 "OptLocalName", "OptLocalAssign", "GlobalName", "OptGlobalAssign",
1883 "GlobalAssign", "GVInternalLinkage", "GVExternalLinkage",
1884 "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage",
1885 "AliasLinkage", "OptCallingConv", "ParamAttr", "OptParamAttrs",
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00001886 "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign", "OptCAlign",
1887 "SectionString", "OptSection", "GlobalVarAttributes",
1888 "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
1889 "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
1890 "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
1891 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1892 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1893 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1894 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1895 "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList",
1896 "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst",
1897 "PHIList", "ParamList", "IndexList", "OptTailCall", "InstVal",
1898 "OptVolatile", "MemoryInst", 0
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001899};
1900#endif
1901
1902# ifdef YYPRINT
1903/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1904 token YYLEX-NUM. */
1905static const yytype_uint16 yytoknum[] =
1906{
1907 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1908 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1909 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1910 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1911 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1912 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1913 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1914 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1915 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1916 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1917 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1918 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1919 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1920 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00001921 395, 396, 397, 398, 399, 400, 401, 402, 403, 61,
1922 44, 42, 92, 40, 41, 91, 120, 93, 60, 62,
1923 123, 125, 99
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001924};
1925# endif
1926
1927/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1928static const yytype_uint8 yyr1[] =
1929{
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00001930 0, 163, 164, 164, 164, 164, 164, 164, 164, 164,
1931 164, 165, 165, 165, 165, 165, 165, 166, 166, 166,
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001932 166, 166, 166, 166, 166, 166, 166, 166, 166, 167,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00001933 167, 167, 167, 167, 167, 167, 167, 167, 167, 168,
1934 168, 168, 168, 168, 168, 168, 168, 168, 168, 168,
1935 168, 168, 168, 168, 168, 169, 170, 170, 170, 170,
1936 170, 171, 171, 171, 172, 172, 173, 173, 174, 174,
1937 175, 175, 176, 177, 177, 177, 177, 177, 178, 178,
1938 178, 179, 179, 179, 179, 180, 180, 180, 181, 181,
1939 181, 181, 181, 182, 182, 182, 183, 183, 183, 183,
1940 183, 183, 183, 184, 184, 184, 184, 184, 184, 184,
1941 184, 184, 185, 185, 186, 186, 186, 186, 186, 186,
1942 187, 187, 188, 188, 189, 189, 190, 190, 191, 192,
1943 192, 193, 193, 194, 194, 195, 195, 195, 195, 195,
1944 195, 195, 196, 196, 196, 196, 196, 196, 196, 196,
1945 196, 196, 196, 196, 196, 197, 198, 198, 199, 199,
1946 200, 200, 200, 200, 201, 201, 202, 202, 202, 202,
1947 202, 202, 202, 202, 202, 202, 202, 202, 202, 202,
1948 202, 202, 202, 202, 202, 202, 203, 203, 203, 203,
1949 203, 203, 203, 203, 203, 203, 204, 204, 205, 205,
1950 206, 206, 207, 207, 208, 208, 209, 209, 211, 210,
1951 212, 210, 210, 210, 210, 213, 210, 214, 210, 215,
1952 210, 210, 210, 210, 216, 217, 217, 218, 219, 219,
1953 219, 220, 220, 221, 221, 221, 221, 222, 223, 223,
1954 224, 225, 225, 226, 227, 228, 228, 229, 229, 229,
1955 229, 229, 229, 229, 229, 229, 229, 229, 230, 230,
1956 230, 230, 231, 231, 232, 233, 233, 234, 235, 235,
1957 235, 236, 236, 236, 236, 236, 236, 236, 236, 236,
1958 237, 237, 238, 239, 239, 240, 240, 240, 240, 240,
1959 241, 241, 242, 242, 243, 243, 243, 243, 243, 243,
1960 243, 243, 243, 243, 243, 243, 243, 244, 244, 245,
1961 245, 245, 245, 245, 245, 245, 245
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001962};
1963
1964/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1965static const yytype_uint8 yyr2[] =
1966{
1967 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1968 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1969 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1970 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1971 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1972 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1973 1, 1, 1, 1, 1, 0, 2, 0, 1, 1,
1974 1, 0, 2, 1, 1, 1, 1, 1, 1, 1,
1975 1, 0, 1, 1, 1, 0, 1, 1, 0, 1,
1976 1, 1, 1, 0, 1, 1, 0, 1, 1, 1,
1977 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
1978 1, 1, 0, 2, 1, 1, 1, 1, 1, 1,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00001979 0, 2, 0, 2, 0, 2, 0, 3, 2, 0,
1980 1, 0, 3, 1, 2, 1, 1, 1, 1, 1,
1981 1, 1, 1, 1, 2, 1, 2, 5, 5, 5,
1982 5, 3, 2, 5, 4, 2, 1, 1, 1, 3,
1983 1, 3, 1, 0, 1, 3, 4, 3, 3, 4,
1984 4, 3, 6, 5, 2, 2, 2, 2, 2, 2,
1985 2, 2, 2, 2, 2, 2, 6, 5, 8, 6,
1986 6, 7, 7, 6, 8, 8, 3, 1, 1, 1,
1987 1, 0, 2, 6, 1, 0, 1, 2, 0, 3,
1988 0, 3, 3, 3, 3, 0, 7, 0, 8, 0,
1989 8, 5, 2, 3, 1, 3, 3, 3, 3, 1,
1990 0, 5, 3, 1, 3, 1, 0, 10, 1, 1,
1991 4, 1, 1, 2, 3, 0, 1, 1, 1, 1,
1992 1, 1, 1, 1, 1, 3, 1, 5, 1, 1,
1993 1, 1, 1, 1, 2, 2, 2, 3, 2, 0,
1994 1, 2, 2, 3, 9, 9, 8, 14, 1, 1,
1995 6, 5, 2, 6, 7, 4, 4, 6, 6, 0,
1996 0, 3, 2, 1, 5, 5, 6, 6, 4, 6,
1997 4, 4, 6, 6, 2, 8, 1, 1, 0, 3,
1998 6, 3, 6, 2, 5, 7, 4
Anton Korobeynikov66e28652007-11-14 09:53:48 +00001999};
2000
2001/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2002 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2003 means the default is an error. */
2004static const yytype_uint16 yydefact[] =
2005{
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002006 71, 61, 68, 62, 69, 63, 210, 208, 0, 0,
2007 0, 0, 0, 0, 81, 70, 0, 71, 206, 85,
2008 88, 0, 0, 222, 0, 0, 66, 0, 72, 73,
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002009 75, 74, 76, 78, 77, 79, 80, 82, 83, 84,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002010 81, 81, 201, 1, 207, 86, 87, 81, 211, 89,
2011 90, 91, 92, 81, 269, 209, 269, 0, 0, 230,
2012 223, 224, 212, 258, 259, 214, 135, 136, 137, 140,
2013 139, 138, 141, 142, 0, 0, 0, 0, 260, 261,
2014 143, 213, 145, 201, 201, 93, 200, 0, 96, 96,
2015 270, 266, 67, 241, 242, 243, 265, 225, 226, 229,
2016 0, 163, 146, 0, 0, 0, 0, 152, 164, 0,
2017 144, 163, 0, 0, 95, 94, 0, 198, 199, 0,
2018 0, 97, 98, 99, 100, 101, 0, 244, 0, 308,
2019 268, 0, 227, 162, 112, 158, 160, 0, 0, 0,
2020 0, 0, 0, 151, 0, 0, 0, 157, 0, 156,
2021 0, 221, 135, 136, 137, 140, 139, 138, 0, 0,
2022 0, 215, 102, 0, 238, 239, 240, 307, 293, 0,
2023 0, 0, 0, 96, 278, 279, 2, 3, 4, 5,
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002024 6, 7, 8, 9, 10, 14, 15, 16, 11, 12,
2025 13, 0, 0, 0, 0, 0, 0, 17, 18, 19,
2026 20, 21, 22, 23, 24, 25, 26, 27, 28, 0,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002027 0, 0, 0, 0, 0, 0, 0, 0, 267, 96,
2028 282, 0, 306, 228, 155, 0, 120, 0, 0, 154,
2029 0, 165, 120, 217, 219, 0, 202, 183, 184, 179,
2030 181, 180, 182, 185, 178, 174, 175, 0, 0, 0,
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002031 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002032 0, 177, 176, 131, 0, 292, 272, 0, 271, 0,
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002033 0, 55, 0, 0, 29, 30, 31, 32, 33, 34,
2034 35, 36, 37, 38, 0, 53, 54, 49, 50, 51,
2035 52, 39, 40, 41, 42, 43, 44, 45, 46, 47,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002036 48, 0, 126, 126, 313, 0, 0, 304, 0, 0,
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002037 0, 0, 0, 0, 0, 0, 0, 0, 0, 104,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002038 106, 105, 103, 107, 108, 109, 110, 111, 113, 161,
2039 159, 148, 149, 150, 153, 147, 131, 131, 0, 0,
2040 0, 0, 0, 0, 0, 0, 167, 197, 0, 0,
2041 0, 171, 0, 168, 0, 0, 0, 0, 216, 236,
2042 247, 248, 249, 254, 250, 251, 252, 253, 245, 0,
2043 256, 263, 262, 264, 0, 273, 0, 0, 0, 0,
2044 0, 309, 0, 311, 290, 0, 0, 0, 0, 0,
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002045 0, 0, 0, 0, 0, 0, 0, 0, 117, 116,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002046 114, 115, 118, 119, 121, 218, 220, 0, 0, 0,
2047 290, 0, 0, 0, 0, 0, 166, 152, 164, 0,
2048 169, 170, 0, 0, 0, 0, 0, 133, 131, 235,
2049 112, 233, 0, 246, 0, 0, 0, 0, 0, 0,
2050 0, 0, 0, 0, 316, 0, 0, 0, 300, 301,
2051 0, 0, 0, 0, 298, 0, 126, 0, 0, 0,
2052 0, 0, 0, 0, 0, 0, 196, 173, 0, 0,
2053 0, 0, 128, 134, 132, 65, 0, 120, 0, 255,
2054 0, 0, 289, 0, 0, 126, 127, 126, 0, 0,
2055 0, 0, 0, 0, 294, 295, 289, 0, 314, 0,
2056 203, 0, 0, 187, 0, 0, 0, 0, 172, 0,
2057 0, 0, 64, 232, 234, 112, 129, 0, 0, 0,
2058 112, 112, 0, 296, 297, 310, 312, 291, 0, 0,
2059 299, 302, 303, 0, 126, 0, 0, 0, 193, 0,
2060 0, 189, 190, 186, 65, 130, 124, 257, 0, 0,
2061 0, 0, 0, 120, 283, 0, 120, 315, 191, 192,
2062 0, 0, 0, 231, 0, 122, 0, 276, 0, 0,
2063 104, 106, 112, 112, 112, 112, 0, 284, 305, 188,
2064 194, 195, 125, 0, 237, 274, 0, 275, 0, 286,
2065 285, 0, 0, 0, 123, 0, 0, 112, 112, 0,
2066 0, 0, 288, 287, 0, 281, 0, 0, 280, 0,
2067 277
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002068};
2069
2070/* YYDEFGOTO[NTERM-NUM]. */
2071static const yytype_int16 yydefgoto[] =
2072{
2073 -1, 258, 259, 260, 284, 301, 158, 159, 78, 513,
2074 12, 79, 14, 15, 40, 41, 42, 47, 53, 116,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002075 126, 328, 224, 404, 331, 584, 565, 381, 427, 546,
2076 358, 428, 80, 160, 135, 150, 136, 137, 109, 347,
2077 370, 348, 119, 87, 151, 16, 17, 18, 20, 19,
2078 263, 336, 337, 62, 23, 60, 100, 431, 432, 127,
2079 166, 54, 95, 55, 48, 434, 371, 82, 373, 268,
2080 56, 91, 92, 218, 569, 130, 307, 522, 444, 219,
2081 220, 221, 222
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002082};
2083
2084/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2085 STATE-NUM. */
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002086#define YYPACT_NINF -541
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002087static const yytype_int16 yypact[] =
2088{
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002089 658, -541, -541, -541, -541, -541, -541, -541, -12, -135,
2090 -38, -125, 106, -69, 26, -541, 29, 1762, -541, 14,
2091 88, 43, 49, -541, 45, 127, -541, 1344, -541, -541,
2092 -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,
2093 131, 131, 73, -541, -541, -541, -541, 131, -541, -541,
2094 -541, -541, -541, 131, 201, -541, -11, 135, 215, 216,
2095 -541, -541, -541, -541, -541, 70, -541, -541, -541, -541,
2096 -541, -541, -541, -541, 245, 247, 3, 553, -541, -541,
2097 -541, -34, -541, 219, 219, 110, -541, 62, 171, 171,
2098 -541, -541, 124, -541, -541, -541, -541, -541, -541, -541,
2099 -66, 1092, -541, 108, 114, 991, 70, -541, -34, -109,
2100 -541, 1092, 62, 62, -541, -541, 1146, -541, -541, 1362,
2101 261, -541, -541, -541, -541, -541, 1418, -541, -15, 1628,
2102 -541, 260, -541, -541, -34, -541, 119, 129, 1458, 1458,
2103 147, -108, 1458, -541, 134, 1362, 1458, 70, 142, -34,
2104 118, -541, 40, 306, 307, 308, 309, 310, 172, 311,
2105 805, -541, -541, 113, -541, -541, -541, -541, -541, 266,
2106 1516, 72, 314, 171, -541, -541, -541, -541, -541, -541,
2107 -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,
2108 -541, 313, 507, 1458, 1458, 1458, 1458, -541, -541, -541,
2109 -541, -541, -541, -541, -541, -541, -541, -541, -541, 1458,
2110 1458, 1458, 1458, 1458, 1458, 1458, 1458, 1458, -541, 171,
2111 -541, 52, -541, -541, -36, 1186, -541, -94, -30, -541,
2112 163, -34, -541, -541, -34, 1146, -541, -541, -541, -541,
2113 -541, -541, -541, -541, -541, -541, -541, 313, 507, 176,
2114 178, 184, 185, 187, 1246, 1534, 1031, 302, 190, 193,
2115 198, -541, -541, 202, 200, -541, 70, 645, -541, 782,
2116 782, -541, 782, 1418, -541, -541, -541, -541, -541, -541,
2117 -541, -541, -541, -541, 1458, -541, -541, -541, -541, -541,
2118 -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,
2119 -541, 1458, 136, 146, -541, 645, 104, 206, 207, 208,
2120 209, 210, 217, 645, 645, 328, 1418, 1458, 1458, -541,
2121 -541, -541, -541, -541, -541, -541, -541, -541, -541, -541,
2122 -541, 137, -541, -541, -541, 137, 202, 202, 333, 221,
2123 222, 1362, 1362, 1362, 1362, 1362, -541, -541, -64, 1071,
2124 -103, -541, -100, -541, 1362, 1362, 1362, 2, -541, 1264,
2125 -541, -541, -541, -541, -541, -541, -541, -541, 317, 1362,
2126 -541, -541, -541, -541, 227, -541, 230, 782, 645, 645,
2127 11, -541, 12, -541, -541, 782, 228, 1458, 1458, 1458,
2128 1458, 1458, 232, 234, 1458, 782, 645, 235, -541, -541,
2129 -541, -541, -541, -541, -541, -541, -541, 1458, 1362, 1362,
2130 -541, 239, 241, 243, 244, 1362, -541, 256, 805, -73,
2131 -541, -541, 248, 250, 385, 404, 423, -541, 202, -541,
2132 -34, 278, 280, -541, 413, -72, 419, 420, 288, 292,
2133 293, 782, 440, 782, 296, 297, 782, 299, -34, -541,
2134 301, 303, 782, 782, -34, 304, 318, 1458, 151, 319,
2135 321, -43, 1362, 1362, 1362, 1362, -541, -541, 295, 1362,
2136 1362, 1458, -541, -541, -541, 279, 1304, -541, 322, -541,
2137 782, 782, 1574, 782, 782, 318, -541, 318, 1458, 782,
2138 323, 1458, 1458, 1458, -541, -541, 1574, 399, -541, 645,
2139 -541, 1362, 1362, -541, 324, 305, 326, 327, -541, 325,
2140 329, 157, -541, -541, -541, -34, 81, 436, 332, 330,
2141 9, -34, 47, -541, -541, -541, -541, -541, 334, 782,
2142 -541, -541, -541, 96, 318, 336, 338, 1362, -541, 1362,
2143 1362, -541, -541, -541, 279, -541, 407, -541, 444, -6,
2144 505, 505, 1614, -541, -541, 337, -541, -541, -541, -541,
2145 339, 342, 343, -541, 459, 341, 782, -541, 943, -2,
2146 331, 348, -541, -541, 9, -34, 109, -541, 137, -541,
2147 -541, -541, -541, 442, -541, -541, 352, -541, 943, -36,
2148 -36, 505, 505, 470, -541, 486, 354, -541, -541, 782,
2149 782, 488, -36, -36, 435, -541, 782, 490, -541, 782,
2150 -541
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002151};
2152
2153/* YYPGOTO[NTERM-NUM]. */
2154static const yytype_int16 yypgoto[] =
2155{
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002156 -541, 381, 382, 387, 270, 271, -170, -541, 0, -24,
2157 426, 8, -541, -541, -541, -541, 56, -541, -541, -541,
2158 -161, -541, -393, -541, -217, -541, -541, -292, 5, -541,
2159 -310, -541, -541, -26, 298, -120, -541, 411, 430, -115,
2160 -157, -235, 94, 130, 312, -541, -541, 519, -541, -541,
2161 -541, -541, -541, -541, -541, -541, -541, -541, -541, 448,
2162 -541, -541, -541, -541, -541, -541, -540, -111, -51, -179,
2163 -541, 482, -541, -541, -541, -541, -541, 46, 133, -541,
2164 -541, -541, -541
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002165};
2166
2167/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2168 positive, shift that token. If negative, reduce the rule which
2169 number is the opposite. If zero, do what YYDEFACT says.
2170 If YYTABLE_NINF, syntax error. */
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002171#define YYTABLE_NINF -206
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002172static const yytype_int16 yytable[] =
2173{
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002174 11, 81, 272, 261, 161, 271, 163, 104, 13, 271,
2175 90, 383, 273, 164, 24, 335, 304, 11, 93, 25,
2176 350, 352, 441, 443, 26, 13, 405, 406, 586, 43,
2177 233, 308, 309, 310, 311, 312, 425, 475, 315, 236,
2178 21, 142, 142, -55, -55, -55, -55, 415, 596, 262,
2179 415, 108, 143, 230, 22, 426, 420, 110, 316, 111,
2180 45, 421, 46, 332, 442, 442, 237, 238, 29, 30,
2181 31, 32, 33, 34, 35, 134, 36, 415, 415, 108,
2182 28, 319, 320, 269, 131, 134, 415, 479, 468, 270,
2183 149, 132, 11, 416, 117, 118, 83, 84, 321, 322,
2184 149, 323, 324, 88, 325, 326, 327, 488, 85, 89,
2185 86, 503, 227, 228, 419, 425, 231, 110, 474, 111,
2186 234, 110, 544, 111, 27, 63, 64, 550, 551, 333,
2187 49, 50, 51, 2, 435, 52, 4, 1, 2, 397,
2188 3, 4, 5, 1, 267, 165, 3, 593, 5, 61,
2189 94, 567, 114, 377, 115, 587, 372, 97, 372, 372,
2190 -141, 372, -141, 105, 498, 317, 318, 302, 303, 267,
2191 305, 264, 37, 38, 39, 239, 240, 241, 242, 589,
2192 590, 591, 592, 306, 267, 267, 267, 267, 267, 313,
2193 314, 267, 57, 525, 372, 526, 395, 552, 58, 134,
2194 59, 553, 372, 372, 602, 603, 145, 146, 447, 149,
2195 449, 450, 451, 112, 113, 398, 399, 400, 374, 375,
2196 401, 376, 90, 101, 402, 403, 410, 411, 412, 413,
2197 414, 120, 121, 122, 123, 124, 125, 98, 99, 422,
2198 423, 424, 557, 398, 399, 400, 552, 149, 401, 102,
2199 556, 103, 402, 403, 384, 110, 86, 111, 378, 385,
2200 516, 261, 392, 393, 138, 162, 372, 372, 372, 225,
2201 139, 398, 399, 400, 372, 379, 401, 37, 38, 39,
2202 402, 403, 223, 226, 372, 372, 380, 110, 232, 111,
2203 149, 396, 267, 459, 460, 235, 382, 110, 1, 111,
2204 466, 3, 110, 5, 111, 500, 229, 262, 110, 527,
2205 111, 543, 530, 531, 532, -56, -57, -60, -59, -58,
2206 243, 265, 334, 418, 353, 271, 438, 439, 440, 341,
2207 372, 342, 372, 430, 445, 372, 576, 343, 344, 578,
2208 345, 372, 372, 354, 455, 456, 355, 504, 505, 506,
2209 507, 356, 357, 359, 509, 510, 386, 387, 388, 389,
2210 390, 267, 448, 267, 267, 267, 394, 391, 454, 372,
2211 372, 407, 372, 372, 408, 409, 433, 436, 372, 568,
2212 437, 458, 452, 446, 453, 457, 535, 536, 372, 462,
2213 485, 463, 487, 464, 465, 490, 319, 320, 469, 588,
2214 470, 494, 495, 274, 275, 276, 277, 278, 279, 280,
2215 281, 282, 283, 321, 322, 467, 323, 324, 372, 325,
2216 326, 327, 560, 471, 561, 562, 472, 473, 476, 518,
2217 519, 499, 523, 524, 477, 478, 480, 481, 528, 372,
2218 372, 482, 483, 484, 486, 511, 488, 489, 534, 491,
2219 515, 492, 442, 493, 508, 372, 521, 496, 547, 538,
2220 564, 566, 267, 582, 594, 267, 267, 267, 497, 501,
2221 521, 502, 517, 529, 537, 512, 539, 540, 555, 541,
2222 372, 372, 548, 542, -18, 549, 583, 599, 372, 372,
2223 558, 554, 559, 579, 577, 372, 580, 581, 372, 572,
2224 573, -19, 595, 600, 601, 606, 607, 609, 360, 361,
2225 215, 216, 63, 64, 362, 585, 217, 339, 129, 340,
2226 563, 545, 144, 330, 1, 2, 575, 3, 4, 5,
2227 363, 364, 365, 285, 286, 141, 44, 128, 96, 0,
2228 597, 598, 533, 461, 512, 366, 367, 338, 604, 605,
2229 0, 0, 0, 0, 0, 608, 0, 0, 610, 0,
2230 63, 64, 368, 106, 66, 67, 68, 69, 70, 71,
2231 72, 0, 1, 2, 0, 3, 4, 5, 176, 177,
2232 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
2233 188, 189, 190, 247, 248, 0, 0, 0, 0, 0,
2234 0, 0, 73, 287, 288, 289, 290, 291, 292, 293,
2235 294, 295, 296, 297, 298, 299, 300, 0, 0, 0,
2236 249, 197, 570, 571, 200, 201, 202, 203, 204, 205,
2237 206, 207, 208, 0, 250, 0, 251, 252, 253, 321,
2238 322, 0, 323, 324, 0, 325, 326, 327, 360, 361,
2239 0, 0, 63, 64, 362, 0, 0, 0, -205, 0,
2240 0, 0, 0, 369, 1, 2, 0, 3, 4, 5,
2241 363, 364, 365, 0, 0, 0, -67, 1, 2, 0,
2242 3, 4, 5, 0, 0, 366, 367, 0, 6, 7,
2243 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2244 0, 0, 368, 0, 0, 74, 0, 0, 75, 8,
2245 0, 76, 9, 77, 107, 0, 10, 0, 176, 177,
2246 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
2247 188, 189, 190, 247, 248, 0, 0, 0, 0, 0,
2248 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2249 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2250 249, 197, 198, 199, 200, 201, 202, 203, 204, 205,
2251 206, 207, 208, 0, 250, 0, 251, 252, 253, 0,
2252 0, 0, 0, 0, 0, 360, 361, 0, 0, 63,
2253 64, 362, 0, 0, 0, 0, 110, 0, 111, 0,
2254 0, 1, 2, 369, 3, 4, 5, 363, 364, 365,
2255 0, 0, 63, 64, 0, 0, 0, 0, 0, 0,
2256 0, 0, 366, 367, 1, 2, 0, 3, 4, 5,
2257 244, 0, 0, 0, 0, 0, 0, 0, 0, 368,
2258 0, 0, 0, 0, 0, 245, 246, 0, 0, 0,
2259 0, 0, 0, 0, 0, 176, 177, 178, 179, 180,
2260 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
2261 247, 248, 0, 0, 0, 0, 0, 0, 176, 177,
2262 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
2263 188, 189, 190, 247, 248, 0, 0, 249, 197, 198,
2264 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,
2265 0, 250, 0, 251, 252, 253, 0, 0, 0, 0,
2266 249, 197, 198, 199, 200, 201, 202, 203, 204, 205,
2267 206, 207, 208, 0, 250, 0, 251, 252, 253, 0,
2268 369, 0, 0, 0, 0, 0, 360, 361, 0, 0,
2269 0, 0, 362, 0, 0, 0, 110, 0, 111, 0,
2270 254, 0, 0, 255, 0, 256, 0, 257, 363, 364,
2271 365, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2272 0, 0, 0, 366, 367, 0, 0, 0, 0, 0,
2273 0, 0, 0, 0, 0, 0, 0, 0, 63, 64,
2274 368, 106, 66, 67, 68, 69, 70, 71, 72, 0,
2275 1, 2, 0, 3, 4, 5, 176, 177, 178, 179,
Duncan Sandsf5588dc2007-11-27 13:23:08 +00002276 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002277 190, 247, 248, 0, 0, 0, 0, 0, 63, 64,
2278 73, 106, 152, 153, 154, 155, 156, 157, 72, 0,
2279 1, 2, 0, 3, 4, 5, 0, 0, 249, 197,
Duncan Sandsf5588dc2007-11-27 13:23:08 +00002280 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002281 208, 0, 250, 0, 251, 252, 253, 0, 63, 64,
2282 73, 106, 152, 153, 154, 155, 156, 157, 72, 0,
2283 1, 2, 0, 3, 4, 5, 0, 0, 0, 63,
2284 64, 369, 106, 66, 67, 68, 69, 70, 71, 72,
Duncan Sandsf5588dc2007-11-27 13:23:08 +00002285 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002286 73, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2287 0, 133, 0, 0, 0, 0, 0, 0, 0, 0,
Duncan Sandsf5588dc2007-11-27 13:23:08 +00002288 0, 73, 0, 74, 0, 0, 75, 0, 0, 76,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002289 0, 77, 140, 63, 64, 0, 147, 66, 67, 68,
2290 69, 70, 71, 72, 0, 1, 2, 0, 3, 4,
2291 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Duncan Sandsf5588dc2007-11-27 13:23:08 +00002292 0, 0, 0, 74, 0, 0, 75, 0, 0, 76,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002293 0, 77, 351, 63, 64, 73, 106, 66, 67, 68,
2294 69, 70, 71, 72, 0, 1, 2, 0, 3, 4,
2295 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2296 0, 0, 0, 74, 0, 329, 75, 0, 0, 76,
2297 0, 77, 417, 0, 0, 73, 0, 0, 0, 0,
2298 0, 0, 0, 0, 74, 0, 0, 75, 0, 0,
2299 76, 0, 77, 63, 64, 0, 106, 152, 153, 154,
2300 155, 156, 157, 72, 0, 1, 2, 148, 3, 4,
2301 5, 63, 64, 0, 106, 66, 67, 68, 69, 70,
Duncan Sandsf5588dc2007-11-27 13:23:08 +00002302 71, 72, 0, 1, 2, 0, 3, 4, 5, 0,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002303 0, 0, 0, 0, 0, 73, 0, 0, 74, 0,
2304 0, 75, 0, 429, 76, 0, 77, 0, 0, 0,
2305 0, 63, 64, 73, 106, 66, 67, 68, 69, 70,
Duncan Sandsf5588dc2007-11-27 13:23:08 +00002306 71, 72, 0, 1, 2, 0, 3, 4, 5, 0,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002307 0, 0, 0, 0, 0, 0, 0, 0, 74, 0,
2308 0, 75, 0, 514, 76, 0, 77, 0, 0, 0,
2309 0, 63, 64, 73, 65, 66, 67, 68, 69, 70,
2310 71, 72, 0, 1, 2, 0, 3, 4, 5, 63,
2311 64, 0, 106, 152, 153, 154, 155, 156, 157, 72,
2312 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2313 0, 0, 0, 73, 0, 0, 0, 0, 74, 0,
2314 0, 75, 0, 346, 76, 0, 77, 0, 0, 0,
2315 0, 73, 0, 0, 0, 0, 74, 0, 0, 75,
2316 0, 0, 76, 0, 77, 63, 64, 0, 147, 66,
2317 67, 68, 69, 70, 71, 72, 0, 1, 2, 0,
2318 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
2319 0, 0, 0, 0, 0, 0, 74, 0, 0, 75,
2320 0, 0, 76, 0, 77, 63, 64, 73, 106, 66,
2321 67, 68, 69, 70, 71, 72, 0, 1, 2, 0,
2322 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
2323 0, 0, 0, 0, 0, 0, 74, 0, 0, 75,
2324 0, 0, 76, 0, 77, 0, 0, 73, 0, 0,
2325 0, 0, 0, 0, 74, 0, 0, 75, 0, 0,
2326 76, 0, 77, 63, 64, 0, 266, 66, 67, 68,
2327 69, 70, 71, 72, 0, 1, 2, 0, 3, 4,
2328 5, 63, 64, 0, 106, 152, 153, 154, 155, 156,
2329 157, 72, 0, 1, 2, 0, 3, 4, 5, 0,
2330 0, 0, 0, 0, 0, 73, 0, 0, 0, 0,
2331 74, 0, 0, 75, 0, 0, 76, 0, 77, 0,
2332 0, 63, 64, 73, 106, 66, 67, 68, 69, 70,
2333 71, 520, 0, 1, 2, 0, 3, 4, 5, 0,
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002334 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002335 74, 0, 0, 75, 0, 0, 76, 0, 77, 0,
2336 0, 63, 64, 73, 106, 66, 67, 68, 69, 70,
2337 71, 574, 0, 1, 2, 0, 3, 4, 5, 0,
Duncan Sandsf5588dc2007-11-27 13:23:08 +00002338 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Duncan Sandsf5588dc2007-11-27 13:23:08 +00002339 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002340 0, 0, 0, 73, 167, 0, 0, 0, 74, 0,
2341 0, 75, 0, 0, 76, 0, 77, 0, 0, 0,
2342 0, 0, 0, 168, 169, 0, 74, 0, 0, 75,
2343 0, 0, 76, 0, 349, 170, 171, 172, 173, 174,
2344 175, 176, 177, 178, 179, 180, 181, 182, 183, 184,
2345 185, 186, 187, 188, 189, 190, 191, 192, 0, 0,
2346 0, 0, 0, 0, 0, 0, 74, 0, 0, 75,
2347 0, 0, 76, 0, 77, 0, 0, 0, 193, 194,
2348 195, 0, 0, 196, 197, 198, 199, 200, 201, 202,
2349 203, 204, 205, 206, 207, 208, 209, 210, 211, 212,
2350 213, 214, -204, 0, 0, 0, 74, 0, 0, 75,
2351 0, 0, 76, 0, 77, 0, 0, 0, 0, 0,
2352 -67, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2353 0, 0, 6, 7, 0, 0, 0, 0, 0, 0,
2354 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2355 0, 0, 0, 8, 0, 0, 9, 0, 0, 0,
2356 10
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002357};
2358
2359static const yytype_int16 yycheck[] =
2360{
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002361 0, 27, 172, 160, 119, 11, 126, 4, 0, 11,
2362 21, 303, 173, 28, 149, 232, 195, 17, 29, 57,
2363 255, 256, 11, 11, 149, 17, 336, 337, 568, 0,
2364 145, 210, 211, 212, 213, 214, 34, 430, 217, 150,
2365 52, 150, 150, 3, 4, 5, 6, 150, 588, 160,
2366 150, 77, 161, 161, 66, 53, 159, 151, 219, 153,
2367 46, 161, 48, 157, 53, 53, 26, 27, 42, 43,
2368 44, 45, 46, 47, 48, 101, 50, 150, 150, 105,
2369 149, 117, 118, 11, 150, 111, 150, 159, 161, 17,
2370 116, 157, 92, 157, 32, 33, 40, 41, 134, 135,
2371 126, 137, 138, 47, 140, 141, 142, 150, 35, 53,
2372 37, 154, 138, 139, 349, 34, 142, 151, 428, 153,
2373 146, 151, 515, 153, 18, 7, 8, 520, 521, 159,
2374 42, 43, 44, 20, 369, 47, 23, 19, 20, 318,
2375 22, 23, 24, 19, 170, 160, 22, 38, 24, 22,
2376 161, 157, 42, 273, 44, 157, 267, 22, 269, 270,
2377 151, 272, 153, 160, 456, 113, 114, 193, 194, 195,
2378 196, 163, 146, 147, 148, 3, 4, 5, 6, 572,
2379 573, 574, 575, 209, 210, 211, 212, 213, 214, 215,
2380 216, 217, 149, 485, 305, 487, 316, 150, 149, 225,
2381 155, 154, 313, 314, 597, 598, 112, 113, 387, 235,
2382 389, 390, 391, 83, 84, 134, 135, 136, 269, 270,
2383 139, 272, 21, 153, 143, 144, 341, 342, 343, 344,
2384 345, 60, 61, 62, 63, 64, 65, 22, 22, 354,
2385 355, 356, 534, 134, 135, 136, 150, 273, 139, 4,
2386 154, 4, 143, 144, 305, 151, 37, 153, 284, 155,
2387 477, 418, 313, 314, 156, 4, 377, 378, 379, 150,
2388 156, 134, 135, 136, 385, 301, 139, 146, 147, 148,
2389 143, 144, 22, 154, 395, 396, 150, 151, 154, 153,
2390 316, 317, 318, 408, 409, 153, 150, 151, 19, 153,
2391 415, 22, 151, 24, 153, 154, 159, 418, 151, 488,
2392 153, 154, 491, 492, 493, 9, 9, 9, 9, 9,
2393 9, 55, 159, 349, 22, 11, 377, 378, 379, 153,
2394 441, 153, 443, 359, 385, 446, 553, 153, 153, 556,
2395 153, 452, 453, 153, 395, 396, 153, 462, 463, 464,
2396 465, 153, 150, 153, 469, 470, 150, 150, 150, 150,
2397 150, 387, 388, 389, 390, 391, 38, 150, 394, 480,
2398 481, 38, 483, 484, 153, 153, 59, 150, 489, 549,
2399 150, 407, 150, 155, 150, 150, 501, 502, 499, 150,
2400 441, 150, 443, 150, 150, 446, 117, 118, 150, 569,
2401 150, 452, 453, 90, 91, 92, 93, 94, 95, 96,
2402 97, 98, 99, 134, 135, 159, 137, 138, 529, 140,
2403 141, 142, 537, 38, 539, 540, 22, 4, 150, 480,
2404 481, 457, 483, 484, 154, 22, 17, 17, 489, 550,
2405 551, 153, 150, 150, 4, 471, 150, 150, 499, 150,
2406 476, 150, 53, 150, 159, 566, 482, 153, 22, 154,
2407 53, 17, 488, 4, 22, 491, 492, 493, 150, 150,
2408 496, 150, 150, 150, 150, 475, 150, 150, 529, 154,
2409 591, 592, 150, 154, 153, 155, 145, 17, 599, 600,
2410 154, 157, 154, 154, 157, 606, 154, 154, 609, 550,
2411 551, 153, 150, 17, 150, 17, 71, 17, 3, 4,
2412 129, 129, 7, 8, 9, 566, 129, 247, 92, 248,
2413 544, 516, 111, 225, 19, 20, 552, 22, 23, 24,
2414 25, 26, 27, 26, 27, 105, 17, 89, 56, -1,
2415 591, 592, 496, 410, 544, 40, 41, 235, 599, 600,
2416 -1, -1, -1, -1, -1, 606, -1, -1, 609, -1,
2417 7, 8, 57, 10, 11, 12, 13, 14, 15, 16,
2418 17, -1, 19, 20, -1, 22, 23, 24, 73, 74,
2419 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2420 85, 86, 87, 88, 89, -1, -1, -1, -1, -1,
2421 -1, -1, 49, 96, 97, 98, 99, 100, 101, 102,
2422 103, 104, 105, 106, 107, 108, 109, -1, -1, -1,
2423 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
2424 125, 126, 127, -1, 129, -1, 131, 132, 133, 134,
2425 135, -1, 137, 138, -1, 140, 141, 142, 3, 4,
2426 -1, -1, 7, 8, 9, -1, -1, -1, 0, -1,
2427 -1, -1, -1, 158, 19, 20, -1, 22, 23, 24,
2428 25, 26, 27, -1, -1, -1, 18, 19, 20, -1,
2429 22, 23, 24, -1, -1, 40, 41, -1, 30, 31,
2430 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2431 -1, -1, 57, -1, -1, 152, -1, -1, 155, 51,
2432 -1, 158, 54, 160, 161, -1, 58, -1, 73, 74,
2433 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2434 85, 86, 87, 88, 89, -1, -1, -1, -1, -1,
2435 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2436 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2437 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
2438 125, 126, 127, -1, 129, -1, 131, 132, 133, -1,
2439 -1, -1, -1, -1, -1, 3, 4, -1, -1, 7,
2440 8, 9, -1, -1, -1, -1, 151, -1, 153, -1,
2441 -1, 19, 20, 158, 22, 23, 24, 25, 26, 27,
2442 -1, -1, 7, 8, -1, -1, -1, -1, -1, -1,
2443 -1, -1, 40, 41, 19, 20, -1, 22, 23, 24,
2444 25, -1, -1, -1, -1, -1, -1, -1, -1, 57,
2445 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
2446 -1, -1, -1, -1, -1, 73, 74, 75, 76, 77,
2447 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2448 88, 89, -1, -1, -1, -1, -1, -1, 73, 74,
2449 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2450 85, 86, 87, 88, 89, -1, -1, 115, 116, 117,
2451 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2452 -1, 129, -1, 131, 132, 133, -1, -1, -1, -1,
2453 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
2454 125, 126, 127, -1, 129, -1, 131, 132, 133, -1,
2455 158, -1, -1, -1, -1, -1, 3, 4, -1, -1,
2456 -1, -1, 9, -1, -1, -1, 151, -1, 153, -1,
2457 155, -1, -1, 158, -1, 160, -1, 162, 25, 26,
2458 27, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Duncan Sandsf5588dc2007-11-27 13:23:08 +00002459 -1, -1, -1, 40, 41, -1, -1, -1, -1, -1,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002460 -1, -1, -1, -1, -1, -1, -1, -1, 7, 8,
2461 57, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2462 19, 20, -1, 22, 23, 24, 73, 74, 75, 76,
Duncan Sandsf5588dc2007-11-27 13:23:08 +00002463 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002464 87, 88, 89, -1, -1, -1, -1, -1, 7, 8,
2465 49, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2466 19, 20, -1, 22, 23, 24, -1, -1, 115, 116,
Duncan Sandsf5588dc2007-11-27 13:23:08 +00002467 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002468 127, -1, 129, -1, 131, 132, 133, -1, 7, 8,
2469 49, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2470 19, 20, -1, 22, 23, 24, -1, -1, -1, 7,
2471 8, 158, 10, 11, 12, 13, 14, 15, 16, 17,
2472 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2473 49, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2474 -1, 39, -1, -1, -1, -1, -1, -1, -1, -1,
2475 -1, 49, -1, 152, -1, -1, 155, -1, -1, 158,
2476 -1, 160, 161, 7, 8, -1, 10, 11, 12, 13,
2477 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2478 24, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2479 -1, -1, -1, 152, -1, -1, 155, -1, -1, 158,
2480 -1, 160, 161, 7, 8, 49, 10, 11, 12, 13,
2481 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2482 24, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2483 -1, -1, -1, 152, -1, 39, 155, -1, -1, 158,
2484 -1, 160, 161, -1, -1, 49, -1, -1, -1, -1,
2485 -1, -1, -1, -1, 152, -1, -1, 155, -1, -1,
2486 158, -1, 160, 7, 8, -1, 10, 11, 12, 13,
2487 14, 15, 16, 17, -1, 19, 20, 121, 22, 23,
2488 24, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2489 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2490 -1, -1, -1, -1, -1, 49, -1, -1, 152, -1,
2491 -1, 155, -1, 39, 158, -1, 160, -1, -1, -1,
2492 -1, 7, 8, 49, 10, 11, 12, 13, 14, 15,
2493 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2494 -1, -1, -1, -1, -1, -1, -1, -1, 152, -1,
2495 -1, 155, -1, 39, 158, -1, 160, -1, -1, -1,
2496 -1, 7, 8, 49, 10, 11, 12, 13, 14, 15,
2497 16, 17, -1, 19, 20, -1, 22, 23, 24, 7,
Duncan Sandsf5588dc2007-11-27 13:23:08 +00002498 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2499 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002500 -1, -1, -1, 49, -1, -1, -1, -1, 152, -1,
2501 -1, 155, -1, 157, 158, -1, 160, -1, -1, -1,
2502 -1, 49, -1, -1, -1, -1, 152, -1, -1, 155,
2503 -1, -1, 158, -1, 160, 7, 8, -1, 10, 11,
2504 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2505 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
2506 -1, -1, -1, -1, -1, -1, 152, -1, -1, 155,
2507 -1, -1, 158, -1, 160, 7, 8, 49, 10, 11,
2508 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2509 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
2510 -1, -1, -1, -1, -1, -1, 152, -1, -1, 155,
2511 -1, -1, 158, -1, 160, -1, -1, 49, -1, -1,
2512 -1, -1, -1, -1, 152, -1, -1, 155, -1, -1,
2513 158, -1, 160, 7, 8, -1, 10, 11, 12, 13,
2514 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2515 24, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2516 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2517 -1, -1, -1, -1, -1, 49, -1, -1, -1, -1,
2518 152, -1, -1, 155, -1, -1, 158, -1, 160, -1,
2519 -1, 7, 8, 49, 10, 11, 12, 13, 14, 15,
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002520 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2521 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002522 152, -1, -1, 155, -1, -1, 158, -1, 160, -1,
2523 -1, 7, 8, 49, 10, 11, 12, 13, 14, 15,
Duncan Sandsf5588dc2007-11-27 13:23:08 +00002524 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2525 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Duncan Sandsf5588dc2007-11-27 13:23:08 +00002526 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002527 -1, -1, -1, 49, 36, -1, -1, -1, 152, -1,
2528 -1, 155, -1, -1, 158, -1, 160, -1, -1, -1,
2529 -1, -1, -1, 55, 56, -1, 152, -1, -1, 155,
2530 -1, -1, 158, -1, 160, 67, 68, 69, 70, 71,
2531 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
2532 82, 83, 84, 85, 86, 87, 88, 89, -1, -1,
2533 -1, -1, -1, -1, -1, -1, 152, -1, -1, 155,
2534 -1, -1, 158, -1, 160, -1, -1, -1, 110, 111,
2535 112, -1, -1, 115, 116, 117, 118, 119, 120, 121,
2536 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
2537 132, 133, 0, -1, -1, -1, 152, -1, -1, 155,
2538 -1, -1, 158, -1, 160, -1, -1, -1, -1, -1,
2539 18, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2540 -1, -1, 30, 31, -1, -1, -1, -1, -1, -1,
Duncan Sandsf5588dc2007-11-27 13:23:08 +00002541 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002542 -1, -1, -1, 51, -1, -1, 54, -1, -1, -1,
2543 58
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002544};
2545
2546/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2547 symbol of state STATE-NUM. */
2548static const yytype_uint8 yystos[] =
2549{
2550 0, 19, 20, 22, 23, 24, 30, 31, 51, 54,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002551 58, 171, 173, 174, 175, 176, 208, 209, 210, 212,
2552 211, 52, 66, 217, 149, 57, 149, 18, 149, 42,
2553 43, 44, 45, 46, 47, 48, 50, 146, 147, 148,
2554 177, 178, 179, 0, 210, 46, 48, 180, 227, 42,
2555 43, 44, 47, 181, 224, 226, 233, 149, 149, 155,
2556 218, 22, 216, 7, 8, 10, 11, 12, 13, 14,
2557 15, 16, 17, 49, 152, 155, 158, 160, 171, 174,
2558 195, 196, 230, 179, 179, 35, 37, 206, 179, 179,
2559 21, 234, 235, 29, 161, 225, 234, 22, 22, 22,
2560 219, 153, 4, 4, 4, 160, 10, 161, 196, 201,
2561 151, 153, 206, 206, 42, 44, 182, 32, 33, 205,
2562 60, 61, 62, 63, 64, 65, 183, 222, 222, 173,
2563 238, 150, 157, 39, 196, 197, 199, 200, 156, 156,
2564 161, 201, 150, 161, 200, 205, 205, 10, 121, 196,
2565 198, 207, 11, 12, 13, 14, 15, 16, 169, 170,
2566 196, 202, 4, 198, 28, 160, 223, 36, 55, 56,
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002567 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
2568 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2569 87, 88, 89, 110, 111, 112, 115, 116, 117, 118,
2570 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002571 129, 130, 131, 132, 133, 164, 165, 166, 236, 242,
2572 243, 244, 245, 22, 185, 150, 154, 196, 196, 159,
2573 161, 196, 154, 202, 196, 153, 230, 26, 27, 3,
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002574 4, 5, 6, 9, 25, 40, 41, 88, 89, 115,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002575 129, 131, 132, 133, 155, 158, 160, 162, 164, 165,
2576 166, 203, 230, 213, 174, 55, 10, 196, 232, 11,
2577 17, 11, 169, 183, 90, 91, 92, 93, 94, 95,
2578 96, 97, 98, 99, 167, 26, 27, 96, 97, 98,
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002579 99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002580 109, 168, 196, 196, 232, 196, 196, 239, 232, 232,
2581 232, 232, 232, 196, 196, 232, 183, 113, 114, 117,
2582 118, 134, 135, 137, 138, 140, 141, 142, 184, 39,
2583 197, 187, 157, 159, 159, 187, 214, 215, 207, 167,
2584 168, 153, 153, 153, 153, 153, 157, 202, 204, 160,
2585 204, 161, 204, 22, 153, 153, 153, 150, 193, 153,
2586 3, 4, 9, 25, 26, 27, 40, 41, 57, 158,
2587 203, 229, 230, 231, 231, 231, 231, 198, 196, 196,
2588 150, 190, 150, 190, 231, 155, 150, 150, 150, 150,
2589 150, 150, 231, 231, 38, 198, 196, 232, 134, 135,
2590 136, 139, 143, 144, 186, 193, 193, 38, 153, 153,
2591 202, 202, 202, 202, 202, 150, 157, 161, 196, 204,
2592 159, 161, 202, 202, 202, 34, 53, 191, 194, 39,
2593 196, 220, 221, 59, 228, 204, 150, 150, 231, 231,
2594 231, 11, 53, 11, 241, 231, 155, 232, 196, 232,
2595 232, 232, 150, 150, 196, 231, 231, 150, 196, 202,
2596 202, 241, 150, 150, 150, 150, 202, 159, 161, 150,
2597 150, 38, 22, 4, 193, 185, 150, 154, 22, 159,
2598 17, 17, 153, 150, 150, 231, 4, 231, 150, 150,
2599 231, 150, 150, 150, 231, 231, 153, 150, 190, 196,
2600 154, 150, 150, 154, 202, 202, 202, 202, 159, 202,
2601 202, 196, 171, 172, 39, 196, 187, 150, 231, 231,
2602 17, 196, 240, 231, 231, 190, 190, 232, 231, 150,
2603 232, 232, 232, 240, 231, 202, 202, 150, 154, 150,
2604 150, 154, 154, 154, 185, 191, 192, 22, 150, 155,
2605 185, 185, 150, 154, 157, 231, 154, 190, 154, 154,
2606 202, 202, 202, 172, 53, 189, 17, 157, 169, 237,
2607 117, 118, 231, 231, 17, 196, 187, 157, 187, 154,
2608 154, 154, 4, 145, 188, 231, 229, 157, 169, 185,
2609 185, 185, 185, 38, 22, 150, 229, 231, 231, 17,
2610 17, 150, 185, 185, 231, 231, 17, 71, 231, 17,
2611 231
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002612};
David Greene9145dd22007-08-01 03:59:32 +00002613
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002614#define yyerrok (yyerrstatus = 0)
2615#define yyclearin (yychar = YYEMPTY)
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002616#define YYEMPTY (-2)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002617#define YYEOF 0
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002618
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002619#define YYACCEPT goto yyacceptlab
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002620#define YYABORT goto yyabortlab
2621#define YYERROR goto yyerrorlab
2622
2623
2624/* Like YYERROR except do call yyerror. This remains here temporarily
2625 to ease the transition to the new meaning of YYERROR, for GCC.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002626 Once GCC version 2 has supplanted version 1, this can go. */
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002627
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002628#define YYFAIL goto yyerrlab
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002629
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002630#define YYRECOVERING() (!!yyerrstatus)
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002631
2632#define YYBACKUP(Token, Value) \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002633do \
2634 if (yychar == YYEMPTY && yylen == 1) \
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002635 { \
2636 yychar = (Token); \
2637 yylval = (Value); \
2638 yytoken = YYTRANSLATE (yychar); \
2639 YYPOPSTACK (1); \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002640 goto yybackup; \
2641 } \
2642 else \
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002643 { \
2644 yyerror (YY_("syntax error: cannot back up")); \
2645 YYERROR; \
2646 } \
2647while (YYID (0))
2648
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002649
2650#define YYTERROR 1
2651#define YYERRCODE 256
2652
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002653
2654/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2655 If N is 0, then set CURRENT to the empty location which ends
2656 the previous symbol: RHS[0] (always defined). */
2657
2658#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2659#ifndef YYLLOC_DEFAULT
2660# define YYLLOC_DEFAULT(Current, Rhs, N) \
2661 do \
2662 if (YYID (N)) \
2663 { \
2664 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2665 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2666 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2667 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2668 } \
2669 else \
2670 { \
2671 (Current).first_line = (Current).last_line = \
2672 YYRHSLOC (Rhs, 0).last_line; \
2673 (Current).first_column = (Current).last_column = \
2674 YYRHSLOC (Rhs, 0).last_column; \
2675 } \
2676 while (YYID (0))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002677#endif
2678
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002679
2680/* YY_LOCATION_PRINT -- Print the location on the stream.
2681 This macro was not mandated originally: define only if we know
2682 we won't break user code: when these are the locations we know. */
2683
2684#ifndef YY_LOCATION_PRINT
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00002685# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002686# define YY_LOCATION_PRINT(File, Loc) \
2687 fprintf (File, "%d.%d-%d.%d", \
2688 (Loc).first_line, (Loc).first_column, \
2689 (Loc).last_line, (Loc).last_column)
2690# else
2691# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2692# endif
2693#endif
2694
2695
2696/* YYLEX -- calling `yylex' with the right arguments. */
2697
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002698#ifdef YYLEX_PARAM
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002699# define YYLEX yylex (YYLEX_PARAM)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002700#else
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002701# define YYLEX yylex ()
Dale Johannesen3afee192007-09-07 21:07:57 +00002702#endif
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002703
2704/* Enable debugging if requested. */
2705#if YYDEBUG
2706
2707# ifndef YYFPRINTF
2708# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2709# define YYFPRINTF fprintf
2710# endif
2711
2712# define YYDPRINTF(Args) \
2713do { \
2714 if (yydebug) \
2715 YYFPRINTF Args; \
2716} while (YYID (0))
2717
2718# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2719do { \
2720 if (yydebug) \
2721 { \
2722 YYFPRINTF (stderr, "%s ", Title); \
2723 yy_symbol_print (stderr, \
2724 Type, Value); \
2725 YYFPRINTF (stderr, "\n"); \
2726 } \
2727} while (YYID (0))
2728
2729
2730/*--------------------------------.
2731| Print this symbol on YYOUTPUT. |
2732`--------------------------------*/
2733
2734/*ARGSUSED*/
2735#if (defined __STDC__ || defined __C99__FUNC__ \
2736 || defined __cplusplus || defined _MSC_VER)
2737static void
2738yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
Dale Johannesen3afee192007-09-07 21:07:57 +00002739#else
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002740static void
2741yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2742 FILE *yyoutput;
2743 int yytype;
2744 YYSTYPE const * const yyvaluep;
Dale Johannesen3afee192007-09-07 21:07:57 +00002745#endif
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002746{
2747 if (!yyvaluep)
2748 return;
2749# ifdef YYPRINT
2750 if (yytype < YYNTOKENS)
2751 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2752# else
2753 YYUSE (yyoutput);
2754# endif
2755 switch (yytype)
2756 {
2757 default:
2758 break;
2759 }
2760}
2761
2762
2763/*--------------------------------.
2764| Print this symbol on YYOUTPUT. |
2765`--------------------------------*/
2766
2767#if (defined __STDC__ || defined __C99__FUNC__ \
2768 || defined __cplusplus || defined _MSC_VER)
2769static void
2770yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2771#else
2772static void
2773yy_symbol_print (yyoutput, yytype, yyvaluep)
2774 FILE *yyoutput;
2775 int yytype;
2776 YYSTYPE const * const yyvaluep;
Chris Lattnerbb856a32007-08-06 21:00:46 +00002777#endif
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002778{
2779 if (yytype < YYNTOKENS)
2780 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2781 else
2782 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
David Greene48556392007-09-04 18:46:50 +00002783
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002784 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2785 YYFPRINTF (yyoutput, ")");
2786}
David Greene48556392007-09-04 18:46:50 +00002787
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002788/*------------------------------------------------------------------.
2789| yy_stack_print -- Print the state stack from its BOTTOM up to its |
2790| TOP (included). |
2791`------------------------------------------------------------------*/
David Greene48556392007-09-04 18:46:50 +00002792
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002793#if (defined __STDC__ || defined __C99__FUNC__ \
2794 || defined __cplusplus || defined _MSC_VER)
2795static void
2796yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
2797#else
2798static void
2799yy_stack_print (bottom, top)
2800 yytype_int16 *bottom;
2801 yytype_int16 *top;
Chris Lattnerbb856a32007-08-06 21:00:46 +00002802#endif
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002803{
2804 YYFPRINTF (stderr, "Stack now");
2805 for (; bottom <= top; ++bottom)
2806 YYFPRINTF (stderr, " %d", *bottom);
2807 YYFPRINTF (stderr, "\n");
2808}
David Greene48556392007-09-04 18:46:50 +00002809
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002810# define YY_STACK_PRINT(Bottom, Top) \
2811do { \
2812 if (yydebug) \
2813 yy_stack_print ((Bottom), (Top)); \
2814} while (YYID (0))
David Greene48556392007-09-04 18:46:50 +00002815
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002816
2817/*------------------------------------------------.
2818| Report that the YYRULE is going to be reduced. |
2819`------------------------------------------------*/
2820
2821#if (defined __STDC__ || defined __C99__FUNC__ \
2822 || defined __cplusplus || defined _MSC_VER)
2823static void
2824yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
2825#else
2826static void
2827yy_reduce_print (yyvsp, yyrule)
2828 YYSTYPE *yyvsp;
2829 int yyrule;
Dale Johannesenf325d9f2007-08-03 01:03:46 +00002830#endif
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002831{
2832 int yynrhs = yyr2[yyrule];
2833 int yyi;
2834 unsigned long int yylno = yyrline[yyrule];
2835 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2836 yyrule - 1, yylno);
2837 /* The symbols being reduced. */
2838 for (yyi = 0; yyi < yynrhs; yyi++)
2839 {
2840 fprintf (stderr, " $%d = ", yyi + 1);
2841 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2842 &(yyvsp[(yyi + 1) - (yynrhs)])
2843 );
2844 fprintf (stderr, "\n");
2845 }
2846}
Chandler Carruth563d4a42007-08-04 01:56:21 +00002847
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002848# define YY_REDUCE_PRINT(Rule) \
2849do { \
2850 if (yydebug) \
2851 yy_reduce_print (yyvsp, Rule); \
2852} while (YYID (0))
Chandler Carruth563d4a42007-08-04 01:56:21 +00002853
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002854/* Nonzero means print parse trace. It is left uninitialized so that
2855 multiple parsers can coexist. */
2856int yydebug;
2857#else /* !YYDEBUG */
2858# define YYDPRINTF(Args)
2859# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2860# define YY_STACK_PRINT(Bottom, Top)
2861# define YY_REDUCE_PRINT(Rule)
2862#endif /* !YYDEBUG */
2863
2864
2865/* YYINITDEPTH -- initial size of the parser's stacks. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002866#ifndef YYINITDEPTH
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002867# define YYINITDEPTH 200
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002868#endif
2869
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002870/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2871 if the built-in stack extension method is used).
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002872
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002873 Do not make this value too large; the results are undefined if
2874 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2875 evaluated with infinite-precision integer arithmetic. */
David Greene9145dd22007-08-01 03:59:32 +00002876
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002877#ifndef YYMAXDEPTH
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002878# define YYMAXDEPTH 10000
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002879#endif
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002880
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002881
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002882
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002883#if YYERROR_VERBOSE
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002884
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002885# ifndef yystrlen
2886# if defined __GLIBC__ && defined _STRING_H
2887# define yystrlen strlen
2888# else
2889/* Return the length of YYSTR. */
2890#if (defined __STDC__ || defined __C99__FUNC__ \
2891 || defined __cplusplus || defined _MSC_VER)
2892static YYSIZE_T
2893yystrlen (const char *yystr)
Dale Johannesen3afee192007-09-07 21:07:57 +00002894#else
Anton Korobeynikov66e28652007-11-14 09:53:48 +00002895static YYSIZE_T
2896yystrlen (yystr)
2897 const char *yystr;
2898#endif
2899{
2900 YYSIZE_T yylen;
2901 for (yylen = 0; yystr[yylen]; yylen++)
2902 continue;
2903 return yylen;
2904}
2905# endif
2906# endif
2907
2908# ifndef yystpcpy
2909# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
2910# define yystpcpy stpcpy
2911# else
2912/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2913 YYDEST. */
2914#if (defined __STDC__ || defined __C99__FUNC__ \
2915 || defined __cplusplus || defined _MSC_VER)
2916static char *
2917yystpcpy (char *yydest, const char *yysrc)
2918#else
2919static char *
2920yystpcpy (yydest, yysrc)
2921 char *yydest;
2922 const char *yysrc;
2923#endif
2924{
2925 char *yyd = yydest;
2926 const char *yys = yysrc;
2927
2928 while ((*yyd++ = *yys++) != '\0')
2929 continue;
2930
2931 return yyd - 1;
2932}
2933# endif
2934# endif
2935
2936# ifndef yytnamerr
2937/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2938 quotes and backslashes, so that it's suitable for yyerror. The
2939 heuristic is that double-quoting is unnecessary unless the string
2940 contains an apostrophe, a comma, or backslash (other than
2941 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2942 null, do not copy; instead, return the length of what the result
2943 would have been. */
2944static YYSIZE_T
2945yytnamerr (char *yyres, const char *yystr)
2946{
2947 if (*yystr == '"')
2948 {
2949 YYSIZE_T yyn = 0;
2950 char const *yyp = yystr;
2951
2952 for (;;)
2953 switch (*++yyp)
2954 {
2955 case '\'':
2956 case ',':
2957 goto do_not_strip_quotes;
2958
2959 case '\\':
2960 if (*++yyp != '\\')
2961 goto do_not_strip_quotes;
2962 /* Fall through. */
2963 default:
2964 if (yyres)
2965 yyres[yyn] = *yyp;
2966 yyn++;
2967 break;
2968
2969 case '"':
2970 if (yyres)
2971 yyres[yyn] = '\0';
2972 return yyn;
2973 }
2974 do_not_strip_quotes: ;
2975 }
2976
2977 if (! yyres)
2978 return yystrlen (yystr);
2979
2980 return yystpcpy (yyres, yystr) - yyres;
2981}
2982# endif
2983
2984/* Copy into YYRESULT an error message about the unexpected token
2985 YYCHAR while in state YYSTATE. Return the number of bytes copied,
2986 including the terminating null byte. If YYRESULT is null, do not
2987 copy anything; just return the number of bytes that would be
2988 copied. As a special case, return 0 if an ordinary "syntax error"
2989 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
2990 size calculation. */
2991static YYSIZE_T
2992yysyntax_error (char *yyresult, int yystate, int yychar)
2993{
2994 int yyn = yypact[yystate];
2995
2996 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
2997 return 0;
2998 else
2999 {
3000 int yytype = YYTRANSLATE (yychar);
3001 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3002 YYSIZE_T yysize = yysize0;
3003 YYSIZE_T yysize1;
3004 int yysize_overflow = 0;
3005 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3006 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3007 int yyx;
3008
3009# if 0
3010 /* This is so xgettext sees the translatable formats that are
3011 constructed on the fly. */
3012 YY_("syntax error, unexpected %s");
3013 YY_("syntax error, unexpected %s, expecting %s");
3014 YY_("syntax error, unexpected %s, expecting %s or %s");
3015 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3016 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3017# endif
3018 char *yyfmt;
3019 char const *yyf;
3020 static char const yyunexpected[] = "syntax error, unexpected %s";
3021 static char const yyexpecting[] = ", expecting %s";
3022 static char const yyor[] = " or %s";
3023 char yyformat[sizeof yyunexpected
3024 + sizeof yyexpecting - 1
3025 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3026 * (sizeof yyor - 1))];
3027 char const *yyprefix = yyexpecting;
3028
3029 /* Start YYX at -YYN if negative to avoid negative indexes in
3030 YYCHECK. */
3031 int yyxbegin = yyn < 0 ? -yyn : 0;
3032
3033 /* Stay within bounds of both yycheck and yytname. */
3034 int yychecklim = YYLAST - yyn + 1;
3035 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3036 int yycount = 1;
3037
3038 yyarg[0] = yytname[yytype];
3039 yyfmt = yystpcpy (yyformat, yyunexpected);
3040
3041 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3042 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3043 {
3044 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3045 {
3046 yycount = 1;
3047 yysize = yysize0;
3048 yyformat[sizeof yyunexpected - 1] = '\0';
3049 break;
3050 }
3051 yyarg[yycount++] = yytname[yyx];
3052 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3053 yysize_overflow |= (yysize1 < yysize);
3054 yysize = yysize1;
3055 yyfmt = yystpcpy (yyfmt, yyprefix);
3056 yyprefix = yyor;
3057 }
3058
3059 yyf = YY_(yyformat);
3060 yysize1 = yysize + yystrlen (yyf);
3061 yysize_overflow |= (yysize1 < yysize);
3062 yysize = yysize1;
3063
3064 if (yysize_overflow)
3065 return YYSIZE_MAXIMUM;
3066
3067 if (yyresult)
3068 {
3069 /* Avoid sprintf, as that infringes on the user's name space.
3070 Don't have undefined behavior even if the translation
3071 produced a string with the wrong number of "%s"s. */
3072 char *yyp = yyresult;
3073 int yyi = 0;
3074 while ((*yyp = *yyf) != '\0')
3075 {
3076 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3077 {
3078 yyp += yytnamerr (yyp, yyarg[yyi++]);
3079 yyf += 2;
3080 }
3081 else
3082 {
3083 yyp++;
3084 yyf++;
3085 }
3086 }
3087 }
3088 return yysize;
3089 }
3090}
3091#endif /* YYERROR_VERBOSE */
3092
3093
3094/*-----------------------------------------------.
3095| Release the memory associated to this symbol. |
3096`-----------------------------------------------*/
3097
3098/*ARGSUSED*/
3099#if (defined __STDC__ || defined __C99__FUNC__ \
3100 || defined __cplusplus || defined _MSC_VER)
3101static void
3102yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3103#else
3104static void
3105yydestruct (yymsg, yytype, yyvaluep)
3106 const char *yymsg;
3107 int yytype;
3108 YYSTYPE *yyvaluep;
3109#endif
3110{
3111 YYUSE (yyvaluep);
3112
3113 if (!yymsg)
3114 yymsg = "Deleting";
3115 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3116
3117 switch (yytype)
3118 {
3119
3120 default:
3121 break;
3122 }
3123}
3124
3125
3126/* Prevent warnings from -Wmissing-prototypes. */
3127
3128#ifdef YYPARSE_PARAM
3129#if defined __STDC__ || defined __cplusplus
3130int yyparse (void *YYPARSE_PARAM);
3131#else
3132int yyparse ();
3133#endif
3134#else /* ! YYPARSE_PARAM */
3135#if defined __STDC__ || defined __cplusplus
David Greene48556392007-09-04 18:46:50 +00003136int yyparse (void);
Dale Johannesen3afee192007-09-07 21:07:57 +00003137#else
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003138int yyparse ();
Dale Johannesen3afee192007-09-07 21:07:57 +00003139#endif
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003140#endif /* ! YYPARSE_PARAM */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003141
Chandler Carruth563d4a42007-08-04 01:56:21 +00003142
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003143
3144/* The look-ahead symbol. */
3145int yychar;
3146
3147/* The semantic value of the look-ahead symbol. */
3148YYSTYPE yylval;
3149
3150/* Number of syntax errors so far. */
3151int yynerrs;
3152
3153
3154
3155/*----------.
3156| yyparse. |
3157`----------*/
3158
3159#ifdef YYPARSE_PARAM
3160#if (defined __STDC__ || defined __C99__FUNC__ \
3161 || defined __cplusplus || defined _MSC_VER)
3162int
3163yyparse (void *YYPARSE_PARAM)
3164#else
3165int
3166yyparse (YYPARSE_PARAM)
3167 void *YYPARSE_PARAM;
3168#endif
3169#else /* ! YYPARSE_PARAM */
3170#if (defined __STDC__ || defined __C99__FUNC__ \
3171 || defined __cplusplus || defined _MSC_VER)
3172int
3173yyparse (void)
3174#else
3175int
3176yyparse ()
3177
Dale Johannesen3afee192007-09-07 21:07:57 +00003178#endif
3179#endif
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003180{
3181
3182 int yystate;
3183 int yyn;
3184 int yyresult;
3185 /* Number of tokens to shift before error messages enabled. */
3186 int yyerrstatus;
3187 /* Look-ahead token as an internal (translated) token number. */
3188 int yytoken = 0;
3189#if YYERROR_VERBOSE
3190 /* Buffer for error messages, and its allocated size. */
3191 char yymsgbuf[128];
3192 char *yymsg = yymsgbuf;
3193 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
Dale Johannesen3afee192007-09-07 21:07:57 +00003194#endif
Chandler Carruth563d4a42007-08-04 01:56:21 +00003195
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003196 /* Three stacks and their tools:
3197 `yyss': related to states,
3198 `yyvs': related to semantic values,
3199 `yyls': related to locations.
3200
3201 Refer to the stacks thru separate pointers, to allow yyoverflow
3202 to reallocate them elsewhere. */
3203
3204 /* The state stack. */
3205 yytype_int16 yyssa[YYINITDEPTH];
3206 yytype_int16 *yyss = yyssa;
3207 yytype_int16 *yyssp;
3208
3209 /* The semantic value stack. */
3210 YYSTYPE yyvsa[YYINITDEPTH];
3211 YYSTYPE *yyvs = yyvsa;
3212 YYSTYPE *yyvsp;
3213
3214
3215
3216#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3217
3218 YYSIZE_T yystacksize = YYINITDEPTH;
3219
3220 /* The variables used to return semantic value and location from the
3221 action routines. */
3222 YYSTYPE yyval;
3223
3224
3225 /* The number of symbols on the RHS of the reduced rule.
3226 Keep to zero when no symbol should be popped. */
3227 int yylen = 0;
3228
3229 YYDPRINTF ((stderr, "Starting parse\n"));
3230
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003231 yystate = 0;
3232 yyerrstatus = 0;
3233 yynerrs = 0;
3234 yychar = YYEMPTY; /* Cause a token to be read. */
3235
3236 /* Initialize stack pointers.
3237 Waste one element of value and location stack
3238 so that they stay on the same level as the state stack.
3239 The wasted elements are never initialized. */
3240
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003241 yyssp = yyss;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003242 yyvsp = yyvs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003243
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003244 goto yysetstate;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003245
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003246/*------------------------------------------------------------.
3247| yynewstate -- Push a new state, which is found in yystate. |
3248`------------------------------------------------------------*/
3249 yynewstate:
3250 /* In all cases, when you get here, the value and location stacks
3251 have just been pushed. So pushing a state here evens the stacks. */
3252 yyssp++;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003253
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003254 yysetstate:
3255 *yyssp = yystate;
3256
3257 if (yyss + yystacksize - 1 <= yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003258 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003259 /* Get the current used size of the three stacks, in elements. */
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003260 YYSIZE_T yysize = yyssp - yyss + 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003261
3262#ifdef yyoverflow
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003263 {
3264 /* Give user a chance to reallocate the stack. Use copies of
3265 these so that the &'s don't force the real ones into
3266 memory. */
3267 YYSTYPE *yyvs1 = yyvs;
3268 yytype_int16 *yyss1 = yyss;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003269
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003270
3271 /* Each stack pointer address is followed by the size of the
3272 data in use in that stack, in bytes. This used to be a
3273 conditional around just the two extra args, but that might
3274 be undefined if yyoverflow is a macro. */
3275 yyoverflow (YY_("memory exhausted"),
3276 &yyss1, yysize * sizeof (*yyssp),
3277 &yyvs1, yysize * sizeof (*yyvsp),
3278
3279 &yystacksize);
3280
3281 yyss = yyss1;
3282 yyvs = yyvs1;
3283 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003284#else /* no yyoverflow */
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003285# ifndef YYSTACK_RELOCATE
3286 goto yyexhaustedlab;
3287# else
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003288 /* Extend the stack our own way. */
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003289 if (YYMAXDEPTH <= yystacksize)
3290 goto yyexhaustedlab;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003291 yystacksize *= 2;
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003292 if (YYMAXDEPTH < yystacksize)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003293 yystacksize = YYMAXDEPTH;
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003294
3295 {
3296 yytype_int16 *yyss1 = yyss;
3297 union yyalloc *yyptr =
3298 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3299 if (! yyptr)
3300 goto yyexhaustedlab;
3301 YYSTACK_RELOCATE (yyss);
3302 YYSTACK_RELOCATE (yyvs);
3303
3304# undef YYSTACK_RELOCATE
3305 if (yyss1 != yyssa)
3306 YYSTACK_FREE (yyss1);
3307 }
3308# endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003309#endif /* no yyoverflow */
3310
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003311 yyssp = yyss + yysize - 1;
3312 yyvsp = yyvs + yysize - 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003313
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003314
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003315 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3316 (unsigned long int) yystacksize));
3317
3318 if (yyss + yystacksize - 1 <= yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003319 YYABORT;
3320 }
3321
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003322 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003323
3324 goto yybackup;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003325
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003326/*-----------.
3327| yybackup. |
3328`-----------*/
3329yybackup:
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003330
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003331 /* Do appropriate processing given the current state. Read a
3332 look-ahead token if we need one and don't already have one. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003333
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003334 /* First try to decide what to do without reference to look-ahead token. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003335 yyn = yypact[yystate];
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003336 if (yyn == YYPACT_NINF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003337 goto yydefault;
3338
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003339 /* Not known => get a look-ahead token if don't already have one. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003340
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003341 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003342 if (yychar == YYEMPTY)
3343 {
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003344 YYDPRINTF ((stderr, "Reading a token: "));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003345 yychar = YYLEX;
3346 }
3347
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003348 if (yychar <= YYEOF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003349 {
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003350 yychar = yytoken = YYEOF;
3351 YYDPRINTF ((stderr, "Now at end of input.\n"));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003352 }
3353 else
3354 {
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003355 yytoken = YYTRANSLATE (yychar);
3356 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003357 }
3358
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003359 /* If the proper action on seeing token YYTOKEN is to reduce or to
3360 detect an error, take that action. */
3361 yyn += yytoken;
3362 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003363 goto yydefault;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003364 yyn = yytable[yyn];
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003365 if (yyn <= 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003366 {
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003367 if (yyn == 0 || yyn == YYTABLE_NINF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003368 goto yyerrlab;
3369 yyn = -yyn;
3370 goto yyreduce;
3371 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003372
3373 if (yyn == YYFINAL)
3374 YYACCEPT;
3375
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003376 /* Count tokens shifted since error; after three, turn off error
3377 status. */
3378 if (yyerrstatus)
3379 yyerrstatus--;
Dale Johannesen3afee192007-09-07 21:07:57 +00003380
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003381 /* Shift the look-ahead token. */
3382 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003383
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003384 /* Discard the shifted token unless it is eof. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003385 if (yychar != YYEOF)
3386 yychar = YYEMPTY;
3387
Chris Lattnerbb856a32007-08-06 21:00:46 +00003388 yystate = yyn;
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003389 *++yyvsp = yylval;
3390
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003391 goto yynewstate;
3392
Dale Johannesen3afee192007-09-07 21:07:57 +00003393
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003394/*-----------------------------------------------------------.
3395| yydefault -- do the default action for the current state. |
3396`-----------------------------------------------------------*/
3397yydefault:
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003398 yyn = yydefact[yystate];
3399 if (yyn == 0)
3400 goto yyerrlab;
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003401 goto yyreduce;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003402
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003403
3404/*-----------------------------.
3405| yyreduce -- Do a reduction. |
3406`-----------------------------*/
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003407yyreduce:
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003408 /* yyn is the number of a rule to reduce with. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003409 yylen = yyr2[yyn];
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003410
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003411 /* If YYLEN is nonzero, implement the default value of the action:
3412 `$$ = $1'.
3413
3414 Otherwise, the following line sets YYVAL to garbage.
3415 This behavior is undocumented and Bison
3416 users should not rely upon it. Assigning to YYVAL
3417 unconditionally makes the parser a bit smaller, and it avoids a
3418 GCC warning that YYVAL may be used uninitialized. */
3419 yyval = yyvsp[1-yylen];
3420
3421
3422 YY_REDUCE_PRINT (yyn);
3423 switch (yyn)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003424 {
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003425 case 29:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003426#line 1111 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003427 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3428 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003429
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003430 case 30:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003431#line 1111 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003432 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3433 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003434
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003435 case 31:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003436#line 1112 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003437 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3438 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003439
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003440 case 32:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003441#line 1112 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003442 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3443 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003444
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003445 case 33:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003446#line 1113 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003447 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3448 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003449
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003450 case 34:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003451#line 1113 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003452 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3453 break;
3454
3455 case 35:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003456#line 1114 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003457 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3458 break;
3459
3460 case 36:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003461#line 1114 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003462 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3463 break;
3464
3465 case 37:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003466#line 1115 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003467 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3468 break;
3469
3470 case 38:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003471#line 1115 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003472 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3473 break;
3474
3475 case 39:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003476#line 1119 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003477 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3478 break;
3479
3480 case 40:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003481#line 1119 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003482 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3483 break;
3484
3485 case 41:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003486#line 1120 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003487 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3488 break;
3489
3490 case 42:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003491#line 1120 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003492 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3493 break;
3494
3495 case 43:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003496#line 1121 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003497 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3498 break;
3499
3500 case 44:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003501#line 1121 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003502 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3503 break;
3504
3505 case 45:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003506#line 1122 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003507 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3508 break;
3509
3510 case 46:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003511#line 1122 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003512 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3513 break;
3514
3515 case 47:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003516#line 1123 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003517 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3518 break;
3519
3520 case 48:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003521#line 1123 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003522 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3523 break;
3524
3525 case 49:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003526#line 1124 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003527 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3528 break;
3529
3530 case 50:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003531#line 1124 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003532 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3533 break;
3534
3535 case 51:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003536#line 1125 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003537 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3538 break;
3539
3540 case 52:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003541#line 1125 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003542 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3543 break;
3544
3545 case 53:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003546#line 1126 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003547 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3548 break;
3549
3550 case 54:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003551#line 1127 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003552 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3553 break;
3554
3555 case 65:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003556#line 1136 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003557 { (yyval.StrVal) = 0; ;}
3558 break;
3559
3560 case 66:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003561#line 1140 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003562 {
3563 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003564 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003565 ;}
3566 break;
3567
3568 case 67:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003569#line 1144 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003570 {
3571 (yyval.StrVal) = 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003572 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003573 ;}
3574 break;
3575
3576 case 71:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003577#line 1152 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003578 {
3579 (yyval.StrVal) = 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003580 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003581 ;}
3582 break;
3583
3584 case 72:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003585#line 1157 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003586 {
3587 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003588 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003589 ;}
3590 break;
3591
3592 case 73:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003593#line 1163 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003594 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3595 break;
3596
3597 case 74:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003598#line 1164 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003599 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3600 break;
3601
3602 case 75:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003603#line 1165 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003604 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3605 break;
3606
3607 case 76:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003608#line 1166 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003609 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3610 break;
3611
3612 case 77:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003613#line 1167 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003614 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3615 break;
3616
3617 case 78:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003618#line 1171 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003619 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3620 break;
3621
3622 case 79:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003623#line 1172 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003624 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3625 break;
3626
3627 case 80:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003628#line 1173 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003629 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3630 break;
3631
3632 case 81:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003633#line 1177 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003634 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3635 break;
3636
3637 case 82:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003638#line 1178 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003639 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3640 break;
3641
3642 case 83:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003643#line 1179 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003644 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3645 break;
3646
3647 case 84:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003648#line 1180 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003649 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
3650 break;
3651
3652 case 85:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003653#line 1184 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003654 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3655 break;
3656
3657 case 86:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003658#line 1185 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003659 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3660 break;
3661
3662 case 87:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003663#line 1186 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003664 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3665 break;
3666
3667 case 88:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003668#line 1190 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003669 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3670 break;
3671
3672 case 89:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003673#line 1191 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003674 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3675 break;
3676
3677 case 90:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003678#line 1192 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003679 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3680 break;
3681
3682 case 91:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003683#line 1193 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003684 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3685 break;
3686
3687 case 92:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003688#line 1194 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003689 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3690 break;
3691
3692 case 93:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003693#line 1198 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003694 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3695 break;
3696
3697 case 94:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003698#line 1199 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003699 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3700 break;
3701
3702 case 95:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003703#line 1200 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003704 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3705 break;
3706
3707 case 96:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003708#line 1203 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003709 { (yyval.UIntVal) = CallingConv::C; ;}
3710 break;
3711
3712 case 97:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003713#line 1204 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003714 { (yyval.UIntVal) = CallingConv::C; ;}
3715 break;
3716
3717 case 98:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003718#line 1205 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003719 { (yyval.UIntVal) = CallingConv::Fast; ;}
3720 break;
3721
3722 case 99:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003723#line 1206 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003724 { (yyval.UIntVal) = CallingConv::Cold; ;}
3725 break;
3726
3727 case 100:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003728#line 1207 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003729 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3730 break;
3731
3732 case 101:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003733#line 1208 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003734 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3735 break;
3736
3737 case 102:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003738#line 1209 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003739 {
3740 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003741 GEN_ERROR("Calling conv too large");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003742 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003743 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003744 ;}
3745 break;
3746
3747 case 103:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003748#line 1216 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003749 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3750 break;
3751
3752 case 104:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003753#line 1217 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003754 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3755 break;
3756
3757 case 105:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003758#line 1218 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003759 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3760 break;
3761
3762 case 106:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003763#line 1219 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003764 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3765 break;
3766
3767 case 107:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003768#line 1220 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003769 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
3770 break;
3771
3772 case 108:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003773#line 1221 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003774 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
3775 break;
3776
3777 case 109:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003778#line 1222 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003779 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
3780 break;
3781
3782 case 110:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003783#line 1223 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003784 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
3785 break;
3786
3787 case 111:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003788#line 1224 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003789 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
3790 break;
3791
3792 case 112:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003793#line 1227 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003794 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3795 break;
3796
3797 case 113:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003798#line 1228 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003799 {
3800 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3801 ;}
3802 break;
3803
3804 case 114:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003805#line 1233 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003806 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
3807 break;
3808
3809 case 115:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003810#line 1234 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003811 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
3812 break;
3813
3814 case 116:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003815#line 1235 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003816 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3817 break;
3818
3819 case 117:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003820#line 1236 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003821 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3822 break;
3823
3824 case 118:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003825#line 1237 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Duncan Sandsf5588dc2007-11-27 13:23:08 +00003826 { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003827 break;
3828
3829 case 119:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003830#line 1238 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Duncan Sandsf5588dc2007-11-27 13:23:08 +00003831 { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003832 break;
3833
3834 case 120:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003835#line 1241 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003836 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3837 break;
3838
3839 case 121:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003840#line 1242 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003841 {
3842 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3843 ;}
3844 break;
3845
3846 case 122:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003847#line 1247 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3848 { (yyval.StrVal) = 0; ;}
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003849 break;
3850
3851 case 123:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003852#line 1248 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3853 {
3854 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3855 ;}
3856 break;
3857
3858 case 124:
3859#line 1255 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3860 { (yyval.UIntVal) = 0; ;}
3861 break;
3862
3863 case 125:
3864#line 1256 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003865 {
3866 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3867 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003868 GEN_ERROR("Alignment must be a power of two");
3869 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003870;}
3871 break;
3872
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003873 case 126:
3874#line 1262 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003875 { (yyval.UIntVal) = 0; ;}
3876 break;
3877
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003878 case 127:
3879#line 1263 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003880 {
3881 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
3882 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003883 GEN_ERROR("Alignment must be a power of two");
3884 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003885;}
3886 break;
3887
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003888 case 128:
3889#line 1271 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003890 {
3891 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
3892 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003893 GEN_ERROR("Invalid character in section name");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003894 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003895 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003896;}
3897 break;
3898
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003899 case 129:
3900#line 1279 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003901 { (yyval.StrVal) = 0; ;}
3902 break;
3903
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003904 case 130:
3905#line 1280 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003906 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
3907 break;
3908
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003909 case 131:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003910#line 1285 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3911 {;}
3912 break;
3913
3914 case 132:
3915#line 1286 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
3916 {;}
3917 break;
3918
3919 case 133:
3920#line 1287 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003921 {
3922 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
3923 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003924 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003925 ;}
3926 break;
3927
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003928 case 134:
3929#line 1292 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003930 {
3931 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003932 GEN_ERROR("Alignment must be a power of two");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003933 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003934 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003935 ;}
3936 break;
3937
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003938 case 142:
3939#line 1308 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003940 {
3941 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003942 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003943 ;}
3944 break;
3945
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003946 case 143:
3947#line 1312 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003948 {
3949 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003950 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003951 ;}
3952 break;
3953
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003954 case 144:
3955#line 1316 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003956 { // Pointer type?
3957 if (*(yyvsp[(1) - (2)].TypeVal) == Type::LabelTy)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003958 GEN_ERROR("Cannot form a pointer to a basic block");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003959 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (2)].TypeVal))));
3960 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003961 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003962 ;}
3963 break;
3964
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003965 case 145:
3966#line 1323 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003967 { // Named types are also simple types...
3968 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003969 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003970 (yyval.TypeVal) = new PATypeHolder(tmp);
3971 ;}
3972 break;
3973
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003974 case 146:
3975#line 1328 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003976 { // Type UpReference
3977 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003978 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003979 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
3980 (yyval.TypeVal) = new PATypeHolder(OT);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003981 UR_OUT("New Upreference!\n");
3982 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003983 ;}
3984 break;
3985
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00003986 case 147:
3987#line 1336 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003988 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00003989 // Allow but ignore attributes on function types; this permits auto-upgrade.
3990 // FIXME: remove in LLVM 3.0.
Anton Korobeynikov0cdd2692007-12-03 19:17:47 +00003991 const Type* RetTy = *(yyvsp[(1) - (5)].TypeVal);
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00003992 if (!(RetTy->isFirstClassType() || RetTy == Type::VoidTy ||
3993 isa<OpaqueType>(RetTy)))
Anton Korobeynikov0cdd2692007-12-03 19:17:47 +00003994 GEN_ERROR("LLVM Functions cannot return aggregates");
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00003995
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003996 std::vector<const Type*> Params;
Anton Korobeynikov66e28652007-11-14 09:53:48 +00003997 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00003998 for (; I != E; ++I ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003999 const Type *Ty = I->Ty->get();
4000 Params.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004001 }
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004002
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004003 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4004 if (isVarArg) Params.pop_back();
4005
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004006 for (unsigned i = 0; i != Params.size(); ++i)
4007 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4008 GEN_ERROR("Function arguments must be value types!");
4009
4010 CHECK_FOR_ERROR
4011
Anton Korobeynikov0cdd2692007-12-03 19:17:47 +00004012 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004013 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4014 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4015 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004016 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004017 ;}
4018 break;
4019
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004020 case 148:
4021#line 1366 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004022 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004023 // Allow but ignore attributes on function types; this permits auto-upgrade.
4024 // FIXME: remove in LLVM 3.0.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004025 std::vector<const Type*> Params;
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004026 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004027 for ( ; I != E; ++I ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004028 const Type* Ty = I->Ty->get();
4029 Params.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004030 }
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004031
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004032 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4033 if (isVarArg) Params.pop_back();
4034
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004035 for (unsigned i = 0; i != Params.size(); ++i)
4036 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4037 GEN_ERROR("Function arguments must be value types!");
4038
4039 CHECK_FOR_ERROR
4040
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004041 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004042 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4043 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004044 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004045 ;}
4046 break;
4047
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004048 case 149:
4049#line 1391 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004050 { // Sized array type?
4051 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4052 delete (yyvsp[(4) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004053 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004054 ;}
4055 break;
4056
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004057 case 150:
4058#line 1396 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004059 { // Vector type?
4060 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4061 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004062 GEN_ERROR("Unsigned result not equal to signed result");
4063 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4064 GEN_ERROR("Element type of a VectorType must be primitive");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004065 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4066 delete (yyvsp[(4) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004067 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004068 ;}
4069 break;
4070
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004071 case 151:
4072#line 1406 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004073 { // Structure type?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004074 std::vector<const Type*> Elements;
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004075 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4076 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004077 Elements.push_back(*I);
4078
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004079 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4080 delete (yyvsp[(2) - (3)].TypeList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004081 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004082 ;}
4083 break;
4084
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004085 case 152:
4086#line 1416 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004087 { // Empty structure type?
4088 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004089 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004090 ;}
4091 break;
4092
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004093 case 153:
4094#line 1420 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004095 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004096 std::vector<const Type*> Elements;
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004097 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4098 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004099 Elements.push_back(*I);
4100
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004101 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4102 delete (yyvsp[(3) - (5)].TypeList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004103 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004104 ;}
4105 break;
4106
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004107 case 154:
4108#line 1430 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004109 { // Empty structure type?
4110 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004111 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004112 ;}
4113 break;
4114
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004115 case 155:
4116#line 1437 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004117 {
4118 // Allow but ignore attributes on function types; this permits auto-upgrade.
4119 // FIXME: remove in LLVM 3.0.
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004120 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004121 (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004122 ;}
4123 break;
4124
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004125 case 156:
4126#line 1446 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004127 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004128 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004129 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4130 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004131 GEN_ERROR("LLVM functions cannot return aggregate types");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004132 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4133 ;}
4134 break;
4135
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004136 case 157:
4137#line 1453 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004138 {
4139 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4140 ;}
4141 break;
4142
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004143 case 158:
4144#line 1458 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004145 {
4146 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4147 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004148 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004149 ;}
4150 break;
4151
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004152 case 159:
4153#line 1463 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004154 {
4155 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004156 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004157 ;}
4158 break;
4159
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004160 case 161:
4161#line 1471 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004162 {
4163 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004164 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4165 TWA.Ty = new PATypeHolder(Type::VoidTy);
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004166 (yyval.TypeWithAttrsList)->push_back(TWA);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004167 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004168 ;}
4169 break;
4170
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004171 case 162:
4172#line 1478 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004173 {
4174 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004175 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4176 TWA.Ty = new PATypeHolder(Type::VoidTy);
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004177 (yyval.TypeWithAttrsList)->push_back(TWA);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004178 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004179 ;}
4180 break;
4181
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004182 case 163:
4183#line 1485 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004184 {
4185 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004186 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004187 ;}
4188 break;
4189
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004190 case 164:
4191#line 1493 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004192 {
4193 (yyval.TypeList) = new std::list<PATypeHolder>();
4194 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4195 delete (yyvsp[(1) - (1)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004196 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004197 ;}
4198 break;
4199
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004200 case 165:
4201#line 1499 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004202 {
4203 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4204 delete (yyvsp[(3) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004205 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004206 ;}
4207 break;
4208
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004209 case 166:
4210#line 1511 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004211 { // Nonempty unsized arr
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004212 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004213 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4214 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004215 if (ATy == 0)
4216 GEN_ERROR("Cannot make array constant with type: '" +
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004217 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004218 const Type *ETy = ATy->getElementType();
4219 int NumElements = ATy->getNumElements();
4220
4221 // Verify that we have the correct size...
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004222 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004223 GEN_ERROR("Type mismatch: constant sized array initialized with " +
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004224 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004225 itostr(NumElements) + "");
4226
4227 // Verify all elements are correct type!
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004228 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4229 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004230 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4231 ETy->getDescription() +"' as required!\nIt is of type '"+
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004232 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004233 }
4234
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004235 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4236 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004237 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004238 ;}
4239 break;
4240
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004241 case 167:
4242#line 1539 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004243 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004244 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004245 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4246 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004247 if (ATy == 0)
4248 GEN_ERROR("Cannot make array constant with type: '" +
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004249 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004250
4251 int NumElements = ATy->getNumElements();
4252 if (NumElements != -1 && NumElements != 0)
4253 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
4254 " arguments, but has size of " + itostr(NumElements) +"");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004255 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4256 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004257 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004258 ;}
4259 break;
4260
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004261 case 168:
4262#line 1555 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004263 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004264 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004265 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4266 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004267 if (ATy == 0)
4268 GEN_ERROR("Cannot make array constant with type: '" +
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004269 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004270
4271 int NumElements = ATy->getNumElements();
4272 const Type *ETy = ATy->getElementType();
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004273 if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004274 GEN_ERROR("Can't build string constant of size " +
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004275 itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004276 " when array has size " + itostr(NumElements) + "");
4277 std::vector<Constant*> Vals;
4278 if (ETy == Type::Int8Ty) {
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004279 for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
4280 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004281 } else {
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004282 delete (yyvsp[(3) - (3)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004283 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4284 }
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004285 delete (yyvsp[(3) - (3)].StrVal);
4286 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4287 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004288 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004289 ;}
4290 break;
4291
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004292 case 169:
4293#line 1582 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004294 { // Nonempty unsized arr
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004295 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004296 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4297 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004298 if (PTy == 0)
4299 GEN_ERROR("Cannot make packed constant with type: '" +
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004300 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004301 const Type *ETy = PTy->getElementType();
4302 int NumElements = PTy->getNumElements();
4303
4304 // Verify that we have the correct size...
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004305 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004306 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004307 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004308 itostr(NumElements) + "");
4309
4310 // Verify all elements are correct type!
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004311 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4312 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004313 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4314 ETy->getDescription() +"' as required!\nIt is of type '"+
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004315 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004316 }
4317
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004318 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4319 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004320 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004321 ;}
4322 break;
4323
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004324 case 170:
4325#line 1610 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004326 {
4327 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004328 if (STy == 0)
4329 GEN_ERROR("Cannot make struct constant with type: '" +
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004330 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004331
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004332 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004333 GEN_ERROR("Illegal number of initializers for structure type");
4334
4335 // Check to ensure that constants are compatible with the type initializer!
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004336 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4337 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004338 GEN_ERROR("Expected type '" +
4339 STy->getElementType(i)->getDescription() +
4340 "' for element #" + utostr(i) +
4341 " of structure initializer");
4342
4343 // Check to ensure that Type is not packed
4344 if (STy->isPacked())
4345 GEN_ERROR("Unpacked Initializer to vector type '" +
4346 STy->getDescription() + "'");
4347
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004348 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4349 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004350 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004351 ;}
4352 break;
4353
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004354 case 171:
4355#line 1636 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004356 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004357 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004358 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4359 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004360 if (STy == 0)
4361 GEN_ERROR("Cannot make struct constant with type: '" +
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004362 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004363
4364 if (STy->getNumContainedTypes() != 0)
4365 GEN_ERROR("Illegal number of initializers for structure type");
4366
4367 // Check to ensure that Type is not packed
4368 if (STy->isPacked())
4369 GEN_ERROR("Unpacked Initializer to vector type '" +
4370 STy->getDescription() + "'");
4371
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004372 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4373 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004374 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004375 ;}
4376 break;
4377
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004378 case 172:
4379#line 1656 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004380 {
4381 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004382 if (STy == 0)
4383 GEN_ERROR("Cannot make struct constant with type: '" +
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004384 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004385
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004386 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004387 GEN_ERROR("Illegal number of initializers for structure type");
4388
4389 // Check to ensure that constants are compatible with the type initializer!
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004390 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4391 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004392 GEN_ERROR("Expected type '" +
4393 STy->getElementType(i)->getDescription() +
4394 "' for element #" + utostr(i) +
4395 " of structure initializer");
4396
4397 // Check to ensure that Type is packed
4398 if (!STy->isPacked())
4399 GEN_ERROR("Vector initializer to non-vector type '" +
4400 STy->getDescription() + "'");
4401
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004402 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4403 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004404 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004405 ;}
4406 break;
4407
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004408 case 173:
4409#line 1682 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004410 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004411 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004412 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4413 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004414 if (STy == 0)
4415 GEN_ERROR("Cannot make struct constant with type: '" +
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004416 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004417
4418 if (STy->getNumContainedTypes() != 0)
4419 GEN_ERROR("Illegal number of initializers for structure type");
4420
4421 // Check to ensure that Type is packed
4422 if (!STy->isPacked())
4423 GEN_ERROR("Vector initializer to non-vector type '" +
4424 STy->getDescription() + "'");
4425
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004426 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4427 delete (yyvsp[(1) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004428 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004429 ;}
4430 break;
4431
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004432 case 174:
4433#line 1702 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004434 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004435 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004436 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4437 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004438 if (PTy == 0)
4439 GEN_ERROR("Cannot make null pointer constant with type: '" +
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004440 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004441
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004442 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4443 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004444 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004445 ;}
4446 break;
4447
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004448 case 175:
4449#line 1714 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004450 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004451 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004452 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4453 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4454 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004455 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004456 ;}
4457 break;
4458
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004459 case 176:
4460#line 1721 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004461 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004462 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004463 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4464 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004465 if (Ty == 0)
4466 GEN_ERROR("Global const reference must be a pointer type");
4467
4468 // ConstExprs can exist in the body of a function, thus creating
4469 // GlobalValues whenever they refer to a variable. Because we are in
4470 // the context of a function, getExistingVal will search the functions
4471 // symbol table instead of the module symbol table for the global symbol,
4472 // which throws things all off. To get around this, we just tell
4473 // getExistingVal that we are at global scope here.
4474 //
4475 Function *SavedCurFn = CurFun.CurrentFunction;
4476 CurFun.CurrentFunction = 0;
4477
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004478 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004479 CHECK_FOR_ERROR
4480
4481 CurFun.CurrentFunction = SavedCurFn;
4482
4483 // If this is an initializer for a constant pointer, which is referencing a
4484 // (currently) undefined variable, create a stub now that shall be replaced
4485 // in the future with the right type of variable.
4486 //
4487 if (V == 0) {
4488 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4489 const PointerType *PT = cast<PointerType>(Ty);
4490
4491 // First check to see if the forward references value is already created!
4492 PerModuleInfo::GlobalRefsType::iterator I =
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004493 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004494
4495 if (I != CurModule.GlobalRefs.end()) {
4496 V = I->second; // Placeholder already exists, use it...
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004497 (yyvsp[(2) - (2)].ValIDVal).destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004498 } else {
4499 std::string Name;
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004500 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4501 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4502 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004503 GEN_ERROR("Invalid reference to global");
4504
4505 // Create the forward referenced global.
4506 GlobalValue *GV;
4507 if (const FunctionType *FTy =
4508 dyn_cast<FunctionType>(PT->getElementType())) {
4509 GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name,
4510 CurModule.CurrentModule);
4511 } else {
4512 GV = new GlobalVariable(PT->getElementType(), false,
4513 GlobalValue::ExternalWeakLinkage, 0,
4514 Name, CurModule.CurrentModule);
4515 }
4516
4517 // Keep track of the fact that we have a forward ref to recycle it
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004518 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004519 V = GV;
4520 }
4521 }
4522
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004523 (yyval.ConstVal) = cast<GlobalValue>(V);
4524 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004525 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004526 ;}
4527 break;
4528
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004529 case 177:
4530#line 1787 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004531 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004532 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004533 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4534 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004535 GEN_ERROR("Mismatched types for constant expression: " +
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004536 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4537 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4538 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004539 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004540 ;}
4541 break;
4542
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004543 case 178:
4544#line 1797 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004545 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004546 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004547 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4548 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004549 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4550 GEN_ERROR("Cannot create a null initialized value of this type");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004551 (yyval.ConstVal) = Constant::getNullValue(Ty);
4552 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004553 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004554 ;}
4555 break;
4556
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004557 case 179:
4558#line 1807 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004559 { // integral constants
4560 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004561 GEN_ERROR("Constant value doesn't fit in type");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004562 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004563 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004564 ;}
4565 break;
4566
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004567 case 180:
4568#line 1813 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004569 { // arbitrary precision integer constants
4570 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4571 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004572 GEN_ERROR("Constant value does not fit in type");
4573 }
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004574 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4575 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4576 delete (yyvsp[(2) - (2)].APIntVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004577 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004578 ;}
4579 break;
4580
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004581 case 181:
4582#line 1823 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004583 { // integral constants
4584 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004585 GEN_ERROR("Constant value doesn't fit in type");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004586 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004587 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004588 ;}
4589 break;
4590
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004591 case 182:
4592#line 1829 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004593 { // arbitrary precision integer constants
4594 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4595 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004596 GEN_ERROR("Constant value does not fit in type");
4597 }
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004598 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4599 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4600 delete (yyvsp[(2) - (2)].APIntVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004601 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004602 ;}
4603 break;
4604
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004605 case 183:
4606#line 1839 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004607 { // Boolean constants
4608 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4609 (yyval.ConstVal) = ConstantInt::getTrue();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004610 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004611 ;}
4612 break;
4613
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004614 case 184:
4615#line 1844 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004616 { // Boolean constants
4617 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4618 (yyval.ConstVal) = ConstantInt::getFalse();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004619 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004620 ;}
4621 break;
4622
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004623 case 185:
4624#line 1849 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004625 { // Floating point constants
4626 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004627 GEN_ERROR("Floating point constant invalid for type");
Dale Johannesen255b8fe2007-09-11 18:33:39 +00004628 // Lexer has no type info, so builds all float and double FP constants
4629 // as double. Fix this here. Long double is done right.
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004630 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4631 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
4632 (yyval.ConstVal) = ConstantFP::get((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal));
4633 delete (yyvsp[(2) - (2)].FPVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004634 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004635 ;}
4636 break;
4637
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004638 case 186:
4639#line 1862 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004640 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004641 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004642 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4643 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4644 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4645 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004646 GEN_ERROR("invalid cast opcode for cast from '" +
4647 Val->getType()->getDescription() + "' to '" +
4648 DestTy->getDescription() + "'");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004649 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4650 delete (yyvsp[(5) - (6)].TypeVal);
4651 ;}
4652 break;
4653
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004654 case 187:
4655#line 1874 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004656 {
4657 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004658 GEN_ERROR("GetElementPtr requires a pointer operand");
4659
4660 const Type *IdxTy =
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004661 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end(),
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004662 true);
4663 if (!IdxTy)
4664 GEN_ERROR("Index list invalid for constant getelementptr");
4665
4666 SmallVector<Constant*, 8> IdxVec;
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004667 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4668 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004669 IdxVec.push_back(C);
4670 else
4671 GEN_ERROR("Indices to constant getelementptr must be constants");
4672
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004673 delete (yyvsp[(4) - (5)].ValueList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004674
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004675 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004676 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004677 ;}
4678 break;
4679
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004680 case 188:
4681#line 1896 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004682 {
4683 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004684 GEN_ERROR("Select condition must be of boolean type");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004685 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004686 GEN_ERROR("Select operand types must match");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004687 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004688 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004689 ;}
4690 break;
4691
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004692 case 189:
4693#line 1904 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004694 {
4695 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004696 GEN_ERROR("Binary operator types must match");
4697 CHECK_FOR_ERROR;
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004698 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4699 ;}
4700 break;
4701
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004702 case 190:
4703#line 1910 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004704 {
4705 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004706 GEN_ERROR("Logical operator types must match");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004707 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
4708 if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
4709 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004710 GEN_ERROR("Logical operator requires integral operands");
4711 }
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004712 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004713 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004714 ;}
4715 break;
4716
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004717 case 191:
4718#line 1921 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004719 {
4720 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004721 GEN_ERROR("icmp operand types must match");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004722 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4723 ;}
4724 break;
4725
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004726 case 192:
4727#line 1926 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004728 {
4729 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004730 GEN_ERROR("fcmp operand types must match");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004731 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4732 ;}
4733 break;
4734
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004735 case 193:
4736#line 1931 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004737 {
4738 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004739 GEN_ERROR("Invalid extractelement operands");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004740 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004741 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004742 ;}
4743 break;
4744
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004745 case 194:
4746#line 1937 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004747 {
4748 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004749 GEN_ERROR("Invalid insertelement operands");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004750 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004751 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004752 ;}
4753 break;
4754
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004755 case 195:
4756#line 1943 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004757 {
4758 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004759 GEN_ERROR("Invalid shufflevector operands");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004760 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004761 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004762 ;}
4763 break;
4764
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004765 case 196:
4766#line 1952 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004767 {
4768 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004769 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004770 ;}
4771 break;
4772
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004773 case 197:
4774#line 1956 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004775 {
4776 (yyval.ConstVector) = new std::vector<Constant*>();
4777 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004778 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004779 ;}
4780 break;
4781
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004782 case 198:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004783#line 1964 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4784 { (yyval.BoolVal) = false; ;}
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004785 break;
4786
4787 case 199:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004788#line 1964 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4789 { (yyval.BoolVal) = true; ;}
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004790 break;
4791
4792 case 200:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004793#line 1967 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4794 { (yyval.BoolVal) = true; ;}
4795 break;
4796
4797 case 201:
4798#line 1967 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4799 { (yyval.BoolVal) = false; ;}
4800 break;
4801
4802 case 202:
4803#line 1970 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004804 {
4805 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
4806 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
Chris Lattnerbb856a32007-08-06 21:00:46 +00004807 CHECK_FOR_ERROR
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004808 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
4809 if (!Aliasee)
4810 GEN_ERROR("Aliases can be created only to global values");
4811
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004812 (yyval.ConstVal) = Aliasee;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004813 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004814 delete (yyvsp[(1) - (2)].TypeVal);
4815 ;}
4816 break;
4817
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004818 case 203:
4819#line 1982 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004820 {
4821 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4822 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4823 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004824 GEN_ERROR("invalid cast opcode for cast from '" +
4825 Val->getType()->getDescription() + "' to '" +
4826 DestTy->getDescription() + "'");
4827
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004828 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004829 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004830 delete (yyvsp[(5) - (6)].TypeVal);
4831 ;}
4832 break;
4833
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004834 case 204:
4835#line 2003 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004836 {
4837 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
Reid Spencer47470022007-07-31 14:41:17 +00004838 CurModule.ModuleDone();
4839 CHECK_FOR_ERROR;
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004840 ;}
4841 break;
4842
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004843 case 205:
4844#line 2008 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004845 {
4846 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004847 CurModule.ModuleDone();
4848 CHECK_FOR_ERROR;
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004849 ;}
4850 break;
4851
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004852 case 208:
4853#line 2021 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004854 { CurFun.isDeclare = false; ;}
4855 break;
4856
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004857 case 209:
4858#line 2021 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004859 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004860 CurFun.FunctionDone();
4861 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004862 ;}
4863 break;
4864
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004865 case 210:
4866#line 2025 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004867 { CurFun.isDeclare = true; ;}
4868 break;
4869
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004870 case 211:
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004871#line 2025 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4872 {
4873 CHECK_FOR_ERROR
4874 ;}
4875 break;
4876
4877 case 212:
4878#line 2028 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
4879 {
4880 CHECK_FOR_ERROR
4881 ;}
4882 break;
4883
4884 case 213:
4885#line 2031 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004886 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004887 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004888 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004889 // Eagerly resolve types. This is not an optimization, this is a
4890 // requirement that is due to the fact that we could have this:
4891 //
4892 // %list = type { %list * }
4893 // %list = type { %list * } ; repeated type decl
4894 //
4895 // If types are not resolved eagerly, then the two types will not be
4896 // determined to be the same type!
4897 //
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004898 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004899
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004900 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004901 CHECK_FOR_ERROR
4902 // If this is a named type that is not a redefinition, add it to the slot
4903 // table.
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004904 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004905 }
4906
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004907 delete (yyvsp[(3) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004908 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004909 ;}
4910 break;
Reid Spenceraa8ae282007-07-31 03:50:36 +00004911
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004912 case 214:
4913#line 2055 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004914 {
4915 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
4916
4917 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004918 CHECK_FOR_ERROR
4919 // If this is a named type that is not a redefinition, add it to the slot
4920 // table.
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004921 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004922 }
4923 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004924 ;}
4925 break;
4926
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004927 case 215:
4928#line 2066 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004929 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004930 /* "Externally Visible" Linkage */
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004931 if ((yyvsp[(5) - (5)].ConstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004932 GEN_ERROR("Global value initializer is not a constant");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004933 CurGV = ParseGlobalVariable((yyvsp[(1) - (5)].StrVal), GlobalValue::ExternalLinkage,
4934 (yyvsp[(2) - (5)].Visibility), (yyvsp[(4) - (5)].BoolVal), (yyvsp[(5) - (5)].ConstVal)->getType(), (yyvsp[(5) - (5)].ConstVal), (yyvsp[(3) - (5)].BoolVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004935 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004936 ;}
4937 break;
4938
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004939 case 216:
4940#line 2073 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004941 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004942 CurGV = 0;
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004943 ;}
4944 break;
4945
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004946 case 217:
4947#line 2077 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004948 {
4949 if ((yyvsp[(6) - (6)].ConstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004950 GEN_ERROR("Global value initializer is not a constant");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004951 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), (yyvsp[(2) - (6)].Linkage), (yyvsp[(3) - (6)].Visibility), (yyvsp[(5) - (6)].BoolVal), (yyvsp[(6) - (6)].ConstVal)->getType(), (yyvsp[(6) - (6)].ConstVal), (yyvsp[(4) - (6)].BoolVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004952 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004953 ;}
4954 break;
4955
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004956 case 218:
4957#line 2082 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004958 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004959 CurGV = 0;
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004960 ;}
4961 break;
4962
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004963 case 219:
4964#line 2086 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004965 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004966 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004967 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (6)].TypeVal))->getDescription());
4968 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), (yyvsp[(2) - (6)].Linkage), (yyvsp[(3) - (6)].Visibility), (yyvsp[(5) - (6)].BoolVal), *(yyvsp[(6) - (6)].TypeVal), 0, (yyvsp[(4) - (6)].BoolVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004969 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004970 delete (yyvsp[(6) - (6)].TypeVal);
4971 ;}
4972 break;
4973
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004974 case 220:
4975#line 2092 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004976 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004977 CurGV = 0;
4978 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004979 ;}
4980 break;
4981
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00004982 case 221:
4983#line 2096 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004984 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004985 std::string Name;
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004986 if ((yyvsp[(1) - (5)].StrVal)) {
4987 Name = *(yyvsp[(1) - (5)].StrVal);
4988 delete (yyvsp[(1) - (5)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004989 }
4990 if (Name.empty())
4991 GEN_ERROR("Alias name cannot be empty");
4992
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004993 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004994 if (Aliasee == 0)
4995 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
4996
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004997 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004998 CurModule.CurrentModule);
Anton Korobeynikov66e28652007-11-14 09:53:48 +00004999 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005000 InsertValue(GA, CurModule.Values);
Chris Lattner5eefce32007-09-10 23:24:14 +00005001
5002
5003 // If there was a forward reference of this alias, resolve it now.
5004
5005 ValID ID;
5006 if (!Name.empty())
5007 ID = ValID::createGlobalName(Name);
5008 else
5009 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5010
5011 if (GlobalValue *FWGV =
5012 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5013 // Replace uses of the fwdref with the actual alias.
5014 FWGV->replaceAllUsesWith(GA);
5015 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5016 GV->eraseFromParent();
5017 else
5018 cast<Function>(FWGV)->eraseFromParent();
5019 }
5020 ID.destroy();
5021
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005022 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005023 ;}
5024 break;
5025
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005026 case 222:
5027#line 2136 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005028 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005029 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005030 ;}
5031 break;
5032
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005033 case 223:
5034#line 2139 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005035 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005036 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005037 ;}
5038 break;
5039
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005040 case 224:
5041#line 2145 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005042 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005043 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
5044 if (AsmSoFar.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005045 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005046 else
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005047 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5048 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005049 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005050;}
5051 break;
5052
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005053 case 225:
5054#line 2155 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005055 {
5056 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5057 delete (yyvsp[(3) - (3)].StrVal);
5058 ;}
5059 break;
5060
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005061 case 226:
5062#line 2159 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005063 {
5064 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5065 delete (yyvsp[(3) - (3)].StrVal);
5066 ;}
5067 break;
5068
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005069 case 228:
5070#line 2166 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005071 {
5072 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5073 delete (yyvsp[(3) - (3)].StrVal);
Reid Spencer47470022007-07-31 14:41:17 +00005074 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005075 ;}
5076 break;
5077
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005078 case 229:
5079#line 2171 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005080 {
5081 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5082 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005083 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005084 ;}
5085 break;
5086
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005087 case 230:
5088#line 2176 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005089 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005090 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005091 ;}
5092 break;
5093
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005094 case 231:
5095#line 2185 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005096 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005097 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005098 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
5099 if (*(yyvsp[(3) - (5)].TypeVal) == Type::VoidTy)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005100 GEN_ERROR("void typed arguments are invalid");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005101 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5102 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5103 (yyvsp[(1) - (5)].ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005104 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005105 ;}
5106 break;
5107
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005108 case 232:
5109#line 2195 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005110 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005111 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005112 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
5113 if (*(yyvsp[(1) - (3)].TypeVal) == Type::VoidTy)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005114 GEN_ERROR("void typed arguments are invalid");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005115 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5116 (yyval.ArgList) = new ArgListType;
5117 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005118 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005119 ;}
5120 break;
5121
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005122 case 233:
5123#line 2206 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005124 {
5125 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005126 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005127 ;}
5128 break;
5129
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005130 case 234:
5131#line 2210 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005132 {
5133 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005134 struct ArgListEntry E;
5135 E.Ty = new PATypeHolder(Type::VoidTy);
5136 E.Name = 0;
5137 E.Attrs = ParamAttr::None;
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005138 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005139 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005140 ;}
5141 break;
5142
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005143 case 235:
5144#line 2219 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005145 {
5146 (yyval.ArgList) = new ArgListType;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005147 struct ArgListEntry E;
5148 E.Ty = new PATypeHolder(Type::VoidTy);
5149 E.Name = 0;
5150 E.Attrs = ParamAttr::None;
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005151 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005152 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005153 ;}
5154 break;
5155
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005156 case 236:
5157#line 2228 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005158 {
5159 (yyval.ArgList) = 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005160 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005161 ;}
5162 break;
5163
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005164 case 237:
5165#line 2234 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005166 {
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005167 std::string FunctionName(*(yyvsp[(3) - (10)].StrVal));
5168 delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory!
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005169
5170 // Check the function result for abstractness if this is a define. We should
5171 // have no abstract types at this point
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005172 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal)))
5173 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005174
5175 std::vector<const Type*> ParamTypeList;
5176 ParamAttrsVector Attrs;
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005177 if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005178 ParamAttrsWithIndex PAWI;
5179 PAWI.index = 0;
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005180 PAWI.attrs = (yyvsp[(7) - (10)].ParamAttrs);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005181 Attrs.push_back(PAWI);
5182 }
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005183 if ((yyvsp[(5) - (10)].ArgList)) { // If there are arguments...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005184 unsigned index = 1;
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005185 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); I != (yyvsp[(5) - (10)].ArgList)->end(); ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005186 const Type* Ty = I->Ty->get();
5187 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5188 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
5189 ParamTypeList.push_back(Ty);
5190 if (Ty != Type::VoidTy)
5191 if (I->Attrs != ParamAttr::None) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005192 ParamAttrsWithIndex PAWI;
5193 PAWI.index = index;
5194 PAWI.attrs = I->Attrs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005195 Attrs.push_back(PAWI);
5196 }
5197 }
5198 }
5199
5200 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5201 if (isVarArg) ParamTypeList.pop_back();
5202
Duncan Sands637ec552007-11-28 17:07:01 +00005203 const ParamAttrsList *PAL = 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005204 if (!Attrs.empty())
5205 PAL = ParamAttrsList::get(Attrs);
5206
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005207 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005208 const PointerType *PFT = PointerType::get(FT);
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005209 delete (yyvsp[(2) - (10)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005210
5211 ValID ID;
5212 if (!FunctionName.empty()) {
5213 ID = ValID::createGlobalName((char*)FunctionName.c_str());
5214 } else {
5215 ID = ValID::createGlobalID(CurModule.Values.size());
5216 }
5217
5218 Function *Fn = 0;
5219 // See if this function was forward referenced. If so, recycle the object.
5220 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5221 // Move the function to the end of the list, from whereever it was
5222 // previously inserted.
5223 Fn = cast<Function>(FWRef);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005224 assert(!Fn->getParamAttrs() && "Forward reference has parameter attributes!");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005225 CurModule.CurrentModule->getFunctionList().remove(Fn);
5226 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5227 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
5228 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005229 if (Fn->getFunctionType() != FT ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005230 // The existing function doesn't have the same type. This is an overload
5231 // error.
5232 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005233 } else if (Fn->getParamAttrs() != PAL) {
5234 // The existing function doesn't have the same parameter attributes.
5235 // This is an overload error.
5236 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005237 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
5238 // Neither the existing or the current function is a declaration and they
5239 // have the same name and same type. Clearly this is a redefinition.
5240 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005241 } else if (Fn->isDeclaration()) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005242 // Make sure to strip off any argument names so we can't get conflicts.
5243 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5244 AI != AE; ++AI)
5245 AI->setName("");
5246 }
5247 } else { // Not already defined?
5248 Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5249 CurModule.CurrentModule);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005250 InsertValue(Fn, CurModule.Values);
5251 }
5252
5253 CurFun.FunctionStart(Fn);
5254
5255 if (CurFun.isDeclare) {
5256 // If we have declaration, always overwrite linkage. This will allow us to
5257 // correctly handle cases, when pointer to function is passed as argument to
5258 // another function.
5259 Fn->setLinkage(CurFun.Linkage);
5260 Fn->setVisibility(CurFun.Visibility);
5261 }
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005262 Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005263 Fn->setParamAttrs(PAL);
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005264 Fn->setAlignment((yyvsp[(9) - (10)].UIntVal));
5265 if ((yyvsp[(8) - (10)].StrVal)) {
5266 Fn->setSection(*(yyvsp[(8) - (10)].StrVal));
5267 delete (yyvsp[(8) - (10)].StrVal);
5268 }
5269 if ((yyvsp[(10) - (10)].StrVal)) {
5270 Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str());
5271 delete (yyvsp[(10) - (10)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005272 }
5273
5274 // Add all of the arguments we parsed to the function...
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005275 if ((yyvsp[(5) - (10)].ArgList)) { // Is null if empty...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005276 if (isVarArg) { // Nuke the last entry
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005277 assert((yyvsp[(5) - (10)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (10)].ArgList)->back().Name == 0 &&
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005278 "Not a varargs marker!");
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005279 delete (yyvsp[(5) - (10)].ArgList)->back().Ty;
5280 (yyvsp[(5) - (10)].ArgList)->pop_back(); // Delete the last entry
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005281 }
5282 Function::arg_iterator ArgIt = Fn->arg_begin();
5283 Function::arg_iterator ArgEnd = Fn->arg_end();
5284 unsigned Idx = 1;
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005285 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin();
5286 I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005287 delete I->Ty; // Delete the typeholder...
5288 setValueName(ArgIt, I->Name); // Insert arg into symtab...
5289 CHECK_FOR_ERROR
5290 InsertValue(ArgIt);
5291 Idx++;
5292 }
5293
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005294 delete (yyvsp[(5) - (10)].ArgList); // We're now done with the argument list
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005295 }
5296 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005297;}
5298 break;
5299
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005300 case 240:
5301#line 2369 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005302 {
5303 (yyval.FunctionVal) = CurFun.CurrentFunction;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005304
5305 // Make sure that we keep track of the linkage type even if there was a
5306 // previous "declare".
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005307 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5308 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5309;}
5310 break;
5311
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005312 case 243:
5313#line 2380 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005314 {
5315 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005316 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005317;}
5318 break;
5319
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005320 case 244:
5321#line 2385 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005322 {
5323 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5324 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5325 (yyval.FunctionVal) = CurFun.CurrentFunction;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005326 CurFun.FunctionDone();
5327 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005328 ;}
5329 break;
5330
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005331 case 245:
5332#line 2397 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005333 {
5334 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005335 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005336 ;}
5337 break;
5338
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005339 case 246:
5340#line 2401 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005341 {
5342 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005343 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005344 ;}
5345 break;
5346
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005347 case 247:
5348#line 2406 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005349 { // A reference to a direct constant
5350 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005351 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005352 ;}
5353 break;
5354
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005355 case 248:
5356#line 2410 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005357 {
5358 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005359 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005360 ;}
5361 break;
5362
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005363 case 249:
5364#line 2414 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005365 { // Perhaps it's an FP constant?
5366 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005367 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005368 ;}
5369 break;
5370
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005371 case 250:
5372#line 2418 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005373 {
5374 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005375 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005376 ;}
5377 break;
5378
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005379 case 251:
5380#line 2422 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005381 {
5382 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005383 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005384 ;}
5385 break;
5386
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005387 case 252:
5388#line 2426 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005389 {
5390 (yyval.ValIDVal) = ValID::createNull();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005391 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005392 ;}
5393 break;
5394
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005395 case 253:
5396#line 2430 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005397 {
5398 (yyval.ValIDVal) = ValID::createUndef();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005399 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005400 ;}
5401 break;
5402
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005403 case 254:
5404#line 2434 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005405 { // A vector zero constant.
5406 (yyval.ValIDVal) = ValID::createZeroInit();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005407 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005408 ;}
5409 break;
5410
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005411 case 255:
5412#line 2438 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005413 { // Nonempty unsized packed vector
5414 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5415 int NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005416
5417 VectorType* pt = VectorType::get(ETy, NumElements);
5418 PATypeHolder* PTy = new PATypeHolder(
5419 HandleUpRefs(
5420 VectorType::get(
5421 ETy,
5422 NumElements)
5423 )
5424 );
5425
5426 // Verify all elements are correct type!
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005427 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5428 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005429 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5430 ETy->getDescription() +"' as required!\nIt is of type '" +
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005431 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005432 }
5433
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005434 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5435 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005436 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005437 ;}
5438 break;
5439
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005440 case 256:
5441#line 2463 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005442 {
5443 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005444 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005445 ;}
5446 break;
5447
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005448 case 257:
5449#line 2467 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005450 {
5451 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5452 delete (yyvsp[(3) - (5)].StrVal);
5453 delete (yyvsp[(5) - (5)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005454 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005455 ;}
5456 break;
5457
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005458 case 258:
5459#line 2477 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005460 { // Is it an integer reference...?
5461 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005462 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005463 ;}
5464 break;
5465
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005466 case 259:
5467#line 2481 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005468 {
5469 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005470 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005471 ;}
5472 break;
5473
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005474 case 260:
5475#line 2485 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005476 { // Is it a named reference...?
5477 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5478 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005479 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005480 ;}
5481 break;
5482
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005483 case 261:
5484#line 2490 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005485 { // Is it a named reference...?
5486 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5487 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005488 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005489 ;}
5490 break;
5491
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005492 case 264:
5493#line 2503 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005494 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005495 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005496 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5497 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5498 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005499 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005500 ;}
5501 break;
5502
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005503 case 265:
5504#line 2512 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005505 {
5506 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005507 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005508 ;}
5509 break;
5510
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005511 case 266:
5512#line 2516 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005513 { // Do not allow functions with 0 basic blocks
5514 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005515 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005516 ;}
5517 break;
5518
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005519 case 267:
5520#line 2525 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005521 {
5522 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005523 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005524 InsertValue((yyvsp[(3) - (3)].TermInstVal));
5525 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
5526 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005527 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005528 ;}
5529 break;
5530
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005531 case 268:
5532#line 2534 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005533 {
5534 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005535 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5536 if (CI2->getParent() == 0)
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005537 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
5538 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
5539 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005540 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005541 ;}
5542 break;
5543
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005544 case 269:
5545#line 2543 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005546 { // Empty space between instruction lists
5547 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005548 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005549 ;}
5550 break;
5551
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005552 case 270:
5553#line 2547 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005554 { // Labelled (named) basic block
5555 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
5556 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005557 CHECK_FOR_ERROR
5558
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005559 ;}
5560 break;
Reid Spenceraa8ae282007-07-31 03:50:36 +00005561
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005562 case 271:
5563#line 2554 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005564 { // Return with a result...
5565 (yyval.TermInstVal) = new ReturnInst((yyvsp[(2) - (2)].ValueVal));
5566 CHECK_FOR_ERROR
5567 ;}
5568 break;
5569
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005570 case 272:
5571#line 2558 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005572 { // Return with no result...
5573 (yyval.TermInstVal) = new ReturnInst();
5574 CHECK_FOR_ERROR
5575 ;}
5576 break;
5577
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005578 case 273:
5579#line 2562 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005580 { // Unconditional Branch...
5581 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
5582 CHECK_FOR_ERROR
5583 (yyval.TermInstVal) = new BranchInst(tmpBB);
5584 ;}
5585 break;
5586
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005587 case 274:
5588#line 2567 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005589 {
5590 assert(cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?");
5591 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5592 CHECK_FOR_ERROR
5593 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
5594 CHECK_FOR_ERROR
5595 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
5596 CHECK_FOR_ERROR
5597 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
5598 ;}
5599 break;
5600
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005601 case 275:
5602#line 2577 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005603 {
5604 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
5605 CHECK_FOR_ERROR
5606 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5607 CHECK_FOR_ERROR
5608 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
5609 (yyval.TermInstVal) = S;
5610
5611 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
5612 E = (yyvsp[(8) - (9)].JumpTable)->end();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005613 for (; I != E; ++I) {
5614 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5615 S->addCase(CI, I->second);
5616 else
5617 GEN_ERROR("Switch case is constant, but not a simple integer");
5618 }
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005619 delete (yyvsp[(8) - (9)].JumpTable);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005620 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005621 ;}
5622 break;
5623
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005624 case 276:
5625#line 2596 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005626 {
5627 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005628 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005629 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005630 CHECK_FOR_ERROR
5631 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005632 (yyval.TermInstVal) = S;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005633 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005634 ;}
5635 break;
5636
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005637 case 277:
5638#line 2606 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005639 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005640
5641 // Handle the short syntax
5642 const PointerType *PFTy = 0;
5643 const FunctionType *Ty = 0;
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005644 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005645 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5646 // Pull out the types of all of the arguments...
5647 std::vector<const Type*> ParamTypes;
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005648 ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005649 for (; I != E; ++I) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005650 const Type *Ty = I->Val->getType();
5651 if (Ty == Type::VoidTy)
5652 GEN_ERROR("Short call syntax cannot be used with varargs");
5653 ParamTypes.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005654 }
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005655 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005656 PFTy = PointerType::get(Ty);
5657 }
5658
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005659 delete (yyvsp[(3) - (14)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005660
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005661 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005662 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005663 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005664 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005665 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005666 CHECK_FOR_ERROR
5667
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005668 ParamAttrsVector Attrs;
5669 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None) {
5670 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[(8) - (14)].ParamAttrs);
5671 Attrs.push_back(PAWI);
5672 }
5673
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005674 // Check the arguments
5675 ValueList Args;
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005676 if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005677 // Make sure no arguments is a good thing!
5678 if (Ty->getNumParams() != 0)
5679 GEN_ERROR("No arguments passed to a function that "
5680 "expects arguments");
5681 } else { // Has arguments?
5682 // Loop through FunctionType's arguments and ensure they are specified
5683 // correctly!
5684 FunctionType::param_iterator I = Ty->param_begin();
5685 FunctionType::param_iterator E = Ty->param_end();
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005686 ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005687 unsigned index = 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005688
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005689 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005690 if (ArgI->Val->getType() != *I)
5691 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5692 (*I)->getDescription() + "'");
5693 Args.push_back(ArgI->Val);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005694 if (ArgI->Attrs != ParamAttr::None) {
5695 ParamAttrsWithIndex PAWI;
5696 PAWI.index = index;
5697 PAWI.attrs = ArgI->Attrs;
5698 Attrs.push_back(PAWI);
5699 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005700 }
5701
5702 if (Ty->isVarArg()) {
5703 if (I == E)
5704 for (; ArgI != ArgE; ++ArgI)
5705 Args.push_back(ArgI->Val); // push the remaining varargs
5706 } else if (I != E || ArgI != ArgE)
5707 GEN_ERROR("Invalid number of parameters detected");
5708 }
5709
Duncan Sands637ec552007-11-28 17:07:01 +00005710 const ParamAttrsList *PAL = 0;
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005711 if (!Attrs.empty())
5712 PAL = ParamAttrsList::get(Attrs);
5713
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005714 // Create the InvokeInst
Chris Lattnerd140ada2007-08-29 16:15:23 +00005715 InvokeInst *II = new InvokeInst(V, Normal, Except, Args.begin(), Args.end());
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005716 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005717 II->setParamAttrs(PAL);
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005718 (yyval.TermInstVal) = II;
5719 delete (yyvsp[(6) - (14)].ParamList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005720 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005721 ;}
5722 break;
5723
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005724 case 278:
5725#line 2689 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005726 {
5727 (yyval.TermInstVal) = new UnwindInst();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005728 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005729 ;}
5730 break;
5731
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005732 case 279:
5733#line 2693 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005734 {
5735 (yyval.TermInstVal) = new UnreachableInst();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005736 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005737 ;}
5738 break;
5739
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005740 case 280:
5741#line 2700 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005742 {
5743 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
5744 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005745 CHECK_FOR_ERROR
5746 if (V == 0)
5747 GEN_ERROR("May only switch on a constant pool value");
5748
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005749 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005750 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005751 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5752 ;}
5753 break;
5754
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005755 case 281:
5756#line 2711 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005757 {
5758 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5759 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005760 CHECK_FOR_ERROR
5761
5762 if (V == 0)
5763 GEN_ERROR("May only switch on a constant pool value");
5764
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005765 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005766 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005767 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5768 ;}
5769 break;
5770
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005771 case 282:
5772#line 2724 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005773 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005774 // Is this definition named?? if so, assign the name...
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005775 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005776 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005777 InsertValue((yyvsp[(2) - (2)].InstVal));
5778 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005779 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005780 ;}
5781 break;
5782
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005783 case 283:
5784#line 2734 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005785 { // Used for PHI nodes
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005786 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005787 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
5788 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5789 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005790 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005791 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005792 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005793 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5794 delete (yyvsp[(1) - (6)].TypeVal);
5795 ;}
5796 break;
5797
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005798 case 284:
5799#line 2745 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005800 {
5801 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
5802 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005803 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005804 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005805 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005806 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5807 ;}
5808 break;
5809
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005810 case 285:
5811#line 2755 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005812 {
5813 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005814 if (!UpRefs.empty())
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005815 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005816 // Used for call and invoke instructions
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005817 (yyval.ParamList) = new ParamList();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005818 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005819 (yyval.ParamList)->push_back(E);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005820 delete (yyvsp[(1) - (4)].TypeVal);
5821 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005822 ;}
5823 break;
5824
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005825 case 286:
5826#line 2766 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005827 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005828 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dale Johannesencfb19e62007-11-05 21:20:28 +00005829 // Labels are only valid in ASMs
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005830 (yyval.ParamList) = new ParamList();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005831 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005832 (yyval.ParamList)->push_back(E);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005833 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005834 ;}
5835 break;
5836
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005837 case 287:
5838#line 2774 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005839 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005840 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005841 if (!UpRefs.empty())
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005842 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5843 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5844 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005845 (yyval.ParamList)->push_back(E);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005846 delete (yyvsp[(3) - (6)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005847 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005848 ;}
5849 break;
5850
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005851 case 288:
5852#line 2784 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005853 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005854 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
5855 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5856 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005857 (yyval.ParamList)->push_back(E);
Dale Johannesencfb19e62007-11-05 21:20:28 +00005858 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005859 ;}
5860 break;
5861
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005862 case 289:
5863#line 2791 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005864 { (yyval.ParamList) = new ParamList(); ;}
5865 break;
5866
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005867 case 290:
5868#line 2794 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005869 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5870 break;
5871
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005872 case 291:
5873#line 2795 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005874 {
5875 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
5876 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005877 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005878 ;}
5879 break;
5880
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005881 case 292:
5882#line 2802 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005883 {
5884 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005885 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005886 ;}
5887 break;
5888
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005889 case 293:
5890#line 2806 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005891 {
5892 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005893 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005894 ;}
5895 break;
5896
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005897 case 294:
5898#line 2811 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005899 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005900 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005901 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
5902 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
5903 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005904 GEN_ERROR(
5905 "Arithmetic operator requires integer, FP, or packed operands");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005906 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005907 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005908 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005909 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005910 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
5911 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005912 GEN_ERROR("binary operator returned null");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005913 delete (yyvsp[(2) - (5)].TypeVal);
5914 ;}
5915 break;
5916
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005917 case 295:
5918#line 2827 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005919 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005920 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005921 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
5922 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
5923 if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
5924 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005925 GEN_ERROR("Logical operator requires integral operands");
5926 }
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005927 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005928 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005929 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005930 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005931 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
5932 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005933 GEN_ERROR("binary operator returned null");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005934 delete (yyvsp[(2) - (5)].TypeVal);
5935 ;}
5936 break;
5937
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005938 case 296:
5939#line 2844 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005940 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005941 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005942 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5943 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005944 GEN_ERROR("Vector types not supported by icmp instruction");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005945 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005946 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005947 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005948 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005949 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
5950 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005951 GEN_ERROR("icmp operator returned null");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005952 delete (yyvsp[(3) - (6)].TypeVal);
5953 ;}
5954 break;
5955
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005956 case 297:
5957#line 2858 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005958 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005959 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005960 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5961 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005962 GEN_ERROR("Vector types not supported by fcmp instruction");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005963 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005964 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005965 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005966 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005967 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
5968 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005969 GEN_ERROR("fcmp operator returned null");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005970 delete (yyvsp[(3) - (6)].TypeVal);
5971 ;}
5972 break;
5973
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005974 case 298:
5975#line 2872 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005976 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005977 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005978 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
5979 Value* Val = (yyvsp[(2) - (4)].ValueVal);
5980 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
5981 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005982 GEN_ERROR("invalid cast opcode for cast from '" +
5983 Val->getType()->getDescription() + "' to '" +
5984 DestTy->getDescription() + "'");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005985 (yyval.InstVal) = CastInst::create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
5986 delete (yyvsp[(4) - (4)].TypeVal);
5987 ;}
5988 break;
5989
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005990 case 299:
5991#line 2884 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005992 {
5993 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005994 GEN_ERROR("select condition must be boolean");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005995 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005996 GEN_ERROR("select value types should match");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005997 (yyval.InstVal) = new SelectInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005998 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00005999 ;}
6000 break;
6001
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00006002 case 300:
6003#line 2892 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006004 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006005 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006006 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6007 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6008 delete (yyvsp[(4) - (4)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006009 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006010 ;}
6011 break;
6012
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00006013 case 301:
6014#line 2899 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006015 {
6016 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006017 GEN_ERROR("Invalid extractelement operands");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006018 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006019 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006020 ;}
6021 break;
6022
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00006023 case 302:
6024#line 2905 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006025 {
6026 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006027 GEN_ERROR("Invalid insertelement operands");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006028 (yyval.InstVal) = new InsertElementInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006029 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006030 ;}
6031 break;
6032
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00006033 case 303:
6034#line 2911 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006035 {
6036 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006037 GEN_ERROR("Invalid shufflevector operands");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006038 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006039 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006040 ;}
6041 break;
6042
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00006043 case 304:
6044#line 2917 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006045 {
6046 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006047 if (!Ty->isFirstClassType())
6048 GEN_ERROR("PHI node operands must be of first class type");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006049 (yyval.InstVal) = new PHINode(Ty);
6050 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6051 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6052 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006053 GEN_ERROR("All elements of a PHI node must be of the same type");
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006054 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6055 (yyvsp[(2) - (2)].PHIList)->pop_front();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006056 }
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006057 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006058 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006059 ;}
6060 break;
6061
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00006062 case 305:
6063#line 2933 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006064 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006065
6066 // Handle the short syntax
6067 const PointerType *PFTy = 0;
6068 const FunctionType *Ty = 0;
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006069 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006070 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6071 // Pull out the types of all of the arguments...
6072 std::vector<const Type*> ParamTypes;
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006073 ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006074 for (; I != E; ++I) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006075 const Type *Ty = I->Val->getType();
6076 if (Ty == Type::VoidTy)
6077 GEN_ERROR("Short call syntax cannot be used with varargs");
6078 ParamTypes.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006079 }
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006080 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006081 PFTy = PointerType::get(Ty);
6082 }
6083
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006084 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006085 CHECK_FOR_ERROR
6086
6087 // Check for call to invalid intrinsic to avoid crashing later.
6088 if (Function *theF = dyn_cast<Function>(V)) {
6089 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
6090 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6091 !theF->getIntrinsicID(true))
6092 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6093 theF->getName() + "'");
6094 }
6095
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006096 // Set up the ParamAttrs for the function
6097 ParamAttrsVector Attrs;
6098 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None) {
6099 ParamAttrsWithIndex PAWI;
6100 PAWI.index = 0;
6101 PAWI.attrs = (yyvsp[(8) - (8)].ParamAttrs);
6102 Attrs.push_back(PAWI);
6103 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006104 // Check the arguments
6105 ValueList Args;
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006106 if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006107 // Make sure no arguments is a good thing!
6108 if (Ty->getNumParams() != 0)
6109 GEN_ERROR("No arguments passed to a function that "
6110 "expects arguments");
6111 } else { // Has arguments?
6112 // Loop through FunctionType's arguments and ensure they are specified
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006113 // correctly. Also, gather any parameter attributes.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006114 FunctionType::param_iterator I = Ty->param_begin();
6115 FunctionType::param_iterator E = Ty->param_end();
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006116 ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006117 unsigned index = 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006118
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006119 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006120 if (ArgI->Val->getType() != *I)
6121 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6122 (*I)->getDescription() + "'");
6123 Args.push_back(ArgI->Val);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006124 if (ArgI->Attrs != ParamAttr::None) {
6125 ParamAttrsWithIndex PAWI;
6126 PAWI.index = index;
6127 PAWI.attrs = ArgI->Attrs;
6128 Attrs.push_back(PAWI);
6129 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006130 }
6131 if (Ty->isVarArg()) {
6132 if (I == E)
6133 for (; ArgI != ArgE; ++ArgI)
6134 Args.push_back(ArgI->Val); // push the remaining varargs
6135 } else if (I != E || ArgI != ArgE)
6136 GEN_ERROR("Invalid number of parameters detected");
6137 }
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006138
6139 // Finish off the ParamAttrs and check them
Duncan Sands637ec552007-11-28 17:07:01 +00006140 const ParamAttrsList *PAL = 0;
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006141 if (!Attrs.empty())
6142 PAL = ParamAttrsList::get(Attrs);
6143
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006144 // Create the call node
David Greene9145dd22007-08-01 03:59:32 +00006145 CallInst *CI = new CallInst(V, Args.begin(), Args.end());
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006146 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6147 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006148 CI->setParamAttrs(PAL);
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006149 (yyval.InstVal) = CI;
6150 delete (yyvsp[(6) - (8)].ParamList);
6151 delete (yyvsp[(3) - (8)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006152 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006153 ;}
6154 break;
6155
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00006156 case 306:
6157#line 3023 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006158 {
6159 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006160 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006161 ;}
6162 break;
6163
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00006164 case 307:
6165#line 3028 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006166 {
6167 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006168 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006169 ;}
6170 break;
6171
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00006172 case 308:
6173#line 3032 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006174 {
6175 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006176 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006177 ;}
6178 break;
6179
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00006180 case 309:
6181#line 3039 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006182 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006183 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006184 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6185 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6186 delete (yyvsp[(2) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006187 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006188 ;}
6189 break;
6190
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00006191 case 310:
6192#line 3046 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006193 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006194 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006195 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6196 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006197 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006198 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6199 delete (yyvsp[(2) - (6)].TypeVal);
6200 ;}
6201 break;
6202
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00006203 case 311:
6204#line 3054 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006205 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006206 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006207 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6208 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6209 delete (yyvsp[(2) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006210 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006211 ;}
6212 break;
6213
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00006214 case 312:
6215#line 3061 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006216 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006217 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006218 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6219 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006220 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006221 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6222 delete (yyvsp[(2) - (6)].TypeVal);
6223 ;}
6224 break;
6225
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00006226 case 313:
6227#line 3069 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006228 {
6229 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006230 GEN_ERROR("Trying to free nonpointer type " +
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006231 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6232 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006233 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006234 ;}
6235 break;
6236
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00006237 case 314:
6238#line 3077 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006239 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006240 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006241 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6242 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006243 GEN_ERROR("Can't load from nonpointer type: " +
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006244 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6245 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006246 GEN_ERROR("Can't load from pointer of non-first-class type: " +
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006247 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6248 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006249 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006250 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6251 delete (yyvsp[(3) - (5)].TypeVal);
6252 ;}
6253 break;
6254
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00006255 case 315:
6256#line 3091 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006257 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006258 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006259 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6260 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006261 if (!PT)
6262 GEN_ERROR("Can't store to a nonpointer type: " +
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006263 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006264 const Type *ElTy = PT->getElementType();
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006265 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6266 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006267 "' into space of type '" + ElTy->getDescription() + "'");
6268
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006269 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006270 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006271 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6272 delete (yyvsp[(5) - (7)].TypeVal);
6273 ;}
6274 break;
6275
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00006276 case 316:
6277#line 3108 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006278 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006279 if (!UpRefs.empty())
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006280 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6281 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006282 GEN_ERROR("getelementptr insn requires pointer operand");
6283
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006284 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end(), true))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006285 GEN_ERROR("Invalid getelementptr indices for type '" +
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006286 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6287 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006288 CHECK_FOR_ERROR
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006289 (yyval.InstVal) = new GetElementPtrInst(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6290 delete (yyvsp[(2) - (4)].TypeVal);
6291 delete (yyvsp[(4) - (4)].ValueList);
6292 ;}
6293 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006294
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006295
6296/* Line 1267 of yacc.c. */
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00006297#line 6298 "llvmAsmParser.tab.c"
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006298 default: break;
Dale Johannesen3afee192007-09-07 21:07:57 +00006299 }
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006300 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6301
6302 YYPOPSTACK (yylen);
6303 yylen = 0;
6304 YY_STACK_PRINT (yyss, yyssp);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006305
6306 *++yyvsp = yyval;
6307
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006308
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006309 /* Now `shift' the result of the reduction. Determine what state
6310 that goes to, based on the state we popped back to and the rule
6311 number reduced by. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006312
6313 yyn = yyr1[yyn];
6314
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006315 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6316 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006317 yystate = yytable[yystate];
6318 else
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006319 yystate = yydefgoto[yyn - YYNTOKENS];
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006320
6321 goto yynewstate;
6322
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006323
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006324/*------------------------------------.
6325| yyerrlab -- here on detecting error |
6326`------------------------------------*/
6327yyerrlab:
6328 /* If not already recovering from an error, report this error. */
6329 if (!yyerrstatus)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006330 {
6331 ++yynerrs;
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006332#if ! YYERROR_VERBOSE
6333 yyerror (YY_("syntax error"));
6334#else
6335 {
6336 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
6337 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
6338 {
6339 YYSIZE_T yyalloc = 2 * yysize;
6340 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
6341 yyalloc = YYSTACK_ALLOC_MAXIMUM;
6342 if (yymsg != yymsgbuf)
6343 YYSTACK_FREE (yymsg);
6344 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
6345 if (yymsg)
6346 yymsg_alloc = yyalloc;
6347 else
6348 {
6349 yymsg = yymsgbuf;
6350 yymsg_alloc = sizeof yymsgbuf;
6351 }
6352 }
Dale Johannesen3afee192007-09-07 21:07:57 +00006353
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006354 if (0 < yysize && yysize <= yymsg_alloc)
6355 {
6356 (void) yysyntax_error (yymsg, yystate, yychar);
6357 yyerror (yymsg);
6358 }
6359 else
6360 {
6361 yyerror (YY_("syntax error"));
6362 if (yysize != 0)
6363 goto yyexhaustedlab;
6364 }
6365 }
6366#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006367 }
6368
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006369
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006370
6371 if (yyerrstatus == 3)
6372 {
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006373 /* If just tried and failed to reuse look-ahead token after an
6374 error, discard it. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006375
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006376 if (yychar <= YYEOF)
6377 {
6378 /* Return failure if at end of input. */
6379 if (yychar == YYEOF)
6380 YYABORT;
6381 }
6382 else
6383 {
6384 yydestruct ("Error: discarding",
6385 yytoken, &yylval);
6386 yychar = YYEMPTY;
6387 }
6388 }
6389
6390 /* Else will try to reuse look-ahead token after shifting the error
6391 token. */
6392 goto yyerrlab1;
6393
6394
6395/*---------------------------------------------------.
6396| yyerrorlab -- error raised explicitly by YYERROR. |
6397`---------------------------------------------------*/
6398yyerrorlab:
6399
6400 /* Pacify compilers like GCC when the user code never invokes
6401 YYERROR and the label yyerrorlab therefore never appears in user
6402 code. */
6403 if (/*CONSTCOND*/ 0)
6404 goto yyerrorlab;
6405
6406 /* Do not reclaim the symbols of the rule which action triggered
6407 this YYERROR. */
6408 YYPOPSTACK (yylen);
6409 yylen = 0;
6410 YY_STACK_PRINT (yyss, yyssp);
6411 yystate = *yyssp;
6412 goto yyerrlab1;
6413
6414
6415/*-------------------------------------------------------------.
6416| yyerrlab1 -- common code for both syntax error and YYERROR. |
6417`-------------------------------------------------------------*/
6418yyerrlab1:
6419 yyerrstatus = 3; /* Each real token shifted decrements this. */
6420
6421 for (;;)
6422 {
6423 yyn = yypact[yystate];
6424 if (yyn != YYPACT_NINF)
6425 {
6426 yyn += YYTERROR;
6427 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6428 {
6429 yyn = yytable[yyn];
6430 if (0 < yyn)
6431 break;
6432 }
6433 }
6434
6435 /* Pop the current state because it cannot handle the error token. */
6436 if (yyssp == yyss)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006437 YYABORT;
6438
Dale Johannesen3afee192007-09-07 21:07:57 +00006439
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006440 yydestruct ("Error: popping",
6441 yystos[yystate], yyvsp);
6442 YYPOPSTACK (1);
6443 yystate = *yyssp;
6444 YY_STACK_PRINT (yyss, yyssp);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006445 }
6446
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006447 if (yyn == YYFINAL)
6448 YYACCEPT;
6449
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006450 *++yyvsp = yylval;
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006451
6452
6453 /* Shift the error token. */
6454 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spenceraa8ae282007-07-31 03:50:36 +00006455
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006456 yystate = yyn;
6457 goto yynewstate;
6458
David Greene48556392007-09-04 18:46:50 +00006459
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006460/*-------------------------------------.
6461| yyacceptlab -- YYACCEPT comes here. |
6462`-------------------------------------*/
6463yyacceptlab:
6464 yyresult = 0;
6465 goto yyreturn;
6466
6467/*-----------------------------------.
6468| yyabortlab -- YYABORT comes here. |
6469`-----------------------------------*/
6470yyabortlab:
6471 yyresult = 1;
6472 goto yyreturn;
6473
6474#ifndef yyoverflow
6475/*-------------------------------------------------.
6476| yyexhaustedlab -- memory exhaustion comes here. |
6477`-------------------------------------------------*/
6478yyexhaustedlab:
6479 yyerror (YY_("memory exhausted"));
6480 yyresult = 2;
6481 /* Fall through. */
David Greene48556392007-09-04 18:46:50 +00006482#endif
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006483
6484yyreturn:
6485 if (yychar != YYEOF && yychar != YYEMPTY)
6486 yydestruct ("Cleanup: discarding lookahead",
6487 yytoken, &yylval);
6488 /* Do not reclaim the symbols of the rule which action triggered
6489 this YYABORT or YYACCEPT. */
6490 YYPOPSTACK (yylen);
6491 YY_STACK_PRINT (yyss, yyssp);
6492 while (yyssp != yyss)
6493 {
6494 yydestruct ("Cleanup: popping",
6495 yystos[*yyssp], yyvsp);
6496 YYPOPSTACK (1);
Dale Johannesen3afee192007-09-07 21:07:57 +00006497 }
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006498#ifndef yyoverflow
6499 if (yyss != yyssa)
6500 YYSTACK_FREE (yyss);
6501#endif
6502#if YYERROR_VERBOSE
6503 if (yymsg != yymsgbuf)
6504 YYSTACK_FREE (yymsg);
6505#endif
6506 /* Make sure YYID is used. */
6507 return YYID (yyresult);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006508}
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006509
6510
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00006511#line 3125 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006512
6513
6514// common code from the two 'RunVMAsmParser' functions
6515static Module* RunParser(Module * M) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006516 CurModule.CurrentModule = M;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006517 // Check to make sure the parser succeeded
6518 if (yyparse()) {
6519 if (ParserResult)
6520 delete ParserResult;
6521 return 0;
6522 }
6523
6524 // Emit an error if there are any unresolved types left.
6525 if (!CurModule.LateResolveTypes.empty()) {
6526 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6527 if (DID.Type == ValID::LocalName) {
6528 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6529 } else {
6530 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
6531 }
6532 if (ParserResult)
6533 delete ParserResult;
6534 return 0;
6535 }
6536
6537 // Emit an error if there are any unresolved values left.
6538 if (!CurModule.LateResolveValues.empty()) {
6539 Value *V = CurModule.LateResolveValues.back();
6540 std::map<Value*, std::pair<ValID, int> >::iterator I =
6541 CurModule.PlaceHolderInfo.find(V);
6542
6543 if (I != CurModule.PlaceHolderInfo.end()) {
6544 ValID &DID = I->second.first;
6545 if (DID.Type == ValID::LocalName) {
6546 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
6547 } else {
6548 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
6549 }
6550 if (ParserResult)
6551 delete ParserResult;
6552 return 0;
6553 }
6554 }
6555
6556 // Check to make sure that parsing produced a result
6557 if (!ParserResult)
6558 return 0;
6559
6560 // Reset ParserResult variable while saving its value for the result.
6561 Module *Result = ParserResult;
6562 ParserResult = 0;
6563
6564 return Result;
6565}
6566
6567void llvm::GenerateError(const std::string &message, int LineNo) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006568 if (LineNo == -1) LineNo = LLLgetLineNo();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006569 // TODO: column number in exception
6570 if (TheParseError)
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006571 TheParseError->setError(LLLgetFilename(), message, LineNo);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006572 TriggerError = 1;
6573}
6574
6575int yyerror(const char *ErrorMsg) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006576 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006577 std::string errMsg = where + "error: " + std::string(ErrorMsg);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006578 if (yychar != YYEMPTY && yychar != 0) {
6579 errMsg += " while reading token: '";
6580 errMsg += std::string(LLLgetTokenStart(),
6581 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
6582 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006583 GenerateError(errMsg);
6584 return 0;
6585}
Anton Korobeynikov66e28652007-11-14 09:53:48 +00006586