blob: bd6d59115494127edb461867688ed77cc351cb8c [file] [log] [blame]
Dan Gohman54392c12008-04-19 00:24:39 +00001/* A Bison parser, made by GNU Bison 2.3. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002
Dan Gohman54392c12008-04-19 00:24:39 +00003/* Skeleton implementation for Bison's Yacc-like parsers in C
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004
Dan Gohman54392c12008-04-19 00:24:39 +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
Dan Gohman54392c12008-04-19 00:24:39 +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
Dan Gohman54392c12008-04-19 00:24:39 +000063#define yylex llvmAsmlex
Dan Gohmanf17a25c2007-07-18 16:29:46 +000064#define yyerror llvmAsmerror
Dan Gohman54392c12008-04-19 00:24:39 +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
Dan Gohman54392c12008-04-19 00:24:39 +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,
Dale Johannesen280e7bc2008-05-14 20:13:36 +0000123 COMMON = 304,
124 OPAQUE = 305,
125 EXTERNAL = 306,
126 TARGET = 307,
127 TRIPLE = 308,
128 ALIGN = 309,
129 ADDRSPACE = 310,
130 DEPLIBS = 311,
131 CALL = 312,
132 TAIL = 313,
133 ASM_TOK = 314,
134 MODULE = 315,
135 SIDEEFFECT = 316,
136 CC_TOK = 317,
137 CCC_TOK = 318,
138 FASTCC_TOK = 319,
139 COLDCC_TOK = 320,
140 X86_STDCALLCC_TOK = 321,
141 X86_FASTCALLCC_TOK = 322,
142 DATALAYOUT = 323,
143 RET = 324,
144 BR = 325,
145 SWITCH = 326,
146 INVOKE = 327,
147 UNWIND = 328,
148 UNREACHABLE = 329,
149 ADD = 330,
150 SUB = 331,
151 MUL = 332,
152 UDIV = 333,
153 SDIV = 334,
154 FDIV = 335,
155 UREM = 336,
156 SREM = 337,
157 FREM = 338,
158 AND = 339,
159 OR = 340,
160 XOR = 341,
161 SHL = 342,
162 LSHR = 343,
163 ASHR = 344,
164 ICMP = 345,
165 FCMP = 346,
166 VICMP = 347,
167 VFCMP = 348,
168 EQ = 349,
169 NE = 350,
170 SLT = 351,
171 SGT = 352,
172 SLE = 353,
173 SGE = 354,
174 ULT = 355,
175 UGT = 356,
176 ULE = 357,
177 UGE = 358,
178 OEQ = 359,
179 ONE = 360,
180 OLT = 361,
181 OGT = 362,
182 OLE = 363,
183 OGE = 364,
184 ORD = 365,
185 UNO = 366,
186 UEQ = 367,
187 UNE = 368,
188 MALLOC = 369,
189 ALLOCA = 370,
190 FREE = 371,
191 LOAD = 372,
192 STORE = 373,
193 GETELEMENTPTR = 374,
194 TRUNC = 375,
195 ZEXT = 376,
196 SEXT = 377,
197 FPTRUNC = 378,
198 FPEXT = 379,
199 BITCAST = 380,
200 UITOFP = 381,
201 SITOFP = 382,
202 FPTOUI = 383,
203 FPTOSI = 384,
204 INTTOPTR = 385,
205 PTRTOINT = 386,
206 PHI_TOK = 387,
207 SELECT = 388,
208 VAARG = 389,
209 EXTRACTELEMENT = 390,
210 INSERTELEMENT = 391,
211 SHUFFLEVECTOR = 392,
212 GETRESULT = 393,
Dan Gohmane6b1ee62008-05-23 01:55:30 +0000213 EXTRACTVALUE = 394,
214 INSERTVALUE = 395,
215 SIGNEXT = 396,
216 ZEROEXT = 397,
217 NORETURN = 398,
218 INREG = 399,
219 SRET = 400,
220 NOUNWIND = 401,
221 NOALIAS = 402,
222 BYVAL = 403,
223 NEST = 404,
224 READNONE = 405,
225 READONLY = 406,
226 GC = 407,
227 DEFAULT = 408,
228 HIDDEN = 409,
229 PROTECTED = 410
Dan Gohman54392c12008-04-19 00:24:39 +0000230 };
231#endif
232/* Tokens. */
233#define ESINT64VAL 258
234#define EUINT64VAL 259
235#define ESAPINTVAL 260
236#define EUAPINTVAL 261
237#define LOCALVAL_ID 262
238#define GLOBALVAL_ID 263
239#define FPVAL 264
240#define VOID 265
241#define INTTYPE 266
242#define FLOAT 267
243#define DOUBLE 268
244#define X86_FP80 269
245#define FP128 270
246#define PPC_FP128 271
247#define LABEL 272
248#define TYPE 273
249#define LOCALVAR 274
250#define GLOBALVAR 275
251#define LABELSTR 276
252#define STRINGCONSTANT 277
253#define ATSTRINGCONSTANT 278
254#define PCTSTRINGCONSTANT 279
255#define ZEROINITIALIZER 280
256#define TRUETOK 281
257#define FALSETOK 282
258#define BEGINTOK 283
259#define ENDTOK 284
260#define DECLARE 285
261#define DEFINE 286
262#define GLOBAL 287
263#define CONSTANT 288
264#define SECTION 289
265#define ALIAS 290
266#define VOLATILE 291
267#define THREAD_LOCAL 292
268#define TO 293
269#define DOTDOTDOT 294
270#define NULL_TOK 295
271#define UNDEF 296
272#define INTERNAL 297
273#define LINKONCE 298
274#define WEAK 299
275#define APPENDING 300
276#define DLLIMPORT 301
277#define DLLEXPORT 302
278#define EXTERN_WEAK 303
Dale Johannesen280e7bc2008-05-14 20:13:36 +0000279#define COMMON 304
280#define OPAQUE 305
281#define EXTERNAL 306
282#define TARGET 307
283#define TRIPLE 308
284#define ALIGN 309
285#define ADDRSPACE 310
286#define DEPLIBS 311
287#define CALL 312
288#define TAIL 313
289#define ASM_TOK 314
290#define MODULE 315
291#define SIDEEFFECT 316
292#define CC_TOK 317
293#define CCC_TOK 318
294#define FASTCC_TOK 319
295#define COLDCC_TOK 320
296#define X86_STDCALLCC_TOK 321
297#define X86_FASTCALLCC_TOK 322
298#define DATALAYOUT 323
299#define RET 324
300#define BR 325
301#define SWITCH 326
302#define INVOKE 327
303#define UNWIND 328
304#define UNREACHABLE 329
305#define ADD 330
306#define SUB 331
307#define MUL 332
308#define UDIV 333
309#define SDIV 334
310#define FDIV 335
311#define UREM 336
312#define SREM 337
313#define FREM 338
314#define AND 339
315#define OR 340
316#define XOR 341
317#define SHL 342
318#define LSHR 343
319#define ASHR 344
320#define ICMP 345
321#define FCMP 346
322#define VICMP 347
323#define VFCMP 348
324#define EQ 349
325#define NE 350
326#define SLT 351
327#define SGT 352
328#define SLE 353
329#define SGE 354
330#define ULT 355
331#define UGT 356
332#define ULE 357
333#define UGE 358
334#define OEQ 359
335#define ONE 360
336#define OLT 361
337#define OGT 362
338#define OLE 363
339#define OGE 364
340#define ORD 365
341#define UNO 366
342#define UEQ 367
343#define UNE 368
344#define MALLOC 369
345#define ALLOCA 370
346#define FREE 371
347#define LOAD 372
348#define STORE 373
349#define GETELEMENTPTR 374
350#define TRUNC 375
351#define ZEXT 376
352#define SEXT 377
353#define FPTRUNC 378
354#define FPEXT 379
355#define BITCAST 380
356#define UITOFP 381
357#define SITOFP 382
358#define FPTOUI 383
359#define FPTOSI 384
360#define INTTOPTR 385
361#define PTRTOINT 386
362#define PHI_TOK 387
363#define SELECT 388
364#define VAARG 389
365#define EXTRACTELEMENT 390
366#define INSERTELEMENT 391
367#define SHUFFLEVECTOR 392
368#define GETRESULT 393
Dan Gohmane6b1ee62008-05-23 01:55:30 +0000369#define EXTRACTVALUE 394
370#define INSERTVALUE 395
371#define SIGNEXT 396
372#define ZEROEXT 397
373#define NORETURN 398
374#define INREG 399
375#define SRET 400
376#define NOUNWIND 401
377#define NOALIAS 402
378#define BYVAL 403
379#define NEST 404
380#define READNONE 405
381#define READONLY 406
382#define GC 407
383#define DEFAULT 408
384#define HIDDEN 409
385#define PROTECTED 410
Dan Gohman54392c12008-04-19 00:24:39 +0000386
387
388
389
390/* Copy the first part of user declarations. */
Dan Gohmane6b1ee62008-05-23 01:55:30 +0000391#line 14 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000392
393#include "ParserInternals.h"
394#include "llvm/CallingConv.h"
395#include "llvm/InlineAsm.h"
396#include "llvm/Instructions.h"
397#include "llvm/Module.h"
398#include "llvm/ValueSymbolTable.h"
Chandler Carruth563d4a42007-08-04 01:56:21 +0000399#include "llvm/AutoUpgrade.h"
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000400#include "llvm/Support/GetElementPtrTypeIterator.h"
401#include "llvm/Support/CommandLine.h"
402#include "llvm/ADT/SmallVector.h"
403#include "llvm/ADT/STLExtras.h"
404#include "llvm/Support/MathExtras.h"
405#include "llvm/Support/Streams.h"
406#include <algorithm>
407#include <list>
408#include <map>
409#include <utility>
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000410
411// The following is a gross hack. In order to rid the libAsmParser library of
412// exceptions, we have to have a way of getting the yyparse function to go into
413// an error situation. So, whenever we want an error to occur, the GenerateError
414// function (see bottom of file) sets TriggerError. Then, at the end of each
415// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
416// (a goto) to put YACC in error state. Furthermore, several calls to
417// GenerateError are made from inside productions and they must simulate the
418// previous exception behavior by exiting the production immediately. We have
419// replaced these with the GEN_ERROR macro which calls GeneratError and then
420// immediately invokes YYERROR. This would be so much cleaner if it was a
421// recursive descent parser.
422static bool TriggerError = false;
423#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
424#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
425
426int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
427int yylex(); // declaration" of xxx warnings.
428int yyparse();
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000429using namespace llvm;
430
431static Module *ParserResult;
432
433// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
434// relating to upreferences in the input stream.
435//
436//#define DEBUG_UPREFS 1
437#ifdef DEBUG_UPREFS
438#define UR_OUT(X) cerr << X
439#else
440#define UR_OUT(X)
441#endif
442
443#define YYERROR_VERBOSE 1
444
445static GlobalVariable *CurGV;
446
447
448// This contains info used when building the body of a function. It is
449// destroyed when the function is completed.
450//
451typedef std::vector<Value *> ValueList; // Numbered defs
452
453static void
454ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
455
456static struct PerModuleInfo {
457 Module *CurrentModule;
458 ValueList Values; // Module level numbered definitions
459 ValueList LateResolveValues;
460 std::vector<PATypeHolder> Types;
461 std::map<ValID, PATypeHolder> LateResolveTypes;
462
463 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
464 /// how they were referenced and on which line of the input they came from so
465 /// that we can resolve them later and print error messages as appropriate.
466 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
467
468 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
469 // references to global values. Global values may be referenced before they
470 // are defined, and if so, the temporary object that they represent is held
471 // here. This is used for forward references of GlobalValues.
472 //
473 typedef std::map<std::pair<const PointerType *,
474 ValID>, GlobalValue*> GlobalRefsType;
475 GlobalRefsType GlobalRefs;
476
477 void ModuleDone() {
478 // If we could not resolve some functions at function compilation time
479 // (calls to functions before they are defined), resolve them now... Types
480 // are resolved when the constant pool has been completely parsed.
481 //
482 ResolveDefinitions(LateResolveValues);
483 if (TriggerError)
484 return;
485
486 // Check to make sure that all global value forward references have been
487 // resolved!
488 //
489 if (!GlobalRefs.empty()) {
490 std::string UndefinedReferences = "Unresolved global references exist:\n";
491
492 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
493 I != E; ++I) {
494 UndefinedReferences += " " + I->first.first->getDescription() + " " +
495 I->first.second.getName() + "\n";
496 }
497 GenerateError(UndefinedReferences);
498 return;
499 }
500
Chandler Carruth563d4a42007-08-04 01:56:21 +0000501 // Look for intrinsic functions and CallInst that need to be upgraded
502 for (Module::iterator FI = CurrentModule->begin(),
503 FE = CurrentModule->end(); FI != FE; )
504 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
505
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000506 Values.clear(); // Clear out function local definitions
507 Types.clear();
508 CurrentModule = 0;
509 }
510
511 // GetForwardRefForGlobal - Check to see if there is a forward reference
512 // for this global. If so, remove it from the GlobalRefs map and return it.
513 // If not, just return null.
514 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
515 // Check to see if there is a forward reference to this global variable...
516 // if there is, eliminate it and patch the reference to use the new def'n.
517 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
518 GlobalValue *Ret = 0;
519 if (I != GlobalRefs.end()) {
520 Ret = I->second;
521 GlobalRefs.erase(I);
522 }
523 return Ret;
524 }
525
526 bool TypeIsUnresolved(PATypeHolder* PATy) {
527 // If it isn't abstract, its resolved
528 const Type* Ty = PATy->get();
529 if (!Ty->isAbstract())
530 return false;
531 // Traverse the type looking for abstract types. If it isn't abstract then
532 // we don't need to traverse that leg of the type.
533 std::vector<const Type*> WorkList, SeenList;
534 WorkList.push_back(Ty);
535 while (!WorkList.empty()) {
536 const Type* Ty = WorkList.back();
537 SeenList.push_back(Ty);
538 WorkList.pop_back();
539 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
540 // Check to see if this is an unresolved type
541 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
542 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
543 for ( ; I != E; ++I) {
544 if (I->second.get() == OpTy)
545 return true;
546 }
547 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
548 const Type* TheTy = SeqTy->getElementType();
549 if (TheTy->isAbstract() && TheTy != Ty) {
550 std::vector<const Type*>::iterator I = SeenList.begin(),
551 E = SeenList.end();
552 for ( ; I != E; ++I)
553 if (*I == TheTy)
554 break;
555 if (I == E)
556 WorkList.push_back(TheTy);
557 }
558 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
559 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
560 const Type* TheTy = StrTy->getElementType(i);
561 if (TheTy->isAbstract() && TheTy != Ty) {
562 std::vector<const Type*>::iterator I = SeenList.begin(),
563 E = SeenList.end();
564 for ( ; I != E; ++I)
565 if (*I == TheTy)
566 break;
567 if (I == E)
568 WorkList.push_back(TheTy);
569 }
570 }
571 }
572 }
573 return false;
574 }
575} CurModule;
576
577static struct PerFunctionInfo {
578 Function *CurrentFunction; // Pointer to current function being created
579
580 ValueList Values; // Keep track of #'d definitions
581 unsigned NextValNum;
582 ValueList LateResolveValues;
583 bool isDeclare; // Is this function a forward declararation?
584 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
585 GlobalValue::VisibilityTypes Visibility;
586
587 /// BBForwardRefs - When we see forward references to basic blocks, keep
588 /// track of them here.
589 std::map<ValID, BasicBlock*> BBForwardRefs;
590
591 inline PerFunctionInfo() {
592 CurrentFunction = 0;
593 isDeclare = false;
594 Linkage = GlobalValue::ExternalLinkage;
595 Visibility = GlobalValue::DefaultVisibility;
596 }
597
598 inline void FunctionStart(Function *M) {
599 CurrentFunction = M;
600 NextValNum = 0;
601 }
602
603 void FunctionDone() {
604 // Any forward referenced blocks left?
605 if (!BBForwardRefs.empty()) {
606 GenerateError("Undefined reference to label " +
607 BBForwardRefs.begin()->second->getName());
608 return;
609 }
610
611 // Resolve all forward references now.
612 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
613
614 Values.clear(); // Clear out function local definitions
615 BBForwardRefs.clear();
616 CurrentFunction = 0;
617 isDeclare = false;
618 Linkage = GlobalValue::ExternalLinkage;
619 Visibility = GlobalValue::DefaultVisibility;
620 }
621} CurFun; // Info for the current function...
622
623static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
624
625
626//===----------------------------------------------------------------------===//
627// Code to handle definitions of all the types
628//===----------------------------------------------------------------------===//
629
630static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
631 // Things that have names or are void typed don't get slot numbers
632 if (V->hasName() || (V->getType() == Type::VoidTy))
633 return;
634
635 // In the case of function values, we have to allow for the forward reference
636 // of basic blocks, which are included in the numbering. Consequently, we keep
637 // track of the next insertion location with NextValNum. When a BB gets
638 // inserted, it could change the size of the CurFun.Values vector.
639 if (&ValueTab == &CurFun.Values) {
640 if (ValueTab.size() <= CurFun.NextValNum)
641 ValueTab.resize(CurFun.NextValNum+1);
642 ValueTab[CurFun.NextValNum++] = V;
643 return;
644 }
645 // For all other lists, its okay to just tack it on the back of the vector.
646 ValueTab.push_back(V);
647}
648
649static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
650 switch (D.Type) {
651 case ValID::LocalID: // Is it a numbered definition?
652 // Module constants occupy the lowest numbered slots...
653 if (D.Num < CurModule.Types.size())
654 return CurModule.Types[D.Num];
655 break;
656 case ValID::LocalName: // Is it a named definition?
657 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
658 D.destroy(); // Free old strdup'd memory...
659 return N;
660 }
661 break;
662 default:
663 GenerateError("Internal parser error: Invalid symbol type reference");
664 return 0;
665 }
666
667 // If we reached here, we referenced either a symbol that we don't know about
668 // or an id number that hasn't been read yet. We may be referencing something
669 // forward, so just create an entry to be resolved later and get to it...
670 //
671 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
672
673
674 if (inFunctionScope()) {
675 if (D.Type == ValID::LocalName) {
676 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
677 return 0;
678 } else {
679 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
680 return 0;
681 }
682 }
683
684 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
685 if (I != CurModule.LateResolveTypes.end())
686 return I->second;
687
688 Type *Typ = OpaqueType::get();
689 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
690 return Typ;
691 }
692
693// getExistingVal - Look up the value specified by the provided type and
694// the provided ValID. If the value exists and has already been defined, return
695// it. Otherwise return null.
696//
697static Value *getExistingVal(const Type *Ty, const ValID &D) {
698 if (isa<FunctionType>(Ty)) {
699 GenerateError("Functions are not values and "
700 "must be referenced as pointers");
701 return 0;
702 }
703
704 switch (D.Type) {
705 case ValID::LocalID: { // Is it a numbered definition?
706 // Check that the number is within bounds.
707 if (D.Num >= CurFun.Values.size())
708 return 0;
709 Value *Result = CurFun.Values[D.Num];
710 if (Ty != Result->getType()) {
711 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
712 Result->getType()->getDescription() + "' does not match "
713 "expected type, '" + Ty->getDescription() + "'");
714 return 0;
715 }
716 return Result;
717 }
718 case ValID::GlobalID: { // Is it a numbered definition?
719 if (D.Num >= CurModule.Values.size())
720 return 0;
721 Value *Result = CurModule.Values[D.Num];
722 if (Ty != Result->getType()) {
723 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
724 Result->getType()->getDescription() + "' does not match "
725 "expected type, '" + Ty->getDescription() + "'");
726 return 0;
727 }
728 return Result;
729 }
730
731 case ValID::LocalName: { // Is it a named definition?
732 if (!inFunctionScope())
733 return 0;
734 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
735 Value *N = SymTab.lookup(D.getName());
736 if (N == 0)
737 return 0;
738 if (N->getType() != Ty)
739 return 0;
740
741 D.destroy(); // Free old strdup'd memory...
742 return N;
743 }
744 case ValID::GlobalName: { // Is it a named definition?
745 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
746 Value *N = SymTab.lookup(D.getName());
747 if (N == 0)
748 return 0;
749 if (N->getType() != Ty)
750 return 0;
751
752 D.destroy(); // Free old strdup'd memory...
753 return N;
754 }
755
756 // Check to make sure that "Ty" is an integral type, and that our
757 // value will fit into the specified type...
758 case ValID::ConstSIntVal: // Is it a constant pool reference??
Chris Lattner59363a32008-02-19 04:36:25 +0000759 if (!isa<IntegerType>(Ty) ||
760 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000761 GenerateError("Signed integral constant '" +
762 itostr(D.ConstPool64) + "' is invalid for type '" +
763 Ty->getDescription() + "'");
764 return 0;
765 }
766 return ConstantInt::get(Ty, D.ConstPool64, true);
767
768 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
Chris Lattner59363a32008-02-19 04:36:25 +0000769 if (isa<IntegerType>(Ty) &&
770 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000771 return ConstantInt::get(Ty, D.UConstPool64);
Chris Lattner59363a32008-02-19 04:36:25 +0000772
773 if (!isa<IntegerType>(Ty) ||
774 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
775 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
776 "' is invalid or out of range for type '" +
777 Ty->getDescription() + "'");
778 return 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000779 }
Chris Lattner59363a32008-02-19 04:36:25 +0000780 // This is really a signed reference. Transmogrify.
781 return ConstantInt::get(Ty, D.ConstPool64, true);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000782
783 case ValID::ConstFPVal: // Is it a floating point const pool reference?
Chris Lattner59363a32008-02-19 04:36:25 +0000784 if (!Ty->isFloatingPoint() ||
785 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000786 GenerateError("FP constant invalid for type");
787 return 0;
788 }
Chris Lattner05ba86e2008-04-20 00:41:19 +0000789 // Lexer has no type info, so builds all float and double FP constants
Dale Johannesen255b8fe2007-09-11 18:33:39 +0000790 // as double. Fix this here. Long double does not need this.
791 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
792 Ty==Type::FloatTy)
Dale Johannesen3afee192007-09-07 21:07:57 +0000793 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
Chris Lattner05ba86e2008-04-20 00:41:19 +0000794 return ConstantFP::get(*D.ConstPoolFP);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000795
796 case ValID::ConstNullVal: // Is it a null value?
797 if (!isa<PointerType>(Ty)) {
798 GenerateError("Cannot create a a non pointer null");
799 return 0;
800 }
801 return ConstantPointerNull::get(cast<PointerType>(Ty));
802
803 case ValID::ConstUndefVal: // Is it an undef value?
804 return UndefValue::get(Ty);
805
806 case ValID::ConstZeroVal: // Is it a zero value?
807 return Constant::getNullValue(Ty);
808
809 case ValID::ConstantVal: // Fully resolved constant?
810 if (D.ConstantValue->getType() != Ty) {
811 GenerateError("Constant expression type different from required type");
812 return 0;
813 }
814 return D.ConstantValue;
815
816 case ValID::InlineAsmVal: { // Inline asm expression
817 const PointerType *PTy = dyn_cast<PointerType>(Ty);
818 const FunctionType *FTy =
819 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
820 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
821 GenerateError("Invalid type for asm constraint string");
822 return 0;
823 }
824 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
825 D.IAD->HasSideEffects);
826 D.destroy(); // Free InlineAsmDescriptor.
827 return IA;
828 }
829 default:
830 assert(0 && "Unhandled case!");
831 return 0;
832 } // End of switch
833
834 assert(0 && "Unhandled case!");
835 return 0;
836}
837
838// getVal - This function is identical to getExistingVal, except that if a
839// value is not already defined, it "improvises" by creating a placeholder var
840// that looks and acts just like the requested variable. When the value is
841// defined later, all uses of the placeholder variable are replaced with the
842// real thing.
843//
844static Value *getVal(const Type *Ty, const ValID &ID) {
845 if (Ty == Type::LabelTy) {
846 GenerateError("Cannot use a basic block here");
847 return 0;
848 }
849
850 // See if the value has already been defined.
851 Value *V = getExistingVal(Ty, ID);
852 if (V) return V;
853 if (TriggerError) return 0;
854
855 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
Dan Gohmane6b1ee62008-05-23 01:55:30 +0000856 GenerateError("Invalid use of a non-first-class type");
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000857 return 0;
858 }
859
860 // If we reached here, we referenced either a symbol that we don't know about
861 // or an id number that hasn't been read yet. We may be referencing something
862 // forward, so just create an entry to be resolved later and get to it...
863 //
864 switch (ID.Type) {
865 case ValID::GlobalName:
866 case ValID::GlobalID: {
867 const PointerType *PTy = dyn_cast<PointerType>(Ty);
868 if (!PTy) {
869 GenerateError("Invalid type for reference to global" );
870 return 0;
871 }
872 const Type* ElTy = PTy->getElementType();
873 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
Gabor Greif89f01162008-04-06 23:07:54 +0000874 V = Function::Create(FTy, GlobalValue::ExternalLinkage);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000875 else
Christopher Lamb0a243582007-12-11 09:02:08 +0000876 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
877 (Module*)0, false, PTy->getAddressSpace());
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000878 break;
879 }
880 default:
881 V = new Argument(Ty);
882 }
883
884 // Remember where this forward reference came from. FIXME, shouldn't we try
885 // to recycle these things??
886 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
Duncan Sandsf5588dc2007-11-27 13:23:08 +0000887 LLLgetLineNo())));
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000888
889 if (inFunctionScope())
890 InsertValue(V, CurFun.LateResolveValues);
891 else
892 InsertValue(V, CurModule.LateResolveValues);
893 return V;
894}
895
896/// defineBBVal - This is a definition of a new basic block with the specified
897/// identifier which must be the same as CurFun.NextValNum, if its numeric.
Chris Lattnere7e9b602008-05-04 17:18:47 +0000898static BasicBlock *defineBBVal(const ValID &ID) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000899 assert(inFunctionScope() && "Can't get basic block at global scope!");
900
901 BasicBlock *BB = 0;
902
903 // First, see if this was forward referenced
904
905 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
906 if (BBI != CurFun.BBForwardRefs.end()) {
907 BB = BBI->second;
908 // The forward declaration could have been inserted anywhere in the
909 // function: insert it into the correct place now.
910 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
911 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
912
913 // We're about to erase the entry, save the key so we can clean it up.
914 ValID Tmp = BBI->first;
915
916 // Erase the forward ref from the map as its no longer "forward"
917 CurFun.BBForwardRefs.erase(ID);
918
919 // The key has been removed from the map but so we don't want to leave
920 // strdup'd memory around so destroy it too.
921 Tmp.destroy();
922
923 // If its a numbered definition, bump the number and set the BB value.
924 if (ID.Type == ValID::LocalID) {
925 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
926 InsertValue(BB);
927 }
Devang Patel890cc572008-03-03 18:58:47 +0000928 } else {
929 // We haven't seen this BB before and its first mention is a definition.
930 // Just create it and return it.
931 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
Gabor Greif89f01162008-04-06 23:07:54 +0000932 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Devang Patel890cc572008-03-03 18:58:47 +0000933 if (ID.Type == ValID::LocalID) {
934 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
935 InsertValue(BB);
936 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000937 }
938
Devang Patel890cc572008-03-03 18:58:47 +0000939 ID.destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000940 return BB;
941}
942
943/// getBBVal - get an existing BB value or create a forward reference for it.
944///
945static BasicBlock *getBBVal(const ValID &ID) {
946 assert(inFunctionScope() && "Can't get basic block at global scope!");
947
948 BasicBlock *BB = 0;
949
950 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
951 if (BBI != CurFun.BBForwardRefs.end()) {
952 BB = BBI->second;
953 } if (ID.Type == ValID::LocalName) {
954 std::string Name = ID.getName();
955 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
Anton Korobeynikov21c1eeb2008-02-20 12:10:37 +0000956 if (N) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000957 if (N->getType()->getTypeID() == Type::LabelTyID)
958 BB = cast<BasicBlock>(N);
959 else
960 GenerateError("Reference to label '" + Name + "' is actually of type '"+
961 N->getType()->getDescription() + "'");
Anton Korobeynikov21c1eeb2008-02-20 12:10:37 +0000962 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000963 } else if (ID.Type == ValID::LocalID) {
964 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
965 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
966 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
967 else
968 GenerateError("Reference to label '%" + utostr(ID.Num) +
969 "' is actually of type '"+
970 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
971 }
972 } else {
973 GenerateError("Illegal label reference " + ID.getName());
974 return 0;
975 }
976
977 // If its already been defined, return it now.
978 if (BB) {
979 ID.destroy(); // Free strdup'd memory.
980 return BB;
981 }
982
983 // Otherwise, this block has not been seen before, create it.
984 std::string Name;
985 if (ID.Type == ValID::LocalName)
986 Name = ID.getName();
Gabor Greif89f01162008-04-06 23:07:54 +0000987 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000988
989 // Insert it in the forward refs map.
990 CurFun.BBForwardRefs[ID] = BB;
991
992 return BB;
993}
994
995
996//===----------------------------------------------------------------------===//
997// Code to handle forward references in instructions
998//===----------------------------------------------------------------------===//
999//
1000// This code handles the late binding needed with statements that reference
1001// values not defined yet... for example, a forward branch, or the PHI node for
1002// a loop body.
1003//
1004// This keeps a table (CurFun.LateResolveValues) of all such forward references
1005// and back patchs after we are done.
1006//
1007
1008// ResolveDefinitions - If we could not resolve some defs at parsing
1009// time (forward branches, phi functions for loops, etc...) resolve the
1010// defs now...
1011//
1012static void
1013ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
1014 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
1015 while (!LateResolvers.empty()) {
1016 Value *V = LateResolvers.back();
1017 LateResolvers.pop_back();
1018
1019 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1020 CurModule.PlaceHolderInfo.find(V);
1021 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
1022
1023 ValID &DID = PHI->second.first;
1024
1025 Value *TheRealValue = getExistingVal(V->getType(), DID);
1026 if (TriggerError)
1027 return;
1028 if (TheRealValue) {
1029 V->replaceAllUsesWith(TheRealValue);
1030 delete V;
1031 CurModule.PlaceHolderInfo.erase(PHI);
1032 } else if (FutureLateResolvers) {
1033 // Functions have their unresolved items forwarded to the module late
1034 // resolver table
1035 InsertValue(V, *FutureLateResolvers);
1036 } else {
1037 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1038 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1039 "' of type '" + V->getType()->getDescription() + "'",
1040 PHI->second.second);
1041 return;
1042 } else {
1043 GenerateError("Reference to an invalid definition: #" +
1044 itostr(DID.Num) + " of type '" +
1045 V->getType()->getDescription() + "'",
1046 PHI->second.second);
1047 return;
1048 }
1049 }
1050 }
1051 LateResolvers.clear();
1052}
1053
1054// ResolveTypeTo - A brand new type was just declared. This means that (if
1055// name is not null) things referencing Name can be resolved. Otherwise, things
1056// refering to the number can be resolved. Do this now.
1057//
1058static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1059 ValID D;
1060 if (Name)
1061 D = ValID::createLocalName(*Name);
1062 else
1063 D = ValID::createLocalID(CurModule.Types.size());
1064
1065 std::map<ValID, PATypeHolder>::iterator I =
1066 CurModule.LateResolveTypes.find(D);
1067 if (I != CurModule.LateResolveTypes.end()) {
1068 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1069 CurModule.LateResolveTypes.erase(I);
1070 }
1071}
1072
1073// setValueName - Set the specified value to the name given. The name may be
1074// null potentially, in which case this is a noop. The string passed in is
1075// assumed to be a malloc'd string buffer, and is free'd by this function.
1076//
1077static void setValueName(Value *V, std::string *NameStr) {
1078 if (!NameStr) return;
1079 std::string Name(*NameStr); // Copy string
1080 delete NameStr; // Free old string
1081
1082 if (V->getType() == Type::VoidTy) {
1083 GenerateError("Can't assign name '" + Name+"' to value with void type");
1084 return;
1085 }
1086
1087 assert(inFunctionScope() && "Must be in function scope!");
1088 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1089 if (ST.lookup(Name)) {
1090 GenerateError("Redefinition of value '" + Name + "' of type '" +
1091 V->getType()->getDescription() + "'");
1092 return;
1093 }
1094
1095 // Set the name.
1096 V->setName(Name);
1097}
1098
1099/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1100/// this is a declaration, otherwise it is a definition.
1101static GlobalVariable *
1102ParseGlobalVariable(std::string *NameStr,
1103 GlobalValue::LinkageTypes Linkage,
1104 GlobalValue::VisibilityTypes Visibility,
1105 bool isConstantGlobal, const Type *Ty,
Christopher Lamb0a243582007-12-11 09:02:08 +00001106 Constant *Initializer, bool IsThreadLocal,
1107 unsigned AddressSpace = 0) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001108 if (isa<FunctionType>(Ty)) {
1109 GenerateError("Cannot declare global vars of function type");
1110 return 0;
1111 }
Dan Gohmane5febe42008-05-31 00:58:22 +00001112 if (Ty == Type::LabelTy) {
1113 GenerateError("Cannot declare global vars of label type");
1114 return 0;
1115 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001116
Christopher Lamb0a243582007-12-11 09:02:08 +00001117 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001118
1119 std::string Name;
1120 if (NameStr) {
1121 Name = *NameStr; // Copy string
1122 delete NameStr; // Free old string
1123 }
1124
1125 // See if this global value was forward referenced. If so, recycle the
1126 // object.
1127 ValID ID;
1128 if (!Name.empty()) {
1129 ID = ValID::createGlobalName(Name);
1130 } else {
1131 ID = ValID::createGlobalID(CurModule.Values.size());
1132 }
1133
1134 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1135 // Move the global to the end of the list, from whereever it was
1136 // previously inserted.
1137 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1138 CurModule.CurrentModule->getGlobalList().remove(GV);
1139 CurModule.CurrentModule->getGlobalList().push_back(GV);
1140 GV->setInitializer(Initializer);
1141 GV->setLinkage(Linkage);
1142 GV->setVisibility(Visibility);
1143 GV->setConstant(isConstantGlobal);
1144 GV->setThreadLocal(IsThreadLocal);
1145 InsertValue(GV, CurModule.Values);
1146 return GV;
1147 }
1148
1149 // If this global has a name
1150 if (!Name.empty()) {
1151 // if the global we're parsing has an initializer (is a definition) and
1152 // has external linkage.
1153 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1154 // If there is already a global with external linkage with this name
1155 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1156 // If we allow this GVar to get created, it will be renamed in the
1157 // symbol table because it conflicts with an existing GVar. We can't
1158 // allow redefinition of GVars whose linking indicates that their name
1159 // must stay the same. Issue the error.
1160 GenerateError("Redefinition of global variable named '" + Name +
1161 "' of type '" + Ty->getDescription() + "'");
1162 return 0;
1163 }
1164 }
1165
1166 // Otherwise there is no existing GV to use, create one now.
1167 GlobalVariable *GV =
1168 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
Christopher Lamb0a243582007-12-11 09:02:08 +00001169 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001170 GV->setVisibility(Visibility);
1171 InsertValue(GV, CurModule.Values);
1172 return GV;
1173}
1174
1175// setTypeName - Set the specified type to the name given. The name may be
1176// null potentially, in which case this is a noop. The string passed in is
1177// assumed to be a malloc'd string buffer, and is freed by this function.
1178//
1179// This function returns true if the type has already been defined, but is
1180// allowed to be redefined in the specified context. If the name is a new name
1181// for the type plane, it is inserted and false is returned.
1182static bool setTypeName(const Type *T, std::string *NameStr) {
1183 assert(!inFunctionScope() && "Can't give types function-local names!");
1184 if (NameStr == 0) return false;
1185
1186 std::string Name(*NameStr); // Copy string
1187 delete NameStr; // Free old string
1188
1189 // We don't allow assigning names to void type
1190 if (T == Type::VoidTy) {
1191 GenerateError("Can't assign name '" + Name + "' to the void type");
1192 return false;
1193 }
1194
1195 // Set the type name, checking for conflicts as we do so.
1196 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1197
1198 if (AlreadyExists) { // Inserting a name that is already defined???
1199 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1200 assert(Existing && "Conflict but no matching type?!");
1201
1202 // There is only one case where this is allowed: when we are refining an
1203 // opaque type. In this case, Existing will be an opaque type.
1204 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1205 // We ARE replacing an opaque type!
1206 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1207 return true;
1208 }
1209
1210 // Otherwise, this is an attempt to redefine a type. That's okay if
1211 // the redefinition is identical to the original. This will be so if
1212 // Existing and T point to the same Type object. In this one case we
1213 // allow the equivalent redefinition.
1214 if (Existing == T) return true; // Yes, it's equal.
1215
1216 // Any other kind of (non-equivalent) redefinition is an error.
1217 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1218 T->getDescription() + "'");
1219 }
1220
1221 return false;
1222}
1223
1224//===----------------------------------------------------------------------===//
1225// Code for handling upreferences in type names...
1226//
1227
1228// TypeContains - Returns true if Ty directly contains E in it.
1229//
1230static bool TypeContains(const Type *Ty, const Type *E) {
1231 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1232 E) != Ty->subtype_end();
1233}
1234
1235namespace {
1236 struct UpRefRecord {
1237 // NestingLevel - The number of nesting levels that need to be popped before
1238 // this type is resolved.
1239 unsigned NestingLevel;
1240
1241 // LastContainedTy - This is the type at the current binding level for the
1242 // type. Every time we reduce the nesting level, this gets updated.
1243 const Type *LastContainedTy;
1244
1245 // UpRefTy - This is the actual opaque type that the upreference is
1246 // represented with.
1247 OpaqueType *UpRefTy;
1248
1249 UpRefRecord(unsigned NL, OpaqueType *URTy)
1250 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1251 };
1252}
1253
1254// UpRefs - A list of the outstanding upreferences that need to be resolved.
1255static std::vector<UpRefRecord> UpRefs;
1256
1257/// HandleUpRefs - Every time we finish a new layer of types, this function is
1258/// called. It loops through the UpRefs vector, which is a list of the
1259/// currently active types. For each type, if the up reference is contained in
1260/// the newly completed type, we decrement the level count. When the level
1261/// count reaches zero, the upreferenced type is the type that is passed in:
1262/// thus we can complete the cycle.
1263///
1264static PATypeHolder HandleUpRefs(const Type *ty) {
1265 // If Ty isn't abstract, or if there are no up-references in it, then there is
1266 // nothing to resolve here.
1267 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1268
1269 PATypeHolder Ty(ty);
1270 UR_OUT("Type '" << Ty->getDescription() <<
1271 "' newly formed. Resolving upreferences.\n" <<
1272 UpRefs.size() << " upreferences active!\n");
1273
1274 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1275 // to zero), we resolve them all together before we resolve them to Ty. At
1276 // the end of the loop, if there is anything to resolve to Ty, it will be in
1277 // this variable.
1278 OpaqueType *TypeToResolve = 0;
1279
1280 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1281 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1282 << UpRefs[i].second->getDescription() << ") = "
1283 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1284 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1285 // Decrement level of upreference
1286 unsigned Level = --UpRefs[i].NestingLevel;
1287 UpRefs[i].LastContainedTy = Ty;
1288 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1289 if (Level == 0) { // Upreference should be resolved!
1290 if (!TypeToResolve) {
1291 TypeToResolve = UpRefs[i].UpRefTy;
1292 } else {
1293 UR_OUT(" * Resolving upreference for "
1294 << UpRefs[i].second->getDescription() << "\n";
1295 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1296 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1297 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1298 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1299 }
1300 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1301 --i; // Do not skip the next element...
1302 }
1303 }
1304 }
1305
1306 if (TypeToResolve) {
1307 UR_OUT(" * Resolving upreference for "
1308 << UpRefs[i].second->getDescription() << "\n";
1309 std::string OldName = TypeToResolve->getDescription());
1310 TypeToResolve->refineAbstractTypeTo(Ty);
1311 }
1312
1313 return Ty;
1314}
1315
1316//===----------------------------------------------------------------------===//
1317// RunVMAsmParser - Define an interface to this parser
1318//===----------------------------------------------------------------------===//
1319//
1320static Module* RunParser(Module * M);
1321
Duncan Sandsf5588dc2007-11-27 13:23:08 +00001322Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1323 InitLLLexer(MB);
1324 Module *M = RunParser(new Module(LLLgetFilename()));
1325 FreeLexer();
1326 return M;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001327}
1328
1329
Dan Gohman54392c12008-04-19 00:24:39 +00001330
1331/* Enabling traces. */
1332#ifndef YYDEBUG
1333# define YYDEBUG 0
1334#endif
1335
1336/* Enabling verbose error messages. */
1337#ifdef YYERROR_VERBOSE
1338# undef YYERROR_VERBOSE
1339# define YYERROR_VERBOSE 1
1340#else
1341# define YYERROR_VERBOSE 0
1342#endif
1343
1344/* Enabling the token table. */
1345#ifndef YYTOKEN_TABLE
1346# define YYTOKEN_TABLE 0
1347#endif
1348
1349#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1350typedef union YYSTYPE
Dan Gohmane5febe42008-05-31 00:58:22 +00001351#line 953 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00001352{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001353 llvm::Module *ModuleVal;
1354 llvm::Function *FunctionVal;
1355 llvm::BasicBlock *BasicBlockVal;
1356 llvm::TerminatorInst *TermInstVal;
1357 llvm::Instruction *InstVal;
1358 llvm::Constant *ConstVal;
1359
1360 const llvm::Type *PrimType;
1361 std::list<llvm::PATypeHolder> *TypeList;
1362 llvm::PATypeHolder *TypeVal;
1363 llvm::Value *ValueVal;
1364 std::vector<llvm::Value*> *ValueList;
Dan Gohmane5febe42008-05-31 00:58:22 +00001365 std::vector<unsigned> *ConstantList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001366 llvm::ArgListType *ArgList;
1367 llvm::TypeWithAttrs TypeWithAttrs;
1368 llvm::TypeWithAttrsList *TypeWithAttrsList;
Dale Johannesencfb19e62007-11-05 21:20:28 +00001369 llvm::ParamList *ParamList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001370
1371 // Represent the RHS of PHI node
1372 std::list<std::pair<llvm::Value*,
1373 llvm::BasicBlock*> > *PHIList;
1374 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1375 std::vector<llvm::Constant*> *ConstVector;
1376
1377 llvm::GlobalValue::LinkageTypes Linkage;
1378 llvm::GlobalValue::VisibilityTypes Visibility;
Dale Johannesend915ee52008-02-19 21:40:51 +00001379 llvm::ParameterAttributes ParamAttrs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001380 llvm::APInt *APIntVal;
1381 int64_t SInt64Val;
1382 uint64_t UInt64Val;
1383 int SIntVal;
1384 unsigned UIntVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00001385 llvm::APFloat *FPVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001386 bool BoolVal;
1387
1388 std::string *StrVal; // This memory must be deleted
1389 llvm::ValID ValIDVal;
1390
1391 llvm::Instruction::BinaryOps BinaryOpVal;
1392 llvm::Instruction::TermOps TermOpVal;
1393 llvm::Instruction::MemoryOps MemOpVal;
1394 llvm::Instruction::CastOps CastOpVal;
1395 llvm::Instruction::OtherOps OtherOpVal;
1396 llvm::ICmpInst::Predicate IPredicate;
1397 llvm::FCmpInst::Predicate FPredicate;
Dan Gohman54392c12008-04-19 00:24:39 +00001398}
Dan Gohman7185e4b2008-06-23 18:43:26 +00001399/* Line 193 of yacc.c. */
Dan Gohmane5febe42008-05-31 00:58:22 +00001400#line 1401 "llvmAsmParser.tab.c"
Dan Gohman54392c12008-04-19 00:24:39 +00001401 YYSTYPE;
1402# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1403# define YYSTYPE_IS_DECLARED 1
1404# define YYSTYPE_IS_TRIVIAL 1
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001405#endif
1406
1407
1408
Dan Gohman54392c12008-04-19 00:24:39 +00001409/* Copy the second part of user declarations. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001410
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001411
Dan Gohman54392c12008-04-19 00:24:39 +00001412/* Line 216 of yacc.c. */
Dan Gohmane5febe42008-05-31 00:58:22 +00001413#line 1414 "llvmAsmParser.tab.c"
Reid Spenceraa8ae282007-07-31 03:50:36 +00001414
Dan Gohman54392c12008-04-19 00:24:39 +00001415#ifdef short
1416# undef short
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001417#endif
1418
Dan Gohman54392c12008-04-19 00:24:39 +00001419#ifdef YYTYPE_UINT8
1420typedef YYTYPE_UINT8 yytype_uint8;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001421#else
Dan Gohman54392c12008-04-19 00:24:39 +00001422typedef unsigned char yytype_uint8;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001423#endif
1424
Dan Gohman54392c12008-04-19 00:24:39 +00001425#ifdef YYTYPE_INT8
1426typedef YYTYPE_INT8 yytype_int8;
1427#elif (defined __STDC__ || defined __C99__FUNC__ \
1428 || defined __cplusplus || defined _MSC_VER)
1429typedef signed char yytype_int8;
1430#else
1431typedef short int yytype_int8;
1432#endif
1433
1434#ifdef YYTYPE_UINT16
1435typedef YYTYPE_UINT16 yytype_uint16;
1436#else
1437typedef unsigned short int yytype_uint16;
1438#endif
1439
1440#ifdef YYTYPE_INT16
1441typedef YYTYPE_INT16 yytype_int16;
1442#else
1443typedef short int yytype_int16;
1444#endif
1445
1446#ifndef YYSIZE_T
1447# ifdef __SIZE_TYPE__
1448# define YYSIZE_T __SIZE_TYPE__
1449# elif defined size_t
1450# define YYSIZE_T size_t
1451# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1452 || defined __cplusplus || defined _MSC_VER)
1453# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1454# define YYSIZE_T size_t
1455# else
1456# define YYSIZE_T unsigned int
1457# endif
1458#endif
1459
1460#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1461
1462#ifndef YY_
Dan Gohman7185e4b2008-06-23 18:43:26 +00001463# if defined YYENABLE_NLS && YYENABLE_NLS
Dan Gohman54392c12008-04-19 00:24:39 +00001464# if ENABLE_NLS
1465# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1466# define YY_(msgid) dgettext ("bison-runtime", msgid)
1467# endif
1468# endif
1469# ifndef YY_
1470# define YY_(msgid) msgid
1471# endif
1472#endif
1473
1474/* Suppress unused-variable warnings by "using" E. */
1475#if ! defined lint || defined __GNUC__
1476# define YYUSE(e) ((void) (e))
1477#else
1478# define YYUSE(e) /* empty */
1479#endif
1480
1481/* Identity function, used to suppress warnings about constant conditions. */
1482#ifndef lint
1483# define YYID(n) (n)
1484#else
1485#if (defined __STDC__ || defined __C99__FUNC__ \
1486 || defined __cplusplus || defined _MSC_VER)
1487static int
1488YYID (int i)
1489#else
1490static int
1491YYID (i)
1492 int i;
1493#endif
1494{
1495 return i;
1496}
1497#endif
1498
1499#if ! defined yyoverflow || YYERROR_VERBOSE
1500
1501/* The parser invokes alloca or malloc; define the necessary symbols. */
1502
1503# ifdef YYSTACK_USE_ALLOCA
1504# if YYSTACK_USE_ALLOCA
1505# ifdef __GNUC__
1506# define YYSTACK_ALLOC __builtin_alloca
1507# elif defined __BUILTIN_VA_ARG_INCR
1508# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1509# elif defined _AIX
1510# define YYSTACK_ALLOC __alloca
1511# elif defined _MSC_VER
1512# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1513# define alloca _alloca
1514# else
1515# define YYSTACK_ALLOC alloca
1516# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1517 || defined __cplusplus || defined _MSC_VER)
1518# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1519# ifndef _STDLIB_H
1520# define _STDLIB_H 1
1521# endif
1522# endif
1523# endif
1524# endif
1525# endif
1526
1527# ifdef YYSTACK_ALLOC
1528 /* Pacify GCC's `empty if-body' warning. */
1529# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1530# ifndef YYSTACK_ALLOC_MAXIMUM
1531 /* The OS might guarantee only one guard page at the bottom of the stack,
1532 and a page size can be as small as 4096 bytes. So we cannot safely
1533 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1534 to allow for a few compiler-allocated temporary stack slots. */
1535# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1536# endif
1537# else
1538# define YYSTACK_ALLOC YYMALLOC
1539# define YYSTACK_FREE YYFREE
1540# ifndef YYSTACK_ALLOC_MAXIMUM
1541# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1542# endif
1543# if (defined __cplusplus && ! defined _STDLIB_H \
1544 && ! ((defined YYMALLOC || defined malloc) \
1545 && (defined YYFREE || defined free)))
1546# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1547# ifndef _STDLIB_H
1548# define _STDLIB_H 1
1549# endif
1550# endif
1551# ifndef YYMALLOC
1552# define YYMALLOC malloc
1553# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1554 || defined __cplusplus || defined _MSC_VER)
1555void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1556# endif
1557# endif
1558# ifndef YYFREE
1559# define YYFREE free
1560# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1561 || defined __cplusplus || defined _MSC_VER)
1562void free (void *); /* INFRINGES ON USER NAME SPACE */
1563# endif
1564# endif
1565# endif
1566#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1567
1568
1569#if (! defined yyoverflow \
1570 && (! defined __cplusplus \
1571 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1572
1573/* A type that is properly aligned for any stack member. */
1574union yyalloc
1575{
1576 yytype_int16 yyss;
1577 YYSTYPE yyvs;
1578 };
1579
1580/* The size of the maximum gap between one aligned stack and the next. */
1581# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1582
1583/* The size of an array large to enough to hold all stacks, each with
1584 N elements. */
1585# define YYSTACK_BYTES(N) \
1586 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1587 + YYSTACK_GAP_MAXIMUM)
1588
1589/* Copy COUNT objects from FROM to TO. The source and destination do
1590 not overlap. */
1591# ifndef YYCOPY
1592# if defined __GNUC__ && 1 < __GNUC__
1593# define YYCOPY(To, From, Count) \
1594 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1595# else
1596# define YYCOPY(To, From, Count) \
1597 do \
1598 { \
1599 YYSIZE_T yyi; \
1600 for (yyi = 0; yyi < (Count); yyi++) \
1601 (To)[yyi] = (From)[yyi]; \
1602 } \
1603 while (YYID (0))
1604# endif
1605# endif
1606
1607/* Relocate STACK from its old location to the new one. The
1608 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1609 elements in the stack, and YYPTR gives the new location of the
1610 stack. Advance YYPTR to a properly aligned location for the next
1611 stack. */
1612# define YYSTACK_RELOCATE(Stack) \
1613 do \
1614 { \
1615 YYSIZE_T yynewbytes; \
1616 YYCOPY (&yyptr->Stack, Stack, yysize); \
1617 Stack = &yyptr->Stack; \
1618 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1619 yyptr += yynewbytes / sizeof (*yyptr); \
1620 } \
1621 while (YYID (0))
1622
1623#endif
1624
1625/* YYFINAL -- State number of the termination state. */
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001626#define YYFINAL 44
Dan Gohman54392c12008-04-19 00:24:39 +00001627/* YYLAST -- Last index in YYTABLE. */
Dan Gohman9fc6cb02008-06-09 14:45:02 +00001628#define YYLAST 2339
Dan Gohman54392c12008-04-19 00:24:39 +00001629
1630/* YYNTOKENS -- Number of terminals. */
Dan Gohmane6b1ee62008-05-23 01:55:30 +00001631#define YYNTOKENS 170
Dan Gohman54392c12008-04-19 00:24:39 +00001632/* YYNNTS -- Number of nonterminals. */
Dan Gohmane5febe42008-05-31 00:58:22 +00001633#define YYNNTS 86
Dan Gohman54392c12008-04-19 00:24:39 +00001634/* YYNRULES -- Number of rules. */
Dan Gohman9fc6cb02008-06-09 14:45:02 +00001635#define YYNRULES 340
Dan Gohman54392c12008-04-19 00:24:39 +00001636/* YYNRULES -- Number of states. */
Dan Gohman9fc6cb02008-06-09 14:45:02 +00001637#define YYNSTATES 699
Dan Gohman54392c12008-04-19 00:24:39 +00001638
1639/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1640#define YYUNDEFTOK 2
Dan Gohmane6b1ee62008-05-23 01:55:30 +00001641#define YYMAXUTOK 410
Dan Gohman54392c12008-04-19 00:24:39 +00001642
1643#define YYTRANSLATE(YYX) \
1644 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1645
1646/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1647static const yytype_uint8 yytranslate[] =
1648{
1649 0, 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, 2, 2, 2, 2,
1652 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00001653 156, 157, 160, 2, 159, 2, 2, 2, 2, 2,
Dan Gohman54392c12008-04-19 00:24:39 +00001654 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00001655 165, 158, 166, 2, 2, 2, 2, 2, 2, 2,
Dan Gohman54392c12008-04-19 00:24:39 +00001656 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1657 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00001658 2, 162, 161, 164, 2, 2, 2, 2, 2, 169,
Dan Gohman54392c12008-04-19 00:24:39 +00001659 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1660 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00001661 163, 2, 2, 167, 2, 168, 2, 2, 2, 2,
Dan Gohman54392c12008-04-19 00:24:39 +00001662 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1663 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1664 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1665 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1666 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1667 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1668 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1669 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1670 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1671 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1672 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1673 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1674 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1675 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1676 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1677 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1678 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1679 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1680 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1681 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1682 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1683 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1684 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1685 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1686 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1687 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1688 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00001689 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
1690 155
Dan Gohman54392c12008-04-19 00:24:39 +00001691};
1692
1693#if YYDEBUG
1694/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1695 YYRHS. */
1696static const yytype_uint16 yyprhs[] =
1697{
1698 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1699 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1700 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1701 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1702 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1703 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1704 119, 121, 123, 125, 127, 129, 130, 135, 136, 139,
1705 140, 142, 144, 146, 147, 150, 152, 154, 156, 158,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001706 160, 162, 164, 166, 168, 169, 171, 173, 175, 176,
1707 178, 180, 181, 183, 185, 187, 189, 190, 192, 194,
1708 195, 197, 199, 201, 203, 205, 208, 210, 212, 214,
1709 216, 218, 220, 222, 224, 226, 229, 230, 233, 235,
1710 237, 239, 241, 243, 245, 246, 249, 250, 253, 254,
1711 257, 258, 262, 265, 266, 268, 269, 273, 275, 278,
1712 280, 282, 284, 286, 288, 290, 292, 294, 296, 300,
1713 302, 305, 311, 317, 323, 329, 333, 336, 342, 347,
1714 350, 352, 354, 356, 360, 362, 366, 368, 369, 371,
1715 375, 380, 384, 388, 393, 398, 402, 409, 415, 418,
1716 421, 424, 427, 430, 433, 436, 439, 442, 445, 448,
1717 451, 458, 464, 473, 480, 487, 495, 503, 511, 519,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00001718 526, 535, 544, 550, 558, 562, 564, 566, 568, 570,
1719 571, 574, 581, 583, 584, 586, 589, 590, 594, 595,
1720 599, 603, 607, 611, 612, 621, 622, 632, 633, 643,
1721 649, 652, 656, 658, 662, 666, 670, 674, 676, 677,
1722 683, 687, 689, 693, 695, 696, 707, 709, 711, 716,
1723 718, 720, 723, 727, 728, 730, 732, 734, 736, 738,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00001724 740, 742, 744, 746, 750, 754, 757, 760, 764, 767,
1725 773, 778, 780, 786, 788, 790, 792, 794, 796, 798,
1726 801, 803, 807, 810, 813, 817, 820, 821, 823, 826,
1727 829, 833, 843, 853, 862, 877, 879, 881, 888, 894,
1728 897, 904, 912, 917, 922, 929, 936, 937, 938, 942,
1729 945, 949, 952, 954, 960, 966, 973, 980, 987, 994,
1730 999, 1006, 1011, 1016, 1023, 1030, 1033, 1042, 1044, 1046,
1731 1047, 1051, 1058, 1062, 1069, 1072, 1078, 1086, 1092, 1097,
1732 1102
Dan Gohman54392c12008-04-19 00:24:39 +00001733};
1734
1735/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1736static const yytype_int16 yyrhs[] =
1737{
Dan Gohmane6b1ee62008-05-23 01:55:30 +00001738 216, 0, -1, 75, -1, 76, -1, 77, -1, 78,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001739 -1, 79, -1, 80, -1, 81, -1, 82, -1, 83,
1740 -1, 87, -1, 88, -1, 89, -1, 84, -1, 85,
1741 -1, 86, -1, 120, -1, 121, -1, 122, -1, 123,
1742 -1, 124, -1, 125, -1, 126, -1, 127, -1, 128,
1743 -1, 129, -1, 130, -1, 131, -1, 94, -1, 95,
1744 -1, 96, -1, 97, -1, 98, -1, 99, -1, 100,
1745 -1, 101, -1, 102, -1, 103, -1, 104, -1, 105,
1746 -1, 106, -1, 107, -1, 108, -1, 109, -1, 110,
1747 -1, 111, -1, 112, -1, 113, -1, 100, -1, 101,
1748 -1, 102, -1, 103, -1, 26, -1, 27, -1, 11,
Dan Gohman54392c12008-04-19 00:24:39 +00001749 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00001750 -1, 19, -1, 22, -1, 24, -1, 178, -1, -1,
1751 55, 156, 4, 157, -1, -1, 178, 158, -1, -1,
1752 20, -1, 23, -1, 184, -1, -1, 182, 158, -1,
Dan Gohman54392c12008-04-19 00:24:39 +00001753 42, -1, 44, -1, 43, -1, 45, -1, 47, -1,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00001754 49, -1, 46, -1, 48, -1, 51, -1, -1, 153,
1755 -1, 154, -1, 155, -1, -1, 46, -1, 48, -1,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001756 -1, 42, -1, 43, -1, 44, -1, 47, -1, -1,
1757 44, -1, 42, -1, -1, 63, -1, 64, -1, 65,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00001758 -1, 66, -1, 67, -1, 62, 4, -1, 142, -1,
1759 121, -1, 141, -1, 122, -1, 144, -1, 145, -1,
1760 147, -1, 148, -1, 149, -1, 54, 4, -1, -1,
1761 193, 192, -1, 143, -1, 146, -1, 142, -1, 141,
1762 -1, 150, -1, 151, -1, -1, 195, 194, -1, -1,
1763 152, 22, -1, -1, 54, 4, -1, -1, 159, 54,
1764 4, -1, 34, 22, -1, -1, 199, -1, -1, 159,
1765 202, 201, -1, 199, -1, 54, 4, -1, 11, -1,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001766 12, -1, 13, -1, 16, -1, 15, -1, 14, -1,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00001767 17, -1, 50, -1, 203, -1, 204, 180, 160, -1,
1768 238, -1, 161, 4, -1, 204, 156, 208, 157, 195,
1769 -1, 10, 156, 208, 157, 195, -1, 162, 4, 163,
1770 204, 164, -1, 165, 4, 163, 204, 166, -1, 167,
1771 209, 168, -1, 167, 168, -1, 165, 167, 209, 168,
1772 166, -1, 165, 167, 168, 166, -1, 204, 193, -1,
1773 204, -1, 10, -1, 205, -1, 207, 159, 205, -1,
1774 207, -1, 207, 159, 39, -1, 39, -1, -1, 204,
1775 -1, 209, 159, 204, -1, 204, 162, 212, 164, -1,
1776 204, 162, 164, -1, 204, 169, 22, -1, 204, 165,
1777 212, 166, -1, 204, 167, 212, 168, -1, 204, 167,
1778 168, -1, 204, 165, 167, 212, 168, 166, -1, 204,
1779 165, 167, 168, 166, -1, 204, 40, -1, 204, 41,
1780 -1, 204, 238, -1, 204, 211, -1, 204, 25, -1,
1781 176, 3, -1, 176, 5, -1, 176, 4, -1, 176,
1782 6, -1, 11, 26, -1, 11, 27, -1, 177, 9,
1783 -1, 173, 156, 210, 38, 204, 157, -1, 119, 156,
1784 210, 250, 157, -1, 133, 156, 210, 159, 210, 159,
1785 210, 157, -1, 171, 156, 210, 159, 210, 157, -1,
1786 172, 156, 210, 159, 210, 157, -1, 90, 174, 156,
1787 210, 159, 210, 157, -1, 91, 175, 156, 210, 159,
1788 210, 157, -1, 92, 174, 156, 210, 159, 210, 157,
1789 -1, 93, 175, 156, 210, 159, 210, 157, -1, 135,
1790 156, 210, 159, 210, 157, -1, 136, 156, 210, 159,
1791 210, 159, 210, 157, -1, 137, 156, 210, 159, 210,
Dan Gohmane5febe42008-05-31 00:58:22 +00001792 159, 210, 157, -1, 139, 156, 210, 251, 157, -1,
1793 140, 156, 210, 159, 210, 251, 157, -1, 212, 159,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00001794 210, -1, 210, -1, 32, -1, 33, -1, 37, -1,
1795 -1, 206, 238, -1, 125, 156, 215, 38, 204, 157,
1796 -1, 217, -1, -1, 218, -1, 217, 218, -1, -1,
1797 31, 219, 234, -1, -1, 30, 220, 235, -1, 60,
1798 59, 224, -1, 181, 18, 204, -1, 181, 18, 10,
1799 -1, -1, 183, 187, 214, 213, 210, 180, 221, 201,
1800 -1, -1, 183, 185, 187, 214, 213, 210, 180, 222,
1801 201, -1, -1, 183, 186, 187, 214, 213, 204, 180,
1802 223, 201, -1, 183, 187, 35, 190, 215, -1, 52,
1803 225, -1, 56, 158, 226, -1, 22, -1, 53, 158,
1804 22, -1, 68, 158, 22, -1, 162, 227, 164, -1,
1805 227, 159, 22, -1, 22, -1, -1, 228, 159, 204,
1806 193, 179, -1, 204, 193, 179, -1, 228, -1, 228,
1807 159, 39, -1, 39, -1, -1, 191, 206, 182, 156,
1808 229, 157, 195, 200, 197, 196, -1, 28, -1, 167,
1809 -1, 189, 187, 230, 231, -1, 29, -1, 168, -1,
1810 242, 233, -1, 188, 187, 230, -1, -1, 61, -1,
1811 3, -1, 4, -1, 9, -1, 26, -1, 27, -1,
1812 40, -1, 41, -1, 25, -1, 165, 212, 166, -1,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00001813 162, 212, 164, -1, 162, 164, -1, 169, 22, -1,
1814 167, 212, 168, -1, 167, 168, -1, 165, 167, 212,
1815 168, 166, -1, 165, 167, 168, 166, -1, 211, -1,
1816 59, 236, 22, 159, 22, -1, 7, -1, 8, -1,
1817 178, -1, 182, -1, 238, -1, 237, -1, 204, 239,
1818 -1, 240, -1, 241, 159, 240, -1, 242, 243, -1,
1819 232, 243, -1, 244, 181, 245, -1, 244, 247, -1,
1820 -1, 21, -1, 69, 241, -1, 69, 10, -1, 70,
1821 17, 239, -1, 70, 11, 239, 159, 17, 239, 159,
1822 17, 239, -1, 71, 176, 239, 159, 17, 239, 162,
1823 246, 164, -1, 71, 176, 239, 159, 17, 239, 162,
1824 164, -1, 72, 191, 206, 239, 156, 249, 157, 195,
1825 38, 17, 239, 73, 17, 239, -1, 73, -1, 74,
1826 -1, 246, 176, 237, 159, 17, 239, -1, 176, 237,
1827 159, 17, 239, -1, 181, 253, -1, 204, 162, 239,
1828 159, 239, 164, -1, 248, 159, 162, 239, 159, 239,
1829 164, -1, 204, 193, 239, 193, -1, 17, 193, 239,
1830 193, -1, 249, 159, 204, 193, 239, 193, -1, 249,
1831 159, 17, 193, 239, 193, -1, -1, -1, 250, 159,
1832 240, -1, 159, 4, -1, 251, 159, 4, -1, 58,
1833 57, -1, 57, -1, 171, 204, 239, 159, 239, -1,
1834 172, 204, 239, 159, 239, -1, 90, 174, 204, 239,
1835 159, 239, -1, 91, 175, 204, 239, 159, 239, -1,
1836 92, 174, 204, 239, 159, 239, -1, 93, 175, 204,
1837 239, 159, 239, -1, 173, 240, 38, 204, -1, 133,
1838 240, 159, 240, 159, 240, -1, 134, 240, 159, 204,
1839 -1, 135, 240, 159, 240, -1, 136, 240, 159, 240,
1840 159, 240, -1, 137, 240, 159, 240, 159, 240, -1,
1841 132, 248, -1, 252, 191, 206, 239, 156, 249, 157,
1842 195, -1, 255, -1, 36, -1, -1, 114, 204, 198,
1843 -1, 114, 204, 159, 11, 239, 198, -1, 115, 204,
1844 198, -1, 115, 204, 159, 11, 239, 198, -1, 116,
1845 240, -1, 254, 117, 204, 239, 198, -1, 254, 118,
1846 240, 159, 204, 239, 198, -1, 138, 204, 239, 159,
1847 4, -1, 119, 204, 239, 250, -1, 139, 204, 239,
1848 251, -1, 140, 204, 239, 159, 204, 239, 251, -1
Dan Gohman54392c12008-04-19 00:24:39 +00001849};
1850
1851/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1852static const yytype_uint16 yyrline[] =
1853{
Dan Gohmane5febe42008-05-31 00:58:22 +00001854 0, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
1855 1118, 1119, 1119, 1119, 1119, 1119, 1119, 1120, 1120, 1120,
1856 1120, 1120, 1120, 1121, 1121, 1121, 1121, 1121, 1121, 1124,
1857 1124, 1125, 1125, 1126, 1126, 1127, 1127, 1128, 1128, 1132,
1858 1132, 1133, 1133, 1134, 1134, 1135, 1135, 1136, 1136, 1137,
1859 1137, 1138, 1138, 1139, 1140, 1145, 1146, 1146, 1146, 1146,
1860 1146, 1148, 1148, 1148, 1149, 1149, 1151, 1152, 1156, 1160,
1861 1165, 1165, 1167, 1168, 1173, 1179, 1180, 1181, 1182, 1183,
1862 1184, 1188, 1189, 1190, 1194, 1195, 1196, 1197, 1201, 1202,
1863 1203, 1207, 1208, 1209, 1210, 1211, 1215, 1216, 1217, 1220,
1864 1221, 1222, 1223, 1224, 1225, 1226, 1233, 1234, 1235, 1236,
1865 1237, 1238, 1239, 1240, 1241, 1242, 1246, 1247, 1252, 1253,
1866 1254, 1255, 1256, 1257, 1260, 1261, 1266, 1267, 1274, 1275,
1867 1281, 1282, 1291, 1299, 1300, 1305, 1306, 1307, 1312, 1325,
1868 1325, 1325, 1325, 1325, 1325, 1325, 1328, 1332, 1336, 1343,
1869 1348, 1356, 1385, 1410, 1415, 1425, 1435, 1439, 1449, 1456,
1870 1465, 1472, 1477, 1482, 1489, 1490, 1497, 1504, 1512, 1518,
1871 1530, 1558, 1574, 1601, 1629, 1655, 1675, 1701, 1721, 1733,
1872 1740, 1806, 1816, 1826, 1832, 1842, 1848, 1858, 1864, 1870,
1873 1883, 1895, 1916, 1924, 1930, 1941, 1946, 1951, 1956, 1961,
1874 1967, 1973, 1979, 1987, 1998, 2002, 2010, 2010, 2013, 2013,
1875 2016, 2028, 2049, 2054, 2062, 2063, 2067, 2067, 2071, 2071,
1876 2074, 2077, 2101, 2113, 2112, 2124, 2123, 2133, 2132, 2143,
1877 2183, 2186, 2192, 2202, 2206, 2211, 2213, 2218, 2223, 2232,
1878 2242, 2253, 2257, 2266, 2275, 2280, 2409, 2409, 2411, 2420,
1879 2420, 2422, 2427, 2439, 2443, 2448, 2452, 2456, 2460, 2464,
Dan Gohman7185e4b2008-06-23 18:43:26 +00001880 2468, 2472, 2476, 2480, 2502, 2524, 2530, 2543, 2555, 2560,
1881 2572, 2578, 2582, 2592, 2596, 2600, 2605, 2612, 2612, 2618,
1882 2627, 2632, 2637, 2641, 2650, 2659, 2668, 2672, 2680, 2687,
1883 2691, 2696, 2707, 2726, 2735, 2821, 2825, 2832, 2843, 2856,
1884 2866, 2877, 2887, 2898, 2906, 2916, 2923, 2926, 2927, 2935,
1885 2941, 2950, 2954, 2959, 2975, 2992, 3006, 3020, 3034, 3048,
1886 3060, 3068, 3075, 3081, 3087, 3093, 3108, 3198, 3203, 3207,
1887 3214, 3221, 3231, 3238, 3248, 3256, 3270, 3287, 3295, 3310,
1888 3325
Dan Gohman54392c12008-04-19 00:24:39 +00001889};
1890#endif
1891
1892#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1893/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1894 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1895static const char *const yytname[] =
1896{
1897 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1898 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1899 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1900 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1901 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1902 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1903 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1904 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001905 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "COMMON", "OPAQUE",
Dan Gohman54392c12008-04-19 00:24:39 +00001906 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1907 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1908 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
Chris Lattnere7e9b602008-05-04 17:18:47 +00001909 "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE",
1910 "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM",
Nate Begeman646fa482008-05-12 19:01:56 +00001911 "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "VICMP",
1912 "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1913 "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1914 "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1915 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1916 "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1917 "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
Dan Gohmane6b1ee62008-05-23 01:55:30 +00001918 "GETRESULT", "EXTRACTVALUE", "INSERTVALUE", "SIGNEXT", "ZEROEXT",
1919 "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL", "NEST",
1920 "READNONE", "READONLY", "GC", "DEFAULT", "HIDDEN", "PROTECTED", "'('",
1921 "')'", "'='", "','", "'*'", "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'",
1922 "'{'", "'}'", "'c'", "$accept", "ArithmeticOps", "LogicalOps", "CastOps",
1923 "IPredicates", "FPredicates", "IntType", "FPType", "LocalName",
1924 "OptLocalName", "OptAddrSpace", "OptLocalAssign", "GlobalName",
1925 "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
1926 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1927 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr",
1928 "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign",
1929 "OptCAlign", "SectionString", "OptSection", "GlobalVarAttributes",
Dan Gohman54392c12008-04-19 00:24:39 +00001930 "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
1931 "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
1932 "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
1933 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1934 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1935 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1936 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1937 "SymbolicValueRef", "ValueRef", "ResolvedVal", "ReturnedVal",
1938 "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst",
Dan Gohmane5febe42008-05-31 00:58:22 +00001939 "JumpTable", "Inst", "PHIList", "ParamList", "IndexList",
1940 "ConstantIndexList", "OptTailCall", "InstVal", "OptVolatile",
1941 "MemoryInst", 0
Dan Gohman54392c12008-04-19 00:24:39 +00001942};
1943#endif
1944
1945# ifdef YYPRINT
1946/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1947 token YYLEX-NUM. */
1948static const yytype_uint16 yytoknum[] =
1949{
1950 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1951 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1952 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1953 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1954 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1955 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1956 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1957 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1958 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1959 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1960 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1961 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1962 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1963 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1964 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00001965 405, 406, 407, 408, 409, 410, 40, 41, 61, 44,
1966 42, 92, 91, 120, 93, 60, 62, 123, 125, 99
Dan Gohman54392c12008-04-19 00:24:39 +00001967};
1968# endif
1969
1970/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1971static const yytype_uint8 yyr1[] =
1972{
Dan Gohmane6b1ee62008-05-23 01:55:30 +00001973 0, 170, 171, 171, 171, 171, 171, 171, 171, 171,
1974 171, 172, 172, 172, 172, 172, 172, 173, 173, 173,
1975 173, 173, 173, 173, 173, 173, 173, 173, 173, 174,
1976 174, 174, 174, 174, 174, 174, 174, 174, 174, 175,
1977 175, 175, 175, 175, 175, 175, 175, 175, 175, 175,
1978 175, 175, 175, 175, 175, 176, 177, 177, 177, 177,
1979 177, 178, 178, 178, 179, 179, 180, 180, 181, 181,
1980 182, 182, 183, 183, 184, 185, 185, 185, 185, 185,
1981 185, 186, 186, 186, 187, 187, 187, 187, 188, 188,
1982 188, 189, 189, 189, 189, 189, 190, 190, 190, 191,
1983 191, 191, 191, 191, 191, 191, 192, 192, 192, 192,
1984 192, 192, 192, 192, 192, 192, 193, 193, 194, 194,
1985 194, 194, 194, 194, 195, 195, 196, 196, 197, 197,
1986 198, 198, 199, 200, 200, 201, 201, 202, 202, 203,
1987 203, 203, 203, 203, 203, 203, 204, 204, 204, 204,
1988 204, 204, 204, 204, 204, 204, 204, 204, 204, 205,
1989 206, 206, 207, 207, 208, 208, 208, 208, 209, 209,
1990 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
1991 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
1992 211, 211, 211, 211, 211, 211, 211, 211, 211, 211,
1993 211, 211, 211, 211, 212, 212, 213, 213, 214, 214,
1994 215, 215, 216, 216, 217, 217, 219, 218, 220, 218,
1995 218, 218, 218, 221, 218, 222, 218, 223, 218, 218,
1996 218, 218, 224, 225, 225, 226, 227, 227, 227, 228,
1997 228, 229, 229, 229, 229, 230, 231, 231, 232, 233,
1998 233, 234, 235, 236, 236, 237, 237, 237, 237, 237,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00001999 237, 237, 237, 237, 237, 237, 237, 237, 237, 237,
2000 237, 237, 237, 238, 238, 238, 238, 239, 239, 240,
2001 241, 241, 242, 242, 243, 244, 244, 244, 245, 245,
2002 245, 245, 245, 245, 245, 245, 245, 246, 246, 247,
2003 248, 248, 249, 249, 249, 249, 249, 250, 250, 251,
2004 251, 252, 252, 253, 253, 253, 253, 253, 253, 253,
2005 253, 253, 253, 253, 253, 253, 253, 253, 254, 254,
2006 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
2007 255
Dan Gohman54392c12008-04-19 00:24:39 +00002008};
2009
2010/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
2011static const yytype_uint8 yyr2[] =
2012{
2013 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
2014 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2015 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2016 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2017 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2018 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2019 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
2020 1, 1, 1, 0, 2, 1, 1, 1, 1, 1,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002021 1, 1, 1, 1, 0, 1, 1, 1, 0, 1,
2022 1, 0, 1, 1, 1, 1, 0, 1, 1, 0,
2023 1, 1, 1, 1, 1, 2, 1, 1, 1, 1,
2024 1, 1, 1, 1, 1, 2, 0, 2, 1, 1,
2025 1, 1, 1, 1, 0, 2, 0, 2, 0, 2,
2026 0, 3, 2, 0, 1, 0, 3, 1, 2, 1,
2027 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
2028 2, 5, 5, 5, 5, 3, 2, 5, 4, 2,
2029 1, 1, 1, 3, 1, 3, 1, 0, 1, 3,
2030 4, 3, 3, 4, 4, 3, 6, 5, 2, 2,
2031 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2032 6, 5, 8, 6, 6, 7, 7, 7, 7, 6,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00002033 8, 8, 5, 7, 3, 1, 1, 1, 1, 0,
2034 2, 6, 1, 0, 1, 2, 0, 3, 0, 3,
2035 3, 3, 3, 0, 8, 0, 9, 0, 9, 5,
2036 2, 3, 1, 3, 3, 3, 3, 1, 0, 5,
2037 3, 1, 3, 1, 0, 10, 1, 1, 4, 1,
2038 1, 2, 3, 0, 1, 1, 1, 1, 1, 1,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002039 1, 1, 1, 3, 3, 2, 2, 3, 2, 5,
2040 4, 1, 5, 1, 1, 1, 1, 1, 1, 2,
2041 1, 3, 2, 2, 3, 2, 0, 1, 2, 2,
2042 3, 9, 9, 8, 14, 1, 1, 6, 5, 2,
2043 6, 7, 4, 4, 6, 6, 0, 0, 3, 2,
2044 3, 2, 1, 5, 5, 6, 6, 6, 6, 4,
2045 6, 4, 4, 6, 6, 2, 8, 1, 1, 0,
2046 3, 6, 3, 6, 2, 5, 7, 5, 4, 4,
2047 7
Dan Gohman54392c12008-04-19 00:24:39 +00002048};
2049
2050/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2051 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2052 means the default is an error. */
2053static const yytype_uint16 yydefact[] =
2054{
Dan Gohmane6b1ee62008-05-23 01:55:30 +00002055 73, 61, 70, 62, 71, 63, 218, 216, 0, 0,
2056 0, 0, 0, 0, 84, 72, 0, 73, 214, 88,
2057 91, 0, 0, 230, 0, 0, 68, 0, 74, 75,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002058 77, 76, 78, 81, 79, 82, 80, 83, 85, 86,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00002059 87, 84, 84, 209, 1, 215, 89, 90, 84, 219,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002060 92, 93, 94, 95, 84, 286, 217, 286, 0, 0,
2061 238, 231, 232, 220, 273, 274, 222, 139, 140, 141,
2062 144, 143, 142, 145, 146, 0, 0, 0, 0, 275,
2063 276, 147, 221, 149, 209, 209, 96, 208, 0, 99,
2064 99, 287, 283, 69, 249, 250, 251, 282, 233, 234,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00002065 237, 0, 167, 150, 0, 0, 0, 0, 156, 168,
2066 0, 0, 167, 0, 0, 0, 98, 97, 0, 206,
2067 207, 0, 0, 100, 101, 102, 103, 104, 0, 252,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002068 0, 329, 285, 0, 235, 166, 116, 162, 164, 0,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002069 0, 0, 0, 0, 0, 155, 0, 0, 148, 0,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00002070 0, 161, 0, 160, 0, 229, 139, 140, 141, 144,
2071 143, 142, 0, 0, 67, 67, 105, 0, 246, 247,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002072 248, 328, 312, 0, 0, 0, 0, 99, 295, 296,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002073 2, 3, 4, 5, 6, 7, 8, 9, 10, 14,
2074 15, 16, 11, 12, 13, 0, 0, 0, 0, 0,
2075 0, 0, 0, 17, 18, 19, 20, 21, 22, 23,
2076 24, 25, 26, 27, 28, 0, 0, 0, 0, 0,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002077 0, 0, 0, 0, 0, 0, 0, 284, 99, 299,
2078 0, 327, 236, 159, 0, 124, 67, 67, 158, 0,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00002079 169, 0, 124, 67, 67, 0, 210, 187, 188, 183,
2080 185, 184, 186, 189, 182, 178, 179, 0, 0, 0,
Nate Begeman646fa482008-05-12 19:01:56 +00002081 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002082 0, 0, 0, 0, 0, 181, 180, 223, 0, 311,
2083 289, 67, 280, 288, 0, 0, 55, 0, 0, 29,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00002084 30, 31, 32, 33, 34, 35, 36, 37, 38, 0,
2085 53, 54, 49, 50, 51, 52, 39, 40, 41, 42,
2086 43, 44, 45, 46, 47, 48, 0, 0, 0, 130,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002087 130, 334, 67, 67, 325, 0, 0, 0, 0, 0,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00002088 67, 67, 67, 67, 67, 0, 0, 0, 0, 0,
2089 107, 109, 108, 106, 110, 111, 112, 113, 114, 117,
2090 165, 163, 152, 153, 154, 157, 66, 151, 225, 227,
2091 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2092 0, 0, 171, 205, 0, 0, 0, 175, 0, 172,
2093 0, 0, 0, 135, 244, 255, 256, 257, 262, 258,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002094 259, 260, 261, 253, 0, 0, 0, 0, 271, 278,
2095 277, 279, 0, 0, 290, 0, 0, 67, 67, 67,
2096 67, 0, 330, 0, 332, 307, 0, 0, 0, 0,
2097 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2098 67, 0, 115, 121, 120, 118, 119, 122, 123, 125,
2099 135, 135, 0, 0, 0, 0, 0, 307, 0, 0,
2100 0, 0, 0, 0, 0, 170, 156, 168, 0, 173,
2101 174, 0, 0, 0, 0, 224, 243, 116, 241, 0,
2102 254, 0, 265, 0, 0, 0, 268, 0, 266, 281,
2103 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2104 338, 0, 0, 0, 321, 322, 0, 0, 0, 0,
2105 339, 0, 0, 0, 319, 0, 130, 0, 226, 228,
2106 67, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2107 0, 0, 204, 177, 0, 0, 0, 0, 0, 0,
2108 137, 135, 65, 0, 124, 0, 264, 156, 0, 263,
2109 267, 0, 0, 306, 0, 0, 0, 0, 130, 131,
2110 130, 0, 0, 0, 0, 0, 0, 337, 309, 0,
2111 67, 313, 314, 306, 0, 335, 67, 211, 0, 0,
2112 0, 0, 191, 0, 0, 0, 0, 202, 0, 176,
2113 0, 0, 67, 132, 138, 136, 64, 240, 242, 116,
2114 133, 0, 270, 0, 0, 0, 116, 116, 0, 315,
2115 316, 317, 318, 331, 333, 308, 0, 0, 320, 323,
2116 324, 310, 0, 0, 130, 0, 0, 0, 0, 0,
2117 199, 0, 0, 0, 193, 194, 190, 65, 134, 128,
2118 272, 269, 0, 0, 0, 0, 124, 0, 300, 0,
2119 340, 124, 336, 195, 196, 197, 198, 0, 0, 0,
2120 203, 239, 0, 126, 0, 293, 0, 0, 107, 109,
2121 116, 116, 0, 116, 116, 301, 326, 192, 200, 201,
2122 129, 0, 245, 291, 0, 292, 0, 303, 302, 0,
2123 0, 0, 127, 0, 0, 0, 116, 116, 0, 0,
2124 0, 305, 304, 298, 0, 0, 297, 0, 294
Dan Gohman54392c12008-04-19 00:24:39 +00002125};
2126
2127/* YYDEFGOTO[NTERM-NUM]. */
2128static const yytype_int16 yydefgoto[] =
2129{
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002130 -1, 272, 273, 274, 299, 316, 162, 163, 79, 587,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002131 113, 12, 80, 14, 15, 41, 42, 43, 48, 54,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002132 118, 128, 349, 233, 439, 352, 672, 653, 412, 530,
2133 629, 465, 531, 81, 164, 137, 154, 138, 139, 110,
2134 373, 398, 374, 121, 88, 155, 16, 17, 18, 20,
2135 19, 383, 440, 441, 63, 23, 61, 101, 468, 469,
2136 129, 170, 55, 96, 56, 49, 471, 399, 83, 401,
2137 282, 283, 57, 92, 93, 227, 657, 132, 324, 598,
2138 490, 500, 228, 229, 230, 231
Dan Gohman54392c12008-04-19 00:24:39 +00002139};
2140
2141/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2142 STATE-NUM. */
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002143#define YYPACT_NINF -622
Dan Gohman54392c12008-04-19 00:24:39 +00002144static const yytype_int16 yypact[] =
2145{
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002146 805, -622, -622, -622, -622, -622, -622, -622, -6, -112,
2147 23, -97, 91, -94, 24, -622, 126, 1385, -622, 135,
2148 257, 48, 77, -622, 3, 216, -622, 1807, -622, -622,
2149 -622, -622, -622, -622, -622, -622, -622, -622, -622, -622,
2150 -622, 49, 49, 187, -622, -622, -622, -622, 49, -622,
2151 -622, -622, -622, -622, 49, 218, -622, 16, 220, 239,
2152 243, -622, -622, -622, -622, -622, 110, -622, -622, -622,
2153 -622, -622, -622, -622, -622, 267, 271, 1, 691, -622,
2154 -622, -622, -28, -622, 246, 246, 206, -622, 46, 215,
2155 215, -622, -622, 343, -622, -622, -622, -622, -622, -622,
2156 -622, -59, 1537, -622, 121, 130, 880, 110, -622, -28,
2157 -110, 138, 1537, 142, 46, 46, -622, -622, 1555, -622,
2158 -622, 1830, 302, -622, -622, -622, -622, -622, 1848, -622,
2159 -14, 2199, -622, 293, -622, -622, -28, -622, 160, 165,
2160 1877, 1877, 168, -103, 1877, -622, 334, 189, -622, 1830,
2161 1877, 110, 191, -28, 221, -622, 85, 341, 342, 345,
2162 354, 355, 323, 360, 1373, 315, -622, 28, -622, -622,
2163 -622, -622, -622, 316, 1921, 42, 361, 215, -622, -622,
2164 -622, -622, -622, -622, -622, -622, -622, -622, -622, -622,
2165 -622, -622, -622, -622, -622, 393, 529, 393, 529, 1877,
2166 1877, 1877, 1877, -622, -622, -622, -622, -622, -622, -622,
2167 -622, -622, -622, -622, -622, 1877, 1877, 1877, 1877, 1877,
2168 1877, 1877, 1877, 1877, 1877, 1877, 1877, -622, 215, -622,
2169 70, -622, -622, 176, 1578, -622, -39, -46, -622, 208,
2170 -28, 223, -622, 315, 5, 1555, -622, -622, -622, -622,
2171 -622, -622, -622, -622, -622, -622, -622, 393, 529, 393,
2172 529, 219, 227, 228, 234, 235, 241, 242, 1596, 2009,
2173 993, 356, 244, 245, 251, -622, -622, -622, 254, -622,
2174 110, 792, -622, 240, 943, 943, -622, 943, 1848, -622,
2175 -622, -622, -622, -622, -622, -622, -622, -622, -622, 1877,
2176 -622, -622, -622, -622, -622, -622, -622, -622, -622, -622,
2177 -622, -622, -622, -622, -622, -622, 1877, 1877, 1877, 26,
2178 58, -622, 792, -35, 252, 256, 258, 259, 260, 263,
2179 792, 792, 792, 792, 792, 389, 1848, 1877, 1877, 375,
2180 -622, -622, -622, -622, -622, -622, -622, -622, -622, -622,
2181 -622, -622, 202, -622, -622, -622, -622, 202, -622, 142,
2182 390, 273, 274, 276, 277, 1830, 1830, 1830, 1830, 1830,
2183 1830, 1830, -622, -622, 57, 1268, -82, -622, -64, -622,
2184 1830, 1830, 1830, 275, 1628, -622, -622, -622, -622, -622,
2185 -622, -622, -622, 374, 1757, 2041, 1313, 414, -622, -622,
2186 -622, -622, 1877, 278, -622, 279, 943, 792, 792, 792,
2187 792, 31, -622, 33, -622, -622, 943, 280, 1877, 1877,
2188 1877, 1877, 1877, 281, 282, 284, 285, 287, 1877, 943,
2189 792, 288, -622, -622, -622, -622, -622, -622, -622, -622,
2190 275, 275, 1877, 1830, 1830, 1830, 1830, -622, 290, 291,
2191 292, 294, 282, 295, 1830, -622, 286, 1222, -62, -622,
2192 -622, 301, 307, 429, 20, -622, -622, -28, 309, 312,
2193 -622, 448, -622, 87, 1508, -10, -622, -61, -622, -622,
2194 455, 456, 318, 317, 319, 320, 321, 943, 473, 943,
2195 338, 339, 943, 340, -28, -622, 344, 346, 478, 496,
2196 351, 1877, 943, 943, -28, 348, 352, 1877, -622, -622,
2197 -5, 353, 357, 359, 362, 115, 1830, 1830, 1830, 1830,
2198 146, 1830, -622, -622, 336, 1830, 1830, 1877, 493, 515,
2199 -622, 275, 530, 1789, -622, 363, -622, 358, -60, -622,
2200 -622, 943, 943, 2082, 943, 943, 943, 943, 352, -622,
2201 352, 1877, 943, 364, 1877, 1877, 1877, -622, -622, 516,
2202 792, -622, -622, 2082, 472, -622, 792, -622, 1830, 1830,
2203 1830, 1830, -622, 368, 377, 372, 376, -622, 282, -622,
2204 379, 381, 2, -622, -622, -622, -622, -622, -622, -28,
2205 4, 517, -622, 380, 382, 378, -16, -28, 157, -622,
2206 -622, -622, -622, -622, -622, -622, 384, 943, -622, -622,
2207 -622, -622, 282, 178, 352, 386, 388, 394, 396, 1830,
2208 -622, 1830, 1830, 198, -622, -622, -622, 530, -622, 507,
2209 -622, -622, 533, -7, 641, 641, -622, 2100, -622, 398,
2210 351, -622, -622, -622, -622, -622, -622, 406, 408, 409,
2211 -622, -622, 564, 417, 943, -622, 1088, 7, 415, 416,
2212 -622, -622, -12, -16, -28, -622, 202, -622, -622, -622,
2213 -622, 548, -622, -622, 418, -622, 1088, 176, 176, 557,
2214 641, 641, -622, 558, 419, 943, -622, -622, 943, 562,
2215 508, 176, 176, -622, 943, 563, -622, 943, -622
Dan Gohman54392c12008-04-19 00:24:39 +00002216};
2217
2218/* YYPGOTO[NTERM-NUM]. */
2219static const yytype_int16 yypgoto[] =
2220{
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002221 -622, 451, 452, 454, -163, -157, -174, -622, 0, -41,
2222 -102, 494, 13, -622, -622, -622, -622, 222, -622, -622,
2223 -622, -145, -622, -427, -622, -227, -622, -622, -301, -2,
2224 -622, -412, -622, -622, -26, 369, -116, -622, 477, 484,
2225 -113, -161, -259, 8, 147, 347, -622, -622, 574, -622,
2226 -622, -622, -622, -622, -622, -622, -622, -622, -622, -622,
2227 503, -622, -622, -622, -622, -622, -622, -621, -121, 55,
2228 -195, -622, -622, 537, -622, -622, -622, -622, -622, 32,
2229 151, -445, -622, -622, -622, -622
Dan Gohman54392c12008-04-19 00:24:39 +00002230};
2231
2232/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2233 positive, shift that token. If negative, reduce the rule which
2234 number is the opposite. If zero, do what YYDEFACT says.
2235 If YYTABLE_NINF, syntax error. */
Dan Gohmane6b1ee62008-05-23 01:55:30 +00002236#define YYTABLE_NINF -214
Dan Gohman54392c12008-04-19 00:24:39 +00002237static const yytype_int16 yytable[] =
2238{
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002239 11, 82, 287, 275, 286, 105, 321, 520, 165, 111,
2240 376, 378, 167, 13, 168, 357, 111, 11, 286, 414,
2241 111, 325, 326, 327, 328, 329, 679, 111, 508, 509,
2242 13, 335, 288, 246, 317, 674, 243, 91, 528, -145,
2243 532, 318, 487, 276, 489, 94, 24, 21, 2, 144,
2244 111, 4, 109, 284, 528, 684, 144, 111, 145, 285,
2245 111, 26, 22, 277, 28, 239, 29, 30, 31, 32,
2246 33, 34, 35, 36, 529, 37, 136, 454, 119, 120,
2247 109, 111, 25, 336, 459, 488, 136, 488, -55, -55,
2248 -55, -55, 153, 11, 361, 454, 363, 454, 454, 454,
2249 133, 362, 153, 364, 460, 134, 524, 540, 593, 27,
2250 112, 247, 248, 111, 236, 237, 458, 112, 240, 585,
2251 354, 112, 149, 150, 244, 353, 44, 416, 112, 433,
2252 434, 435, -67, 623, 436, 473, 475, 477, 437, 438,
2253 -145, 358, 359, 431, -145, 433, 434, 435, 281, 454,
2254 436, 112, 567, 169, 437, 438, 539, 655, 112, 626,
2255 400, 112, 627, 400, 400, 60, 400, 640, 106, 634,
2256 635, 675, 406, 319, 320, 281, 322, 38, 39, 40,
2257 278, 46, 112, 47, 95, 411, -67, 337, 338, 323,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00002258 281, 281, 281, 281, 281, 330, 331, 332, 333, 334,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002259 281, 400, 38, 39, 40, 565, 58, 479, 136, 400,
2260 400, 400, 400, 400, 112, 538, 454, 413, -67, 153,
2261 429, 455, 86, 493, 87, 495, 496, 497, 64, 65,
2262 339, 114, 115, 677, 678, 59, 680, 681, 62, 91,
2263 1, 2, 98, 3, 4, 5, 454, 603, 116, 604,
2264 117, 536, 447, 448, 449, 450, 451, 452, 453, 691,
2265 692, 99, 153, 84, 85, 100, 102, 461, 462, 463,
2266 89, 103, 572, 407, 551, 104, 90, 122, 123, 124,
2267 125, 126, 127, 87, 140, 400, 400, 400, 400, 400,
2268 408, 409, 410, 141, 146, 400, 275, 340, 341, 50,
2269 51, 52, 148, 577, 53, 559, 166, 590, 400, 400,
2270 153, 430, 281, 642, 636, 232, 637, 342, 343, 234,
2271 344, 345, 235, 346, 347, 348, 249, 250, 251, 252,
2272 511, 512, 513, 514, 238, 641, 276, 637, 241, 403,
2273 404, 522, 405, 433, 434, 435, 242, 245, 436, 457,
2274 -56, -57, 437, 438, -60, 650, 605, 559, 467, 608,
2275 609, 610, 1, -59, -58, 3, 400, 5, 400, 253,
2276 111, 400, 286, 279, 355, 365, 281, 415, 379, 432,
2277 356, 400, 400, 366, 367, 423, 424, 425, 426, 427,
2278 368, 369, 281, 494, 281, 281, 281, 370, 371, 402,
2279 380, 381, 504, 573, 574, 575, 576, 382, 578, 662,
2280 384, 417, 580, 581, 666, 418, 510, 419, 420, 421,
2281 400, 400, 422, 400, 400, 400, 400, 428, 442, 443,
2282 444, 400, 445, 446, 464, 470, 478, 480, 481, 400,
2283 498, 499, 492, 501, 502, 400, 503, 507, 457, 516,
2284 517, 518, 523, 519, 521, 615, 616, 617, 618, 656,
2285 525, 482, 483, 484, 485, 486, 526, 527, 533, 534,
2286 535, 491, 541, 542, 543, 560, 544, 549, 545, 546,
2287 547, 566, 557, 676, 505, 506, 400, 289, 290, 291,
2288 292, 293, 294, 295, 296, 297, 298, 551, 552, 554,
2289 558, 582, 579, 555, 563, 556, 647, 589, 648, 649,
2290 559, 564, 568, 400, 400, 583, 569, 597, 570, 584,
2291 611, 571, 591, 607, 592, 281, 488, 619, 281, 281,
2292 281, 621, 586, 400, 620, 622, 624, 597, 625, 630,
2293 633, 632, 548, 643, 550, 644, 631, 553, 638, 1,
2294 654, 645, 3, 646, 5, 300, 301, 561, 562, 400,
2295 400, 652, 665, 667, 400, 668, 669, 400, 670, 671,
2296 682, -18, -19, 400, 685, 688, 400, 683, 689, 694,
2297 697, 695, 224, 225, 339, 226, 651, 131, 628, 147,
2298 143, 45, 360, 130, 97, 613, 594, 595, 515, 599,
2299 600, 601, 602, 351, 0, 0, 0, 606, 0, 0,
2300 0, 664, 0, 0, 0, 612, 0, 0, 0, 0,
2301 0, 614, 0, 0, 0, 0, 0, 586, 0, 302,
2302 303, 304, 305, 306, 307, 308, 309, 310, 311, 312,
2303 313, 314, 315, 0, 385, 386, 0, 0, 64, 65,
2304 387, 340, 341, 0, 0, 0, 0, 0, 0, 0,
2305 1, 2, 639, 3, 4, 5, 388, 389, 390, 0,
2306 0, 342, 343, 0, 344, 345, 0, 346, 347, 348,
2307 0, 391, 392, 0, 0, 0, 0, 0, 0, 660,
2308 661, 0, 0, 0, 0, 339, 0, 0, 64, 65,
2309 393, 107, 67, 68, 69, 70, 71, 72, 73, 673,
Dan Gohmane5febe42008-05-31 00:58:22 +00002310 1, 2, 0, 3, 4, 5, 180, 181, 182, 183,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00002311 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002312 194, 257, 258, 259, 260, 686, 687, 0, 0, 0,
2313 690, 74, 0, 693, 0, 0, 0, 0, 0, 696,
2314 0, 0, 698, 0, 0, 0, 0, 0, 0, 0,
2315 261, 203, 658, 659, 206, 207, 208, 209, 210, 211,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00002316 212, 213, 214, 0, 262, 0, 263, 264, 265, 0,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002317 266, 267, 342, 343, 0, 344, 345, 0, 346, 347,
2318 348, 0, 0, 0, 0, 385, 386, 0, 0, 64,
2319 65, 387, 0, 394, 0, -213, 395, 0, 396, 0,
2320 397, 1, 2, 0, 3, 4, 5, 388, 389, 390,
2321 0, 0, 0, -69, 1, 2, 0, 3, 4, 5,
2322 0, 0, 391, 392, 0, 6, 7, 0, 0, 0,
2323 0, 0, 0, 0, 0, 0, 0, 111, 0, 0,
2324 0, 393, 75, 76, 0, 0, 77, 8, 78, 108,
2325 0, 9, 0, 0, 0, 10, 0, 180, 181, 182,
2326 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
2327 193, 194, 257, 258, 259, 260, 0, 64, 65, 0,
2328 107, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2329 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2330 0, 261, 203, 204, 205, 206, 207, 208, 209, 210,
2331 211, 212, 213, 214, 0, 262, 0, 263, 264, 265,
2332 74, 266, 267, 0, 0, 0, 0, 0, 0, 0,
2333 0, 0, 0, 0, 0, 0, 385, 386, 112, 0,
2334 64, 65, 387, 0, 394, 0, 0, 395, 0, 396,
2335 0, 397, 1, 2, 0, 3, 4, 5, 388, 389,
2336 390, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2337 0, 0, 0, 391, 392, 0, 0, 0, 0, 0,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002338 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002339 64, 65, 393, 107, 156, 157, 158, 159, 160, 161,
2340 73, 0, 1, 2, 0, 3, 4, 5, 180, 181,
2341 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
2342 192, 193, 194, 257, 258, 259, 260, 0, 0, 0,
2343 0, 75, 76, 74, 0, 77, 0, 78, 142, 0,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002344 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002345 0, 0, 261, 203, 204, 205, 206, 207, 208, 209,
2346 210, 211, 212, 213, 214, 0, 262, 0, 263, 264,
2347 265, 0, 266, 267, 0, 0, 0, 0, 0, 0,
2348 0, 385, 386, 0, 0, 0, 0, 387, 0, 0,
2349 0, 0, 0, 0, 0, 394, 0, 0, 395, 0,
2350 396, 0, 397, 388, 389, 390, 0, 0, 0, 0,
2351 0, 0, 0, 0, 0, 0, 0, 0, 391, 392,
Dan Gohmane5febe42008-05-31 00:58:22 +00002352 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002353 0, 0, 0, 0, 0, 0, 0, 393, 0, 0,
2354 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2355 78, 377, 0, 180, 181, 182, 183, 184, 185, 186,
2356 187, 188, 189, 190, 191, 192, 193, 194, 257, 258,
2357 259, 260, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohmane5febe42008-05-31 00:58:22 +00002358 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002359 0, 0, 0, 0, 0, 0, 0, 261, 203, 204,
2360 205, 206, 207, 208, 209, 210, 211, 212, 213, 214,
2361 0, 262, 0, 263, 264, 265, 0, 266, 267, 64,
2362 65, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2363 0, 1, 2, 0, 3, 4, 5, 254, 0, 0,
2364 394, 0, 0, 395, 0, 396, 0, 397, 0, 0,
2365 0, 0, 255, 256, 0, 0, 0, 0, 0, 0,
2366 0, 0, 0, 0, 0, 64, 65, 111, 107, 156,
2367 157, 158, 159, 160, 161, 73, 0, 1, 2, 0,
2368 3, 4, 5, 0, 0, 0, 0, 180, 181, 182,
2369 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
2370 193, 194, 257, 258, 259, 260, 0, 0, 74, 0,
2371 64, 65, 0, 107, 156, 157, 158, 159, 160, 161,
2372 73, 0, 1, 2, 0, 3, 4, 5, 0, 0,
2373 0, 261, 203, 204, 205, 206, 207, 208, 209, 210,
2374 211, 212, 213, 214, 0, 262, 0, 263, 264, 265,
2375 0, 266, 267, 74, 0, 0, 0, 0, 0, 0,
2376 0, 0, 0, 0, 0, 0, 0, 0, 112, 0,
2377 64, 65, -67, 0, 268, -212, 0, 269, 0, 270,
2378 0, 271, 1, 2, 0, 3, 4, 5, 254, 0,
2379 0, 0, 0, -69, 1, 2, 0, 3, 4, 5,
2380 0, 0, 0, 255, 256, 6, 7, 0, 0, 0,
2381 0, 0, 0, 0, 0, 0, 0, 0, 111, 75,
2382 76, 0, 0, 77, 0, 78, 456, 8, 0, 0,
2383 0, 9, 0, 0, 0, 10, 0, 0, 180, 181,
2384 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
2385 192, 193, 194, 257, 258, 259, 260, 0, 0, 0,
2386 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2387 78, 476, 0, 0, 0, 0, 0, 0, 0, 0,
2388 0, 0, 261, 203, 204, 205, 206, 207, 208, 209,
2389 210, 211, 212, 213, 214, 0, 262, 0, 263, 264,
2390 265, 0, 266, 267, 0, 64, 65, 0, 107, 156,
2391 157, 158, 159, 160, 161, 73, 0, 1, 2, 112,
2392 3, 4, 5, 0, 0, 268, 0, 0, 269, 0,
2393 270, 0, 271, 0, 64, 65, 0, 107, 67, 68,
2394 69, 70, 71, 72, 73, 0, 1, 2, 74, 3,
2395 4, 5, 64, 65, 0, 151, 67, 68, 69, 70,
2396 71, 72, 73, 0, 1, 2, 135, 3, 4, 5,
2397 0, 0, 0, 0, 0, 64, 65, 74, 107, 67,
Dan Gohmane5febe42008-05-31 00:58:22 +00002398 68, 69, 70, 71, 72, 73, 0, 1, 2, 0,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002399 3, 4, 5, 64, 65, 74, 107, 156, 157, 158,
2400 159, 160, 161, 73, 0, 1, 2, 350, 3, 4,
2401 5, 0, 0, 0, 0, 0, 0, 0, 74, 0,
2402 0, 0, 0, 0, 0, 64, 65, 0, 107, 67,
2403 68, 69, 70, 71, 72, 73, 74, 1, 2, 0,
2404 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
2405 0, 0, 0, 0, 0, 0, 0, 466, 0, 75,
2406 76, 0, 0, 77, 0, 78, 537, 0, 74, 0,
2407 152, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2408 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2409 0, 0, 77, 0, 78, 0, 0, 0, 0, 0,
2410 0, 0, 0, 0, 0, 0, 75, 76, 0, 0,
2411 77, 0, 78, 0, 0, 0, 0, 0, 0, 0,
2412 0, 0, 0, 0, 0, 0, 0, 0, 0, 75,
2413 76, 0, 0, 77, 0, 78, 0, 0, 0, 0,
2414 0, 0, 0, 0, 0, 0, 0, 75, 76, 0,
2415 372, 77, 0, 78, 64, 65, 0, 107, 156, 157,
2416 158, 159, 160, 161, 73, 0, 1, 2, 0, 3,
2417 4, 5, 0, 0, 0, 0, 0, 0, 0, 75,
2418 76, 0, 0, 77, 0, 78, 64, 65, 0, 107,
2419 67, 68, 69, 70, 71, 72, 73, 74, 1, 2,
2420 0, 3, 4, 5, 64, 65, 0, 66, 67, 68,
2421 69, 70, 71, 72, 73, 0, 1, 2, 588, 3,
2422 4, 5, 0, 0, 0, 0, 0, 64, 65, 74,
Dan Gohmane5febe42008-05-31 00:58:22 +00002423 107, 156, 157, 158, 159, 160, 161, 73, 0, 1,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002424 2, 0, 3, 4, 5, 64, 65, 74, 151, 67,
2425 68, 69, 70, 71, 72, 73, 0, 1, 2, 0,
2426 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
2427 74, 0, 0, 0, 64, 65, 0, 107, 67, 68,
2428 69, 70, 71, 72, 73, 0, 1, 2, 74, 3,
2429 4, 5, 0, 0, 0, 0, 0, 0, 0, 0,
2430 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2431 0, 472, 77, 0, 78, 0, 0, 74, 64, 65,
2432 0, 280, 67, 68, 69, 70, 71, 72, 73, 0,
2433 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2434 75, 76, 0, 0, 77, 0, 78, 0, 0, 0,
2435 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2436 0, 74, 77, 0, 78, 0, 0, 0, 0, 0,
2437 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2438 0, 75, 76, 0, 0, 77, 0, 78, 0, 0,
2439 0, 0, 0, 0, 0, 0, 0, 0, 0, 75,
2440 76, 0, 0, 77, 0, 78, 64, 65, 0, 107,
2441 156, 157, 158, 159, 160, 161, 73, 0, 1, 2,
2442 0, 3, 4, 5, 0, 0, 0, 0, 75, 76,
2443 0, 0, 77, 0, 78, 0, 0, 0, 64, 65,
2444 0, 107, 156, 157, 158, 159, 160, 161, 73, 74,
2445 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2446 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2447 0, 0, 75, 76, 0, 0, 77, 0, 78, 64,
2448 65, 74, 107, 67, 68, 69, 70, 71, 72, 596,
2449 0, 1, 2, 0, 3, 4, 5, 64, 65, 0,
2450 107, 67, 68, 69, 70, 71, 72, 663, 0, 1,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00002451 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
Dan Gohmane5febe42008-05-31 00:58:22 +00002452 0, 0, 74, 0, 0, 0, 0, 0, 0, 0,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002453 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2454 74, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2455 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2456 75, 76, 0, 0, 77, 0, 375, 0, 0, 0,
2457 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2458 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2459 0, 0, 75, 76, 0, 0, 77, 0, 474, 0,
2460 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2461 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2462 0, 0, 0, 0, 0, 171, 0, 0, 0, 0,
Dan Gohmane5febe42008-05-31 00:58:22 +00002463 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002464 0, 0, 0, 0, 0, 0, 172, 173, 0, 0,
2465 0, 75, 76, 0, 0, 77, 0, 78, 174, 175,
2466 176, 177, 178, 179, 180, 181, 182, 183, 184, 185,
2467 186, 187, 188, 189, 190, 191, 192, 193, 194, 195,
2468 196, 197, 198, 0, 0, 0, 0, 0, 0, 0,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00002469 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002470 0, 0, 0, 199, 200, 201, 0, 0, 202, 203,
2471 204, 205, 206, 207, 208, 209, 210, 211, 212, 213,
2472 214, 215, 216, 217, 218, 219, 220, 221, 222, 223
Dan Gohman54392c12008-04-19 00:24:39 +00002473};
2474
2475static const yytype_int16 yycheck[] =
2476{
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002477 0, 27, 176, 164, 11, 4, 201, 452, 121, 55,
2478 269, 270, 128, 0, 28, 242, 55, 17, 11, 320,
2479 55, 216, 217, 218, 219, 220, 38, 55, 440, 441,
2480 17, 226, 177, 154, 197, 656, 149, 21, 34, 55,
2481 467, 198, 11, 164, 11, 29, 158, 53, 20, 159,
2482 55, 23, 78, 11, 34, 676, 159, 55, 168, 17,
2483 55, 158, 68, 165, 158, 168, 42, 43, 44, 45,
2484 46, 47, 48, 49, 54, 51, 102, 159, 32, 33,
2485 106, 55, 59, 228, 166, 54, 112, 54, 3, 4,
2486 5, 6, 118, 93, 257, 159, 259, 159, 159, 159,
2487 159, 258, 128, 260, 168, 164, 168, 168, 168, 18,
2488 156, 26, 27, 55, 140, 141, 375, 156, 144, 531,
2489 166, 156, 114, 115, 150, 164, 0, 162, 156, 141,
2490 142, 143, 160, 578, 146, 394, 395, 396, 150, 151,
2491 156, 243, 244, 338, 160, 141, 142, 143, 174, 159,
2492 146, 156, 157, 167, 150, 151, 166, 164, 156, 157,
2493 281, 156, 589, 284, 285, 162, 287, 612, 167, 596,
2494 597, 164, 288, 199, 200, 201, 202, 153, 154, 155,
2495 167, 46, 156, 48, 168, 159, 160, 117, 118, 215,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00002496 216, 217, 218, 219, 220, 221, 222, 223, 224, 225,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002497 226, 322, 153, 154, 155, 506, 158, 402, 234, 330,
2498 331, 332, 333, 334, 156, 474, 159, 159, 160, 245,
2499 336, 164, 35, 418, 37, 420, 421, 422, 7, 8,
2500 54, 84, 85, 660, 661, 158, 663, 664, 22, 21,
2501 19, 20, 22, 22, 23, 24, 159, 548, 42, 550,
2502 44, 164, 365, 366, 367, 368, 369, 370, 371, 686,
2503 687, 22, 288, 41, 42, 22, 156, 380, 381, 382,
2504 48, 4, 157, 299, 159, 4, 54, 62, 63, 64,
2505 65, 66, 67, 37, 163, 406, 407, 408, 409, 410,
2506 316, 317, 318, 163, 156, 416, 457, 121, 122, 42,
2507 43, 44, 160, 157, 47, 159, 4, 534, 429, 430,
2508 336, 337, 338, 614, 157, 22, 159, 141, 142, 159,
2509 144, 145, 157, 147, 148, 149, 3, 4, 5, 6,
2510 443, 444, 445, 446, 166, 157, 457, 159, 4, 284,
2511 285, 454, 287, 141, 142, 143, 157, 156, 146, 375,
2512 9, 9, 150, 151, 9, 157, 551, 159, 384, 554,
2513 555, 556, 19, 9, 9, 22, 487, 24, 489, 9,
2514 55, 492, 11, 57, 166, 156, 402, 322, 22, 4,
2515 157, 502, 503, 156, 156, 330, 331, 332, 333, 334,
2516 156, 156, 418, 419, 420, 421, 422, 156, 156, 159,
2517 156, 156, 428, 516, 517, 518, 519, 156, 521, 636,
2518 156, 159, 525, 526, 641, 159, 442, 159, 159, 159,
2519 541, 542, 159, 544, 545, 546, 547, 38, 38, 156,
2520 156, 552, 156, 156, 159, 61, 22, 159, 159, 560,
2521 159, 159, 162, 159, 159, 566, 159, 159, 474, 159,
2522 159, 159, 166, 159, 159, 568, 569, 570, 571, 633,
2523 159, 406, 407, 408, 409, 410, 159, 38, 159, 157,
2524 22, 416, 17, 17, 156, 501, 159, 4, 159, 159,
2525 159, 507, 4, 657, 429, 430, 607, 94, 95, 96,
2526 97, 98, 99, 100, 101, 102, 103, 159, 159, 159,
2527 4, 527, 166, 159, 156, 159, 619, 533, 621, 622,
2528 159, 159, 159, 634, 635, 22, 159, 543, 159, 4,
2529 4, 159, 159, 159, 166, 551, 54, 159, 554, 555,
2530 556, 159, 532, 654, 157, 159, 157, 563, 157, 22,
2531 162, 159, 487, 157, 489, 157, 166, 492, 164, 19,
2532 17, 157, 22, 157, 24, 26, 27, 502, 503, 680,
2533 681, 54, 164, 157, 685, 157, 157, 688, 4, 152,
2534 22, 156, 156, 694, 17, 17, 697, 159, 159, 17,
2535 17, 73, 131, 131, 54, 131, 627, 93, 590, 112,
2536 106, 17, 245, 90, 57, 563, 541, 542, 447, 544,
2537 545, 546, 547, 234, -1, -1, -1, 552, -1, -1,
2538 -1, 637, -1, -1, -1, 560, -1, -1, -1, -1,
2539 -1, 566, -1, -1, -1, -1, -1, 627, -1, 100,
2540 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
2541 111, 112, 113, -1, 3, 4, -1, -1, 7, 8,
2542 9, 121, 122, -1, -1, -1, -1, -1, -1, -1,
2543 19, 20, 607, 22, 23, 24, 25, 26, 27, -1,
2544 -1, 141, 142, -1, 144, 145, -1, 147, 148, 149,
2545 -1, 40, 41, -1, -1, -1, -1, -1, -1, 634,
2546 635, -1, -1, -1, -1, 54, -1, -1, 7, 8,
2547 59, 10, 11, 12, 13, 14, 15, 16, 17, 654,
Dan Gohmane5febe42008-05-31 00:58:22 +00002548 19, 20, -1, 22, 23, 24, 75, 76, 77, 78,
2549 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002550 89, 90, 91, 92, 93, 680, 681, -1, -1, -1,
2551 685, 50, -1, 688, -1, -1, -1, -1, -1, 694,
2552 -1, -1, 697, -1, -1, -1, -1, -1, -1, -1,
Dan Gohmane5febe42008-05-31 00:58:22 +00002553 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
2554 129, 130, 131, -1, 133, -1, 135, 136, 137, -1,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002555 139, 140, 141, 142, -1, 144, 145, -1, 147, 148,
2556 149, -1, -1, -1, -1, 3, 4, -1, -1, 7,
2557 8, 9, -1, 162, -1, 0, 165, -1, 167, -1,
2558 169, 19, 20, -1, 22, 23, 24, 25, 26, 27,
2559 -1, -1, -1, 18, 19, 20, -1, 22, 23, 24,
2560 -1, -1, 40, 41, -1, 30, 31, -1, -1, -1,
2561 -1, -1, -1, -1, -1, -1, -1, 55, -1, -1,
2562 -1, 59, 161, 162, -1, -1, 165, 52, 167, 168,
2563 -1, 56, -1, -1, -1, 60, -1, 75, 76, 77,
2564 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2565 88, 89, 90, 91, 92, 93, -1, 7, 8, -1,
Dan Gohmane5febe42008-05-31 00:58:22 +00002566 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002567 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2568 -1, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2569 128, 129, 130, 131, -1, 133, -1, 135, 136, 137,
2570 50, 139, 140, -1, -1, -1, -1, -1, -1, -1,
2571 -1, -1, -1, -1, -1, -1, 3, 4, 156, -1,
2572 7, 8, 9, -1, 162, -1, -1, 165, -1, 167,
2573 -1, 169, 19, 20, -1, 22, 23, 24, 25, 26,
2574 27, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2575 -1, -1, -1, 40, 41, -1, -1, -1, -1, -1,
Dan Gohmane5febe42008-05-31 00:58:22 +00002576 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002577 7, 8, 59, 10, 11, 12, 13, 14, 15, 16,
2578 17, -1, 19, 20, -1, 22, 23, 24, 75, 76,
2579 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2580 87, 88, 89, 90, 91, 92, 93, -1, -1, -1,
2581 -1, 161, 162, 50, -1, 165, -1, 167, 168, -1,
Dan Gohmane5febe42008-05-31 00:58:22 +00002582 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002583 -1, -1, 119, 120, 121, 122, 123, 124, 125, 126,
2584 127, 128, 129, 130, 131, -1, 133, -1, 135, 136,
2585 137, -1, 139, 140, -1, -1, -1, -1, -1, -1,
2586 -1, 3, 4, -1, -1, -1, -1, 9, -1, -1,
2587 -1, -1, -1, -1, -1, 162, -1, -1, 165, -1,
2588 167, -1, 169, 25, 26, 27, -1, -1, -1, -1,
2589 -1, -1, -1, -1, -1, -1, -1, -1, 40, 41,
2590 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2591 -1, -1, -1, -1, -1, -1, -1, 59, -1, -1,
2592 -1, -1, -1, -1, 161, 162, -1, -1, 165, -1,
2593 167, 168, -1, 75, 76, 77, 78, 79, 80, 81,
2594 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
2595 92, 93, -1, -1, -1, -1, -1, -1, -1, -1,
2596 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2597 -1, -1, -1, -1, -1, -1, -1, 119, 120, 121,
2598 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
2599 -1, 133, -1, 135, 136, 137, -1, 139, 140, 7,
2600 8, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2601 -1, 19, 20, -1, 22, 23, 24, 25, -1, -1,
2602 162, -1, -1, 165, -1, 167, -1, 169, -1, -1,
2603 -1, -1, 40, 41, -1, -1, -1, -1, -1, -1,
2604 -1, -1, -1, -1, -1, 7, 8, 55, 10, 11,
2605 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2606 22, 23, 24, -1, -1, -1, -1, 75, 76, 77,
2607 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2608 88, 89, 90, 91, 92, 93, -1, -1, 50, -1,
2609 7, 8, -1, 10, 11, 12, 13, 14, 15, 16,
2610 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
2611 -1, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2612 128, 129, 130, 131, -1, 133, -1, 135, 136, 137,
2613 -1, 139, 140, 50, -1, -1, -1, -1, -1, -1,
2614 -1, -1, -1, -1, -1, -1, -1, -1, 156, -1,
2615 7, 8, 160, -1, 162, 0, -1, 165, -1, 167,
2616 -1, 169, 19, 20, -1, 22, 23, 24, 25, -1,
2617 -1, -1, -1, 18, 19, 20, -1, 22, 23, 24,
2618 -1, -1, -1, 40, 41, 30, 31, -1, -1, -1,
2619 -1, -1, -1, -1, -1, -1, -1, -1, 55, 161,
2620 162, -1, -1, 165, -1, 167, 168, 52, -1, -1,
2621 -1, 56, -1, -1, -1, 60, -1, -1, 75, 76,
2622 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2623 87, 88, 89, 90, 91, 92, 93, -1, -1, -1,
2624 -1, -1, -1, -1, 161, 162, -1, -1, 165, -1,
2625 167, 168, -1, -1, -1, -1, -1, -1, -1, -1,
2626 -1, -1, 119, 120, 121, 122, 123, 124, 125, 126,
2627 127, 128, 129, 130, 131, -1, 133, -1, 135, 136,
2628 137, -1, 139, 140, -1, 7, 8, -1, 10, 11,
2629 12, 13, 14, 15, 16, 17, -1, 19, 20, 156,
2630 22, 23, 24, -1, -1, 162, -1, -1, 165, -1,
2631 167, -1, 169, -1, 7, 8, -1, 10, 11, 12,
2632 13, 14, 15, 16, 17, -1, 19, 20, 50, 22,
2633 23, 24, 7, 8, -1, 10, 11, 12, 13, 14,
2634 15, 16, 17, -1, 19, 20, 39, 22, 23, 24,
2635 -1, -1, -1, -1, -1, 7, 8, 50, 10, 11,
2636 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2637 22, 23, 24, 7, 8, 50, 10, 11, 12, 13,
2638 14, 15, 16, 17, -1, 19, 20, 39, 22, 23,
2639 24, -1, -1, -1, -1, -1, -1, -1, 50, -1,
2640 -1, -1, -1, -1, -1, 7, 8, -1, 10, 11,
2641 12, 13, 14, 15, 16, 17, 50, 19, 20, -1,
2642 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
2643 -1, -1, -1, -1, -1, -1, -1, 39, -1, 161,
2644 162, -1, -1, 165, -1, 167, 168, -1, 50, -1,
2645 125, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2646 -1, -1, -1, -1, -1, -1, -1, -1, 161, 162,
2647 -1, -1, 165, -1, 167, -1, -1, -1, -1, -1,
2648 -1, -1, -1, -1, -1, -1, 161, 162, -1, -1,
2649 165, -1, 167, -1, -1, -1, -1, -1, -1, -1,
2650 -1, -1, -1, -1, -1, -1, -1, -1, -1, 161,
2651 162, -1, -1, 165, -1, 167, -1, -1, -1, -1,
2652 -1, -1, -1, -1, -1, -1, -1, 161, 162, -1,
2653 164, 165, -1, 167, 7, 8, -1, 10, 11, 12,
2654 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2655 23, 24, -1, -1, -1, -1, -1, -1, -1, 161,
2656 162, -1, -1, 165, -1, 167, 7, 8, -1, 10,
2657 11, 12, 13, 14, 15, 16, 17, 50, 19, 20,
2658 -1, 22, 23, 24, 7, 8, -1, 10, 11, 12,
2659 13, 14, 15, 16, 17, -1, 19, 20, 39, 22,
2660 23, 24, -1, -1, -1, -1, -1, 7, 8, 50,
2661 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2662 20, -1, 22, 23, 24, 7, 8, 50, 10, 11,
2663 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2664 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
2665 50, -1, -1, -1, 7, 8, -1, 10, 11, 12,
2666 13, 14, 15, 16, 17, -1, 19, 20, 50, 22,
2667 23, 24, -1, -1, -1, -1, -1, -1, -1, -1,
2668 -1, -1, -1, -1, -1, -1, -1, -1, 161, 162,
2669 -1, 164, 165, -1, 167, -1, -1, 50, 7, 8,
Dan Gohmane5febe42008-05-31 00:58:22 +00002670 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2671 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002672 161, 162, -1, -1, 165, -1, 167, -1, -1, -1,
2673 -1, -1, -1, -1, -1, -1, -1, -1, 161, 162,
2674 -1, 50, 165, -1, 167, -1, -1, -1, -1, -1,
2675 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2676 -1, 161, 162, -1, -1, 165, -1, 167, -1, -1,
2677 -1, -1, -1, -1, -1, -1, -1, -1, -1, 161,
2678 162, -1, -1, 165, -1, 167, 7, 8, -1, 10,
2679 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2680 -1, 22, 23, 24, -1, -1, -1, -1, 161, 162,
2681 -1, -1, 165, -1, 167, -1, -1, -1, 7, 8,
2682 -1, 10, 11, 12, 13, 14, 15, 16, 17, 50,
2683 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
Dan Gohmane5febe42008-05-31 00:58:22 +00002684 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2685 -1, -1, 161, 162, -1, -1, 165, -1, 167, 7,
2686 8, 50, 10, 11, 12, 13, 14, 15, 16, 17,
2687 -1, 19, 20, -1, 22, 23, 24, 7, 8, -1,
2688 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2689 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2690 -1, -1, 50, -1, -1, -1, -1, -1, -1, -1,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002691 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2692 50, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2693 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2694 161, 162, -1, -1, 165, -1, 167, -1, -1, -1,
2695 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2696 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dan Gohmane5febe42008-05-31 00:58:22 +00002697 -1, -1, 161, 162, -1, -1, 165, -1, 167, -1,
Dan Gohmane5febe42008-05-31 00:58:22 +00002698 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2699 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002700 -1, -1, -1, -1, -1, 36, -1, -1, -1, -1,
Dan Gohmane5febe42008-05-31 00:58:22 +00002701 -1, -1, -1, 161, 162, -1, -1, 165, -1, 167,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002702 -1, -1, -1, -1, -1, -1, 57, 58, -1, -1,
2703 -1, 161, 162, -1, -1, 165, -1, 167, 69, 70,
2704 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2705 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2706 91, 92, 93, -1, -1, -1, -1, -1, -1, -1,
Dan Gohmane5febe42008-05-31 00:58:22 +00002707 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002708 -1, -1, -1, 114, 115, 116, -1, -1, 119, 120,
2709 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
2710 131, 132, 133, 134, 135, 136, 137, 138, 139, 140
Dan Gohman54392c12008-04-19 00:24:39 +00002711};
2712
2713/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2714 symbol of state STATE-NUM. */
2715static const yytype_uint8 yystos[] =
2716{
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002717 0, 19, 20, 22, 23, 24, 30, 31, 52, 56,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00002718 60, 178, 181, 182, 183, 184, 216, 217, 218, 220,
2719 219, 53, 68, 225, 158, 59, 158, 18, 158, 42,
2720 43, 44, 45, 46, 47, 48, 49, 51, 153, 154,
2721 155, 185, 186, 187, 0, 218, 46, 48, 188, 235,
2722 42, 43, 44, 47, 189, 232, 234, 242, 158, 158,
2723 162, 226, 22, 224, 7, 8, 10, 11, 12, 13,
2724 14, 15, 16, 17, 50, 161, 162, 165, 167, 178,
2725 182, 203, 204, 238, 187, 187, 35, 37, 214, 187,
2726 187, 21, 243, 244, 29, 168, 233, 243, 22, 22,
2727 22, 227, 156, 4, 4, 4, 167, 10, 168, 204,
2728 209, 55, 156, 180, 214, 214, 42, 44, 190, 32,
2729 33, 213, 62, 63, 64, 65, 66, 67, 191, 230,
2730 230, 181, 247, 159, 164, 39, 204, 205, 207, 208,
2731 163, 163, 168, 209, 159, 168, 156, 208, 160, 213,
2732 213, 10, 125, 204, 206, 215, 11, 12, 13, 14,
2733 15, 16, 176, 177, 204, 210, 4, 206, 28, 167,
2734 231, 36, 57, 58, 69, 70, 71, 72, 73, 74,
Chris Lattnere7e9b602008-05-04 17:18:47 +00002735 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002736 85, 86, 87, 88, 89, 90, 91, 92, 93, 114,
2737 115, 116, 119, 120, 121, 122, 123, 124, 125, 126,
Nate Begeman646fa482008-05-12 19:01:56 +00002738 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
Dan Gohmane5febe42008-05-31 00:58:22 +00002739 137, 138, 139, 140, 171, 172, 173, 245, 252, 253,
2740 254, 255, 22, 193, 159, 157, 204, 204, 166, 168,
Dan Gohmane6b1ee62008-05-23 01:55:30 +00002741 204, 4, 157, 210, 204, 156, 238, 26, 27, 3,
2742 4, 5, 6, 9, 25, 40, 41, 90, 91, 92,
2743 93, 119, 133, 135, 136, 137, 139, 140, 162, 165,
2744 167, 169, 171, 172, 173, 211, 238, 180, 182, 57,
2745 10, 204, 240, 241, 11, 17, 11, 176, 191, 94,
2746 95, 96, 97, 98, 99, 100, 101, 102, 103, 174,
2747 26, 27, 100, 101, 102, 103, 104, 105, 106, 107,
2748 108, 109, 110, 111, 112, 113, 175, 174, 175, 204,
2749 204, 240, 204, 204, 248, 240, 240, 240, 240, 240,
2750 204, 204, 204, 204, 204, 240, 191, 117, 118, 54,
2751 121, 122, 141, 142, 144, 145, 147, 148, 149, 192,
2752 39, 205, 195, 164, 166, 166, 157, 195, 180, 180,
2753 215, 174, 175, 174, 175, 156, 156, 156, 156, 156,
2754 156, 156, 164, 210, 212, 167, 212, 168, 212, 22,
2755 156, 156, 156, 221, 156, 3, 4, 9, 25, 26,
Dan Gohman9fc6cb02008-06-09 14:45:02 +00002756 27, 40, 41, 59, 162, 165, 167, 169, 211, 237,
2757 238, 239, 159, 239, 239, 239, 206, 204, 204, 204,
2758 204, 159, 198, 159, 198, 239, 162, 159, 159, 159,
2759 159, 159, 159, 239, 239, 239, 239, 239, 38, 206,
2760 204, 240, 4, 141, 142, 143, 146, 150, 151, 194,
2761 222, 223, 38, 156, 156, 156, 156, 210, 210, 210,
2762 210, 210, 210, 210, 159, 164, 168, 204, 212, 166,
2763 168, 210, 210, 210, 159, 201, 39, 204, 228, 229,
2764 61, 236, 164, 212, 167, 212, 168, 212, 22, 240,
2765 159, 159, 239, 239, 239, 239, 239, 11, 54, 11,
2766 250, 239, 162, 240, 204, 240, 240, 240, 159, 159,
2767 251, 159, 159, 159, 204, 239, 239, 159, 201, 201,
2768 204, 210, 210, 210, 210, 250, 159, 159, 159, 159,
2769 251, 159, 210, 166, 168, 159, 159, 38, 34, 54,
2770 199, 202, 193, 159, 157, 22, 164, 168, 212, 166,
2771 168, 17, 17, 156, 159, 159, 159, 159, 239, 4,
2772 239, 159, 159, 239, 159, 159, 159, 4, 4, 159,
2773 204, 239, 239, 156, 159, 198, 204, 157, 159, 159,
2774 159, 159, 157, 210, 210, 210, 210, 157, 210, 166,
2775 210, 210, 204, 22, 4, 201, 178, 179, 39, 204,
2776 195, 159, 166, 168, 239, 239, 17, 204, 249, 239,
2777 239, 239, 239, 198, 198, 240, 239, 159, 240, 240,
2778 240, 4, 239, 249, 239, 210, 210, 210, 210, 159,
2779 157, 159, 159, 251, 157, 157, 157, 193, 199, 200,
2780 22, 166, 159, 162, 193, 193, 157, 159, 164, 239,
2781 251, 157, 198, 157, 157, 157, 157, 210, 210, 210,
2782 157, 179, 54, 197, 17, 164, 176, 246, 121, 122,
2783 239, 239, 195, 17, 204, 164, 195, 157, 157, 157,
2784 4, 152, 196, 239, 237, 164, 176, 193, 193, 38,
2785 193, 193, 22, 159, 237, 17, 239, 239, 17, 159,
2786 239, 193, 193, 239, 17, 73, 239, 17, 239
Dan Gohman54392c12008-04-19 00:24:39 +00002787};
David Greene9145dd22007-08-01 03:59:32 +00002788
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002789#define yyerrok (yyerrstatus = 0)
2790#define yyclearin (yychar = YYEMPTY)
Dan Gohman54392c12008-04-19 00:24:39 +00002791#define YYEMPTY (-2)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002792#define YYEOF 0
Dan Gohman54392c12008-04-19 00:24:39 +00002793
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002794#define YYACCEPT goto yyacceptlab
Dan Gohman54392c12008-04-19 00:24:39 +00002795#define YYABORT goto yyabortlab
2796#define YYERROR goto yyerrorlab
2797
2798
2799/* Like YYERROR except do call yyerror. This remains here temporarily
2800 to ease the transition to the new meaning of YYERROR, for GCC.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002801 Once GCC version 2 has supplanted version 1, this can go. */
Dan Gohman54392c12008-04-19 00:24:39 +00002802
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002803#define YYFAIL goto yyerrlab
Dan Gohman54392c12008-04-19 00:24:39 +00002804
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002805#define YYRECOVERING() (!!yyerrstatus)
Dan Gohman54392c12008-04-19 00:24:39 +00002806
2807#define YYBACKUP(Token, Value) \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002808do \
2809 if (yychar == YYEMPTY && yylen == 1) \
Dan Gohman54392c12008-04-19 00:24:39 +00002810 { \
2811 yychar = (Token); \
2812 yylval = (Value); \
2813 yytoken = YYTRANSLATE (yychar); \
2814 YYPOPSTACK (1); \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002815 goto yybackup; \
2816 } \
2817 else \
Dan Gohman54392c12008-04-19 00:24:39 +00002818 { \
2819 yyerror (YY_("syntax error: cannot back up")); \
2820 YYERROR; \
2821 } \
2822while (YYID (0))
2823
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002824
2825#define YYTERROR 1
2826#define YYERRCODE 256
2827
Dan Gohman54392c12008-04-19 00:24:39 +00002828
2829/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2830 If N is 0, then set CURRENT to the empty location which ends
2831 the previous symbol: RHS[0] (always defined). */
2832
2833#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2834#ifndef YYLLOC_DEFAULT
2835# define YYLLOC_DEFAULT(Current, Rhs, N) \
2836 do \
2837 if (YYID (N)) \
2838 { \
2839 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2840 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2841 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2842 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2843 } \
2844 else \
2845 { \
2846 (Current).first_line = (Current).last_line = \
2847 YYRHSLOC (Rhs, 0).last_line; \
2848 (Current).first_column = (Current).last_column = \
2849 YYRHSLOC (Rhs, 0).last_column; \
2850 } \
2851 while (YYID (0))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002852#endif
2853
Dan Gohman54392c12008-04-19 00:24:39 +00002854
2855/* YY_LOCATION_PRINT -- Print the location on the stream.
2856 This macro was not mandated originally: define only if we know
2857 we won't break user code: when these are the locations we know. */
2858
2859#ifndef YY_LOCATION_PRINT
Dan Gohman7185e4b2008-06-23 18:43:26 +00002860# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
Dan Gohman54392c12008-04-19 00:24:39 +00002861# define YY_LOCATION_PRINT(File, Loc) \
2862 fprintf (File, "%d.%d-%d.%d", \
2863 (Loc).first_line, (Loc).first_column, \
2864 (Loc).last_line, (Loc).last_column)
2865# else
2866# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2867# endif
2868#endif
2869
2870
2871/* YYLEX -- calling `yylex' with the right arguments. */
2872
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002873#ifdef YYLEX_PARAM
Dan Gohman54392c12008-04-19 00:24:39 +00002874# define YYLEX yylex (YYLEX_PARAM)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002875#else
Dan Gohman54392c12008-04-19 00:24:39 +00002876# define YYLEX yylex ()
Gabor Greif89f01162008-04-06 23:07:54 +00002877#endif
Dan Gohman54392c12008-04-19 00:24:39 +00002878
2879/* Enable debugging if requested. */
2880#if YYDEBUG
2881
2882# ifndef YYFPRINTF
2883# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2884# define YYFPRINTF fprintf
2885# endif
2886
2887# define YYDPRINTF(Args) \
2888do { \
2889 if (yydebug) \
2890 YYFPRINTF Args; \
2891} while (YYID (0))
2892
2893# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2894do { \
2895 if (yydebug) \
2896 { \
2897 YYFPRINTF (stderr, "%s ", Title); \
2898 yy_symbol_print (stderr, \
2899 Type, Value); \
2900 YYFPRINTF (stderr, "\n"); \
2901 } \
2902} while (YYID (0))
2903
2904
2905/*--------------------------------.
2906| Print this symbol on YYOUTPUT. |
2907`--------------------------------*/
2908
2909/*ARGSUSED*/
2910#if (defined __STDC__ || defined __C99__FUNC__ \
2911 || defined __cplusplus || defined _MSC_VER)
2912static void
2913yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
Gabor Greif89f01162008-04-06 23:07:54 +00002914#else
Dan Gohman54392c12008-04-19 00:24:39 +00002915static void
2916yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2917 FILE *yyoutput;
2918 int yytype;
2919 YYSTYPE const * const yyvaluep;
Gabor Greif89f01162008-04-06 23:07:54 +00002920#endif
Dan Gohman54392c12008-04-19 00:24:39 +00002921{
2922 if (!yyvaluep)
2923 return;
2924# ifdef YYPRINT
2925 if (yytype < YYNTOKENS)
2926 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2927# else
2928 YYUSE (yyoutput);
2929# endif
2930 switch (yytype)
2931 {
2932 default:
2933 break;
2934 }
2935}
2936
2937
2938/*--------------------------------.
2939| Print this symbol on YYOUTPUT. |
2940`--------------------------------*/
2941
2942#if (defined __STDC__ || defined __C99__FUNC__ \
2943 || defined __cplusplus || defined _MSC_VER)
2944static void
2945yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2946#else
2947static void
2948yy_symbol_print (yyoutput, yytype, yyvaluep)
2949 FILE *yyoutput;
2950 int yytype;
2951 YYSTYPE const * const yyvaluep;
Scott Michel6d1aba82008-01-30 03:10:00 +00002952#endif
Dan Gohman54392c12008-04-19 00:24:39 +00002953{
2954 if (yytype < YYNTOKENS)
2955 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2956 else
2957 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
Chris Lattner59363a32008-02-19 04:36:25 +00002958
Dan Gohman54392c12008-04-19 00:24:39 +00002959 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2960 YYFPRINTF (yyoutput, ")");
2961}
Chris Lattner59363a32008-02-19 04:36:25 +00002962
Dan Gohman54392c12008-04-19 00:24:39 +00002963/*------------------------------------------------------------------.
2964| yy_stack_print -- Print the state stack from its BOTTOM up to its |
2965| TOP (included). |
2966`------------------------------------------------------------------*/
Chris Lattner59363a32008-02-19 04:36:25 +00002967
Dan Gohman54392c12008-04-19 00:24:39 +00002968#if (defined __STDC__ || defined __C99__FUNC__ \
2969 || defined __cplusplus || defined _MSC_VER)
2970static void
2971yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
2972#else
2973static void
2974yy_stack_print (bottom, top)
2975 yytype_int16 *bottom;
2976 yytype_int16 *top;
Scott Michel6d1aba82008-01-30 03:10:00 +00002977#endif
Dan Gohman54392c12008-04-19 00:24:39 +00002978{
2979 YYFPRINTF (stderr, "Stack now");
2980 for (; bottom <= top; ++bottom)
2981 YYFPRINTF (stderr, " %d", *bottom);
2982 YYFPRINTF (stderr, "\n");
2983}
Chris Lattner59363a32008-02-19 04:36:25 +00002984
Dan Gohman54392c12008-04-19 00:24:39 +00002985# define YY_STACK_PRINT(Bottom, Top) \
2986do { \
2987 if (yydebug) \
2988 yy_stack_print ((Bottom), (Top)); \
2989} while (YYID (0))
Chris Lattner59363a32008-02-19 04:36:25 +00002990
Dan Gohman54392c12008-04-19 00:24:39 +00002991
2992/*------------------------------------------------.
2993| Report that the YYRULE is going to be reduced. |
2994`------------------------------------------------*/
2995
2996#if (defined __STDC__ || defined __C99__FUNC__ \
2997 || defined __cplusplus || defined _MSC_VER)
2998static void
2999yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
3000#else
3001static void
3002yy_reduce_print (yyvsp, yyrule)
3003 YYSTYPE *yyvsp;
3004 int yyrule;
Christopher Lamb0a243582007-12-11 09:02:08 +00003005#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003006{
3007 int yynrhs = yyr2[yyrule];
3008 int yyi;
3009 unsigned long int yylno = yyrline[yyrule];
3010 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
3011 yyrule - 1, yylno);
3012 /* The symbols being reduced. */
3013 for (yyi = 0; yyi < yynrhs; yyi++)
3014 {
3015 fprintf (stderr, " $%d = ", yyi + 1);
3016 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
3017 &(yyvsp[(yyi + 1) - (yynrhs)])
3018 );
3019 fprintf (stderr, "\n");
3020 }
3021}
Scott Michel5a6f17b2008-01-30 02:55:46 +00003022
Dan Gohman54392c12008-04-19 00:24:39 +00003023# define YY_REDUCE_PRINT(Rule) \
3024do { \
3025 if (yydebug) \
3026 yy_reduce_print (yyvsp, Rule); \
3027} while (YYID (0))
Scott Michel5a6f17b2008-01-30 02:55:46 +00003028
Dan Gohman54392c12008-04-19 00:24:39 +00003029/* Nonzero means print parse trace. It is left uninitialized so that
3030 multiple parsers can coexist. */
3031int yydebug;
3032#else /* !YYDEBUG */
3033# define YYDPRINTF(Args)
3034# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
3035# define YY_STACK_PRINT(Bottom, Top)
3036# define YY_REDUCE_PRINT(Rule)
3037#endif /* !YYDEBUG */
3038
3039
3040/* YYINITDEPTH -- initial size of the parser's stacks. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003041#ifndef YYINITDEPTH
Dan Gohman54392c12008-04-19 00:24:39 +00003042# define YYINITDEPTH 200
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003043#endif
3044
Dan Gohman54392c12008-04-19 00:24:39 +00003045/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
3046 if the built-in stack extension method is used).
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003047
Dan Gohman54392c12008-04-19 00:24:39 +00003048 Do not make this value too large; the results are undefined if
3049 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
3050 evaluated with infinite-precision integer arithmetic. */
David Greene9145dd22007-08-01 03:59:32 +00003051
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003052#ifndef YYMAXDEPTH
Dan Gohman54392c12008-04-19 00:24:39 +00003053# define YYMAXDEPTH 10000
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003054#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003055
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003056
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003057
Dan Gohman54392c12008-04-19 00:24:39 +00003058#if YYERROR_VERBOSE
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003059
Dan Gohman54392c12008-04-19 00:24:39 +00003060# ifndef yystrlen
3061# if defined __GLIBC__ && defined _STRING_H
3062# define yystrlen strlen
3063# else
3064/* Return the length of YYSTR. */
3065#if (defined __STDC__ || defined __C99__FUNC__ \
3066 || defined __cplusplus || defined _MSC_VER)
3067static YYSIZE_T
3068yystrlen (const char *yystr)
Chris Lattner59363a32008-02-19 04:36:25 +00003069#else
Dan Gohman54392c12008-04-19 00:24:39 +00003070static YYSIZE_T
3071yystrlen (yystr)
3072 const char *yystr;
3073#endif
3074{
3075 YYSIZE_T yylen;
3076 for (yylen = 0; yystr[yylen]; yylen++)
3077 continue;
3078 return yylen;
3079}
3080# endif
3081# endif
3082
3083# ifndef yystpcpy
3084# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
3085# define yystpcpy stpcpy
3086# else
3087/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
3088 YYDEST. */
3089#if (defined __STDC__ || defined __C99__FUNC__ \
3090 || defined __cplusplus || defined _MSC_VER)
3091static char *
3092yystpcpy (char *yydest, const char *yysrc)
3093#else
3094static char *
3095yystpcpy (yydest, yysrc)
3096 char *yydest;
3097 const char *yysrc;
3098#endif
3099{
3100 char *yyd = yydest;
3101 const char *yys = yysrc;
3102
3103 while ((*yyd++ = *yys++) != '\0')
3104 continue;
3105
3106 return yyd - 1;
3107}
3108# endif
3109# endif
3110
3111# ifndef yytnamerr
3112/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3113 quotes and backslashes, so that it's suitable for yyerror. The
3114 heuristic is that double-quoting is unnecessary unless the string
3115 contains an apostrophe, a comma, or backslash (other than
3116 backslash-backslash). YYSTR is taken from yytname. If YYRES is
3117 null, do not copy; instead, return the length of what the result
3118 would have been. */
3119static YYSIZE_T
3120yytnamerr (char *yyres, const char *yystr)
3121{
3122 if (*yystr == '"')
3123 {
3124 YYSIZE_T yyn = 0;
3125 char const *yyp = yystr;
3126
3127 for (;;)
3128 switch (*++yyp)
3129 {
3130 case '\'':
3131 case ',':
3132 goto do_not_strip_quotes;
3133
3134 case '\\':
3135 if (*++yyp != '\\')
3136 goto do_not_strip_quotes;
3137 /* Fall through. */
3138 default:
3139 if (yyres)
3140 yyres[yyn] = *yyp;
3141 yyn++;
3142 break;
3143
3144 case '"':
3145 if (yyres)
3146 yyres[yyn] = '\0';
3147 return yyn;
3148 }
3149 do_not_strip_quotes: ;
3150 }
3151
3152 if (! yyres)
3153 return yystrlen (yystr);
3154
3155 return yystpcpy (yyres, yystr) - yyres;
3156}
3157# endif
3158
3159/* Copy into YYRESULT an error message about the unexpected token
3160 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3161 including the terminating null byte. If YYRESULT is null, do not
3162 copy anything; just return the number of bytes that would be
3163 copied. As a special case, return 0 if an ordinary "syntax error"
3164 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3165 size calculation. */
3166static YYSIZE_T
3167yysyntax_error (char *yyresult, int yystate, int yychar)
3168{
3169 int yyn = yypact[yystate];
3170
3171 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3172 return 0;
3173 else
3174 {
3175 int yytype = YYTRANSLATE (yychar);
3176 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3177 YYSIZE_T yysize = yysize0;
3178 YYSIZE_T yysize1;
3179 int yysize_overflow = 0;
3180 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3181 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3182 int yyx;
3183
3184# if 0
3185 /* This is so xgettext sees the translatable formats that are
3186 constructed on the fly. */
3187 YY_("syntax error, unexpected %s");
3188 YY_("syntax error, unexpected %s, expecting %s");
3189 YY_("syntax error, unexpected %s, expecting %s or %s");
3190 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3191 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3192# endif
3193 char *yyfmt;
3194 char const *yyf;
3195 static char const yyunexpected[] = "syntax error, unexpected %s";
3196 static char const yyexpecting[] = ", expecting %s";
3197 static char const yyor[] = " or %s";
3198 char yyformat[sizeof yyunexpected
3199 + sizeof yyexpecting - 1
3200 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3201 * (sizeof yyor - 1))];
3202 char const *yyprefix = yyexpecting;
3203
3204 /* Start YYX at -YYN if negative to avoid negative indexes in
3205 YYCHECK. */
3206 int yyxbegin = yyn < 0 ? -yyn : 0;
3207
3208 /* Stay within bounds of both yycheck and yytname. */
3209 int yychecklim = YYLAST - yyn + 1;
3210 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3211 int yycount = 1;
3212
3213 yyarg[0] = yytname[yytype];
3214 yyfmt = yystpcpy (yyformat, yyunexpected);
3215
3216 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3217 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3218 {
3219 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3220 {
3221 yycount = 1;
3222 yysize = yysize0;
3223 yyformat[sizeof yyunexpected - 1] = '\0';
3224 break;
3225 }
3226 yyarg[yycount++] = yytname[yyx];
3227 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3228 yysize_overflow |= (yysize1 < yysize);
3229 yysize = yysize1;
3230 yyfmt = yystpcpy (yyfmt, yyprefix);
3231 yyprefix = yyor;
3232 }
3233
3234 yyf = YY_(yyformat);
3235 yysize1 = yysize + yystrlen (yyf);
3236 yysize_overflow |= (yysize1 < yysize);
3237 yysize = yysize1;
3238
3239 if (yysize_overflow)
3240 return YYSIZE_MAXIMUM;
3241
3242 if (yyresult)
3243 {
3244 /* Avoid sprintf, as that infringes on the user's name space.
3245 Don't have undefined behavior even if the translation
3246 produced a string with the wrong number of "%s"s. */
3247 char *yyp = yyresult;
3248 int yyi = 0;
3249 while ((*yyp = *yyf) != '\0')
3250 {
3251 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3252 {
3253 yyp += yytnamerr (yyp, yyarg[yyi++]);
3254 yyf += 2;
3255 }
3256 else
3257 {
3258 yyp++;
3259 yyf++;
3260 }
3261 }
3262 }
3263 return yysize;
3264 }
3265}
3266#endif /* YYERROR_VERBOSE */
3267
3268
3269/*-----------------------------------------------.
3270| Release the memory associated to this symbol. |
3271`-----------------------------------------------*/
3272
3273/*ARGSUSED*/
3274#if (defined __STDC__ || defined __C99__FUNC__ \
3275 || defined __cplusplus || defined _MSC_VER)
3276static void
3277yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3278#else
3279static void
3280yydestruct (yymsg, yytype, yyvaluep)
3281 const char *yymsg;
3282 int yytype;
3283 YYSTYPE *yyvaluep;
3284#endif
3285{
3286 YYUSE (yyvaluep);
3287
3288 if (!yymsg)
3289 yymsg = "Deleting";
3290 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3291
3292 switch (yytype)
3293 {
3294
3295 default:
3296 break;
3297 }
3298}
3299
3300
3301/* Prevent warnings from -Wmissing-prototypes. */
3302
3303#ifdef YYPARSE_PARAM
3304#if defined __STDC__ || defined __cplusplus
3305int yyparse (void *YYPARSE_PARAM);
3306#else
3307int yyparse ();
3308#endif
3309#else /* ! YYPARSE_PARAM */
3310#if defined __STDC__ || defined __cplusplus
David Greene48556392007-09-04 18:46:50 +00003311int yyparse (void);
Gabor Greif89f01162008-04-06 23:07:54 +00003312#else
Dan Gohman54392c12008-04-19 00:24:39 +00003313int yyparse ();
Scott Michel6d1aba82008-01-30 03:10:00 +00003314#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003315#endif /* ! YYPARSE_PARAM */
Scott Michel5a6f17b2008-01-30 02:55:46 +00003316
Chris Lattner59363a32008-02-19 04:36:25 +00003317
Dan Gohman54392c12008-04-19 00:24:39 +00003318
3319/* The look-ahead symbol. */
3320int yychar;
3321
3322/* The semantic value of the look-ahead symbol. */
3323YYSTYPE yylval;
3324
3325/* Number of syntax errors so far. */
3326int yynerrs;
3327
3328
3329
3330/*----------.
3331| yyparse. |
3332`----------*/
3333
3334#ifdef YYPARSE_PARAM
3335#if (defined __STDC__ || defined __C99__FUNC__ \
3336 || defined __cplusplus || defined _MSC_VER)
3337int
3338yyparse (void *YYPARSE_PARAM)
3339#else
3340int
3341yyparse (YYPARSE_PARAM)
3342 void *YYPARSE_PARAM;
3343#endif
3344#else /* ! YYPARSE_PARAM */
3345#if (defined __STDC__ || defined __C99__FUNC__ \
3346 || defined __cplusplus || defined _MSC_VER)
3347int
3348yyparse (void)
3349#else
3350int
3351yyparse ()
3352
Gabor Greif89f01162008-04-06 23:07:54 +00003353#endif
3354#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003355{
3356
3357 int yystate;
3358 int yyn;
3359 int yyresult;
3360 /* Number of tokens to shift before error messages enabled. */
3361 int yyerrstatus;
3362 /* Look-ahead token as an internal (translated) token number. */
3363 int yytoken = 0;
3364#if YYERROR_VERBOSE
3365 /* Buffer for error messages, and its allocated size. */
3366 char yymsgbuf[128];
3367 char *yymsg = yymsgbuf;
3368 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
Gabor Greif89f01162008-04-06 23:07:54 +00003369#endif
Chris Lattner59363a32008-02-19 04:36:25 +00003370
Dan Gohman54392c12008-04-19 00:24:39 +00003371 /* Three stacks and their tools:
3372 `yyss': related to states,
3373 `yyvs': related to semantic values,
3374 `yyls': related to locations.
3375
3376 Refer to the stacks thru separate pointers, to allow yyoverflow
3377 to reallocate them elsewhere. */
3378
3379 /* The state stack. */
3380 yytype_int16 yyssa[YYINITDEPTH];
3381 yytype_int16 *yyss = yyssa;
3382 yytype_int16 *yyssp;
3383
3384 /* The semantic value stack. */
3385 YYSTYPE yyvsa[YYINITDEPTH];
3386 YYSTYPE *yyvs = yyvsa;
3387 YYSTYPE *yyvsp;
3388
3389
3390
3391#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3392
3393 YYSIZE_T yystacksize = YYINITDEPTH;
3394
3395 /* The variables used to return semantic value and location from the
3396 action routines. */
3397 YYSTYPE yyval;
3398
3399
3400 /* The number of symbols on the RHS of the reduced rule.
3401 Keep to zero when no symbol should be popped. */
3402 int yylen = 0;
3403
3404 YYDPRINTF ((stderr, "Starting parse\n"));
3405
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003406 yystate = 0;
3407 yyerrstatus = 0;
3408 yynerrs = 0;
3409 yychar = YYEMPTY; /* Cause a token to be read. */
3410
3411 /* Initialize stack pointers.
3412 Waste one element of value and location stack
3413 so that they stay on the same level as the state stack.
3414 The wasted elements are never initialized. */
3415
Dan Gohman54392c12008-04-19 00:24:39 +00003416 yyssp = yyss;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003417 yyvsp = yyvs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003418
Dan Gohman54392c12008-04-19 00:24:39 +00003419 goto yysetstate;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003420
Dan Gohman54392c12008-04-19 00:24:39 +00003421/*------------------------------------------------------------.
3422| yynewstate -- Push a new state, which is found in yystate. |
3423`------------------------------------------------------------*/
3424 yynewstate:
3425 /* In all cases, when you get here, the value and location stacks
3426 have just been pushed. So pushing a state here evens the stacks. */
3427 yyssp++;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003428
Dan Gohman54392c12008-04-19 00:24:39 +00003429 yysetstate:
3430 *yyssp = yystate;
3431
3432 if (yyss + yystacksize - 1 <= yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003433 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003434 /* Get the current used size of the three stacks, in elements. */
Dan Gohman54392c12008-04-19 00:24:39 +00003435 YYSIZE_T yysize = yyssp - yyss + 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003436
3437#ifdef yyoverflow
Dan Gohman54392c12008-04-19 00:24:39 +00003438 {
3439 /* Give user a chance to reallocate the stack. Use copies of
3440 these so that the &'s don't force the real ones into
3441 memory. */
3442 YYSTYPE *yyvs1 = yyvs;
3443 yytype_int16 *yyss1 = yyss;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003444
Dan Gohman54392c12008-04-19 00:24:39 +00003445
3446 /* Each stack pointer address is followed by the size of the
3447 data in use in that stack, in bytes. This used to be a
3448 conditional around just the two extra args, but that might
3449 be undefined if yyoverflow is a macro. */
3450 yyoverflow (YY_("memory exhausted"),
3451 &yyss1, yysize * sizeof (*yyssp),
3452 &yyvs1, yysize * sizeof (*yyvsp),
3453
3454 &yystacksize);
3455
3456 yyss = yyss1;
3457 yyvs = yyvs1;
3458 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003459#else /* no yyoverflow */
Dan Gohman54392c12008-04-19 00:24:39 +00003460# ifndef YYSTACK_RELOCATE
3461 goto yyexhaustedlab;
3462# else
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003463 /* Extend the stack our own way. */
Dan Gohman54392c12008-04-19 00:24:39 +00003464 if (YYMAXDEPTH <= yystacksize)
3465 goto yyexhaustedlab;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003466 yystacksize *= 2;
Dan Gohman54392c12008-04-19 00:24:39 +00003467 if (YYMAXDEPTH < yystacksize)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003468 yystacksize = YYMAXDEPTH;
Dan Gohman54392c12008-04-19 00:24:39 +00003469
3470 {
3471 yytype_int16 *yyss1 = yyss;
3472 union yyalloc *yyptr =
3473 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3474 if (! yyptr)
3475 goto yyexhaustedlab;
3476 YYSTACK_RELOCATE (yyss);
3477 YYSTACK_RELOCATE (yyvs);
3478
3479# undef YYSTACK_RELOCATE
3480 if (yyss1 != yyssa)
3481 YYSTACK_FREE (yyss1);
3482 }
3483# endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003484#endif /* no yyoverflow */
3485
Dan Gohman54392c12008-04-19 00:24:39 +00003486 yyssp = yyss + yysize - 1;
3487 yyvsp = yyvs + yysize - 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003488
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003489
Dan Gohman54392c12008-04-19 00:24:39 +00003490 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3491 (unsigned long int) yystacksize));
3492
3493 if (yyss + yystacksize - 1 <= yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003494 YYABORT;
3495 }
3496
Dan Gohman54392c12008-04-19 00:24:39 +00003497 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003498
3499 goto yybackup;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003500
Dan Gohman54392c12008-04-19 00:24:39 +00003501/*-----------.
3502| yybackup. |
3503`-----------*/
3504yybackup:
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003505
Dan Gohman54392c12008-04-19 00:24:39 +00003506 /* Do appropriate processing given the current state. Read a
3507 look-ahead token if we need one and don't already have one. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003508
Dan Gohman54392c12008-04-19 00:24:39 +00003509 /* First try to decide what to do without reference to look-ahead token. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003510 yyn = yypact[yystate];
Dan Gohman54392c12008-04-19 00:24:39 +00003511 if (yyn == YYPACT_NINF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003512 goto yydefault;
3513
Dan Gohman54392c12008-04-19 00:24:39 +00003514 /* Not known => get a look-ahead token if don't already have one. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003515
Dan Gohman54392c12008-04-19 00:24:39 +00003516 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003517 if (yychar == YYEMPTY)
3518 {
Dan Gohman54392c12008-04-19 00:24:39 +00003519 YYDPRINTF ((stderr, "Reading a token: "));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003520 yychar = YYLEX;
3521 }
3522
Dan Gohman54392c12008-04-19 00:24:39 +00003523 if (yychar <= YYEOF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003524 {
Dan Gohman54392c12008-04-19 00:24:39 +00003525 yychar = yytoken = YYEOF;
3526 YYDPRINTF ((stderr, "Now at end of input.\n"));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003527 }
3528 else
3529 {
Dan Gohman54392c12008-04-19 00:24:39 +00003530 yytoken = YYTRANSLATE (yychar);
3531 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003532 }
3533
Dan Gohman54392c12008-04-19 00:24:39 +00003534 /* If the proper action on seeing token YYTOKEN is to reduce or to
3535 detect an error, take that action. */
3536 yyn += yytoken;
3537 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003538 goto yydefault;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003539 yyn = yytable[yyn];
Dan Gohman54392c12008-04-19 00:24:39 +00003540 if (yyn <= 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003541 {
Dan Gohman54392c12008-04-19 00:24:39 +00003542 if (yyn == 0 || yyn == YYTABLE_NINF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003543 goto yyerrlab;
3544 yyn = -yyn;
3545 goto yyreduce;
3546 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003547
3548 if (yyn == YYFINAL)
3549 YYACCEPT;
3550
Dan Gohman54392c12008-04-19 00:24:39 +00003551 /* Count tokens shifted since error; after three, turn off error
3552 status. */
3553 if (yyerrstatus)
3554 yyerrstatus--;
Dale Johannesen3afee192007-09-07 21:07:57 +00003555
Dan Gohman54392c12008-04-19 00:24:39 +00003556 /* Shift the look-ahead token. */
3557 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003558
Dan Gohman54392c12008-04-19 00:24:39 +00003559 /* Discard the shifted token unless it is eof. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003560 if (yychar != YYEOF)
3561 yychar = YYEMPTY;
3562
Gabor Greif89f01162008-04-06 23:07:54 +00003563 yystate = yyn;
Dan Gohman54392c12008-04-19 00:24:39 +00003564 *++yyvsp = yylval;
3565
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003566 goto yynewstate;
3567
Gabor Greif89f01162008-04-06 23:07:54 +00003568
Dan Gohman54392c12008-04-19 00:24:39 +00003569/*-----------------------------------------------------------.
3570| yydefault -- do the default action for the current state. |
3571`-----------------------------------------------------------*/
3572yydefault:
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003573 yyn = yydefact[yystate];
3574 if (yyn == 0)
3575 goto yyerrlab;
Dan Gohman54392c12008-04-19 00:24:39 +00003576 goto yyreduce;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003577
Dan Gohman54392c12008-04-19 00:24:39 +00003578
3579/*-----------------------------.
3580| yyreduce -- Do a reduction. |
3581`-----------------------------*/
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003582yyreduce:
Dan Gohman54392c12008-04-19 00:24:39 +00003583 /* yyn is the number of a rule to reduce with. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003584 yylen = yyr2[yyn];
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003585
Dan Gohman54392c12008-04-19 00:24:39 +00003586 /* If YYLEN is nonzero, implement the default value of the action:
3587 `$$ = $1'.
3588
3589 Otherwise, the following line sets YYVAL to garbage.
3590 This behavior is undocumented and Bison
3591 users should not rely upon it. Assigning to YYVAL
3592 unconditionally makes the parser a bit smaller, and it avoids a
3593 GCC warning that YYVAL may be used uninitialized. */
3594 yyval = yyvsp[1-yylen];
3595
3596
3597 YY_REDUCE_PRINT (yyn);
3598 switch (yyn)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003599 {
Dan Gohman54392c12008-04-19 00:24:39 +00003600 case 29:
Dan Gohmane5febe42008-05-31 00:58:22 +00003601#line 1124 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003602 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3603 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003604
Dan Gohman54392c12008-04-19 00:24:39 +00003605 case 30:
Dan Gohmane5febe42008-05-31 00:58:22 +00003606#line 1124 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003607 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3608 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003609
Dan Gohman54392c12008-04-19 00:24:39 +00003610 case 31:
Dan Gohmane5febe42008-05-31 00:58:22 +00003611#line 1125 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003612 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3613 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003614
Dan Gohman54392c12008-04-19 00:24:39 +00003615 case 32:
Dan Gohmane5febe42008-05-31 00:58:22 +00003616#line 1125 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003617 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3618 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003619
Dan Gohman54392c12008-04-19 00:24:39 +00003620 case 33:
Dan Gohmane5febe42008-05-31 00:58:22 +00003621#line 1126 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003622 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3623 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003624
Dan Gohman54392c12008-04-19 00:24:39 +00003625 case 34:
Dan Gohmane5febe42008-05-31 00:58:22 +00003626#line 1126 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003627 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3628 break;
3629
3630 case 35:
Dan Gohmane5febe42008-05-31 00:58:22 +00003631#line 1127 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003632 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3633 break;
3634
3635 case 36:
Dan Gohmane5febe42008-05-31 00:58:22 +00003636#line 1127 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003637 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3638 break;
3639
3640 case 37:
Dan Gohmane5febe42008-05-31 00:58:22 +00003641#line 1128 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003642 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3643 break;
3644
3645 case 38:
Dan Gohmane5febe42008-05-31 00:58:22 +00003646#line 1128 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003647 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3648 break;
3649
3650 case 39:
Dan Gohmane5febe42008-05-31 00:58:22 +00003651#line 1132 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003652 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3653 break;
3654
3655 case 40:
Dan Gohmane5febe42008-05-31 00:58:22 +00003656#line 1132 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003657 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3658 break;
3659
3660 case 41:
Dan Gohmane5febe42008-05-31 00:58:22 +00003661#line 1133 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003662 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3663 break;
3664
3665 case 42:
Dan Gohmane5febe42008-05-31 00:58:22 +00003666#line 1133 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003667 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3668 break;
3669
3670 case 43:
Dan Gohmane5febe42008-05-31 00:58:22 +00003671#line 1134 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003672 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3673 break;
3674
3675 case 44:
Dan Gohmane5febe42008-05-31 00:58:22 +00003676#line 1134 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003677 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3678 break;
3679
3680 case 45:
Dan Gohmane5febe42008-05-31 00:58:22 +00003681#line 1135 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003682 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3683 break;
3684
3685 case 46:
Dan Gohmane5febe42008-05-31 00:58:22 +00003686#line 1135 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003687 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3688 break;
3689
3690 case 47:
Dan Gohmane5febe42008-05-31 00:58:22 +00003691#line 1136 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003692 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3693 break;
3694
3695 case 48:
Dan Gohmane5febe42008-05-31 00:58:22 +00003696#line 1136 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003697 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3698 break;
3699
3700 case 49:
Dan Gohmane5febe42008-05-31 00:58:22 +00003701#line 1137 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003702 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3703 break;
3704
3705 case 50:
Dan Gohmane5febe42008-05-31 00:58:22 +00003706#line 1137 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003707 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3708 break;
3709
3710 case 51:
Dan Gohmane5febe42008-05-31 00:58:22 +00003711#line 1138 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003712 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3713 break;
3714
3715 case 52:
Dan Gohmane5febe42008-05-31 00:58:22 +00003716#line 1138 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003717 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3718 break;
3719
3720 case 53:
Dan Gohmane5febe42008-05-31 00:58:22 +00003721#line 1139 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003722 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3723 break;
3724
3725 case 54:
Dan Gohmane5febe42008-05-31 00:58:22 +00003726#line 1140 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003727 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3728 break;
3729
3730 case 65:
Dan Gohmane5febe42008-05-31 00:58:22 +00003731#line 1149 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003732 { (yyval.StrVal) = 0; ;}
3733 break;
3734
3735 case 66:
Dan Gohmane5febe42008-05-31 00:58:22 +00003736#line 1151 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003737 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3738 break;
3739
3740 case 67:
Dan Gohmane5febe42008-05-31 00:58:22 +00003741#line 1152 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003742 { (yyval.UIntVal)=0; ;}
3743 break;
3744
3745 case 68:
Dan Gohmane5febe42008-05-31 00:58:22 +00003746#line 1156 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003747 {
3748 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003749 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003750 ;}
3751 break;
3752
3753 case 69:
Dan Gohmane5febe42008-05-31 00:58:22 +00003754#line 1160 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003755 {
3756 (yyval.StrVal) = 0;
Christopher Lamb668d9a02007-12-12 08:45:45 +00003757 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003758 ;}
3759 break;
3760
3761 case 73:
Dan Gohmane5febe42008-05-31 00:58:22 +00003762#line 1168 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003763 {
3764 (yyval.StrVal) = 0;
Christopher Lamb668d9a02007-12-12 08:45:45 +00003765 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003766 ;}
3767 break;
3768
3769 case 74:
Dan Gohmane5febe42008-05-31 00:58:22 +00003770#line 1173 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003771 {
3772 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00003773 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003774 ;}
3775 break;
3776
3777 case 75:
Dan Gohmane5febe42008-05-31 00:58:22 +00003778#line 1179 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003779 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3780 break;
3781
3782 case 76:
Dan Gohmane5febe42008-05-31 00:58:22 +00003783#line 1180 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003784 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3785 break;
3786
3787 case 77:
Dan Gohmane5febe42008-05-31 00:58:22 +00003788#line 1181 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003789 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3790 break;
3791
3792 case 78:
Dan Gohmane5febe42008-05-31 00:58:22 +00003793#line 1182 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003794 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3795 break;
3796
3797 case 79:
Dan Gohmane5febe42008-05-31 00:58:22 +00003798#line 1183 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003799 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3800 break;
3801
3802 case 80:
Dan Gohmane5febe42008-05-31 00:58:22 +00003803#line 1184 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003804 { (yyval.Linkage) = GlobalValue::CommonLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003805 break;
3806
3807 case 81:
Dan Gohmane5febe42008-05-31 00:58:22 +00003808#line 1188 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003809 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003810 break;
3811
3812 case 82:
Dan Gohmane5febe42008-05-31 00:58:22 +00003813#line 1189 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003814 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003815 break;
3816
3817 case 83:
Dan Gohmane5febe42008-05-31 00:58:22 +00003818#line 1190 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003819 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003820 break;
3821
3822 case 84:
Dan Gohmane5febe42008-05-31 00:58:22 +00003823#line 1194 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003824 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3825 break;
3826
3827 case 85:
Dan Gohmane5febe42008-05-31 00:58:22 +00003828#line 1195 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003829 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003830 break;
3831
3832 case 86:
Dan Gohmane5febe42008-05-31 00:58:22 +00003833#line 1196 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003834 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003835 break;
3836
3837 case 87:
Dan Gohmane5febe42008-05-31 00:58:22 +00003838#line 1197 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003839 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003840 break;
3841
3842 case 88:
Dan Gohmane6b1ee62008-05-23 01:55:30 +00003843#line 1201 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003844 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3845 break;
3846
Dan Gohmane5febe42008-05-31 00:58:22 +00003847 case 89:
Dan Gohmane6b1ee62008-05-23 01:55:30 +00003848#line 1202 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane5febe42008-05-31 00:58:22 +00003849 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3850 break;
3851
3852 case 90:
3853#line 1203 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3854 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3855 break;
3856
3857 case 91:
3858#line 1207 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3859 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3860 break;
3861
3862 case 92:
3863#line 1208 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003864 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3865 break;
3866
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003867 case 93:
Dan Gohmane5febe42008-05-31 00:58:22 +00003868#line 1209 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003869 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3870 break;
3871
3872 case 94:
Dan Gohmane6b1ee62008-05-23 01:55:30 +00003873#line 1210 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003874 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3875 break;
3876
Dan Gohmane5febe42008-05-31 00:58:22 +00003877 case 95:
Dan Gohmane6b1ee62008-05-23 01:55:30 +00003878#line 1211 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane5febe42008-05-31 00:58:22 +00003879 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3880 break;
3881
3882 case 96:
3883#line 1215 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3884 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3885 break;
3886
3887 case 97:
3888#line 1216 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3889 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3890 break;
3891
3892 case 98:
3893#line 1217 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003894 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003895 break;
3896
3897 case 99:
Dan Gohmane5febe42008-05-31 00:58:22 +00003898#line 1220 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003899 { (yyval.UIntVal) = CallingConv::C; ;}
3900 break;
3901
3902 case 100:
Dan Gohmane5febe42008-05-31 00:58:22 +00003903#line 1221 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003904 { (yyval.UIntVal) = CallingConv::C; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003905 break;
3906
3907 case 101:
Dan Gohmane5febe42008-05-31 00:58:22 +00003908#line 1222 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003909 { (yyval.UIntVal) = CallingConv::Fast; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003910 break;
3911
3912 case 102:
Dan Gohmane5febe42008-05-31 00:58:22 +00003913#line 1223 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003914 { (yyval.UIntVal) = CallingConv::Cold; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003915 break;
3916
3917 case 103:
Dan Gohmane5febe42008-05-31 00:58:22 +00003918#line 1224 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003919 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003920 break;
3921
3922 case 104:
Dan Gohmane5febe42008-05-31 00:58:22 +00003923#line 1225 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003924 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3925 break;
3926
3927 case 105:
Dan Gohmane5febe42008-05-31 00:58:22 +00003928#line 1226 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003929 {
3930 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003931 GEN_ERROR("Calling conv too large");
Dan Gohman54392c12008-04-19 00:24:39 +00003932 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003933 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003934 ;}
3935 break;
3936
Dan Gohman54392c12008-04-19 00:24:39 +00003937 case 106:
Dan Gohmane5febe42008-05-31 00:58:22 +00003938#line 1233 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003939 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3940 break;
3941
3942 case 107:
Dan Gohmane5febe42008-05-31 00:58:22 +00003943#line 1234 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003944 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003945 break;
3946
3947 case 108:
Dan Gohmane5febe42008-05-31 00:58:22 +00003948#line 1235 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003949 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3950 break;
3951
3952 case 109:
Dan Gohmane5febe42008-05-31 00:58:22 +00003953#line 1236 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003954 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003955 break;
3956
3957 case 110:
Dan Gohmane5febe42008-05-31 00:58:22 +00003958#line 1237 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003959 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003960 break;
3961
3962 case 111:
Dan Gohmane5febe42008-05-31 00:58:22 +00003963#line 1238 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003964 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003965 break;
3966
3967 case 112:
Dan Gohmane5febe42008-05-31 00:58:22 +00003968#line 1239 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003969 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003970 break;
3971
3972 case 113:
Dan Gohmane5febe42008-05-31 00:58:22 +00003973#line 1240 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003974 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003975 break;
3976
3977 case 114:
Dan Gohmane5febe42008-05-31 00:58:22 +00003978#line 1241 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003979 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
3980 break;
3981
3982 case 115:
Dan Gohmane5febe42008-05-31 00:58:22 +00003983#line 1242 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003984 { (yyval.ParamAttrs) =
3985 ParamAttr::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
3986 break;
3987
Dan Gohman54392c12008-04-19 00:24:39 +00003988 case 116:
Dan Gohmane5febe42008-05-31 00:58:22 +00003989#line 1246 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003990 { (yyval.ParamAttrs) = ParamAttr::None; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003991 break;
3992
3993 case 117:
Dan Gohmane5febe42008-05-31 00:58:22 +00003994#line 1247 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003995 {
3996 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3997 ;}
3998 break;
3999
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004000 case 118:
Dan Gohmane5febe42008-05-31 00:58:22 +00004001#line 1252 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004002 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
4003 break;
4004
4005 case 119:
Dan Gohmane5febe42008-05-31 00:58:22 +00004006#line 1253 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004007 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
4008 break;
4009
4010 case 120:
Dan Gohmane5febe42008-05-31 00:58:22 +00004011#line 1254 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004012 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
4013 break;
4014
4015 case 121:
Dan Gohmane5febe42008-05-31 00:58:22 +00004016#line 1255 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004017 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
4018 break;
4019
4020 case 122:
Dan Gohmane5febe42008-05-31 00:58:22 +00004021#line 1256 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004022 { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
4023 break;
4024
4025 case 123:
Dan Gohmane5febe42008-05-31 00:58:22 +00004026#line 1257 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004027 { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
4028 break;
4029
4030 case 124:
Dan Gohmane5febe42008-05-31 00:58:22 +00004031#line 1260 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004032 { (yyval.ParamAttrs) = ParamAttr::None; ;}
4033 break;
4034
Dan Gohman54392c12008-04-19 00:24:39 +00004035 case 125:
Dan Gohmane5febe42008-05-31 00:58:22 +00004036#line 1261 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004037 {
4038 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
4039 ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004040 break;
4041
4042 case 126:
Dan Gohmane5febe42008-05-31 00:58:22 +00004043#line 1266 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004044 { (yyval.StrVal) = 0; ;}
4045 break;
4046
4047 case 127:
Dan Gohmane5febe42008-05-31 00:58:22 +00004048#line 1267 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004049 {
4050 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
4051 ;}
4052 break;
4053
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004054 case 128:
Dan Gohmane5febe42008-05-31 00:58:22 +00004055#line 1274 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004056 { (yyval.UIntVal) = 0; ;}
4057 break;
4058
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004059 case 129:
Dan Gohmane5febe42008-05-31 00:58:22 +00004060#line 1275 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004061 {
4062 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
4063 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004064 GEN_ERROR("Alignment must be a power of two");
4065 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004066;}
4067 break;
4068
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004069 case 130:
Dan Gohmane5febe42008-05-31 00:58:22 +00004070#line 1281 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004071 { (yyval.UIntVal) = 0; ;}
4072 break;
4073
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004074 case 131:
Dan Gohmane5febe42008-05-31 00:58:22 +00004075#line 1282 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004076 {
4077 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
4078 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Christopher Lamb668d9a02007-12-12 08:45:45 +00004079 GEN_ERROR("Alignment must be a power of two");
4080 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004081;}
4082 break;
4083
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004084 case 132:
Dan Gohmane5febe42008-05-31 00:58:22 +00004085#line 1291 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004086 {
4087 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
4088 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004089 GEN_ERROR("Invalid character in section name");
Dan Gohman54392c12008-04-19 00:24:39 +00004090 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004091 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004092;}
4093 break;
4094
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004095 case 133:
Dan Gohmane5febe42008-05-31 00:58:22 +00004096#line 1299 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004097 { (yyval.StrVal) = 0; ;}
4098 break;
4099
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004100 case 134:
Dan Gohmane5febe42008-05-31 00:58:22 +00004101#line 1300 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004102 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
4103 break;
4104
Dan Gohman54392c12008-04-19 00:24:39 +00004105 case 135:
Dan Gohmane5febe42008-05-31 00:58:22 +00004106#line 1305 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004107 {;}
4108 break;
4109
4110 case 136:
Dan Gohmane5febe42008-05-31 00:58:22 +00004111#line 1306 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004112 {;}
4113 break;
4114
4115 case 137:
Dan Gohmane5febe42008-05-31 00:58:22 +00004116#line 1307 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004117 {
4118 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
4119 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004120 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004121 ;}
4122 break;
4123
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004124 case 138:
Dan Gohmane5febe42008-05-31 00:58:22 +00004125#line 1312 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004126 {
4127 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004128 GEN_ERROR("Alignment must be a power of two");
Dan Gohman54392c12008-04-19 00:24:39 +00004129 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004130 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004131 ;}
4132 break;
4133
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004134 case 146:
Dan Gohmane5febe42008-05-31 00:58:22 +00004135#line 1328 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004136 {
4137 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004138 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004139 ;}
4140 break;
4141
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004142 case 147:
Dan Gohmane5febe42008-05-31 00:58:22 +00004143#line 1332 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004144 {
4145 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004146 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004147 ;}
4148 break;
4149
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004150 case 148:
Dan Gohmane5febe42008-05-31 00:58:22 +00004151#line 1336 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004152 { // Pointer type?
4153 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
Christopher Lamb668d9a02007-12-12 08:45:45 +00004154 GEN_ERROR("Cannot form a pointer to a basic block");
Dan Gohman54392c12008-04-19 00:24:39 +00004155 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4156 delete (yyvsp[(1) - (3)].TypeVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00004157 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004158 ;}
4159 break;
4160
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004161 case 149:
Dan Gohmane5febe42008-05-31 00:58:22 +00004162#line 1343 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004163 { // Named types are also simple types...
4164 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
Christopher Lamb0a243582007-12-11 09:02:08 +00004165 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004166 (yyval.TypeVal) = new PATypeHolder(tmp);
4167 ;}
4168 break;
4169
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004170 case 150:
Dan Gohmane5febe42008-05-31 00:58:22 +00004171#line 1348 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004172 { // Type UpReference
4173 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004174 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Dan Gohman54392c12008-04-19 00:24:39 +00004175 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4176 (yyval.TypeVal) = new PATypeHolder(OT);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004177 UR_OUT("New Upreference!\n");
4178 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004179 ;}
4180 break;
4181
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004182 case 151:
Dan Gohmane5febe42008-05-31 00:58:22 +00004183#line 1356 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004184 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004185 // Allow but ignore attributes on function types; this permits auto-upgrade.
4186 // FIXME: remove in LLVM 3.0.
Chris Lattner73de3c02008-04-23 05:37:08 +00004187 const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal);
4188 if (!FunctionType::isValidReturnType(RetTy))
4189 GEN_ERROR("Invalid result type for LLVM function");
4190
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004191 std::vector<const Type*> Params;
Dan Gohman54392c12008-04-19 00:24:39 +00004192 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004193 for (; I != E; ++I ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004194 const Type *Ty = I->Ty->get();
4195 Params.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004196 }
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004197
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004198 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4199 if (isVarArg) Params.pop_back();
4200
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004201 for (unsigned i = 0; i != Params.size(); ++i)
4202 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4203 GEN_ERROR("Function arguments must be value types!");
4204
4205 CHECK_FOR_ERROR
4206
Anton Korobeynikov0cdd2692007-12-03 19:17:47 +00004207 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
Dan Gohman54392c12008-04-19 00:24:39 +00004208 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4209 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4210 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004211 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004212 ;}
4213 break;
4214
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004215 case 152:
Dan Gohmane5febe42008-05-31 00:58:22 +00004216#line 1385 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004217 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004218 // Allow but ignore attributes on function types; this permits auto-upgrade.
4219 // FIXME: remove in LLVM 3.0.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004220 std::vector<const Type*> Params;
Dan Gohman54392c12008-04-19 00:24:39 +00004221 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004222 for ( ; I != E; ++I ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004223 const Type* Ty = I->Ty->get();
4224 Params.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004225 }
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004226
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004227 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4228 if (isVarArg) Params.pop_back();
4229
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004230 for (unsigned i = 0; i != Params.size(); ++i)
4231 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4232 GEN_ERROR("Function arguments must be value types!");
4233
4234 CHECK_FOR_ERROR
4235
Dan Gohman54392c12008-04-19 00:24:39 +00004236 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4237 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4238 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004239 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004240 ;}
4241 break;
4242
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004243 case 153:
Dan Gohmane5febe42008-05-31 00:58:22 +00004244#line 1410 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004245 { // Sized array type?
Dan Gohmane5febe42008-05-31 00:58:22 +00004246 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (yyvsp[(2) - (5)].UInt64Val))));
Dan Gohman54392c12008-04-19 00:24:39 +00004247 delete (yyvsp[(4) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004248 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004249 ;}
4250 break;
4251
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004252 case 154:
Dan Gohmane5febe42008-05-31 00:58:22 +00004253#line 1415 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004254 { // Vector type?
4255 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4256 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004257 GEN_ERROR("Unsigned result not equal to signed result");
4258 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4259 GEN_ERROR("Element type of a VectorType must be primitive");
Dan Gohman54392c12008-04-19 00:24:39 +00004260 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4261 delete (yyvsp[(4) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004262 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004263 ;}
4264 break;
4265
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004266 case 155:
Dan Gohmane5febe42008-05-31 00:58:22 +00004267#line 1425 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004268 { // Structure type?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004269 std::vector<const Type*> Elements;
Dan Gohman54392c12008-04-19 00:24:39 +00004270 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4271 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004272 Elements.push_back(*I);
4273
Dan Gohman54392c12008-04-19 00:24:39 +00004274 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4275 delete (yyvsp[(2) - (3)].TypeList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004276 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004277 ;}
4278 break;
4279
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004280 case 156:
Dan Gohmane5febe42008-05-31 00:58:22 +00004281#line 1435 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004282 { // Empty structure type?
4283 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004284 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004285 ;}
4286 break;
4287
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004288 case 157:
Dan Gohmane5febe42008-05-31 00:58:22 +00004289#line 1439 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004290 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004291 std::vector<const Type*> Elements;
Dan Gohman54392c12008-04-19 00:24:39 +00004292 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4293 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004294 Elements.push_back(*I);
4295
Dan Gohman54392c12008-04-19 00:24:39 +00004296 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4297 delete (yyvsp[(3) - (5)].TypeList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004298 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004299 ;}
4300 break;
4301
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004302 case 158:
Dan Gohmane5febe42008-05-31 00:58:22 +00004303#line 1449 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004304 { // Empty structure type?
4305 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004306 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004307 ;}
4308 break;
4309
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004310 case 159:
Dan Gohmane5febe42008-05-31 00:58:22 +00004311#line 1456 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004312 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004313 // Allow but ignore attributes on function types; this permits auto-upgrade.
4314 // FIXME: remove in LLVM 3.0.
Dan Gohman54392c12008-04-19 00:24:39 +00004315 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4316 (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
4317 ;}
4318 break;
4319
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004320 case 160:
Dan Gohmane5febe42008-05-31 00:58:22 +00004321#line 1465 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004322 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004323 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004324 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4325 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004326 GEN_ERROR("LLVM functions cannot return aggregate types");
Dan Gohman54392c12008-04-19 00:24:39 +00004327 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4328 ;}
4329 break;
4330
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004331 case 161:
Dan Gohmane5febe42008-05-31 00:58:22 +00004332#line 1472 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004333 {
4334 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4335 ;}
4336 break;
4337
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004338 case 162:
Dan Gohmane5febe42008-05-31 00:58:22 +00004339#line 1477 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004340 {
4341 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4342 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004343 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004344 ;}
4345 break;
4346
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004347 case 163:
Dan Gohmane5febe42008-05-31 00:58:22 +00004348#line 1482 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004349 {
4350 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004351 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004352 ;}
4353 break;
4354
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004355 case 165:
Dan Gohmane5febe42008-05-31 00:58:22 +00004356#line 1490 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004357 {
4358 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004359 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4360 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohman54392c12008-04-19 00:24:39 +00004361 (yyval.TypeWithAttrsList)->push_back(TWA);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004362 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004363 ;}
4364 break;
4365
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004366 case 166:
Dan Gohmane5febe42008-05-31 00:58:22 +00004367#line 1497 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004368 {
4369 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004370 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4371 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohman54392c12008-04-19 00:24:39 +00004372 (yyval.TypeWithAttrsList)->push_back(TWA);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004373 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004374 ;}
4375 break;
4376
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004377 case 167:
Dan Gohmane5febe42008-05-31 00:58:22 +00004378#line 1504 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004379 {
4380 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004381 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004382 ;}
4383 break;
4384
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004385 case 168:
Dan Gohmane5febe42008-05-31 00:58:22 +00004386#line 1512 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004387 {
4388 (yyval.TypeList) = new std::list<PATypeHolder>();
4389 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4390 delete (yyvsp[(1) - (1)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004391 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004392 ;}
4393 break;
4394
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004395 case 169:
Dan Gohmane5febe42008-05-31 00:58:22 +00004396#line 1518 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004397 {
4398 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4399 delete (yyvsp[(3) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004400 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004401 ;}
4402 break;
4403
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004404 case 170:
Dan Gohmane5febe42008-05-31 00:58:22 +00004405#line 1530 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004406 { // Nonempty unsized arr
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004407 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004408 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4409 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004410 if (ATy == 0)
4411 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004412 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004413 const Type *ETy = ATy->getElementType();
Dan Gohman7185e4b2008-06-23 18:43:26 +00004414 uint64_t NumElements = ATy->getNumElements();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004415
4416 // Verify that we have the correct size...
Dan Gohman54392c12008-04-19 00:24:39 +00004417 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004418 GEN_ERROR("Type mismatch: constant sized array initialized with " +
Dan Gohman54392c12008-04-19 00:24:39 +00004419 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004420 itostr(NumElements) + "");
4421
4422 // Verify all elements are correct type!
Dan Gohman54392c12008-04-19 00:24:39 +00004423 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4424 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004425 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4426 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohman54392c12008-04-19 00:24:39 +00004427 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004428 }
4429
Dan Gohman54392c12008-04-19 00:24:39 +00004430 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4431 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004432 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004433 ;}
4434 break;
4435
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004436 case 171:
Dan Gohmane5febe42008-05-31 00:58:22 +00004437#line 1558 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004438 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004439 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004440 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4441 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004442 if (ATy == 0)
4443 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004444 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004445
Dan Gohman7185e4b2008-06-23 18:43:26 +00004446 uint64_t NumElements = ATy->getNumElements();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004447 if (NumElements != -1 && NumElements != 0)
4448 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
4449 " arguments, but has size of " + itostr(NumElements) +"");
Dan Gohman54392c12008-04-19 00:24:39 +00004450 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4451 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004452 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004453 ;}
4454 break;
4455
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004456 case 172:
Dan Gohmane5febe42008-05-31 00:58:22 +00004457#line 1574 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004458 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004459 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004460 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4461 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004462 if (ATy == 0)
4463 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004464 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004465
Dan Gohman7185e4b2008-06-23 18:43:26 +00004466 uint64_t NumElements = ATy->getNumElements();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004467 const Type *ETy = ATy->getElementType();
Dan Gohman54392c12008-04-19 00:24:39 +00004468 if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004469 GEN_ERROR("Can't build string constant of size " +
Dan Gohman54392c12008-04-19 00:24:39 +00004470 itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004471 " when array has size " + itostr(NumElements) + "");
4472 std::vector<Constant*> Vals;
4473 if (ETy == Type::Int8Ty) {
Dan Gohman54392c12008-04-19 00:24:39 +00004474 for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
4475 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004476 } else {
Dan Gohman54392c12008-04-19 00:24:39 +00004477 delete (yyvsp[(3) - (3)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004478 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4479 }
Dan Gohman54392c12008-04-19 00:24:39 +00004480 delete (yyvsp[(3) - (3)].StrVal);
4481 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4482 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004483 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004484 ;}
4485 break;
4486
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004487 case 173:
Dan Gohmane5febe42008-05-31 00:58:22 +00004488#line 1601 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004489 { // Nonempty unsized arr
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004490 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004491 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4492 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004493 if (PTy == 0)
4494 GEN_ERROR("Cannot make packed constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004495 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004496 const Type *ETy = PTy->getElementType();
Dan Gohman7185e4b2008-06-23 18:43:26 +00004497 unsigned NumElements = PTy->getNumElements();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004498
4499 // Verify that we have the correct size...
Dan Gohman54392c12008-04-19 00:24:39 +00004500 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004501 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
Dan Gohman54392c12008-04-19 00:24:39 +00004502 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004503 itostr(NumElements) + "");
4504
4505 // Verify all elements are correct type!
Dan Gohman54392c12008-04-19 00:24:39 +00004506 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4507 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004508 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4509 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohman54392c12008-04-19 00:24:39 +00004510 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004511 }
4512
Dan Gohman54392c12008-04-19 00:24:39 +00004513 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4514 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004515 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004516 ;}
4517 break;
4518
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004519 case 174:
Dan Gohmane5febe42008-05-31 00:58:22 +00004520#line 1629 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004521 {
4522 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004523 if (STy == 0)
4524 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004525 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004526
Dan Gohman54392c12008-04-19 00:24:39 +00004527 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004528 GEN_ERROR("Illegal number of initializers for structure type");
4529
4530 // Check to ensure that constants are compatible with the type initializer!
Dan Gohman54392c12008-04-19 00:24:39 +00004531 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4532 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004533 GEN_ERROR("Expected type '" +
4534 STy->getElementType(i)->getDescription() +
4535 "' for element #" + utostr(i) +
4536 " of structure initializer");
4537
4538 // Check to ensure that Type is not packed
4539 if (STy->isPacked())
4540 GEN_ERROR("Unpacked Initializer to vector type '" +
4541 STy->getDescription() + "'");
4542
Dan Gohman54392c12008-04-19 00:24:39 +00004543 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4544 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004545 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004546 ;}
4547 break;
4548
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004549 case 175:
Dan Gohmane5febe42008-05-31 00:58:22 +00004550#line 1655 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004551 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004552 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004553 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4554 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004555 if (STy == 0)
4556 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004557 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004558
4559 if (STy->getNumContainedTypes() != 0)
4560 GEN_ERROR("Illegal number of initializers for structure type");
4561
4562 // Check to ensure that Type is not packed
4563 if (STy->isPacked())
4564 GEN_ERROR("Unpacked Initializer to vector type '" +
4565 STy->getDescription() + "'");
4566
Dan Gohman54392c12008-04-19 00:24:39 +00004567 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4568 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004569 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004570 ;}
4571 break;
4572
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004573 case 176:
Dan Gohmane5febe42008-05-31 00:58:22 +00004574#line 1675 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004575 {
4576 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004577 if (STy == 0)
4578 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004579 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004580
Dan Gohman54392c12008-04-19 00:24:39 +00004581 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004582 GEN_ERROR("Illegal number of initializers for structure type");
4583
4584 // Check to ensure that constants are compatible with the type initializer!
Dan Gohman54392c12008-04-19 00:24:39 +00004585 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4586 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004587 GEN_ERROR("Expected type '" +
4588 STy->getElementType(i)->getDescription() +
4589 "' for element #" + utostr(i) +
4590 " of structure initializer");
4591
4592 // Check to ensure that Type is packed
4593 if (!STy->isPacked())
4594 GEN_ERROR("Vector initializer to non-vector type '" +
4595 STy->getDescription() + "'");
4596
Dan Gohman54392c12008-04-19 00:24:39 +00004597 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4598 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004599 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004600 ;}
4601 break;
4602
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004603 case 177:
Dan Gohmane5febe42008-05-31 00:58:22 +00004604#line 1701 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004605 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004606 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004607 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4608 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004609 if (STy == 0)
4610 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004611 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004612
4613 if (STy->getNumContainedTypes() != 0)
4614 GEN_ERROR("Illegal number of initializers for structure type");
4615
4616 // Check to ensure that Type is packed
4617 if (!STy->isPacked())
4618 GEN_ERROR("Vector initializer to non-vector type '" +
4619 STy->getDescription() + "'");
4620
Dan Gohman54392c12008-04-19 00:24:39 +00004621 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4622 delete (yyvsp[(1) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004623 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004624 ;}
4625 break;
4626
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004627 case 178:
Dan Gohmane5febe42008-05-31 00:58:22 +00004628#line 1721 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004629 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004630 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004631 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4632 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004633 if (PTy == 0)
4634 GEN_ERROR("Cannot make null pointer constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004635 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004636
Dan Gohman54392c12008-04-19 00:24:39 +00004637 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4638 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004639 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004640 ;}
4641 break;
4642
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004643 case 179:
Dan Gohmane5febe42008-05-31 00:58:22 +00004644#line 1733 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004645 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004646 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004647 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4648 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4649 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004650 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004651 ;}
4652 break;
4653
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004654 case 180:
Dan Gohmane5febe42008-05-31 00:58:22 +00004655#line 1740 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004656 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004657 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004658 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4659 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004660 if (Ty == 0)
Dan Gohman54392c12008-04-19 00:24:39 +00004661 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004662
4663 // ConstExprs can exist in the body of a function, thus creating
4664 // GlobalValues whenever they refer to a variable. Because we are in
4665 // the context of a function, getExistingVal will search the functions
4666 // symbol table instead of the module symbol table for the global symbol,
4667 // which throws things all off. To get around this, we just tell
4668 // getExistingVal that we are at global scope here.
4669 //
4670 Function *SavedCurFn = CurFun.CurrentFunction;
4671 CurFun.CurrentFunction = 0;
4672
Dan Gohman54392c12008-04-19 00:24:39 +00004673 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004674 CHECK_FOR_ERROR
4675
4676 CurFun.CurrentFunction = SavedCurFn;
4677
4678 // If this is an initializer for a constant pointer, which is referencing a
4679 // (currently) undefined variable, create a stub now that shall be replaced
4680 // in the future with the right type of variable.
4681 //
4682 if (V == 0) {
4683 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4684 const PointerType *PT = cast<PointerType>(Ty);
4685
4686 // First check to see if the forward references value is already created!
4687 PerModuleInfo::GlobalRefsType::iterator I =
Dan Gohman54392c12008-04-19 00:24:39 +00004688 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004689
4690 if (I != CurModule.GlobalRefs.end()) {
4691 V = I->second; // Placeholder already exists, use it...
Dan Gohman54392c12008-04-19 00:24:39 +00004692 (yyvsp[(2) - (2)].ValIDVal).destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004693 } else {
4694 std::string Name;
Dan Gohman54392c12008-04-19 00:24:39 +00004695 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4696 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4697 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004698 GEN_ERROR("Invalid reference to global");
4699
4700 // Create the forward referenced global.
4701 GlobalValue *GV;
4702 if (const FunctionType *FTy =
4703 dyn_cast<FunctionType>(PT->getElementType())) {
Gabor Greif89f01162008-04-06 23:07:54 +00004704 GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
4705 CurModule.CurrentModule);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004706 } else {
4707 GV = new GlobalVariable(PT->getElementType(), false,
4708 GlobalValue::ExternalWeakLinkage, 0,
4709 Name, CurModule.CurrentModule);
4710 }
4711
4712 // Keep track of the fact that we have a forward ref to recycle it
Dan Gohman54392c12008-04-19 00:24:39 +00004713 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004714 V = GV;
4715 }
4716 }
4717
Dan Gohman54392c12008-04-19 00:24:39 +00004718 (yyval.ConstVal) = cast<GlobalValue>(V);
4719 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004720 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004721 ;}
4722 break;
4723
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004724 case 181:
Dan Gohmane5febe42008-05-31 00:58:22 +00004725#line 1806 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004726 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004727 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004728 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4729 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004730 GEN_ERROR("Mismatched types for constant expression: " +
Dan Gohman54392c12008-04-19 00:24:39 +00004731 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4732 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4733 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004734 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004735 ;}
4736 break;
4737
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004738 case 182:
Dan Gohmane5febe42008-05-31 00:58:22 +00004739#line 1816 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004740 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004741 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004742 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4743 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004744 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4745 GEN_ERROR("Cannot create a null initialized value of this type");
Dan Gohman54392c12008-04-19 00:24:39 +00004746 (yyval.ConstVal) = Constant::getNullValue(Ty);
4747 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004748 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004749 ;}
4750 break;
4751
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004752 case 183:
Dan Gohmane5febe42008-05-31 00:58:22 +00004753#line 1826 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004754 { // integral constants
4755 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004756 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohman54392c12008-04-19 00:24:39 +00004757 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004758 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004759 ;}
4760 break;
4761
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004762 case 184:
Dan Gohmane5febe42008-05-31 00:58:22 +00004763#line 1832 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004764 { // arbitrary precision integer constants
4765 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4766 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004767 GEN_ERROR("Constant value does not fit in type");
4768 }
Dan Gohman54392c12008-04-19 00:24:39 +00004769 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4770 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4771 delete (yyvsp[(2) - (2)].APIntVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004772 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004773 ;}
4774 break;
4775
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004776 case 185:
Dan Gohmane5febe42008-05-31 00:58:22 +00004777#line 1842 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004778 { // integral constants
4779 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004780 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohman54392c12008-04-19 00:24:39 +00004781 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004782 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004783 ;}
4784 break;
4785
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004786 case 186:
Dan Gohmane5febe42008-05-31 00:58:22 +00004787#line 1848 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004788 { // arbitrary precision integer constants
4789 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4790 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004791 GEN_ERROR("Constant value does not fit in type");
4792 }
Dan Gohman54392c12008-04-19 00:24:39 +00004793 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4794 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4795 delete (yyvsp[(2) - (2)].APIntVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004796 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004797 ;}
4798 break;
4799
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004800 case 187:
Dan Gohmane5febe42008-05-31 00:58:22 +00004801#line 1858 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004802 { // Boolean constants
Dan Gohmane5febe42008-05-31 00:58:22 +00004803 if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1)
4804 GEN_ERROR("Constant true must have type i1");
Dan Gohman54392c12008-04-19 00:24:39 +00004805 (yyval.ConstVal) = ConstantInt::getTrue();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004806 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004807 ;}
4808 break;
4809
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004810 case 188:
Dan Gohmane5febe42008-05-31 00:58:22 +00004811#line 1864 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004812 { // Boolean constants
Dan Gohmane5febe42008-05-31 00:58:22 +00004813 if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1)
4814 GEN_ERROR("Constant false must have type i1");
Dan Gohman54392c12008-04-19 00:24:39 +00004815 (yyval.ConstVal) = ConstantInt::getFalse();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004816 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004817 ;}
4818 break;
4819
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004820 case 189:
Dan Gohmane5febe42008-05-31 00:58:22 +00004821#line 1870 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004822 { // Floating point constants
4823 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004824 GEN_ERROR("Floating point constant invalid for type");
Dale Johannesen255b8fe2007-09-11 18:33:39 +00004825 // Lexer has no type info, so builds all float and double FP constants
4826 // as double. Fix this here. Long double is done right.
Dan Gohman54392c12008-04-19 00:24:39 +00004827 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4828 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
Chris Lattner05ba86e2008-04-20 00:41:19 +00004829 (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal));
Dan Gohman54392c12008-04-19 00:24:39 +00004830 delete (yyvsp[(2) - (2)].FPVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004831 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004832 ;}
4833 break;
4834
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004835 case 190:
Dan Gohmane5febe42008-05-31 00:58:22 +00004836#line 1883 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004837 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004838 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004839 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4840 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4841 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4842 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004843 GEN_ERROR("invalid cast opcode for cast from '" +
4844 Val->getType()->getDescription() + "' to '" +
4845 DestTy->getDescription() + "'");
Dan Gohman54392c12008-04-19 00:24:39 +00004846 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4847 delete (yyvsp[(5) - (6)].TypeVal);
4848 ;}
4849 break;
4850
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004851 case 191:
Dan Gohmane5febe42008-05-31 00:58:22 +00004852#line 1895 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004853 {
4854 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004855 GEN_ERROR("GetElementPtr requires a pointer operand");
4856
4857 const Type *IdxTy =
Dan Gohman8055f772008-05-15 19:50:34 +00004858 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004859 if (!IdxTy)
4860 GEN_ERROR("Index list invalid for constant getelementptr");
4861
4862 SmallVector<Constant*, 8> IdxVec;
Dan Gohman54392c12008-04-19 00:24:39 +00004863 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4864 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004865 IdxVec.push_back(C);
4866 else
4867 GEN_ERROR("Indices to constant getelementptr must be constants");
4868
Dan Gohman54392c12008-04-19 00:24:39 +00004869 delete (yyvsp[(4) - (5)].ValueList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004870
Dan Gohman54392c12008-04-19 00:24:39 +00004871 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004872 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004873 ;}
4874 break;
4875
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004876 case 192:
Dan Gohmane5febe42008-05-31 00:58:22 +00004877#line 1916 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004878 {
4879 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004880 GEN_ERROR("Select condition must be of boolean type");
Dan Gohman54392c12008-04-19 00:24:39 +00004881 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004882 GEN_ERROR("Select operand types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00004883 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004884 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004885 ;}
4886 break;
4887
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004888 case 193:
Dan Gohmane5febe42008-05-31 00:58:22 +00004889#line 1924 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004890 {
4891 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004892 GEN_ERROR("Binary operator types must match");
4893 CHECK_FOR_ERROR;
Dan Gohman54392c12008-04-19 00:24:39 +00004894 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4895 ;}
4896 break;
4897
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004898 case 194:
Dan Gohmane5febe42008-05-31 00:58:22 +00004899#line 1930 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004900 {
4901 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004902 GEN_ERROR("Logical operator types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00004903 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
4904 if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
4905 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004906 GEN_ERROR("Logical operator requires integral operands");
4907 }
Dan Gohman54392c12008-04-19 00:24:39 +00004908 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004909 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004910 ;}
4911 break;
4912
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004913 case 195:
Dan Gohmane5febe42008-05-31 00:58:22 +00004914#line 1941 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004915 {
4916 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004917 GEN_ERROR("icmp operand types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00004918 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4919 ;}
4920 break;
4921
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004922 case 196:
Dan Gohmane5febe42008-05-31 00:58:22 +00004923#line 1946 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004924 {
4925 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004926 GEN_ERROR("fcmp operand types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00004927 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4928 ;}
4929 break;
4930
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004931 case 197:
Dan Gohmane5febe42008-05-31 00:58:22 +00004932#line 1951 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00004933 {
4934 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4935 GEN_ERROR("vicmp operand types must match");
4936 (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4937 ;}
4938 break;
4939
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004940 case 198:
Dan Gohmane5febe42008-05-31 00:58:22 +00004941#line 1956 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00004942 {
4943 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4944 GEN_ERROR("vfcmp operand types must match");
4945 (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4946 ;}
4947 break;
4948
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004949 case 199:
Dan Gohmane5febe42008-05-31 00:58:22 +00004950#line 1961 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004951 {
4952 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004953 GEN_ERROR("Invalid extractelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00004954 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004955 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004956 ;}
4957 break;
4958
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004959 case 200:
Dan Gohmane5febe42008-05-31 00:58:22 +00004960#line 1967 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004961 {
4962 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004963 GEN_ERROR("Invalid insertelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00004964 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004965 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004966 ;}
4967 break;
4968
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004969 case 201:
Dan Gohmane5febe42008-05-31 00:58:22 +00004970#line 1973 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004971 {
4972 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004973 GEN_ERROR("Invalid shufflevector operands");
Dan Gohman54392c12008-04-19 00:24:39 +00004974 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004975 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004976 ;}
4977 break;
4978
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004979 case 202:
Dan Gohmane5febe42008-05-31 00:58:22 +00004980#line 1979 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00004981 {
4982 if (!isa<StructType>((yyvsp[(3) - (5)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (5)].ConstVal)->getType()))
4983 GEN_ERROR("ExtractValue requires an aggregate operand");
4984
Dan Gohmane5febe42008-05-31 00:58:22 +00004985 (yyval.ConstVal) = ConstantExpr::getExtractValue((yyvsp[(3) - (5)].ConstVal), &(*(yyvsp[(4) - (5)].ConstantList))[0], (yyvsp[(4) - (5)].ConstantList)->size());
4986 delete (yyvsp[(4) - (5)].ConstantList);
Dan Gohmane6b1ee62008-05-23 01:55:30 +00004987 CHECK_FOR_ERROR
4988 ;}
4989 break;
4990
4991 case 203:
Dan Gohmane5febe42008-05-31 00:58:22 +00004992#line 1987 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00004993 {
4994 if (!isa<StructType>((yyvsp[(3) - (7)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (7)].ConstVal)->getType()))
4995 GEN_ERROR("InsertValue requires an aggregate operand");
4996
Dan Gohmane5febe42008-05-31 00:58:22 +00004997 (yyval.ConstVal) = ConstantExpr::getInsertValue((yyvsp[(3) - (7)].ConstVal), (yyvsp[(5) - (7)].ConstVal), &(*(yyvsp[(6) - (7)].ConstantList))[0], (yyvsp[(6) - (7)].ConstantList)->size());
4998 delete (yyvsp[(6) - (7)].ConstantList);
Dan Gohmane6b1ee62008-05-23 01:55:30 +00004999 CHECK_FOR_ERROR
5000 ;}
5001 break;
5002
5003 case 204:
Dan Gohmane5febe42008-05-31 00:58:22 +00005004#line 1998 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005005 {
5006 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005007 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005008 ;}
5009 break;
5010
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005011 case 205:
Dan Gohmane5febe42008-05-31 00:58:22 +00005012#line 2002 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005013 {
5014 (yyval.ConstVector) = new std::vector<Constant*>();
5015 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005016 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005017 ;}
5018 break;
5019
Nate Begeman646fa482008-05-12 19:01:56 +00005020 case 206:
Dan Gohmane5febe42008-05-31 00:58:22 +00005021#line 2010 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005022 { (yyval.BoolVal) = false; ;}
Nate Begeman646fa482008-05-12 19:01:56 +00005023 break;
5024
5025 case 207:
Dan Gohmane5febe42008-05-31 00:58:22 +00005026#line 2010 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005027 { (yyval.BoolVal) = true; ;}
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005028 break;
5029
5030 case 208:
Dan Gohmane5febe42008-05-31 00:58:22 +00005031#line 2013 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005032 { (yyval.BoolVal) = true; ;}
5033 break;
5034
5035 case 209:
Dan Gohmane5febe42008-05-31 00:58:22 +00005036#line 2013 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005037 { (yyval.BoolVal) = false; ;}
5038 break;
5039
5040 case 210:
Dan Gohmane5febe42008-05-31 00:58:22 +00005041#line 2016 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005042 {
5043 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
5044 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
Chris Lattnerbb856a32007-08-06 21:00:46 +00005045 CHECK_FOR_ERROR
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005046 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
5047 if (!Aliasee)
5048 GEN_ERROR("Aliases can be created only to global values");
5049
Dan Gohman54392c12008-04-19 00:24:39 +00005050 (yyval.ConstVal) = Aliasee;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005051 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005052 delete (yyvsp[(1) - (2)].TypeVal);
5053 ;}
5054 break;
5055
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005056 case 211:
Dan Gohmane5febe42008-05-31 00:58:22 +00005057#line 2028 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005058 {
5059 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
5060 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
5061 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005062 GEN_ERROR("invalid cast opcode for cast from '" +
5063 Val->getType()->getDescription() + "' to '" +
5064 DestTy->getDescription() + "'");
5065
Dan Gohman54392c12008-04-19 00:24:39 +00005066 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005067 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005068 delete (yyvsp[(5) - (6)].TypeVal);
5069 ;}
5070 break;
5071
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005072 case 212:
Dan Gohmane5febe42008-05-31 00:58:22 +00005073#line 2049 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005074 {
5075 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
Dale Johannesena79ecf32008-02-20 21:15:43 +00005076 CurModule.ModuleDone();
5077 CHECK_FOR_ERROR;
Dan Gohman54392c12008-04-19 00:24:39 +00005078 ;}
5079 break;
5080
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005081 case 213:
Dan Gohmane5febe42008-05-31 00:58:22 +00005082#line 2054 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005083 {
5084 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5085 CurModule.ModuleDone();
5086 CHECK_FOR_ERROR;
5087 ;}
Dan Gohman54392c12008-04-19 00:24:39 +00005088 break;
5089
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005090 case 216:
Dan Gohmane5febe42008-05-31 00:58:22 +00005091#line 2067 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005092 { CurFun.isDeclare = false; ;}
5093 break;
5094
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005095 case 217:
Dan Gohmane5febe42008-05-31 00:58:22 +00005096#line 2067 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005097 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005098 CurFun.FunctionDone();
5099 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005100 ;}
5101 break;
5102
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005103 case 218:
Dan Gohmane5febe42008-05-31 00:58:22 +00005104#line 2071 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005105 { CurFun.isDeclare = true; ;}
5106 break;
5107
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005108 case 219:
Dan Gohmane5febe42008-05-31 00:58:22 +00005109#line 2071 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005110 {
5111 CHECK_FOR_ERROR
5112 ;}
5113 break;
5114
5115 case 220:
Dan Gohmane5febe42008-05-31 00:58:22 +00005116#line 2074 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005117 {
5118 CHECK_FOR_ERROR
5119 ;}
5120 break;
5121
5122 case 221:
Dan Gohmane5febe42008-05-31 00:58:22 +00005123#line 2077 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005124 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005125 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005126 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005127 // Eagerly resolve types. This is not an optimization, this is a
5128 // requirement that is due to the fact that we could have this:
5129 //
5130 // %list = type { %list * }
5131 // %list = type { %list * } ; repeated type decl
5132 //
5133 // If types are not resolved eagerly, then the two types will not be
5134 // determined to be the same type!
5135 //
Dan Gohman54392c12008-04-19 00:24:39 +00005136 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005137
Dan Gohman54392c12008-04-19 00:24:39 +00005138 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005139 CHECK_FOR_ERROR
5140 // If this is a named type that is not a redefinition, add it to the slot
5141 // table.
Dan Gohman54392c12008-04-19 00:24:39 +00005142 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005143 }
5144
Dan Gohman54392c12008-04-19 00:24:39 +00005145 delete (yyvsp[(3) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005146 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005147 ;}
5148 break;
Reid Spenceraa8ae282007-07-31 03:50:36 +00005149
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005150 case 222:
Dan Gohmane5febe42008-05-31 00:58:22 +00005151#line 2101 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005152 {
5153 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
5154
5155 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005156 CHECK_FOR_ERROR
5157 // If this is a named type that is not a redefinition, add it to the slot
5158 // table.
Dan Gohman54392c12008-04-19 00:24:39 +00005159 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005160 }
5161 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005162 ;}
5163 break;
5164
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005165 case 223:
Dan Gohmane5febe42008-05-31 00:58:22 +00005166#line 2113 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005167 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005168 /* "Externally Visible" Linkage */
Dan Gohman54392c12008-04-19 00:24:39 +00005169 if ((yyvsp[(5) - (6)].ConstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005170 GEN_ERROR("Global value initializer is not a constant");
Dan Gohman54392c12008-04-19 00:24:39 +00005171 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5172 (yyvsp[(2) - (6)].Visibility), (yyvsp[(4) - (6)].BoolVal), (yyvsp[(5) - (6)].ConstVal)->getType(), (yyvsp[(5) - (6)].ConstVal), (yyvsp[(3) - (6)].BoolVal), (yyvsp[(6) - (6)].UIntVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005173 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005174 ;}
5175 break;
5176
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005177 case 224:
Dan Gohmane5febe42008-05-31 00:58:22 +00005178#line 2120 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005179 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005180 CurGV = 0;
Dan Gohman54392c12008-04-19 00:24:39 +00005181 ;}
5182 break;
5183
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005184 case 225:
Dan Gohmane5febe42008-05-31 00:58:22 +00005185#line 2124 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005186 {
5187 if ((yyvsp[(6) - (7)].ConstVal) == 0)
Christopher Lamb668d9a02007-12-12 08:45:45 +00005188 GEN_ERROR("Global value initializer is not a constant");
Dan Gohman54392c12008-04-19 00:24:39 +00005189 CurGV = ParseGlobalVariable((yyvsp[(1) - (7)].StrVal), (yyvsp[(2) - (7)].Linkage), (yyvsp[(3) - (7)].Visibility), (yyvsp[(5) - (7)].BoolVal), (yyvsp[(6) - (7)].ConstVal)->getType(), (yyvsp[(6) - (7)].ConstVal), (yyvsp[(4) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
Christopher Lamb668d9a02007-12-12 08:45:45 +00005190 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005191 ;}
5192 break;
5193
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005194 case 226:
Dan Gohmane5febe42008-05-31 00:58:22 +00005195#line 2129 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005196 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005197 CurGV = 0;
Dan Gohman54392c12008-04-19 00:24:39 +00005198 ;}
5199 break;
5200
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005201 case 227:
Dan Gohmane5febe42008-05-31 00:58:22 +00005202#line 2133 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005203 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005204 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005205 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5206 CurGV = ParseGlobalVariable((yyvsp[(1) - (7)].StrVal), (yyvsp[(2) - (7)].Linkage), (yyvsp[(3) - (7)].Visibility), (yyvsp[(5) - (7)].BoolVal), *(yyvsp[(6) - (7)].TypeVal), 0, (yyvsp[(4) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
Christopher Lamb668d9a02007-12-12 08:45:45 +00005207 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005208 delete (yyvsp[(6) - (7)].TypeVal);
5209 ;}
5210 break;
5211
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005212 case 228:
Dan Gohmane5febe42008-05-31 00:58:22 +00005213#line 2139 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005214 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005215 CurGV = 0;
5216 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005217 ;}
5218 break;
5219
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005220 case 229:
Dan Gohmane5febe42008-05-31 00:58:22 +00005221#line 2143 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005222 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005223 std::string Name;
Dan Gohman54392c12008-04-19 00:24:39 +00005224 if ((yyvsp[(1) - (5)].StrVal)) {
5225 Name = *(yyvsp[(1) - (5)].StrVal);
5226 delete (yyvsp[(1) - (5)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005227 }
5228 if (Name.empty())
5229 GEN_ERROR("Alias name cannot be empty");
5230
Dan Gohman54392c12008-04-19 00:24:39 +00005231 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005232 if (Aliasee == 0)
5233 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
5234
Dan Gohman54392c12008-04-19 00:24:39 +00005235 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005236 CurModule.CurrentModule);
Dan Gohman54392c12008-04-19 00:24:39 +00005237 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005238 InsertValue(GA, CurModule.Values);
Chris Lattner5eefce32007-09-10 23:24:14 +00005239
5240
5241 // If there was a forward reference of this alias, resolve it now.
5242
5243 ValID ID;
5244 if (!Name.empty())
5245 ID = ValID::createGlobalName(Name);
5246 else
5247 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5248
5249 if (GlobalValue *FWGV =
5250 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5251 // Replace uses of the fwdref with the actual alias.
5252 FWGV->replaceAllUsesWith(GA);
5253 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5254 GV->eraseFromParent();
5255 else
5256 cast<Function>(FWGV)->eraseFromParent();
5257 }
5258 ID.destroy();
5259
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005260 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005261 ;}
5262 break;
5263
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005264 case 230:
Dan Gohmane5febe42008-05-31 00:58:22 +00005265#line 2183 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005266 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005267 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005268 ;}
5269 break;
5270
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005271 case 231:
Dan Gohmane5febe42008-05-31 00:58:22 +00005272#line 2186 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005273 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005274 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005275 ;}
5276 break;
5277
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005278 case 232:
Dan Gohmane5febe42008-05-31 00:58:22 +00005279#line 2192 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005280 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005281 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
5282 if (AsmSoFar.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005283 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005284 else
Dan Gohman54392c12008-04-19 00:24:39 +00005285 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5286 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005287 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005288;}
5289 break;
5290
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005291 case 233:
Dan Gohmane5febe42008-05-31 00:58:22 +00005292#line 2202 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005293 {
5294 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5295 delete (yyvsp[(3) - (3)].StrVal);
5296 ;}
5297 break;
5298
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005299 case 234:
Dan Gohmane5febe42008-05-31 00:58:22 +00005300#line 2206 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005301 {
5302 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5303 delete (yyvsp[(3) - (3)].StrVal);
5304 ;}
5305 break;
5306
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005307 case 236:
Dan Gohmane5febe42008-05-31 00:58:22 +00005308#line 2213 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005309 {
5310 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5311 delete (yyvsp[(3) - (3)].StrVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00005312 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005313 ;}
5314 break;
5315
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005316 case 237:
Dan Gohmane5febe42008-05-31 00:58:22 +00005317#line 2218 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005318 {
5319 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5320 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer47470022007-07-31 14:41:17 +00005321 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005322 ;}
5323 break;
5324
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005325 case 238:
Dan Gohmane5febe42008-05-31 00:58:22 +00005326#line 2223 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005327 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005328 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005329 ;}
5330 break;
5331
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005332 case 239:
Dan Gohmane5febe42008-05-31 00:58:22 +00005333#line 2232 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005334 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005335 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005336 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
Dan Gohmane5febe42008-05-31 00:58:22 +00005337 if (!(*(yyvsp[(3) - (5)].TypeVal))->isFirstClassType())
5338 GEN_ERROR("Argument types must be first-class");
Dan Gohman54392c12008-04-19 00:24:39 +00005339 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5340 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5341 (yyvsp[(1) - (5)].ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005342 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005343 ;}
5344 break;
5345
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005346 case 240:
Dan Gohmane5febe42008-05-31 00:58:22 +00005347#line 2242 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005348 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005349 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005350 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
Dan Gohmane5febe42008-05-31 00:58:22 +00005351 if (!(*(yyvsp[(1) - (3)].TypeVal))->isFirstClassType())
5352 GEN_ERROR("Argument types must be first-class");
Dan Gohman54392c12008-04-19 00:24:39 +00005353 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5354 (yyval.ArgList) = new ArgListType;
5355 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005356 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005357 ;}
5358 break;
5359
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005360 case 241:
Dan Gohmane5febe42008-05-31 00:58:22 +00005361#line 2253 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005362 {
5363 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005364 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005365 ;}
5366 break;
5367
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005368 case 242:
Dan Gohmane5febe42008-05-31 00:58:22 +00005369#line 2257 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005370 {
5371 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005372 struct ArgListEntry E;
5373 E.Ty = new PATypeHolder(Type::VoidTy);
5374 E.Name = 0;
5375 E.Attrs = ParamAttr::None;
Dan Gohman54392c12008-04-19 00:24:39 +00005376 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005377 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005378 ;}
5379 break;
5380
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005381 case 243:
Dan Gohmane5febe42008-05-31 00:58:22 +00005382#line 2266 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005383 {
5384 (yyval.ArgList) = new ArgListType;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005385 struct ArgListEntry E;
5386 E.Ty = new PATypeHolder(Type::VoidTy);
5387 E.Name = 0;
5388 E.Attrs = ParamAttr::None;
Dan Gohman54392c12008-04-19 00:24:39 +00005389 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005390 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005391 ;}
5392 break;
5393
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005394 case 244:
Dan Gohmane5febe42008-05-31 00:58:22 +00005395#line 2275 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005396 {
5397 (yyval.ArgList) = 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005398 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005399 ;}
5400 break;
5401
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005402 case 245:
Dan Gohmane5febe42008-05-31 00:58:22 +00005403#line 2281 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005404 {
5405 std::string FunctionName(*(yyvsp[(3) - (10)].StrVal));
5406 delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory!
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005407
5408 // Check the function result for abstractness if this is a define. We should
5409 // have no abstract types at this point
Dan Gohman54392c12008-04-19 00:24:39 +00005410 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal)))
5411 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005412
Chris Lattner73de3c02008-04-23 05:37:08 +00005413 if (!FunctionType::isValidReturnType(*(yyvsp[(2) - (10)].TypeVal)))
5414 GEN_ERROR("Invalid result type for LLVM function");
5415
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005416 std::vector<const Type*> ParamTypeList;
Chris Lattner1c8733e2008-03-12 17:45:29 +00005417 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohman54392c12008-04-19 00:24:39 +00005418 if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None)
5419 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(7) - (10)].ParamAttrs)));
5420 if ((yyvsp[(5) - (10)].ArgList)) { // If there are arguments...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005421 unsigned index = 1;
Dan Gohman54392c12008-04-19 00:24:39 +00005422 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); I != (yyvsp[(5) - (10)].ArgList)->end(); ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005423 const Type* Ty = I->Ty->get();
5424 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5425 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
5426 ParamTypeList.push_back(Ty);
Chris Lattner1c8733e2008-03-12 17:45:29 +00005427 if (Ty != Type::VoidTy && I->Attrs != ParamAttr::None)
5428 Attrs.push_back(ParamAttrsWithIndex::get(index, I->Attrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005429 }
5430 }
5431
5432 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5433 if (isVarArg) ParamTypeList.pop_back();
5434
Chris Lattner1c8733e2008-03-12 17:45:29 +00005435 PAListPtr PAL;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005436 if (!Attrs.empty())
Chris Lattner1c8733e2008-03-12 17:45:29 +00005437 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005438
Dan Gohman54392c12008-04-19 00:24:39 +00005439 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg);
Christopher Lambfb623c62007-12-17 01:17:35 +00005440 const PointerType *PFT = PointerType::getUnqual(FT);
Dan Gohman54392c12008-04-19 00:24:39 +00005441 delete (yyvsp[(2) - (10)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005442
5443 ValID ID;
5444 if (!FunctionName.empty()) {
5445 ID = ValID::createGlobalName((char*)FunctionName.c_str());
5446 } else {
5447 ID = ValID::createGlobalID(CurModule.Values.size());
5448 }
5449
5450 Function *Fn = 0;
5451 // See if this function was forward referenced. If so, recycle the object.
5452 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5453 // Move the function to the end of the list, from whereever it was
5454 // previously inserted.
5455 Fn = cast<Function>(FWRef);
Chris Lattner1c8733e2008-03-12 17:45:29 +00005456 assert(Fn->getParamAttrs().isEmpty() &&
5457 "Forward reference has parameter attributes!");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005458 CurModule.CurrentModule->getFunctionList().remove(Fn);
5459 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5460 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
5461 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005462 if (Fn->getFunctionType() != FT ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005463 // The existing function doesn't have the same type. This is an overload
5464 // error.
5465 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005466 } else if (Fn->getParamAttrs() != PAL) {
5467 // The existing function doesn't have the same parameter attributes.
5468 // This is an overload error.
5469 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005470 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
5471 // Neither the existing or the current function is a declaration and they
5472 // have the same name and same type. Clearly this is a redefinition.
5473 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005474 } else if (Fn->isDeclaration()) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005475 // Make sure to strip off any argument names so we can't get conflicts.
5476 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5477 AI != AE; ++AI)
5478 AI->setName("");
5479 }
5480 } else { // Not already defined?
Gabor Greif89f01162008-04-06 23:07:54 +00005481 Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5482 CurModule.CurrentModule);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005483 InsertValue(Fn, CurModule.Values);
5484 }
5485
5486 CurFun.FunctionStart(Fn);
5487
5488 if (CurFun.isDeclare) {
5489 // If we have declaration, always overwrite linkage. This will allow us to
5490 // correctly handle cases, when pointer to function is passed as argument to
5491 // another function.
5492 Fn->setLinkage(CurFun.Linkage);
5493 Fn->setVisibility(CurFun.Visibility);
5494 }
Dan Gohman54392c12008-04-19 00:24:39 +00005495 Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005496 Fn->setParamAttrs(PAL);
Dan Gohman54392c12008-04-19 00:24:39 +00005497 Fn->setAlignment((yyvsp[(9) - (10)].UIntVal));
5498 if ((yyvsp[(8) - (10)].StrVal)) {
5499 Fn->setSection(*(yyvsp[(8) - (10)].StrVal));
5500 delete (yyvsp[(8) - (10)].StrVal);
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005501 }
Dan Gohman54392c12008-04-19 00:24:39 +00005502 if ((yyvsp[(10) - (10)].StrVal)) {
5503 Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str());
5504 delete (yyvsp[(10) - (10)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005505 }
5506
5507 // Add all of the arguments we parsed to the function...
Dan Gohman54392c12008-04-19 00:24:39 +00005508 if ((yyvsp[(5) - (10)].ArgList)) { // Is null if empty...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005509 if (isVarArg) { // Nuke the last entry
Dan Gohman54392c12008-04-19 00:24:39 +00005510 assert((yyvsp[(5) - (10)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (10)].ArgList)->back().Name == 0 &&
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005511 "Not a varargs marker!");
Dan Gohman54392c12008-04-19 00:24:39 +00005512 delete (yyvsp[(5) - (10)].ArgList)->back().Ty;
5513 (yyvsp[(5) - (10)].ArgList)->pop_back(); // Delete the last entry
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005514 }
5515 Function::arg_iterator ArgIt = Fn->arg_begin();
5516 Function::arg_iterator ArgEnd = Fn->arg_end();
5517 unsigned Idx = 1;
Dan Gohman54392c12008-04-19 00:24:39 +00005518 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin();
5519 I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005520 delete I->Ty; // Delete the typeholder...
5521 setValueName(ArgIt, I->Name); // Insert arg into symtab...
5522 CHECK_FOR_ERROR
5523 InsertValue(ArgIt);
5524 Idx++;
5525 }
5526
Dan Gohman54392c12008-04-19 00:24:39 +00005527 delete (yyvsp[(5) - (10)].ArgList); // We're now done with the argument list
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005528 }
5529 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005530;}
5531 break;
5532
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005533 case 248:
Dan Gohmane5febe42008-05-31 00:58:22 +00005534#line 2411 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005535 {
5536 (yyval.FunctionVal) = CurFun.CurrentFunction;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005537
5538 // Make sure that we keep track of the linkage type even if there was a
5539 // previous "declare".
Dan Gohman54392c12008-04-19 00:24:39 +00005540 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5541 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5542;}
5543 break;
5544
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005545 case 251:
Dan Gohmane5febe42008-05-31 00:58:22 +00005546#line 2422 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005547 {
5548 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005549 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005550;}
5551 break;
5552
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005553 case 252:
Dan Gohmane5febe42008-05-31 00:58:22 +00005554#line 2427 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005555 {
5556 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5557 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5558 (yyval.FunctionVal) = CurFun.CurrentFunction;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005559 CurFun.FunctionDone();
5560 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005561 ;}
5562 break;
5563
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005564 case 253:
Dan Gohmane5febe42008-05-31 00:58:22 +00005565#line 2439 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005566 {
5567 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005568 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005569 ;}
5570 break;
5571
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005572 case 254:
Dan Gohmane5febe42008-05-31 00:58:22 +00005573#line 2443 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005574 {
5575 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005576 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005577 ;}
5578 break;
5579
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005580 case 255:
Dan Gohmane5febe42008-05-31 00:58:22 +00005581#line 2448 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005582 { // A reference to a direct constant
5583 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005584 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005585 ;}
5586 break;
5587
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005588 case 256:
Dan Gohmane5febe42008-05-31 00:58:22 +00005589#line 2452 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005590 {
5591 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005592 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005593 ;}
5594 break;
5595
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005596 case 257:
Dan Gohmane5febe42008-05-31 00:58:22 +00005597#line 2456 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005598 { // Perhaps it's an FP constant?
5599 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005600 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005601 ;}
5602 break;
5603
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005604 case 258:
Dan Gohmane5febe42008-05-31 00:58:22 +00005605#line 2460 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005606 {
5607 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005608 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005609 ;}
5610 break;
5611
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005612 case 259:
Dan Gohmane5febe42008-05-31 00:58:22 +00005613#line 2464 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005614 {
5615 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005616 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005617 ;}
5618 break;
5619
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005620 case 260:
Dan Gohmane5febe42008-05-31 00:58:22 +00005621#line 2468 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005622 {
5623 (yyval.ValIDVal) = ValID::createNull();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005624 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005625 ;}
5626 break;
5627
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005628 case 261:
Dan Gohmane5febe42008-05-31 00:58:22 +00005629#line 2472 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005630 {
5631 (yyval.ValIDVal) = ValID::createUndef();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005632 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005633 ;}
5634 break;
5635
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005636 case 262:
Dan Gohmane5febe42008-05-31 00:58:22 +00005637#line 2476 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005638 { // A vector zero constant.
5639 (yyval.ValIDVal) = ValID::createZeroInit();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005640 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005641 ;}
5642 break;
5643
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005644 case 263:
Dan Gohmane5febe42008-05-31 00:58:22 +00005645#line 2480 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005646 { // Nonempty unsized packed vector
5647 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
Dan Gohman7185e4b2008-06-23 18:43:26 +00005648 unsigned NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohmane5febe42008-05-31 00:58:22 +00005649
5650 if (!ETy->isInteger() && !ETy->isFloatingPoint())
5651 GEN_ERROR("Invalid vector element type: " + ETy->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005652
5653 VectorType* pt = VectorType::get(ETy, NumElements);
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005654 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(pt));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005655
5656 // Verify all elements are correct type!
Dan Gohman54392c12008-04-19 00:24:39 +00005657 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5658 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005659 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5660 ETy->getDescription() +"' as required!\nIt is of type '" +
Dan Gohman54392c12008-04-19 00:24:39 +00005661 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005662 }
5663
Dan Gohman54392c12008-04-19 00:24:39 +00005664 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5665 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005666 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005667 ;}
5668 break;
5669
Dan Gohmane6b1ee62008-05-23 01:55:30 +00005670 case 264:
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005671#line 2502 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5672 { // Nonempty unsized arr
5673 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
Dan Gohman7185e4b2008-06-23 18:43:26 +00005674 uint64_t NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005675
5676 if (!ETy->isFirstClassType())
5677 GEN_ERROR("Invalid array element type: " + ETy->getDescription());
5678
5679 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5680 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(ATy));
5681
5682 // Verify all elements are correct type!
5683 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5684 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
5685 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5686 ETy->getDescription() +"' as required!\nIt is of type '"+
5687 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5688 }
5689
5690 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, *(yyvsp[(2) - (3)].ConstVector)));
5691 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5692 CHECK_FOR_ERROR
5693 ;}
5694 break;
5695
5696 case 265:
5697#line 2524 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5698 {
Dan Gohman7185e4b2008-06-23 18:43:26 +00005699 // Use undef instead of an array because it's inconvenient to determine
5700 // the element type at this point, there being no elements to examine.
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005701 (yyval.ValIDVal) = ValID::createUndef();
5702 CHECK_FOR_ERROR
5703 ;}
5704 break;
5705
5706 case 266:
Dan Gohman7185e4b2008-06-23 18:43:26 +00005707#line 2530 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005708 {
Dan Gohman7185e4b2008-06-23 18:43:26 +00005709 uint64_t NumElements = (yyvsp[(2) - (2)].StrVal)->length();
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005710 const Type *ETy = Type::Int8Ty;
5711
5712 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5713
5714 std::vector<Constant*> Vals;
5715 for (unsigned i = 0; i < (yyvsp[(2) - (2)].StrVal)->length(); ++i)
5716 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(2) - (2)].StrVal))[i]));
5717 delete (yyvsp[(2) - (2)].StrVal);
5718 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, Vals));
5719 CHECK_FOR_ERROR
5720 ;}
5721 break;
5722
5723 case 267:
Dan Gohman7185e4b2008-06-23 18:43:26 +00005724#line 2543 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005725 {
5726 std::vector<const Type*> Elements((yyvsp[(2) - (3)].ConstVector)->size());
5727 for (unsigned i = 0, e = (yyvsp[(2) - (3)].ConstVector)->size(); i != e; ++i)
5728 Elements[i] = (*(yyvsp[(2) - (3)].ConstVector))[i]->getType();
5729
5730 const StructType *STy = StructType::get(Elements);
5731 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5732
5733 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(2) - (3)].ConstVector)));
5734 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5735 CHECK_FOR_ERROR
5736 ;}
5737 break;
5738
5739 case 268:
Dan Gohman7185e4b2008-06-23 18:43:26 +00005740#line 2555 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005741 {
5742 const StructType *STy = StructType::get(std::vector<const Type*>());
5743 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5744 CHECK_FOR_ERROR
5745 ;}
5746 break;
5747
5748 case 269:
Dan Gohman7185e4b2008-06-23 18:43:26 +00005749#line 2560 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005750 {
5751 std::vector<const Type*> Elements((yyvsp[(3) - (5)].ConstVector)->size());
5752 for (unsigned i = 0, e = (yyvsp[(3) - (5)].ConstVector)->size(); i != e; ++i)
5753 Elements[i] = (*(yyvsp[(3) - (5)].ConstVector))[i]->getType();
5754
5755 const StructType *STy = StructType::get(Elements, /*isPacked=*/true);
5756 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5757
5758 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(3) - (5)].ConstVector)));
5759 delete PTy; delete (yyvsp[(3) - (5)].ConstVector);
5760 CHECK_FOR_ERROR
5761 ;}
5762 break;
5763
5764 case 270:
Dan Gohman7185e4b2008-06-23 18:43:26 +00005765#line 2572 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005766 {
5767 const StructType *STy = StructType::get(std::vector<const Type*>(),
5768 /*isPacked=*/true);
5769 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5770 CHECK_FOR_ERROR
5771 ;}
5772 break;
5773
5774 case 271:
Dan Gohman7185e4b2008-06-23 18:43:26 +00005775#line 2578 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005776 {
5777 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005778 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005779 ;}
5780 break;
5781
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005782 case 272:
Dan Gohman7185e4b2008-06-23 18:43:26 +00005783#line 2582 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005784 {
5785 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5786 delete (yyvsp[(3) - (5)].StrVal);
5787 delete (yyvsp[(5) - (5)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005788 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005789 ;}
5790 break;
5791
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005792 case 273:
Dan Gohman7185e4b2008-06-23 18:43:26 +00005793#line 2592 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005794 { // Is it an integer reference...?
5795 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005796 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005797 ;}
5798 break;
5799
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005800 case 274:
Dan Gohman7185e4b2008-06-23 18:43:26 +00005801#line 2596 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005802 {
5803 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005804 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005805 ;}
5806 break;
5807
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005808 case 275:
Dan Gohman7185e4b2008-06-23 18:43:26 +00005809#line 2600 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005810 { // Is it a named reference...?
5811 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5812 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005813 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005814 ;}
5815 break;
5816
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005817 case 276:
Dan Gohman7185e4b2008-06-23 18:43:26 +00005818#line 2605 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005819 { // Is it a named reference...?
5820 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5821 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005822 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005823 ;}
5824 break;
5825
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005826 case 279:
Dan Gohman7185e4b2008-06-23 18:43:26 +00005827#line 2618 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005828 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005829 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005830 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5831 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5832 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005833 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005834 ;}
5835 break;
5836
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005837 case 280:
Dan Gohman7185e4b2008-06-23 18:43:26 +00005838#line 2627 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005839 {
5840 (yyval.ValueList) = new std::vector<Value *>();
5841 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
Devang Patelbf507402008-02-20 22:40:23 +00005842 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005843 ;}
5844 break;
5845
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005846 case 281:
Dan Gohman7185e4b2008-06-23 18:43:26 +00005847#line 2632 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005848 {
5849 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
Devang Patelbf507402008-02-20 22:40:23 +00005850 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005851 ;}
5852 break;
5853
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005854 case 282:
Dan Gohman7185e4b2008-06-23 18:43:26 +00005855#line 2637 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005856 {
5857 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005858 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005859 ;}
5860 break;
5861
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005862 case 283:
Dan Gohman7185e4b2008-06-23 18:43:26 +00005863#line 2641 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005864 { // Do not allow functions with 0 basic blocks
5865 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005866 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005867 ;}
5868 break;
5869
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005870 case 284:
Dan Gohman7185e4b2008-06-23 18:43:26 +00005871#line 2650 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005872 {
5873 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005874 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005875 InsertValue((yyvsp[(3) - (3)].TermInstVal));
5876 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
5877 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005878 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005879 ;}
5880 break;
5881
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005882 case 285:
Dan Gohman7185e4b2008-06-23 18:43:26 +00005883#line 2659 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005884 {
5885 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005886 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5887 if (CI2->getParent() == 0)
Dan Gohman54392c12008-04-19 00:24:39 +00005888 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
5889 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
5890 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005891 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005892 ;}
5893 break;
Chris Lattner59363a32008-02-19 04:36:25 +00005894
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005895 case 286:
Dan Gohman7185e4b2008-06-23 18:43:26 +00005896#line 2668 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005897 { // Empty space between instruction lists
Chris Lattnere7e9b602008-05-04 17:18:47 +00005898 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
Dan Gohman54392c12008-04-19 00:24:39 +00005899 CHECK_FOR_ERROR
5900 ;}
5901 break;
5902
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005903 case 287:
Dan Gohman7185e4b2008-06-23 18:43:26 +00005904#line 2672 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnere7e9b602008-05-04 17:18:47 +00005905 { // Labelled (named) basic block
5906 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
5907 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohman54392c12008-04-19 00:24:39 +00005908 CHECK_FOR_ERROR
Chris Lattnere7e9b602008-05-04 17:18:47 +00005909
Dan Gohman54392c12008-04-19 00:24:39 +00005910 ;}
5911 break;
5912
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005913 case 288:
Dan Gohman7185e4b2008-06-23 18:43:26 +00005914#line 2680 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005915 { // Return with a result...
5916 ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
5917 assert(!VL.empty() && "Invalid ret operands!");
5918 (yyval.TermInstVal) = ReturnInst::Create(&VL[0], VL.size());
5919 delete (yyvsp[(2) - (2)].ValueList);
5920 CHECK_FOR_ERROR
5921 ;}
5922 break;
5923
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005924 case 289:
Dan Gohman7185e4b2008-06-23 18:43:26 +00005925#line 2687 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005926 { // Return with no result...
5927 (yyval.TermInstVal) = ReturnInst::Create();
5928 CHECK_FOR_ERROR
5929 ;}
5930 break;
5931
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005932 case 290:
Dan Gohman7185e4b2008-06-23 18:43:26 +00005933#line 2691 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005934 { // Unconditional Branch...
5935 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
5936 CHECK_FOR_ERROR
5937 (yyval.TermInstVal) = BranchInst::Create(tmpBB);
5938 ;}
5939 break;
5940
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005941 case 291:
Dan Gohman7185e4b2008-06-23 18:43:26 +00005942#line 2696 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005943 {
Dan Gohmane5febe42008-05-31 00:58:22 +00005944 if (cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() != 1)
5945 GEN_ERROR("Branch condition must have type i1");
Dan Gohman54392c12008-04-19 00:24:39 +00005946 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5947 CHECK_FOR_ERROR
5948 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
5949 CHECK_FOR_ERROR
5950 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
5951 CHECK_FOR_ERROR
5952 (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal);
5953 ;}
5954 break;
5955
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005956 case 292:
Dan Gohman7185e4b2008-06-23 18:43:26 +00005957#line 2707 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005958 {
5959 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
5960 CHECK_FOR_ERROR
5961 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5962 CHECK_FOR_ERROR
5963 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
5964 (yyval.TermInstVal) = S;
5965
5966 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
5967 E = (yyvsp[(8) - (9)].JumpTable)->end();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005968 for (; I != E; ++I) {
5969 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5970 S->addCase(CI, I->second);
5971 else
5972 GEN_ERROR("Switch case is constant, but not a simple integer");
5973 }
Dan Gohman54392c12008-04-19 00:24:39 +00005974 delete (yyvsp[(8) - (9)].JumpTable);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005975 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005976 ;}
5977 break;
5978
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005979 case 293:
Dan Gohman7185e4b2008-06-23 18:43:26 +00005980#line 2726 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005981 {
5982 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005983 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005984 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005985 CHECK_FOR_ERROR
Gabor Greif89f01162008-04-06 23:07:54 +00005986 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0);
Dan Gohman54392c12008-04-19 00:24:39 +00005987 (yyval.TermInstVal) = S;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005988 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005989 ;}
5990 break;
5991
Dan Gohman9fc6cb02008-06-09 14:45:02 +00005992 case 294:
Dan Gohman7185e4b2008-06-23 18:43:26 +00005993#line 2736 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005994 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005995
5996 // Handle the short syntax
5997 const PointerType *PFTy = 0;
5998 const FunctionType *Ty = 0;
Dan Gohman54392c12008-04-19 00:24:39 +00005999 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006000 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6001 // Pull out the types of all of the arguments...
6002 std::vector<const Type*> ParamTypes;
Dan Gohman54392c12008-04-19 00:24:39 +00006003 ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006004 for (; I != E; ++I) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006005 const Type *Ty = I->Val->getType();
6006 if (Ty == Type::VoidTy)
6007 GEN_ERROR("Short call syntax cannot be used with varargs");
6008 ParamTypes.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006009 }
Chris Lattner73de3c02008-04-23 05:37:08 +00006010
6011 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (14)].TypeVal)))
6012 GEN_ERROR("Invalid result type for LLVM function");
6013
Dan Gohman54392c12008-04-19 00:24:39 +00006014 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
Christopher Lambfb623c62007-12-17 01:17:35 +00006015 PFTy = PointerType::getUnqual(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006016 }
6017
Dan Gohman54392c12008-04-19 00:24:39 +00006018 delete (yyvsp[(3) - (14)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006019
Dan Gohman54392c12008-04-19 00:24:39 +00006020 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006021 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006022 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006023 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006024 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006025 CHECK_FOR_ERROR
6026
Chris Lattner1c8733e2008-03-12 17:45:29 +00006027 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohman54392c12008-04-19 00:24:39 +00006028 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None)
6029 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (14)].ParamAttrs)));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006030
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006031 // Check the arguments
6032 ValueList Args;
Dan Gohman54392c12008-04-19 00:24:39 +00006033 if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006034 // Make sure no arguments is a good thing!
6035 if (Ty->getNumParams() != 0)
6036 GEN_ERROR("No arguments passed to a function that "
6037 "expects arguments");
6038 } else { // Has arguments?
6039 // Loop through FunctionType's arguments and ensure they are specified
6040 // correctly!
6041 FunctionType::param_iterator I = Ty->param_begin();
6042 FunctionType::param_iterator E = Ty->param_end();
Dan Gohman54392c12008-04-19 00:24:39 +00006043 ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006044 unsigned index = 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006045
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006046 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006047 if (ArgI->Val->getType() != *I)
6048 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6049 (*I)->getDescription() + "'");
6050 Args.push_back(ArgI->Val);
Chris Lattner1c8733e2008-03-12 17:45:29 +00006051 if (ArgI->Attrs != ParamAttr::None)
6052 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006053 }
6054
6055 if (Ty->isVarArg()) {
6056 if (I == E)
Chris Lattner59363a32008-02-19 04:36:25 +00006057 for (; ArgI != ArgE; ++ArgI, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006058 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner1c8733e2008-03-12 17:45:29 +00006059 if (ArgI->Attrs != ParamAttr::None)
6060 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Chris Lattner59363a32008-02-19 04:36:25 +00006061 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006062 } else if (I != E || ArgI != ArgE)
6063 GEN_ERROR("Invalid number of parameters detected");
6064 }
6065
Chris Lattner1c8733e2008-03-12 17:45:29 +00006066 PAListPtr PAL;
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006067 if (!Attrs.empty())
Chris Lattner1c8733e2008-03-12 17:45:29 +00006068 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006069
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006070 // Create the InvokeInst
Dan Gohman8055f772008-05-15 19:50:34 +00006071 InvokeInst *II = InvokeInst::Create(V, Normal, Except,
6072 Args.begin(), Args.end());
Dan Gohman54392c12008-04-19 00:24:39 +00006073 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006074 II->setParamAttrs(PAL);
Dan Gohman54392c12008-04-19 00:24:39 +00006075 (yyval.TermInstVal) = II;
6076 delete (yyvsp[(6) - (14)].ParamList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006077 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006078 ;}
6079 break;
6080
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006081 case 295:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006082#line 2821 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006083 {
6084 (yyval.TermInstVal) = new UnwindInst();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006085 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006086 ;}
6087 break;
6088
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006089 case 296:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006090#line 2825 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006091 {
6092 (yyval.TermInstVal) = new UnreachableInst();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006093 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006094 ;}
6095 break;
6096
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006097 case 297:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006098#line 2832 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006099 {
6100 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
6101 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006102 CHECK_FOR_ERROR
6103 if (V == 0)
6104 GEN_ERROR("May only switch on a constant pool value");
6105
Dan Gohman54392c12008-04-19 00:24:39 +00006106 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006107 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006108 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
6109 ;}
6110 break;
6111
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006112 case 298:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006113#line 2843 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006114 {
6115 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
6116 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006117 CHECK_FOR_ERROR
6118
6119 if (V == 0)
6120 GEN_ERROR("May only switch on a constant pool value");
6121
Dan Gohman54392c12008-04-19 00:24:39 +00006122 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006123 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006124 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
6125 ;}
6126 break;
6127
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006128 case 299:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006129#line 2856 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006130 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006131 // Is this definition named?? if so, assign the name...
Dan Gohman54392c12008-04-19 00:24:39 +00006132 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006133 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006134 InsertValue((yyvsp[(2) - (2)].InstVal));
6135 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006136 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006137 ;}
6138 break;
6139
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006140 case 300:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006141#line 2866 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006142 { // Used for PHI nodes
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006143 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006144 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
6145 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
6146 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006147 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006148 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006149 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006150 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6151 delete (yyvsp[(1) - (6)].TypeVal);
6152 ;}
6153 break;
6154
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006155 case 301:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006156#line 2877 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006157 {
6158 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
6159 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006160 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006161 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006162 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006163 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6164 ;}
6165 break;
6166
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006167 case 302:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006168#line 2887 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006169 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006170 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006171 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006172 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006173 // Used for call and invoke instructions
Dan Gohman54392c12008-04-19 00:24:39 +00006174 (yyval.ParamList) = new ParamList();
6175 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
6176 (yyval.ParamList)->push_back(E);
6177 delete (yyvsp[(1) - (4)].TypeVal);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006178 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006179 ;}
6180 break;
6181
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006182 case 303:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006183#line 2898 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006184 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006185 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dale Johannesencfb19e62007-11-05 21:20:28 +00006186 // Labels are only valid in ASMs
Dan Gohman54392c12008-04-19 00:24:39 +00006187 (yyval.ParamList) = new ParamList();
6188 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
6189 (yyval.ParamList)->push_back(E);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006190 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006191 ;}
6192 break;
6193
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006194 case 304:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006195#line 2906 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006196 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006197 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006198 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006199 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6200 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
6201 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
6202 (yyval.ParamList)->push_back(E);
6203 delete (yyvsp[(3) - (6)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006204 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006205 ;}
6206 break;
6207
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006208 case 305:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006209#line 2916 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006210 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006211 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dan Gohman54392c12008-04-19 00:24:39 +00006212 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
6213 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
6214 (yyval.ParamList)->push_back(E);
Dale Johannesencfb19e62007-11-05 21:20:28 +00006215 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006216 ;}
6217 break;
6218
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006219 case 306:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006220#line 2923 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006221 { (yyval.ParamList) = new ParamList(); ;}
6222 break;
6223
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006224 case 307:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006225#line 2926 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006226 { (yyval.ValueList) = new std::vector<Value*>(); ;}
6227 break;
6228
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006229 case 308:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006230#line 2927 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006231 {
6232 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
6233 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006234 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006235 ;}
6236 break;
6237
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006238 case 309:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006239#line 2935 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane5febe42008-05-31 00:58:22 +00006240 {
6241 (yyval.ConstantList) = new std::vector<unsigned>();
6242 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
6243 GEN_ERROR("Index " + utostr((yyvsp[(2) - (2)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6244 (yyval.ConstantList)->push_back((yyvsp[(2) - (2)].UInt64Val));
6245 ;}
6246 break;
6247
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006248 case 310:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006249#line 2941 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane5febe42008-05-31 00:58:22 +00006250 {
6251 (yyval.ConstantList) = (yyvsp[(1) - (3)].ConstantList);
6252 if ((unsigned)(yyvsp[(3) - (3)].UInt64Val) != (yyvsp[(3) - (3)].UInt64Val))
6253 GEN_ERROR("Index " + utostr((yyvsp[(3) - (3)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6254 (yyval.ConstantList)->push_back((yyvsp[(3) - (3)].UInt64Val));
6255 CHECK_FOR_ERROR
6256 ;}
6257 break;
6258
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006259 case 311:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006260#line 2950 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006261 {
6262 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006263 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006264 ;}
6265 break;
6266
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006267 case 312:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006268#line 2954 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006269 {
6270 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006271 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006272 ;}
6273 break;
6274
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006275 case 313:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006276#line 2959 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006277 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006278 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006279 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6280 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
6281 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006282 GEN_ERROR(
6283 "Arithmetic operator requires integer, FP, or packed operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006284 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006285 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006286 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006287 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006288 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
Dan Gohman54392c12008-04-19 00:24:39 +00006289 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006290 GEN_ERROR("binary operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006291 delete (yyvsp[(2) - (5)].TypeVal);
6292 ;}
6293 break;
6294
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006295 case 314:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006296#line 2975 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006297 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006298 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006299 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6300 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
6301 if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
6302 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006303 GEN_ERROR("Logical operator requires integral operands");
6304 }
Dan Gohman54392c12008-04-19 00:24:39 +00006305 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006306 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006307 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006308 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006309 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
Dan Gohman54392c12008-04-19 00:24:39 +00006310 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006311 GEN_ERROR("binary operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006312 delete (yyvsp[(2) - (5)].TypeVal);
6313 ;}
6314 break;
6315
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006316 case 315:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006317#line 2992 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006318 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006319 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006320 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6321 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006322 GEN_ERROR("Vector types not supported by icmp instruction");
Dan Gohman54392c12008-04-19 00:24:39 +00006323 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006324 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006325 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006326 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006327 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Dan Gohman54392c12008-04-19 00:24:39 +00006328 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006329 GEN_ERROR("icmp operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006330 delete (yyvsp[(3) - (6)].TypeVal);
6331 ;}
6332 break;
6333
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006334 case 316:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006335#line 3006 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006336 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006337 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006338 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6339 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006340 GEN_ERROR("Vector types not supported by fcmp instruction");
Dan Gohman54392c12008-04-19 00:24:39 +00006341 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006342 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006343 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006344 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006345 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Dan Gohman54392c12008-04-19 00:24:39 +00006346 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006347 GEN_ERROR("fcmp operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006348 delete (yyvsp[(3) - (6)].TypeVal);
6349 ;}
6350 break;
6351
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006352 case 317:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006353#line 3020 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00006354 {
6355 if (!UpRefs.empty())
6356 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6357 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6358 GEN_ERROR("Scalar types not supported by vicmp instruction");
6359 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6360 CHECK_FOR_ERROR
6361 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6362 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006363 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Nate Begeman646fa482008-05-12 19:01:56 +00006364 if ((yyval.InstVal) == 0)
6365 GEN_ERROR("icmp operator returned null");
6366 delete (yyvsp[(3) - (6)].TypeVal);
6367 ;}
6368 break;
6369
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006370 case 318:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006371#line 3034 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00006372 {
6373 if (!UpRefs.empty())
6374 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6375 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6376 GEN_ERROR("Scalar types not supported by vfcmp instruction");
6377 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6378 CHECK_FOR_ERROR
6379 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6380 CHECK_FOR_ERROR
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006381 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Nate Begeman646fa482008-05-12 19:01:56 +00006382 if ((yyval.InstVal) == 0)
6383 GEN_ERROR("fcmp operator returned null");
6384 delete (yyvsp[(3) - (6)].TypeVal);
6385 ;}
6386 break;
6387
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006388 case 319:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006389#line 3048 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006390 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006391 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006392 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6393 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6394 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6395 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006396 GEN_ERROR("invalid cast opcode for cast from '" +
6397 Val->getType()->getDescription() + "' to '" +
6398 DestTy->getDescription() + "'");
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006399 (yyval.InstVal) = CastInst::Create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
Dan Gohman54392c12008-04-19 00:24:39 +00006400 delete (yyvsp[(4) - (4)].TypeVal);
6401 ;}
6402 break;
6403
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006404 case 320:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006405#line 3060 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006406 {
6407 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006408 GEN_ERROR("select condition must be boolean");
Dan Gohman54392c12008-04-19 00:24:39 +00006409 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006410 GEN_ERROR("select value types should match");
Dan Gohman54392c12008-04-19 00:24:39 +00006411 (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006412 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006413 ;}
6414 break;
6415
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006416 case 321:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006417#line 3068 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006418 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006419 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006420 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6421 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6422 delete (yyvsp[(4) - (4)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006423 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006424 ;}
6425 break;
6426
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006427 case 322:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006428#line 3075 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006429 {
6430 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006431 GEN_ERROR("Invalid extractelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006432 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006433 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006434 ;}
6435 break;
6436
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006437 case 323:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006438#line 3081 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006439 {
6440 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006441 GEN_ERROR("Invalid insertelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006442 (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006443 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006444 ;}
6445 break;
6446
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006447 case 324:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006448#line 3087 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006449 {
6450 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006451 GEN_ERROR("Invalid shufflevector operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006452 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006453 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006454 ;}
6455 break;
6456
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006457 case 325:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006458#line 3093 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006459 {
6460 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006461 if (!Ty->isFirstClassType())
6462 GEN_ERROR("PHI node operands must be of first class type");
Dan Gohman54392c12008-04-19 00:24:39 +00006463 (yyval.InstVal) = PHINode::Create(Ty);
6464 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6465 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6466 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006467 GEN_ERROR("All elements of a PHI node must be of the same type");
Dan Gohman54392c12008-04-19 00:24:39 +00006468 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6469 (yyvsp[(2) - (2)].PHIList)->pop_front();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006470 }
Dan Gohman54392c12008-04-19 00:24:39 +00006471 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006472 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006473 ;}
6474 break;
6475
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006476 case 326:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006477#line 3109 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006478 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006479
6480 // Handle the short syntax
6481 const PointerType *PFTy = 0;
6482 const FunctionType *Ty = 0;
Dan Gohman54392c12008-04-19 00:24:39 +00006483 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006484 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6485 // Pull out the types of all of the arguments...
6486 std::vector<const Type*> ParamTypes;
Dan Gohman54392c12008-04-19 00:24:39 +00006487 ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006488 for (; I != E; ++I) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006489 const Type *Ty = I->Val->getType();
6490 if (Ty == Type::VoidTy)
6491 GEN_ERROR("Short call syntax cannot be used with varargs");
6492 ParamTypes.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006493 }
Chris Lattner73de3c02008-04-23 05:37:08 +00006494
6495 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (8)].TypeVal)))
6496 GEN_ERROR("Invalid result type for LLVM function");
6497
Dan Gohman54392c12008-04-19 00:24:39 +00006498 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
Christopher Lambfb623c62007-12-17 01:17:35 +00006499 PFTy = PointerType::getUnqual(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006500 }
6501
Dan Gohman54392c12008-04-19 00:24:39 +00006502 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006503 CHECK_FOR_ERROR
6504
6505 // Check for call to invalid intrinsic to avoid crashing later.
6506 if (Function *theF = dyn_cast<Function>(V)) {
6507 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
6508 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6509 !theF->getIntrinsicID(true))
6510 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6511 theF->getName() + "'");
6512 }
6513
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006514 // Set up the ParamAttrs for the function
Chris Lattner1c8733e2008-03-12 17:45:29 +00006515 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohman54392c12008-04-19 00:24:39 +00006516 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None)
6517 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (8)].ParamAttrs)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006518 // Check the arguments
6519 ValueList Args;
Dan Gohman54392c12008-04-19 00:24:39 +00006520 if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006521 // Make sure no arguments is a good thing!
6522 if (Ty->getNumParams() != 0)
6523 GEN_ERROR("No arguments passed to a function that "
6524 "expects arguments");
6525 } else { // Has arguments?
6526 // Loop through FunctionType's arguments and ensure they are specified
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006527 // correctly. Also, gather any parameter attributes.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006528 FunctionType::param_iterator I = Ty->param_begin();
6529 FunctionType::param_iterator E = Ty->param_end();
Dan Gohman54392c12008-04-19 00:24:39 +00006530 ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006531 unsigned index = 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006532
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006533 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006534 if (ArgI->Val->getType() != *I)
6535 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6536 (*I)->getDescription() + "'");
6537 Args.push_back(ArgI->Val);
Chris Lattner1c8733e2008-03-12 17:45:29 +00006538 if (ArgI->Attrs != ParamAttr::None)
6539 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006540 }
6541 if (Ty->isVarArg()) {
6542 if (I == E)
Chris Lattner59363a32008-02-19 04:36:25 +00006543 for (; ArgI != ArgE; ++ArgI, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006544 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner1c8733e2008-03-12 17:45:29 +00006545 if (ArgI->Attrs != ParamAttr::None)
6546 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Chris Lattner59363a32008-02-19 04:36:25 +00006547 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006548 } else if (I != E || ArgI != ArgE)
6549 GEN_ERROR("Invalid number of parameters detected");
6550 }
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006551
6552 // Finish off the ParamAttrs and check them
Chris Lattner1c8733e2008-03-12 17:45:29 +00006553 PAListPtr PAL;
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006554 if (!Attrs.empty())
Chris Lattner1c8733e2008-03-12 17:45:29 +00006555 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006556
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006557 // Create the call node
Gabor Greif89f01162008-04-06 23:07:54 +00006558 CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
Dan Gohman54392c12008-04-19 00:24:39 +00006559 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6560 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006561 CI->setParamAttrs(PAL);
Dan Gohman54392c12008-04-19 00:24:39 +00006562 (yyval.InstVal) = CI;
6563 delete (yyvsp[(6) - (8)].ParamList);
6564 delete (yyvsp[(3) - (8)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006565 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006566 ;}
6567 break;
6568
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006569 case 327:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006570#line 3198 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006571 {
6572 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006573 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006574 ;}
6575 break;
6576
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006577 case 328:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006578#line 3203 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006579 {
6580 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006581 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006582 ;}
6583 break;
6584
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006585 case 329:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006586#line 3207 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006587 {
6588 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006589 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006590 ;}
6591 break;
6592
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006593 case 330:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006594#line 3214 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006595 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006596 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006597 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6598 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6599 delete (yyvsp[(2) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006600 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006601 ;}
6602 break;
6603
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006604 case 331:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006605#line 3221 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006606 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006607 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006608 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohmane5febe42008-05-31 00:58:22 +00006609 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6610 GEN_ERROR("Malloc array size is not a 32-bit integer!");
Dan Gohman54392c12008-04-19 00:24:39 +00006611 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006612 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006613 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6614 delete (yyvsp[(2) - (6)].TypeVal);
6615 ;}
6616 break;
6617
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006618 case 332:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006619#line 3231 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006620 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006621 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006622 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6623 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6624 delete (yyvsp[(2) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006625 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006626 ;}
6627 break;
6628
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006629 case 333:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006630#line 3238 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006631 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006632 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006633 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohmane5febe42008-05-31 00:58:22 +00006634 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6635 GEN_ERROR("Alloca array size is not a 32-bit integer!");
Dan Gohman54392c12008-04-19 00:24:39 +00006636 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006637 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006638 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6639 delete (yyvsp[(2) - (6)].TypeVal);
6640 ;}
6641 break;
6642
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006643 case 334:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006644#line 3248 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006645 {
6646 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006647 GEN_ERROR("Trying to free nonpointer type " +
Dan Gohman54392c12008-04-19 00:24:39 +00006648 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6649 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006650 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006651 ;}
6652 break;
6653
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006654 case 335:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006655#line 3256 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006656 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006657 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006658 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6659 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006660 GEN_ERROR("Can't load from nonpointer type: " +
Dan Gohman54392c12008-04-19 00:24:39 +00006661 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6662 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006663 GEN_ERROR("Can't load from pointer of non-first-class type: " +
Dan Gohman54392c12008-04-19 00:24:39 +00006664 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6665 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006666 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006667 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6668 delete (yyvsp[(3) - (5)].TypeVal);
6669 ;}
6670 break;
6671
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006672 case 336:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006673#line 3270 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006674 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006675 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006676 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6677 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006678 if (!PT)
6679 GEN_ERROR("Can't store to a nonpointer type: " +
Dan Gohman54392c12008-04-19 00:24:39 +00006680 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006681 const Type *ElTy = PT->getElementType();
Dan Gohman54392c12008-04-19 00:24:39 +00006682 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6683 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006684 "' into space of type '" + ElTy->getDescription() + "'");
6685
Dan Gohman54392c12008-04-19 00:24:39 +00006686 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006687 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006688 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6689 delete (yyvsp[(5) - (7)].TypeVal);
6690 ;}
6691 break;
6692
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006693 case 337:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006694#line 3287 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006695 {
6696 Value *TmpVal = getVal((yyvsp[(2) - (5)].TypeVal)->get(), (yyvsp[(3) - (5)].ValIDVal));
6697 if (!GetResultInst::isValidOperands(TmpVal, (yyvsp[(5) - (5)].UInt64Val)))
Devang Patel3b8849c2008-02-19 22:27:01 +00006698 GEN_ERROR("Invalid getresult operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006699 (yyval.InstVal) = new GetResultInst(TmpVal, (yyvsp[(5) - (5)].UInt64Val));
6700 delete (yyvsp[(2) - (5)].TypeVal);
Devang Patel3b8849c2008-02-19 22:27:01 +00006701 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006702 ;}
6703 break;
6704
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006705 case 338:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006706#line 3295 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006707 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006708 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006709 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6710 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006711 GEN_ERROR("getelementptr insn requires pointer operand");
6712
Dan Gohman8055f772008-05-15 19:50:34 +00006713 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006714 GEN_ERROR("Invalid getelementptr indices for type '" +
Dan Gohman54392c12008-04-19 00:24:39 +00006715 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6716 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006717 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006718 (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6719 delete (yyvsp[(2) - (4)].TypeVal);
6720 delete (yyvsp[(4) - (4)].ValueList);
6721 ;}
6722 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006723
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006724 case 339:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006725#line 3310 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006726 {
6727 if (!UpRefs.empty())
6728 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6729 if (!isa<StructType>((yyvsp[(2) - (4)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (4)].TypeVal)->get()))
6730 GEN_ERROR("extractvalue insn requires an aggregate operand");
6731
Dan Gohmane5febe42008-05-31 00:58:22 +00006732 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end()))
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006733 GEN_ERROR("Invalid extractvalue indices for type '" +
6734 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6735 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6736 CHECK_FOR_ERROR
Dan Gohmane5febe42008-05-31 00:58:22 +00006737 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end());
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006738 delete (yyvsp[(2) - (4)].TypeVal);
Dan Gohmane5febe42008-05-31 00:58:22 +00006739 delete (yyvsp[(4) - (4)].ConstantList);
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006740 ;}
6741 break;
6742
Dan Gohman9fc6cb02008-06-09 14:45:02 +00006743 case 340:
Dan Gohman7185e4b2008-06-23 18:43:26 +00006744#line 3325 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006745 {
6746 if (!UpRefs.empty())
6747 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription());
6748 if (!isa<StructType>((yyvsp[(2) - (7)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (7)].TypeVal)->get()))
6749 GEN_ERROR("extractvalue insn requires an aggregate operand");
6750
Dan Gohmane5febe42008-05-31 00:58:22 +00006751 if (ExtractValueInst::getIndexedType(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end()) != (yyvsp[(5) - (7)].TypeVal)->get())
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006752 GEN_ERROR("Invalid insertvalue indices for type '" +
6753 (*(yyvsp[(2) - (7)].TypeVal))->getDescription()+ "'");
6754 Value* aggVal = getVal(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(3) - (7)].ValIDVal));
6755 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
6756 CHECK_FOR_ERROR
Dan Gohmane5febe42008-05-31 00:58:22 +00006757 (yyval.InstVal) = InsertValueInst::Create(aggVal, tmpVal, (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end());
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006758 delete (yyvsp[(2) - (7)].TypeVal);
6759 delete (yyvsp[(5) - (7)].TypeVal);
Dan Gohmane5febe42008-05-31 00:58:22 +00006760 delete (yyvsp[(7) - (7)].ConstantList);
Dan Gohmane6b1ee62008-05-23 01:55:30 +00006761 ;}
6762 break;
6763
Dan Gohman54392c12008-04-19 00:24:39 +00006764
6765/* Line 1267 of yacc.c. */
Dan Gohman7185e4b2008-06-23 18:43:26 +00006766#line 6767 "llvmAsmParser.tab.c"
Dan Gohman54392c12008-04-19 00:24:39 +00006767 default: break;
Dale Johannesen3afee192007-09-07 21:07:57 +00006768 }
Dan Gohman54392c12008-04-19 00:24:39 +00006769 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6770
6771 YYPOPSTACK (yylen);
6772 yylen = 0;
6773 YY_STACK_PRINT (yyss, yyssp);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006774
6775 *++yyvsp = yyval;
6776
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006777
Dan Gohman54392c12008-04-19 00:24:39 +00006778 /* Now `shift' the result of the reduction. Determine what state
6779 that goes to, based on the state we popped back to and the rule
6780 number reduced by. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006781
6782 yyn = yyr1[yyn];
6783
Dan Gohman54392c12008-04-19 00:24:39 +00006784 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6785 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006786 yystate = yytable[yystate];
6787 else
Dan Gohman54392c12008-04-19 00:24:39 +00006788 yystate = yydefgoto[yyn - YYNTOKENS];
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006789
6790 goto yynewstate;
6791
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006792
Dan Gohman54392c12008-04-19 00:24:39 +00006793/*------------------------------------.
6794| yyerrlab -- here on detecting error |
6795`------------------------------------*/
6796yyerrlab:
6797 /* If not already recovering from an error, report this error. */
6798 if (!yyerrstatus)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006799 {
6800 ++yynerrs;
Dan Gohman54392c12008-04-19 00:24:39 +00006801#if ! YYERROR_VERBOSE
6802 yyerror (YY_("syntax error"));
6803#else
6804 {
6805 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
6806 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
6807 {
6808 YYSIZE_T yyalloc = 2 * yysize;
6809 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
6810 yyalloc = YYSTACK_ALLOC_MAXIMUM;
6811 if (yymsg != yymsgbuf)
6812 YYSTACK_FREE (yymsg);
6813 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
6814 if (yymsg)
6815 yymsg_alloc = yyalloc;
6816 else
6817 {
6818 yymsg = yymsgbuf;
6819 yymsg_alloc = sizeof yymsgbuf;
6820 }
6821 }
Dale Johannesen3afee192007-09-07 21:07:57 +00006822
Dan Gohman54392c12008-04-19 00:24:39 +00006823 if (0 < yysize && yysize <= yymsg_alloc)
6824 {
6825 (void) yysyntax_error (yymsg, yystate, yychar);
6826 yyerror (yymsg);
6827 }
6828 else
6829 {
6830 yyerror (YY_("syntax error"));
6831 if (yysize != 0)
6832 goto yyexhaustedlab;
6833 }
6834 }
6835#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006836 }
6837
Dan Gohman54392c12008-04-19 00:24:39 +00006838
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006839
6840 if (yyerrstatus == 3)
6841 {
Dan Gohman54392c12008-04-19 00:24:39 +00006842 /* If just tried and failed to reuse look-ahead token after an
6843 error, discard it. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006844
Dan Gohman54392c12008-04-19 00:24:39 +00006845 if (yychar <= YYEOF)
6846 {
6847 /* Return failure if at end of input. */
6848 if (yychar == YYEOF)
6849 YYABORT;
6850 }
6851 else
6852 {
6853 yydestruct ("Error: discarding",
6854 yytoken, &yylval);
6855 yychar = YYEMPTY;
6856 }
6857 }
6858
6859 /* Else will try to reuse look-ahead token after shifting the error
6860 token. */
6861 goto yyerrlab1;
6862
6863
6864/*---------------------------------------------------.
6865| yyerrorlab -- error raised explicitly by YYERROR. |
6866`---------------------------------------------------*/
6867yyerrorlab:
6868
6869 /* Pacify compilers like GCC when the user code never invokes
6870 YYERROR and the label yyerrorlab therefore never appears in user
6871 code. */
6872 if (/*CONSTCOND*/ 0)
6873 goto yyerrorlab;
6874
6875 /* Do not reclaim the symbols of the rule which action triggered
6876 this YYERROR. */
6877 YYPOPSTACK (yylen);
6878 yylen = 0;
6879 YY_STACK_PRINT (yyss, yyssp);
6880 yystate = *yyssp;
6881 goto yyerrlab1;
6882
6883
6884/*-------------------------------------------------------------.
6885| yyerrlab1 -- common code for both syntax error and YYERROR. |
6886`-------------------------------------------------------------*/
6887yyerrlab1:
6888 yyerrstatus = 3; /* Each real token shifted decrements this. */
6889
6890 for (;;)
6891 {
6892 yyn = yypact[yystate];
6893 if (yyn != YYPACT_NINF)
6894 {
6895 yyn += YYTERROR;
6896 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6897 {
6898 yyn = yytable[yyn];
6899 if (0 < yyn)
6900 break;
6901 }
6902 }
6903
6904 /* Pop the current state because it cannot handle the error token. */
6905 if (yyssp == yyss)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006906 YYABORT;
6907
Dale Johannesen3afee192007-09-07 21:07:57 +00006908
Dan Gohman54392c12008-04-19 00:24:39 +00006909 yydestruct ("Error: popping",
6910 yystos[yystate], yyvsp);
6911 YYPOPSTACK (1);
6912 yystate = *yyssp;
6913 YY_STACK_PRINT (yyss, yyssp);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006914 }
6915
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006916 if (yyn == YYFINAL)
6917 YYACCEPT;
6918
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006919 *++yyvsp = yylval;
Dan Gohman54392c12008-04-19 00:24:39 +00006920
6921
6922 /* Shift the error token. */
6923 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spenceraa8ae282007-07-31 03:50:36 +00006924
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006925 yystate = yyn;
6926 goto yynewstate;
6927
Gabor Greif89f01162008-04-06 23:07:54 +00006928
Dan Gohman54392c12008-04-19 00:24:39 +00006929/*-------------------------------------.
6930| yyacceptlab -- YYACCEPT comes here. |
6931`-------------------------------------*/
6932yyacceptlab:
6933 yyresult = 0;
6934 goto yyreturn;
6935
6936/*-----------------------------------.
6937| yyabortlab -- YYABORT comes here. |
6938`-----------------------------------*/
6939yyabortlab:
6940 yyresult = 1;
6941 goto yyreturn;
6942
6943#ifndef yyoverflow
6944/*-------------------------------------------------.
6945| yyexhaustedlab -- memory exhaustion comes here. |
6946`-------------------------------------------------*/
6947yyexhaustedlab:
6948 yyerror (YY_("memory exhausted"));
6949 yyresult = 2;
6950 /* Fall through. */
Chris Lattner59363a32008-02-19 04:36:25 +00006951#endif
Dan Gohman54392c12008-04-19 00:24:39 +00006952
6953yyreturn:
6954 if (yychar != YYEOF && yychar != YYEMPTY)
6955 yydestruct ("Cleanup: discarding lookahead",
6956 yytoken, &yylval);
6957 /* Do not reclaim the symbols of the rule which action triggered
6958 this YYABORT or YYACCEPT. */
6959 YYPOPSTACK (yylen);
6960 YY_STACK_PRINT (yyss, yyssp);
6961 while (yyssp != yyss)
6962 {
6963 yydestruct ("Cleanup: popping",
6964 yystos[*yyssp], yyvsp);
6965 YYPOPSTACK (1);
Gabor Greif89f01162008-04-06 23:07:54 +00006966 }
Dan Gohman54392c12008-04-19 00:24:39 +00006967#ifndef yyoverflow
6968 if (yyss != yyssa)
6969 YYSTACK_FREE (yyss);
6970#endif
6971#if YYERROR_VERBOSE
6972 if (yymsg != yymsgbuf)
6973 YYSTACK_FREE (yymsg);
6974#endif
6975 /* Make sure YYID is used. */
6976 return YYID (yyresult);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006977}
Dan Gohman54392c12008-04-19 00:24:39 +00006978
6979
Dan Gohman7185e4b2008-06-23 18:43:26 +00006980#line 3344 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006981
6982
6983// common code from the two 'RunVMAsmParser' functions
6984static Module* RunParser(Module * M) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006985 CurModule.CurrentModule = M;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006986 // Check to make sure the parser succeeded
6987 if (yyparse()) {
6988 if (ParserResult)
6989 delete ParserResult;
6990 return 0;
6991 }
6992
6993 // Emit an error if there are any unresolved types left.
6994 if (!CurModule.LateResolveTypes.empty()) {
6995 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6996 if (DID.Type == ValID::LocalName) {
6997 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6998 } else {
6999 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
7000 }
7001 if (ParserResult)
7002 delete ParserResult;
7003 return 0;
7004 }
7005
7006 // Emit an error if there are any unresolved values left.
7007 if (!CurModule.LateResolveValues.empty()) {
7008 Value *V = CurModule.LateResolveValues.back();
7009 std::map<Value*, std::pair<ValID, int> >::iterator I =
7010 CurModule.PlaceHolderInfo.find(V);
7011
7012 if (I != CurModule.PlaceHolderInfo.end()) {
7013 ValID &DID = I->second.first;
7014 if (DID.Type == ValID::LocalName) {
7015 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
7016 } else {
7017 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
7018 }
7019 if (ParserResult)
7020 delete ParserResult;
7021 return 0;
7022 }
7023 }
7024
7025 // Check to make sure that parsing produced a result
7026 if (!ParserResult)
7027 return 0;
7028
7029 // Reset ParserResult variable while saving its value for the result.
7030 Module *Result = ParserResult;
7031 ParserResult = 0;
7032
7033 return Result;
7034}
7035
7036void llvm::GenerateError(const std::string &message, int LineNo) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00007037 if (LineNo == -1) LineNo = LLLgetLineNo();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007038 // TODO: column number in exception
7039 if (TheParseError)
Duncan Sandsf5588dc2007-11-27 13:23:08 +00007040 TheParseError->setError(LLLgetFilename(), message, LineNo);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007041 TriggerError = 1;
7042}
7043
7044int yyerror(const char *ErrorMsg) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00007045 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007046 std::string errMsg = where + "error: " + std::string(ErrorMsg);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00007047 if (yychar != YYEMPTY && yychar != 0) {
7048 errMsg += " while reading token: '";
7049 errMsg += std::string(LLLgetTokenStart(),
7050 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
7051 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007052 GenerateError(errMsg);
7053 return 0;
7054}
Dan Gohman54392c12008-04-19 00:24:39 +00007055