blob: fe6fb6871307fdd982bd674bd1896f0f4ea27397 [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,
123 OPAQUE = 304,
124 EXTERNAL = 305,
125 TARGET = 306,
126 TRIPLE = 307,
127 ALIGN = 308,
128 ADDRSPACE = 309,
129 DEPLIBS = 310,
130 CALL = 311,
131 TAIL = 312,
132 ASM_TOK = 313,
133 MODULE = 314,
134 SIDEEFFECT = 315,
135 CC_TOK = 316,
136 CCC_TOK = 317,
137 FASTCC_TOK = 318,
138 COLDCC_TOK = 319,
139 X86_STDCALLCC_TOK = 320,
140 X86_FASTCALLCC_TOK = 321,
141 DATALAYOUT = 322,
142 UNWINDS = 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 EQ = 347,
167 NE = 348,
168 SLT = 349,
169 SGT = 350,
170 SLE = 351,
171 SGE = 352,
172 ULT = 353,
173 UGT = 354,
174 ULE = 355,
175 UGE = 356,
176 OEQ = 357,
177 ONE = 358,
178 OLT = 359,
179 OGT = 360,
180 OLE = 361,
181 OGE = 362,
182 ORD = 363,
183 UNO = 364,
184 UEQ = 365,
185 UNE = 366,
186 MALLOC = 367,
187 ALLOCA = 368,
188 FREE = 369,
189 LOAD = 370,
190 STORE = 371,
191 GETELEMENTPTR = 372,
192 TRUNC = 373,
193 ZEXT = 374,
194 SEXT = 375,
195 FPTRUNC = 376,
196 FPEXT = 377,
197 BITCAST = 378,
198 UITOFP = 379,
199 SITOFP = 380,
200 FPTOUI = 381,
201 FPTOSI = 382,
202 INTTOPTR = 383,
203 PTRTOINT = 384,
204 PHI_TOK = 385,
205 SELECT = 386,
206 VAARG = 387,
207 EXTRACTELEMENT = 388,
208 INSERTELEMENT = 389,
209 SHUFFLEVECTOR = 390,
210 GETRESULT = 391,
211 SIGNEXT = 392,
212 ZEROEXT = 393,
213 NORETURN = 394,
214 INREG = 395,
215 SRET = 396,
216 NOUNWIND = 397,
217 NOALIAS = 398,
218 BYVAL = 399,
219 NEST = 400,
220 READNONE = 401,
221 READONLY = 402,
222 GC = 403,
223 DEFAULT = 404,
224 HIDDEN = 405,
225 PROTECTED = 406
226 };
227#endif
228/* Tokens. */
229#define ESINT64VAL 258
230#define EUINT64VAL 259
231#define ESAPINTVAL 260
232#define EUAPINTVAL 261
233#define LOCALVAL_ID 262
234#define GLOBALVAL_ID 263
235#define FPVAL 264
236#define VOID 265
237#define INTTYPE 266
238#define FLOAT 267
239#define DOUBLE 268
240#define X86_FP80 269
241#define FP128 270
242#define PPC_FP128 271
243#define LABEL 272
244#define TYPE 273
245#define LOCALVAR 274
246#define GLOBALVAR 275
247#define LABELSTR 276
248#define STRINGCONSTANT 277
249#define ATSTRINGCONSTANT 278
250#define PCTSTRINGCONSTANT 279
251#define ZEROINITIALIZER 280
252#define TRUETOK 281
253#define FALSETOK 282
254#define BEGINTOK 283
255#define ENDTOK 284
256#define DECLARE 285
257#define DEFINE 286
258#define GLOBAL 287
259#define CONSTANT 288
260#define SECTION 289
261#define ALIAS 290
262#define VOLATILE 291
263#define THREAD_LOCAL 292
264#define TO 293
265#define DOTDOTDOT 294
266#define NULL_TOK 295
267#define UNDEF 296
268#define INTERNAL 297
269#define LINKONCE 298
270#define WEAK 299
271#define APPENDING 300
272#define DLLIMPORT 301
273#define DLLEXPORT 302
274#define EXTERN_WEAK 303
275#define OPAQUE 304
276#define EXTERNAL 305
277#define TARGET 306
278#define TRIPLE 307
279#define ALIGN 308
280#define ADDRSPACE 309
281#define DEPLIBS 310
282#define CALL 311
283#define TAIL 312
284#define ASM_TOK 313
285#define MODULE 314
286#define SIDEEFFECT 315
287#define CC_TOK 316
288#define CCC_TOK 317
289#define FASTCC_TOK 318
290#define COLDCC_TOK 319
291#define X86_STDCALLCC_TOK 320
292#define X86_FASTCALLCC_TOK 321
293#define DATALAYOUT 322
294#define UNWINDS 323
295#define RET 324
296#define BR 325
297#define SWITCH 326
298#define INVOKE 327
299#define UNWIND 328
300#define UNREACHABLE 329
301#define ADD 330
302#define SUB 331
303#define MUL 332
304#define UDIV 333
305#define SDIV 334
306#define FDIV 335
307#define UREM 336
308#define SREM 337
309#define FREM 338
310#define AND 339
311#define OR 340
312#define XOR 341
313#define SHL 342
314#define LSHR 343
315#define ASHR 344
316#define ICMP 345
317#define FCMP 346
318#define EQ 347
319#define NE 348
320#define SLT 349
321#define SGT 350
322#define SLE 351
323#define SGE 352
324#define ULT 353
325#define UGT 354
326#define ULE 355
327#define UGE 356
328#define OEQ 357
329#define ONE 358
330#define OLT 359
331#define OGT 360
332#define OLE 361
333#define OGE 362
334#define ORD 363
335#define UNO 364
336#define UEQ 365
337#define UNE 366
338#define MALLOC 367
339#define ALLOCA 368
340#define FREE 369
341#define LOAD 370
342#define STORE 371
343#define GETELEMENTPTR 372
344#define TRUNC 373
345#define ZEXT 374
346#define SEXT 375
347#define FPTRUNC 376
348#define FPEXT 377
349#define BITCAST 378
350#define UITOFP 379
351#define SITOFP 380
352#define FPTOUI 381
353#define FPTOSI 382
354#define INTTOPTR 383
355#define PTRTOINT 384
356#define PHI_TOK 385
357#define SELECT 386
358#define VAARG 387
359#define EXTRACTELEMENT 388
360#define INSERTELEMENT 389
361#define SHUFFLEVECTOR 390
362#define GETRESULT 391
363#define SIGNEXT 392
364#define ZEROEXT 393
365#define NORETURN 394
366#define INREG 395
367#define SRET 396
368#define NOUNWIND 397
369#define NOALIAS 398
370#define BYVAL 399
371#define NEST 400
372#define READNONE 401
373#define READONLY 402
374#define GC 403
375#define DEFAULT 404
376#define HIDDEN 405
377#define PROTECTED 406
378
379
380
381
382/* Copy the first part of user declarations. */
Dan Gohmandecb8c02008-04-23 20:11:27 +0000383#line 14 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000384
385#include "ParserInternals.h"
386#include "llvm/CallingConv.h"
387#include "llvm/InlineAsm.h"
388#include "llvm/Instructions.h"
389#include "llvm/Module.h"
390#include "llvm/ValueSymbolTable.h"
Chandler Carruth563d4a42007-08-04 01:56:21 +0000391#include "llvm/AutoUpgrade.h"
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000392#include "llvm/Support/GetElementPtrTypeIterator.h"
393#include "llvm/Support/CommandLine.h"
394#include "llvm/ADT/SmallVector.h"
395#include "llvm/ADT/STLExtras.h"
396#include "llvm/Support/MathExtras.h"
397#include "llvm/Support/Streams.h"
398#include <algorithm>
399#include <list>
400#include <map>
401#include <utility>
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000402
403// The following is a gross hack. In order to rid the libAsmParser library of
404// exceptions, we have to have a way of getting the yyparse function to go into
405// an error situation. So, whenever we want an error to occur, the GenerateError
406// function (see bottom of file) sets TriggerError. Then, at the end of each
407// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
408// (a goto) to put YACC in error state. Furthermore, several calls to
409// GenerateError are made from inside productions and they must simulate the
410// previous exception behavior by exiting the production immediately. We have
411// replaced these with the GEN_ERROR macro which calls GeneratError and then
412// immediately invokes YYERROR. This would be so much cleaner if it was a
413// recursive descent parser.
414static bool TriggerError = false;
415#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
416#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
417
418int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
419int yylex(); // declaration" of xxx warnings.
420int yyparse();
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000421using namespace llvm;
422
423static Module *ParserResult;
424
425// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
426// relating to upreferences in the input stream.
427//
428//#define DEBUG_UPREFS 1
429#ifdef DEBUG_UPREFS
430#define UR_OUT(X) cerr << X
431#else
432#define UR_OUT(X)
433#endif
434
435#define YYERROR_VERBOSE 1
436
437static GlobalVariable *CurGV;
438
439
440// This contains info used when building the body of a function. It is
441// destroyed when the function is completed.
442//
443typedef std::vector<Value *> ValueList; // Numbered defs
444
445static void
446ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
447
448static struct PerModuleInfo {
449 Module *CurrentModule;
450 ValueList Values; // Module level numbered definitions
451 ValueList LateResolveValues;
452 std::vector<PATypeHolder> Types;
453 std::map<ValID, PATypeHolder> LateResolveTypes;
454
455 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
456 /// how they were referenced and on which line of the input they came from so
457 /// that we can resolve them later and print error messages as appropriate.
458 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
459
460 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
461 // references to global values. Global values may be referenced before they
462 // are defined, and if so, the temporary object that they represent is held
463 // here. This is used for forward references of GlobalValues.
464 //
465 typedef std::map<std::pair<const PointerType *,
466 ValID>, GlobalValue*> GlobalRefsType;
467 GlobalRefsType GlobalRefs;
468
469 void ModuleDone() {
470 // If we could not resolve some functions at function compilation time
471 // (calls to functions before they are defined), resolve them now... Types
472 // are resolved when the constant pool has been completely parsed.
473 //
474 ResolveDefinitions(LateResolveValues);
475 if (TriggerError)
476 return;
477
478 // Check to make sure that all global value forward references have been
479 // resolved!
480 //
481 if (!GlobalRefs.empty()) {
482 std::string UndefinedReferences = "Unresolved global references exist:\n";
483
484 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
485 I != E; ++I) {
486 UndefinedReferences += " " + I->first.first->getDescription() + " " +
487 I->first.second.getName() + "\n";
488 }
489 GenerateError(UndefinedReferences);
490 return;
491 }
492
Chandler Carruth563d4a42007-08-04 01:56:21 +0000493 // Look for intrinsic functions and CallInst that need to be upgraded
494 for (Module::iterator FI = CurrentModule->begin(),
495 FE = CurrentModule->end(); FI != FE; )
496 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
497
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000498 Values.clear(); // Clear out function local definitions
499 Types.clear();
500 CurrentModule = 0;
501 }
502
503 // GetForwardRefForGlobal - Check to see if there is a forward reference
504 // for this global. If so, remove it from the GlobalRefs map and return it.
505 // If not, just return null.
506 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
507 // Check to see if there is a forward reference to this global variable...
508 // if there is, eliminate it and patch the reference to use the new def'n.
509 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
510 GlobalValue *Ret = 0;
511 if (I != GlobalRefs.end()) {
512 Ret = I->second;
513 GlobalRefs.erase(I);
514 }
515 return Ret;
516 }
517
518 bool TypeIsUnresolved(PATypeHolder* PATy) {
519 // If it isn't abstract, its resolved
520 const Type* Ty = PATy->get();
521 if (!Ty->isAbstract())
522 return false;
523 // Traverse the type looking for abstract types. If it isn't abstract then
524 // we don't need to traverse that leg of the type.
525 std::vector<const Type*> WorkList, SeenList;
526 WorkList.push_back(Ty);
527 while (!WorkList.empty()) {
528 const Type* Ty = WorkList.back();
529 SeenList.push_back(Ty);
530 WorkList.pop_back();
531 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
532 // Check to see if this is an unresolved type
533 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
534 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
535 for ( ; I != E; ++I) {
536 if (I->second.get() == OpTy)
537 return true;
538 }
539 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
540 const Type* TheTy = SeqTy->getElementType();
541 if (TheTy->isAbstract() && TheTy != Ty) {
542 std::vector<const Type*>::iterator I = SeenList.begin(),
543 E = SeenList.end();
544 for ( ; I != E; ++I)
545 if (*I == TheTy)
546 break;
547 if (I == E)
548 WorkList.push_back(TheTy);
549 }
550 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
551 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
552 const Type* TheTy = StrTy->getElementType(i);
553 if (TheTy->isAbstract() && TheTy != Ty) {
554 std::vector<const Type*>::iterator I = SeenList.begin(),
555 E = SeenList.end();
556 for ( ; I != E; ++I)
557 if (*I == TheTy)
558 break;
559 if (I == E)
560 WorkList.push_back(TheTy);
561 }
562 }
563 }
564 }
565 return false;
566 }
567} CurModule;
568
569static struct PerFunctionInfo {
570 Function *CurrentFunction; // Pointer to current function being created
571
572 ValueList Values; // Keep track of #'d definitions
573 unsigned NextValNum;
574 ValueList LateResolveValues;
575 bool isDeclare; // Is this function a forward declararation?
576 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
577 GlobalValue::VisibilityTypes Visibility;
578
579 /// BBForwardRefs - When we see forward references to basic blocks, keep
580 /// track of them here.
581 std::map<ValID, BasicBlock*> BBForwardRefs;
582
583 inline PerFunctionInfo() {
584 CurrentFunction = 0;
585 isDeclare = false;
586 Linkage = GlobalValue::ExternalLinkage;
587 Visibility = GlobalValue::DefaultVisibility;
588 }
589
590 inline void FunctionStart(Function *M) {
591 CurrentFunction = M;
592 NextValNum = 0;
593 }
594
595 void FunctionDone() {
596 // Any forward referenced blocks left?
597 if (!BBForwardRefs.empty()) {
598 GenerateError("Undefined reference to label " +
599 BBForwardRefs.begin()->second->getName());
600 return;
601 }
602
603 // Resolve all forward references now.
604 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
605
606 Values.clear(); // Clear out function local definitions
607 BBForwardRefs.clear();
608 CurrentFunction = 0;
609 isDeclare = false;
610 Linkage = GlobalValue::ExternalLinkage;
611 Visibility = GlobalValue::DefaultVisibility;
612 }
613} CurFun; // Info for the current function...
614
615static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
616
617
618//===----------------------------------------------------------------------===//
619// Code to handle definitions of all the types
620//===----------------------------------------------------------------------===//
621
622static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
623 // Things that have names or are void typed don't get slot numbers
624 if (V->hasName() || (V->getType() == Type::VoidTy))
625 return;
626
627 // In the case of function values, we have to allow for the forward reference
628 // of basic blocks, which are included in the numbering. Consequently, we keep
629 // track of the next insertion location with NextValNum. When a BB gets
630 // inserted, it could change the size of the CurFun.Values vector.
631 if (&ValueTab == &CurFun.Values) {
632 if (ValueTab.size() <= CurFun.NextValNum)
633 ValueTab.resize(CurFun.NextValNum+1);
634 ValueTab[CurFun.NextValNum++] = V;
635 return;
636 }
637 // For all other lists, its okay to just tack it on the back of the vector.
638 ValueTab.push_back(V);
639}
640
641static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
642 switch (D.Type) {
643 case ValID::LocalID: // Is it a numbered definition?
644 // Module constants occupy the lowest numbered slots...
645 if (D.Num < CurModule.Types.size())
646 return CurModule.Types[D.Num];
647 break;
648 case ValID::LocalName: // Is it a named definition?
649 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
650 D.destroy(); // Free old strdup'd memory...
651 return N;
652 }
653 break;
654 default:
655 GenerateError("Internal parser error: Invalid symbol type reference");
656 return 0;
657 }
658
659 // If we reached here, we referenced either a symbol that we don't know about
660 // or an id number that hasn't been read yet. We may be referencing something
661 // forward, so just create an entry to be resolved later and get to it...
662 //
663 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
664
665
666 if (inFunctionScope()) {
667 if (D.Type == ValID::LocalName) {
668 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
669 return 0;
670 } else {
671 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
672 return 0;
673 }
674 }
675
676 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
677 if (I != CurModule.LateResolveTypes.end())
678 return I->second;
679
680 Type *Typ = OpaqueType::get();
681 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
682 return Typ;
683 }
684
685// getExistingVal - Look up the value specified by the provided type and
686// the provided ValID. If the value exists and has already been defined, return
687// it. Otherwise return null.
688//
689static Value *getExistingVal(const Type *Ty, const ValID &D) {
690 if (isa<FunctionType>(Ty)) {
691 GenerateError("Functions are not values and "
692 "must be referenced as pointers");
693 return 0;
694 }
695
696 switch (D.Type) {
697 case ValID::LocalID: { // Is it a numbered definition?
698 // Check that the number is within bounds.
699 if (D.Num >= CurFun.Values.size())
700 return 0;
701 Value *Result = CurFun.Values[D.Num];
702 if (Ty != Result->getType()) {
703 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
704 Result->getType()->getDescription() + "' does not match "
705 "expected type, '" + Ty->getDescription() + "'");
706 return 0;
707 }
708 return Result;
709 }
710 case ValID::GlobalID: { // Is it a numbered definition?
711 if (D.Num >= CurModule.Values.size())
712 return 0;
713 Value *Result = CurModule.Values[D.Num];
714 if (Ty != Result->getType()) {
715 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
716 Result->getType()->getDescription() + "' does not match "
717 "expected type, '" + Ty->getDescription() + "'");
718 return 0;
719 }
720 return Result;
721 }
722
723 case ValID::LocalName: { // Is it a named definition?
724 if (!inFunctionScope())
725 return 0;
726 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
727 Value *N = SymTab.lookup(D.getName());
728 if (N == 0)
729 return 0;
730 if (N->getType() != Ty)
731 return 0;
732
733 D.destroy(); // Free old strdup'd memory...
734 return N;
735 }
736 case ValID::GlobalName: { // Is it a named definition?
737 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
738 Value *N = SymTab.lookup(D.getName());
739 if (N == 0)
740 return 0;
741 if (N->getType() != Ty)
742 return 0;
743
744 D.destroy(); // Free old strdup'd memory...
745 return N;
746 }
747
748 // Check to make sure that "Ty" is an integral type, and that our
749 // value will fit into the specified type...
750 case ValID::ConstSIntVal: // Is it a constant pool reference??
Chris Lattner59363a32008-02-19 04:36:25 +0000751 if (!isa<IntegerType>(Ty) ||
752 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000753 GenerateError("Signed integral constant '" +
754 itostr(D.ConstPool64) + "' is invalid for type '" +
755 Ty->getDescription() + "'");
756 return 0;
757 }
758 return ConstantInt::get(Ty, D.ConstPool64, true);
759
760 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
Chris Lattner59363a32008-02-19 04:36:25 +0000761 if (isa<IntegerType>(Ty) &&
762 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000763 return ConstantInt::get(Ty, D.UConstPool64);
Chris Lattner59363a32008-02-19 04:36:25 +0000764
765 if (!isa<IntegerType>(Ty) ||
766 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
767 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
768 "' is invalid or out of range for type '" +
769 Ty->getDescription() + "'");
770 return 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000771 }
Chris Lattner59363a32008-02-19 04:36:25 +0000772 // This is really a signed reference. Transmogrify.
773 return ConstantInt::get(Ty, D.ConstPool64, true);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000774
775 case ValID::ConstFPVal: // Is it a floating point const pool reference?
Chris Lattner59363a32008-02-19 04:36:25 +0000776 if (!Ty->isFloatingPoint() ||
777 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000778 GenerateError("FP constant invalid for type");
779 return 0;
780 }
Chris Lattner05ba86e2008-04-20 00:41:19 +0000781 // Lexer has no type info, so builds all float and double FP constants
Dale Johannesen255b8fe2007-09-11 18:33:39 +0000782 // as double. Fix this here. Long double does not need this.
783 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
784 Ty==Type::FloatTy)
Dale Johannesen3afee192007-09-07 21:07:57 +0000785 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
Chris Lattner05ba86e2008-04-20 00:41:19 +0000786 return ConstantFP::get(*D.ConstPoolFP);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000787
788 case ValID::ConstNullVal: // Is it a null value?
789 if (!isa<PointerType>(Ty)) {
790 GenerateError("Cannot create a a non pointer null");
791 return 0;
792 }
793 return ConstantPointerNull::get(cast<PointerType>(Ty));
794
795 case ValID::ConstUndefVal: // Is it an undef value?
796 return UndefValue::get(Ty);
797
798 case ValID::ConstZeroVal: // Is it a zero value?
799 return Constant::getNullValue(Ty);
800
801 case ValID::ConstantVal: // Fully resolved constant?
802 if (D.ConstantValue->getType() != Ty) {
803 GenerateError("Constant expression type different from required type");
804 return 0;
805 }
806 return D.ConstantValue;
807
808 case ValID::InlineAsmVal: { // Inline asm expression
809 const PointerType *PTy = dyn_cast<PointerType>(Ty);
810 const FunctionType *FTy =
811 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
812 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
813 GenerateError("Invalid type for asm constraint string");
814 return 0;
815 }
816 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
817 D.IAD->HasSideEffects);
818 D.destroy(); // Free InlineAsmDescriptor.
819 return IA;
820 }
821 default:
822 assert(0 && "Unhandled case!");
823 return 0;
824 } // End of switch
825
826 assert(0 && "Unhandled case!");
827 return 0;
828}
829
830// getVal - This function is identical to getExistingVal, except that if a
831// value is not already defined, it "improvises" by creating a placeholder var
832// that looks and acts just like the requested variable. When the value is
833// defined later, all uses of the placeholder variable are replaced with the
834// real thing.
835//
836static Value *getVal(const Type *Ty, const ValID &ID) {
837 if (Ty == Type::LabelTy) {
838 GenerateError("Cannot use a basic block here");
839 return 0;
840 }
841
842 // See if the value has already been defined.
843 Value *V = getExistingVal(Ty, ID);
844 if (V) return V;
845 if (TriggerError) return 0;
846
847 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
848 GenerateError("Invalid use of a composite type");
849 return 0;
850 }
851
852 // If we reached here, we referenced either a symbol that we don't know about
853 // or an id number that hasn't been read yet. We may be referencing something
854 // forward, so just create an entry to be resolved later and get to it...
855 //
856 switch (ID.Type) {
857 case ValID::GlobalName:
858 case ValID::GlobalID: {
859 const PointerType *PTy = dyn_cast<PointerType>(Ty);
860 if (!PTy) {
861 GenerateError("Invalid type for reference to global" );
862 return 0;
863 }
864 const Type* ElTy = PTy->getElementType();
865 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
Gabor Greif89f01162008-04-06 23:07:54 +0000866 V = Function::Create(FTy, GlobalValue::ExternalLinkage);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000867 else
Christopher Lamb0a243582007-12-11 09:02:08 +0000868 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
869 (Module*)0, false, PTy->getAddressSpace());
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000870 break;
871 }
872 default:
873 V = new Argument(Ty);
874 }
875
876 // Remember where this forward reference came from. FIXME, shouldn't we try
877 // to recycle these things??
878 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
Duncan Sandsf5588dc2007-11-27 13:23:08 +0000879 LLLgetLineNo())));
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000880
881 if (inFunctionScope())
882 InsertValue(V, CurFun.LateResolveValues);
883 else
884 InsertValue(V, CurModule.LateResolveValues);
885 return V;
886}
887
888/// defineBBVal - This is a definition of a new basic block with the specified
889/// identifier which must be the same as CurFun.NextValNum, if its numeric.
Devang Patel890cc572008-03-03 18:58:47 +0000890static BasicBlock *defineBBVal(const ValID &ID, BasicBlock *unwindDest) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000891 assert(inFunctionScope() && "Can't get basic block at global scope!");
892
893 BasicBlock *BB = 0;
894
895 // First, see if this was forward referenced
896
897 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
898 if (BBI != CurFun.BBForwardRefs.end()) {
899 BB = BBI->second;
900 // The forward declaration could have been inserted anywhere in the
901 // function: insert it into the correct place now.
902 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
903 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
904
905 // We're about to erase the entry, save the key so we can clean it up.
906 ValID Tmp = BBI->first;
907
908 // Erase the forward ref from the map as its no longer "forward"
909 CurFun.BBForwardRefs.erase(ID);
910
911 // The key has been removed from the map but so we don't want to leave
912 // strdup'd memory around so destroy it too.
913 Tmp.destroy();
914
915 // If its a numbered definition, bump the number and set the BB value.
916 if (ID.Type == ValID::LocalID) {
917 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
918 InsertValue(BB);
919 }
Devang Patel890cc572008-03-03 18:58:47 +0000920 } else {
921 // We haven't seen this BB before and its first mention is a definition.
922 // Just create it and return it.
923 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
Gabor Greif89f01162008-04-06 23:07:54 +0000924 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Devang Patel890cc572008-03-03 18:58:47 +0000925 if (ID.Type == ValID::LocalID) {
926 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
927 InsertValue(BB);
928 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000929 }
930
Devang Patel890cc572008-03-03 18:58:47 +0000931 ID.destroy();
932 BB->setUnwindDest(unwindDest);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000933 return BB;
934}
935
936/// getBBVal - get an existing BB value or create a forward reference for it.
937///
938static BasicBlock *getBBVal(const ValID &ID) {
939 assert(inFunctionScope() && "Can't get basic block at global scope!");
940
941 BasicBlock *BB = 0;
942
943 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
944 if (BBI != CurFun.BBForwardRefs.end()) {
945 BB = BBI->second;
946 } if (ID.Type == ValID::LocalName) {
947 std::string Name = ID.getName();
948 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
Anton Korobeynikov21c1eeb2008-02-20 12:10:37 +0000949 if (N) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000950 if (N->getType()->getTypeID() == Type::LabelTyID)
951 BB = cast<BasicBlock>(N);
952 else
953 GenerateError("Reference to label '" + Name + "' is actually of type '"+
954 N->getType()->getDescription() + "'");
Anton Korobeynikov21c1eeb2008-02-20 12:10:37 +0000955 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000956 } else if (ID.Type == ValID::LocalID) {
957 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
958 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
959 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
960 else
961 GenerateError("Reference to label '%" + utostr(ID.Num) +
962 "' is actually of type '"+
963 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
964 }
965 } else {
966 GenerateError("Illegal label reference " + ID.getName());
967 return 0;
968 }
969
970 // If its already been defined, return it now.
971 if (BB) {
972 ID.destroy(); // Free strdup'd memory.
973 return BB;
974 }
975
976 // Otherwise, this block has not been seen before, create it.
977 std::string Name;
978 if (ID.Type == ValID::LocalName)
979 Name = ID.getName();
Gabor Greif89f01162008-04-06 23:07:54 +0000980 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000981
982 // Insert it in the forward refs map.
983 CurFun.BBForwardRefs[ID] = BB;
984
985 return BB;
986}
987
988
989//===----------------------------------------------------------------------===//
990// Code to handle forward references in instructions
991//===----------------------------------------------------------------------===//
992//
993// This code handles the late binding needed with statements that reference
994// values not defined yet... for example, a forward branch, or the PHI node for
995// a loop body.
996//
997// This keeps a table (CurFun.LateResolveValues) of all such forward references
998// and back patchs after we are done.
999//
1000
1001// ResolveDefinitions - If we could not resolve some defs at parsing
1002// time (forward branches, phi functions for loops, etc...) resolve the
1003// defs now...
1004//
1005static void
1006ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
1007 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
1008 while (!LateResolvers.empty()) {
1009 Value *V = LateResolvers.back();
1010 LateResolvers.pop_back();
1011
1012 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1013 CurModule.PlaceHolderInfo.find(V);
1014 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
1015
1016 ValID &DID = PHI->second.first;
1017
1018 Value *TheRealValue = getExistingVal(V->getType(), DID);
1019 if (TriggerError)
1020 return;
1021 if (TheRealValue) {
1022 V->replaceAllUsesWith(TheRealValue);
1023 delete V;
1024 CurModule.PlaceHolderInfo.erase(PHI);
1025 } else if (FutureLateResolvers) {
1026 // Functions have their unresolved items forwarded to the module late
1027 // resolver table
1028 InsertValue(V, *FutureLateResolvers);
1029 } else {
1030 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1031 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1032 "' of type '" + V->getType()->getDescription() + "'",
1033 PHI->second.second);
1034 return;
1035 } else {
1036 GenerateError("Reference to an invalid definition: #" +
1037 itostr(DID.Num) + " of type '" +
1038 V->getType()->getDescription() + "'",
1039 PHI->second.second);
1040 return;
1041 }
1042 }
1043 }
1044 LateResolvers.clear();
1045}
1046
1047// ResolveTypeTo - A brand new type was just declared. This means that (if
1048// name is not null) things referencing Name can be resolved. Otherwise, things
1049// refering to the number can be resolved. Do this now.
1050//
1051static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1052 ValID D;
1053 if (Name)
1054 D = ValID::createLocalName(*Name);
1055 else
1056 D = ValID::createLocalID(CurModule.Types.size());
1057
1058 std::map<ValID, PATypeHolder>::iterator I =
1059 CurModule.LateResolveTypes.find(D);
1060 if (I != CurModule.LateResolveTypes.end()) {
1061 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1062 CurModule.LateResolveTypes.erase(I);
1063 }
1064}
1065
1066// setValueName - Set the specified value to the name given. The name may be
1067// null potentially, in which case this is a noop. The string passed in is
1068// assumed to be a malloc'd string buffer, and is free'd by this function.
1069//
1070static void setValueName(Value *V, std::string *NameStr) {
1071 if (!NameStr) return;
1072 std::string Name(*NameStr); // Copy string
1073 delete NameStr; // Free old string
1074
1075 if (V->getType() == Type::VoidTy) {
1076 GenerateError("Can't assign name '" + Name+"' to value with void type");
1077 return;
1078 }
1079
1080 assert(inFunctionScope() && "Must be in function scope!");
1081 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1082 if (ST.lookup(Name)) {
1083 GenerateError("Redefinition of value '" + Name + "' of type '" +
1084 V->getType()->getDescription() + "'");
1085 return;
1086 }
1087
1088 // Set the name.
1089 V->setName(Name);
1090}
1091
1092/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1093/// this is a declaration, otherwise it is a definition.
1094static GlobalVariable *
1095ParseGlobalVariable(std::string *NameStr,
1096 GlobalValue::LinkageTypes Linkage,
1097 GlobalValue::VisibilityTypes Visibility,
1098 bool isConstantGlobal, const Type *Ty,
Christopher Lamb0a243582007-12-11 09:02:08 +00001099 Constant *Initializer, bool IsThreadLocal,
1100 unsigned AddressSpace = 0) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001101 if (isa<FunctionType>(Ty)) {
1102 GenerateError("Cannot declare global vars of function type");
1103 return 0;
1104 }
1105
Christopher Lamb0a243582007-12-11 09:02:08 +00001106 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001107
1108 std::string Name;
1109 if (NameStr) {
1110 Name = *NameStr; // Copy string
1111 delete NameStr; // Free old string
1112 }
1113
1114 // See if this global value was forward referenced. If so, recycle the
1115 // object.
1116 ValID ID;
1117 if (!Name.empty()) {
1118 ID = ValID::createGlobalName(Name);
1119 } else {
1120 ID = ValID::createGlobalID(CurModule.Values.size());
1121 }
1122
1123 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1124 // Move the global to the end of the list, from whereever it was
1125 // previously inserted.
1126 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1127 CurModule.CurrentModule->getGlobalList().remove(GV);
1128 CurModule.CurrentModule->getGlobalList().push_back(GV);
1129 GV->setInitializer(Initializer);
1130 GV->setLinkage(Linkage);
1131 GV->setVisibility(Visibility);
1132 GV->setConstant(isConstantGlobal);
1133 GV->setThreadLocal(IsThreadLocal);
1134 InsertValue(GV, CurModule.Values);
1135 return GV;
1136 }
1137
1138 // If this global has a name
1139 if (!Name.empty()) {
1140 // if the global we're parsing has an initializer (is a definition) and
1141 // has external linkage.
1142 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1143 // If there is already a global with external linkage with this name
1144 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1145 // If we allow this GVar to get created, it will be renamed in the
1146 // symbol table because it conflicts with an existing GVar. We can't
1147 // allow redefinition of GVars whose linking indicates that their name
1148 // must stay the same. Issue the error.
1149 GenerateError("Redefinition of global variable named '" + Name +
1150 "' of type '" + Ty->getDescription() + "'");
1151 return 0;
1152 }
1153 }
1154
1155 // Otherwise there is no existing GV to use, create one now.
1156 GlobalVariable *GV =
1157 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
Christopher Lamb0a243582007-12-11 09:02:08 +00001158 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001159 GV->setVisibility(Visibility);
1160 InsertValue(GV, CurModule.Values);
1161 return GV;
1162}
1163
1164// setTypeName - Set the specified type to the name given. The name may be
1165// null potentially, in which case this is a noop. The string passed in is
1166// assumed to be a malloc'd string buffer, and is freed by this function.
1167//
1168// This function returns true if the type has already been defined, but is
1169// allowed to be redefined in the specified context. If the name is a new name
1170// for the type plane, it is inserted and false is returned.
1171static bool setTypeName(const Type *T, std::string *NameStr) {
1172 assert(!inFunctionScope() && "Can't give types function-local names!");
1173 if (NameStr == 0) return false;
1174
1175 std::string Name(*NameStr); // Copy string
1176 delete NameStr; // Free old string
1177
1178 // We don't allow assigning names to void type
1179 if (T == Type::VoidTy) {
1180 GenerateError("Can't assign name '" + Name + "' to the void type");
1181 return false;
1182 }
1183
1184 // Set the type name, checking for conflicts as we do so.
1185 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1186
1187 if (AlreadyExists) { // Inserting a name that is already defined???
1188 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1189 assert(Existing && "Conflict but no matching type?!");
1190
1191 // There is only one case where this is allowed: when we are refining an
1192 // opaque type. In this case, Existing will be an opaque type.
1193 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1194 // We ARE replacing an opaque type!
1195 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1196 return true;
1197 }
1198
1199 // Otherwise, this is an attempt to redefine a type. That's okay if
1200 // the redefinition is identical to the original. This will be so if
1201 // Existing and T point to the same Type object. In this one case we
1202 // allow the equivalent redefinition.
1203 if (Existing == T) return true; // Yes, it's equal.
1204
1205 // Any other kind of (non-equivalent) redefinition is an error.
1206 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1207 T->getDescription() + "'");
1208 }
1209
1210 return false;
1211}
1212
1213//===----------------------------------------------------------------------===//
1214// Code for handling upreferences in type names...
1215//
1216
1217// TypeContains - Returns true if Ty directly contains E in it.
1218//
1219static bool TypeContains(const Type *Ty, const Type *E) {
1220 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1221 E) != Ty->subtype_end();
1222}
1223
1224namespace {
1225 struct UpRefRecord {
1226 // NestingLevel - The number of nesting levels that need to be popped before
1227 // this type is resolved.
1228 unsigned NestingLevel;
1229
1230 // LastContainedTy - This is the type at the current binding level for the
1231 // type. Every time we reduce the nesting level, this gets updated.
1232 const Type *LastContainedTy;
1233
1234 // UpRefTy - This is the actual opaque type that the upreference is
1235 // represented with.
1236 OpaqueType *UpRefTy;
1237
1238 UpRefRecord(unsigned NL, OpaqueType *URTy)
1239 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1240 };
1241}
1242
1243// UpRefs - A list of the outstanding upreferences that need to be resolved.
1244static std::vector<UpRefRecord> UpRefs;
1245
1246/// HandleUpRefs - Every time we finish a new layer of types, this function is
1247/// called. It loops through the UpRefs vector, which is a list of the
1248/// currently active types. For each type, if the up reference is contained in
1249/// the newly completed type, we decrement the level count. When the level
1250/// count reaches zero, the upreferenced type is the type that is passed in:
1251/// thus we can complete the cycle.
1252///
1253static PATypeHolder HandleUpRefs(const Type *ty) {
1254 // If Ty isn't abstract, or if there are no up-references in it, then there is
1255 // nothing to resolve here.
1256 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1257
1258 PATypeHolder Ty(ty);
1259 UR_OUT("Type '" << Ty->getDescription() <<
1260 "' newly formed. Resolving upreferences.\n" <<
1261 UpRefs.size() << " upreferences active!\n");
1262
1263 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1264 // to zero), we resolve them all together before we resolve them to Ty. At
1265 // the end of the loop, if there is anything to resolve to Ty, it will be in
1266 // this variable.
1267 OpaqueType *TypeToResolve = 0;
1268
1269 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1270 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1271 << UpRefs[i].second->getDescription() << ") = "
1272 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1273 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1274 // Decrement level of upreference
1275 unsigned Level = --UpRefs[i].NestingLevel;
1276 UpRefs[i].LastContainedTy = Ty;
1277 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1278 if (Level == 0) { // Upreference should be resolved!
1279 if (!TypeToResolve) {
1280 TypeToResolve = UpRefs[i].UpRefTy;
1281 } else {
1282 UR_OUT(" * Resolving upreference for "
1283 << UpRefs[i].second->getDescription() << "\n";
1284 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1285 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1286 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1287 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1288 }
1289 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1290 --i; // Do not skip the next element...
1291 }
1292 }
1293 }
1294
1295 if (TypeToResolve) {
1296 UR_OUT(" * Resolving upreference for "
1297 << UpRefs[i].second->getDescription() << "\n";
1298 std::string OldName = TypeToResolve->getDescription());
1299 TypeToResolve->refineAbstractTypeTo(Ty);
1300 }
1301
1302 return Ty;
1303}
1304
1305//===----------------------------------------------------------------------===//
1306// RunVMAsmParser - Define an interface to this parser
1307//===----------------------------------------------------------------------===//
1308//
1309static Module* RunParser(Module * M);
1310
Duncan Sandsf5588dc2007-11-27 13:23:08 +00001311Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1312 InitLLLexer(MB);
1313 Module *M = RunParser(new Module(LLLgetFilename()));
1314 FreeLexer();
1315 return M;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001316}
1317
1318
Dan Gohman54392c12008-04-19 00:24:39 +00001319
1320/* Enabling traces. */
1321#ifndef YYDEBUG
1322# define YYDEBUG 0
1323#endif
1324
1325/* Enabling verbose error messages. */
1326#ifdef YYERROR_VERBOSE
1327# undef YYERROR_VERBOSE
1328# define YYERROR_VERBOSE 1
1329#else
1330# define YYERROR_VERBOSE 0
1331#endif
1332
1333/* Enabling the token table. */
1334#ifndef YYTOKEN_TABLE
1335# define YYTOKEN_TABLE 0
1336#endif
1337
1338#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1339typedef union YYSTYPE
Dan Gohmandecb8c02008-04-23 20:11:27 +00001340#line 950 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00001341{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001342 llvm::Module *ModuleVal;
1343 llvm::Function *FunctionVal;
1344 llvm::BasicBlock *BasicBlockVal;
1345 llvm::TerminatorInst *TermInstVal;
1346 llvm::Instruction *InstVal;
1347 llvm::Constant *ConstVal;
1348
1349 const llvm::Type *PrimType;
1350 std::list<llvm::PATypeHolder> *TypeList;
1351 llvm::PATypeHolder *TypeVal;
1352 llvm::Value *ValueVal;
1353 std::vector<llvm::Value*> *ValueList;
1354 llvm::ArgListType *ArgList;
1355 llvm::TypeWithAttrs TypeWithAttrs;
1356 llvm::TypeWithAttrsList *TypeWithAttrsList;
Dale Johannesencfb19e62007-11-05 21:20:28 +00001357 llvm::ParamList *ParamList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001358
1359 // Represent the RHS of PHI node
1360 std::list<std::pair<llvm::Value*,
1361 llvm::BasicBlock*> > *PHIList;
1362 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1363 std::vector<llvm::Constant*> *ConstVector;
1364
1365 llvm::GlobalValue::LinkageTypes Linkage;
1366 llvm::GlobalValue::VisibilityTypes Visibility;
Dale Johannesend915ee52008-02-19 21:40:51 +00001367 llvm::ParameterAttributes ParamAttrs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001368 llvm::APInt *APIntVal;
1369 int64_t SInt64Val;
1370 uint64_t UInt64Val;
1371 int SIntVal;
1372 unsigned UIntVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00001373 llvm::APFloat *FPVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001374 bool BoolVal;
1375
1376 std::string *StrVal; // This memory must be deleted
1377 llvm::ValID ValIDVal;
1378
1379 llvm::Instruction::BinaryOps BinaryOpVal;
1380 llvm::Instruction::TermOps TermOpVal;
1381 llvm::Instruction::MemoryOps MemOpVal;
1382 llvm::Instruction::CastOps CastOpVal;
1383 llvm::Instruction::OtherOps OtherOpVal;
1384 llvm::ICmpInst::Predicate IPredicate;
1385 llvm::FCmpInst::Predicate FPredicate;
Dan Gohman54392c12008-04-19 00:24:39 +00001386}
1387/* Line 193 of yacc.c. */
1388#line 1389 "llvmAsmParser.tab.c"
1389 YYSTYPE;
1390# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1391# define YYSTYPE_IS_DECLARED 1
1392# define YYSTYPE_IS_TRIVIAL 1
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001393#endif
1394
1395
1396
Dan Gohman54392c12008-04-19 00:24:39 +00001397/* Copy the second part of user declarations. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001398
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001399
Dan Gohman54392c12008-04-19 00:24:39 +00001400/* Line 216 of yacc.c. */
1401#line 1402 "llvmAsmParser.tab.c"
Reid Spenceraa8ae282007-07-31 03:50:36 +00001402
Dan Gohman54392c12008-04-19 00:24:39 +00001403#ifdef short
1404# undef short
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001405#endif
1406
Dan Gohman54392c12008-04-19 00:24:39 +00001407#ifdef YYTYPE_UINT8
1408typedef YYTYPE_UINT8 yytype_uint8;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001409#else
Dan Gohman54392c12008-04-19 00:24:39 +00001410typedef unsigned char yytype_uint8;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001411#endif
1412
Dan Gohman54392c12008-04-19 00:24:39 +00001413#ifdef YYTYPE_INT8
1414typedef YYTYPE_INT8 yytype_int8;
1415#elif (defined __STDC__ || defined __C99__FUNC__ \
1416 || defined __cplusplus || defined _MSC_VER)
1417typedef signed char yytype_int8;
1418#else
1419typedef short int yytype_int8;
1420#endif
1421
1422#ifdef YYTYPE_UINT16
1423typedef YYTYPE_UINT16 yytype_uint16;
1424#else
1425typedef unsigned short int yytype_uint16;
1426#endif
1427
1428#ifdef YYTYPE_INT16
1429typedef YYTYPE_INT16 yytype_int16;
1430#else
1431typedef short int yytype_int16;
1432#endif
1433
1434#ifndef YYSIZE_T
1435# ifdef __SIZE_TYPE__
1436# define YYSIZE_T __SIZE_TYPE__
1437# elif defined size_t
1438# define YYSIZE_T size_t
1439# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1440 || defined __cplusplus || defined _MSC_VER)
1441# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1442# define YYSIZE_T size_t
1443# else
1444# define YYSIZE_T unsigned int
1445# endif
1446#endif
1447
1448#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1449
1450#ifndef YY_
1451# if defined YYENABLE_NLS && YYENABLE_NLS
1452# if ENABLE_NLS
1453# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1454# define YY_(msgid) dgettext ("bison-runtime", msgid)
1455# endif
1456# endif
1457# ifndef YY_
1458# define YY_(msgid) msgid
1459# endif
1460#endif
1461
1462/* Suppress unused-variable warnings by "using" E. */
1463#if ! defined lint || defined __GNUC__
1464# define YYUSE(e) ((void) (e))
1465#else
1466# define YYUSE(e) /* empty */
1467#endif
1468
1469/* Identity function, used to suppress warnings about constant conditions. */
1470#ifndef lint
1471# define YYID(n) (n)
1472#else
1473#if (defined __STDC__ || defined __C99__FUNC__ \
1474 || defined __cplusplus || defined _MSC_VER)
1475static int
1476YYID (int i)
1477#else
1478static int
1479YYID (i)
1480 int i;
1481#endif
1482{
1483 return i;
1484}
1485#endif
1486
1487#if ! defined yyoverflow || YYERROR_VERBOSE
1488
1489/* The parser invokes alloca or malloc; define the necessary symbols. */
1490
1491# ifdef YYSTACK_USE_ALLOCA
1492# if YYSTACK_USE_ALLOCA
1493# ifdef __GNUC__
1494# define YYSTACK_ALLOC __builtin_alloca
1495# elif defined __BUILTIN_VA_ARG_INCR
1496# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1497# elif defined _AIX
1498# define YYSTACK_ALLOC __alloca
1499# elif defined _MSC_VER
1500# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1501# define alloca _alloca
1502# else
1503# define YYSTACK_ALLOC alloca
1504# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1505 || defined __cplusplus || defined _MSC_VER)
1506# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1507# ifndef _STDLIB_H
1508# define _STDLIB_H 1
1509# endif
1510# endif
1511# endif
1512# endif
1513# endif
1514
1515# ifdef YYSTACK_ALLOC
1516 /* Pacify GCC's `empty if-body' warning. */
1517# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1518# ifndef YYSTACK_ALLOC_MAXIMUM
1519 /* The OS might guarantee only one guard page at the bottom of the stack,
1520 and a page size can be as small as 4096 bytes. So we cannot safely
1521 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1522 to allow for a few compiler-allocated temporary stack slots. */
1523# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1524# endif
1525# else
1526# define YYSTACK_ALLOC YYMALLOC
1527# define YYSTACK_FREE YYFREE
1528# ifndef YYSTACK_ALLOC_MAXIMUM
1529# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1530# endif
1531# if (defined __cplusplus && ! defined _STDLIB_H \
1532 && ! ((defined YYMALLOC || defined malloc) \
1533 && (defined YYFREE || defined free)))
1534# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1535# ifndef _STDLIB_H
1536# define _STDLIB_H 1
1537# endif
1538# endif
1539# ifndef YYMALLOC
1540# define YYMALLOC malloc
1541# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1542 || defined __cplusplus || defined _MSC_VER)
1543void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1544# endif
1545# endif
1546# ifndef YYFREE
1547# define YYFREE free
1548# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1549 || defined __cplusplus || defined _MSC_VER)
1550void free (void *); /* INFRINGES ON USER NAME SPACE */
1551# endif
1552# endif
1553# endif
1554#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1555
1556
1557#if (! defined yyoverflow \
1558 && (! defined __cplusplus \
1559 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1560
1561/* A type that is properly aligned for any stack member. */
1562union yyalloc
1563{
1564 yytype_int16 yyss;
1565 YYSTYPE yyvs;
1566 };
1567
1568/* The size of the maximum gap between one aligned stack and the next. */
1569# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1570
1571/* The size of an array large to enough to hold all stacks, each with
1572 N elements. */
1573# define YYSTACK_BYTES(N) \
1574 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1575 + YYSTACK_GAP_MAXIMUM)
1576
1577/* Copy COUNT objects from FROM to TO. The source and destination do
1578 not overlap. */
1579# ifndef YYCOPY
1580# if defined __GNUC__ && 1 < __GNUC__
1581# define YYCOPY(To, From, Count) \
1582 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1583# else
1584# define YYCOPY(To, From, Count) \
1585 do \
1586 { \
1587 YYSIZE_T yyi; \
1588 for (yyi = 0; yyi < (Count); yyi++) \
1589 (To)[yyi] = (From)[yyi]; \
1590 } \
1591 while (YYID (0))
1592# endif
1593# endif
1594
1595/* Relocate STACK from its old location to the new one. The
1596 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1597 elements in the stack, and YYPTR gives the new location of the
1598 stack. Advance YYPTR to a properly aligned location for the next
1599 stack. */
1600# define YYSTACK_RELOCATE(Stack) \
1601 do \
1602 { \
1603 YYSIZE_T yynewbytes; \
1604 YYCOPY (&yyptr->Stack, Stack, yysize); \
1605 Stack = &yyptr->Stack; \
1606 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1607 yyptr += yynewbytes / sizeof (*yyptr); \
1608 } \
1609 while (YYID (0))
1610
1611#endif
1612
1613/* YYFINAL -- State number of the termination state. */
1614#define YYFINAL 43
1615/* YYLAST -- Last index in YYTABLE. */
1616#define YYLAST 2015
1617
1618/* YYNTOKENS -- Number of terminals. */
1619#define YYNTOKENS 166
1620/* YYNNTS -- Number of nonterminals. */
1621#define YYNNTS 85
1622/* YYNRULES -- Number of rules. */
1623#define YYNRULES 324
1624/* YYNRULES -- Number of states. */
1625#define YYNSTATES 635
1626
1627/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1628#define YYUNDEFTOK 2
1629#define YYMAXUTOK 406
1630
1631#define YYTRANSLATE(YYX) \
1632 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1633
1634/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1635static const yytype_uint8 yytranslate[] =
1636{
1637 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1638 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1639 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1640 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1641 152, 153, 156, 2, 155, 2, 2, 2, 2, 2,
1642 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1643 161, 154, 162, 2, 2, 2, 2, 2, 2, 2,
1644 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1645 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1646 2, 158, 157, 160, 2, 2, 2, 2, 2, 165,
1647 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1648 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1649 159, 2, 2, 163, 2, 164, 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,
1653 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1654 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1655 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1656 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1657 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1658 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1659 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1660 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1661 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1662 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1663 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1664 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1665 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1666 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1667 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1668 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1669 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1670 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1671 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1672 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1673 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1674 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1675 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1676 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
1677 145, 146, 147, 148, 149, 150, 151
1678};
1679
1680#if YYDEBUG
1681/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1682 YYRHS. */
1683static const yytype_uint16 yyprhs[] =
1684{
1685 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1686 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1687 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1688 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1689 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1690 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1691 119, 121, 123, 125, 127, 129, 130, 135, 136, 139,
1692 140, 142, 144, 146, 147, 150, 152, 154, 156, 158,
1693 160, 162, 164, 166, 167, 169, 171, 173, 174, 176,
1694 178, 179, 181, 183, 185, 187, 188, 190, 192, 193,
1695 195, 197, 199, 201, 203, 206, 208, 210, 212, 214,
1696 216, 218, 220, 222, 224, 227, 228, 231, 233, 235,
1697 237, 239, 241, 243, 244, 247, 248, 251, 252, 255,
1698 256, 260, 263, 264, 266, 267, 271, 273, 276, 278,
1699 280, 282, 284, 286, 288, 290, 292, 294, 298, 300,
1700 303, 309, 315, 321, 327, 331, 334, 340, 345, 348,
1701 350, 352, 354, 358, 360, 364, 366, 367, 369, 373,
1702 378, 382, 386, 391, 396, 400, 407, 413, 416, 419,
1703 422, 425, 428, 431, 434, 437, 440, 443, 446, 449,
1704 456, 462, 471, 478, 485, 493, 501, 508, 517, 526,
1705 530, 532, 534, 536, 538, 539, 542, 549, 551, 552,
1706 554, 557, 558, 562, 563, 567, 571, 575, 579, 580,
1707 589, 590, 600, 601, 611, 617, 620, 624, 626, 630,
1708 634, 638, 642, 644, 645, 651, 655, 657, 661, 663,
1709 664, 675, 677, 679, 684, 686, 688, 691, 695, 696,
1710 698, 700, 702, 704, 706, 708, 710, 712, 714, 718,
1711 720, 726, 728, 730, 732, 734, 736, 738, 741, 743,
1712 747, 750, 753, 757, 760, 761, 765, 767, 772, 775,
1713 778, 782, 792, 802, 811, 826, 828, 830, 837, 843,
1714 846, 853, 861, 866, 871, 878, 885, 886, 887, 891,
1715 894, 896, 902, 908, 915, 922, 927, 934, 939, 944,
1716 951, 958, 961, 970, 972, 974, 975, 979, 986, 990,
1717 997, 1000, 1006, 1014, 1020
1718};
1719
1720/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1721static const yytype_int16 yyrhs[] =
1722{
1723 212, 0, -1, 75, -1, 76, -1, 77, -1, 78,
1724 -1, 79, -1, 80, -1, 81, -1, 82, -1, 83,
1725 -1, 87, -1, 88, -1, 89, -1, 84, -1, 85,
1726 -1, 86, -1, 118, -1, 119, -1, 120, -1, 121,
1727 -1, 122, -1, 123, -1, 124, -1, 125, -1, 126,
1728 -1, 127, -1, 128, -1, 129, -1, 92, -1, 93,
1729 -1, 94, -1, 95, -1, 96, -1, 97, -1, 98,
1730 -1, 99, -1, 100, -1, 101, -1, 102, -1, 103,
1731 -1, 104, -1, 105, -1, 106, -1, 107, -1, 108,
1732 -1, 109, -1, 110, -1, 111, -1, 98, -1, 99,
1733 -1, 100, -1, 101, -1, 26, -1, 27, -1, 11,
1734 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
1735 -1, 19, -1, 22, -1, 24, -1, 174, -1, -1,
1736 54, 152, 4, 153, -1, -1, 174, 154, -1, -1,
1737 20, -1, 23, -1, 180, -1, -1, 178, 154, -1,
1738 42, -1, 44, -1, 43, -1, 45, -1, 47, -1,
1739 46, -1, 48, -1, 50, -1, -1, 149, -1, 150,
1740 -1, 151, -1, -1, 46, -1, 48, -1, -1, 42,
1741 -1, 43, -1, 44, -1, 47, -1, -1, 44, -1,
1742 42, -1, -1, 62, -1, 63, -1, 64, -1, 65,
1743 -1, 66, -1, 61, 4, -1, 138, -1, 119, -1,
1744 137, -1, 120, -1, 140, -1, 141, -1, 143, -1,
1745 144, -1, 145, -1, 53, 4, -1, -1, 189, 188,
1746 -1, 139, -1, 142, -1, 138, -1, 137, -1, 146,
1747 -1, 147, -1, -1, 191, 190, -1, -1, 148, 22,
1748 -1, -1, 53, 4, -1, -1, 155, 53, 4, -1,
1749 34, 22, -1, -1, 195, -1, -1, 155, 198, 197,
1750 -1, 195, -1, 53, 4, -1, 11, -1, 12, -1,
1751 13, -1, 16, -1, 15, -1, 14, -1, 17, -1,
1752 49, -1, 199, -1, 200, 176, 156, -1, 234, -1,
1753 157, 4, -1, 200, 152, 204, 153, 191, -1, 10,
1754 152, 204, 153, 191, -1, 158, 4, 159, 200, 160,
1755 -1, 161, 4, 159, 200, 162, -1, 163, 205, 164,
1756 -1, 163, 164, -1, 161, 163, 205, 164, 162, -1,
1757 161, 163, 164, 162, -1, 200, 189, -1, 200, -1,
1758 10, -1, 201, -1, 203, 155, 201, -1, 203, -1,
1759 203, 155, 39, -1, 39, -1, -1, 200, -1, 205,
1760 155, 200, -1, 200, 158, 208, 160, -1, 200, 158,
1761 160, -1, 200, 165, 22, -1, 200, 161, 208, 162,
1762 -1, 200, 163, 208, 164, -1, 200, 163, 164, -1,
1763 200, 161, 163, 208, 164, 162, -1, 200, 161, 163,
1764 164, 162, -1, 200, 40, -1, 200, 41, -1, 200,
1765 234, -1, 200, 207, -1, 200, 25, -1, 172, 3,
1766 -1, 172, 5, -1, 172, 4, -1, 172, 6, -1,
1767 11, 26, -1, 11, 27, -1, 173, 9, -1, 169,
1768 152, 206, 38, 200, 153, -1, 117, 152, 206, 246,
1769 153, -1, 131, 152, 206, 155, 206, 155, 206, 153,
1770 -1, 167, 152, 206, 155, 206, 153, -1, 168, 152,
1771 206, 155, 206, 153, -1, 90, 170, 152, 206, 155,
1772 206, 153, -1, 91, 171, 152, 206, 155, 206, 153,
1773 -1, 133, 152, 206, 155, 206, 153, -1, 134, 152,
1774 206, 155, 206, 155, 206, 153, -1, 135, 152, 206,
1775 155, 206, 155, 206, 153, -1, 208, 155, 206, -1,
1776 206, -1, 32, -1, 33, -1, 37, -1, -1, 202,
1777 234, -1, 123, 152, 211, 38, 200, 153, -1, 213,
1778 -1, -1, 214, -1, 213, 214, -1, -1, 31, 215,
1779 230, -1, -1, 30, 216, 231, -1, 59, 58, 220,
1780 -1, 177, 18, 200, -1, 177, 18, 10, -1, -1,
1781 179, 183, 210, 209, 206, 176, 217, 197, -1, -1,
1782 179, 181, 183, 210, 209, 206, 176, 218, 197, -1,
1783 -1, 179, 182, 183, 210, 209, 200, 176, 219, 197,
1784 -1, 179, 183, 35, 186, 211, -1, 51, 221, -1,
1785 55, 154, 222, -1, 22, -1, 52, 154, 22, -1,
1786 67, 154, 22, -1, 158, 223, 160, -1, 223, 155,
1787 22, -1, 22, -1, -1, 224, 155, 200, 189, 175,
1788 -1, 200, 189, 175, -1, 224, -1, 224, 155, 39,
1789 -1, 39, -1, -1, 187, 202, 178, 152, 225, 153,
1790 191, 196, 193, 192, -1, 28, -1, 163, -1, 185,
1791 183, 226, 227, -1, 29, -1, 164, -1, 238, 229,
1792 -1, 184, 183, 226, -1, -1, 60, -1, 3, -1,
1793 4, -1, 9, -1, 26, -1, 27, -1, 40, -1,
1794 41, -1, 25, -1, 161, 208, 162, -1, 207, -1,
1795 58, 232, 22, 155, 22, -1, 7, -1, 8, -1,
1796 174, -1, 178, -1, 234, -1, 233, -1, 200, 235,
1797 -1, 236, -1, 237, 155, 236, -1, 238, 239, -1,
1798 228, 239, -1, 240, 177, 241, -1, 240, 243, -1,
1799 -1, 68, 38, 235, -1, 21, -1, 21, 68, 38,
1800 235, -1, 69, 237, -1, 69, 10, -1, 70, 17,
1801 235, -1, 70, 11, 235, 155, 17, 235, 155, 17,
1802 235, -1, 71, 172, 235, 155, 17, 235, 158, 242,
1803 160, -1, 71, 172, 235, 155, 17, 235, 158, 160,
1804 -1, 72, 187, 202, 235, 152, 245, 153, 191, 38,
1805 17, 235, 73, 17, 235, -1, 73, -1, 74, -1,
1806 242, 172, 233, 155, 17, 235, -1, 172, 233, 155,
1807 17, 235, -1, 177, 248, -1, 200, 158, 235, 155,
1808 235, 160, -1, 244, 155, 158, 235, 155, 235, 160,
1809 -1, 200, 189, 235, 189, -1, 17, 189, 235, 189,
1810 -1, 245, 155, 200, 189, 235, 189, -1, 245, 155,
1811 17, 189, 235, 189, -1, -1, -1, 246, 155, 236,
1812 -1, 57, 56, -1, 56, -1, 167, 200, 235, 155,
1813 235, -1, 168, 200, 235, 155, 235, -1, 90, 170,
1814 200, 235, 155, 235, -1, 91, 171, 200, 235, 155,
1815 235, -1, 169, 236, 38, 200, -1, 131, 236, 155,
1816 236, 155, 236, -1, 132, 236, 155, 200, -1, 133,
1817 236, 155, 236, -1, 134, 236, 155, 236, 155, 236,
1818 -1, 135, 236, 155, 236, 155, 236, -1, 130, 244,
1819 -1, 247, 187, 202, 235, 152, 245, 153, 191, -1,
1820 250, -1, 36, -1, -1, 112, 200, 194, -1, 112,
1821 200, 155, 11, 235, 194, -1, 113, 200, 194, -1,
1822 113, 200, 155, 11, 235, 194, -1, 114, 236, -1,
1823 249, 115, 200, 235, 194, -1, 249, 116, 236, 155,
Dan Gohmandecb8c02008-04-23 20:11:27 +00001824 200, 235, 194, -1, 136, 200, 235, 155, 4, -1,
Dan Gohman54392c12008-04-19 00:24:39 +00001825 117, 200, 235, 246, -1
1826};
1827
1828/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1829static const yytype_uint16 yyrline[] =
1830{
1831 0, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112,
1832 1112, 1113, 1113, 1113, 1113, 1113, 1113, 1114, 1114, 1114,
1833 1114, 1114, 1114, 1115, 1115, 1115, 1115, 1115, 1115, 1118,
1834 1118, 1119, 1119, 1120, 1120, 1121, 1121, 1122, 1122, 1126,
1835 1126, 1127, 1127, 1128, 1128, 1129, 1129, 1130, 1130, 1131,
1836 1131, 1132, 1132, 1133, 1134, 1139, 1140, 1140, 1140, 1140,
1837 1140, 1142, 1142, 1142, 1143, 1143, 1145, 1146, 1150, 1154,
1838 1159, 1159, 1161, 1162, 1167, 1173, 1174, 1175, 1176, 1177,
1839 1181, 1182, 1183, 1187, 1188, 1189, 1190, 1194, 1195, 1196,
1840 1200, 1201, 1202, 1203, 1204, 1208, 1209, 1210, 1213, 1214,
1841 1215, 1216, 1217, 1218, 1219, 1226, 1227, 1228, 1229, 1230,
1842 1231, 1232, 1233, 1234, 1235, 1239, 1240, 1245, 1246, 1247,
1843 1248, 1249, 1250, 1253, 1254, 1259, 1260, 1267, 1268, 1274,
1844 1275, 1284, 1292, 1293, 1298, 1299, 1300, 1305, 1318, 1318,
1845 1318, 1318, 1318, 1318, 1318, 1321, 1325, 1329, 1336, 1341,
Chris Lattner73de3c02008-04-23 05:37:08 +00001846 1349, 1378, 1403, 1408, 1418, 1428, 1432, 1442, 1449, 1458,
1847 1465, 1470, 1475, 1482, 1483, 1490, 1497, 1505, 1511, 1523,
1848 1551, 1567, 1594, 1622, 1648, 1668, 1694, 1714, 1726, 1733,
1849 1799, 1809, 1819, 1825, 1835, 1841, 1851, 1856, 1861, 1874,
1850 1886, 1908, 1916, 1922, 1933, 1938, 1943, 1949, 1955, 1964,
1851 1968, 1976, 1976, 1979, 1979, 1982, 1994, 2015, 2020, 2028,
1852 2029, 2033, 2033, 2037, 2037, 2040, 2043, 2067, 2079, 2078,
1853 2090, 2089, 2099, 2098, 2109, 2149, 2152, 2158, 2168, 2172,
1854 2177, 2179, 2184, 2189, 2198, 2208, 2219, 2223, 2232, 2241,
1855 2246, 2375, 2375, 2377, 2386, 2386, 2388, 2393, 2405, 2409,
1856 2414, 2418, 2422, 2426, 2430, 2434, 2438, 2442, 2446, 2471,
1857 2475, 2485, 2489, 2493, 2498, 2505, 2505, 2511, 2520, 2525,
1858 2530, 2534, 2543, 2552, 2561, 2565, 2569, 2574, 2581, 2588,
1859 2592, 2597, 2607, 2626, 2635, 2720, 2724, 2731, 2742, 2755,
1860 2765, 2776, 2786, 2797, 2805, 2815, 2822, 2825, 2826, 2833,
1861 2837, 2842, 2858, 2875, 2889, 2903, 2915, 2923, 2930, 2936,
1862 2942, 2948, 2963, 3053, 3058, 3062, 3069, 3076, 3084, 3091,
1863 3099, 3107, 3121, 3138, 3146
Dan Gohman54392c12008-04-19 00:24:39 +00001864};
1865#endif
1866
1867#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1868/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1869 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1870static const char *const yytname[] =
1871{
1872 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1873 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1874 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1875 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1876 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1877 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1878 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1879 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1880 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1881 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1882 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1883 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
1884 "DATALAYOUT", "UNWINDS", "RET", "BR", "SWITCH", "INVOKE", "UNWIND",
1885 "UNREACHABLE", "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM",
1886 "SREM", "FREM", "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP",
1887 "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1888 "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1889 "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1890 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1891 "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1892 "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
1893 "GETRESULT", "SIGNEXT", "ZEROEXT", "NORETURN", "INREG", "SRET",
1894 "NOUNWIND", "NOALIAS", "BYVAL", "NEST", "READNONE", "READONLY", "GC",
1895 "DEFAULT", "HIDDEN", "PROTECTED", "'('", "')'", "'='", "','", "'*'",
1896 "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'c'",
1897 "$accept", "ArithmeticOps", "LogicalOps", "CastOps", "IPredicates",
1898 "FPredicates", "IntType", "FPType", "LocalName", "OptLocalName",
1899 "OptAddrSpace", "OptLocalAssign", "GlobalName", "OptGlobalAssign",
1900 "GlobalAssign", "GVInternalLinkage", "GVExternalLinkage",
1901 "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage",
1902 "AliasLinkage", "OptCallingConv", "ParamAttr", "OptParamAttrs",
1903 "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign", "OptCAlign",
1904 "SectionString", "OptSection", "GlobalVarAttributes",
1905 "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
1906 "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
1907 "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
1908 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1909 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1910 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1911 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1912 "SymbolicValueRef", "ValueRef", "ResolvedVal", "ReturnedVal",
1913 "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst",
1914 "JumpTable", "Inst", "PHIList", "ParamList", "IndexList", "OptTailCall",
1915 "InstVal", "OptVolatile", "MemoryInst", 0
1916};
1917#endif
1918
1919# ifdef YYPRINT
1920/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1921 token YYLEX-NUM. */
1922static const yytype_uint16 yytoknum[] =
1923{
1924 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1925 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1926 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1927 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1928 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1929 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1930 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1931 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1932 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1933 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1934 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1935 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1936 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1937 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1938 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
1939 405, 406, 40, 41, 61, 44, 42, 92, 91, 120,
1940 93, 60, 62, 123, 125, 99
1941};
1942# endif
1943
1944/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1945static const yytype_uint8 yyr1[] =
1946{
1947 0, 166, 167, 167, 167, 167, 167, 167, 167, 167,
1948 167, 168, 168, 168, 168, 168, 168, 169, 169, 169,
1949 169, 169, 169, 169, 169, 169, 169, 169, 169, 170,
1950 170, 170, 170, 170, 170, 170, 170, 170, 170, 171,
1951 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
1952 171, 171, 171, 171, 171, 172, 173, 173, 173, 173,
1953 173, 174, 174, 174, 175, 175, 176, 176, 177, 177,
1954 178, 178, 179, 179, 180, 181, 181, 181, 181, 181,
1955 182, 182, 182, 183, 183, 183, 183, 184, 184, 184,
1956 185, 185, 185, 185, 185, 186, 186, 186, 187, 187,
1957 187, 187, 187, 187, 187, 188, 188, 188, 188, 188,
1958 188, 188, 188, 188, 188, 189, 189, 190, 190, 190,
1959 190, 190, 190, 191, 191, 192, 192, 193, 193, 194,
1960 194, 195, 196, 196, 197, 197, 198, 198, 199, 199,
1961 199, 199, 199, 199, 199, 200, 200, 200, 200, 200,
1962 200, 200, 200, 200, 200, 200, 200, 200, 201, 202,
1963 202, 203, 203, 204, 204, 204, 204, 205, 205, 206,
1964 206, 206, 206, 206, 206, 206, 206, 206, 206, 206,
1965 206, 206, 206, 206, 206, 206, 206, 206, 206, 207,
1966 207, 207, 207, 207, 207, 207, 207, 207, 207, 208,
1967 208, 209, 209, 210, 210, 211, 211, 212, 212, 213,
1968 213, 215, 214, 216, 214, 214, 214, 214, 217, 214,
1969 218, 214, 219, 214, 214, 214, 214, 220, 221, 221,
1970 222, 223, 223, 223, 224, 224, 225, 225, 225, 225,
1971 226, 227, 227, 228, 229, 229, 230, 231, 232, 232,
1972 233, 233, 233, 233, 233, 233, 233, 233, 233, 233,
1973 233, 234, 234, 234, 234, 235, 235, 236, 237, 237,
1974 238, 238, 239, 240, 240, 240, 240, 240, 241, 241,
1975 241, 241, 241, 241, 241, 241, 241, 242, 242, 243,
1976 244, 244, 245, 245, 245, 245, 245, 246, 246, 247,
1977 247, 248, 248, 248, 248, 248, 248, 248, 248, 248,
1978 248, 248, 248, 248, 249, 249, 250, 250, 250, 250,
1979 250, 250, 250, 250, 250
1980};
1981
1982/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1983static const yytype_uint8 yyr2[] =
1984{
1985 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1986 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1987 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1988 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1989 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1990 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1991 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
1992 1, 1, 1, 0, 2, 1, 1, 1, 1, 1,
1993 1, 1, 1, 0, 1, 1, 1, 0, 1, 1,
1994 0, 1, 1, 1, 1, 0, 1, 1, 0, 1,
1995 1, 1, 1, 1, 2, 1, 1, 1, 1, 1,
1996 1, 1, 1, 1, 2, 0, 2, 1, 1, 1,
1997 1, 1, 1, 0, 2, 0, 2, 0, 2, 0,
1998 3, 2, 0, 1, 0, 3, 1, 2, 1, 1,
1999 1, 1, 1, 1, 1, 1, 1, 3, 1, 2,
2000 5, 5, 5, 5, 3, 2, 5, 4, 2, 1,
2001 1, 1, 3, 1, 3, 1, 0, 1, 3, 4,
2002 3, 3, 4, 4, 3, 6, 5, 2, 2, 2,
2003 2, 2, 2, 2, 2, 2, 2, 2, 2, 6,
2004 5, 8, 6, 6, 7, 7, 6, 8, 8, 3,
2005 1, 1, 1, 1, 0, 2, 6, 1, 0, 1,
2006 2, 0, 3, 0, 3, 3, 3, 3, 0, 8,
2007 0, 9, 0, 9, 5, 2, 3, 1, 3, 3,
2008 3, 3, 1, 0, 5, 3, 1, 3, 1, 0,
2009 10, 1, 1, 4, 1, 1, 2, 3, 0, 1,
2010 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
2011 5, 1, 1, 1, 1, 1, 1, 2, 1, 3,
2012 2, 2, 3, 2, 0, 3, 1, 4, 2, 2,
2013 3, 9, 9, 8, 14, 1, 1, 6, 5, 2,
2014 6, 7, 4, 4, 6, 6, 0, 0, 3, 2,
2015 1, 5, 5, 6, 6, 4, 6, 4, 4, 6,
2016 6, 2, 8, 1, 1, 0, 3, 6, 3, 6,
2017 2, 5, 7, 5, 4
2018};
2019
2020/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2021 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2022 means the default is an error. */
2023static const yytype_uint16 yydefact[] =
2024{
2025 73, 61, 70, 62, 71, 63, 213, 211, 0, 0,
2026 0, 0, 0, 0, 83, 72, 0, 73, 209, 87,
2027 90, 0, 0, 225, 0, 0, 68, 0, 74, 75,
2028 77, 76, 78, 80, 79, 81, 82, 84, 85, 86,
2029 83, 83, 204, 1, 210, 88, 89, 83, 214, 91,
2030 92, 93, 94, 83, 274, 212, 274, 0, 0, 233,
2031 226, 227, 215, 261, 262, 217, 138, 139, 140, 143,
2032 142, 141, 144, 145, 0, 0, 0, 0, 263, 264,
2033 146, 216, 148, 204, 204, 95, 203, 0, 98, 98,
2034 276, 0, 271, 69, 244, 245, 246, 270, 228, 229,
2035 232, 0, 166, 149, 0, 0, 0, 0, 155, 167,
2036 0, 0, 166, 0, 0, 0, 97, 96, 0, 201,
2037 202, 0, 0, 99, 100, 101, 102, 103, 0, 247,
2038 0, 0, 0, 315, 273, 0, 230, 165, 115, 161,
2039 163, 0, 0, 0, 0, 0, 0, 154, 0, 0,
2040 147, 0, 0, 160, 0, 159, 0, 224, 138, 139,
2041 140, 143, 142, 141, 0, 0, 67, 67, 104, 0,
2042 241, 242, 243, 0, 250, 251, 252, 257, 253, 254,
2043 255, 256, 248, 2, 3, 4, 5, 6, 7, 8,
2044 9, 10, 14, 15, 16, 11, 12, 13, 0, 0,
2045 0, 17, 18, 19, 20, 21, 22, 23, 24, 25,
2046 26, 27, 28, 0, 0, 0, 0, 0, 0, 0,
2047 0, 259, 266, 265, 275, 314, 300, 0, 0, 0,
2048 0, 98, 285, 286, 0, 0, 0, 0, 0, 0,
2049 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2050 272, 98, 289, 0, 313, 231, 158, 0, 123, 67,
2051 67, 157, 0, 168, 0, 123, 67, 67, 0, 205,
2052 186, 187, 182, 184, 183, 185, 188, 181, 177, 178,
2053 0, 0, 0, 0, 180, 179, 218, 0, 277, 249,
2054 0, 29, 30, 31, 32, 33, 34, 35, 36, 37,
2055 38, 0, 53, 54, 49, 50, 51, 52, 39, 40,
2056 41, 42, 43, 44, 45, 46, 47, 48, 0, 0,
2057 0, 0, 0, 0, 200, 0, 0, 0, 0, 299,
2058 279, 67, 268, 278, 0, 0, 55, 0, 0, 0,
2059 0, 129, 129, 320, 67, 67, 311, 0, 0, 0,
2060 0, 0, 67, 67, 67, 0, 0, 0, 0, 0,
2061 106, 108, 107, 105, 109, 110, 111, 112, 113, 116,
2062 164, 162, 151, 152, 153, 156, 66, 150, 220, 222,
2063 0, 170, 0, 0, 0, 174, 0, 171, 134, 239,
2064 0, 0, 0, 297, 0, 0, 0, 0, 0, 258,
2065 0, 0, 0, 267, 0, 0, 280, 0, 0, 67,
2066 67, 0, 316, 0, 318, 297, 0, 0, 0, 0,
2067 0, 0, 0, 0, 0, 0, 0, 0, 67, 0,
2068 114, 120, 119, 117, 118, 121, 122, 124, 134, 134,
2069 0, 169, 155, 167, 0, 172, 173, 0, 219, 238,
2070 115, 236, 0, 0, 0, 0, 0, 0, 0, 0,
2071 0, 199, 0, 0, 0, 269, 0, 0, 0, 0,
2072 0, 0, 0, 0, 324, 0, 0, 0, 307, 308,
2073 0, 0, 0, 0, 0, 305, 0, 129, 0, 221,
2074 223, 67, 176, 0, 0, 0, 136, 134, 65, 0,
2075 123, 260, 0, 0, 190, 0, 0, 0, 0, 0,
2076 0, 0, 67, 0, 0, 296, 0, 0, 129, 130,
2077 129, 0, 0, 0, 0, 0, 323, 301, 302, 296,
2078 0, 321, 67, 206, 175, 131, 137, 135, 64, 235,
2079 237, 115, 132, 0, 0, 298, 0, 196, 0, 0,
2080 192, 193, 189, 0, 0, 115, 115, 0, 303, 304,
2081 317, 319, 0, 0, 306, 309, 310, 0, 129, 65,
2082 133, 127, 194, 195, 0, 0, 0, 0, 0, 0,
2083 0, 123, 0, 290, 0, 123, 322, 234, 0, 125,
2084 191, 197, 198, 0, 283, 0, 0, 106, 108, 115,
2085 115, 0, 115, 115, 291, 312, 128, 0, 240, 281,
2086 0, 282, 0, 293, 292, 0, 0, 0, 126, 0,
2087 0, 0, 115, 115, 0, 0, 0, 295, 294, 288,
2088 0, 0, 287, 0, 284
2089};
2090
2091/* YYDEFGOTO[NTERM-NUM]. */
2092static const yytype_int16 yydefgoto[] =
2093{
2094 -1, 218, 219, 220, 301, 318, 164, 165, 78, 539,
2095 113, 12, 79, 14, 15, 40, 41, 42, 47, 53,
2096 118, 128, 369, 256, 437, 372, 608, 589, 412, 496,
2097 571, 448, 497, 80, 166, 139, 156, 140, 141, 110,
2098 324, 221, 325, 121, 87, 157, 16, 17, 18, 20,
2099 19, 388, 438, 439, 62, 23, 60, 101, 451, 452,
2100 129, 172, 54, 96, 55, 48, 290, 222, 82, 224,
2101 332, 333, 56, 92, 93, 250, 596, 134, 346, 557,
2102 456, 251, 252, 253, 254
2103};
2104
2105/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2106 STATE-NUM. */
Dan Gohmandecb8c02008-04-23 20:11:27 +00002107#define YYPACT_NINF -536
Dan Gohman54392c12008-04-19 00:24:39 +00002108static const yytype_int16 yypact[] =
2109{
Dan Gohmandecb8c02008-04-23 20:11:27 +00002110 369, -536, -536, -536, -536, -536, -536, -536, 39, -128,
2111 -20, -82, 67, -9, 258, -536, 177, 506, -536, 239,
2112 226, 57, 78, -536, 22, 214, -536, 1572, -536, -536,
2113 -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,
2114 -35, -35, 244, -536, -536, -536, -536, -35, -536, -536,
2115 -536, -536, -536, -35, 15, -536, -2, 221, 232, 235,
2116 -536, -536, -536, -536, -536, 99, -536, -536, -536, -536,
2117 -536, -536, -536, -536, 262, 268, 8, 35, -536, -536,
2118 -536, -26, -536, 225, 225, 265, -536, 128, 233, 233,
2119 208, 254, -536, 256, -536, -536, -536, -536, -536, -536,
2120 -536, -22, 1126, -536, 161, 165, 815, 99, -536, -26,
2121 -91, 174, 1126, 171, 128, 128, -536, -536, 1372, -536,
2122 -536, 1612, 324, -536, -536, -536, -536, -536, 1652, -536,
2123 -6, 293, 906, 1867, -536, 313, -536, -536, -26, -536,
2124 181, 184, 1692, 1692, 179, -84, 1692, -536, 338, 190,
2125 -536, 1612, 1692, 99, 192, -26, 410, -536, 223, 336,
2126 343, 347, 351, 352, 204, 353, 1182, 309, -536, 126,
2127 -536, -536, -536, 906, -536, -536, -536, -536, -536, -536,
2128 -536, -536, 304, -536, -536, -536, -536, -536, -536, -536,
2129 -536, -536, -536, -536, -536, -536, -536, -536, 511, 491,
2130 216, -536, -536, -536, -536, -536, -536, -536, -536, -536,
2131 -536, -536, -536, 218, 219, 220, 222, 1612, 231, 234,
2132 238, -536, -536, -536, -536, -536, -536, 310, 1732, 50,
2133 364, 233, -536, -536, 511, 491, 1692, 1692, 1692, 1692,
Dan Gohman54392c12008-04-19 00:24:39 +00002134 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692,
Dan Gohmandecb8c02008-04-23 20:11:27 +00002135 -536, 233, -536, 79, -536, -536, 210, 1452, -536, -25,
2136 -31, -536, 242, -26, 252, -536, 309, 2, 1372, -536,
2137 -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,
2138 1412, 1772, 855, 362, -536, -536, -536, 259, -536, -536,
2139 363, -536, -536, -536, -536, -536, -536, -536, -536, -536,
2140 -536, 260, -536, -536, -536, -536, -536, -536, -536, -536,
2141 -536, -536, -536, -536, -536, -536, -536, -536, 263, 1612,
2142 1612, 1612, 1612, 1612, -536, -42, 1612, 1612, 1612, -536,
2143 99, 766, -536, 255, 906, 906, -536, 906, 1652, 1692,
2144 1692, 20, 45, -536, 766, -29, 264, 270, 271, 272,
2145 276, 281, 766, 766, 766, 385, 1652, 1692, 1692, 433,
2146 -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,
2147 -536, -536, -37, -536, -536, -536, -536, -37, -536, 171,
2148 404, -536, -7, 1080, -30, -536, -66, -536, 290, 1492,
2149 294, 1612, 1612, -536, 295, 297, 298, 299, 1612, -536,
2150 300, 305, 421, -536, 1692, 306, -536, 308, 906, 766,
2151 766, 10, -536, 26, -536, -536, 906, 311, 1692, 1692,
2152 1692, 1692, 1692, 315, 316, 317, 1692, 906, 766, 318,
2153 -536, -536, -536, -536, -536, -536, -536, -536, 290, 290,
2154 1692, -536, 312, 1035, -47, -536, -536, 42, -536, -536,
2155 -26, 321, 325, 444, 322, 327, 133, 1612, 1612, 1612,
2156 1612, -536, 1612, 1612, 1692, -536, 462, 463, 331, 329,
2157 330, 906, 482, 906, 332, 333, 906, 334, -26, -536,
2158 335, 337, 490, 906, 906, -26, 344, 340, 1692, -536,
2159 -536, 38, -536, 341, 475, 498, -536, 290, 115, 1532,
2160 -536, -536, 1612, 1612, -536, 1692, 349, 354, 356, 360,
2161 355, 366, 53, 906, 906, 1812, 906, 906, 340, -536,
2162 340, 906, 361, 1692, 1692, 1692, -536, -536, -536, 1812,
2163 468, -536, 766, -536, -536, -536, -536, -536, -536, -536,
2164 -536, -26, 5, 374, 380, -536, 1612, -536, 1612, 1612,
2165 -536, -536, -536, 367, 376, 33, -26, 166, -536, -536,
2166 -536, -536, 375, 906, -536, -536, -536, 170, 340, 115,
2167 -536, 485, -536, -536, 386, 387, 388, 525, 3, 623,
2168 623, -536, 1852, -536, 383, -536, -536, -536, 540, 397,
2169 -536, -536, -536, 906, -536, 1323, 7, 396, 398, -536,
2170 -536, 27, 33, -26, -536, -37, -536, 527, -536, -536,
2171 400, -536, 1323, 210, 210, 535, 623, 623, -536, 536,
2172 401, 906, -536, -536, 906, 542, 489, 210, 210, -536,
2173 906, 547, -536, 906, -536
Dan Gohman54392c12008-04-19 00:24:39 +00002174};
2175
2176/* YYPGOTO[NTERM-NUM]. */
2177static const yytype_int16 yypgoto[] =
2178{
Dan Gohmandecb8c02008-04-23 20:11:27 +00002179 -536, 434, 435, 437, 339, 346, -229, -536, 0, -3,
2180 -126, 478, 13, -536, -536, -536, -536, 28, -536, -536,
2181 -536, -207, -536, -444, -536, -263, -536, -536, -337, 30,
2182 -536, -407, -536, -536, -24, 319, -108, -536, 466, 473,
2183 -81, -150, -247, 88, 229, 314, -536, -536, 557, -536,
2184 -536, -536, -536, -536, -536, -536, -536, -536, -536, -536,
2185 494, -536, -536, -536, -536, -536, -536, -535, -70, 104,
2186 -234, -536, -536, 528, -536, -536, -536, -536, -536, 56,
2187 198, -536, -536, -536, -536
Dan Gohman54392c12008-04-19 00:24:39 +00002188};
2189
2190/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2191 positive, shift that token. If negative, reduce the rule which
2192 number is the opposite. If zero, do what YYDEFACT says.
2193 If YYTABLE_NINF, syntax error. */
2194#define YYTABLE_NINF -209
2195static const yytype_int16 yytable[] =
2196{
2197 11, 337, 377, 81, 343, 414, 498, 347, 348, 349,
2198 350, 351, 105, 13, 336, 355, 284, 11, 336, 90,
Dan Gohmandecb8c02008-04-23 20:11:27 +00002199 169, 471, 170, 111, 338, 111, 24, 94, 111, 111,
2200 13, 489, 490, 382, 384, 386, 90, 473, 25, 494,
2201 167, 286, 63, 64, 356, 107, 66, 67, 68, 69,
Dan Gohman54392c12008-04-19 00:24:39 +00002202 70, 71, 72, 109, 1, 2, 111, 3, 4, 5,
Dan Gohmandecb8c02008-04-23 20:11:27 +00002203 610, 334, 223, 472, 146, 615, 91, 335, 83, 84,
2204 266, 146, 26, 147, 111, 88, 494, 620, 138, 472,
2205 262, 89, 109, 91, 73, 27, 269, -144, 138, 398,
2206 537, 21, 111, 11, 155, 495, 285, 569, 446, 111,
2207 431, 432, 433, 223, 155, 434, 22, 111, 398, 435,
2208 436, 579, 580, 398, 37, 38, 39, 493, 259, 260,
2209 399, 112, 263, 112, 429, 398, 112, 112, 267, 416,
2210 -67, 374, 445, 135, 1, 373, 444, 3, 136, 5,
2211 378, 379, 431, 432, 433, 28, 2, 434, 398, 4,
2212 531, 435, 436, 441, 112, 613, 614, 171, 616, 617,
2213 119, 120, 95, 594, 431, 432, 433, 611, 359, 434,
2214 465, 106, 112, 435, 436, 411, -67, 43, 627, 628,
2215 59, 560, 287, 561, 477, -144, 479, 480, 481, -144,
2216 112, 533, 74, 75, 357, 358, 76, 112, 77, 108,
2217 413, -67, 151, 152, 331, 112, 552, 272, 273, 274,
2218 275, 57, 341, 342, 331, 344, 345, 331, 331, 331,
Dan Gohman54392c12008-04-19 00:24:39 +00002219 331, 331, 352, 353, 354, 331, -55, -55, -55, -55,
Dan Gohmandecb8c02008-04-23 20:11:27 +00002220 408, 586, 58, 138, 360, 361, 61, 542, 393, 394,
2221 395, 396, 397, 98, 155, 400, 401, 402, 427, 270,
2222 271, 102, 362, 363, 99, 364, 365, 100, 366, 367,
2223 368, 223, 86, 359, 223, 223, 103, 223, 49, 50,
2224 51, 545, 104, 52, 223, 1, 131, 288, 3, 85,
2225 5, 86, 223, 223, 223, 45, 504, 46, 505, 564,
2226 565, 566, 132, 284, 122, 123, 124, 125, 126, 127,
2227 29, 30, 31, 32, 33, 34, 35, 116, 36, 117,
2228 454, 455, 114, 115, 155, 409, 410, 461, 601, 581,
2229 142, 582, 605, 585, 143, 582, 148, 150, 168, 360,
2230 361, 173, 155, 428, 331, 255, 257, 258, 223, 223,
2231 223, 261, 264, 265, 268, -56, 223, 362, 363, 595,
2232 364, 365, -57, 366, 367, 368, -60, 223, 223, 443,
2233 -59, -58, 276, 111, 289, 450, 329, 612, 319, -208,
2234 320, 321, 322, 285, 323, 336, 506, 507, 508, 509,
2235 331, 510, 511, 326, 387, 390, 327, -69, 1, 2,
2236 328, 3, 4, 5, 331, 478, 331, 331, 331, 6,
2237 7, 223, 485, 223, 375, 376, 223, 37, 38, 39,
2238 404, 389, 391, 223, 223, 392, 491, 63, 64, 417,
2239 8, 543, 544, 426, 9, 418, 419, 420, 10, 1,
2240 2, 421, 3, 4, 5, 403, 422, 430, 405, 406,
2241 512, 407, 440, 223, 223, 447, 223, 223, 415, 453,
2242 457, 223, 458, 459, 460, 462, 423, 424, 425, 464,
2243 463, 466, 223, 467, 532, 574, 501, 575, 576, 476,
2244 482, 483, 484, 488, 492, 541, 499, 502, 500, 513,
2245 514, 331, 503, 515, 516, 517, 519, 505, 521, 523,
2246 524, 556, 525, 223, 526, 530, 529, 535, 538, 331,
2247 331, 331, 536, 534, 546, 556, -207, 547, 550, 223,
2248 223, 548, 468, 469, 470, 549, 563, 302, 303, 551,
2249 475, 472, 577, 223, -69, 1, 2, 572, 3, 4,
2250 5, 486, 487, 573, 578, 583, 6, 7, 588, 590,
2251 591, 592, 593, 604, 606, 607, 223, 223, -18, 618,
2252 -19, 223, 621, 624, 223, 619, 625, 8, 603, 630,
2253 223, 9, 631, 223, 633, 10, 587, 247, 248, 538,
2254 249, 133, 570, 339, 44, 518, 371, 520, 149, 145,
2255 522, 340, 380, 130, 97, 567, 0, 527, 528, 304,
Dan Gohman54392c12008-04-19 00:24:39 +00002256 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
2257 315, 316, 317, 291, 292, 293, 294, 295, 296, 297,
Dan Gohmandecb8c02008-04-23 20:11:27 +00002258 298, 299, 300, 474, 0, 0, 0, 553, 554, 0,
2259 558, 559, 0, 0, 0, 562, 174, 175, 0, 0,
Dan Gohman54392c12008-04-19 00:24:39 +00002260 63, 64, 176, 0, 0, 0, 568, 0, 0, 0,
2261 0, 0, 1, 2, 0, 3, 4, 5, 177, 178,
2262 179, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2263 0, 0, 0, 180, 181, 0, 0, 584, 0, 0,
2264 0, 0, 0, 0, 0, 0, 359, 0, 0, 0,
2265 0, 182, 0, 599, 600, 0, 0, 0, 0, 0,
2266 0, 0, 0, 0, 0, 0, 0, 609, 183, 184,
2267 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
2268 195, 196, 197, 198, 199, 0, 0, 0, 0, 0,
2269 622, 623, 0, 0, 0, 626, 0, 0, 629, 0,
2270 0, 0, 0, 0, 632, 0, 0, 634, 0, 0,
2271 200, 201, 597, 598, 204, 205, 206, 207, 208, 209,
2272 210, 211, 212, 0, 213, 0, 214, 215, 216, 0,
2273 362, 363, 0, 364, 365, 0, 366, 367, 368, 174,
2274 175, 0, 0, 63, 64, 176, 0, 0, 0, 0,
2275 0, 0, 0, 0, 217, 1, 2, 0, 3, 4,
2276 5, 177, 178, 179, 0, 0, 0, 0, 0, 0,
2277 0, 0, 0, 0, 0, 0, 180, 181, 0, 0,
2278 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2279 111, 0, 63, 64, 182, 107, 66, 67, 68, 69,
2280 70, 71, 72, 0, 1, 2, 0, 3, 4, 5,
2281 0, 183, 184, 185, 186, 187, 188, 189, 190, 191,
2282 192, 193, 194, 195, 196, 197, 198, 199, 0, 0,
2283 0, 0, 63, 64, 73, 107, 158, 159, 160, 161,
2284 162, 163, 72, 0, 1, 2, 0, 3, 4, 5,
2285 0, 0, 0, 200, 201, 202, 203, 204, 205, 206,
2286 207, 208, 209, 210, 211, 212, 0, 213, 0, 214,
2287 215, 216, 0, 0, 73, 0, 0, 0, 0, 174,
2288 175, 0, 0, 63, 64, 176, 0, 0, 112, 0,
2289 0, 0, 0, 0, 0, 1, 2, 217, 3, 4,
2290 5, 177, 178, 179, 0, 0, 0, 0, 0, 0,
2291 0, 0, 0, 0, 0, 0, 180, 181, 0, 0,
2292 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2293 0, 0, 0, 0, 182, 0, 0, 0, 0, 0,
2294 0, 0, 74, 75, 0, 0, 76, 0, 77, 144,
2295 0, 183, 184, 185, 186, 187, 188, 189, 190, 191,
2296 192, 193, 194, 195, 196, 197, 198, 199, 0, 0,
2297 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2298 0, 0, 74, 75, 0, 0, 76, 0, 77, 385,
2299 0, 0, 0, 200, 201, 202, 203, 204, 205, 206,
2300 207, 208, 209, 210, 211, 212, 0, 213, 0, 214,
2301 215, 216, 63, 64, 0, 0, 0, 0, 0, 0,
2302 0, 0, 0, 0, 1, 2, 0, 3, 4, 5,
2303 277, 0, 0, 0, 0, 0, 0, 217, 0, 0,
2304 0, 0, 0, 0, 0, 278, 279, 0, 0, 0,
2305 0, 0, 0, 0, 0, 0, 0, 63, 64, 111,
2306 107, 158, 159, 160, 161, 162, 163, 72, 0, 1,
2307 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2308 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
2309 193, 194, 195, 196, 197, 198, 199, 0, 0, 73,
2310 0, 0, 0, 63, 64, 0, 107, 66, 67, 68,
2311 69, 70, 71, 72, 0, 1, 2, 0, 3, 4,
2312 5, 0, 200, 201, 202, 203, 204, 205, 206, 207,
2313 208, 209, 210, 211, 212, 137, 213, 0, 214, 215,
2314 216, 0, 0, 0, 0, 73, 0, 0, 0, 0,
2315 0, 0, 0, 0, 0, 0, 0, 112, 0, 63,
2316 64, -67, 0, 280, 0, 0, 281, 0, 282, 0,
2317 283, 1, 2, 0, 3, 4, 5, 277, 0, 0,
2318 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2319 0, 0, 278, 279, 0, 0, 0, 0, 0, 0,
2320 0, 0, 0, 0, 0, 0, 111, 74, 75, 0,
2321 0, 76, 0, 77, 442, 0, 0, 0, 0, 0,
2322 0, 0, 0, 0, 0, 0, 0, 183, 184, 185,
2323 186, 187, 188, 189, 190, 191, 192, 193, 194, 195,
2324 196, 197, 198, 199, 0, 0, 0, 0, 0, 0,
2325 0, 0, 0, 74, 75, 0, 0, 76, 0, 77,
2326 0, 0, 0, 0, 0, 0, 0, 0, 0, 200,
2327 201, 202, 203, 204, 205, 206, 207, 208, 209, 210,
2328 211, 212, 0, 213, 0, 214, 215, 216, 0, 0,
2329 0, 0, 0, 0, 0, 0, 174, 175, 0, 0,
2330 0, 0, 176, 0, 112, 0, 0, 0, 0, 0,
2331 280, 0, 0, 281, 0, 282, 0, 283, 177, 178,
2332 179, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2333 0, 0, 0, 180, 181, 0, 0, 0, 0, 0,
2334 0, 0, 0, 0, 0, 0, 0, 0, 0, 63,
2335 64, 182, 153, 66, 67, 68, 69, 70, 71, 72,
2336 0, 1, 2, 0, 3, 4, 5, 0, 183, 184,
2337 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
2338 195, 196, 197, 198, 199, 0, 0, 0, 0, 63,
2339 64, 73, 107, 158, 159, 160, 161, 162, 163, 72,
2340 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2341 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
2342 210, 211, 212, 0, 213, 0, 214, 215, 216, 63,
2343 64, 73, 107, 66, 67, 68, 69, 70, 71, 72,
2344 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2345 0, 0, 0, 0, 217, 0, 0, 0, 0, 0,
2346 0, 370, 0, 0, 0, 154, 0, 0, 0, 63,
2347 64, 73, 107, 66, 67, 68, 69, 70, 71, 72,
2348 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2349 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2350 75, 449, 0, 76, 0, 77, 0, 0, 0, 63,
2351 64, 73, 107, 66, 67, 68, 69, 70, 71, 72,
2352 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2353 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2354 75, 540, 381, 76, 0, 77, 0, 0, 0, 63,
2355 64, 73, 65, 66, 67, 68, 69, 70, 71, 72,
2356 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2357 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2358 75, 0, 0, 76, 0, 77, 0, 0, 0, 63,
2359 64, 73, 107, 158, 159, 160, 161, 162, 163, 72,
2360 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2361 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2362 75, 0, 0, 76, 0, 77, 0, 0, 0, 63,
2363 64, 73, 153, 66, 67, 68, 69, 70, 71, 72,
2364 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2365 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2366 75, 0, 0, 76, 0, 77, 0, 0, 0, 63,
2367 64, 73, 107, 66, 67, 68, 69, 70, 71, 72,
2368 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2369 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2370 75, 0, 0, 76, 0, 77, 0, 0, 0, 63,
2371 64, 73, 330, 66, 67, 68, 69, 70, 71, 72,
2372 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2373 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2374 75, 0, 0, 76, 0, 77, 0, 0, 0, 63,
2375 64, 73, 107, 158, 159, 160, 161, 162, 163, 72,
2376 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2377 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2378 75, 0, 0, 76, 0, 77, 0, 0, 0, 63,
2379 64, 73, 107, 66, 67, 68, 69, 70, 71, 555,
2380 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2381 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2382 75, 0, 0, 76, 0, 77, 0, 0, 0, 63,
2383 64, 73, 107, 66, 67, 68, 69, 70, 71, 602,
2384 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2385 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2386 75, 0, 0, 76, 0, 77, 0, 0, 0, 0,
2387 0, 73, 0, 225, 0, 0, 0, 0, 0, 0,
2388 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2389 0, 0, 0, 226, 227, 0, 0, 0, 0, 74,
2390 75, 0, 0, 76, 0, 383, 228, 229, 230, 231,
2391 232, 233, 183, 184, 185, 186, 187, 188, 189, 190,
2392 191, 192, 193, 194, 195, 196, 197, 234, 235, 0,
2393 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2394 75, 0, 0, 76, 0, 77, 0, 0, 0, 236,
2395 237, 238, 0, 0, 239, 201, 202, 203, 204, 205,
2396 206, 207, 208, 209, 210, 211, 212, 240, 241, 242,
2397 243, 244, 245, 246, 0, 0, 0, 0, 0, 74,
2398 75, 0, 0, 76, 0, 77
2399};
2400
2401static const yytype_int16 yycheck[] =
2402{
2403 0, 230, 265, 27, 238, 342, 450, 241, 242, 243,
2404 244, 245, 4, 0, 11, 249, 166, 17, 11, 21,
Dan Gohmandecb8c02008-04-23 20:11:27 +00002405 128, 11, 28, 54, 231, 54, 154, 29, 54, 54,
2406 17, 438, 439, 280, 281, 282, 21, 11, 58, 34,
2407 121, 167, 7, 8, 251, 10, 11, 12, 13, 14,
Dan Gohman54392c12008-04-19 00:24:39 +00002408 15, 16, 17, 77, 19, 20, 54, 22, 23, 24,
Dan Gohmandecb8c02008-04-23 20:11:27 +00002409 595, 11, 132, 53, 155, 38, 68, 17, 40, 41,
2410 151, 155, 154, 164, 54, 47, 34, 612, 102, 53,
2411 164, 53, 106, 68, 49, 18, 156, 54, 112, 155,
2412 497, 52, 54, 93, 118, 53, 166, 541, 164, 54,
2413 137, 138, 139, 173, 128, 142, 67, 54, 155, 146,
2414 147, 555, 556, 155, 149, 150, 151, 164, 142, 143,
2415 162, 152, 146, 152, 358, 155, 152, 152, 152, 158,
2416 156, 162, 162, 155, 19, 160, 383, 22, 160, 24,
2417 266, 267, 137, 138, 139, 154, 20, 142, 155, 23,
2418 487, 146, 147, 160, 152, 599, 600, 163, 602, 603,
2419 32, 33, 164, 160, 137, 138, 139, 160, 53, 142,
2420 404, 163, 152, 146, 147, 155, 156, 0, 622, 623,
2421 158, 518, 169, 520, 418, 152, 420, 421, 422, 156,
2422 152, 153, 157, 158, 115, 116, 161, 152, 163, 164,
2423 155, 156, 114, 115, 228, 152, 153, 3, 4, 5,
2424 6, 154, 236, 237, 238, 239, 240, 241, 242, 243,
Dan Gohman54392c12008-04-19 00:24:39 +00002425 244, 245, 246, 247, 248, 249, 3, 4, 5, 6,
Dan Gohmandecb8c02008-04-23 20:11:27 +00002426 338, 568, 154, 257, 119, 120, 22, 500, 319, 320,
Dan Gohman54392c12008-04-19 00:24:39 +00002427 321, 322, 323, 22, 268, 326, 327, 328, 356, 26,
Dan Gohmandecb8c02008-04-23 20:11:27 +00002428 27, 152, 137, 138, 22, 140, 141, 22, 143, 144,
2429 145, 331, 37, 53, 334, 335, 4, 337, 42, 43,
2430 44, 505, 4, 47, 344, 19, 68, 173, 22, 35,
2431 24, 37, 352, 353, 354, 46, 153, 48, 155, 523,
2432 524, 525, 38, 443, 61, 62, 63, 64, 65, 66,
2433 42, 43, 44, 45, 46, 47, 48, 42, 50, 44,
2434 391, 392, 83, 84, 338, 339, 340, 398, 581, 153,
2435 159, 155, 585, 153, 159, 155, 152, 156, 4, 119,
2436 120, 38, 356, 357, 358, 22, 155, 153, 408, 409,
2437 410, 162, 4, 153, 152, 9, 416, 137, 138, 578,
2438 140, 141, 9, 143, 144, 145, 9, 427, 428, 383,
2439 9, 9, 9, 54, 60, 389, 56, 596, 152, 0,
2440 152, 152, 152, 443, 152, 11, 457, 458, 459, 460,
2441 404, 462, 463, 152, 22, 22, 152, 18, 19, 20,
2442 152, 22, 23, 24, 418, 419, 420, 421, 422, 30,
2443 31, 471, 426, 473, 162, 153, 476, 149, 150, 151,
2444 155, 152, 152, 483, 484, 152, 440, 7, 8, 155,
2445 51, 502, 503, 38, 55, 155, 155, 155, 59, 19,
2446 20, 155, 22, 23, 24, 331, 155, 4, 334, 335,
2447 464, 337, 38, 513, 514, 155, 516, 517, 344, 155,
2448 155, 521, 155, 155, 155, 155, 352, 353, 354, 38,
2449 155, 155, 532, 155, 488, 546, 22, 548, 549, 158,
2450 155, 155, 155, 155, 162, 499, 155, 155, 153, 17,
2451 17, 505, 155, 152, 155, 155, 4, 155, 155, 155,
2452 155, 515, 155, 563, 4, 155, 152, 22, 498, 523,
2453 524, 525, 4, 162, 155, 529, 0, 153, 153, 579,
2454 580, 155, 408, 409, 410, 155, 155, 26, 27, 153,
2455 416, 53, 155, 593, 18, 19, 20, 153, 22, 23,
2456 24, 427, 428, 153, 158, 160, 30, 31, 53, 153,
2457 153, 153, 17, 160, 4, 148, 616, 617, 152, 22,
2458 152, 621, 17, 17, 624, 155, 155, 51, 582, 17,
2459 630, 55, 73, 633, 17, 59, 569, 133, 133, 569,
2460 133, 93, 542, 234, 17, 471, 257, 473, 112, 106,
2461 476, 235, 268, 89, 56, 529, -1, 483, 484, 98,
Dan Gohman54392c12008-04-19 00:24:39 +00002462 99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
2463 109, 110, 111, 92, 93, 94, 95, 96, 97, 98,
Dan Gohmandecb8c02008-04-23 20:11:27 +00002464 99, 100, 101, 415, -1, -1, -1, 513, 514, -1,
2465 516, 517, -1, -1, -1, 521, 3, 4, -1, -1,
Dan Gohman54392c12008-04-19 00:24:39 +00002466 7, 8, 9, -1, -1, -1, 532, -1, -1, -1,
2467 -1, -1, 19, 20, -1, 22, 23, 24, 25, 26,
2468 27, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2469 -1, -1, -1, 40, 41, -1, -1, 563, -1, -1,
2470 -1, -1, -1, -1, -1, -1, 53, -1, -1, -1,
2471 -1, 58, -1, 579, 580, -1, -1, -1, -1, -1,
2472 -1, -1, -1, -1, -1, -1, -1, 593, 75, 76,
2473 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2474 87, 88, 89, 90, 91, -1, -1, -1, -1, -1,
2475 616, 617, -1, -1, -1, 621, -1, -1, 624, -1,
2476 -1, -1, -1, -1, 630, -1, -1, 633, -1, -1,
2477 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
2478 127, 128, 129, -1, 131, -1, 133, 134, 135, -1,
2479 137, 138, -1, 140, 141, -1, 143, 144, 145, 3,
2480 4, -1, -1, 7, 8, 9, -1, -1, -1, -1,
2481 -1, -1, -1, -1, 161, 19, 20, -1, 22, 23,
2482 24, 25, 26, 27, -1, -1, -1, -1, -1, -1,
2483 -1, -1, -1, -1, -1, -1, 40, 41, -1, -1,
2484 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2485 54, -1, 7, 8, 58, 10, 11, 12, 13, 14,
2486 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2487 -1, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2488 84, 85, 86, 87, 88, 89, 90, 91, -1, -1,
2489 -1, -1, 7, 8, 49, 10, 11, 12, 13, 14,
2490 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2491 -1, -1, -1, 117, 118, 119, 120, 121, 122, 123,
2492 124, 125, 126, 127, 128, 129, -1, 131, -1, 133,
2493 134, 135, -1, -1, 49, -1, -1, -1, -1, 3,
2494 4, -1, -1, 7, 8, 9, -1, -1, 152, -1,
2495 -1, -1, -1, -1, -1, 19, 20, 161, 22, 23,
2496 24, 25, 26, 27, -1, -1, -1, -1, -1, -1,
2497 -1, -1, -1, -1, -1, -1, 40, 41, -1, -1,
2498 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2499 -1, -1, -1, -1, 58, -1, -1, -1, -1, -1,
2500 -1, -1, 157, 158, -1, -1, 161, -1, 163, 164,
2501 -1, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2502 84, 85, 86, 87, 88, 89, 90, 91, -1, -1,
2503 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2504 -1, -1, 157, 158, -1, -1, 161, -1, 163, 164,
2505 -1, -1, -1, 117, 118, 119, 120, 121, 122, 123,
2506 124, 125, 126, 127, 128, 129, -1, 131, -1, 133,
2507 134, 135, 7, 8, -1, -1, -1, -1, -1, -1,
2508 -1, -1, -1, -1, 19, 20, -1, 22, 23, 24,
2509 25, -1, -1, -1, -1, -1, -1, 161, -1, -1,
2510 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
2511 -1, -1, -1, -1, -1, -1, -1, 7, 8, 54,
2512 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2513 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2514 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2515 85, 86, 87, 88, 89, 90, 91, -1, -1, 49,
2516 -1, -1, -1, 7, 8, -1, 10, 11, 12, 13,
2517 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2518 24, -1, 117, 118, 119, 120, 121, 122, 123, 124,
2519 125, 126, 127, 128, 129, 39, 131, -1, 133, 134,
2520 135, -1, -1, -1, -1, 49, -1, -1, -1, -1,
2521 -1, -1, -1, -1, -1, -1, -1, 152, -1, 7,
2522 8, 156, -1, 158, -1, -1, 161, -1, 163, -1,
2523 165, 19, 20, -1, 22, 23, 24, 25, -1, -1,
2524 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2525 -1, -1, 40, 41, -1, -1, -1, -1, -1, -1,
2526 -1, -1, -1, -1, -1, -1, 54, 157, 158, -1,
2527 -1, 161, -1, 163, 164, -1, -1, -1, -1, -1,
2528 -1, -1, -1, -1, -1, -1, -1, 75, 76, 77,
2529 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2530 88, 89, 90, 91, -1, -1, -1, -1, -1, -1,
2531 -1, -1, -1, 157, 158, -1, -1, 161, -1, 163,
2532 -1, -1, -1, -1, -1, -1, -1, -1, -1, 117,
2533 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2534 128, 129, -1, 131, -1, 133, 134, 135, -1, -1,
2535 -1, -1, -1, -1, -1, -1, 3, 4, -1, -1,
2536 -1, -1, 9, -1, 152, -1, -1, -1, -1, -1,
2537 158, -1, -1, 161, -1, 163, -1, 165, 25, 26,
2538 27, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2539 -1, -1, -1, 40, 41, -1, -1, -1, -1, -1,
2540 -1, -1, -1, -1, -1, -1, -1, -1, -1, 7,
2541 8, 58, 10, 11, 12, 13, 14, 15, 16, 17,
2542 -1, 19, 20, -1, 22, 23, 24, -1, 75, 76,
2543 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2544 87, 88, 89, 90, 91, -1, -1, -1, -1, 7,
2545 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2546 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2547 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
2548 127, 128, 129, -1, 131, -1, 133, 134, 135, 7,
2549 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2550 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2551 -1, -1, -1, -1, 161, -1, -1, -1, -1, -1,
2552 -1, 39, -1, -1, -1, 123, -1, -1, -1, 7,
2553 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2554 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2555 -1, -1, -1, -1, -1, -1, -1, -1, -1, 157,
2556 158, 39, -1, 161, -1, 163, -1, -1, -1, 7,
2557 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2558 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2559 -1, -1, -1, -1, -1, -1, -1, -1, -1, 157,
2560 158, 39, 160, 161, -1, 163, -1, -1, -1, 7,
2561 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2562 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2563 -1, -1, -1, -1, -1, -1, -1, -1, -1, 157,
2564 158, -1, -1, 161, -1, 163, -1, -1, -1, 7,
2565 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2566 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2567 -1, -1, -1, -1, -1, -1, -1, -1, -1, 157,
2568 158, -1, -1, 161, -1, 163, -1, -1, -1, 7,
2569 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2570 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2571 -1, -1, -1, -1, -1, -1, -1, -1, -1, 157,
2572 158, -1, -1, 161, -1, 163, -1, -1, -1, 7,
2573 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2574 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2575 -1, -1, -1, -1, -1, -1, -1, -1, -1, 157,
2576 158, -1, -1, 161, -1, 163, -1, -1, -1, 7,
2577 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2578 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2579 -1, -1, -1, -1, -1, -1, -1, -1, -1, 157,
2580 158, -1, -1, 161, -1, 163, -1, -1, -1, 7,
2581 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2582 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2583 -1, -1, -1, -1, -1, -1, -1, -1, -1, 157,
2584 158, -1, -1, 161, -1, 163, -1, -1, -1, 7,
2585 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2586 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2587 -1, -1, -1, -1, -1, -1, -1, -1, -1, 157,
2588 158, -1, -1, 161, -1, 163, -1, -1, -1, 7,
2589 8, 49, 10, 11, 12, 13, 14, 15, 16, 17,
2590 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2591 -1, -1, -1, -1, -1, -1, -1, -1, -1, 157,
2592 158, -1, -1, 161, -1, 163, -1, -1, -1, -1,
2593 -1, 49, -1, 36, -1, -1, -1, -1, -1, -1,
2594 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2595 -1, -1, -1, 56, 57, -1, -1, -1, -1, 157,
2596 158, -1, -1, 161, -1, 163, 69, 70, 71, 72,
2597 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
2598 83, 84, 85, 86, 87, 88, 89, 90, 91, -1,
2599 -1, -1, -1, -1, -1, -1, -1, -1, -1, 157,
2600 158, -1, -1, 161, -1, 163, -1, -1, -1, 112,
2601 113, 114, -1, -1, 117, 118, 119, 120, 121, 122,
2602 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
2603 133, 134, 135, 136, -1, -1, -1, -1, -1, 157,
2604 158, -1, -1, 161, -1, 163
2605};
2606
2607/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2608 symbol of state STATE-NUM. */
2609static const yytype_uint8 yystos[] =
2610{
2611 0, 19, 20, 22, 23, 24, 30, 31, 51, 55,
2612 59, 174, 177, 178, 179, 180, 212, 213, 214, 216,
2613 215, 52, 67, 221, 154, 58, 154, 18, 154, 42,
2614 43, 44, 45, 46, 47, 48, 50, 149, 150, 151,
2615 181, 182, 183, 0, 214, 46, 48, 184, 231, 42,
2616 43, 44, 47, 185, 228, 230, 238, 154, 154, 158,
2617 222, 22, 220, 7, 8, 10, 11, 12, 13, 14,
2618 15, 16, 17, 49, 157, 158, 161, 163, 174, 178,
2619 199, 200, 234, 183, 183, 35, 37, 210, 183, 183,
2620 21, 68, 239, 240, 29, 164, 229, 239, 22, 22,
2621 22, 223, 152, 4, 4, 4, 163, 10, 164, 200,
2622 205, 54, 152, 176, 210, 210, 42, 44, 186, 32,
2623 33, 209, 61, 62, 63, 64, 65, 66, 187, 226,
2624 226, 68, 38, 177, 243, 155, 160, 39, 200, 201,
2625 203, 204, 159, 159, 164, 205, 155, 164, 152, 204,
2626 156, 209, 209, 10, 123, 200, 202, 211, 11, 12,
2627 13, 14, 15, 16, 172, 173, 200, 206, 4, 202,
2628 28, 163, 227, 38, 3, 4, 9, 25, 26, 27,
2629 40, 41, 58, 75, 76, 77, 78, 79, 80, 81,
2630 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
2631 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
2632 127, 128, 129, 131, 133, 134, 135, 161, 167, 168,
2633 169, 207, 233, 234, 235, 36, 56, 57, 69, 70,
2634 71, 72, 73, 74, 90, 91, 112, 113, 114, 117,
2635 130, 131, 132, 133, 134, 135, 136, 167, 168, 169,
2636 241, 247, 248, 249, 250, 22, 189, 155, 153, 200,
2637 200, 162, 164, 200, 4, 153, 206, 200, 152, 234,
2638 26, 27, 3, 4, 5, 6, 9, 25, 40, 41,
2639 158, 161, 163, 165, 207, 234, 176, 178, 235, 60,
2640 232, 92, 93, 94, 95, 96, 97, 98, 99, 100,
2641 101, 170, 26, 27, 98, 99, 100, 101, 102, 103,
2642 104, 105, 106, 107, 108, 109, 110, 111, 171, 152,
2643 152, 152, 152, 152, 206, 208, 152, 152, 152, 56,
2644 10, 200, 236, 237, 11, 17, 11, 172, 187, 170,
2645 171, 200, 200, 236, 200, 200, 244, 236, 236, 236,
2646 236, 236, 200, 200, 200, 236, 187, 115, 116, 53,
2647 119, 120, 137, 138, 140, 141, 143, 144, 145, 188,
2648 39, 201, 191, 160, 162, 162, 153, 191, 176, 176,
2649 211, 160, 208, 163, 208, 164, 208, 22, 217, 152,
2650 22, 152, 152, 206, 206, 206, 206, 206, 155, 162,
2651 206, 206, 206, 235, 155, 235, 235, 235, 202, 200,
2652 200, 155, 194, 155, 194, 235, 158, 155, 155, 155,
Dan Gohmandecb8c02008-04-23 20:11:27 +00002653 155, 155, 155, 235, 235, 235, 38, 202, 200, 236,
Dan Gohman54392c12008-04-19 00:24:39 +00002654 4, 137, 138, 139, 142, 146, 147, 190, 218, 219,
2655 38, 160, 164, 200, 208, 162, 164, 155, 197, 39,
2656 200, 224, 225, 155, 206, 206, 246, 155, 155, 155,
2657 155, 206, 155, 155, 38, 236, 155, 155, 235, 235,
2658 235, 11, 53, 11, 246, 235, 158, 236, 200, 236,
2659 236, 236, 155, 155, 155, 200, 235, 235, 155, 197,
2660 197, 200, 162, 164, 34, 53, 195, 198, 189, 155,
2661 153, 22, 155, 155, 153, 155, 206, 206, 206, 206,
2662 206, 206, 200, 17, 17, 152, 155, 155, 235, 4,
2663 235, 155, 235, 155, 155, 155, 4, 235, 235, 152,
2664 155, 194, 200, 153, 162, 22, 4, 197, 174, 175,
2665 39, 200, 191, 206, 206, 236, 155, 153, 155, 155,
2666 153, 153, 153, 235, 235, 17, 200, 245, 235, 235,
2667 194, 194, 235, 155, 236, 236, 236, 245, 235, 189,
2668 195, 196, 153, 153, 206, 206, 206, 155, 158, 189,
2669 189, 153, 155, 160, 235, 153, 194, 175, 53, 193,
2670 153, 153, 153, 17, 160, 172, 242, 119, 120, 235,
2671 235, 191, 17, 200, 160, 191, 4, 148, 192, 235,
2672 233, 160, 172, 189, 189, 38, 189, 189, 22, 155,
2673 233, 17, 235, 235, 17, 155, 235, 189, 189, 235,
2674 17, 73, 235, 17, 235
2675};
David Greene9145dd22007-08-01 03:59:32 +00002676
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002677#define yyerrok (yyerrstatus = 0)
2678#define yyclearin (yychar = YYEMPTY)
Dan Gohman54392c12008-04-19 00:24:39 +00002679#define YYEMPTY (-2)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002680#define YYEOF 0
Dan Gohman54392c12008-04-19 00:24:39 +00002681
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002682#define YYACCEPT goto yyacceptlab
Dan Gohman54392c12008-04-19 00:24:39 +00002683#define YYABORT goto yyabortlab
2684#define YYERROR goto yyerrorlab
2685
2686
2687/* Like YYERROR except do call yyerror. This remains here temporarily
2688 to ease the transition to the new meaning of YYERROR, for GCC.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002689 Once GCC version 2 has supplanted version 1, this can go. */
Dan Gohman54392c12008-04-19 00:24:39 +00002690
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002691#define YYFAIL goto yyerrlab
Dan Gohman54392c12008-04-19 00:24:39 +00002692
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002693#define YYRECOVERING() (!!yyerrstatus)
Dan Gohman54392c12008-04-19 00:24:39 +00002694
2695#define YYBACKUP(Token, Value) \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002696do \
2697 if (yychar == YYEMPTY && yylen == 1) \
Dan Gohman54392c12008-04-19 00:24:39 +00002698 { \
2699 yychar = (Token); \
2700 yylval = (Value); \
2701 yytoken = YYTRANSLATE (yychar); \
2702 YYPOPSTACK (1); \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002703 goto yybackup; \
2704 } \
2705 else \
Dan Gohman54392c12008-04-19 00:24:39 +00002706 { \
2707 yyerror (YY_("syntax error: cannot back up")); \
2708 YYERROR; \
2709 } \
2710while (YYID (0))
2711
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002712
2713#define YYTERROR 1
2714#define YYERRCODE 256
2715
Dan Gohman54392c12008-04-19 00:24:39 +00002716
2717/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2718 If N is 0, then set CURRENT to the empty location which ends
2719 the previous symbol: RHS[0] (always defined). */
2720
2721#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2722#ifndef YYLLOC_DEFAULT
2723# define YYLLOC_DEFAULT(Current, Rhs, N) \
2724 do \
2725 if (YYID (N)) \
2726 { \
2727 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2728 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2729 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2730 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2731 } \
2732 else \
2733 { \
2734 (Current).first_line = (Current).last_line = \
2735 YYRHSLOC (Rhs, 0).last_line; \
2736 (Current).first_column = (Current).last_column = \
2737 YYRHSLOC (Rhs, 0).last_column; \
2738 } \
2739 while (YYID (0))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002740#endif
2741
Dan Gohman54392c12008-04-19 00:24:39 +00002742
2743/* YY_LOCATION_PRINT -- Print the location on the stream.
2744 This macro was not mandated originally: define only if we know
2745 we won't break user code: when these are the locations we know. */
2746
2747#ifndef YY_LOCATION_PRINT
2748# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2749# define YY_LOCATION_PRINT(File, Loc) \
2750 fprintf (File, "%d.%d-%d.%d", \
2751 (Loc).first_line, (Loc).first_column, \
2752 (Loc).last_line, (Loc).last_column)
2753# else
2754# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2755# endif
2756#endif
2757
2758
2759/* YYLEX -- calling `yylex' with the right arguments. */
2760
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002761#ifdef YYLEX_PARAM
Dan Gohman54392c12008-04-19 00:24:39 +00002762# define YYLEX yylex (YYLEX_PARAM)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002763#else
Dan Gohman54392c12008-04-19 00:24:39 +00002764# define YYLEX yylex ()
Gabor Greif89f01162008-04-06 23:07:54 +00002765#endif
Dan Gohman54392c12008-04-19 00:24:39 +00002766
2767/* Enable debugging if requested. */
2768#if YYDEBUG
2769
2770# ifndef YYFPRINTF
2771# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2772# define YYFPRINTF fprintf
2773# endif
2774
2775# define YYDPRINTF(Args) \
2776do { \
2777 if (yydebug) \
2778 YYFPRINTF Args; \
2779} while (YYID (0))
2780
2781# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2782do { \
2783 if (yydebug) \
2784 { \
2785 YYFPRINTF (stderr, "%s ", Title); \
2786 yy_symbol_print (stderr, \
2787 Type, Value); \
2788 YYFPRINTF (stderr, "\n"); \
2789 } \
2790} while (YYID (0))
2791
2792
2793/*--------------------------------.
2794| Print this symbol on YYOUTPUT. |
2795`--------------------------------*/
2796
2797/*ARGSUSED*/
2798#if (defined __STDC__ || defined __C99__FUNC__ \
2799 || defined __cplusplus || defined _MSC_VER)
2800static void
2801yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
Gabor Greif89f01162008-04-06 23:07:54 +00002802#else
Dan Gohman54392c12008-04-19 00:24:39 +00002803static void
2804yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2805 FILE *yyoutput;
2806 int yytype;
2807 YYSTYPE const * const yyvaluep;
Gabor Greif89f01162008-04-06 23:07:54 +00002808#endif
Dan Gohman54392c12008-04-19 00:24:39 +00002809{
2810 if (!yyvaluep)
2811 return;
2812# ifdef YYPRINT
2813 if (yytype < YYNTOKENS)
2814 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2815# else
2816 YYUSE (yyoutput);
2817# endif
2818 switch (yytype)
2819 {
2820 default:
2821 break;
2822 }
2823}
2824
2825
2826/*--------------------------------.
2827| Print this symbol on YYOUTPUT. |
2828`--------------------------------*/
2829
2830#if (defined __STDC__ || defined __C99__FUNC__ \
2831 || defined __cplusplus || defined _MSC_VER)
2832static void
2833yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2834#else
2835static void
2836yy_symbol_print (yyoutput, yytype, yyvaluep)
2837 FILE *yyoutput;
2838 int yytype;
2839 YYSTYPE const * const yyvaluep;
Scott Michel6d1aba82008-01-30 03:10:00 +00002840#endif
Dan Gohman54392c12008-04-19 00:24:39 +00002841{
2842 if (yytype < YYNTOKENS)
2843 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2844 else
2845 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
Chris Lattner59363a32008-02-19 04:36:25 +00002846
Dan Gohman54392c12008-04-19 00:24:39 +00002847 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2848 YYFPRINTF (yyoutput, ")");
2849}
Chris Lattner59363a32008-02-19 04:36:25 +00002850
Dan Gohman54392c12008-04-19 00:24:39 +00002851/*------------------------------------------------------------------.
2852| yy_stack_print -- Print the state stack from its BOTTOM up to its |
2853| TOP (included). |
2854`------------------------------------------------------------------*/
Chris Lattner59363a32008-02-19 04:36:25 +00002855
Dan Gohman54392c12008-04-19 00:24:39 +00002856#if (defined __STDC__ || defined __C99__FUNC__ \
2857 || defined __cplusplus || defined _MSC_VER)
2858static void
2859yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
2860#else
2861static void
2862yy_stack_print (bottom, top)
2863 yytype_int16 *bottom;
2864 yytype_int16 *top;
Scott Michel6d1aba82008-01-30 03:10:00 +00002865#endif
Dan Gohman54392c12008-04-19 00:24:39 +00002866{
2867 YYFPRINTF (stderr, "Stack now");
2868 for (; bottom <= top; ++bottom)
2869 YYFPRINTF (stderr, " %d", *bottom);
2870 YYFPRINTF (stderr, "\n");
2871}
Chris Lattner59363a32008-02-19 04:36:25 +00002872
Dan Gohman54392c12008-04-19 00:24:39 +00002873# define YY_STACK_PRINT(Bottom, Top) \
2874do { \
2875 if (yydebug) \
2876 yy_stack_print ((Bottom), (Top)); \
2877} while (YYID (0))
Chris Lattner59363a32008-02-19 04:36:25 +00002878
Dan Gohman54392c12008-04-19 00:24:39 +00002879
2880/*------------------------------------------------.
2881| Report that the YYRULE is going to be reduced. |
2882`------------------------------------------------*/
2883
2884#if (defined __STDC__ || defined __C99__FUNC__ \
2885 || defined __cplusplus || defined _MSC_VER)
2886static void
2887yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
2888#else
2889static void
2890yy_reduce_print (yyvsp, yyrule)
2891 YYSTYPE *yyvsp;
2892 int yyrule;
Christopher Lamb0a243582007-12-11 09:02:08 +00002893#endif
Dan Gohman54392c12008-04-19 00:24:39 +00002894{
2895 int yynrhs = yyr2[yyrule];
2896 int yyi;
2897 unsigned long int yylno = yyrline[yyrule];
2898 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2899 yyrule - 1, yylno);
2900 /* The symbols being reduced. */
2901 for (yyi = 0; yyi < yynrhs; yyi++)
2902 {
2903 fprintf (stderr, " $%d = ", yyi + 1);
2904 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2905 &(yyvsp[(yyi + 1) - (yynrhs)])
2906 );
2907 fprintf (stderr, "\n");
2908 }
2909}
Scott Michel5a6f17b2008-01-30 02:55:46 +00002910
Dan Gohman54392c12008-04-19 00:24:39 +00002911# define YY_REDUCE_PRINT(Rule) \
2912do { \
2913 if (yydebug) \
2914 yy_reduce_print (yyvsp, Rule); \
2915} while (YYID (0))
Scott Michel5a6f17b2008-01-30 02:55:46 +00002916
Dan Gohman54392c12008-04-19 00:24:39 +00002917/* Nonzero means print parse trace. It is left uninitialized so that
2918 multiple parsers can coexist. */
2919int yydebug;
2920#else /* !YYDEBUG */
2921# define YYDPRINTF(Args)
2922# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2923# define YY_STACK_PRINT(Bottom, Top)
2924# define YY_REDUCE_PRINT(Rule)
2925#endif /* !YYDEBUG */
2926
2927
2928/* YYINITDEPTH -- initial size of the parser's stacks. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002929#ifndef YYINITDEPTH
Dan Gohman54392c12008-04-19 00:24:39 +00002930# define YYINITDEPTH 200
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002931#endif
2932
Dan Gohman54392c12008-04-19 00:24:39 +00002933/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2934 if the built-in stack extension method is used).
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002935
Dan Gohman54392c12008-04-19 00:24:39 +00002936 Do not make this value too large; the results are undefined if
2937 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2938 evaluated with infinite-precision integer arithmetic. */
David Greene9145dd22007-08-01 03:59:32 +00002939
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002940#ifndef YYMAXDEPTH
Dan Gohman54392c12008-04-19 00:24:39 +00002941# define YYMAXDEPTH 10000
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002942#endif
Dan Gohman54392c12008-04-19 00:24:39 +00002943
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002944
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002945
Dan Gohman54392c12008-04-19 00:24:39 +00002946#if YYERROR_VERBOSE
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002947
Dan Gohman54392c12008-04-19 00:24:39 +00002948# ifndef yystrlen
2949# if defined __GLIBC__ && defined _STRING_H
2950# define yystrlen strlen
2951# else
2952/* Return the length of YYSTR. */
2953#if (defined __STDC__ || defined __C99__FUNC__ \
2954 || defined __cplusplus || defined _MSC_VER)
2955static YYSIZE_T
2956yystrlen (const char *yystr)
Chris Lattner59363a32008-02-19 04:36:25 +00002957#else
Dan Gohman54392c12008-04-19 00:24:39 +00002958static YYSIZE_T
2959yystrlen (yystr)
2960 const char *yystr;
2961#endif
2962{
2963 YYSIZE_T yylen;
2964 for (yylen = 0; yystr[yylen]; yylen++)
2965 continue;
2966 return yylen;
2967}
2968# endif
2969# endif
2970
2971# ifndef yystpcpy
2972# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
2973# define yystpcpy stpcpy
2974# else
2975/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2976 YYDEST. */
2977#if (defined __STDC__ || defined __C99__FUNC__ \
2978 || defined __cplusplus || defined _MSC_VER)
2979static char *
2980yystpcpy (char *yydest, const char *yysrc)
2981#else
2982static char *
2983yystpcpy (yydest, yysrc)
2984 char *yydest;
2985 const char *yysrc;
2986#endif
2987{
2988 char *yyd = yydest;
2989 const char *yys = yysrc;
2990
2991 while ((*yyd++ = *yys++) != '\0')
2992 continue;
2993
2994 return yyd - 1;
2995}
2996# endif
2997# endif
2998
2999# ifndef yytnamerr
3000/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3001 quotes and backslashes, so that it's suitable for yyerror. The
3002 heuristic is that double-quoting is unnecessary unless the string
3003 contains an apostrophe, a comma, or backslash (other than
3004 backslash-backslash). YYSTR is taken from yytname. If YYRES is
3005 null, do not copy; instead, return the length of what the result
3006 would have been. */
3007static YYSIZE_T
3008yytnamerr (char *yyres, const char *yystr)
3009{
3010 if (*yystr == '"')
3011 {
3012 YYSIZE_T yyn = 0;
3013 char const *yyp = yystr;
3014
3015 for (;;)
3016 switch (*++yyp)
3017 {
3018 case '\'':
3019 case ',':
3020 goto do_not_strip_quotes;
3021
3022 case '\\':
3023 if (*++yyp != '\\')
3024 goto do_not_strip_quotes;
3025 /* Fall through. */
3026 default:
3027 if (yyres)
3028 yyres[yyn] = *yyp;
3029 yyn++;
3030 break;
3031
3032 case '"':
3033 if (yyres)
3034 yyres[yyn] = '\0';
3035 return yyn;
3036 }
3037 do_not_strip_quotes: ;
3038 }
3039
3040 if (! yyres)
3041 return yystrlen (yystr);
3042
3043 return yystpcpy (yyres, yystr) - yyres;
3044}
3045# endif
3046
3047/* Copy into YYRESULT an error message about the unexpected token
3048 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3049 including the terminating null byte. If YYRESULT is null, do not
3050 copy anything; just return the number of bytes that would be
3051 copied. As a special case, return 0 if an ordinary "syntax error"
3052 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3053 size calculation. */
3054static YYSIZE_T
3055yysyntax_error (char *yyresult, int yystate, int yychar)
3056{
3057 int yyn = yypact[yystate];
3058
3059 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3060 return 0;
3061 else
3062 {
3063 int yytype = YYTRANSLATE (yychar);
3064 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3065 YYSIZE_T yysize = yysize0;
3066 YYSIZE_T yysize1;
3067 int yysize_overflow = 0;
3068 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3069 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3070 int yyx;
3071
3072# if 0
3073 /* This is so xgettext sees the translatable formats that are
3074 constructed on the fly. */
3075 YY_("syntax error, unexpected %s");
3076 YY_("syntax error, unexpected %s, expecting %s");
3077 YY_("syntax error, unexpected %s, expecting %s or %s");
3078 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3079 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3080# endif
3081 char *yyfmt;
3082 char const *yyf;
3083 static char const yyunexpected[] = "syntax error, unexpected %s";
3084 static char const yyexpecting[] = ", expecting %s";
3085 static char const yyor[] = " or %s";
3086 char yyformat[sizeof yyunexpected
3087 + sizeof yyexpecting - 1
3088 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3089 * (sizeof yyor - 1))];
3090 char const *yyprefix = yyexpecting;
3091
3092 /* Start YYX at -YYN if negative to avoid negative indexes in
3093 YYCHECK. */
3094 int yyxbegin = yyn < 0 ? -yyn : 0;
3095
3096 /* Stay within bounds of both yycheck and yytname. */
3097 int yychecklim = YYLAST - yyn + 1;
3098 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3099 int yycount = 1;
3100
3101 yyarg[0] = yytname[yytype];
3102 yyfmt = yystpcpy (yyformat, yyunexpected);
3103
3104 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3105 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3106 {
3107 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3108 {
3109 yycount = 1;
3110 yysize = yysize0;
3111 yyformat[sizeof yyunexpected - 1] = '\0';
3112 break;
3113 }
3114 yyarg[yycount++] = yytname[yyx];
3115 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3116 yysize_overflow |= (yysize1 < yysize);
3117 yysize = yysize1;
3118 yyfmt = yystpcpy (yyfmt, yyprefix);
3119 yyprefix = yyor;
3120 }
3121
3122 yyf = YY_(yyformat);
3123 yysize1 = yysize + yystrlen (yyf);
3124 yysize_overflow |= (yysize1 < yysize);
3125 yysize = yysize1;
3126
3127 if (yysize_overflow)
3128 return YYSIZE_MAXIMUM;
3129
3130 if (yyresult)
3131 {
3132 /* Avoid sprintf, as that infringes on the user's name space.
3133 Don't have undefined behavior even if the translation
3134 produced a string with the wrong number of "%s"s. */
3135 char *yyp = yyresult;
3136 int yyi = 0;
3137 while ((*yyp = *yyf) != '\0')
3138 {
3139 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3140 {
3141 yyp += yytnamerr (yyp, yyarg[yyi++]);
3142 yyf += 2;
3143 }
3144 else
3145 {
3146 yyp++;
3147 yyf++;
3148 }
3149 }
3150 }
3151 return yysize;
3152 }
3153}
3154#endif /* YYERROR_VERBOSE */
3155
3156
3157/*-----------------------------------------------.
3158| Release the memory associated to this symbol. |
3159`-----------------------------------------------*/
3160
3161/*ARGSUSED*/
3162#if (defined __STDC__ || defined __C99__FUNC__ \
3163 || defined __cplusplus || defined _MSC_VER)
3164static void
3165yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3166#else
3167static void
3168yydestruct (yymsg, yytype, yyvaluep)
3169 const char *yymsg;
3170 int yytype;
3171 YYSTYPE *yyvaluep;
3172#endif
3173{
3174 YYUSE (yyvaluep);
3175
3176 if (!yymsg)
3177 yymsg = "Deleting";
3178 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3179
3180 switch (yytype)
3181 {
3182
3183 default:
3184 break;
3185 }
3186}
3187
3188
3189/* Prevent warnings from -Wmissing-prototypes. */
3190
3191#ifdef YYPARSE_PARAM
3192#if defined __STDC__ || defined __cplusplus
3193int yyparse (void *YYPARSE_PARAM);
3194#else
3195int yyparse ();
3196#endif
3197#else /* ! YYPARSE_PARAM */
3198#if defined __STDC__ || defined __cplusplus
David Greene48556392007-09-04 18:46:50 +00003199int yyparse (void);
Gabor Greif89f01162008-04-06 23:07:54 +00003200#else
Dan Gohman54392c12008-04-19 00:24:39 +00003201int yyparse ();
Scott Michel6d1aba82008-01-30 03:10:00 +00003202#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003203#endif /* ! YYPARSE_PARAM */
Scott Michel5a6f17b2008-01-30 02:55:46 +00003204
Chris Lattner59363a32008-02-19 04:36:25 +00003205
Dan Gohman54392c12008-04-19 00:24:39 +00003206
3207/* The look-ahead symbol. */
3208int yychar;
3209
3210/* The semantic value of the look-ahead symbol. */
3211YYSTYPE yylval;
3212
3213/* Number of syntax errors so far. */
3214int yynerrs;
3215
3216
3217
3218/*----------.
3219| yyparse. |
3220`----------*/
3221
3222#ifdef YYPARSE_PARAM
3223#if (defined __STDC__ || defined __C99__FUNC__ \
3224 || defined __cplusplus || defined _MSC_VER)
3225int
3226yyparse (void *YYPARSE_PARAM)
3227#else
3228int
3229yyparse (YYPARSE_PARAM)
3230 void *YYPARSE_PARAM;
3231#endif
3232#else /* ! YYPARSE_PARAM */
3233#if (defined __STDC__ || defined __C99__FUNC__ \
3234 || defined __cplusplus || defined _MSC_VER)
3235int
3236yyparse (void)
3237#else
3238int
3239yyparse ()
3240
Gabor Greif89f01162008-04-06 23:07:54 +00003241#endif
3242#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003243{
3244
3245 int yystate;
3246 int yyn;
3247 int yyresult;
3248 /* Number of tokens to shift before error messages enabled. */
3249 int yyerrstatus;
3250 /* Look-ahead token as an internal (translated) token number. */
3251 int yytoken = 0;
3252#if YYERROR_VERBOSE
3253 /* Buffer for error messages, and its allocated size. */
3254 char yymsgbuf[128];
3255 char *yymsg = yymsgbuf;
3256 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
Gabor Greif89f01162008-04-06 23:07:54 +00003257#endif
Chris Lattner59363a32008-02-19 04:36:25 +00003258
Dan Gohman54392c12008-04-19 00:24:39 +00003259 /* Three stacks and their tools:
3260 `yyss': related to states,
3261 `yyvs': related to semantic values,
3262 `yyls': related to locations.
3263
3264 Refer to the stacks thru separate pointers, to allow yyoverflow
3265 to reallocate them elsewhere. */
3266
3267 /* The state stack. */
3268 yytype_int16 yyssa[YYINITDEPTH];
3269 yytype_int16 *yyss = yyssa;
3270 yytype_int16 *yyssp;
3271
3272 /* The semantic value stack. */
3273 YYSTYPE yyvsa[YYINITDEPTH];
3274 YYSTYPE *yyvs = yyvsa;
3275 YYSTYPE *yyvsp;
3276
3277
3278
3279#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3280
3281 YYSIZE_T yystacksize = YYINITDEPTH;
3282
3283 /* The variables used to return semantic value and location from the
3284 action routines. */
3285 YYSTYPE yyval;
3286
3287
3288 /* The number of symbols on the RHS of the reduced rule.
3289 Keep to zero when no symbol should be popped. */
3290 int yylen = 0;
3291
3292 YYDPRINTF ((stderr, "Starting parse\n"));
3293
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003294 yystate = 0;
3295 yyerrstatus = 0;
3296 yynerrs = 0;
3297 yychar = YYEMPTY; /* Cause a token to be read. */
3298
3299 /* Initialize stack pointers.
3300 Waste one element of value and location stack
3301 so that they stay on the same level as the state stack.
3302 The wasted elements are never initialized. */
3303
Dan Gohman54392c12008-04-19 00:24:39 +00003304 yyssp = yyss;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003305 yyvsp = yyvs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003306
Dan Gohman54392c12008-04-19 00:24:39 +00003307 goto yysetstate;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003308
Dan Gohman54392c12008-04-19 00:24:39 +00003309/*------------------------------------------------------------.
3310| yynewstate -- Push a new state, which is found in yystate. |
3311`------------------------------------------------------------*/
3312 yynewstate:
3313 /* In all cases, when you get here, the value and location stacks
3314 have just been pushed. So pushing a state here evens the stacks. */
3315 yyssp++;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003316
Dan Gohman54392c12008-04-19 00:24:39 +00003317 yysetstate:
3318 *yyssp = yystate;
3319
3320 if (yyss + yystacksize - 1 <= yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003321 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003322 /* Get the current used size of the three stacks, in elements. */
Dan Gohman54392c12008-04-19 00:24:39 +00003323 YYSIZE_T yysize = yyssp - yyss + 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003324
3325#ifdef yyoverflow
Dan Gohman54392c12008-04-19 00:24:39 +00003326 {
3327 /* Give user a chance to reallocate the stack. Use copies of
3328 these so that the &'s don't force the real ones into
3329 memory. */
3330 YYSTYPE *yyvs1 = yyvs;
3331 yytype_int16 *yyss1 = yyss;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003332
Dan Gohman54392c12008-04-19 00:24:39 +00003333
3334 /* Each stack pointer address is followed by the size of the
3335 data in use in that stack, in bytes. This used to be a
3336 conditional around just the two extra args, but that might
3337 be undefined if yyoverflow is a macro. */
3338 yyoverflow (YY_("memory exhausted"),
3339 &yyss1, yysize * sizeof (*yyssp),
3340 &yyvs1, yysize * sizeof (*yyvsp),
3341
3342 &yystacksize);
3343
3344 yyss = yyss1;
3345 yyvs = yyvs1;
3346 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003347#else /* no yyoverflow */
Dan Gohman54392c12008-04-19 00:24:39 +00003348# ifndef YYSTACK_RELOCATE
3349 goto yyexhaustedlab;
3350# else
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003351 /* Extend the stack our own way. */
Dan Gohman54392c12008-04-19 00:24:39 +00003352 if (YYMAXDEPTH <= yystacksize)
3353 goto yyexhaustedlab;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003354 yystacksize *= 2;
Dan Gohman54392c12008-04-19 00:24:39 +00003355 if (YYMAXDEPTH < yystacksize)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003356 yystacksize = YYMAXDEPTH;
Dan Gohman54392c12008-04-19 00:24:39 +00003357
3358 {
3359 yytype_int16 *yyss1 = yyss;
3360 union yyalloc *yyptr =
3361 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3362 if (! yyptr)
3363 goto yyexhaustedlab;
3364 YYSTACK_RELOCATE (yyss);
3365 YYSTACK_RELOCATE (yyvs);
3366
3367# undef YYSTACK_RELOCATE
3368 if (yyss1 != yyssa)
3369 YYSTACK_FREE (yyss1);
3370 }
3371# endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003372#endif /* no yyoverflow */
3373
Dan Gohman54392c12008-04-19 00:24:39 +00003374 yyssp = yyss + yysize - 1;
3375 yyvsp = yyvs + yysize - 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003376
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003377
Dan Gohman54392c12008-04-19 00:24:39 +00003378 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3379 (unsigned long int) yystacksize));
3380
3381 if (yyss + yystacksize - 1 <= yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003382 YYABORT;
3383 }
3384
Dan Gohman54392c12008-04-19 00:24:39 +00003385 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003386
3387 goto yybackup;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003388
Dan Gohman54392c12008-04-19 00:24:39 +00003389/*-----------.
3390| yybackup. |
3391`-----------*/
3392yybackup:
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003393
Dan Gohman54392c12008-04-19 00:24:39 +00003394 /* Do appropriate processing given the current state. Read a
3395 look-ahead token if we need one and don't already have one. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003396
Dan Gohman54392c12008-04-19 00:24:39 +00003397 /* First try to decide what to do without reference to look-ahead token. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003398 yyn = yypact[yystate];
Dan Gohman54392c12008-04-19 00:24:39 +00003399 if (yyn == YYPACT_NINF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003400 goto yydefault;
3401
Dan Gohman54392c12008-04-19 00:24:39 +00003402 /* Not known => get a look-ahead token if don't already have one. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003403
Dan Gohman54392c12008-04-19 00:24:39 +00003404 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003405 if (yychar == YYEMPTY)
3406 {
Dan Gohman54392c12008-04-19 00:24:39 +00003407 YYDPRINTF ((stderr, "Reading a token: "));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003408 yychar = YYLEX;
3409 }
3410
Dan Gohman54392c12008-04-19 00:24:39 +00003411 if (yychar <= YYEOF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003412 {
Dan Gohman54392c12008-04-19 00:24:39 +00003413 yychar = yytoken = YYEOF;
3414 YYDPRINTF ((stderr, "Now at end of input.\n"));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003415 }
3416 else
3417 {
Dan Gohman54392c12008-04-19 00:24:39 +00003418 yytoken = YYTRANSLATE (yychar);
3419 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003420 }
3421
Dan Gohman54392c12008-04-19 00:24:39 +00003422 /* If the proper action on seeing token YYTOKEN is to reduce or to
3423 detect an error, take that action. */
3424 yyn += yytoken;
3425 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003426 goto yydefault;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003427 yyn = yytable[yyn];
Dan Gohman54392c12008-04-19 00:24:39 +00003428 if (yyn <= 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003429 {
Dan Gohman54392c12008-04-19 00:24:39 +00003430 if (yyn == 0 || yyn == YYTABLE_NINF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003431 goto yyerrlab;
3432 yyn = -yyn;
3433 goto yyreduce;
3434 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003435
3436 if (yyn == YYFINAL)
3437 YYACCEPT;
3438
Dan Gohman54392c12008-04-19 00:24:39 +00003439 /* Count tokens shifted since error; after three, turn off error
3440 status. */
3441 if (yyerrstatus)
3442 yyerrstatus--;
Dale Johannesen3afee192007-09-07 21:07:57 +00003443
Dan Gohman54392c12008-04-19 00:24:39 +00003444 /* Shift the look-ahead token. */
3445 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003446
Dan Gohman54392c12008-04-19 00:24:39 +00003447 /* Discard the shifted token unless it is eof. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003448 if (yychar != YYEOF)
3449 yychar = YYEMPTY;
3450
Gabor Greif89f01162008-04-06 23:07:54 +00003451 yystate = yyn;
Dan Gohman54392c12008-04-19 00:24:39 +00003452 *++yyvsp = yylval;
3453
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003454 goto yynewstate;
3455
Gabor Greif89f01162008-04-06 23:07:54 +00003456
Dan Gohman54392c12008-04-19 00:24:39 +00003457/*-----------------------------------------------------------.
3458| yydefault -- do the default action for the current state. |
3459`-----------------------------------------------------------*/
3460yydefault:
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003461 yyn = yydefact[yystate];
3462 if (yyn == 0)
3463 goto yyerrlab;
Dan Gohman54392c12008-04-19 00:24:39 +00003464 goto yyreduce;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003465
Dan Gohman54392c12008-04-19 00:24:39 +00003466
3467/*-----------------------------.
3468| yyreduce -- Do a reduction. |
3469`-----------------------------*/
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003470yyreduce:
Dan Gohman54392c12008-04-19 00:24:39 +00003471 /* yyn is the number of a rule to reduce with. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003472 yylen = yyr2[yyn];
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003473
Dan Gohman54392c12008-04-19 00:24:39 +00003474 /* If YYLEN is nonzero, implement the default value of the action:
3475 `$$ = $1'.
3476
3477 Otherwise, the following line sets YYVAL to garbage.
3478 This behavior is undocumented and Bison
3479 users should not rely upon it. Assigning to YYVAL
3480 unconditionally makes the parser a bit smaller, and it avoids a
3481 GCC warning that YYVAL may be used uninitialized. */
3482 yyval = yyvsp[1-yylen];
3483
3484
3485 YY_REDUCE_PRINT (yyn);
3486 switch (yyn)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003487 {
Dan Gohman54392c12008-04-19 00:24:39 +00003488 case 29:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003489#line 1118 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003490 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3491 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003492
Dan Gohman54392c12008-04-19 00:24:39 +00003493 case 30:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003494#line 1118 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003495 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3496 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003497
Dan Gohman54392c12008-04-19 00:24:39 +00003498 case 31:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003499#line 1119 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003500 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3501 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003502
Dan Gohman54392c12008-04-19 00:24:39 +00003503 case 32:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003504#line 1119 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003505 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3506 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003507
Dan Gohman54392c12008-04-19 00:24:39 +00003508 case 33:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003509#line 1120 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003510 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3511 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003512
Dan Gohman54392c12008-04-19 00:24:39 +00003513 case 34:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003514#line 1120 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003515 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3516 break;
3517
3518 case 35:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003519#line 1121 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003520 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3521 break;
3522
3523 case 36:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003524#line 1121 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003525 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3526 break;
3527
3528 case 37:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003529#line 1122 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003530 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3531 break;
3532
3533 case 38:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003534#line 1122 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003535 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3536 break;
3537
3538 case 39:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003539#line 1126 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003540 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3541 break;
3542
3543 case 40:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003544#line 1126 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003545 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3546 break;
3547
3548 case 41:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003549#line 1127 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003550 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3551 break;
3552
3553 case 42:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003554#line 1127 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003555 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3556 break;
3557
3558 case 43:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003559#line 1128 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003560 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3561 break;
3562
3563 case 44:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003564#line 1128 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003565 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3566 break;
3567
3568 case 45:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003569#line 1129 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003570 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3571 break;
3572
3573 case 46:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003574#line 1129 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003575 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3576 break;
3577
3578 case 47:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003579#line 1130 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003580 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3581 break;
3582
3583 case 48:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003584#line 1130 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003585 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3586 break;
3587
3588 case 49:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003589#line 1131 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003590 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3591 break;
3592
3593 case 50:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003594#line 1131 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003595 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3596 break;
3597
3598 case 51:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003599#line 1132 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003600 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3601 break;
3602
3603 case 52:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003604#line 1132 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003605 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3606 break;
3607
3608 case 53:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003609#line 1133 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003610 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3611 break;
3612
3613 case 54:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003614#line 1134 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003615 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3616 break;
3617
3618 case 65:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003619#line 1143 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003620 { (yyval.StrVal) = 0; ;}
3621 break;
3622
3623 case 66:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003624#line 1145 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003625 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3626 break;
3627
3628 case 67:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003629#line 1146 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003630 { (yyval.UIntVal)=0; ;}
3631 break;
3632
3633 case 68:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003634#line 1150 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003635 {
3636 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003637 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003638 ;}
3639 break;
3640
3641 case 69:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003642#line 1154 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003643 {
3644 (yyval.StrVal) = 0;
Christopher Lamb668d9a02007-12-12 08:45:45 +00003645 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003646 ;}
3647 break;
3648
3649 case 73:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003650#line 1162 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003651 {
3652 (yyval.StrVal) = 0;
Christopher Lamb668d9a02007-12-12 08:45:45 +00003653 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003654 ;}
3655 break;
3656
3657 case 74:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003658#line 1167 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003659 {
3660 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00003661 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003662 ;}
3663 break;
3664
3665 case 75:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003666#line 1173 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003667 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3668 break;
3669
3670 case 76:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003671#line 1174 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003672 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3673 break;
3674
3675 case 77:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003676#line 1175 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003677 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3678 break;
3679
3680 case 78:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003681#line 1176 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003682 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3683 break;
3684
3685 case 79:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003686#line 1177 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003687 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3688 break;
3689
3690 case 80:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003691#line 1181 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003692 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3693 break;
3694
3695 case 81:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003696#line 1182 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003697 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3698 break;
3699
3700 case 82:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003701#line 1183 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003702 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3703 break;
3704
3705 case 83:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003706#line 1187 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003707 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3708 break;
3709
3710 case 84:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003711#line 1188 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003712 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3713 break;
3714
3715 case 85:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003716#line 1189 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003717 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3718 break;
3719
3720 case 86:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003721#line 1190 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003722 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
3723 break;
3724
3725 case 87:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003726#line 1194 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003727 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3728 break;
3729
3730 case 88:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003731#line 1195 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003732 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3733 break;
3734
3735 case 89:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003736#line 1196 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003737 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3738 break;
3739
3740 case 90:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003741#line 1200 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003742 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3743 break;
3744
3745 case 91:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003746#line 1201 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003747 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3748 break;
3749
3750 case 92:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003751#line 1202 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003752 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3753 break;
3754
3755 case 93:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003756#line 1203 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003757 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3758 break;
3759
3760 case 94:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003761#line 1204 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003762 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3763 break;
3764
3765 case 95:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003766#line 1208 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003767 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3768 break;
3769
3770 case 96:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003771#line 1209 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003772 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3773 break;
3774
3775 case 97:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003776#line 1210 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003777 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3778 break;
3779
3780 case 98:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003781#line 1213 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003782 { (yyval.UIntVal) = CallingConv::C; ;}
3783 break;
3784
3785 case 99:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003786#line 1214 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003787 { (yyval.UIntVal) = CallingConv::C; ;}
3788 break;
3789
3790 case 100:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003791#line 1215 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003792 { (yyval.UIntVal) = CallingConv::Fast; ;}
3793 break;
3794
3795 case 101:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003796#line 1216 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003797 { (yyval.UIntVal) = CallingConv::Cold; ;}
3798 break;
3799
3800 case 102:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003801#line 1217 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003802 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3803 break;
3804
3805 case 103:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003806#line 1218 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003807 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3808 break;
3809
3810 case 104:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003811#line 1219 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003812 {
3813 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003814 GEN_ERROR("Calling conv too large");
Dan Gohman54392c12008-04-19 00:24:39 +00003815 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003816 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003817 ;}
3818 break;
3819
3820 case 105:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003821#line 1226 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003822 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3823 break;
3824
3825 case 106:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003826#line 1227 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003827 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3828 break;
3829
3830 case 107:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003831#line 1228 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003832 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3833 break;
3834
3835 case 108:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003836#line 1229 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003837 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3838 break;
3839
3840 case 109:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003841#line 1230 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003842 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
3843 break;
3844
3845 case 110:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003846#line 1231 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003847 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
3848 break;
3849
3850 case 111:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003851#line 1232 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003852 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
3853 break;
3854
3855 case 112:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003856#line 1233 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003857 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
3858 break;
3859
3860 case 113:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003861#line 1234 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003862 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
3863 break;
3864
3865 case 114:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003866#line 1235 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003867 { (yyval.ParamAttrs) =
3868 ParamAttr::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
3869 break;
3870
3871 case 115:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003872#line 1239 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003873 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3874 break;
3875
3876 case 116:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003877#line 1240 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003878 {
3879 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3880 ;}
3881 break;
3882
3883 case 117:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003884#line 1245 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003885 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
3886 break;
3887
3888 case 118:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003889#line 1246 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003890 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
3891 break;
3892
3893 case 119:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003894#line 1247 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003895 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3896 break;
3897
3898 case 120:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003899#line 1248 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003900 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3901 break;
3902
3903 case 121:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003904#line 1249 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003905 { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
3906 break;
3907
3908 case 122:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003909#line 1250 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003910 { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
3911 break;
3912
3913 case 123:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003914#line 1253 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003915 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3916 break;
3917
3918 case 124:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003919#line 1254 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003920 {
3921 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3922 ;}
3923 break;
3924
3925 case 125:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003926#line 1259 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003927 { (yyval.StrVal) = 0; ;}
3928 break;
3929
3930 case 126:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003931#line 1260 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003932 {
3933 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3934 ;}
3935 break;
3936
3937 case 127:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003938#line 1267 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003939 { (yyval.UIntVal) = 0; ;}
3940 break;
3941
3942 case 128:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003943#line 1268 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003944 {
3945 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3946 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003947 GEN_ERROR("Alignment must be a power of two");
3948 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003949;}
3950 break;
3951
3952 case 129:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003953#line 1274 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003954 { (yyval.UIntVal) = 0; ;}
3955 break;
3956
3957 case 130:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003958#line 1275 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003959 {
3960 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
3961 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Christopher Lamb668d9a02007-12-12 08:45:45 +00003962 GEN_ERROR("Alignment must be a power of two");
3963 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003964;}
3965 break;
3966
3967 case 131:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003968#line 1284 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003969 {
3970 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
3971 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003972 GEN_ERROR("Invalid character in section name");
Dan Gohman54392c12008-04-19 00:24:39 +00003973 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003974 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003975;}
3976 break;
3977
3978 case 132:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003979#line 1292 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003980 { (yyval.StrVal) = 0; ;}
3981 break;
3982
3983 case 133:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003984#line 1293 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003985 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
3986 break;
3987
3988 case 134:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003989#line 1298 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003990 {;}
3991 break;
3992
3993 case 135:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003994#line 1299 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003995 {;}
3996 break;
3997
3998 case 136:
Dan Gohmandecb8c02008-04-23 20:11:27 +00003999#line 1300 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004000 {
4001 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
4002 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004003 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004004 ;}
4005 break;
4006
4007 case 137:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004008#line 1305 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004009 {
4010 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004011 GEN_ERROR("Alignment must be a power of two");
Dan Gohman54392c12008-04-19 00:24:39 +00004012 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004013 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004014 ;}
4015 break;
4016
4017 case 145:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004018#line 1321 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004019 {
4020 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004021 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004022 ;}
4023 break;
4024
4025 case 146:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004026#line 1325 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004027 {
4028 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004029 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004030 ;}
4031 break;
4032
4033 case 147:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004034#line 1329 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004035 { // Pointer type?
4036 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
Christopher Lamb668d9a02007-12-12 08:45:45 +00004037 GEN_ERROR("Cannot form a pointer to a basic block");
Dan Gohman54392c12008-04-19 00:24:39 +00004038 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4039 delete (yyvsp[(1) - (3)].TypeVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00004040 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004041 ;}
4042 break;
4043
4044 case 148:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004045#line 1336 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004046 { // Named types are also simple types...
4047 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
Christopher Lamb0a243582007-12-11 09:02:08 +00004048 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004049 (yyval.TypeVal) = new PATypeHolder(tmp);
4050 ;}
4051 break;
4052
4053 case 149:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004054#line 1341 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004055 { // Type UpReference
4056 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004057 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Dan Gohman54392c12008-04-19 00:24:39 +00004058 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4059 (yyval.TypeVal) = new PATypeHolder(OT);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004060 UR_OUT("New Upreference!\n");
4061 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004062 ;}
4063 break;
4064
4065 case 150:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004066#line 1349 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004067 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004068 // Allow but ignore attributes on function types; this permits auto-upgrade.
4069 // FIXME: remove in LLVM 3.0.
Chris Lattner73de3c02008-04-23 05:37:08 +00004070 const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal);
4071 if (!FunctionType::isValidReturnType(RetTy))
4072 GEN_ERROR("Invalid result type for LLVM function");
4073
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004074 std::vector<const Type*> Params;
Dan Gohman54392c12008-04-19 00:24:39 +00004075 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004076 for (; I != E; ++I ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004077 const Type *Ty = I->Ty->get();
4078 Params.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004079 }
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004080
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004081 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4082 if (isVarArg) Params.pop_back();
4083
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004084 for (unsigned i = 0; i != Params.size(); ++i)
4085 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4086 GEN_ERROR("Function arguments must be value types!");
4087
4088 CHECK_FOR_ERROR
4089
Anton Korobeynikov0cdd2692007-12-03 19:17:47 +00004090 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
Dan Gohman54392c12008-04-19 00:24:39 +00004091 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4092 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4093 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004094 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004095 ;}
4096 break;
4097
4098 case 151:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004099#line 1378 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004100 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004101 // Allow but ignore attributes on function types; this permits auto-upgrade.
4102 // FIXME: remove in LLVM 3.0.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004103 std::vector<const Type*> Params;
Dan Gohman54392c12008-04-19 00:24:39 +00004104 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004105 for ( ; I != E; ++I ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004106 const Type* Ty = I->Ty->get();
4107 Params.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004108 }
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004109
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004110 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4111 if (isVarArg) Params.pop_back();
4112
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004113 for (unsigned i = 0; i != Params.size(); ++i)
4114 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4115 GEN_ERROR("Function arguments must be value types!");
4116
4117 CHECK_FOR_ERROR
4118
Dan Gohman54392c12008-04-19 00:24:39 +00004119 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4120 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4121 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004122 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004123 ;}
4124 break;
4125
4126 case 152:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004127#line 1403 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004128 { // Sized array type?
4129 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4130 delete (yyvsp[(4) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004131 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004132 ;}
4133 break;
4134
4135 case 153:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004136#line 1408 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004137 { // Vector type?
4138 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4139 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004140 GEN_ERROR("Unsigned result not equal to signed result");
4141 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4142 GEN_ERROR("Element type of a VectorType must be primitive");
Dan Gohman54392c12008-04-19 00:24:39 +00004143 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4144 delete (yyvsp[(4) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004145 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004146 ;}
4147 break;
4148
4149 case 154:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004150#line 1418 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004151 { // Structure type?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004152 std::vector<const Type*> Elements;
Dan Gohman54392c12008-04-19 00:24:39 +00004153 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4154 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004155 Elements.push_back(*I);
4156
Dan Gohman54392c12008-04-19 00:24:39 +00004157 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4158 delete (yyvsp[(2) - (3)].TypeList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004159 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004160 ;}
4161 break;
4162
4163 case 155:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004164#line 1428 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004165 { // Empty structure type?
4166 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004167 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004168 ;}
4169 break;
4170
4171 case 156:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004172#line 1432 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004173 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004174 std::vector<const Type*> Elements;
Dan Gohman54392c12008-04-19 00:24:39 +00004175 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4176 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004177 Elements.push_back(*I);
4178
Dan Gohman54392c12008-04-19 00:24:39 +00004179 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4180 delete (yyvsp[(3) - (5)].TypeList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004181 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004182 ;}
4183 break;
4184
4185 case 157:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004186#line 1442 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004187 { // Empty structure type?
4188 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004189 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004190 ;}
4191 break;
4192
4193 case 158:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004194#line 1449 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004195 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004196 // Allow but ignore attributes on function types; this permits auto-upgrade.
4197 // FIXME: remove in LLVM 3.0.
Dan Gohman54392c12008-04-19 00:24:39 +00004198 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4199 (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
4200 ;}
4201 break;
4202
4203 case 159:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004204#line 1458 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004205 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004206 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004207 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4208 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004209 GEN_ERROR("LLVM functions cannot return aggregate types");
Dan Gohman54392c12008-04-19 00:24:39 +00004210 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4211 ;}
4212 break;
4213
4214 case 160:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004215#line 1465 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004216 {
4217 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4218 ;}
4219 break;
4220
4221 case 161:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004222#line 1470 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004223 {
4224 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4225 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004226 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004227 ;}
4228 break;
4229
4230 case 162:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004231#line 1475 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004232 {
4233 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004234 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004235 ;}
4236 break;
4237
4238 case 164:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004239#line 1483 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004240 {
4241 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004242 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4243 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohman54392c12008-04-19 00:24:39 +00004244 (yyval.TypeWithAttrsList)->push_back(TWA);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004245 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004246 ;}
4247 break;
4248
4249 case 165:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004250#line 1490 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004251 {
4252 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004253 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4254 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohman54392c12008-04-19 00:24:39 +00004255 (yyval.TypeWithAttrsList)->push_back(TWA);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004256 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004257 ;}
4258 break;
4259
4260 case 166:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004261#line 1497 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004262 {
4263 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004264 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004265 ;}
4266 break;
4267
4268 case 167:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004269#line 1505 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004270 {
4271 (yyval.TypeList) = new std::list<PATypeHolder>();
4272 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4273 delete (yyvsp[(1) - (1)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004274 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004275 ;}
4276 break;
4277
4278 case 168:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004279#line 1511 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004280 {
4281 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4282 delete (yyvsp[(3) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004283 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004284 ;}
4285 break;
4286
4287 case 169:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004288#line 1523 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004289 { // Nonempty unsized arr
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004290 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004291 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4292 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004293 if (ATy == 0)
4294 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004295 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004296 const Type *ETy = ATy->getElementType();
4297 int NumElements = ATy->getNumElements();
4298
4299 // Verify that we have the correct size...
Dan Gohman54392c12008-04-19 00:24:39 +00004300 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004301 GEN_ERROR("Type mismatch: constant sized array initialized with " +
Dan Gohman54392c12008-04-19 00:24:39 +00004302 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004303 itostr(NumElements) + "");
4304
4305 // Verify all elements are correct type!
Dan Gohman54392c12008-04-19 00:24:39 +00004306 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4307 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004308 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4309 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohman54392c12008-04-19 00:24:39 +00004310 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004311 }
4312
Dan Gohman54392c12008-04-19 00:24:39 +00004313 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4314 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004315 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004316 ;}
4317 break;
4318
4319 case 170:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004320#line 1551 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004321 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004322 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004323 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4324 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004325 if (ATy == 0)
4326 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004327 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004328
4329 int NumElements = ATy->getNumElements();
4330 if (NumElements != -1 && NumElements != 0)
4331 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
4332 " arguments, but has size of " + itostr(NumElements) +"");
Dan Gohman54392c12008-04-19 00:24:39 +00004333 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4334 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004335 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004336 ;}
4337 break;
4338
4339 case 171:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004340#line 1567 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004341 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004342 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004343 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4344 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004345 if (ATy == 0)
4346 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004347 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004348
4349 int NumElements = ATy->getNumElements();
4350 const Type *ETy = ATy->getElementType();
Dan Gohman54392c12008-04-19 00:24:39 +00004351 if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004352 GEN_ERROR("Can't build string constant of size " +
Dan Gohman54392c12008-04-19 00:24:39 +00004353 itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004354 " when array has size " + itostr(NumElements) + "");
4355 std::vector<Constant*> Vals;
4356 if (ETy == Type::Int8Ty) {
Dan Gohman54392c12008-04-19 00:24:39 +00004357 for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
4358 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004359 } else {
Dan Gohman54392c12008-04-19 00:24:39 +00004360 delete (yyvsp[(3) - (3)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004361 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4362 }
Dan Gohman54392c12008-04-19 00:24:39 +00004363 delete (yyvsp[(3) - (3)].StrVal);
4364 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4365 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004366 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004367 ;}
4368 break;
4369
4370 case 172:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004371#line 1594 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004372 { // Nonempty unsized arr
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004373 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004374 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4375 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004376 if (PTy == 0)
4377 GEN_ERROR("Cannot make packed constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004378 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004379 const Type *ETy = PTy->getElementType();
4380 int NumElements = PTy->getNumElements();
4381
4382 // Verify that we have the correct size...
Dan Gohman54392c12008-04-19 00:24:39 +00004383 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004384 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
Dan Gohman54392c12008-04-19 00:24:39 +00004385 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004386 itostr(NumElements) + "");
4387
4388 // Verify all elements are correct type!
Dan Gohman54392c12008-04-19 00:24:39 +00004389 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4390 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004391 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4392 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohman54392c12008-04-19 00:24:39 +00004393 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004394 }
4395
Dan Gohman54392c12008-04-19 00:24:39 +00004396 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4397 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004398 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004399 ;}
4400 break;
4401
4402 case 173:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004403#line 1622 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004404 {
4405 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004406 if (STy == 0)
4407 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004408 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004409
Dan Gohman54392c12008-04-19 00:24:39 +00004410 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004411 GEN_ERROR("Illegal number of initializers for structure type");
4412
4413 // Check to ensure that constants are compatible with the type initializer!
Dan Gohman54392c12008-04-19 00:24:39 +00004414 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4415 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004416 GEN_ERROR("Expected type '" +
4417 STy->getElementType(i)->getDescription() +
4418 "' for element #" + utostr(i) +
4419 " of structure initializer");
4420
4421 // Check to ensure that Type is not packed
4422 if (STy->isPacked())
4423 GEN_ERROR("Unpacked Initializer to vector type '" +
4424 STy->getDescription() + "'");
4425
Dan Gohman54392c12008-04-19 00:24:39 +00004426 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4427 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004428 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004429 ;}
4430 break;
4431
4432 case 174:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004433#line 1648 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004434 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004435 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004436 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4437 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004438 if (STy == 0)
4439 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004440 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004441
4442 if (STy->getNumContainedTypes() != 0)
4443 GEN_ERROR("Illegal number of initializers for structure type");
4444
4445 // Check to ensure that Type is not packed
4446 if (STy->isPacked())
4447 GEN_ERROR("Unpacked Initializer to vector type '" +
4448 STy->getDescription() + "'");
4449
Dan Gohman54392c12008-04-19 00:24:39 +00004450 (yyval.ConstVal) = ConstantStruct::get(STy, 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
4456 case 175:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004457#line 1668 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004458 {
4459 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004460 if (STy == 0)
4461 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004462 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004463
Dan Gohman54392c12008-04-19 00:24:39 +00004464 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004465 GEN_ERROR("Illegal number of initializers for structure type");
4466
4467 // Check to ensure that constants are compatible with the type initializer!
Dan Gohman54392c12008-04-19 00:24:39 +00004468 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4469 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004470 GEN_ERROR("Expected type '" +
4471 STy->getElementType(i)->getDescription() +
4472 "' for element #" + utostr(i) +
4473 " of structure initializer");
4474
4475 // Check to ensure that Type is packed
4476 if (!STy->isPacked())
4477 GEN_ERROR("Vector initializer to non-vector type '" +
4478 STy->getDescription() + "'");
4479
Dan Gohman54392c12008-04-19 00:24:39 +00004480 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4481 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004482 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004483 ;}
4484 break;
4485
4486 case 176:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004487#line 1694 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004488 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004489 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004490 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4491 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004492 if (STy == 0)
4493 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004494 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004495
4496 if (STy->getNumContainedTypes() != 0)
4497 GEN_ERROR("Illegal number of initializers for structure type");
4498
4499 // Check to ensure that Type is packed
4500 if (!STy->isPacked())
4501 GEN_ERROR("Vector initializer to non-vector type '" +
4502 STy->getDescription() + "'");
4503
Dan Gohman54392c12008-04-19 00:24:39 +00004504 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4505 delete (yyvsp[(1) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004506 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004507 ;}
4508 break;
4509
4510 case 177:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004511#line 1714 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004512 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004513 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004514 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4515 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004516 if (PTy == 0)
4517 GEN_ERROR("Cannot make null pointer constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004518 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004519
Dan Gohman54392c12008-04-19 00:24:39 +00004520 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4521 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004522 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004523 ;}
4524 break;
4525
4526 case 178:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004527#line 1726 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004528 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004529 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004530 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4531 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4532 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004533 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004534 ;}
4535 break;
4536
4537 case 179:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004538#line 1733 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004539 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004540 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004541 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4542 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004543 if (Ty == 0)
Dan Gohman54392c12008-04-19 00:24:39 +00004544 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004545
4546 // ConstExprs can exist in the body of a function, thus creating
4547 // GlobalValues whenever they refer to a variable. Because we are in
4548 // the context of a function, getExistingVal will search the functions
4549 // symbol table instead of the module symbol table for the global symbol,
4550 // which throws things all off. To get around this, we just tell
4551 // getExistingVal that we are at global scope here.
4552 //
4553 Function *SavedCurFn = CurFun.CurrentFunction;
4554 CurFun.CurrentFunction = 0;
4555
Dan Gohman54392c12008-04-19 00:24:39 +00004556 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004557 CHECK_FOR_ERROR
4558
4559 CurFun.CurrentFunction = SavedCurFn;
4560
4561 // If this is an initializer for a constant pointer, which is referencing a
4562 // (currently) undefined variable, create a stub now that shall be replaced
4563 // in the future with the right type of variable.
4564 //
4565 if (V == 0) {
4566 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4567 const PointerType *PT = cast<PointerType>(Ty);
4568
4569 // First check to see if the forward references value is already created!
4570 PerModuleInfo::GlobalRefsType::iterator I =
Dan Gohman54392c12008-04-19 00:24:39 +00004571 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004572
4573 if (I != CurModule.GlobalRefs.end()) {
4574 V = I->second; // Placeholder already exists, use it...
Dan Gohman54392c12008-04-19 00:24:39 +00004575 (yyvsp[(2) - (2)].ValIDVal).destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004576 } else {
4577 std::string Name;
Dan Gohman54392c12008-04-19 00:24:39 +00004578 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4579 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4580 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004581 GEN_ERROR("Invalid reference to global");
4582
4583 // Create the forward referenced global.
4584 GlobalValue *GV;
4585 if (const FunctionType *FTy =
4586 dyn_cast<FunctionType>(PT->getElementType())) {
Gabor Greif89f01162008-04-06 23:07:54 +00004587 GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
4588 CurModule.CurrentModule);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004589 } else {
4590 GV = new GlobalVariable(PT->getElementType(), false,
4591 GlobalValue::ExternalWeakLinkage, 0,
4592 Name, CurModule.CurrentModule);
4593 }
4594
4595 // Keep track of the fact that we have a forward ref to recycle it
Dan Gohman54392c12008-04-19 00:24:39 +00004596 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004597 V = GV;
4598 }
4599 }
4600
Dan Gohman54392c12008-04-19 00:24:39 +00004601 (yyval.ConstVal) = cast<GlobalValue>(V);
4602 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004603 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004604 ;}
4605 break;
4606
4607 case 180:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004608#line 1799 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004609 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004610 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004611 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4612 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004613 GEN_ERROR("Mismatched types for constant expression: " +
Dan Gohman54392c12008-04-19 00:24:39 +00004614 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4615 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4616 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004617 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004618 ;}
4619 break;
4620
4621 case 181:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004622#line 1809 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004623 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004624 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004625 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4626 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004627 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4628 GEN_ERROR("Cannot create a null initialized value of this type");
Dan Gohman54392c12008-04-19 00:24:39 +00004629 (yyval.ConstVal) = Constant::getNullValue(Ty);
4630 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004631 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004632 ;}
4633 break;
4634
4635 case 182:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004636#line 1819 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004637 { // integral constants
4638 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004639 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohman54392c12008-04-19 00:24:39 +00004640 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004641 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004642 ;}
4643 break;
4644
4645 case 183:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004646#line 1825 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004647 { // arbitrary precision integer constants
4648 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4649 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004650 GEN_ERROR("Constant value does not fit in type");
4651 }
Dan Gohman54392c12008-04-19 00:24:39 +00004652 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4653 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4654 delete (yyvsp[(2) - (2)].APIntVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004655 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004656 ;}
4657 break;
4658
4659 case 184:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004660#line 1835 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004661 { // integral constants
4662 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004663 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohman54392c12008-04-19 00:24:39 +00004664 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004665 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004666 ;}
4667 break;
4668
4669 case 185:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004670#line 1841 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004671 { // arbitrary precision integer constants
4672 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4673 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004674 GEN_ERROR("Constant value does not fit in type");
4675 }
Dan Gohman54392c12008-04-19 00:24:39 +00004676 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4677 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4678 delete (yyvsp[(2) - (2)].APIntVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004679 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004680 ;}
4681 break;
4682
4683 case 186:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004684#line 1851 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004685 { // Boolean constants
4686 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4687 (yyval.ConstVal) = ConstantInt::getTrue();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004688 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004689 ;}
4690 break;
4691
4692 case 187:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004693#line 1856 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004694 { // Boolean constants
4695 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4696 (yyval.ConstVal) = ConstantInt::getFalse();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004697 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004698 ;}
4699 break;
4700
4701 case 188:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004702#line 1861 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004703 { // Floating point constants
4704 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004705 GEN_ERROR("Floating point constant invalid for type");
Dale Johannesen255b8fe2007-09-11 18:33:39 +00004706 // Lexer has no type info, so builds all float and double FP constants
4707 // as double. Fix this here. Long double is done right.
Dan Gohman54392c12008-04-19 00:24:39 +00004708 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4709 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
Chris Lattner05ba86e2008-04-20 00:41:19 +00004710 (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal));
Dan Gohman54392c12008-04-19 00:24:39 +00004711 delete (yyvsp[(2) - (2)].FPVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004712 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004713 ;}
4714 break;
4715
4716 case 189:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004717#line 1874 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004718 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004719 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004720 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4721 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4722 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4723 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004724 GEN_ERROR("invalid cast opcode for cast from '" +
4725 Val->getType()->getDescription() + "' to '" +
4726 DestTy->getDescription() + "'");
Dan Gohman54392c12008-04-19 00:24:39 +00004727 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4728 delete (yyvsp[(5) - (6)].TypeVal);
4729 ;}
4730 break;
4731
4732 case 190:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004733#line 1886 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004734 {
4735 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004736 GEN_ERROR("GetElementPtr requires a pointer operand");
4737
4738 const Type *IdxTy =
Dan Gohman54392c12008-04-19 00:24:39 +00004739 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end(),
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004740 true);
4741 if (!IdxTy)
4742 GEN_ERROR("Index list invalid for constant getelementptr");
4743
4744 SmallVector<Constant*, 8> IdxVec;
Dan Gohman54392c12008-04-19 00:24:39 +00004745 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4746 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004747 IdxVec.push_back(C);
4748 else
4749 GEN_ERROR("Indices to constant getelementptr must be constants");
4750
Dan Gohman54392c12008-04-19 00:24:39 +00004751 delete (yyvsp[(4) - (5)].ValueList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004752
Dan Gohman54392c12008-04-19 00:24:39 +00004753 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004754 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004755 ;}
4756 break;
4757
4758 case 191:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004759#line 1908 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004760 {
4761 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004762 GEN_ERROR("Select condition must be of boolean type");
Dan Gohman54392c12008-04-19 00:24:39 +00004763 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004764 GEN_ERROR("Select operand types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00004765 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004766 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004767 ;}
4768 break;
4769
4770 case 192:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004771#line 1916 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004772 {
4773 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004774 GEN_ERROR("Binary operator types must match");
4775 CHECK_FOR_ERROR;
Dan Gohman54392c12008-04-19 00:24:39 +00004776 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4777 ;}
4778 break;
4779
4780 case 193:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004781#line 1922 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004782 {
4783 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004784 GEN_ERROR("Logical operator types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00004785 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
4786 if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
4787 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004788 GEN_ERROR("Logical operator requires integral operands");
4789 }
Dan Gohman54392c12008-04-19 00:24:39 +00004790 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004791 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004792 ;}
4793 break;
4794
4795 case 194:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004796#line 1933 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004797 {
4798 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004799 GEN_ERROR("icmp operand types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00004800 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4801 ;}
4802 break;
4803
4804 case 195:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004805#line 1938 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004806 {
4807 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004808 GEN_ERROR("fcmp operand types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00004809 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4810 ;}
4811 break;
4812
4813 case 196:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004814#line 1943 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004815 {
4816 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004817 GEN_ERROR("Invalid extractelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00004818 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004819 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004820 ;}
4821 break;
4822
4823 case 197:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004824#line 1949 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004825 {
4826 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004827 GEN_ERROR("Invalid insertelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00004828 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004829 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004830 ;}
4831 break;
4832
4833 case 198:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004834#line 1955 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004835 {
4836 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004837 GEN_ERROR("Invalid shufflevector operands");
Dan Gohman54392c12008-04-19 00:24:39 +00004838 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004839 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004840 ;}
4841 break;
4842
4843 case 199:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004844#line 1964 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004845 {
4846 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004847 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004848 ;}
4849 break;
4850
4851 case 200:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004852#line 1968 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004853 {
4854 (yyval.ConstVector) = new std::vector<Constant*>();
4855 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004856 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004857 ;}
4858 break;
4859
4860 case 201:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004861#line 1976 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004862 { (yyval.BoolVal) = false; ;}
4863 break;
4864
4865 case 202:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004866#line 1976 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004867 { (yyval.BoolVal) = true; ;}
4868 break;
4869
4870 case 203:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004871#line 1979 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004872 { (yyval.BoolVal) = true; ;}
4873 break;
4874
4875 case 204:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004876#line 1979 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004877 { (yyval.BoolVal) = false; ;}
4878 break;
4879
4880 case 205:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004881#line 1982 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004882 {
4883 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
4884 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
Chris Lattnerbb856a32007-08-06 21:00:46 +00004885 CHECK_FOR_ERROR
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004886 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
4887 if (!Aliasee)
4888 GEN_ERROR("Aliases can be created only to global values");
4889
Dan Gohman54392c12008-04-19 00:24:39 +00004890 (yyval.ConstVal) = Aliasee;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004891 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004892 delete (yyvsp[(1) - (2)].TypeVal);
4893 ;}
4894 break;
4895
4896 case 206:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004897#line 1994 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004898 {
4899 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4900 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4901 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004902 GEN_ERROR("invalid cast opcode for cast from '" +
4903 Val->getType()->getDescription() + "' to '" +
4904 DestTy->getDescription() + "'");
4905
Dan Gohman54392c12008-04-19 00:24:39 +00004906 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004907 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004908 delete (yyvsp[(5) - (6)].TypeVal);
4909 ;}
4910 break;
4911
4912 case 207:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004913#line 2015 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004914 {
4915 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
Christopher Lamb668d9a02007-12-12 08:45:45 +00004916 CurModule.ModuleDone();
4917 CHECK_FOR_ERROR;
Dan Gohman54392c12008-04-19 00:24:39 +00004918 ;}
4919 break;
4920
4921 case 208:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004922#line 2020 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004923 {
4924 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
Dale Johannesena79ecf32008-02-20 21:15:43 +00004925 CurModule.ModuleDone();
4926 CHECK_FOR_ERROR;
Dan Gohman54392c12008-04-19 00:24:39 +00004927 ;}
4928 break;
4929
4930 case 211:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004931#line 2033 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004932 { CurFun.isDeclare = false; ;}
4933 break;
4934
4935 case 212:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004936#line 2033 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004937 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004938 CurFun.FunctionDone();
4939 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004940 ;}
4941 break;
4942
4943 case 213:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004944#line 2037 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004945 { CurFun.isDeclare = true; ;}
4946 break;
4947
4948 case 214:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004949#line 2037 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004950 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00004951 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004952 ;}
4953 break;
4954
4955 case 215:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004956#line 2040 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004957 {
Dale Johannesena79ecf32008-02-20 21:15:43 +00004958 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004959 ;}
4960 break;
4961
4962 case 216:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004963#line 2043 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004964 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004965 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004966 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004967 // Eagerly resolve types. This is not an optimization, this is a
4968 // requirement that is due to the fact that we could have this:
4969 //
4970 // %list = type { %list * }
4971 // %list = type { %list * } ; repeated type decl
4972 //
4973 // If types are not resolved eagerly, then the two types will not be
4974 // determined to be the same type!
4975 //
Dan Gohman54392c12008-04-19 00:24:39 +00004976 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004977
Dan Gohman54392c12008-04-19 00:24:39 +00004978 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004979 CHECK_FOR_ERROR
4980 // If this is a named type that is not a redefinition, add it to the slot
4981 // table.
Dan Gohman54392c12008-04-19 00:24:39 +00004982 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004983 }
4984
Dan Gohman54392c12008-04-19 00:24:39 +00004985 delete (yyvsp[(3) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004986 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004987 ;}
4988 break;
Reid Spenceraa8ae282007-07-31 03:50:36 +00004989
Dan Gohman54392c12008-04-19 00:24:39 +00004990 case 217:
Dan Gohmandecb8c02008-04-23 20:11:27 +00004991#line 2067 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004992 {
4993 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
4994
4995 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004996 CHECK_FOR_ERROR
4997 // If this is a named type that is not a redefinition, add it to the slot
4998 // table.
Dan Gohman54392c12008-04-19 00:24:39 +00004999 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005000 }
5001 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005002 ;}
5003 break;
5004
5005 case 218:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005006#line 2079 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005007 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005008 /* "Externally Visible" Linkage */
Dan Gohman54392c12008-04-19 00:24:39 +00005009 if ((yyvsp[(5) - (6)].ConstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005010 GEN_ERROR("Global value initializer is not a constant");
Dan Gohman54392c12008-04-19 00:24:39 +00005011 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5012 (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 +00005013 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005014 ;}
5015 break;
5016
5017 case 219:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005018#line 2086 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005019 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005020 CurGV = 0;
Dan Gohman54392c12008-04-19 00:24:39 +00005021 ;}
5022 break;
5023
5024 case 220:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005025#line 2090 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005026 {
5027 if ((yyvsp[(6) - (7)].ConstVal) == 0)
Christopher Lamb668d9a02007-12-12 08:45:45 +00005028 GEN_ERROR("Global value initializer is not a constant");
Dan Gohman54392c12008-04-19 00:24:39 +00005029 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 +00005030 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005031 ;}
5032 break;
5033
5034 case 221:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005035#line 2095 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005036 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005037 CurGV = 0;
Dan Gohman54392c12008-04-19 00:24:39 +00005038 ;}
5039 break;
5040
5041 case 222:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005042#line 2099 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005043 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005044 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005045 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5046 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 +00005047 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005048 delete (yyvsp[(6) - (7)].TypeVal);
5049 ;}
5050 break;
5051
5052 case 223:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005053#line 2105 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005054 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005055 CurGV = 0;
5056 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005057 ;}
5058 break;
5059
5060 case 224:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005061#line 2109 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005062 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005063 std::string Name;
Dan Gohman54392c12008-04-19 00:24:39 +00005064 if ((yyvsp[(1) - (5)].StrVal)) {
5065 Name = *(yyvsp[(1) - (5)].StrVal);
5066 delete (yyvsp[(1) - (5)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005067 }
5068 if (Name.empty())
5069 GEN_ERROR("Alias name cannot be empty");
5070
Dan Gohman54392c12008-04-19 00:24:39 +00005071 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005072 if (Aliasee == 0)
5073 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
5074
Dan Gohman54392c12008-04-19 00:24:39 +00005075 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005076 CurModule.CurrentModule);
Dan Gohman54392c12008-04-19 00:24:39 +00005077 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005078 InsertValue(GA, CurModule.Values);
Chris Lattner5eefce32007-09-10 23:24:14 +00005079
5080
5081 // If there was a forward reference of this alias, resolve it now.
5082
5083 ValID ID;
5084 if (!Name.empty())
5085 ID = ValID::createGlobalName(Name);
5086 else
5087 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5088
5089 if (GlobalValue *FWGV =
5090 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5091 // Replace uses of the fwdref with the actual alias.
5092 FWGV->replaceAllUsesWith(GA);
5093 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5094 GV->eraseFromParent();
5095 else
5096 cast<Function>(FWGV)->eraseFromParent();
5097 }
5098 ID.destroy();
5099
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005100 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005101 ;}
5102 break;
5103
5104 case 225:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005105#line 2149 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005106 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005107 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005108 ;}
5109 break;
5110
5111 case 226:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005112#line 2152 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005113 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005114 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005115 ;}
5116 break;
5117
5118 case 227:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005119#line 2158 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005120 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005121 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
5122 if (AsmSoFar.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005123 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005124 else
Dan Gohman54392c12008-04-19 00:24:39 +00005125 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5126 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005127 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005128;}
5129 break;
5130
5131 case 228:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005132#line 2168 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005133 {
5134 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5135 delete (yyvsp[(3) - (3)].StrVal);
5136 ;}
5137 break;
5138
5139 case 229:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005140#line 2172 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005141 {
5142 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5143 delete (yyvsp[(3) - (3)].StrVal);
5144 ;}
5145 break;
5146
5147 case 231:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005148#line 2179 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005149 {
5150 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5151 delete (yyvsp[(3) - (3)].StrVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00005152 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005153 ;}
5154 break;
5155
5156 case 232:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005157#line 2184 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005158 {
5159 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5160 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer47470022007-07-31 14:41:17 +00005161 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005162 ;}
5163 break;
5164
5165 case 233:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005166#line 2189 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005167 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005168 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005169 ;}
5170 break;
5171
5172 case 234:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005173#line 2198 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005174 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005175 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005176 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
5177 if (*(yyvsp[(3) - (5)].TypeVal) == Type::VoidTy)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005178 GEN_ERROR("void typed arguments are invalid");
Dan Gohman54392c12008-04-19 00:24:39 +00005179 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5180 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5181 (yyvsp[(1) - (5)].ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005182 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005183 ;}
5184 break;
5185
5186 case 235:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005187#line 2208 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005188 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005189 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005190 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
5191 if (*(yyvsp[(1) - (3)].TypeVal) == Type::VoidTy)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005192 GEN_ERROR("void typed arguments are invalid");
Dan Gohman54392c12008-04-19 00:24:39 +00005193 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5194 (yyval.ArgList) = new ArgListType;
5195 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005196 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005197 ;}
5198 break;
5199
5200 case 236:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005201#line 2219 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005202 {
5203 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005204 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005205 ;}
5206 break;
5207
5208 case 237:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005209#line 2223 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005210 {
5211 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005212 struct ArgListEntry E;
5213 E.Ty = new PATypeHolder(Type::VoidTy);
5214 E.Name = 0;
5215 E.Attrs = ParamAttr::None;
Dan Gohman54392c12008-04-19 00:24:39 +00005216 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005217 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005218 ;}
5219 break;
5220
5221 case 238:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005222#line 2232 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005223 {
5224 (yyval.ArgList) = new ArgListType;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005225 struct ArgListEntry E;
5226 E.Ty = new PATypeHolder(Type::VoidTy);
5227 E.Name = 0;
5228 E.Attrs = ParamAttr::None;
Dan Gohman54392c12008-04-19 00:24:39 +00005229 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005230 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005231 ;}
5232 break;
5233
5234 case 239:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005235#line 2241 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005236 {
5237 (yyval.ArgList) = 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005238 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005239 ;}
5240 break;
5241
5242 case 240:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005243#line 2247 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005244 {
5245 std::string FunctionName(*(yyvsp[(3) - (10)].StrVal));
5246 delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory!
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005247
5248 // Check the function result for abstractness if this is a define. We should
5249 // have no abstract types at this point
Dan Gohman54392c12008-04-19 00:24:39 +00005250 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal)))
5251 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005252
Chris Lattner73de3c02008-04-23 05:37:08 +00005253 if (!FunctionType::isValidReturnType(*(yyvsp[(2) - (10)].TypeVal)))
5254 GEN_ERROR("Invalid result type for LLVM function");
5255
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005256 std::vector<const Type*> ParamTypeList;
Chris Lattner1c8733e2008-03-12 17:45:29 +00005257 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohman54392c12008-04-19 00:24:39 +00005258 if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None)
5259 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(7) - (10)].ParamAttrs)));
5260 if ((yyvsp[(5) - (10)].ArgList)) { // If there are arguments...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005261 unsigned index = 1;
Dan Gohman54392c12008-04-19 00:24:39 +00005262 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); I != (yyvsp[(5) - (10)].ArgList)->end(); ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005263 const Type* Ty = I->Ty->get();
5264 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5265 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
5266 ParamTypeList.push_back(Ty);
Chris Lattner1c8733e2008-03-12 17:45:29 +00005267 if (Ty != Type::VoidTy && I->Attrs != ParamAttr::None)
5268 Attrs.push_back(ParamAttrsWithIndex::get(index, I->Attrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005269 }
5270 }
5271
5272 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5273 if (isVarArg) ParamTypeList.pop_back();
5274
Chris Lattner1c8733e2008-03-12 17:45:29 +00005275 PAListPtr PAL;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005276 if (!Attrs.empty())
Chris Lattner1c8733e2008-03-12 17:45:29 +00005277 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005278
Dan Gohman54392c12008-04-19 00:24:39 +00005279 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg);
Christopher Lambfb623c62007-12-17 01:17:35 +00005280 const PointerType *PFT = PointerType::getUnqual(FT);
Dan Gohman54392c12008-04-19 00:24:39 +00005281 delete (yyvsp[(2) - (10)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005282
5283 ValID ID;
5284 if (!FunctionName.empty()) {
5285 ID = ValID::createGlobalName((char*)FunctionName.c_str());
5286 } else {
5287 ID = ValID::createGlobalID(CurModule.Values.size());
5288 }
5289
5290 Function *Fn = 0;
5291 // See if this function was forward referenced. If so, recycle the object.
5292 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5293 // Move the function to the end of the list, from whereever it was
5294 // previously inserted.
5295 Fn = cast<Function>(FWRef);
Chris Lattner1c8733e2008-03-12 17:45:29 +00005296 assert(Fn->getParamAttrs().isEmpty() &&
5297 "Forward reference has parameter attributes!");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005298 CurModule.CurrentModule->getFunctionList().remove(Fn);
5299 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5300 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
5301 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005302 if (Fn->getFunctionType() != FT ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005303 // The existing function doesn't have the same type. This is an overload
5304 // error.
5305 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005306 } else if (Fn->getParamAttrs() != PAL) {
5307 // The existing function doesn't have the same parameter attributes.
5308 // This is an overload error.
5309 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005310 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
5311 // Neither the existing or the current function is a declaration and they
5312 // have the same name and same type. Clearly this is a redefinition.
5313 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005314 } else if (Fn->isDeclaration()) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005315 // Make sure to strip off any argument names so we can't get conflicts.
5316 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5317 AI != AE; ++AI)
5318 AI->setName("");
5319 }
5320 } else { // Not already defined?
Gabor Greif89f01162008-04-06 23:07:54 +00005321 Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5322 CurModule.CurrentModule);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005323 InsertValue(Fn, CurModule.Values);
5324 }
5325
5326 CurFun.FunctionStart(Fn);
5327
5328 if (CurFun.isDeclare) {
5329 // If we have declaration, always overwrite linkage. This will allow us to
5330 // correctly handle cases, when pointer to function is passed as argument to
5331 // another function.
5332 Fn->setLinkage(CurFun.Linkage);
5333 Fn->setVisibility(CurFun.Visibility);
5334 }
Dan Gohman54392c12008-04-19 00:24:39 +00005335 Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005336 Fn->setParamAttrs(PAL);
Dan Gohman54392c12008-04-19 00:24:39 +00005337 Fn->setAlignment((yyvsp[(9) - (10)].UIntVal));
5338 if ((yyvsp[(8) - (10)].StrVal)) {
5339 Fn->setSection(*(yyvsp[(8) - (10)].StrVal));
5340 delete (yyvsp[(8) - (10)].StrVal);
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005341 }
Dan Gohman54392c12008-04-19 00:24:39 +00005342 if ((yyvsp[(10) - (10)].StrVal)) {
5343 Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str());
5344 delete (yyvsp[(10) - (10)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005345 }
5346
5347 // Add all of the arguments we parsed to the function...
Dan Gohman54392c12008-04-19 00:24:39 +00005348 if ((yyvsp[(5) - (10)].ArgList)) { // Is null if empty...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005349 if (isVarArg) { // Nuke the last entry
Dan Gohman54392c12008-04-19 00:24:39 +00005350 assert((yyvsp[(5) - (10)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (10)].ArgList)->back().Name == 0 &&
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005351 "Not a varargs marker!");
Dan Gohman54392c12008-04-19 00:24:39 +00005352 delete (yyvsp[(5) - (10)].ArgList)->back().Ty;
5353 (yyvsp[(5) - (10)].ArgList)->pop_back(); // Delete the last entry
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005354 }
5355 Function::arg_iterator ArgIt = Fn->arg_begin();
5356 Function::arg_iterator ArgEnd = Fn->arg_end();
5357 unsigned Idx = 1;
Dan Gohman54392c12008-04-19 00:24:39 +00005358 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin();
5359 I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005360 delete I->Ty; // Delete the typeholder...
5361 setValueName(ArgIt, I->Name); // Insert arg into symtab...
5362 CHECK_FOR_ERROR
5363 InsertValue(ArgIt);
5364 Idx++;
5365 }
5366
Dan Gohman54392c12008-04-19 00:24:39 +00005367 delete (yyvsp[(5) - (10)].ArgList); // We're now done with the argument list
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005368 }
5369 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005370;}
5371 break;
5372
5373 case 243:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005374#line 2377 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005375 {
5376 (yyval.FunctionVal) = CurFun.CurrentFunction;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005377
5378 // Make sure that we keep track of the linkage type even if there was a
5379 // previous "declare".
Dan Gohman54392c12008-04-19 00:24:39 +00005380 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5381 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5382;}
5383 break;
5384
5385 case 246:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005386#line 2388 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005387 {
5388 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005389 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005390;}
5391 break;
5392
5393 case 247:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005394#line 2393 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005395 {
5396 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5397 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5398 (yyval.FunctionVal) = CurFun.CurrentFunction;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005399 CurFun.FunctionDone();
5400 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005401 ;}
5402 break;
5403
5404 case 248:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005405#line 2405 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005406 {
5407 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005408 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005409 ;}
5410 break;
5411
5412 case 249:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005413#line 2409 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005414 {
5415 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005416 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005417 ;}
5418 break;
5419
5420 case 250:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005421#line 2414 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005422 { // A reference to a direct constant
5423 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005424 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005425 ;}
5426 break;
5427
5428 case 251:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005429#line 2418 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005430 {
5431 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005432 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005433 ;}
5434 break;
5435
5436 case 252:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005437#line 2422 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005438 { // Perhaps it's an FP constant?
5439 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005440 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005441 ;}
5442 break;
5443
5444 case 253:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005445#line 2426 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005446 {
5447 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005448 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005449 ;}
5450 break;
5451
5452 case 254:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005453#line 2430 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005454 {
5455 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005456 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005457 ;}
5458 break;
5459
5460 case 255:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005461#line 2434 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005462 {
5463 (yyval.ValIDVal) = ValID::createNull();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005464 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005465 ;}
5466 break;
5467
5468 case 256:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005469#line 2438 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005470 {
5471 (yyval.ValIDVal) = ValID::createUndef();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005472 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005473 ;}
5474 break;
5475
5476 case 257:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005477#line 2442 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005478 { // A vector zero constant.
5479 (yyval.ValIDVal) = ValID::createZeroInit();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005480 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005481 ;}
5482 break;
5483
5484 case 258:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005485#line 2446 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005486 { // Nonempty unsized packed vector
5487 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5488 int NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005489
5490 VectorType* pt = VectorType::get(ETy, NumElements);
5491 PATypeHolder* PTy = new PATypeHolder(
5492 HandleUpRefs(
5493 VectorType::get(
5494 ETy,
5495 NumElements)
5496 )
5497 );
5498
5499 // Verify all elements are correct type!
Dan Gohman54392c12008-04-19 00:24:39 +00005500 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5501 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005502 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5503 ETy->getDescription() +"' as required!\nIt is of type '" +
Dan Gohman54392c12008-04-19 00:24:39 +00005504 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005505 }
5506
Dan Gohman54392c12008-04-19 00:24:39 +00005507 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5508 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005509 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005510 ;}
5511 break;
5512
5513 case 259:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005514#line 2471 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005515 {
5516 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005517 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005518 ;}
5519 break;
5520
5521 case 260:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005522#line 2475 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005523 {
5524 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5525 delete (yyvsp[(3) - (5)].StrVal);
5526 delete (yyvsp[(5) - (5)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005527 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005528 ;}
5529 break;
5530
5531 case 261:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005532#line 2485 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005533 { // Is it an integer reference...?
5534 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005535 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005536 ;}
5537 break;
5538
5539 case 262:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005540#line 2489 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005541 {
5542 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005543 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005544 ;}
5545 break;
5546
5547 case 263:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005548#line 2493 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005549 { // Is it a named reference...?
5550 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5551 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005552 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005553 ;}
5554 break;
5555
5556 case 264:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005557#line 2498 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005558 { // Is it a named reference...?
5559 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5560 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005561 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005562 ;}
5563 break;
5564
5565 case 267:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005566#line 2511 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005567 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005568 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005569 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5570 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5571 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005572 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005573 ;}
5574 break;
5575
5576 case 268:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005577#line 2520 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005578 {
5579 (yyval.ValueList) = new std::vector<Value *>();
5580 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
Devang Patelbf507402008-02-20 22:40:23 +00005581 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005582 ;}
5583 break;
5584
5585 case 269:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005586#line 2525 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005587 {
5588 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
Devang Patelbf507402008-02-20 22:40:23 +00005589 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005590 ;}
5591 break;
5592
5593 case 270:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005594#line 2530 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005595 {
5596 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005597 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005598 ;}
5599 break;
5600
5601 case 271:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005602#line 2534 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005603 { // Do not allow functions with 0 basic blocks
5604 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005605 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005606 ;}
5607 break;
5608
5609 case 272:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005610#line 2543 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005611 {
5612 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005613 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005614 InsertValue((yyvsp[(3) - (3)].TermInstVal));
5615 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
5616 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005617 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005618 ;}
5619 break;
5620
5621 case 273:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005622#line 2552 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005623 {
5624 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005625 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5626 if (CI2->getParent() == 0)
Dan Gohman54392c12008-04-19 00:24:39 +00005627 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
5628 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
5629 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005630 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005631 ;}
5632 break;
Chris Lattner59363a32008-02-19 04:36:25 +00005633
Dan Gohman54392c12008-04-19 00:24:39 +00005634 case 274:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005635#line 2561 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005636 { // Empty space between instruction lists
5637 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum), 0);
5638 CHECK_FOR_ERROR
5639 ;}
5640 break;
5641
5642 case 275:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005643#line 2565 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005644 { // Only the unwind to block
5645 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum), getBBVal((yyvsp[(3) - (3)].ValIDVal)));
5646 CHECK_FOR_ERROR
5647 ;}
5648 break;
5649
5650 case 276:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005651#line 2569 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005652 { // Labelled (named) basic block
5653 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)), 0);
5654 delete (yyvsp[(1) - (1)].StrVal);
5655 CHECK_FOR_ERROR
5656 ;}
5657 break;
5658
5659 case 277:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005660#line 2574 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005661 {
5662 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (4)].StrVal)), getBBVal((yyvsp[(4) - (4)].ValIDVal)));
5663 delete (yyvsp[(1) - (4)].StrVal);
5664 CHECK_FOR_ERROR
5665 ;}
5666 break;
5667
5668 case 278:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005669#line 2581 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005670 { // Return with a result...
5671 ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
5672 assert(!VL.empty() && "Invalid ret operands!");
5673 (yyval.TermInstVal) = ReturnInst::Create(&VL[0], VL.size());
5674 delete (yyvsp[(2) - (2)].ValueList);
5675 CHECK_FOR_ERROR
5676 ;}
5677 break;
5678
5679 case 279:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005680#line 2588 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005681 { // Return with no result...
5682 (yyval.TermInstVal) = ReturnInst::Create();
5683 CHECK_FOR_ERROR
5684 ;}
5685 break;
5686
5687 case 280:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005688#line 2592 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005689 { // Unconditional Branch...
5690 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
5691 CHECK_FOR_ERROR
5692 (yyval.TermInstVal) = BranchInst::Create(tmpBB);
5693 ;}
5694 break;
5695
5696 case 281:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005697#line 2597 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005698 {
5699 assert(cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?");
5700 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5701 CHECK_FOR_ERROR
5702 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
5703 CHECK_FOR_ERROR
5704 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
5705 CHECK_FOR_ERROR
5706 (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal);
5707 ;}
5708 break;
5709
5710 case 282:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005711#line 2607 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005712 {
5713 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
5714 CHECK_FOR_ERROR
5715 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5716 CHECK_FOR_ERROR
5717 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
5718 (yyval.TermInstVal) = S;
5719
5720 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
5721 E = (yyvsp[(8) - (9)].JumpTable)->end();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005722 for (; I != E; ++I) {
5723 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5724 S->addCase(CI, I->second);
5725 else
5726 GEN_ERROR("Switch case is constant, but not a simple integer");
5727 }
Dan Gohman54392c12008-04-19 00:24:39 +00005728 delete (yyvsp[(8) - (9)].JumpTable);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005729 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005730 ;}
5731 break;
5732
5733 case 283:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005734#line 2626 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005735 {
5736 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005737 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005738 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005739 CHECK_FOR_ERROR
Gabor Greif89f01162008-04-06 23:07:54 +00005740 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0);
Dan Gohman54392c12008-04-19 00:24:39 +00005741 (yyval.TermInstVal) = S;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005742 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005743 ;}
5744 break;
5745
5746 case 284:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005747#line 2636 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005748 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005749
5750 // Handle the short syntax
5751 const PointerType *PFTy = 0;
5752 const FunctionType *Ty = 0;
Dan Gohman54392c12008-04-19 00:24:39 +00005753 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005754 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5755 // Pull out the types of all of the arguments...
5756 std::vector<const Type*> ParamTypes;
Dan Gohman54392c12008-04-19 00:24:39 +00005757 ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005758 for (; I != E; ++I) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005759 const Type *Ty = I->Val->getType();
5760 if (Ty == Type::VoidTy)
5761 GEN_ERROR("Short call syntax cannot be used with varargs");
5762 ParamTypes.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005763 }
Chris Lattner73de3c02008-04-23 05:37:08 +00005764
5765 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (14)].TypeVal)))
5766 GEN_ERROR("Invalid result type for LLVM function");
5767
Dan Gohman54392c12008-04-19 00:24:39 +00005768 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
Christopher Lambfb623c62007-12-17 01:17:35 +00005769 PFTy = PointerType::getUnqual(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005770 }
5771
Dan Gohman54392c12008-04-19 00:24:39 +00005772 delete (yyvsp[(3) - (14)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005773
Dan Gohman54392c12008-04-19 00:24:39 +00005774 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005775 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005776 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005777 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005778 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005779 CHECK_FOR_ERROR
5780
Chris Lattner1c8733e2008-03-12 17:45:29 +00005781 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohman54392c12008-04-19 00:24:39 +00005782 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None)
5783 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (14)].ParamAttrs)));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005784
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005785 // Check the arguments
5786 ValueList Args;
Dan Gohman54392c12008-04-19 00:24:39 +00005787 if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005788 // Make sure no arguments is a good thing!
5789 if (Ty->getNumParams() != 0)
5790 GEN_ERROR("No arguments passed to a function that "
5791 "expects arguments");
5792 } else { // Has arguments?
5793 // Loop through FunctionType's arguments and ensure they are specified
5794 // correctly!
5795 FunctionType::param_iterator I = Ty->param_begin();
5796 FunctionType::param_iterator E = Ty->param_end();
Dan Gohman54392c12008-04-19 00:24:39 +00005797 ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005798 unsigned index = 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005799
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005800 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005801 if (ArgI->Val->getType() != *I)
5802 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5803 (*I)->getDescription() + "'");
5804 Args.push_back(ArgI->Val);
Chris Lattner1c8733e2008-03-12 17:45:29 +00005805 if (ArgI->Attrs != ParamAttr::None)
5806 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005807 }
5808
5809 if (Ty->isVarArg()) {
5810 if (I == E)
Chris Lattner59363a32008-02-19 04:36:25 +00005811 for (; ArgI != ArgE; ++ArgI, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005812 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner1c8733e2008-03-12 17:45:29 +00005813 if (ArgI->Attrs != ParamAttr::None)
5814 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Chris Lattner59363a32008-02-19 04:36:25 +00005815 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005816 } else if (I != E || ArgI != ArgE)
5817 GEN_ERROR("Invalid number of parameters detected");
5818 }
5819
Chris Lattner1c8733e2008-03-12 17:45:29 +00005820 PAListPtr PAL;
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005821 if (!Attrs.empty())
Chris Lattner1c8733e2008-03-12 17:45:29 +00005822 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005823
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005824 // Create the InvokeInst
Gabor Greif89f01162008-04-06 23:07:54 +00005825 InvokeInst *II = InvokeInst::Create(V, Normal, Except, Args.begin(),Args.end());
Dan Gohman54392c12008-04-19 00:24:39 +00005826 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005827 II->setParamAttrs(PAL);
Dan Gohman54392c12008-04-19 00:24:39 +00005828 (yyval.TermInstVal) = II;
5829 delete (yyvsp[(6) - (14)].ParamList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005830 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005831 ;}
5832 break;
5833
5834 case 285:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005835#line 2720 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005836 {
5837 (yyval.TermInstVal) = new UnwindInst();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005838 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005839 ;}
5840 break;
5841
5842 case 286:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005843#line 2724 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005844 {
5845 (yyval.TermInstVal) = new UnreachableInst();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005846 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005847 ;}
5848 break;
5849
5850 case 287:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005851#line 2731 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005852 {
5853 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
5854 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005855 CHECK_FOR_ERROR
5856 if (V == 0)
5857 GEN_ERROR("May only switch on a constant pool value");
5858
Dan Gohman54392c12008-04-19 00:24:39 +00005859 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005860 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005861 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5862 ;}
5863 break;
5864
5865 case 288:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005866#line 2742 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005867 {
5868 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5869 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005870 CHECK_FOR_ERROR
5871
5872 if (V == 0)
5873 GEN_ERROR("May only switch on a constant pool value");
5874
Dan Gohman54392c12008-04-19 00:24:39 +00005875 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005876 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005877 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5878 ;}
5879 break;
5880
5881 case 289:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005882#line 2755 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005883 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005884 // Is this definition named?? if so, assign the name...
Dan Gohman54392c12008-04-19 00:24:39 +00005885 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005886 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005887 InsertValue((yyvsp[(2) - (2)].InstVal));
5888 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005889 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005890 ;}
5891 break;
5892
5893 case 290:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005894#line 2765 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005895 { // Used for PHI nodes
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005896 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005897 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
5898 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5899 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005900 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005901 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005902 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005903 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5904 delete (yyvsp[(1) - (6)].TypeVal);
5905 ;}
5906 break;
5907
5908 case 291:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005909#line 2776 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005910 {
5911 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
5912 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005913 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005914 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005915 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005916 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5917 ;}
5918 break;
5919
5920 case 292:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005921#line 2786 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005922 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005923 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005924 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005925 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005926 // Used for call and invoke instructions
Dan Gohman54392c12008-04-19 00:24:39 +00005927 (yyval.ParamList) = new ParamList();
5928 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
5929 (yyval.ParamList)->push_back(E);
5930 delete (yyvsp[(1) - (4)].TypeVal);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005931 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005932 ;}
5933 break;
5934
5935 case 293:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005936#line 2797 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005937 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005938 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dale Johannesencfb19e62007-11-05 21:20:28 +00005939 // Labels are only valid in ASMs
Dan Gohman54392c12008-04-19 00:24:39 +00005940 (yyval.ParamList) = new ParamList();
5941 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
5942 (yyval.ParamList)->push_back(E);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005943 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005944 ;}
5945 break;
5946
5947 case 294:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005948#line 2805 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005949 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005950 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005951 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005952 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5953 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5954 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
5955 (yyval.ParamList)->push_back(E);
5956 delete (yyvsp[(3) - (6)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005957 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005958 ;}
5959 break;
5960
5961 case 295:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005962#line 2815 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005963 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005964 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dan Gohman54392c12008-04-19 00:24:39 +00005965 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5966 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
5967 (yyval.ParamList)->push_back(E);
Dale Johannesencfb19e62007-11-05 21:20:28 +00005968 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005969 ;}
5970 break;
5971
5972 case 296:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005973#line 2822 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005974 { (yyval.ParamList) = new ParamList(); ;}
5975 break;
5976
5977 case 297:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005978#line 2825 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005979 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5980 break;
5981
5982 case 298:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005983#line 2826 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005984 {
5985 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
5986 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005987 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005988 ;}
5989 break;
5990
5991 case 299:
Dan Gohmandecb8c02008-04-23 20:11:27 +00005992#line 2833 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005993 {
5994 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005995 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005996 ;}
5997 break;
5998
5999 case 300:
Dan Gohmandecb8c02008-04-23 20:11:27 +00006000#line 2837 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006001 {
6002 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006003 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006004 ;}
6005 break;
6006
6007 case 301:
Dan Gohmandecb8c02008-04-23 20:11:27 +00006008#line 2842 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006009 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006010 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006011 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6012 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
6013 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006014 GEN_ERROR(
6015 "Arithmetic operator requires integer, FP, or packed operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006016 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006017 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006018 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006019 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006020 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
6021 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006022 GEN_ERROR("binary operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006023 delete (yyvsp[(2) - (5)].TypeVal);
6024 ;}
6025 break;
6026
6027 case 302:
Dan Gohmandecb8c02008-04-23 20:11:27 +00006028#line 2858 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006029 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006030 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006031 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6032 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
6033 if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
6034 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006035 GEN_ERROR("Logical operator requires integral operands");
6036 }
Dan Gohman54392c12008-04-19 00:24:39 +00006037 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006038 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006039 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006040 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006041 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
6042 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006043 GEN_ERROR("binary operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006044 delete (yyvsp[(2) - (5)].TypeVal);
6045 ;}
6046 break;
6047
6048 case 303:
Dan Gohmandecb8c02008-04-23 20:11:27 +00006049#line 2875 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006050 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006051 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006052 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6053 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006054 GEN_ERROR("Vector types not supported by icmp instruction");
Dan Gohman54392c12008-04-19 00:24:39 +00006055 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006056 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006057 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006058 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006059 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
6060 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006061 GEN_ERROR("icmp operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006062 delete (yyvsp[(3) - (6)].TypeVal);
6063 ;}
6064 break;
6065
6066 case 304:
Dan Gohmandecb8c02008-04-23 20:11:27 +00006067#line 2889 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006068 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006069 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006070 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6071 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006072 GEN_ERROR("Vector types not supported by fcmp instruction");
Dan Gohman54392c12008-04-19 00:24:39 +00006073 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006074 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006075 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006076 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006077 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
6078 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006079 GEN_ERROR("fcmp operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006080 delete (yyvsp[(3) - (6)].TypeVal);
6081 ;}
6082 break;
6083
6084 case 305:
Dan Gohmandecb8c02008-04-23 20:11:27 +00006085#line 2903 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006086 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006087 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006088 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6089 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6090 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6091 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006092 GEN_ERROR("invalid cast opcode for cast from '" +
6093 Val->getType()->getDescription() + "' to '" +
6094 DestTy->getDescription() + "'");
Dan Gohman54392c12008-04-19 00:24:39 +00006095 (yyval.InstVal) = CastInst::create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
6096 delete (yyvsp[(4) - (4)].TypeVal);
6097 ;}
6098 break;
6099
6100 case 306:
Dan Gohmandecb8c02008-04-23 20:11:27 +00006101#line 2915 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006102 {
6103 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006104 GEN_ERROR("select condition must be boolean");
Dan Gohman54392c12008-04-19 00:24:39 +00006105 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006106 GEN_ERROR("select value types should match");
Dan Gohman54392c12008-04-19 00:24:39 +00006107 (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006108 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006109 ;}
6110 break;
6111
6112 case 307:
Dan Gohmandecb8c02008-04-23 20:11:27 +00006113#line 2923 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006114 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006115 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006116 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6117 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6118 delete (yyvsp[(4) - (4)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006119 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006120 ;}
6121 break;
6122
6123 case 308:
Dan Gohmandecb8c02008-04-23 20:11:27 +00006124#line 2930 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006125 {
6126 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006127 GEN_ERROR("Invalid extractelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006128 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006129 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006130 ;}
6131 break;
6132
6133 case 309:
Dan Gohmandecb8c02008-04-23 20:11:27 +00006134#line 2936 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006135 {
6136 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006137 GEN_ERROR("Invalid insertelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006138 (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006139 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006140 ;}
6141 break;
6142
6143 case 310:
Dan Gohmandecb8c02008-04-23 20:11:27 +00006144#line 2942 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006145 {
6146 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006147 GEN_ERROR("Invalid shufflevector operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006148 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006149 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006150 ;}
6151 break;
6152
6153 case 311:
Dan Gohmandecb8c02008-04-23 20:11:27 +00006154#line 2948 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006155 {
6156 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006157 if (!Ty->isFirstClassType())
6158 GEN_ERROR("PHI node operands must be of first class type");
Dan Gohman54392c12008-04-19 00:24:39 +00006159 (yyval.InstVal) = PHINode::Create(Ty);
6160 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6161 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6162 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006163 GEN_ERROR("All elements of a PHI node must be of the same type");
Dan Gohman54392c12008-04-19 00:24:39 +00006164 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6165 (yyvsp[(2) - (2)].PHIList)->pop_front();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006166 }
Dan Gohman54392c12008-04-19 00:24:39 +00006167 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006168 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006169 ;}
6170 break;
6171
6172 case 312:
Dan Gohmandecb8c02008-04-23 20:11:27 +00006173#line 2964 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006174 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006175
6176 // Handle the short syntax
6177 const PointerType *PFTy = 0;
6178 const FunctionType *Ty = 0;
Dan Gohman54392c12008-04-19 00:24:39 +00006179 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006180 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6181 // Pull out the types of all of the arguments...
6182 std::vector<const Type*> ParamTypes;
Dan Gohman54392c12008-04-19 00:24:39 +00006183 ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006184 for (; I != E; ++I) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006185 const Type *Ty = I->Val->getType();
6186 if (Ty == Type::VoidTy)
6187 GEN_ERROR("Short call syntax cannot be used with varargs");
6188 ParamTypes.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006189 }
Chris Lattner73de3c02008-04-23 05:37:08 +00006190
6191 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (8)].TypeVal)))
6192 GEN_ERROR("Invalid result type for LLVM function");
6193
Dan Gohman54392c12008-04-19 00:24:39 +00006194 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
Christopher Lambfb623c62007-12-17 01:17:35 +00006195 PFTy = PointerType::getUnqual(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006196 }
6197
Dan Gohman54392c12008-04-19 00:24:39 +00006198 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006199 CHECK_FOR_ERROR
6200
6201 // Check for call to invalid intrinsic to avoid crashing later.
6202 if (Function *theF = dyn_cast<Function>(V)) {
6203 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
6204 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6205 !theF->getIntrinsicID(true))
6206 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6207 theF->getName() + "'");
6208 }
6209
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006210 // Set up the ParamAttrs for the function
Chris Lattner1c8733e2008-03-12 17:45:29 +00006211 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohman54392c12008-04-19 00:24:39 +00006212 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None)
6213 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (8)].ParamAttrs)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006214 // Check the arguments
6215 ValueList Args;
Dan Gohman54392c12008-04-19 00:24:39 +00006216 if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006217 // Make sure no arguments is a good thing!
6218 if (Ty->getNumParams() != 0)
6219 GEN_ERROR("No arguments passed to a function that "
6220 "expects arguments");
6221 } else { // Has arguments?
6222 // Loop through FunctionType's arguments and ensure they are specified
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006223 // correctly. Also, gather any parameter attributes.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006224 FunctionType::param_iterator I = Ty->param_begin();
6225 FunctionType::param_iterator E = Ty->param_end();
Dan Gohman54392c12008-04-19 00:24:39 +00006226 ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006227 unsigned index = 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006228
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006229 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006230 if (ArgI->Val->getType() != *I)
6231 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6232 (*I)->getDescription() + "'");
6233 Args.push_back(ArgI->Val);
Chris Lattner1c8733e2008-03-12 17:45:29 +00006234 if (ArgI->Attrs != ParamAttr::None)
6235 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006236 }
6237 if (Ty->isVarArg()) {
6238 if (I == E)
Chris Lattner59363a32008-02-19 04:36:25 +00006239 for (; ArgI != ArgE; ++ArgI, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006240 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner1c8733e2008-03-12 17:45:29 +00006241 if (ArgI->Attrs != ParamAttr::None)
6242 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Chris Lattner59363a32008-02-19 04:36:25 +00006243 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006244 } else if (I != E || ArgI != ArgE)
6245 GEN_ERROR("Invalid number of parameters detected");
6246 }
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006247
6248 // Finish off the ParamAttrs and check them
Chris Lattner1c8733e2008-03-12 17:45:29 +00006249 PAListPtr PAL;
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006250 if (!Attrs.empty())
Chris Lattner1c8733e2008-03-12 17:45:29 +00006251 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006252
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006253 // Create the call node
Gabor Greif89f01162008-04-06 23:07:54 +00006254 CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
Dan Gohman54392c12008-04-19 00:24:39 +00006255 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6256 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006257 CI->setParamAttrs(PAL);
Dan Gohman54392c12008-04-19 00:24:39 +00006258 (yyval.InstVal) = CI;
6259 delete (yyvsp[(6) - (8)].ParamList);
6260 delete (yyvsp[(3) - (8)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006261 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006262 ;}
6263 break;
6264
6265 case 313:
Dan Gohmandecb8c02008-04-23 20:11:27 +00006266#line 3053 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006267 {
6268 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006269 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006270 ;}
6271 break;
6272
6273 case 314:
Dan Gohmandecb8c02008-04-23 20:11:27 +00006274#line 3058 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006275 {
6276 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006277 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006278 ;}
6279 break;
6280
6281 case 315:
Dan Gohmandecb8c02008-04-23 20:11:27 +00006282#line 3062 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006283 {
6284 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006285 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006286 ;}
6287 break;
6288
6289 case 316:
Dan Gohmandecb8c02008-04-23 20:11:27 +00006290#line 3069 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006291 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006292 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006293 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6294 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6295 delete (yyvsp[(2) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006296 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006297 ;}
6298 break;
6299
6300 case 317:
Dan Gohmandecb8c02008-04-23 20:11:27 +00006301#line 3076 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006302 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006303 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006304 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6305 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006306 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006307 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6308 delete (yyvsp[(2) - (6)].TypeVal);
6309 ;}
6310 break;
6311
6312 case 318:
Dan Gohmandecb8c02008-04-23 20:11:27 +00006313#line 3084 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006314 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006315 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006316 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6317 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6318 delete (yyvsp[(2) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006319 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006320 ;}
6321 break;
6322
6323 case 319:
Dan Gohmandecb8c02008-04-23 20:11:27 +00006324#line 3091 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006325 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006326 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006327 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6328 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006329 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006330 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6331 delete (yyvsp[(2) - (6)].TypeVal);
6332 ;}
6333 break;
6334
6335 case 320:
Dan Gohmandecb8c02008-04-23 20:11:27 +00006336#line 3099 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006337 {
6338 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006339 GEN_ERROR("Trying to free nonpointer type " +
Dan Gohman54392c12008-04-19 00:24:39 +00006340 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6341 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006342 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006343 ;}
6344 break;
6345
6346 case 321:
Dan Gohmandecb8c02008-04-23 20:11:27 +00006347#line 3107 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006348 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006349 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006350 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6351 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006352 GEN_ERROR("Can't load from nonpointer type: " +
Dan Gohman54392c12008-04-19 00:24:39 +00006353 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6354 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006355 GEN_ERROR("Can't load from pointer of non-first-class type: " +
Dan Gohman54392c12008-04-19 00:24:39 +00006356 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6357 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006358 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006359 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6360 delete (yyvsp[(3) - (5)].TypeVal);
6361 ;}
6362 break;
6363
6364 case 322:
Dan Gohmandecb8c02008-04-23 20:11:27 +00006365#line 3121 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006366 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006367 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006368 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6369 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006370 if (!PT)
6371 GEN_ERROR("Can't store to a nonpointer type: " +
Dan Gohman54392c12008-04-19 00:24:39 +00006372 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006373 const Type *ElTy = PT->getElementType();
Dan Gohman54392c12008-04-19 00:24:39 +00006374 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6375 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006376 "' into space of type '" + ElTy->getDescription() + "'");
6377
Dan Gohman54392c12008-04-19 00:24:39 +00006378 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006379 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006380 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6381 delete (yyvsp[(5) - (7)].TypeVal);
6382 ;}
6383 break;
6384
6385 case 323:
Dan Gohmandecb8c02008-04-23 20:11:27 +00006386#line 3138 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006387 {
6388 Value *TmpVal = getVal((yyvsp[(2) - (5)].TypeVal)->get(), (yyvsp[(3) - (5)].ValIDVal));
6389 if (!GetResultInst::isValidOperands(TmpVal, (yyvsp[(5) - (5)].UInt64Val)))
Devang Patel3b8849c2008-02-19 22:27:01 +00006390 GEN_ERROR("Invalid getresult operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006391 (yyval.InstVal) = new GetResultInst(TmpVal, (yyvsp[(5) - (5)].UInt64Val));
6392 delete (yyvsp[(2) - (5)].TypeVal);
Devang Patel3b8849c2008-02-19 22:27:01 +00006393 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006394 ;}
6395 break;
6396
6397 case 324:
Dan Gohmandecb8c02008-04-23 20:11:27 +00006398#line 3146 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006399 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006400 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006401 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6402 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006403 GEN_ERROR("getelementptr insn requires pointer operand");
6404
Dan Gohman54392c12008-04-19 00:24:39 +00006405 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end(), true))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006406 GEN_ERROR("Invalid getelementptr indices for type '" +
Dan Gohman54392c12008-04-19 00:24:39 +00006407 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6408 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006409 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006410 (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6411 delete (yyvsp[(2) - (4)].TypeVal);
6412 delete (yyvsp[(4) - (4)].ValueList);
6413 ;}
6414 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006415
Dan Gohman54392c12008-04-19 00:24:39 +00006416
6417/* Line 1267 of yacc.c. */
Chris Lattner73de3c02008-04-23 05:37:08 +00006418#line 6419 "llvmAsmParser.tab.c"
Dan Gohman54392c12008-04-19 00:24:39 +00006419 default: break;
Dale Johannesen3afee192007-09-07 21:07:57 +00006420 }
Dan Gohman54392c12008-04-19 00:24:39 +00006421 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6422
6423 YYPOPSTACK (yylen);
6424 yylen = 0;
6425 YY_STACK_PRINT (yyss, yyssp);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006426
6427 *++yyvsp = yyval;
6428
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006429
Dan Gohman54392c12008-04-19 00:24:39 +00006430 /* Now `shift' the result of the reduction. Determine what state
6431 that goes to, based on the state we popped back to and the rule
6432 number reduced by. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006433
6434 yyn = yyr1[yyn];
6435
Dan Gohman54392c12008-04-19 00:24:39 +00006436 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6437 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006438 yystate = yytable[yystate];
6439 else
Dan Gohman54392c12008-04-19 00:24:39 +00006440 yystate = yydefgoto[yyn - YYNTOKENS];
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006441
6442 goto yynewstate;
6443
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006444
Dan Gohman54392c12008-04-19 00:24:39 +00006445/*------------------------------------.
6446| yyerrlab -- here on detecting error |
6447`------------------------------------*/
6448yyerrlab:
6449 /* If not already recovering from an error, report this error. */
6450 if (!yyerrstatus)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006451 {
6452 ++yynerrs;
Dan Gohman54392c12008-04-19 00:24:39 +00006453#if ! YYERROR_VERBOSE
6454 yyerror (YY_("syntax error"));
6455#else
6456 {
6457 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
6458 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
6459 {
6460 YYSIZE_T yyalloc = 2 * yysize;
6461 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
6462 yyalloc = YYSTACK_ALLOC_MAXIMUM;
6463 if (yymsg != yymsgbuf)
6464 YYSTACK_FREE (yymsg);
6465 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
6466 if (yymsg)
6467 yymsg_alloc = yyalloc;
6468 else
6469 {
6470 yymsg = yymsgbuf;
6471 yymsg_alloc = sizeof yymsgbuf;
6472 }
6473 }
Dale Johannesen3afee192007-09-07 21:07:57 +00006474
Dan Gohman54392c12008-04-19 00:24:39 +00006475 if (0 < yysize && yysize <= yymsg_alloc)
6476 {
6477 (void) yysyntax_error (yymsg, yystate, yychar);
6478 yyerror (yymsg);
6479 }
6480 else
6481 {
6482 yyerror (YY_("syntax error"));
6483 if (yysize != 0)
6484 goto yyexhaustedlab;
6485 }
6486 }
6487#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006488 }
6489
Dan Gohman54392c12008-04-19 00:24:39 +00006490
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006491
6492 if (yyerrstatus == 3)
6493 {
Dan Gohman54392c12008-04-19 00:24:39 +00006494 /* If just tried and failed to reuse look-ahead token after an
6495 error, discard it. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006496
Dan Gohman54392c12008-04-19 00:24:39 +00006497 if (yychar <= YYEOF)
6498 {
6499 /* Return failure if at end of input. */
6500 if (yychar == YYEOF)
6501 YYABORT;
6502 }
6503 else
6504 {
6505 yydestruct ("Error: discarding",
6506 yytoken, &yylval);
6507 yychar = YYEMPTY;
6508 }
6509 }
6510
6511 /* Else will try to reuse look-ahead token after shifting the error
6512 token. */
6513 goto yyerrlab1;
6514
6515
6516/*---------------------------------------------------.
6517| yyerrorlab -- error raised explicitly by YYERROR. |
6518`---------------------------------------------------*/
6519yyerrorlab:
6520
6521 /* Pacify compilers like GCC when the user code never invokes
6522 YYERROR and the label yyerrorlab therefore never appears in user
6523 code. */
6524 if (/*CONSTCOND*/ 0)
6525 goto yyerrorlab;
6526
6527 /* Do not reclaim the symbols of the rule which action triggered
6528 this YYERROR. */
6529 YYPOPSTACK (yylen);
6530 yylen = 0;
6531 YY_STACK_PRINT (yyss, yyssp);
6532 yystate = *yyssp;
6533 goto yyerrlab1;
6534
6535
6536/*-------------------------------------------------------------.
6537| yyerrlab1 -- common code for both syntax error and YYERROR. |
6538`-------------------------------------------------------------*/
6539yyerrlab1:
6540 yyerrstatus = 3; /* Each real token shifted decrements this. */
6541
6542 for (;;)
6543 {
6544 yyn = yypact[yystate];
6545 if (yyn != YYPACT_NINF)
6546 {
6547 yyn += YYTERROR;
6548 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6549 {
6550 yyn = yytable[yyn];
6551 if (0 < yyn)
6552 break;
6553 }
6554 }
6555
6556 /* Pop the current state because it cannot handle the error token. */
6557 if (yyssp == yyss)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006558 YYABORT;
6559
Dale Johannesen3afee192007-09-07 21:07:57 +00006560
Dan Gohman54392c12008-04-19 00:24:39 +00006561 yydestruct ("Error: popping",
6562 yystos[yystate], yyvsp);
6563 YYPOPSTACK (1);
6564 yystate = *yyssp;
6565 YY_STACK_PRINT (yyss, yyssp);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006566 }
6567
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006568 if (yyn == YYFINAL)
6569 YYACCEPT;
6570
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006571 *++yyvsp = yylval;
Dan Gohman54392c12008-04-19 00:24:39 +00006572
6573
6574 /* Shift the error token. */
6575 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spenceraa8ae282007-07-31 03:50:36 +00006576
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006577 yystate = yyn;
6578 goto yynewstate;
6579
Gabor Greif89f01162008-04-06 23:07:54 +00006580
Dan Gohman54392c12008-04-19 00:24:39 +00006581/*-------------------------------------.
6582| yyacceptlab -- YYACCEPT comes here. |
6583`-------------------------------------*/
6584yyacceptlab:
6585 yyresult = 0;
6586 goto yyreturn;
6587
6588/*-----------------------------------.
6589| yyabortlab -- YYABORT comes here. |
6590`-----------------------------------*/
6591yyabortlab:
6592 yyresult = 1;
6593 goto yyreturn;
6594
6595#ifndef yyoverflow
6596/*-------------------------------------------------.
6597| yyexhaustedlab -- memory exhaustion comes here. |
6598`-------------------------------------------------*/
6599yyexhaustedlab:
6600 yyerror (YY_("memory exhausted"));
6601 yyresult = 2;
6602 /* Fall through. */
Chris Lattner59363a32008-02-19 04:36:25 +00006603#endif
Dan Gohman54392c12008-04-19 00:24:39 +00006604
6605yyreturn:
6606 if (yychar != YYEOF && yychar != YYEMPTY)
6607 yydestruct ("Cleanup: discarding lookahead",
6608 yytoken, &yylval);
6609 /* Do not reclaim the symbols of the rule which action triggered
6610 this YYABORT or YYACCEPT. */
6611 YYPOPSTACK (yylen);
6612 YY_STACK_PRINT (yyss, yyssp);
6613 while (yyssp != yyss)
6614 {
6615 yydestruct ("Cleanup: popping",
6616 yystos[*yyssp], yyvsp);
6617 YYPOPSTACK (1);
Gabor Greif89f01162008-04-06 23:07:54 +00006618 }
Dan Gohman54392c12008-04-19 00:24:39 +00006619#ifndef yyoverflow
6620 if (yyss != yyssa)
6621 YYSTACK_FREE (yyss);
6622#endif
6623#if YYERROR_VERBOSE
6624 if (yymsg != yymsgbuf)
6625 YYSTACK_FREE (yymsg);
6626#endif
6627 /* Make sure YYID is used. */
6628 return YYID (yyresult);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006629}
Dan Gohman54392c12008-04-19 00:24:39 +00006630
6631
Dan Gohmandecb8c02008-04-23 20:11:27 +00006632#line 3163 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006633
6634
6635// common code from the two 'RunVMAsmParser' functions
6636static Module* RunParser(Module * M) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006637 CurModule.CurrentModule = M;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006638 // Check to make sure the parser succeeded
6639 if (yyparse()) {
6640 if (ParserResult)
6641 delete ParserResult;
6642 return 0;
6643 }
6644
6645 // Emit an error if there are any unresolved types left.
6646 if (!CurModule.LateResolveTypes.empty()) {
6647 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6648 if (DID.Type == ValID::LocalName) {
6649 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6650 } else {
6651 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
6652 }
6653 if (ParserResult)
6654 delete ParserResult;
6655 return 0;
6656 }
6657
6658 // Emit an error if there are any unresolved values left.
6659 if (!CurModule.LateResolveValues.empty()) {
6660 Value *V = CurModule.LateResolveValues.back();
6661 std::map<Value*, std::pair<ValID, int> >::iterator I =
6662 CurModule.PlaceHolderInfo.find(V);
6663
6664 if (I != CurModule.PlaceHolderInfo.end()) {
6665 ValID &DID = I->second.first;
6666 if (DID.Type == ValID::LocalName) {
6667 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
6668 } else {
6669 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
6670 }
6671 if (ParserResult)
6672 delete ParserResult;
6673 return 0;
6674 }
6675 }
6676
6677 // Check to make sure that parsing produced a result
6678 if (!ParserResult)
6679 return 0;
6680
6681 // Reset ParserResult variable while saving its value for the result.
6682 Module *Result = ParserResult;
6683 ParserResult = 0;
6684
6685 return Result;
6686}
6687
6688void llvm::GenerateError(const std::string &message, int LineNo) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006689 if (LineNo == -1) LineNo = LLLgetLineNo();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006690 // TODO: column number in exception
6691 if (TheParseError)
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006692 TheParseError->setError(LLLgetFilename(), message, LineNo);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006693 TriggerError = 1;
6694}
6695
6696int yyerror(const char *ErrorMsg) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006697 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006698 std::string errMsg = where + "error: " + std::string(ErrorMsg);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006699 if (yychar != YYEMPTY && yychar != 0) {
6700 errMsg += " while reading token: '";
6701 errMsg += std::string(LLLgetTokenStart(),
6702 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
6703 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006704 GenerateError(errMsg);
6705 return 0;
6706}
Dan Gohman54392c12008-04-19 00:24:39 +00006707