blob: 2a19214b849961c9f939e5382851d5f50e5d877a [file] [log] [blame]
Dan Gohman54392c12008-04-19 00:24:39 +00001/* A Bison parser, made by GNU Bison 2.3. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002
Dan Gohman54392c12008-04-19 00:24:39 +00003/* Skeleton implementation for Bison's Yacc-like parsers in C
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004
Dan Gohman54392c12008-04-19 00:24:39 +00005 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007
Dan Gohman54392c12008-04-19 00:24:39 +00008 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
22
23/* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
32
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
35
36/* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
38
39/* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
45
46/* Identify Bison output. */
47#define YYBISON 1
48
49/* Bison version. */
50#define YYBISON_VERSION "2.3"
51
52/* Skeleton name. */
53#define YYSKELETON_NAME "yacc.c"
54
55/* Pure parsers. */
56#define YYPURE 0
57
58/* Using locations. */
59#define YYLSP_NEEDED 0
60
61/* Substitute the variable and function names. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +000062#define yyparse llvmAsmparse
Dan Gohman54392c12008-04-19 00:24:39 +000063#define yylex llvmAsmlex
Dan Gohmanf17a25c2007-07-18 16:29:46 +000064#define yyerror llvmAsmerror
Dan Gohman54392c12008-04-19 00:24:39 +000065#define yylval llvmAsmlval
66#define yychar llvmAsmchar
Dan Gohmanf17a25c2007-07-18 16:29:46 +000067#define yydebug llvmAsmdebug
68#define yynerrs llvmAsmnerrs
Dan Gohmanf17a25c2007-07-18 16:29:46 +000069
Dan Gohman54392c12008-04-19 00:24:39 +000070
71/* Tokens. */
72#ifndef YYTOKENTYPE
73# define YYTOKENTYPE
74 /* Put the tokens into the symbol table, so that GDB and other debuggers
75 know about them. */
76 enum yytokentype {
77 ESINT64VAL = 258,
78 EUINT64VAL = 259,
79 ESAPINTVAL = 260,
80 EUAPINTVAL = 261,
81 LOCALVAL_ID = 262,
82 GLOBALVAL_ID = 263,
83 FPVAL = 264,
84 VOID = 265,
85 INTTYPE = 266,
86 FLOAT = 267,
87 DOUBLE = 268,
88 X86_FP80 = 269,
89 FP128 = 270,
90 PPC_FP128 = 271,
91 LABEL = 272,
92 TYPE = 273,
93 LOCALVAR = 274,
94 GLOBALVAR = 275,
95 LABELSTR = 276,
96 STRINGCONSTANT = 277,
97 ATSTRINGCONSTANT = 278,
98 PCTSTRINGCONSTANT = 279,
99 ZEROINITIALIZER = 280,
100 TRUETOK = 281,
101 FALSETOK = 282,
102 BEGINTOK = 283,
103 ENDTOK = 284,
104 DECLARE = 285,
105 DEFINE = 286,
106 GLOBAL = 287,
107 CONSTANT = 288,
108 SECTION = 289,
109 ALIAS = 290,
110 VOLATILE = 291,
111 THREAD_LOCAL = 292,
112 TO = 293,
113 DOTDOTDOT = 294,
114 NULL_TOK = 295,
115 UNDEF = 296,
116 INTERNAL = 297,
117 LINKONCE = 298,
118 WEAK = 299,
119 APPENDING = 300,
120 DLLIMPORT = 301,
121 DLLEXPORT = 302,
122 EXTERN_WEAK = 303,
Dale Johannesen280e7bc2008-05-14 20:13:36 +0000123 COMMON = 304,
124 OPAQUE = 305,
125 EXTERNAL = 306,
126 TARGET = 307,
127 TRIPLE = 308,
128 ALIGN = 309,
129 ADDRSPACE = 310,
130 DEPLIBS = 311,
131 CALL = 312,
132 TAIL = 313,
133 ASM_TOK = 314,
134 MODULE = 315,
135 SIDEEFFECT = 316,
136 CC_TOK = 317,
137 CCC_TOK = 318,
138 FASTCC_TOK = 319,
139 COLDCC_TOK = 320,
140 X86_STDCALLCC_TOK = 321,
141 X86_FASTCALLCC_TOK = 322,
142 DATALAYOUT = 323,
143 RET = 324,
144 BR = 325,
145 SWITCH = 326,
146 INVOKE = 327,
147 UNWIND = 328,
148 UNREACHABLE = 329,
149 ADD = 330,
150 SUB = 331,
151 MUL = 332,
152 UDIV = 333,
153 SDIV = 334,
154 FDIV = 335,
155 UREM = 336,
156 SREM = 337,
157 FREM = 338,
158 AND = 339,
159 OR = 340,
160 XOR = 341,
161 SHL = 342,
162 LSHR = 343,
163 ASHR = 344,
164 ICMP = 345,
165 FCMP = 346,
166 VICMP = 347,
167 VFCMP = 348,
168 EQ = 349,
169 NE = 350,
170 SLT = 351,
171 SGT = 352,
172 SLE = 353,
173 SGE = 354,
174 ULT = 355,
175 UGT = 356,
176 ULE = 357,
177 UGE = 358,
178 OEQ = 359,
179 ONE = 360,
180 OLT = 361,
181 OGT = 362,
182 OLE = 363,
183 OGE = 364,
184 ORD = 365,
185 UNO = 366,
186 UEQ = 367,
187 UNE = 368,
188 MALLOC = 369,
189 ALLOCA = 370,
190 FREE = 371,
191 LOAD = 372,
192 STORE = 373,
193 GETELEMENTPTR = 374,
194 TRUNC = 375,
195 ZEXT = 376,
196 SEXT = 377,
197 FPTRUNC = 378,
198 FPEXT = 379,
199 BITCAST = 380,
200 UITOFP = 381,
201 SITOFP = 382,
202 FPTOUI = 383,
203 FPTOSI = 384,
204 INTTOPTR = 385,
205 PTRTOINT = 386,
206 PHI_TOK = 387,
207 SELECT = 388,
208 VAARG = 389,
209 EXTRACTELEMENT = 390,
210 INSERTELEMENT = 391,
211 SHUFFLEVECTOR = 392,
212 GETRESULT = 393,
213 SIGNEXT = 394,
214 ZEROEXT = 395,
215 NORETURN = 396,
216 INREG = 397,
217 SRET = 398,
218 NOUNWIND = 399,
219 NOALIAS = 400,
220 BYVAL = 401,
221 NEST = 402,
222 READNONE = 403,
223 READONLY = 404,
224 GC = 405,
225 DEFAULT = 406,
226 HIDDEN = 407,
227 PROTECTED = 408
Dan Gohman54392c12008-04-19 00:24:39 +0000228 };
229#endif
230/* Tokens. */
231#define ESINT64VAL 258
232#define EUINT64VAL 259
233#define ESAPINTVAL 260
234#define EUAPINTVAL 261
235#define LOCALVAL_ID 262
236#define GLOBALVAL_ID 263
237#define FPVAL 264
238#define VOID 265
239#define INTTYPE 266
240#define FLOAT 267
241#define DOUBLE 268
242#define X86_FP80 269
243#define FP128 270
244#define PPC_FP128 271
245#define LABEL 272
246#define TYPE 273
247#define LOCALVAR 274
248#define GLOBALVAR 275
249#define LABELSTR 276
250#define STRINGCONSTANT 277
251#define ATSTRINGCONSTANT 278
252#define PCTSTRINGCONSTANT 279
253#define ZEROINITIALIZER 280
254#define TRUETOK 281
255#define FALSETOK 282
256#define BEGINTOK 283
257#define ENDTOK 284
258#define DECLARE 285
259#define DEFINE 286
260#define GLOBAL 287
261#define CONSTANT 288
262#define SECTION 289
263#define ALIAS 290
264#define VOLATILE 291
265#define THREAD_LOCAL 292
266#define TO 293
267#define DOTDOTDOT 294
268#define NULL_TOK 295
269#define UNDEF 296
270#define INTERNAL 297
271#define LINKONCE 298
272#define WEAK 299
273#define APPENDING 300
274#define DLLIMPORT 301
275#define DLLEXPORT 302
276#define EXTERN_WEAK 303
Dale Johannesen280e7bc2008-05-14 20:13:36 +0000277#define COMMON 304
278#define OPAQUE 305
279#define EXTERNAL 306
280#define TARGET 307
281#define TRIPLE 308
282#define ALIGN 309
283#define ADDRSPACE 310
284#define DEPLIBS 311
285#define CALL 312
286#define TAIL 313
287#define ASM_TOK 314
288#define MODULE 315
289#define SIDEEFFECT 316
290#define CC_TOK 317
291#define CCC_TOK 318
292#define FASTCC_TOK 319
293#define COLDCC_TOK 320
294#define X86_STDCALLCC_TOK 321
295#define X86_FASTCALLCC_TOK 322
296#define DATALAYOUT 323
297#define RET 324
298#define BR 325
299#define SWITCH 326
300#define INVOKE 327
301#define UNWIND 328
302#define UNREACHABLE 329
303#define ADD 330
304#define SUB 331
305#define MUL 332
306#define UDIV 333
307#define SDIV 334
308#define FDIV 335
309#define UREM 336
310#define SREM 337
311#define FREM 338
312#define AND 339
313#define OR 340
314#define XOR 341
315#define SHL 342
316#define LSHR 343
317#define ASHR 344
318#define ICMP 345
319#define FCMP 346
320#define VICMP 347
321#define VFCMP 348
322#define EQ 349
323#define NE 350
324#define SLT 351
325#define SGT 352
326#define SLE 353
327#define SGE 354
328#define ULT 355
329#define UGT 356
330#define ULE 357
331#define UGE 358
332#define OEQ 359
333#define ONE 360
334#define OLT 361
335#define OGT 362
336#define OLE 363
337#define OGE 364
338#define ORD 365
339#define UNO 366
340#define UEQ 367
341#define UNE 368
342#define MALLOC 369
343#define ALLOCA 370
344#define FREE 371
345#define LOAD 372
346#define STORE 373
347#define GETELEMENTPTR 374
348#define TRUNC 375
349#define ZEXT 376
350#define SEXT 377
351#define FPTRUNC 378
352#define FPEXT 379
353#define BITCAST 380
354#define UITOFP 381
355#define SITOFP 382
356#define FPTOUI 383
357#define FPTOSI 384
358#define INTTOPTR 385
359#define PTRTOINT 386
360#define PHI_TOK 387
361#define SELECT 388
362#define VAARG 389
363#define EXTRACTELEMENT 390
364#define INSERTELEMENT 391
365#define SHUFFLEVECTOR 392
366#define GETRESULT 393
367#define SIGNEXT 394
368#define ZEROEXT 395
369#define NORETURN 396
370#define INREG 397
371#define SRET 398
372#define NOUNWIND 399
373#define NOALIAS 400
374#define BYVAL 401
375#define NEST 402
376#define READNONE 403
377#define READONLY 404
378#define GC 405
379#define DEFAULT 406
380#define HIDDEN 407
381#define PROTECTED 408
Dan Gohman54392c12008-04-19 00:24:39 +0000382
383
384
385
386/* Copy the first part of user declarations. */
Dale Johannesen280e7bc2008-05-14 20:13:36 +0000387#line 14 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000388
389#include "ParserInternals.h"
390#include "llvm/CallingConv.h"
391#include "llvm/InlineAsm.h"
392#include "llvm/Instructions.h"
393#include "llvm/Module.h"
394#include "llvm/ValueSymbolTable.h"
Chandler Carruth563d4a42007-08-04 01:56:21 +0000395#include "llvm/AutoUpgrade.h"
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000396#include "llvm/Support/GetElementPtrTypeIterator.h"
397#include "llvm/Support/CommandLine.h"
398#include "llvm/ADT/SmallVector.h"
399#include "llvm/ADT/STLExtras.h"
400#include "llvm/Support/MathExtras.h"
401#include "llvm/Support/Streams.h"
402#include <algorithm>
403#include <list>
404#include <map>
405#include <utility>
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000406
407// The following is a gross hack. In order to rid the libAsmParser library of
408// exceptions, we have to have a way of getting the yyparse function to go into
409// an error situation. So, whenever we want an error to occur, the GenerateError
410// function (see bottom of file) sets TriggerError. Then, at the end of each
411// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
412// (a goto) to put YACC in error state. Furthermore, several calls to
413// GenerateError are made from inside productions and they must simulate the
414// previous exception behavior by exiting the production immediately. We have
415// replaced these with the GEN_ERROR macro which calls GeneratError and then
416// immediately invokes YYERROR. This would be so much cleaner if it was a
417// recursive descent parser.
418static bool TriggerError = false;
419#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
420#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
421
422int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
423int yylex(); // declaration" of xxx warnings.
424int yyparse();
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000425using namespace llvm;
426
427static Module *ParserResult;
428
429// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
430// relating to upreferences in the input stream.
431//
432//#define DEBUG_UPREFS 1
433#ifdef DEBUG_UPREFS
434#define UR_OUT(X) cerr << X
435#else
436#define UR_OUT(X)
437#endif
438
439#define YYERROR_VERBOSE 1
440
441static GlobalVariable *CurGV;
442
443
444// This contains info used when building the body of a function. It is
445// destroyed when the function is completed.
446//
447typedef std::vector<Value *> ValueList; // Numbered defs
448
449static void
450ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
451
452static struct PerModuleInfo {
453 Module *CurrentModule;
454 ValueList Values; // Module level numbered definitions
455 ValueList LateResolveValues;
456 std::vector<PATypeHolder> Types;
457 std::map<ValID, PATypeHolder> LateResolveTypes;
458
459 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
460 /// how they were referenced and on which line of the input they came from so
461 /// that we can resolve them later and print error messages as appropriate.
462 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
463
464 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
465 // references to global values. Global values may be referenced before they
466 // are defined, and if so, the temporary object that they represent is held
467 // here. This is used for forward references of GlobalValues.
468 //
469 typedef std::map<std::pair<const PointerType *,
470 ValID>, GlobalValue*> GlobalRefsType;
471 GlobalRefsType GlobalRefs;
472
473 void ModuleDone() {
474 // If we could not resolve some functions at function compilation time
475 // (calls to functions before they are defined), resolve them now... Types
476 // are resolved when the constant pool has been completely parsed.
477 //
478 ResolveDefinitions(LateResolveValues);
479 if (TriggerError)
480 return;
481
482 // Check to make sure that all global value forward references have been
483 // resolved!
484 //
485 if (!GlobalRefs.empty()) {
486 std::string UndefinedReferences = "Unresolved global references exist:\n";
487
488 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
489 I != E; ++I) {
490 UndefinedReferences += " " + I->first.first->getDescription() + " " +
491 I->first.second.getName() + "\n";
492 }
493 GenerateError(UndefinedReferences);
494 return;
495 }
496
Chandler Carruth563d4a42007-08-04 01:56:21 +0000497 // Look for intrinsic functions and CallInst that need to be upgraded
498 for (Module::iterator FI = CurrentModule->begin(),
499 FE = CurrentModule->end(); FI != FE; )
500 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
501
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000502 Values.clear(); // Clear out function local definitions
503 Types.clear();
504 CurrentModule = 0;
505 }
506
507 // GetForwardRefForGlobal - Check to see if there is a forward reference
508 // for this global. If so, remove it from the GlobalRefs map and return it.
509 // If not, just return null.
510 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
511 // Check to see if there is a forward reference to this global variable...
512 // if there is, eliminate it and patch the reference to use the new def'n.
513 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
514 GlobalValue *Ret = 0;
515 if (I != GlobalRefs.end()) {
516 Ret = I->second;
517 GlobalRefs.erase(I);
518 }
519 return Ret;
520 }
521
522 bool TypeIsUnresolved(PATypeHolder* PATy) {
523 // If it isn't abstract, its resolved
524 const Type* Ty = PATy->get();
525 if (!Ty->isAbstract())
526 return false;
527 // Traverse the type looking for abstract types. If it isn't abstract then
528 // we don't need to traverse that leg of the type.
529 std::vector<const Type*> WorkList, SeenList;
530 WorkList.push_back(Ty);
531 while (!WorkList.empty()) {
532 const Type* Ty = WorkList.back();
533 SeenList.push_back(Ty);
534 WorkList.pop_back();
535 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
536 // Check to see if this is an unresolved type
537 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
538 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
539 for ( ; I != E; ++I) {
540 if (I->second.get() == OpTy)
541 return true;
542 }
543 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
544 const Type* TheTy = SeqTy->getElementType();
545 if (TheTy->isAbstract() && TheTy != Ty) {
546 std::vector<const Type*>::iterator I = SeenList.begin(),
547 E = SeenList.end();
548 for ( ; I != E; ++I)
549 if (*I == TheTy)
550 break;
551 if (I == E)
552 WorkList.push_back(TheTy);
553 }
554 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
555 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
556 const Type* TheTy = StrTy->getElementType(i);
557 if (TheTy->isAbstract() && TheTy != Ty) {
558 std::vector<const Type*>::iterator I = SeenList.begin(),
559 E = SeenList.end();
560 for ( ; I != E; ++I)
561 if (*I == TheTy)
562 break;
563 if (I == E)
564 WorkList.push_back(TheTy);
565 }
566 }
567 }
568 }
569 return false;
570 }
571} CurModule;
572
573static struct PerFunctionInfo {
574 Function *CurrentFunction; // Pointer to current function being created
575
576 ValueList Values; // Keep track of #'d definitions
577 unsigned NextValNum;
578 ValueList LateResolveValues;
579 bool isDeclare; // Is this function a forward declararation?
580 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
581 GlobalValue::VisibilityTypes Visibility;
582
583 /// BBForwardRefs - When we see forward references to basic blocks, keep
584 /// track of them here.
585 std::map<ValID, BasicBlock*> BBForwardRefs;
586
587 inline PerFunctionInfo() {
588 CurrentFunction = 0;
589 isDeclare = false;
590 Linkage = GlobalValue::ExternalLinkage;
591 Visibility = GlobalValue::DefaultVisibility;
592 }
593
594 inline void FunctionStart(Function *M) {
595 CurrentFunction = M;
596 NextValNum = 0;
597 }
598
599 void FunctionDone() {
600 // Any forward referenced blocks left?
601 if (!BBForwardRefs.empty()) {
602 GenerateError("Undefined reference to label " +
603 BBForwardRefs.begin()->second->getName());
604 return;
605 }
606
607 // Resolve all forward references now.
608 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
609
610 Values.clear(); // Clear out function local definitions
611 BBForwardRefs.clear();
612 CurrentFunction = 0;
613 isDeclare = false;
614 Linkage = GlobalValue::ExternalLinkage;
615 Visibility = GlobalValue::DefaultVisibility;
616 }
617} CurFun; // Info for the current function...
618
619static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
620
621
622//===----------------------------------------------------------------------===//
623// Code to handle definitions of all the types
624//===----------------------------------------------------------------------===//
625
626static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
627 // Things that have names or are void typed don't get slot numbers
628 if (V->hasName() || (V->getType() == Type::VoidTy))
629 return;
630
631 // In the case of function values, we have to allow for the forward reference
632 // of basic blocks, which are included in the numbering. Consequently, we keep
633 // track of the next insertion location with NextValNum. When a BB gets
634 // inserted, it could change the size of the CurFun.Values vector.
635 if (&ValueTab == &CurFun.Values) {
636 if (ValueTab.size() <= CurFun.NextValNum)
637 ValueTab.resize(CurFun.NextValNum+1);
638 ValueTab[CurFun.NextValNum++] = V;
639 return;
640 }
641 // For all other lists, its okay to just tack it on the back of the vector.
642 ValueTab.push_back(V);
643}
644
645static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
646 switch (D.Type) {
647 case ValID::LocalID: // Is it a numbered definition?
648 // Module constants occupy the lowest numbered slots...
649 if (D.Num < CurModule.Types.size())
650 return CurModule.Types[D.Num];
651 break;
652 case ValID::LocalName: // Is it a named definition?
653 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
654 D.destroy(); // Free old strdup'd memory...
655 return N;
656 }
657 break;
658 default:
659 GenerateError("Internal parser error: Invalid symbol type reference");
660 return 0;
661 }
662
663 // If we reached here, we referenced either a symbol that we don't know about
664 // or an id number that hasn't been read yet. We may be referencing something
665 // forward, so just create an entry to be resolved later and get to it...
666 //
667 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
668
669
670 if (inFunctionScope()) {
671 if (D.Type == ValID::LocalName) {
672 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
673 return 0;
674 } else {
675 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
676 return 0;
677 }
678 }
679
680 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
681 if (I != CurModule.LateResolveTypes.end())
682 return I->second;
683
684 Type *Typ = OpaqueType::get();
685 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
686 return Typ;
687 }
688
689// getExistingVal - Look up the value specified by the provided type and
690// the provided ValID. If the value exists and has already been defined, return
691// it. Otherwise return null.
692//
693static Value *getExistingVal(const Type *Ty, const ValID &D) {
694 if (isa<FunctionType>(Ty)) {
695 GenerateError("Functions are not values and "
696 "must be referenced as pointers");
697 return 0;
698 }
699
700 switch (D.Type) {
701 case ValID::LocalID: { // Is it a numbered definition?
702 // Check that the number is within bounds.
703 if (D.Num >= CurFun.Values.size())
704 return 0;
705 Value *Result = CurFun.Values[D.Num];
706 if (Ty != Result->getType()) {
707 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
708 Result->getType()->getDescription() + "' does not match "
709 "expected type, '" + Ty->getDescription() + "'");
710 return 0;
711 }
712 return Result;
713 }
714 case ValID::GlobalID: { // Is it a numbered definition?
715 if (D.Num >= CurModule.Values.size())
716 return 0;
717 Value *Result = CurModule.Values[D.Num];
718 if (Ty != Result->getType()) {
719 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
720 Result->getType()->getDescription() + "' does not match "
721 "expected type, '" + Ty->getDescription() + "'");
722 return 0;
723 }
724 return Result;
725 }
726
727 case ValID::LocalName: { // Is it a named definition?
728 if (!inFunctionScope())
729 return 0;
730 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
731 Value *N = SymTab.lookup(D.getName());
732 if (N == 0)
733 return 0;
734 if (N->getType() != Ty)
735 return 0;
736
737 D.destroy(); // Free old strdup'd memory...
738 return N;
739 }
740 case ValID::GlobalName: { // Is it a named definition?
741 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
742 Value *N = SymTab.lookup(D.getName());
743 if (N == 0)
744 return 0;
745 if (N->getType() != Ty)
746 return 0;
747
748 D.destroy(); // Free old strdup'd memory...
749 return N;
750 }
751
752 // Check to make sure that "Ty" is an integral type, and that our
753 // value will fit into the specified type...
754 case ValID::ConstSIntVal: // Is it a constant pool reference??
Chris Lattner59363a32008-02-19 04:36:25 +0000755 if (!isa<IntegerType>(Ty) ||
756 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000757 GenerateError("Signed integral constant '" +
758 itostr(D.ConstPool64) + "' is invalid for type '" +
759 Ty->getDescription() + "'");
760 return 0;
761 }
762 return ConstantInt::get(Ty, D.ConstPool64, true);
763
764 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
Chris Lattner59363a32008-02-19 04:36:25 +0000765 if (isa<IntegerType>(Ty) &&
766 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000767 return ConstantInt::get(Ty, D.UConstPool64);
Chris Lattner59363a32008-02-19 04:36:25 +0000768
769 if (!isa<IntegerType>(Ty) ||
770 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
771 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
772 "' is invalid or out of range for type '" +
773 Ty->getDescription() + "'");
774 return 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000775 }
Chris Lattner59363a32008-02-19 04:36:25 +0000776 // This is really a signed reference. Transmogrify.
777 return ConstantInt::get(Ty, D.ConstPool64, true);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000778
779 case ValID::ConstFPVal: // Is it a floating point const pool reference?
Chris Lattner59363a32008-02-19 04:36:25 +0000780 if (!Ty->isFloatingPoint() ||
781 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000782 GenerateError("FP constant invalid for type");
783 return 0;
784 }
Chris Lattner05ba86e2008-04-20 00:41:19 +0000785 // Lexer has no type info, so builds all float and double FP constants
Dale Johannesen255b8fe2007-09-11 18:33:39 +0000786 // as double. Fix this here. Long double does not need this.
787 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
788 Ty==Type::FloatTy)
Dale Johannesen3afee192007-09-07 21:07:57 +0000789 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
Chris Lattner05ba86e2008-04-20 00:41:19 +0000790 return ConstantFP::get(*D.ConstPoolFP);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000791
792 case ValID::ConstNullVal: // Is it a null value?
793 if (!isa<PointerType>(Ty)) {
794 GenerateError("Cannot create a a non pointer null");
795 return 0;
796 }
797 return ConstantPointerNull::get(cast<PointerType>(Ty));
798
799 case ValID::ConstUndefVal: // Is it an undef value?
800 return UndefValue::get(Ty);
801
802 case ValID::ConstZeroVal: // Is it a zero value?
803 return Constant::getNullValue(Ty);
804
805 case ValID::ConstantVal: // Fully resolved constant?
806 if (D.ConstantValue->getType() != Ty) {
807 GenerateError("Constant expression type different from required type");
808 return 0;
809 }
810 return D.ConstantValue;
811
812 case ValID::InlineAsmVal: { // Inline asm expression
813 const PointerType *PTy = dyn_cast<PointerType>(Ty);
814 const FunctionType *FTy =
815 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
816 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
817 GenerateError("Invalid type for asm constraint string");
818 return 0;
819 }
820 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
821 D.IAD->HasSideEffects);
822 D.destroy(); // Free InlineAsmDescriptor.
823 return IA;
824 }
825 default:
826 assert(0 && "Unhandled case!");
827 return 0;
828 } // End of switch
829
830 assert(0 && "Unhandled case!");
831 return 0;
832}
833
834// getVal - This function is identical to getExistingVal, except that if a
835// value is not already defined, it "improvises" by creating a placeholder var
836// that looks and acts just like the requested variable. When the value is
837// defined later, all uses of the placeholder variable are replaced with the
838// real thing.
839//
840static Value *getVal(const Type *Ty, const ValID &ID) {
841 if (Ty == Type::LabelTy) {
842 GenerateError("Cannot use a basic block here");
843 return 0;
844 }
845
846 // See if the value has already been defined.
847 Value *V = getExistingVal(Ty, ID);
848 if (V) return V;
849 if (TriggerError) return 0;
850
851 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
852 GenerateError("Invalid use of a composite type");
853 return 0;
854 }
855
856 // If we reached here, we referenced either a symbol that we don't know about
857 // or an id number that hasn't been read yet. We may be referencing something
858 // forward, so just create an entry to be resolved later and get to it...
859 //
860 switch (ID.Type) {
861 case ValID::GlobalName:
862 case ValID::GlobalID: {
863 const PointerType *PTy = dyn_cast<PointerType>(Ty);
864 if (!PTy) {
865 GenerateError("Invalid type for reference to global" );
866 return 0;
867 }
868 const Type* ElTy = PTy->getElementType();
869 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
Gabor Greif89f01162008-04-06 23:07:54 +0000870 V = Function::Create(FTy, GlobalValue::ExternalLinkage);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000871 else
Christopher Lamb0a243582007-12-11 09:02:08 +0000872 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
873 (Module*)0, false, PTy->getAddressSpace());
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000874 break;
875 }
876 default:
877 V = new Argument(Ty);
878 }
879
880 // Remember where this forward reference came from. FIXME, shouldn't we try
881 // to recycle these things??
882 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
Duncan Sandsf5588dc2007-11-27 13:23:08 +0000883 LLLgetLineNo())));
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000884
885 if (inFunctionScope())
886 InsertValue(V, CurFun.LateResolveValues);
887 else
888 InsertValue(V, CurModule.LateResolveValues);
889 return V;
890}
891
892/// defineBBVal - This is a definition of a new basic block with the specified
893/// identifier which must be the same as CurFun.NextValNum, if its numeric.
Chris Lattnere7e9b602008-05-04 17:18:47 +0000894static BasicBlock *defineBBVal(const ValID &ID) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000895 assert(inFunctionScope() && "Can't get basic block at global scope!");
896
897 BasicBlock *BB = 0;
898
899 // First, see if this was forward referenced
900
901 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
902 if (BBI != CurFun.BBForwardRefs.end()) {
903 BB = BBI->second;
904 // The forward declaration could have been inserted anywhere in the
905 // function: insert it into the correct place now.
906 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
907 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
908
909 // We're about to erase the entry, save the key so we can clean it up.
910 ValID Tmp = BBI->first;
911
912 // Erase the forward ref from the map as its no longer "forward"
913 CurFun.BBForwardRefs.erase(ID);
914
915 // The key has been removed from the map but so we don't want to leave
916 // strdup'd memory around so destroy it too.
917 Tmp.destroy();
918
919 // If its a numbered definition, bump the number and set the BB value.
920 if (ID.Type == ValID::LocalID) {
921 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
922 InsertValue(BB);
923 }
Devang Patel890cc572008-03-03 18:58:47 +0000924 } else {
925 // We haven't seen this BB before and its first mention is a definition.
926 // Just create it and return it.
927 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
Gabor Greif89f01162008-04-06 23:07:54 +0000928 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Devang Patel890cc572008-03-03 18:58:47 +0000929 if (ID.Type == ValID::LocalID) {
930 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
931 InsertValue(BB);
932 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000933 }
934
Devang Patel890cc572008-03-03 18:58:47 +0000935 ID.destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000936 return BB;
937}
938
939/// getBBVal - get an existing BB value or create a forward reference for it.
940///
941static BasicBlock *getBBVal(const ValID &ID) {
942 assert(inFunctionScope() && "Can't get basic block at global scope!");
943
944 BasicBlock *BB = 0;
945
946 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
947 if (BBI != CurFun.BBForwardRefs.end()) {
948 BB = BBI->second;
949 } if (ID.Type == ValID::LocalName) {
950 std::string Name = ID.getName();
951 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
Anton Korobeynikov21c1eeb2008-02-20 12:10:37 +0000952 if (N) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000953 if (N->getType()->getTypeID() == Type::LabelTyID)
954 BB = cast<BasicBlock>(N);
955 else
956 GenerateError("Reference to label '" + Name + "' is actually of type '"+
957 N->getType()->getDescription() + "'");
Anton Korobeynikov21c1eeb2008-02-20 12:10:37 +0000958 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000959 } else if (ID.Type == ValID::LocalID) {
960 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
961 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
962 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
963 else
964 GenerateError("Reference to label '%" + utostr(ID.Num) +
965 "' is actually of type '"+
966 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
967 }
968 } else {
969 GenerateError("Illegal label reference " + ID.getName());
970 return 0;
971 }
972
973 // If its already been defined, return it now.
974 if (BB) {
975 ID.destroy(); // Free strdup'd memory.
976 return BB;
977 }
978
979 // Otherwise, this block has not been seen before, create it.
980 std::string Name;
981 if (ID.Type == ValID::LocalName)
982 Name = ID.getName();
Gabor Greif89f01162008-04-06 23:07:54 +0000983 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000984
985 // Insert it in the forward refs map.
986 CurFun.BBForwardRefs[ID] = BB;
987
988 return BB;
989}
990
991
992//===----------------------------------------------------------------------===//
993// Code to handle forward references in instructions
994//===----------------------------------------------------------------------===//
995//
996// This code handles the late binding needed with statements that reference
997// values not defined yet... for example, a forward branch, or the PHI node for
998// a loop body.
999//
1000// This keeps a table (CurFun.LateResolveValues) of all such forward references
1001// and back patchs after we are done.
1002//
1003
1004// ResolveDefinitions - If we could not resolve some defs at parsing
1005// time (forward branches, phi functions for loops, etc...) resolve the
1006// defs now...
1007//
1008static void
1009ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
1010 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
1011 while (!LateResolvers.empty()) {
1012 Value *V = LateResolvers.back();
1013 LateResolvers.pop_back();
1014
1015 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1016 CurModule.PlaceHolderInfo.find(V);
1017 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
1018
1019 ValID &DID = PHI->second.first;
1020
1021 Value *TheRealValue = getExistingVal(V->getType(), DID);
1022 if (TriggerError)
1023 return;
1024 if (TheRealValue) {
1025 V->replaceAllUsesWith(TheRealValue);
1026 delete V;
1027 CurModule.PlaceHolderInfo.erase(PHI);
1028 } else if (FutureLateResolvers) {
1029 // Functions have their unresolved items forwarded to the module late
1030 // resolver table
1031 InsertValue(V, *FutureLateResolvers);
1032 } else {
1033 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1034 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1035 "' of type '" + V->getType()->getDescription() + "'",
1036 PHI->second.second);
1037 return;
1038 } else {
1039 GenerateError("Reference to an invalid definition: #" +
1040 itostr(DID.Num) + " of type '" +
1041 V->getType()->getDescription() + "'",
1042 PHI->second.second);
1043 return;
1044 }
1045 }
1046 }
1047 LateResolvers.clear();
1048}
1049
1050// ResolveTypeTo - A brand new type was just declared. This means that (if
1051// name is not null) things referencing Name can be resolved. Otherwise, things
1052// refering to the number can be resolved. Do this now.
1053//
1054static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
1055 ValID D;
1056 if (Name)
1057 D = ValID::createLocalName(*Name);
1058 else
1059 D = ValID::createLocalID(CurModule.Types.size());
1060
1061 std::map<ValID, PATypeHolder>::iterator I =
1062 CurModule.LateResolveTypes.find(D);
1063 if (I != CurModule.LateResolveTypes.end()) {
1064 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
1065 CurModule.LateResolveTypes.erase(I);
1066 }
1067}
1068
1069// setValueName - Set the specified value to the name given. The name may be
1070// null potentially, in which case this is a noop. The string passed in is
1071// assumed to be a malloc'd string buffer, and is free'd by this function.
1072//
1073static void setValueName(Value *V, std::string *NameStr) {
1074 if (!NameStr) return;
1075 std::string Name(*NameStr); // Copy string
1076 delete NameStr; // Free old string
1077
1078 if (V->getType() == Type::VoidTy) {
1079 GenerateError("Can't assign name '" + Name+"' to value with void type");
1080 return;
1081 }
1082
1083 assert(inFunctionScope() && "Must be in function scope!");
1084 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1085 if (ST.lookup(Name)) {
1086 GenerateError("Redefinition of value '" + Name + "' of type '" +
1087 V->getType()->getDescription() + "'");
1088 return;
1089 }
1090
1091 // Set the name.
1092 V->setName(Name);
1093}
1094
1095/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1096/// this is a declaration, otherwise it is a definition.
1097static GlobalVariable *
1098ParseGlobalVariable(std::string *NameStr,
1099 GlobalValue::LinkageTypes Linkage,
1100 GlobalValue::VisibilityTypes Visibility,
1101 bool isConstantGlobal, const Type *Ty,
Christopher Lamb0a243582007-12-11 09:02:08 +00001102 Constant *Initializer, bool IsThreadLocal,
1103 unsigned AddressSpace = 0) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001104 if (isa<FunctionType>(Ty)) {
1105 GenerateError("Cannot declare global vars of function type");
1106 return 0;
1107 }
1108
Christopher Lamb0a243582007-12-11 09:02:08 +00001109 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001110
1111 std::string Name;
1112 if (NameStr) {
1113 Name = *NameStr; // Copy string
1114 delete NameStr; // Free old string
1115 }
1116
1117 // See if this global value was forward referenced. If so, recycle the
1118 // object.
1119 ValID ID;
1120 if (!Name.empty()) {
1121 ID = ValID::createGlobalName(Name);
1122 } else {
1123 ID = ValID::createGlobalID(CurModule.Values.size());
1124 }
1125
1126 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1127 // Move the global to the end of the list, from whereever it was
1128 // previously inserted.
1129 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1130 CurModule.CurrentModule->getGlobalList().remove(GV);
1131 CurModule.CurrentModule->getGlobalList().push_back(GV);
1132 GV->setInitializer(Initializer);
1133 GV->setLinkage(Linkage);
1134 GV->setVisibility(Visibility);
1135 GV->setConstant(isConstantGlobal);
1136 GV->setThreadLocal(IsThreadLocal);
1137 InsertValue(GV, CurModule.Values);
1138 return GV;
1139 }
1140
1141 // If this global has a name
1142 if (!Name.empty()) {
1143 // if the global we're parsing has an initializer (is a definition) and
1144 // has external linkage.
1145 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1146 // If there is already a global with external linkage with this name
1147 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1148 // If we allow this GVar to get created, it will be renamed in the
1149 // symbol table because it conflicts with an existing GVar. We can't
1150 // allow redefinition of GVars whose linking indicates that their name
1151 // must stay the same. Issue the error.
1152 GenerateError("Redefinition of global variable named '" + Name +
1153 "' of type '" + Ty->getDescription() + "'");
1154 return 0;
1155 }
1156 }
1157
1158 // Otherwise there is no existing GV to use, create one now.
1159 GlobalVariable *GV =
1160 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
Christopher Lamb0a243582007-12-11 09:02:08 +00001161 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001162 GV->setVisibility(Visibility);
1163 InsertValue(GV, CurModule.Values);
1164 return GV;
1165}
1166
1167// setTypeName - Set the specified type to the name given. The name may be
1168// null potentially, in which case this is a noop. The string passed in is
1169// assumed to be a malloc'd string buffer, and is freed by this function.
1170//
1171// This function returns true if the type has already been defined, but is
1172// allowed to be redefined in the specified context. If the name is a new name
1173// for the type plane, it is inserted and false is returned.
1174static bool setTypeName(const Type *T, std::string *NameStr) {
1175 assert(!inFunctionScope() && "Can't give types function-local names!");
1176 if (NameStr == 0) return false;
1177
1178 std::string Name(*NameStr); // Copy string
1179 delete NameStr; // Free old string
1180
1181 // We don't allow assigning names to void type
1182 if (T == Type::VoidTy) {
1183 GenerateError("Can't assign name '" + Name + "' to the void type");
1184 return false;
1185 }
1186
1187 // Set the type name, checking for conflicts as we do so.
1188 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1189
1190 if (AlreadyExists) { // Inserting a name that is already defined???
1191 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1192 assert(Existing && "Conflict but no matching type?!");
1193
1194 // There is only one case where this is allowed: when we are refining an
1195 // opaque type. In this case, Existing will be an opaque type.
1196 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1197 // We ARE replacing an opaque type!
1198 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1199 return true;
1200 }
1201
1202 // Otherwise, this is an attempt to redefine a type. That's okay if
1203 // the redefinition is identical to the original. This will be so if
1204 // Existing and T point to the same Type object. In this one case we
1205 // allow the equivalent redefinition.
1206 if (Existing == T) return true; // Yes, it's equal.
1207
1208 // Any other kind of (non-equivalent) redefinition is an error.
1209 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1210 T->getDescription() + "'");
1211 }
1212
1213 return false;
1214}
1215
1216//===----------------------------------------------------------------------===//
1217// Code for handling upreferences in type names...
1218//
1219
1220// TypeContains - Returns true if Ty directly contains E in it.
1221//
1222static bool TypeContains(const Type *Ty, const Type *E) {
1223 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1224 E) != Ty->subtype_end();
1225}
1226
1227namespace {
1228 struct UpRefRecord {
1229 // NestingLevel - The number of nesting levels that need to be popped before
1230 // this type is resolved.
1231 unsigned NestingLevel;
1232
1233 // LastContainedTy - This is the type at the current binding level for the
1234 // type. Every time we reduce the nesting level, this gets updated.
1235 const Type *LastContainedTy;
1236
1237 // UpRefTy - This is the actual opaque type that the upreference is
1238 // represented with.
1239 OpaqueType *UpRefTy;
1240
1241 UpRefRecord(unsigned NL, OpaqueType *URTy)
1242 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1243 };
1244}
1245
1246// UpRefs - A list of the outstanding upreferences that need to be resolved.
1247static std::vector<UpRefRecord> UpRefs;
1248
1249/// HandleUpRefs - Every time we finish a new layer of types, this function is
1250/// called. It loops through the UpRefs vector, which is a list of the
1251/// currently active types. For each type, if the up reference is contained in
1252/// the newly completed type, we decrement the level count. When the level
1253/// count reaches zero, the upreferenced type is the type that is passed in:
1254/// thus we can complete the cycle.
1255///
1256static PATypeHolder HandleUpRefs(const Type *ty) {
1257 // If Ty isn't abstract, or if there are no up-references in it, then there is
1258 // nothing to resolve here.
1259 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1260
1261 PATypeHolder Ty(ty);
1262 UR_OUT("Type '" << Ty->getDescription() <<
1263 "' newly formed. Resolving upreferences.\n" <<
1264 UpRefs.size() << " upreferences active!\n");
1265
1266 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1267 // to zero), we resolve them all together before we resolve them to Ty. At
1268 // the end of the loop, if there is anything to resolve to Ty, it will be in
1269 // this variable.
1270 OpaqueType *TypeToResolve = 0;
1271
1272 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1273 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1274 << UpRefs[i].second->getDescription() << ") = "
1275 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1276 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1277 // Decrement level of upreference
1278 unsigned Level = --UpRefs[i].NestingLevel;
1279 UpRefs[i].LastContainedTy = Ty;
1280 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1281 if (Level == 0) { // Upreference should be resolved!
1282 if (!TypeToResolve) {
1283 TypeToResolve = UpRefs[i].UpRefTy;
1284 } else {
1285 UR_OUT(" * Resolving upreference for "
1286 << UpRefs[i].second->getDescription() << "\n";
1287 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1288 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1289 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1290 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1291 }
1292 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1293 --i; // Do not skip the next element...
1294 }
1295 }
1296 }
1297
1298 if (TypeToResolve) {
1299 UR_OUT(" * Resolving upreference for "
1300 << UpRefs[i].second->getDescription() << "\n";
1301 std::string OldName = TypeToResolve->getDescription());
1302 TypeToResolve->refineAbstractTypeTo(Ty);
1303 }
1304
1305 return Ty;
1306}
1307
1308//===----------------------------------------------------------------------===//
1309// RunVMAsmParser - Define an interface to this parser
1310//===----------------------------------------------------------------------===//
1311//
1312static Module* RunParser(Module * M);
1313
Duncan Sandsf5588dc2007-11-27 13:23:08 +00001314Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1315 InitLLLexer(MB);
1316 Module *M = RunParser(new Module(LLLgetFilename()));
1317 FreeLexer();
1318 return M;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001319}
1320
1321
Dan Gohman54392c12008-04-19 00:24:39 +00001322
1323/* Enabling traces. */
1324#ifndef YYDEBUG
1325# define YYDEBUG 0
1326#endif
1327
1328/* Enabling verbose error messages. */
1329#ifdef YYERROR_VERBOSE
1330# undef YYERROR_VERBOSE
1331# define YYERROR_VERBOSE 1
1332#else
1333# define YYERROR_VERBOSE 0
1334#endif
1335
1336/* Enabling the token table. */
1337#ifndef YYTOKEN_TABLE
1338# define YYTOKEN_TABLE 0
1339#endif
1340
1341#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1342typedef union YYSTYPE
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001343#line 949 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00001344{
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001345 llvm::Module *ModuleVal;
1346 llvm::Function *FunctionVal;
1347 llvm::BasicBlock *BasicBlockVal;
1348 llvm::TerminatorInst *TermInstVal;
1349 llvm::Instruction *InstVal;
1350 llvm::Constant *ConstVal;
1351
1352 const llvm::Type *PrimType;
1353 std::list<llvm::PATypeHolder> *TypeList;
1354 llvm::PATypeHolder *TypeVal;
1355 llvm::Value *ValueVal;
1356 std::vector<llvm::Value*> *ValueList;
1357 llvm::ArgListType *ArgList;
1358 llvm::TypeWithAttrs TypeWithAttrs;
1359 llvm::TypeWithAttrsList *TypeWithAttrsList;
Dale Johannesencfb19e62007-11-05 21:20:28 +00001360 llvm::ParamList *ParamList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001361
1362 // Represent the RHS of PHI node
1363 std::list<std::pair<llvm::Value*,
1364 llvm::BasicBlock*> > *PHIList;
1365 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
1366 std::vector<llvm::Constant*> *ConstVector;
1367
1368 llvm::GlobalValue::LinkageTypes Linkage;
1369 llvm::GlobalValue::VisibilityTypes Visibility;
Dale Johannesend915ee52008-02-19 21:40:51 +00001370 llvm::ParameterAttributes ParamAttrs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001371 llvm::APInt *APIntVal;
1372 int64_t SInt64Val;
1373 uint64_t UInt64Val;
1374 int SIntVal;
1375 unsigned UIntVal;
Dale Johannesen3afee192007-09-07 21:07:57 +00001376 llvm::APFloat *FPVal;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001377 bool BoolVal;
1378
1379 std::string *StrVal; // This memory must be deleted
1380 llvm::ValID ValIDVal;
1381
1382 llvm::Instruction::BinaryOps BinaryOpVal;
1383 llvm::Instruction::TermOps TermOpVal;
1384 llvm::Instruction::MemoryOps MemOpVal;
1385 llvm::Instruction::CastOps CastOpVal;
1386 llvm::Instruction::OtherOps OtherOpVal;
1387 llvm::ICmpInst::Predicate IPredicate;
1388 llvm::FCmpInst::Predicate FPredicate;
Dan Gohman54392c12008-04-19 00:24:39 +00001389}
1390/* Line 193 of yacc.c. */
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001391#line 1392 "llvmAsmParser.tab.c"
Dan Gohman54392c12008-04-19 00:24:39 +00001392 YYSTYPE;
1393# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1394# define YYSTYPE_IS_DECLARED 1
1395# define YYSTYPE_IS_TRIVIAL 1
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001396#endif
1397
1398
1399
Dan Gohman54392c12008-04-19 00:24:39 +00001400/* Copy the second part of user declarations. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001401
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001402
Dan Gohman54392c12008-04-19 00:24:39 +00001403/* Line 216 of yacc.c. */
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001404#line 1405 "llvmAsmParser.tab.c"
Reid Spenceraa8ae282007-07-31 03:50:36 +00001405
Dan Gohman54392c12008-04-19 00:24:39 +00001406#ifdef short
1407# undef short
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001408#endif
1409
Dan Gohman54392c12008-04-19 00:24:39 +00001410#ifdef YYTYPE_UINT8
1411typedef YYTYPE_UINT8 yytype_uint8;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001412#else
Dan Gohman54392c12008-04-19 00:24:39 +00001413typedef unsigned char yytype_uint8;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001414#endif
1415
Dan Gohman54392c12008-04-19 00:24:39 +00001416#ifdef YYTYPE_INT8
1417typedef YYTYPE_INT8 yytype_int8;
1418#elif (defined __STDC__ || defined __C99__FUNC__ \
1419 || defined __cplusplus || defined _MSC_VER)
1420typedef signed char yytype_int8;
1421#else
1422typedef short int yytype_int8;
1423#endif
1424
1425#ifdef YYTYPE_UINT16
1426typedef YYTYPE_UINT16 yytype_uint16;
1427#else
1428typedef unsigned short int yytype_uint16;
1429#endif
1430
1431#ifdef YYTYPE_INT16
1432typedef YYTYPE_INT16 yytype_int16;
1433#else
1434typedef short int yytype_int16;
1435#endif
1436
1437#ifndef YYSIZE_T
1438# ifdef __SIZE_TYPE__
1439# define YYSIZE_T __SIZE_TYPE__
1440# elif defined size_t
1441# define YYSIZE_T size_t
1442# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1443 || defined __cplusplus || defined _MSC_VER)
1444# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1445# define YYSIZE_T size_t
1446# else
1447# define YYSIZE_T unsigned int
1448# endif
1449#endif
1450
1451#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1452
1453#ifndef YY_
1454# if defined YYENABLE_NLS && YYENABLE_NLS
1455# if ENABLE_NLS
1456# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1457# define YY_(msgid) dgettext ("bison-runtime", msgid)
1458# endif
1459# endif
1460# ifndef YY_
1461# define YY_(msgid) msgid
1462# endif
1463#endif
1464
1465/* Suppress unused-variable warnings by "using" E. */
1466#if ! defined lint || defined __GNUC__
1467# define YYUSE(e) ((void) (e))
1468#else
1469# define YYUSE(e) /* empty */
1470#endif
1471
1472/* Identity function, used to suppress warnings about constant conditions. */
1473#ifndef lint
1474# define YYID(n) (n)
1475#else
1476#if (defined __STDC__ || defined __C99__FUNC__ \
1477 || defined __cplusplus || defined _MSC_VER)
1478static int
1479YYID (int i)
1480#else
1481static int
1482YYID (i)
1483 int i;
1484#endif
1485{
1486 return i;
1487}
1488#endif
1489
1490#if ! defined yyoverflow || YYERROR_VERBOSE
1491
1492/* The parser invokes alloca or malloc; define the necessary symbols. */
1493
1494# ifdef YYSTACK_USE_ALLOCA
1495# if YYSTACK_USE_ALLOCA
1496# ifdef __GNUC__
1497# define YYSTACK_ALLOC __builtin_alloca
1498# elif defined __BUILTIN_VA_ARG_INCR
1499# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1500# elif defined _AIX
1501# define YYSTACK_ALLOC __alloca
1502# elif defined _MSC_VER
1503# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1504# define alloca _alloca
1505# else
1506# define YYSTACK_ALLOC alloca
1507# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1508 || defined __cplusplus || defined _MSC_VER)
1509# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1510# ifndef _STDLIB_H
1511# define _STDLIB_H 1
1512# endif
1513# endif
1514# endif
1515# endif
1516# endif
1517
1518# ifdef YYSTACK_ALLOC
1519 /* Pacify GCC's `empty if-body' warning. */
1520# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1521# ifndef YYSTACK_ALLOC_MAXIMUM
1522 /* The OS might guarantee only one guard page at the bottom of the stack,
1523 and a page size can be as small as 4096 bytes. So we cannot safely
1524 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1525 to allow for a few compiler-allocated temporary stack slots. */
1526# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1527# endif
1528# else
1529# define YYSTACK_ALLOC YYMALLOC
1530# define YYSTACK_FREE YYFREE
1531# ifndef YYSTACK_ALLOC_MAXIMUM
1532# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1533# endif
1534# if (defined __cplusplus && ! defined _STDLIB_H \
1535 && ! ((defined YYMALLOC || defined malloc) \
1536 && (defined YYFREE || defined free)))
1537# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1538# ifndef _STDLIB_H
1539# define _STDLIB_H 1
1540# endif
1541# endif
1542# ifndef YYMALLOC
1543# define YYMALLOC malloc
1544# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1545 || defined __cplusplus || defined _MSC_VER)
1546void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1547# endif
1548# endif
1549# ifndef YYFREE
1550# define YYFREE free
1551# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1552 || defined __cplusplus || defined _MSC_VER)
1553void free (void *); /* INFRINGES ON USER NAME SPACE */
1554# endif
1555# endif
1556# endif
1557#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1558
1559
1560#if (! defined yyoverflow \
1561 && (! defined __cplusplus \
1562 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1563
1564/* A type that is properly aligned for any stack member. */
1565union yyalloc
1566{
1567 yytype_int16 yyss;
1568 YYSTYPE yyvs;
1569 };
1570
1571/* The size of the maximum gap between one aligned stack and the next. */
1572# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1573
1574/* The size of an array large to enough to hold all stacks, each with
1575 N elements. */
1576# define YYSTACK_BYTES(N) \
1577 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1578 + YYSTACK_GAP_MAXIMUM)
1579
1580/* Copy COUNT objects from FROM to TO. The source and destination do
1581 not overlap. */
1582# ifndef YYCOPY
1583# if defined __GNUC__ && 1 < __GNUC__
1584# define YYCOPY(To, From, Count) \
1585 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1586# else
1587# define YYCOPY(To, From, Count) \
1588 do \
1589 { \
1590 YYSIZE_T yyi; \
1591 for (yyi = 0; yyi < (Count); yyi++) \
1592 (To)[yyi] = (From)[yyi]; \
1593 } \
1594 while (YYID (0))
1595# endif
1596# endif
1597
1598/* Relocate STACK from its old location to the new one. The
1599 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1600 elements in the stack, and YYPTR gives the new location of the
1601 stack. Advance YYPTR to a properly aligned location for the next
1602 stack. */
1603# define YYSTACK_RELOCATE(Stack) \
1604 do \
1605 { \
1606 YYSIZE_T yynewbytes; \
1607 YYCOPY (&yyptr->Stack, Stack, yysize); \
1608 Stack = &yyptr->Stack; \
1609 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1610 yyptr += yynewbytes / sizeof (*yyptr); \
1611 } \
1612 while (YYID (0))
1613
1614#endif
1615
1616/* YYFINAL -- State number of the termination state. */
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001617#define YYFINAL 44
Dan Gohman54392c12008-04-19 00:24:39 +00001618/* YYLAST -- Last index in YYTABLE. */
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001619#define YYLAST 2040
Dan Gohman54392c12008-04-19 00:24:39 +00001620
1621/* YYNTOKENS -- Number of terminals. */
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001622#define YYNTOKENS 168
Dan Gohman54392c12008-04-19 00:24:39 +00001623/* YYNNTS -- Number of nonterminals. */
1624#define YYNNTS 85
1625/* YYNRULES -- Number of rules. */
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001626#define YYNRULES 327
Dan Gohman54392c12008-04-19 00:24:39 +00001627/* YYNRULES -- Number of states. */
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001628#define YYNSTATES 656
Dan Gohman54392c12008-04-19 00:24:39 +00001629
1630/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1631#define YYUNDEFTOK 2
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001632#define YYMAXUTOK 408
Dan Gohman54392c12008-04-19 00:24:39 +00001633
1634#define YYTRANSLATE(YYX) \
1635 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1636
1637/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1638static const yytype_uint8 yytranslate[] =
1639{
1640 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1641 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1642 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1643 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001644 154, 155, 158, 2, 157, 2, 2, 2, 2, 2,
Dan Gohman54392c12008-04-19 00:24:39 +00001645 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001646 163, 156, 164, 2, 2, 2, 2, 2, 2, 2,
Dan Gohman54392c12008-04-19 00:24:39 +00001647 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1648 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001649 2, 160, 159, 162, 2, 2, 2, 2, 2, 167,
Dan Gohman54392c12008-04-19 00:24:39 +00001650 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1651 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001652 161, 2, 2, 165, 2, 166, 2, 2, 2, 2,
Dan Gohman54392c12008-04-19 00:24:39 +00001653 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, 2, 2, 2, 2,
1663 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1664 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1665 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1666 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1667 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1668 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1669 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1670 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1671 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1672 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1673 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1674 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1675 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1676 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1677 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1678 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1679 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001680 145, 146, 147, 148, 149, 150, 151, 152, 153
Dan Gohman54392c12008-04-19 00:24:39 +00001681};
1682
1683#if YYDEBUG
1684/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1685 YYRHS. */
1686static const yytype_uint16 yyprhs[] =
1687{
1688 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1689 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1690 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1691 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1692 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1693 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1694 119, 121, 123, 125, 127, 129, 130, 135, 136, 139,
1695 140, 142, 144, 146, 147, 150, 152, 154, 156, 158,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001696 160, 162, 164, 166, 168, 169, 171, 173, 175, 176,
1697 178, 180, 181, 183, 185, 187, 189, 190, 192, 194,
1698 195, 197, 199, 201, 203, 205, 208, 210, 212, 214,
1699 216, 218, 220, 222, 224, 226, 229, 230, 233, 235,
1700 237, 239, 241, 243, 245, 246, 249, 250, 253, 254,
1701 257, 258, 262, 265, 266, 268, 269, 273, 275, 278,
1702 280, 282, 284, 286, 288, 290, 292, 294, 296, 300,
1703 302, 305, 311, 317, 323, 329, 333, 336, 342, 347,
1704 350, 352, 354, 356, 360, 362, 366, 368, 369, 371,
1705 375, 380, 384, 388, 393, 398, 402, 409, 415, 418,
1706 421, 424, 427, 430, 433, 436, 439, 442, 445, 448,
1707 451, 458, 464, 473, 480, 487, 495, 503, 511, 519,
1708 526, 535, 544, 548, 550, 552, 554, 556, 557, 560,
1709 567, 569, 570, 572, 575, 576, 580, 581, 585, 589,
1710 593, 597, 598, 607, 608, 618, 619, 629, 635, 638,
1711 642, 644, 648, 652, 656, 660, 662, 663, 669, 673,
1712 675, 679, 681, 682, 693, 695, 697, 702, 704, 706,
1713 709, 713, 714, 716, 718, 720, 722, 724, 726, 728,
1714 730, 732, 736, 738, 744, 746, 748, 750, 752, 754,
1715 756, 759, 761, 765, 768, 771, 775, 778, 779, 781,
1716 784, 787, 791, 801, 811, 820, 835, 837, 839, 846,
1717 852, 855, 862, 870, 875, 880, 887, 894, 895, 896,
1718 900, 903, 905, 911, 917, 924, 931, 938, 945, 950,
1719 957, 962, 967, 974, 981, 984, 993, 995, 997, 998,
1720 1002, 1009, 1013, 1020, 1023, 1029, 1037, 1043
Dan Gohman54392c12008-04-19 00:24:39 +00001721};
1722
1723/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1724static const yytype_int16 yyrhs[] =
1725{
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001726 214, 0, -1, 75, -1, 76, -1, 77, -1, 78,
1727 -1, 79, -1, 80, -1, 81, -1, 82, -1, 83,
1728 -1, 87, -1, 88, -1, 89, -1, 84, -1, 85,
1729 -1, 86, -1, 120, -1, 121, -1, 122, -1, 123,
1730 -1, 124, -1, 125, -1, 126, -1, 127, -1, 128,
1731 -1, 129, -1, 130, -1, 131, -1, 94, -1, 95,
1732 -1, 96, -1, 97, -1, 98, -1, 99, -1, 100,
1733 -1, 101, -1, 102, -1, 103, -1, 104, -1, 105,
1734 -1, 106, -1, 107, -1, 108, -1, 109, -1, 110,
1735 -1, 111, -1, 112, -1, 113, -1, 100, -1, 101,
1736 -1, 102, -1, 103, -1, 26, -1, 27, -1, 11,
Dan Gohman54392c12008-04-19 00:24:39 +00001737 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001738 -1, 19, -1, 22, -1, 24, -1, 176, -1, -1,
1739 55, 154, 4, 155, -1, -1, 176, 156, -1, -1,
1740 20, -1, 23, -1, 182, -1, -1, 180, 156, -1,
Dan Gohman54392c12008-04-19 00:24:39 +00001741 42, -1, 44, -1, 43, -1, 45, -1, 47, -1,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001742 49, -1, 46, -1, 48, -1, 51, -1, -1, 151,
1743 -1, 152, -1, 153, -1, -1, 46, -1, 48, -1,
1744 -1, 42, -1, 43, -1, 44, -1, 47, -1, -1,
1745 44, -1, 42, -1, -1, 63, -1, 64, -1, 65,
1746 -1, 66, -1, 67, -1, 62, 4, -1, 140, -1,
1747 121, -1, 139, -1, 122, -1, 142, -1, 143, -1,
1748 145, -1, 146, -1, 147, -1, 54, 4, -1, -1,
1749 191, 190, -1, 141, -1, 144, -1, 140, -1, 139,
1750 -1, 148, -1, 149, -1, -1, 193, 192, -1, -1,
1751 150, 22, -1, -1, 54, 4, -1, -1, 157, 54,
1752 4, -1, 34, 22, -1, -1, 197, -1, -1, 157,
1753 200, 199, -1, 197, -1, 54, 4, -1, 11, -1,
1754 12, -1, 13, -1, 16, -1, 15, -1, 14, -1,
1755 17, -1, 50, -1, 201, -1, 202, 178, 158, -1,
1756 236, -1, 159, 4, -1, 202, 154, 206, 155, 193,
1757 -1, 10, 154, 206, 155, 193, -1, 160, 4, 161,
1758 202, 162, -1, 163, 4, 161, 202, 164, -1, 165,
1759 207, 166, -1, 165, 166, -1, 163, 165, 207, 166,
1760 164, -1, 163, 165, 166, 164, -1, 202, 191, -1,
1761 202, -1, 10, -1, 203, -1, 205, 157, 203, -1,
1762 205, -1, 205, 157, 39, -1, 39, -1, -1, 202,
1763 -1, 207, 157, 202, -1, 202, 160, 210, 162, -1,
1764 202, 160, 162, -1, 202, 167, 22, -1, 202, 163,
1765 210, 164, -1, 202, 165, 210, 166, -1, 202, 165,
1766 166, -1, 202, 163, 165, 210, 166, 164, -1, 202,
1767 163, 165, 166, 164, -1, 202, 40, -1, 202, 41,
1768 -1, 202, 236, -1, 202, 209, -1, 202, 25, -1,
1769 174, 3, -1, 174, 5, -1, 174, 4, -1, 174,
1770 6, -1, 11, 26, -1, 11, 27, -1, 175, 9,
1771 -1, 171, 154, 208, 38, 202, 155, -1, 119, 154,
1772 208, 248, 155, -1, 133, 154, 208, 157, 208, 157,
1773 208, 155, -1, 169, 154, 208, 157, 208, 155, -1,
1774 170, 154, 208, 157, 208, 155, -1, 90, 172, 154,
1775 208, 157, 208, 155, -1, 91, 173, 154, 208, 157,
1776 208, 155, -1, 92, 172, 154, 208, 157, 208, 155,
1777 -1, 93, 173, 154, 208, 157, 208, 155, -1, 135,
1778 154, 208, 157, 208, 155, -1, 136, 154, 208, 157,
1779 208, 157, 208, 155, -1, 137, 154, 208, 157, 208,
1780 157, 208, 155, -1, 210, 157, 208, -1, 208, -1,
1781 32, -1, 33, -1, 37, -1, -1, 204, 236, -1,
1782 125, 154, 213, 38, 202, 155, -1, 215, -1, -1,
1783 216, -1, 215, 216, -1, -1, 31, 217, 232, -1,
1784 -1, 30, 218, 233, -1, 60, 59, 222, -1, 179,
1785 18, 202, -1, 179, 18, 10, -1, -1, 181, 185,
1786 212, 211, 208, 178, 219, 199, -1, -1, 181, 183,
1787 185, 212, 211, 208, 178, 220, 199, -1, -1, 181,
1788 184, 185, 212, 211, 202, 178, 221, 199, -1, 181,
1789 185, 35, 188, 213, -1, 52, 223, -1, 56, 156,
1790 224, -1, 22, -1, 53, 156, 22, -1, 68, 156,
1791 22, -1, 160, 225, 162, -1, 225, 157, 22, -1,
1792 22, -1, -1, 226, 157, 202, 191, 177, -1, 202,
1793 191, 177, -1, 226, -1, 226, 157, 39, -1, 39,
1794 -1, -1, 189, 204, 180, 154, 227, 155, 193, 198,
1795 195, 194, -1, 28, -1, 165, -1, 187, 185, 228,
1796 229, -1, 29, -1, 166, -1, 240, 231, -1, 186,
1797 185, 228, -1, -1, 61, -1, 3, -1, 4, -1,
1798 9, -1, 26, -1, 27, -1, 40, -1, 41, -1,
1799 25, -1, 163, 210, 164, -1, 209, -1, 59, 234,
1800 22, 157, 22, -1, 7, -1, 8, -1, 176, -1,
1801 180, -1, 236, -1, 235, -1, 202, 237, -1, 238,
1802 -1, 239, 157, 238, -1, 240, 241, -1, 230, 241,
1803 -1, 242, 179, 243, -1, 242, 245, -1, -1, 21,
1804 -1, 69, 239, -1, 69, 10, -1, 70, 17, 237,
1805 -1, 70, 11, 237, 157, 17, 237, 157, 17, 237,
1806 -1, 71, 174, 237, 157, 17, 237, 160, 244, 162,
1807 -1, 71, 174, 237, 157, 17, 237, 160, 162, -1,
1808 72, 189, 204, 237, 154, 247, 155, 193, 38, 17,
1809 237, 73, 17, 237, -1, 73, -1, 74, -1, 244,
1810 174, 235, 157, 17, 237, -1, 174, 235, 157, 17,
1811 237, -1, 179, 250, -1, 202, 160, 237, 157, 237,
1812 162, -1, 246, 157, 160, 237, 157, 237, 162, -1,
1813 202, 191, 237, 191, -1, 17, 191, 237, 191, -1,
1814 247, 157, 202, 191, 237, 191, -1, 247, 157, 17,
1815 191, 237, 191, -1, -1, -1, 248, 157, 238, -1,
1816 58, 57, -1, 57, -1, 169, 202, 237, 157, 237,
1817 -1, 170, 202, 237, 157, 237, -1, 90, 172, 202,
1818 237, 157, 237, -1, 91, 173, 202, 237, 157, 237,
1819 -1, 92, 172, 202, 237, 157, 237, -1, 93, 173,
1820 202, 237, 157, 237, -1, 171, 238, 38, 202, -1,
1821 133, 238, 157, 238, 157, 238, -1, 134, 238, 157,
1822 202, -1, 135, 238, 157, 238, -1, 136, 238, 157,
1823 238, 157, 238, -1, 137, 238, 157, 238, 157, 238,
1824 -1, 132, 246, -1, 249, 189, 204, 237, 154, 247,
1825 155, 193, -1, 252, -1, 36, -1, -1, 114, 202,
1826 196, -1, 114, 202, 157, 11, 237, 196, -1, 115,
1827 202, 196, -1, 115, 202, 157, 11, 237, 196, -1,
1828 116, 238, -1, 251, 117, 202, 237, 196, -1, 251,
1829 118, 238, 157, 202, 237, 196, -1, 138, 202, 237,
1830 157, 4, -1, 119, 202, 237, 248, -1
Dan Gohman54392c12008-04-19 00:24:39 +00001831};
1832
1833/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1834static const yytype_uint16 yyrline[] =
1835{
Chris Lattnere7e9b602008-05-04 17:18:47 +00001836 0, 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111,
1837 1111, 1112, 1112, 1112, 1112, 1112, 1112, 1113, 1113, 1113,
1838 1113, 1113, 1113, 1114, 1114, 1114, 1114, 1114, 1114, 1117,
1839 1117, 1118, 1118, 1119, 1119, 1120, 1120, 1121, 1121, 1125,
1840 1125, 1126, 1126, 1127, 1127, 1128, 1128, 1129, 1129, 1130,
1841 1130, 1131, 1131, 1132, 1133, 1138, 1139, 1139, 1139, 1139,
1842 1139, 1141, 1141, 1141, 1142, 1142, 1144, 1145, 1149, 1153,
1843 1158, 1158, 1160, 1161, 1166, 1172, 1173, 1174, 1175, 1176,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001844 1177, 1181, 1182, 1183, 1187, 1188, 1189, 1190, 1194, 1195,
1845 1196, 1200, 1201, 1202, 1203, 1204, 1208, 1209, 1210, 1213,
1846 1214, 1215, 1216, 1217, 1218, 1219, 1226, 1227, 1228, 1229,
1847 1230, 1231, 1232, 1233, 1234, 1235, 1239, 1240, 1245, 1246,
1848 1247, 1248, 1249, 1250, 1253, 1254, 1259, 1260, 1267, 1268,
1849 1274, 1275, 1284, 1292, 1293, 1298, 1299, 1300, 1305, 1318,
1850 1318, 1318, 1318, 1318, 1318, 1318, 1321, 1325, 1329, 1336,
1851 1341, 1349, 1378, 1403, 1408, 1418, 1428, 1432, 1442, 1449,
1852 1458, 1465, 1470, 1475, 1482, 1483, 1490, 1497, 1505, 1511,
1853 1523, 1551, 1567, 1594, 1622, 1648, 1668, 1694, 1714, 1726,
1854 1733, 1799, 1809, 1819, 1825, 1835, 1841, 1851, 1856, 1861,
1855 1874, 1886, 1908, 1916, 1922, 1933, 1938, 1943, 1948, 1953,
1856 1959, 1965, 1974, 1978, 1986, 1986, 1989, 1989, 1992, 2004,
1857 2025, 2030, 2038, 2039, 2043, 2043, 2047, 2047, 2050, 2053,
1858 2077, 2089, 2088, 2100, 2099, 2109, 2108, 2119, 2159, 2162,
1859 2168, 2178, 2182, 2187, 2189, 2194, 2199, 2208, 2218, 2229,
1860 2233, 2242, 2251, 2256, 2385, 2385, 2387, 2396, 2396, 2398,
1861 2403, 2415, 2419, 2424, 2428, 2432, 2436, 2440, 2444, 2448,
1862 2452, 2456, 2481, 2485, 2495, 2499, 2503, 2508, 2515, 2515,
1863 2521, 2530, 2535, 2540, 2544, 2553, 2562, 2571, 2575, 2583,
1864 2590, 2594, 2599, 2609, 2628, 2637, 2722, 2726, 2733, 2744,
1865 2757, 2767, 2778, 2788, 2799, 2807, 2817, 2824, 2827, 2828,
1866 2835, 2839, 2844, 2860, 2877, 2891, 2905, 2919, 2933, 2945,
1867 2953, 2960, 2966, 2972, 2978, 2993, 3083, 3088, 3092, 3099,
1868 3106, 3114, 3121, 3129, 3137, 3151, 3168, 3176
Dan Gohman54392c12008-04-19 00:24:39 +00001869};
1870#endif
1871
1872#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1873/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1874 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1875static const char *const yytname[] =
1876{
1877 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1878 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1879 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1880 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1881 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1882 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1883 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1884 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001885 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "COMMON", "OPAQUE",
Dan Gohman54392c12008-04-19 00:24:39 +00001886 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1887 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1888 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
Chris Lattnere7e9b602008-05-04 17:18:47 +00001889 "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE",
1890 "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM",
Nate Begeman646fa482008-05-12 19:01:56 +00001891 "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "VICMP",
1892 "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1893 "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1894 "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1895 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1896 "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1897 "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
1898 "GETRESULT", "SIGNEXT", "ZEROEXT", "NORETURN", "INREG", "SRET",
1899 "NOUNWIND", "NOALIAS", "BYVAL", "NEST", "READNONE", "READONLY", "GC",
1900 "DEFAULT", "HIDDEN", "PROTECTED", "'('", "')'", "'='", "','", "'*'",
1901 "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'c'",
1902 "$accept", "ArithmeticOps", "LogicalOps", "CastOps", "IPredicates",
1903 "FPredicates", "IntType", "FPType", "LocalName", "OptLocalName",
1904 "OptAddrSpace", "OptLocalAssign", "GlobalName", "OptGlobalAssign",
1905 "GlobalAssign", "GVInternalLinkage", "GVExternalLinkage",
1906 "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage",
1907 "AliasLinkage", "OptCallingConv", "ParamAttr", "OptParamAttrs",
1908 "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign", "OptCAlign",
1909 "SectionString", "OptSection", "GlobalVarAttributes",
Dan Gohman54392c12008-04-19 00:24:39 +00001910 "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
1911 "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
1912 "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
1913 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1914 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1915 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1916 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1917 "SymbolicValueRef", "ValueRef", "ResolvedVal", "ReturnedVal",
1918 "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst",
1919 "JumpTable", "Inst", "PHIList", "ParamList", "IndexList", "OptTailCall",
1920 "InstVal", "OptVolatile", "MemoryInst", 0
1921};
1922#endif
1923
1924# ifdef YYPRINT
1925/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1926 token YYLEX-NUM. */
1927static const yytype_uint16 yytoknum[] =
1928{
1929 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1930 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1931 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1932 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1933 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1934 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1935 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1936 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1937 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1938 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1939 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1940 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1941 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1942 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1943 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001944 405, 406, 407, 408, 40, 41, 61, 44, 42, 92,
1945 91, 120, 93, 60, 62, 123, 125, 99
Dan Gohman54392c12008-04-19 00:24:39 +00001946};
1947# endif
1948
1949/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1950static const yytype_uint8 yyr1[] =
1951{
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001952 0, 168, 169, 169, 169, 169, 169, 169, 169, 169,
1953 169, 170, 170, 170, 170, 170, 170, 171, 171, 171,
Nate Begeman646fa482008-05-12 19:01:56 +00001954 171, 171, 171, 171, 171, 171, 171, 171, 171, 172,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001955 172, 172, 172, 172, 172, 172, 172, 172, 172, 173,
1956 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
1957 173, 173, 173, 173, 173, 174, 175, 175, 175, 175,
1958 175, 176, 176, 176, 177, 177, 178, 178, 179, 179,
1959 180, 180, 181, 181, 182, 183, 183, 183, 183, 183,
1960 183, 184, 184, 184, 185, 185, 185, 185, 186, 186,
1961 186, 187, 187, 187, 187, 187, 188, 188, 188, 189,
1962 189, 189, 189, 189, 189, 189, 190, 190, 190, 190,
1963 190, 190, 190, 190, 190, 190, 191, 191, 192, 192,
1964 192, 192, 192, 192, 193, 193, 194, 194, 195, 195,
1965 196, 196, 197, 198, 198, 199, 199, 200, 200, 201,
1966 201, 201, 201, 201, 201, 201, 202, 202, 202, 202,
1967 202, 202, 202, 202, 202, 202, 202, 202, 202, 203,
1968 204, 204, 205, 205, 206, 206, 206, 206, 207, 207,
Nate Begeman646fa482008-05-12 19:01:56 +00001969 208, 208, 208, 208, 208, 208, 208, 208, 208, 208,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001970 208, 208, 208, 208, 208, 208, 208, 208, 208, 208,
1971 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
1972 209, 209, 210, 210, 211, 211, 212, 212, 213, 213,
1973 214, 214, 215, 215, 217, 216, 218, 216, 216, 216,
1974 216, 219, 216, 220, 216, 221, 216, 216, 216, 216,
1975 222, 223, 223, 224, 225, 225, 225, 226, 226, 227,
1976 227, 227, 227, 228, 229, 229, 230, 231, 231, 232,
1977 233, 234, 234, 235, 235, 235, 235, 235, 235, 235,
1978 235, 235, 235, 235, 236, 236, 236, 236, 237, 237,
1979 238, 239, 239, 240, 240, 241, 242, 242, 242, 243,
1980 243, 243, 243, 243, 243, 243, 243, 243, 244, 244,
1981 245, 246, 246, 247, 247, 247, 247, 247, 248, 248,
1982 249, 249, 250, 250, 250, 250, 250, 250, 250, 250,
1983 250, 250, 250, 250, 250, 250, 250, 251, 251, 252,
1984 252, 252, 252, 252, 252, 252, 252, 252
Dan Gohman54392c12008-04-19 00:24:39 +00001985};
1986
1987/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1988static const yytype_uint8 yyr2[] =
1989{
1990 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1991 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1992 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1993 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1994 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1995 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1996 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
1997 1, 1, 1, 0, 2, 1, 1, 1, 1, 1,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00001998 1, 1, 1, 1, 0, 1, 1, 1, 0, 1,
1999 1, 0, 1, 1, 1, 1, 0, 1, 1, 0,
2000 1, 1, 1, 1, 1, 2, 1, 1, 1, 1,
2001 1, 1, 1, 1, 1, 2, 0, 2, 1, 1,
2002 1, 1, 1, 1, 0, 2, 0, 2, 0, 2,
2003 0, 3, 2, 0, 1, 0, 3, 1, 2, 1,
2004 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
2005 2, 5, 5, 5, 5, 3, 2, 5, 4, 2,
2006 1, 1, 1, 3, 1, 3, 1, 0, 1, 3,
2007 4, 3, 3, 4, 4, 3, 6, 5, 2, 2,
2008 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2009 6, 5, 8, 6, 6, 7, 7, 7, 7, 6,
2010 8, 8, 3, 1, 1, 1, 1, 0, 2, 6,
2011 1, 0, 1, 2, 0, 3, 0, 3, 3, 3,
2012 3, 0, 8, 0, 9, 0, 9, 5, 2, 3,
2013 1, 3, 3, 3, 3, 1, 0, 5, 3, 1,
2014 3, 1, 0, 10, 1, 1, 4, 1, 1, 2,
2015 3, 0, 1, 1, 1, 1, 1, 1, 1, 1,
2016 1, 3, 1, 5, 1, 1, 1, 1, 1, 1,
2017 2, 1, 3, 2, 2, 3, 2, 0, 1, 2,
2018 2, 3, 9, 9, 8, 14, 1, 1, 6, 5,
2019 2, 6, 7, 4, 4, 6, 6, 0, 0, 3,
2020 2, 1, 5, 5, 6, 6, 6, 6, 4, 6,
2021 4, 4, 6, 6, 2, 8, 1, 1, 0, 3,
2022 6, 3, 6, 2, 5, 7, 5, 4
Dan Gohman54392c12008-04-19 00:24:39 +00002023};
2024
2025/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2026 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2027 means the default is an error. */
2028static const yytype_uint16 yydefact[] =
2029{
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002030 73, 61, 70, 62, 71, 63, 216, 214, 0, 0,
2031 0, 0, 0, 0, 84, 72, 0, 73, 212, 88,
2032 91, 0, 0, 228, 0, 0, 68, 0, 74, 75,
2033 77, 76, 78, 81, 79, 82, 80, 83, 85, 86,
2034 87, 84, 84, 207, 1, 213, 89, 90, 84, 217,
2035 92, 93, 94, 95, 84, 277, 215, 277, 0, 0,
2036 236, 229, 230, 218, 264, 265, 220, 139, 140, 141,
2037 144, 143, 142, 145, 146, 0, 0, 0, 0, 266,
2038 267, 147, 219, 149, 207, 207, 96, 206, 0, 99,
2039 99, 278, 274, 69, 247, 248, 249, 273, 231, 232,
2040 235, 0, 167, 150, 0, 0, 0, 0, 156, 168,
2041 0, 0, 167, 0, 0, 0, 98, 97, 0, 204,
2042 205, 0, 0, 100, 101, 102, 103, 104, 0, 250,
2043 0, 318, 276, 0, 233, 166, 116, 162, 164, 0,
2044 0, 0, 0, 0, 0, 155, 0, 0, 148, 0,
2045 0, 161, 0, 160, 0, 227, 139, 140, 141, 144,
2046 143, 142, 0, 0, 67, 67, 105, 0, 244, 245,
2047 246, 317, 301, 0, 0, 0, 0, 99, 286, 287,
2048 2, 3, 4, 5, 6, 7, 8, 9, 10, 14,
2049 15, 16, 11, 12, 13, 0, 0, 0, 0, 0,
2050 0, 0, 0, 17, 18, 19, 20, 21, 22, 23,
2051 24, 25, 26, 27, 28, 0, 0, 0, 0, 0,
2052 0, 0, 0, 0, 0, 275, 99, 290, 0, 316,
2053 234, 159, 0, 124, 67, 67, 158, 0, 169, 0,
2054 124, 67, 67, 0, 208, 187, 188, 183, 185, 184,
2055 186, 189, 182, 178, 179, 0, 0, 0, 0, 0,
Nate Begeman646fa482008-05-12 19:01:56 +00002056 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002057 0, 181, 180, 221, 0, 300, 280, 67, 271, 279,
2058 0, 0, 55, 0, 0, 29, 30, 31, 32, 33,
2059 34, 35, 36, 37, 38, 0, 53, 54, 49, 50,
2060 51, 52, 39, 40, 41, 42, 43, 44, 45, 46,
2061 47, 48, 0, 0, 0, 130, 130, 323, 67, 67,
2062 314, 0, 0, 0, 0, 0, 67, 67, 67, 0,
2063 0, 0, 0, 0, 107, 109, 108, 106, 110, 111,
2064 112, 113, 114, 117, 165, 163, 152, 153, 154, 157,
2065 66, 151, 223, 225, 0, 0, 0, 0, 0, 0,
2066 0, 0, 0, 0, 171, 203, 0, 0, 0, 175,
2067 0, 172, 0, 0, 0, 135, 242, 253, 254, 255,
2068 260, 256, 257, 258, 259, 251, 0, 262, 269, 268,
2069 270, 0, 0, 281, 0, 0, 67, 67, 67, 67,
2070 0, 319, 0, 321, 298, 0, 0, 0, 0, 0,
2071 0, 0, 0, 0, 0, 0, 0, 67, 0, 115,
2072 121, 120, 118, 119, 122, 123, 125, 135, 135, 0,
2073 0, 0, 0, 0, 298, 0, 0, 0, 0, 0,
2074 170, 156, 168, 0, 173, 174, 0, 0, 0, 0,
2075 222, 241, 116, 239, 0, 252, 0, 0, 272, 0,
2076 0, 0, 0, 0, 0, 0, 0, 0, 0, 327,
2077 0, 0, 0, 310, 311, 0, 0, 0, 0, 0,
2078 308, 0, 130, 0, 224, 226, 67, 0, 0, 0,
2079 0, 0, 0, 0, 0, 0, 202, 177, 0, 0,
2080 0, 0, 0, 0, 137, 135, 65, 0, 124, 0,
2081 261, 0, 0, 297, 0, 0, 0, 0, 130, 131,
2082 130, 0, 0, 0, 0, 0, 0, 326, 302, 303,
2083 297, 0, 324, 67, 209, 0, 0, 0, 0, 191,
2084 0, 0, 0, 0, 176, 0, 0, 67, 132, 138,
2085 136, 64, 238, 240, 116, 133, 0, 0, 0, 116,
2086 116, 0, 304, 305, 306, 307, 320, 322, 299, 0,
2087 0, 309, 312, 313, 0, 130, 0, 0, 0, 0,
2088 0, 199, 0, 0, 193, 194, 190, 65, 134, 128,
2089 263, 0, 0, 0, 0, 124, 0, 291, 0, 124,
2090 325, 195, 196, 197, 198, 0, 0, 0, 237, 0,
2091 126, 0, 284, 0, 0, 107, 109, 116, 116, 0,
2092 116, 116, 292, 315, 192, 200, 201, 129, 0, 243,
2093 282, 0, 283, 0, 294, 293, 0, 0, 0, 127,
2094 0, 0, 0, 116, 116, 0, 0, 0, 296, 295,
2095 289, 0, 0, 288, 0, 285
Dan Gohman54392c12008-04-19 00:24:39 +00002096};
2097
2098/* YYDEFGOTO[NTERM-NUM]. */
2099static const yytype_int16 yydefgoto[] =
2100{
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002101 -1, 268, 269, 270, 295, 312, 162, 163, 79, 552,
2102 113, 12, 80, 14, 15, 41, 42, 43, 48, 54,
2103 118, 128, 343, 231, 426, 346, 629, 610, 401, 504,
2104 589, 450, 505, 81, 164, 137, 154, 138, 139, 110,
2105 365, 387, 366, 121, 88, 155, 16, 17, 18, 20,
2106 19, 375, 427, 428, 63, 23, 61, 101, 453, 454,
2107 129, 170, 55, 96, 56, 49, 456, 388, 83, 390,
2108 278, 279, 57, 92, 93, 225, 614, 132, 320, 561,
2109 469, 226, 227, 228, 229
Dan Gohman54392c12008-04-19 00:24:39 +00002110};
2111
2112/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2113 STATE-NUM. */
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002114#define YYPACT_NINF -560
Dan Gohman54392c12008-04-19 00:24:39 +00002115static const yytype_int16 yypact[] =
2116{
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002117 590, -560, -560, -560, -560, -560, -560, -560, 9, -119,
2118 23, -66, 80, -43, -1, -560, 132, 897, -560, 131,
2119 219, 16, 43, -560, 48, 203, -560, 1564, -560, -560,
2120 -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,
2121 -560, -6, -6, 230, -560, -560, -560, -560, -6, -560,
2122 -560, -560, -560, -560, -6, 211, -560, -10, 223, 234,
2123 246, -560, -560, -560, -560, -560, 119, -560, -560, -560,
2124 -560, -560, -560, -560, -560, 289, 296, 2, 227, -560,
2125 -560, -560, 3, -560, 266, 266, 247, -560, 34, 121,
2126 121, -560, -560, 233, -560, -560, -560, -560, -560, -560,
2127 -560, 67, 1400, -560, 146, 151, 830, 119, -560, 3,
2128 -102, 171, 1400, 159, 34, 34, -560, -560, 1441, -560,
2129 -560, 1682, 322, -560, -560, -560, -560, -560, 1723, -560,
2130 -16, 1902, -560, 306, -560, -560, 3, -560, 172, 176,
2131 1741, 1741, 168, -101, 1741, -560, 332, 182, -560, 1682,
2132 1741, 119, 184, 3, 252, -560, 102, 335, 339, 340,
2133 343, 345, 106, 346, 1164, 303, -560, 213, -560, -560,
2134 -560, -560, -560, 302, 1764, 52, 349, 121, -560, -560,
2135 -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,
2136 -560, -560, -560, -560, -560, 591, 440, 591, 440, 1741,
2137 1741, 1741, 1741, -560, -560, -560, -560, -560, -560, -560,
2138 -560, -560, -560, -560, -560, 1741, 1741, 1741, 1741, 1741,
2139 1741, 1741, 1741, 1741, 1741, -560, 121, -560, 36, -560,
2140 -560, 200, 1461, -560, -20, -37, -560, 198, 3, 215,
2141 -560, 303, 4, 1441, -560, -560, -560, -560, -560, -560,
2142 -560, -560, -560, -560, -560, 591, 440, 591, 440, 217,
2143 218, 220, 222, 224, 1482, 1782, 1061, 351, 225, 226,
2144 237, -560, -560, -560, 240, -560, 119, 742, -560, 231,
2145 884, 884, -560, 884, 1723, -560, -560, -560, -560, -560,
2146 -560, -560, -560, -560, -560, 1741, -560, -560, -560, -560,
2147 -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,
2148 -560, -560, 1741, 1741, 1741, -21, 24, -560, 742, -35,
2149 238, 241, 249, 254, 255, 256, 742, 742, 742, 366,
2150 1723, 1741, 1741, 373, -560, -560, -560, -560, -560, -560,
2151 -560, -560, -560, -560, -560, -560, 175, -560, -560, -560,
2152 -560, 175, -560, 159, 371, 260, 261, 262, 263, 1682,
2153 1682, 1682, 1682, 1682, -560, -560, 91, 1105, -96, -560,
2154 -69, -560, 1682, 1682, 1682, 264, 1502, -560, -560, -560,
2155 -560, -560, -560, -560, -560, 359, 1682, -560, -560, -560,
2156 -560, 1741, 265, -560, 267, 884, 742, 742, 742, 742,
2157 21, -560, 40, -560, -560, 884, 272, 1741, 1741, 1741,
2158 1741, 1741, 268, 269, 270, 1741, 884, 742, 276, -560,
2159 -560, -560, -560, -560, -560, -560, -560, 264, 264, 1741,
2160 1682, 1682, 1682, 1682, -560, 277, 280, 281, 282, 1682,
2161 -560, 259, 1015, -62, -560, -560, 287, 290, 408, 19,
2162 -560, -560, 3, 291, 294, -560, 428, -61, -560, 434,
2163 435, 299, 297, 301, 304, 305, 884, 452, 884, 307,
2164 308, 884, 311, 3, -560, 312, 313, 455, 884, 884,
2165 3, 309, 319, 1741, -560, -560, -15, 320, 325, 326,
2166 327, 137, 1682, 1682, 1682, 1682, -560, -560, 321, 1682,
2167 1682, 1741, 438, 482, -560, 264, 386, 1523, -560, 334,
2168 -560, 884, 884, 1805, 884, 884, 884, 884, 319, -560,
2169 319, 1741, 884, 336, 1741, 1741, 1741, -560, -560, -560,
2170 1805, 443, -560, 742, -560, 1682, 1682, 1682, 1682, -560,
2171 337, 347, 344, 348, -560, 354, 355, 15, -560, -560,
2172 -560, -560, -560, -560, 3, -18, 470, 356, 352, 5,
2173 3, 156, -560, -560, -560, -560, -560, -560, -560, 341,
2174 884, -560, -560, -560, 163, 319, 360, 362, 365, 369,
2175 1682, -560, 1682, 1682, -560, -560, -560, 386, -560, 457,
2176 -560, 497, -7, 577, 577, -560, 1846, -560, 372, -560,
2177 -560, -560, -560, -560, -560, 380, 382, 383, -560, 517,
2178 404, 884, -560, 1307, -2, 401, 402, -560, -560, 82,
2179 5, 3, -560, 175, -560, -560, -560, -560, 540, -560,
2180 -560, 406, -560, 1307, 200, 200, 547, 577, 577, -560,
2181 548, 409, 884, -560, -560, 884, 551, 496, 200, 200,
2182 -560, 884, 554, -560, 884, -560
Dan Gohman54392c12008-04-19 00:24:39 +00002183};
2184
2185/* YYPGOTO[NTERM-NUM]. */
2186static const yytype_int16 yypgoto[] =
2187{
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002188 -560, 441, 442, 444, -174, -167, -173, -560, 0, -13,
2189 -141, 483, 13, -560, -560, -560, -560, 30, -560, -560,
2190 -560, -139, -560, -416, -560, -238, -560, -560, -311, 22,
2191 -560, -406, -560, -560, -26, 350, -120, -560, 471, 485,
2192 -64, -157, -251, 100, 194, 363, -560, -560, 571, -560,
2193 -560, -560, -560, -560, -560, -560, -560, -560, -560, -560,
2194 499, -560, -560, -560, -560, -560, -560, -559, -115, 162,
2195 -191, -560, -560, 535, -560, -560, -560, -560, -560, 63,
2196 160, -560, -560, -560, -560
Dan Gohman54392c12008-04-19 00:24:39 +00002197};
2198
2199/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2200 positive, shift that token. If negative, reduce the rule which
2201 number is the opposite. If zero, do what YYDEFACT says.
2202 If YYTABLE_NINF, syntax error. */
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002203#define YYTABLE_NINF -212
Dan Gohman54392c12008-04-19 00:24:39 +00002204static const yytype_int16 yytable[] =
2205{
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002206 11, 82, 351, 283, 282, 403, 105, 271, 167, 282,
2207 317, 91, 168, 13, 368, 370, 502, 11, 111, 94,
2208 111, 484, 485, 313, 273, 321, 322, 323, 324, 325,
2209 13, 314, 466, 329, 111, 111, 506, 24, 284, 244,
2210 111, 29, 30, 31, 32, 33, 34, 35, 36, 272,
2211 37, 468, 109, 502, 631, 144, 144, 165, 111, 111,
2212 -145, 439, 21, 280, 145, 237, 119, 120, 444, 281,
2213 111, 84, 85, 503, 641, 467, 136, 22, 89, 111,
2214 109, 355, 25, 357, 90, 241, 136, 330, 439, 356,
2215 26, 358, 153, 11, 467, 439, 439, 445, 27, 550,
2216 352, 353, 153, 510, 498, -55, -55, -55, -55, 247,
2217 248, 249, 250, 28, 234, 235, 443, 112, 238, 112,
2218 636, 420, 421, 422, 242, 405, 423, 348, 245, 246,
2219 424, 425, 44, 112, 112, 457, 400, -67, 587, 112,
2220 534, 418, 347, 593, 594, 38, 39, 40, 277, 169,
2221 38, 39, 40, 331, 332, 612, 95, 112, 112, -145,
2222 632, -67, 389, -145, 395, 389, 389, 106, 389, 112,
2223 586, 532, 58, 315, 316, 277, 318, 46, 112, 47,
2224 274, 402, -67, 122, 123, 124, 125, 126, 127, 319,
2225 277, 277, 277, 277, 277, 326, 327, 328, 277, 59,
2226 458, 634, 635, 389, 637, 638, 136, 566, 60, 567,
2227 416, 389, 389, 389, 149, 150, 472, 153, 474, 475,
2228 476, 420, 421, 422, 133, 62, 423, 648, 649, 134,
2229 424, 425, 91, 2, 64, 65, 4, 107, 67, 68,
2230 69, 70, 71, 72, 73, 98, 1, 2, 439, 3,
2231 4, 5, 1, 440, 333, 3, 99, 5, 153, 64,
2232 65, 50, 51, 52, 600, 86, 53, 87, 100, 396,
2233 555, 1, 2, 102, 3, 4, 5, 74, 114, 115,
2234 389, 389, 389, 389, 389, 271, 397, 398, 399, 116,
2235 389, 117, 539, 103, 521, 434, 435, 436, 437, 438,
2236 104, 389, 389, 87, 153, 417, 277, 140, 446, 447,
2237 448, 595, 141, 596, 420, 421, 422, 148, 599, 423,
2238 596, 334, 335, 424, 425, 146, 166, 272, 230, 232,
2239 568, 233, 236, 571, 572, 573, 239, 240, 243, 336,
2240 337, 442, 338, 339, -56, 340, 341, 342, -57, -60,
2241 452, 389, -59, 389, -58, 251, 389, 619, 111, 275,
2242 282, 623, 349, 389, 389, 277, 487, 488, 489, 490,
2243 350, 359, 360, 371, 361, 496, 362, 419, 363, 372,
2244 373, 277, 473, 277, 277, 277, 75, 76, 391, 480,
2245 77, 374, 78, 108, 376, 406, 389, 389, 407, 389,
2246 389, 389, 389, 486, 415, 1, 408, 389, 3, 429,
2247 5, 409, 410, 411, 430, 431, 432, 433, 389, 613,
2248 455, 449, 459, 497, 460, 477, 478, 479, 540, 541,
2249 542, 543, 471, 483, 492, 545, 546, 493, 494, 495,
2250 333, 633, 392, 393, 499, 394, 501, 500, 507, 508,
2251 509, 511, 512, 513, 514, 389, 519, 533, 515, 527,
2252 548, 516, 517, 530, 521, 522, 296, 297, 524, 525,
2253 526, 576, 577, 578, 579, 547, 531, 535, 389, 389,
2254 404, 554, 536, 537, 538, 544, 549, 560, 412, 413,
2255 414, 556, 590, 570, 580, 277, 389, 467, 277, 277,
2256 277, 582, 581, 597, 560, 583, 551, 334, 335, 584,
2257 585, 609, 592, 591, 611, 601, 605, 602, 606, 607,
2258 603, 627, 389, 389, 604, 336, 337, 389, 338, 339,
2259 389, 340, 341, 342, 622, 624, 389, 625, 626, 389,
2260 298, 299, 300, 301, 302, 303, 304, 305, 306, 307,
2261 308, 309, 310, 311, 628, -18, -19, 461, 462, 463,
2262 464, 465, 639, 640, 642, 645, 646, 470, 651, 652,
2263 621, 654, 222, 223, 608, 224, 131, 588, 481, 482,
2264 377, 378, 345, 147, 64, 65, 379, 551, 45, 130,
2265 -211, 143, 97, 574, 491, 0, 1, 2, 0, 3,
2266 4, 5, 380, 381, 382, 0, 354, 0, -69, 1,
2267 2, 0, 3, 4, 5, 0, 0, 383, 384, 0,
2268 6, 7, 0, 0, 0, 0, 0, 0, 518, 0,
2269 520, 333, 0, 523, 0, 0, 385, 0, 0, 0,
2270 528, 529, 8, 0, 0, 0, 9, 0, 0, 0,
2271 10, 0, 180, 181, 182, 183, 184, 185, 186, 187,
2272 188, 189, 190, 191, 192, 193, 194, 255, 256, 257,
2273 258, 0, 0, 557, 558, 0, 562, 563, 564, 565,
2274 0, 0, 0, 0, 569, 285, 286, 287, 288, 289,
2275 290, 291, 292, 293, 294, 575, 259, 203, 615, 616,
2276 206, 207, 208, 209, 210, 211, 212, 213, 214, 0,
2277 260, 0, 261, 262, 263, 0, 336, 337, 0, 338,
2278 339, 0, 340, 341, 342, 0, 0, 0, 0, 0,
2279 0, 0, 598, 0, 0, 0, 0, 0, 0, 0,
2280 386, 0, 0, 0, 0, 377, 378, 0, 0, 64,
2281 65, 379, 0, 0, 0, 617, 618, 0, 0, 0,
2282 0, 1, 2, 0, 3, 4, 5, 380, 381, 382,
2283 0, 0, 0, 630, 0, 0, 0, 0, 0, 0,
2284 0, 0, 383, 384, 0, 0, 0, 0, 0, 0,
2285 0, 0, 0, 0, 0, 0, 0, 111, 0, 643,
2286 644, 385, 0, 0, 647, 0, 0, 650, 0, 0,
2287 0, 0, 0, 653, 0, 0, 655, 180, 181, 182,
2288 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
2289 193, 194, 255, 256, 257, 258, 0, 64, 65, 0,
2290 107, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2291 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2292 0, 259, 203, 204, 205, 206, 207, 208, 209, 210,
2293 211, 212, 213, 214, 0, 260, 0, 261, 262, 263,
2294 74, 0, 0, 0, 0, 0, 0, 377, 378, 0,
2295 0, 64, 65, 379, 0, 0, 112, -210, 0, 0,
2296 0, 0, 0, 1, 2, 386, 3, 4, 5, 380,
2297 381, 382, 0, 0, 0, -69, 1, 2, 0, 3,
2298 4, 5, 0, 0, 383, 384, 0, 6, 7, 0,
2299 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2300 0, 0, 0, 385, 0, 0, 0, 0, 0, 8,
2301 0, 0, 0, 9, 0, 0, 0, 10, 0, 180,
Nate Begeman646fa482008-05-12 19:01:56 +00002302 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002303 191, 192, 193, 194, 255, 256, 257, 258, 0, 0,
2304 0, 0, 0, 0, 0, 0, 0, 0, 0, 75,
2305 76, 0, 0, 77, 0, 78, 142, 0, 0, 0,
2306 0, 0, 0, 259, 203, 204, 205, 206, 207, 208,
2307 209, 210, 211, 212, 213, 214, 0, 260, 0, 261,
2308 262, 263, 64, 65, 0, 0, 0, 0, 0, 0,
2309 0, 0, 0, 0, 1, 2, 0, 3, 4, 5,
2310 252, 0, 0, 0, 0, 0, 0, 386, 0, 0,
2311 0, 0, 0, 0, 0, 253, 254, 0, 0, 0,
2312 0, 0, 0, 0, 0, 0, 0, 0, 64, 65,
2313 111, 107, 156, 157, 158, 159, 160, 161, 73, 0,
2314 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
Chris Lattnere7e9b602008-05-04 17:18:47 +00002315 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002316 190, 191, 192, 193, 194, 255, 256, 257, 258, 0,
2317 0, 74, 64, 65, 0, 107, 156, 157, 158, 159,
2318 160, 161, 73, 0, 1, 2, 0, 3, 4, 5,
2319 0, 0, 0, 0, 259, 203, 204, 205, 206, 207,
2320 208, 209, 210, 211, 212, 213, 214, 0, 260, 0,
2321 261, 262, 263, 0, 0, 74, 0, 0, 0, 0,
2322 0, 0, 0, 0, 0, 0, 0, 0, 0, 112,
2323 0, 64, 65, -67, 0, 264, 0, 0, 265, 0,
2324 266, 0, 267, 1, 2, 0, 3, 4, 5, 252,
Nate Begeman646fa482008-05-12 19:01:56 +00002325 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002326 0, 0, 0, 0, 253, 254, 0, 0, 0, 0,
2327 0, 0, 0, 0, 0, 0, 0, 0, 0, 111,
2328 75, 76, 0, 0, 77, 0, 78, 369, 0, 0,
2329 0, 0, 0, 0, 0, 0, 0, 0, 0, 180,
2330 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
2331 191, 192, 193, 194, 255, 256, 257, 258, 0, 0,
2332 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2333 78, 441, 0, 0, 0, 0, 0, 0, 0, 0,
2334 0, 0, 0, 259, 203, 204, 205, 206, 207, 208,
2335 209, 210, 211, 212, 213, 214, 0, 260, 0, 261,
2336 262, 263, 0, 0, 0, 0, 0, 0, 0, 0,
2337 377, 378, 0, 0, 0, 0, 379, 0, 112, 0,
2338 0, 0, 0, 0, 264, 0, 0, 265, 0, 266,
2339 0, 267, 380, 381, 382, 0, 0, 0, 0, 0,
2340 0, 0, 0, 0, 0, 0, 0, 383, 384, 0,
Nate Begeman646fa482008-05-12 19:01:56 +00002341 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002342 0, 0, 0, 0, 0, 0, 385, 0, 0, 0,
Nate Begeman646fa482008-05-12 19:01:56 +00002343 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002344 0, 0, 180, 181, 182, 183, 184, 185, 186, 187,
2345 188, 189, 190, 191, 192, 193, 194, 255, 256, 257,
2346 258, 0, 0, 0, 0, 0, 0, 64, 65, 0,
2347 107, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2348 2, 0, 3, 4, 5, 0, 259, 203, 204, 205,
2349 206, 207, 208, 209, 210, 211, 212, 213, 214, 135,
2350 260, 0, 261, 262, 263, 0, 0, 0, 64, 65,
2351 74, 151, 67, 68, 69, 70, 71, 72, 73, 0,
2352 1, 2, 0, 3, 4, 5, 0, 0, 64, 65,
2353 386, 107, 67, 68, 69, 70, 71, 72, 73, 0,
2354 1, 2, 0, 3, 4, 5, 0, 0, 0, 64,
2355 65, 74, 107, 156, 157, 158, 159, 160, 161, 73,
2356 344, 1, 2, 0, 3, 4, 5, 0, 0, 64,
2357 65, 74, 107, 67, 68, 69, 70, 71, 72, 73,
2358 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2359 64, 65, 74, 107, 67, 68, 69, 70, 71, 72,
2360 73, 451, 1, 2, 0, 3, 4, 5, 0, 0,
2361 0, 0, 74, 0, 0, 0, 0, 0, 0, 75,
2362 76, 0, 553, 77, 0, 78, 152, 0, 0, 0,
2363 0, 64, 65, 74, 66, 67, 68, 69, 70, 71,
2364 72, 73, 0, 1, 2, 0, 3, 4, 5, 0,
Nate Begeman646fa482008-05-12 19:01:56 +00002365 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002366 75, 76, 0, 0, 77, 0, 78, 0, 0, 0,
2367 0, 0, 0, 0, 74, 0, 0, 0, 0, 0,
2368 75, 76, 0, 0, 77, 0, 78, 0, 0, 0,
Chris Lattnere7e9b602008-05-04 17:18:47 +00002369 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002370 0, 75, 76, 0, 364, 77, 0, 78, 0, 0,
2371 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2372 0, 75, 76, 0, 0, 77, 0, 78, 0, 0,
2373 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2374 0, 0, 75, 76, 0, 0, 77, 0, 78, 64,
2375 65, 0, 107, 156, 157, 158, 159, 160, 161, 73,
Chris Lattnere7e9b602008-05-04 17:18:47 +00002376 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2377 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002378 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
2379 64, 65, 74, 151, 67, 68, 69, 70, 71, 72,
2380 73, 0, 1, 2, 0, 3, 4, 5, 64, 65,
2381 0, 107, 67, 68, 69, 70, 71, 72, 73, 0,
2382 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2383 0, 64, 65, 74, 276, 67, 68, 69, 70, 71,
2384 72, 73, 0, 1, 2, 0, 3, 4, 5, 64,
2385 65, 74, 107, 156, 157, 158, 159, 160, 161, 73,
2386 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2387 0, 0, 64, 65, 74, 107, 67, 68, 69, 70,
2388 71, 72, 559, 0, 1, 2, 0, 3, 4, 5,
2389 0, 0, 74, 0, 0, 0, 0, 0, 0, 0,
2390 0, 75, 76, 0, 0, 77, 0, 78, 0, 0,
2391 0, 0, 0, 64, 65, 74, 107, 67, 68, 69,
2392 70, 71, 72, 620, 0, 1, 2, 0, 3, 4,
2393 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2394 0, 0, 75, 76, 0, 0, 77, 0, 78, 0,
2395 0, 0, 0, 0, 0, 0, 74, 0, 0, 0,
2396 75, 76, 0, 0, 77, 0, 78, 0, 0, 0,
Chris Lattnere7e9b602008-05-04 17:18:47 +00002397 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002398 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
2399 0, 0, 0, 0, 0, 0, 0, 0, 171, 0,
2400 0, 75, 76, 0, 0, 77, 0, 367, 0, 0,
2401 0, 0, 0, 0, 0, 0, 0, 0, 0, 172,
2402 173, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2403 78, 174, 175, 176, 177, 178, 179, 180, 181, 182,
2404 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
2405 193, 194, 195, 196, 197, 198, 0, 0, 0, 0,
2406 0, 0, 0, 0, 0, 75, 76, 0, 0, 77,
2407 0, 78, 0, 0, 0, 0, 199, 200, 201, 0,
2408 0, 202, 203, 204, 205, 206, 207, 208, 209, 210,
2409 211, 212, 213, 214, 215, 216, 217, 218, 219, 220,
2410 221
Dan Gohman54392c12008-04-19 00:24:39 +00002411};
2412
2413static const yytype_int16 yycheck[] =
2414{
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002415 0, 27, 240, 176, 11, 316, 4, 164, 128, 11,
2416 201, 21, 28, 0, 265, 266, 34, 17, 55, 29,
2417 55, 427, 428, 197, 165, 216, 217, 218, 219, 220,
2418 17, 198, 11, 224, 55, 55, 452, 156, 177, 154,
2419 55, 42, 43, 44, 45, 46, 47, 48, 49, 164,
2420 51, 11, 78, 34, 613, 157, 157, 121, 55, 55,
2421 55, 157, 53, 11, 166, 166, 32, 33, 164, 17,
2422 55, 41, 42, 54, 633, 54, 102, 68, 48, 55,
2423 106, 255, 59, 257, 54, 149, 112, 226, 157, 256,
2424 156, 258, 118, 93, 54, 157, 157, 166, 18, 505,
2425 241, 242, 128, 164, 166, 3, 4, 5, 6, 3,
2426 4, 5, 6, 156, 140, 141, 367, 154, 144, 154,
2427 38, 139, 140, 141, 150, 160, 144, 164, 26, 27,
2428 148, 149, 0, 154, 154, 386, 157, 158, 554, 154,
2429 155, 332, 162, 559, 560, 151, 152, 153, 174, 165,
2430 151, 152, 153, 117, 118, 162, 166, 154, 154, 154,
2431 162, 158, 277, 158, 284, 280, 281, 165, 283, 154,
2432 155, 482, 156, 199, 200, 201, 202, 46, 154, 48,
2433 167, 157, 158, 62, 63, 64, 65, 66, 67, 215,
2434 216, 217, 218, 219, 220, 221, 222, 223, 224, 156,
2435 391, 617, 618, 318, 620, 621, 232, 518, 160, 520,
2436 330, 326, 327, 328, 114, 115, 407, 243, 409, 410,
2437 411, 139, 140, 141, 157, 22, 144, 643, 644, 162,
2438 148, 149, 21, 20, 7, 8, 23, 10, 11, 12,
2439 13, 14, 15, 16, 17, 22, 19, 20, 157, 22,
2440 23, 24, 19, 162, 54, 22, 22, 24, 284, 7,
2441 8, 42, 43, 44, 575, 35, 47, 37, 22, 295,
2442 508, 19, 20, 154, 22, 23, 24, 50, 84, 85,
2443 395, 396, 397, 398, 399, 442, 312, 313, 314, 42,
2444 405, 44, 155, 4, 157, 359, 360, 361, 362, 363,
2445 4, 416, 417, 37, 330, 331, 332, 161, 372, 373,
2446 374, 155, 161, 157, 139, 140, 141, 158, 155, 144,
2447 157, 121, 122, 148, 149, 154, 4, 442, 22, 157,
2448 521, 155, 164, 524, 525, 526, 4, 155, 154, 139,
2449 140, 367, 142, 143, 9, 145, 146, 147, 9, 9,
2450 376, 466, 9, 468, 9, 9, 471, 595, 55, 57,
2451 11, 599, 164, 478, 479, 391, 430, 431, 432, 433,
2452 155, 154, 154, 22, 154, 439, 154, 4, 154, 154,
2453 154, 407, 408, 409, 410, 411, 159, 160, 157, 415,
2454 163, 154, 165, 166, 154, 157, 511, 512, 157, 514,
2455 515, 516, 517, 429, 38, 19, 157, 522, 22, 38,
2456 24, 157, 157, 157, 154, 154, 154, 154, 533, 592,
2457 61, 157, 157, 164, 157, 157, 157, 157, 492, 493,
2458 494, 495, 160, 157, 157, 499, 500, 157, 157, 157,
2459 54, 614, 280, 281, 157, 283, 38, 157, 157, 155,
2460 22, 17, 17, 154, 157, 570, 4, 483, 157, 4,
2461 22, 157, 157, 154, 157, 157, 26, 27, 157, 157,
2462 157, 535, 536, 537, 538, 501, 157, 157, 593, 594,
2463 318, 507, 157, 157, 157, 164, 4, 513, 326, 327,
2464 328, 157, 22, 157, 157, 521, 611, 54, 524, 525,
2465 526, 157, 155, 162, 530, 157, 506, 121, 122, 155,
2466 155, 54, 160, 157, 17, 155, 580, 155, 582, 583,
2467 155, 4, 637, 638, 155, 139, 140, 642, 142, 143,
2468 645, 145, 146, 147, 162, 155, 651, 155, 155, 654,
2469 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
2470 110, 111, 112, 113, 150, 154, 154, 395, 396, 397,
2471 398, 399, 22, 157, 17, 17, 157, 405, 17, 73,
2472 596, 17, 131, 131, 587, 131, 93, 555, 416, 417,
2473 3, 4, 232, 112, 7, 8, 9, 587, 17, 90,
2474 0, 106, 57, 530, 434, -1, 19, 20, -1, 22,
2475 23, 24, 25, 26, 27, -1, 243, -1, 18, 19,
2476 20, -1, 22, 23, 24, -1, -1, 40, 41, -1,
2477 30, 31, -1, -1, -1, -1, -1, -1, 466, -1,
2478 468, 54, -1, 471, -1, -1, 59, -1, -1, -1,
2479 478, 479, 52, -1, -1, -1, 56, -1, -1, -1,
2480 60, -1, 75, 76, 77, 78, 79, 80, 81, 82,
2481 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
2482 93, -1, -1, 511, 512, -1, 514, 515, 516, 517,
2483 -1, -1, -1, -1, 522, 94, 95, 96, 97, 98,
2484 99, 100, 101, 102, 103, 533, 119, 120, 121, 122,
2485 123, 124, 125, 126, 127, 128, 129, 130, 131, -1,
2486 133, -1, 135, 136, 137, -1, 139, 140, -1, 142,
2487 143, -1, 145, 146, 147, -1, -1, -1, -1, -1,
2488 -1, -1, 570, -1, -1, -1, -1, -1, -1, -1,
2489 163, -1, -1, -1, -1, 3, 4, -1, -1, 7,
2490 8, 9, -1, -1, -1, 593, 594, -1, -1, -1,
2491 -1, 19, 20, -1, 22, 23, 24, 25, 26, 27,
2492 -1, -1, -1, 611, -1, -1, -1, -1, -1, -1,
2493 -1, -1, 40, 41, -1, -1, -1, -1, -1, -1,
2494 -1, -1, -1, -1, -1, -1, -1, 55, -1, 637,
2495 638, 59, -1, -1, 642, -1, -1, 645, -1, -1,
2496 -1, -1, -1, 651, -1, -1, 654, 75, 76, 77,
2497 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2498 88, 89, 90, 91, 92, 93, -1, 7, 8, -1,
2499 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2500 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2501 -1, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2502 128, 129, 130, 131, -1, 133, -1, 135, 136, 137,
2503 50, -1, -1, -1, -1, -1, -1, 3, 4, -1,
2504 -1, 7, 8, 9, -1, -1, 154, 0, -1, -1,
2505 -1, -1, -1, 19, 20, 163, 22, 23, 24, 25,
2506 26, 27, -1, -1, -1, 18, 19, 20, -1, 22,
2507 23, 24, -1, -1, 40, 41, -1, 30, 31, -1,
2508 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2509 -1, -1, -1, 59, -1, -1, -1, -1, -1, 52,
2510 -1, -1, -1, 56, -1, -1, -1, 60, -1, 75,
Nate Begeman646fa482008-05-12 19:01:56 +00002511 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002512 86, 87, 88, 89, 90, 91, 92, 93, -1, -1,
2513 -1, -1, -1, -1, -1, -1, -1, -1, -1, 159,
2514 160, -1, -1, 163, -1, 165, 166, -1, -1, -1,
2515 -1, -1, -1, 119, 120, 121, 122, 123, 124, 125,
2516 126, 127, 128, 129, 130, 131, -1, 133, -1, 135,
2517 136, 137, 7, 8, -1, -1, -1, -1, -1, -1,
2518 -1, -1, -1, -1, 19, 20, -1, 22, 23, 24,
2519 25, -1, -1, -1, -1, -1, -1, 163, -1, -1,
Chris Lattnere7e9b602008-05-04 17:18:47 +00002520 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002521 -1, -1, -1, -1, -1, -1, -1, -1, 7, 8,
2522 55, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2523 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
Chris Lattnere7e9b602008-05-04 17:18:47 +00002524 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002525 85, 86, 87, 88, 89, 90, 91, 92, 93, -1,
2526 -1, 50, 7, 8, -1, 10, 11, 12, 13, 14,
2527 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2528 -1, -1, -1, -1, 119, 120, 121, 122, 123, 124,
2529 125, 126, 127, 128, 129, 130, 131, -1, 133, -1,
2530 135, 136, 137, -1, -1, 50, -1, -1, -1, -1,
2531 -1, -1, -1, -1, -1, -1, -1, -1, -1, 154,
2532 -1, 7, 8, 158, -1, 160, -1, -1, 163, -1,
2533 165, -1, 167, 19, 20, -1, 22, 23, 24, 25,
Nate Begeman646fa482008-05-12 19:01:56 +00002534 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002535 -1, -1, -1, -1, 40, 41, -1, -1, -1, -1,
2536 -1, -1, -1, -1, -1, -1, -1, -1, -1, 55,
2537 159, 160, -1, -1, 163, -1, 165, 166, -1, -1,
2538 -1, -1, -1, -1, -1, -1, -1, -1, -1, 75,
2539 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2540 86, 87, 88, 89, 90, 91, 92, 93, -1, -1,
2541 -1, -1, -1, -1, 159, 160, -1, -1, 163, -1,
2542 165, 166, -1, -1, -1, -1, -1, -1, -1, -1,
2543 -1, -1, -1, 119, 120, 121, 122, 123, 124, 125,
2544 126, 127, 128, 129, 130, 131, -1, 133, -1, 135,
2545 136, 137, -1, -1, -1, -1, -1, -1, -1, -1,
2546 3, 4, -1, -1, -1, -1, 9, -1, 154, -1,
2547 -1, -1, -1, -1, 160, -1, -1, 163, -1, 165,
2548 -1, 167, 25, 26, 27, -1, -1, -1, -1, -1,
2549 -1, -1, -1, -1, -1, -1, -1, 40, 41, -1,
Nate Begeman646fa482008-05-12 19:01:56 +00002550 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002551 -1, -1, -1, -1, -1, -1, 59, -1, -1, -1,
Chris Lattnere7e9b602008-05-04 17:18:47 +00002552 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002553 -1, -1, 75, 76, 77, 78, 79, 80, 81, 82,
2554 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
2555 93, -1, -1, -1, -1, -1, -1, 7, 8, -1,
Nate Begeman646fa482008-05-12 19:01:56 +00002556 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002557 20, -1, 22, 23, 24, -1, 119, 120, 121, 122,
2558 123, 124, 125, 126, 127, 128, 129, 130, 131, 39,
2559 133, -1, 135, 136, 137, -1, -1, -1, 7, 8,
2560 50, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2561 19, 20, -1, 22, 23, 24, -1, -1, 7, 8,
2562 163, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2563 19, 20, -1, 22, 23, 24, -1, -1, -1, 7,
2564 8, 50, 10, 11, 12, 13, 14, 15, 16, 17,
2565 39, 19, 20, -1, 22, 23, 24, -1, -1, 7,
2566 8, 50, 10, 11, 12, 13, 14, 15, 16, 17,
2567 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2568 7, 8, 50, 10, 11, 12, 13, 14, 15, 16,
2569 17, 39, 19, 20, -1, 22, 23, 24, -1, -1,
2570 -1, -1, 50, -1, -1, -1, -1, -1, -1, 159,
2571 160, -1, 39, 163, -1, 165, 125, -1, -1, -1,
2572 -1, 7, 8, 50, 10, 11, 12, 13, 14, 15,
Chris Lattnere7e9b602008-05-04 17:18:47 +00002573 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2574 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002575 159, 160, -1, -1, 163, -1, 165, -1, -1, -1,
2576 -1, -1, -1, -1, 50, -1, -1, -1, -1, -1,
2577 159, 160, -1, -1, 163, -1, 165, -1, -1, -1,
2578 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2579 -1, 159, 160, -1, 162, 163, -1, 165, -1, -1,
2580 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2581 -1, 159, 160, -1, -1, 163, -1, 165, -1, -1,
2582 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2583 -1, -1, 159, 160, -1, -1, 163, -1, 165, 7,
Chris Lattnere7e9b602008-05-04 17:18:47 +00002584 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2585 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2586 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002587 -1, -1, -1, 159, 160, -1, -1, 163, -1, 165,
2588 7, 8, 50, 10, 11, 12, 13, 14, 15, 16,
Nate Begeman646fa482008-05-12 19:01:56 +00002589 17, -1, 19, 20, -1, 22, 23, 24, 7, 8,
2590 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002591 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
2592 -1, 7, 8, 50, 10, 11, 12, 13, 14, 15,
2593 16, 17, -1, 19, 20, -1, 22, 23, 24, 7,
2594 8, 50, 10, 11, 12, 13, 14, 15, 16, 17,
2595 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2596 -1, -1, 7, 8, 50, 10, 11, 12, 13, 14,
2597 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2598 -1, -1, 50, -1, -1, -1, -1, -1, -1, -1,
2599 -1, 159, 160, -1, -1, 163, -1, 165, -1, -1,
2600 -1, -1, -1, 7, 8, 50, 10, 11, 12, 13,
2601 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2602 24, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2603 -1, -1, 159, 160, -1, -1, 163, -1, 165, -1,
2604 -1, -1, -1, -1, -1, -1, 50, -1, -1, -1,
2605 159, 160, -1, -1, 163, -1, 165, -1, -1, -1,
Chris Lattnere7e9b602008-05-04 17:18:47 +00002606 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002607 -1, -1, -1, 159, 160, -1, -1, 163, -1, 165,
2608 -1, -1, -1, -1, -1, -1, -1, -1, 36, -1,
2609 -1, 159, 160, -1, -1, 163, -1, 165, -1, -1,
2610 -1, -1, -1, -1, -1, -1, -1, -1, -1, 57,
2611 58, -1, -1, -1, 159, 160, -1, -1, 163, -1,
2612 165, 69, 70, 71, 72, 73, 74, 75, 76, 77,
2613 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2614 88, 89, 90, 91, 92, 93, -1, -1, -1, -1,
2615 -1, -1, -1, -1, -1, 159, 160, -1, -1, 163,
2616 -1, 165, -1, -1, -1, -1, 114, 115, 116, -1,
2617 -1, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2618 128, 129, 130, 131, 132, 133, 134, 135, 136, 137,
2619 138
Dan Gohman54392c12008-04-19 00:24:39 +00002620};
2621
2622/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2623 symbol of state STATE-NUM. */
2624static const yytype_uint8 yystos[] =
2625{
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002626 0, 19, 20, 22, 23, 24, 30, 31, 52, 56,
2627 60, 176, 179, 180, 181, 182, 214, 215, 216, 218,
2628 217, 53, 68, 223, 156, 59, 156, 18, 156, 42,
2629 43, 44, 45, 46, 47, 48, 49, 51, 151, 152,
2630 153, 183, 184, 185, 0, 216, 46, 48, 186, 233,
2631 42, 43, 44, 47, 187, 230, 232, 240, 156, 156,
2632 160, 224, 22, 222, 7, 8, 10, 11, 12, 13,
2633 14, 15, 16, 17, 50, 159, 160, 163, 165, 176,
2634 180, 201, 202, 236, 185, 185, 35, 37, 212, 185,
2635 185, 21, 241, 242, 29, 166, 231, 241, 22, 22,
2636 22, 225, 154, 4, 4, 4, 165, 10, 166, 202,
2637 207, 55, 154, 178, 212, 212, 42, 44, 188, 32,
2638 33, 211, 62, 63, 64, 65, 66, 67, 189, 228,
2639 228, 179, 245, 157, 162, 39, 202, 203, 205, 206,
2640 161, 161, 166, 207, 157, 166, 154, 206, 158, 211,
2641 211, 10, 125, 202, 204, 213, 11, 12, 13, 14,
2642 15, 16, 174, 175, 202, 208, 4, 204, 28, 165,
2643 229, 36, 57, 58, 69, 70, 71, 72, 73, 74,
Chris Lattnere7e9b602008-05-04 17:18:47 +00002644 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002645 85, 86, 87, 88, 89, 90, 91, 92, 93, 114,
2646 115, 116, 119, 120, 121, 122, 123, 124, 125, 126,
Nate Begeman646fa482008-05-12 19:01:56 +00002647 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002648 137, 138, 169, 170, 171, 243, 249, 250, 251, 252,
2649 22, 191, 157, 155, 202, 202, 164, 166, 202, 4,
2650 155, 208, 202, 154, 236, 26, 27, 3, 4, 5,
2651 6, 9, 25, 40, 41, 90, 91, 92, 93, 119,
2652 133, 135, 136, 137, 160, 163, 165, 167, 169, 170,
2653 171, 209, 236, 178, 180, 57, 10, 202, 238, 239,
2654 11, 17, 11, 174, 189, 94, 95, 96, 97, 98,
2655 99, 100, 101, 102, 103, 172, 26, 27, 100, 101,
Nate Begeman646fa482008-05-12 19:01:56 +00002656 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
Dale Johannesen280e7bc2008-05-14 20:13:36 +00002657 112, 113, 173, 172, 173, 202, 202, 238, 202, 202,
2658 246, 238, 238, 238, 238, 238, 202, 202, 202, 238,
2659 189, 117, 118, 54, 121, 122, 139, 140, 142, 143,
2660 145, 146, 147, 190, 39, 203, 193, 162, 164, 164,
2661 155, 193, 178, 178, 213, 172, 173, 172, 173, 154,
2662 154, 154, 154, 154, 162, 208, 210, 165, 210, 166,
2663 210, 22, 154, 154, 154, 219, 154, 3, 4, 9,
2664 25, 26, 27, 40, 41, 59, 163, 209, 235, 236,
2665 237, 157, 237, 237, 237, 204, 202, 202, 202, 202,
2666 157, 196, 157, 196, 237, 160, 157, 157, 157, 157,
2667 157, 157, 237, 237, 237, 38, 204, 202, 238, 4,
2668 139, 140, 141, 144, 148, 149, 192, 220, 221, 38,
2669 154, 154, 154, 154, 208, 208, 208, 208, 208, 157,
2670 162, 166, 202, 210, 164, 166, 208, 208, 208, 157,
2671 199, 39, 202, 226, 227, 61, 234, 210, 238, 157,
2672 157, 237, 237, 237, 237, 237, 11, 54, 11, 248,
2673 237, 160, 238, 202, 238, 238, 238, 157, 157, 157,
2674 202, 237, 237, 157, 199, 199, 202, 208, 208, 208,
2675 208, 248, 157, 157, 157, 157, 208, 164, 166, 157,
2676 157, 38, 34, 54, 197, 200, 191, 157, 155, 22,
2677 164, 17, 17, 154, 157, 157, 157, 157, 237, 4,
2678 237, 157, 157, 237, 157, 157, 157, 4, 237, 237,
2679 154, 157, 196, 202, 155, 157, 157, 157, 157, 155,
2680 208, 208, 208, 208, 164, 208, 208, 202, 22, 4,
2681 199, 176, 177, 39, 202, 193, 157, 237, 237, 17,
2682 202, 247, 237, 237, 237, 237, 196, 196, 238, 237,
2683 157, 238, 238, 238, 247, 237, 208, 208, 208, 208,
2684 157, 155, 157, 157, 155, 155, 155, 191, 197, 198,
2685 22, 157, 160, 191, 191, 155, 157, 162, 237, 155,
2686 196, 155, 155, 155, 155, 208, 208, 208, 177, 54,
2687 195, 17, 162, 174, 244, 121, 122, 237, 237, 193,
2688 17, 202, 162, 193, 155, 155, 155, 4, 150, 194,
2689 237, 235, 162, 174, 191, 191, 38, 191, 191, 22,
2690 157, 235, 17, 237, 237, 17, 157, 237, 191, 191,
2691 237, 17, 73, 237, 17, 237
Dan Gohman54392c12008-04-19 00:24:39 +00002692};
David Greene9145dd22007-08-01 03:59:32 +00002693
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002694#define yyerrok (yyerrstatus = 0)
2695#define yyclearin (yychar = YYEMPTY)
Dan Gohman54392c12008-04-19 00:24:39 +00002696#define YYEMPTY (-2)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002697#define YYEOF 0
Dan Gohman54392c12008-04-19 00:24:39 +00002698
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002699#define YYACCEPT goto yyacceptlab
Dan Gohman54392c12008-04-19 00:24:39 +00002700#define YYABORT goto yyabortlab
2701#define YYERROR goto yyerrorlab
2702
2703
2704/* Like YYERROR except do call yyerror. This remains here temporarily
2705 to ease the transition to the new meaning of YYERROR, for GCC.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002706 Once GCC version 2 has supplanted version 1, this can go. */
Dan Gohman54392c12008-04-19 00:24:39 +00002707
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002708#define YYFAIL goto yyerrlab
Dan Gohman54392c12008-04-19 00:24:39 +00002709
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002710#define YYRECOVERING() (!!yyerrstatus)
Dan Gohman54392c12008-04-19 00:24:39 +00002711
2712#define YYBACKUP(Token, Value) \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002713do \
2714 if (yychar == YYEMPTY && yylen == 1) \
Dan Gohman54392c12008-04-19 00:24:39 +00002715 { \
2716 yychar = (Token); \
2717 yylval = (Value); \
2718 yytoken = YYTRANSLATE (yychar); \
2719 YYPOPSTACK (1); \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002720 goto yybackup; \
2721 } \
2722 else \
Dan Gohman54392c12008-04-19 00:24:39 +00002723 { \
2724 yyerror (YY_("syntax error: cannot back up")); \
2725 YYERROR; \
2726 } \
2727while (YYID (0))
2728
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002729
2730#define YYTERROR 1
2731#define YYERRCODE 256
2732
Dan Gohman54392c12008-04-19 00:24:39 +00002733
2734/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2735 If N is 0, then set CURRENT to the empty location which ends
2736 the previous symbol: RHS[0] (always defined). */
2737
2738#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2739#ifndef YYLLOC_DEFAULT
2740# define YYLLOC_DEFAULT(Current, Rhs, N) \
2741 do \
2742 if (YYID (N)) \
2743 { \
2744 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2745 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2746 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2747 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2748 } \
2749 else \
2750 { \
2751 (Current).first_line = (Current).last_line = \
2752 YYRHSLOC (Rhs, 0).last_line; \
2753 (Current).first_column = (Current).last_column = \
2754 YYRHSLOC (Rhs, 0).last_column; \
2755 } \
2756 while (YYID (0))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002757#endif
2758
Dan Gohman54392c12008-04-19 00:24:39 +00002759
2760/* YY_LOCATION_PRINT -- Print the location on the stream.
2761 This macro was not mandated originally: define only if we know
2762 we won't break user code: when these are the locations we know. */
2763
2764#ifndef YY_LOCATION_PRINT
2765# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2766# define YY_LOCATION_PRINT(File, Loc) \
2767 fprintf (File, "%d.%d-%d.%d", \
2768 (Loc).first_line, (Loc).first_column, \
2769 (Loc).last_line, (Loc).last_column)
2770# else
2771# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2772# endif
2773#endif
2774
2775
2776/* YYLEX -- calling `yylex' with the right arguments. */
2777
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002778#ifdef YYLEX_PARAM
Dan Gohman54392c12008-04-19 00:24:39 +00002779# define YYLEX yylex (YYLEX_PARAM)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002780#else
Dan Gohman54392c12008-04-19 00:24:39 +00002781# define YYLEX yylex ()
Gabor Greif89f01162008-04-06 23:07:54 +00002782#endif
Dan Gohman54392c12008-04-19 00:24:39 +00002783
2784/* Enable debugging if requested. */
2785#if YYDEBUG
2786
2787# ifndef YYFPRINTF
2788# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2789# define YYFPRINTF fprintf
2790# endif
2791
2792# define YYDPRINTF(Args) \
2793do { \
2794 if (yydebug) \
2795 YYFPRINTF Args; \
2796} while (YYID (0))
2797
2798# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2799do { \
2800 if (yydebug) \
2801 { \
2802 YYFPRINTF (stderr, "%s ", Title); \
2803 yy_symbol_print (stderr, \
2804 Type, Value); \
2805 YYFPRINTF (stderr, "\n"); \
2806 } \
2807} while (YYID (0))
2808
2809
2810/*--------------------------------.
2811| Print this symbol on YYOUTPUT. |
2812`--------------------------------*/
2813
2814/*ARGSUSED*/
2815#if (defined __STDC__ || defined __C99__FUNC__ \
2816 || defined __cplusplus || defined _MSC_VER)
2817static void
2818yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
Gabor Greif89f01162008-04-06 23:07:54 +00002819#else
Dan Gohman54392c12008-04-19 00:24:39 +00002820static void
2821yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2822 FILE *yyoutput;
2823 int yytype;
2824 YYSTYPE const * const yyvaluep;
Gabor Greif89f01162008-04-06 23:07:54 +00002825#endif
Dan Gohman54392c12008-04-19 00:24:39 +00002826{
2827 if (!yyvaluep)
2828 return;
2829# ifdef YYPRINT
2830 if (yytype < YYNTOKENS)
2831 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2832# else
2833 YYUSE (yyoutput);
2834# endif
2835 switch (yytype)
2836 {
2837 default:
2838 break;
2839 }
2840}
2841
2842
2843/*--------------------------------.
2844| Print this symbol on YYOUTPUT. |
2845`--------------------------------*/
2846
2847#if (defined __STDC__ || defined __C99__FUNC__ \
2848 || defined __cplusplus || defined _MSC_VER)
2849static void
2850yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2851#else
2852static void
2853yy_symbol_print (yyoutput, yytype, yyvaluep)
2854 FILE *yyoutput;
2855 int yytype;
2856 YYSTYPE const * const yyvaluep;
Scott Michel6d1aba82008-01-30 03:10:00 +00002857#endif
Dan Gohman54392c12008-04-19 00:24:39 +00002858{
2859 if (yytype < YYNTOKENS)
2860 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2861 else
2862 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
Chris Lattner59363a32008-02-19 04:36:25 +00002863
Dan Gohman54392c12008-04-19 00:24:39 +00002864 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2865 YYFPRINTF (yyoutput, ")");
2866}
Chris Lattner59363a32008-02-19 04:36:25 +00002867
Dan Gohman54392c12008-04-19 00:24:39 +00002868/*------------------------------------------------------------------.
2869| yy_stack_print -- Print the state stack from its BOTTOM up to its |
2870| TOP (included). |
2871`------------------------------------------------------------------*/
Chris Lattner59363a32008-02-19 04:36:25 +00002872
Dan Gohman54392c12008-04-19 00:24:39 +00002873#if (defined __STDC__ || defined __C99__FUNC__ \
2874 || defined __cplusplus || defined _MSC_VER)
2875static void
2876yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
2877#else
2878static void
2879yy_stack_print (bottom, top)
2880 yytype_int16 *bottom;
2881 yytype_int16 *top;
Scott Michel6d1aba82008-01-30 03:10:00 +00002882#endif
Dan Gohman54392c12008-04-19 00:24:39 +00002883{
2884 YYFPRINTF (stderr, "Stack now");
2885 for (; bottom <= top; ++bottom)
2886 YYFPRINTF (stderr, " %d", *bottom);
2887 YYFPRINTF (stderr, "\n");
2888}
Chris Lattner59363a32008-02-19 04:36:25 +00002889
Dan Gohman54392c12008-04-19 00:24:39 +00002890# define YY_STACK_PRINT(Bottom, Top) \
2891do { \
2892 if (yydebug) \
2893 yy_stack_print ((Bottom), (Top)); \
2894} while (YYID (0))
Chris Lattner59363a32008-02-19 04:36:25 +00002895
Dan Gohman54392c12008-04-19 00:24:39 +00002896
2897/*------------------------------------------------.
2898| Report that the YYRULE is going to be reduced. |
2899`------------------------------------------------*/
2900
2901#if (defined __STDC__ || defined __C99__FUNC__ \
2902 || defined __cplusplus || defined _MSC_VER)
2903static void
2904yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
2905#else
2906static void
2907yy_reduce_print (yyvsp, yyrule)
2908 YYSTYPE *yyvsp;
2909 int yyrule;
Christopher Lamb0a243582007-12-11 09:02:08 +00002910#endif
Dan Gohman54392c12008-04-19 00:24:39 +00002911{
2912 int yynrhs = yyr2[yyrule];
2913 int yyi;
2914 unsigned long int yylno = yyrline[yyrule];
2915 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2916 yyrule - 1, yylno);
2917 /* The symbols being reduced. */
2918 for (yyi = 0; yyi < yynrhs; yyi++)
2919 {
2920 fprintf (stderr, " $%d = ", yyi + 1);
2921 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2922 &(yyvsp[(yyi + 1) - (yynrhs)])
2923 );
2924 fprintf (stderr, "\n");
2925 }
2926}
Scott Michel5a6f17b2008-01-30 02:55:46 +00002927
Dan Gohman54392c12008-04-19 00:24:39 +00002928# define YY_REDUCE_PRINT(Rule) \
2929do { \
2930 if (yydebug) \
2931 yy_reduce_print (yyvsp, Rule); \
2932} while (YYID (0))
Scott Michel5a6f17b2008-01-30 02:55:46 +00002933
Dan Gohman54392c12008-04-19 00:24:39 +00002934/* Nonzero means print parse trace. It is left uninitialized so that
2935 multiple parsers can coexist. */
2936int yydebug;
2937#else /* !YYDEBUG */
2938# define YYDPRINTF(Args)
2939# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2940# define YY_STACK_PRINT(Bottom, Top)
2941# define YY_REDUCE_PRINT(Rule)
2942#endif /* !YYDEBUG */
2943
2944
2945/* YYINITDEPTH -- initial size of the parser's stacks. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002946#ifndef YYINITDEPTH
Dan Gohman54392c12008-04-19 00:24:39 +00002947# define YYINITDEPTH 200
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002948#endif
2949
Dan Gohman54392c12008-04-19 00:24:39 +00002950/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2951 if the built-in stack extension method is used).
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002952
Dan Gohman54392c12008-04-19 00:24:39 +00002953 Do not make this value too large; the results are undefined if
2954 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2955 evaluated with infinite-precision integer arithmetic. */
David Greene9145dd22007-08-01 03:59:32 +00002956
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002957#ifndef YYMAXDEPTH
Dan Gohman54392c12008-04-19 00:24:39 +00002958# define YYMAXDEPTH 10000
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002959#endif
Dan Gohman54392c12008-04-19 00:24:39 +00002960
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002961
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002962
Dan Gohman54392c12008-04-19 00:24:39 +00002963#if YYERROR_VERBOSE
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002964
Dan Gohman54392c12008-04-19 00:24:39 +00002965# ifndef yystrlen
2966# if defined __GLIBC__ && defined _STRING_H
2967# define yystrlen strlen
2968# else
2969/* Return the length of YYSTR. */
2970#if (defined __STDC__ || defined __C99__FUNC__ \
2971 || defined __cplusplus || defined _MSC_VER)
2972static YYSIZE_T
2973yystrlen (const char *yystr)
Chris Lattner59363a32008-02-19 04:36:25 +00002974#else
Dan Gohman54392c12008-04-19 00:24:39 +00002975static YYSIZE_T
2976yystrlen (yystr)
2977 const char *yystr;
2978#endif
2979{
2980 YYSIZE_T yylen;
2981 for (yylen = 0; yystr[yylen]; yylen++)
2982 continue;
2983 return yylen;
2984}
2985# endif
2986# endif
2987
2988# ifndef yystpcpy
2989# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
2990# define yystpcpy stpcpy
2991# else
2992/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2993 YYDEST. */
2994#if (defined __STDC__ || defined __C99__FUNC__ \
2995 || defined __cplusplus || defined _MSC_VER)
2996static char *
2997yystpcpy (char *yydest, const char *yysrc)
2998#else
2999static char *
3000yystpcpy (yydest, yysrc)
3001 char *yydest;
3002 const char *yysrc;
3003#endif
3004{
3005 char *yyd = yydest;
3006 const char *yys = yysrc;
3007
3008 while ((*yyd++ = *yys++) != '\0')
3009 continue;
3010
3011 return yyd - 1;
3012}
3013# endif
3014# endif
3015
3016# ifndef yytnamerr
3017/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3018 quotes and backslashes, so that it's suitable for yyerror. The
3019 heuristic is that double-quoting is unnecessary unless the string
3020 contains an apostrophe, a comma, or backslash (other than
3021 backslash-backslash). YYSTR is taken from yytname. If YYRES is
3022 null, do not copy; instead, return the length of what the result
3023 would have been. */
3024static YYSIZE_T
3025yytnamerr (char *yyres, const char *yystr)
3026{
3027 if (*yystr == '"')
3028 {
3029 YYSIZE_T yyn = 0;
3030 char const *yyp = yystr;
3031
3032 for (;;)
3033 switch (*++yyp)
3034 {
3035 case '\'':
3036 case ',':
3037 goto do_not_strip_quotes;
3038
3039 case '\\':
3040 if (*++yyp != '\\')
3041 goto do_not_strip_quotes;
3042 /* Fall through. */
3043 default:
3044 if (yyres)
3045 yyres[yyn] = *yyp;
3046 yyn++;
3047 break;
3048
3049 case '"':
3050 if (yyres)
3051 yyres[yyn] = '\0';
3052 return yyn;
3053 }
3054 do_not_strip_quotes: ;
3055 }
3056
3057 if (! yyres)
3058 return yystrlen (yystr);
3059
3060 return yystpcpy (yyres, yystr) - yyres;
3061}
3062# endif
3063
3064/* Copy into YYRESULT an error message about the unexpected token
3065 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3066 including the terminating null byte. If YYRESULT is null, do not
3067 copy anything; just return the number of bytes that would be
3068 copied. As a special case, return 0 if an ordinary "syntax error"
3069 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3070 size calculation. */
3071static YYSIZE_T
3072yysyntax_error (char *yyresult, int yystate, int yychar)
3073{
3074 int yyn = yypact[yystate];
3075
3076 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3077 return 0;
3078 else
3079 {
3080 int yytype = YYTRANSLATE (yychar);
3081 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3082 YYSIZE_T yysize = yysize0;
3083 YYSIZE_T yysize1;
3084 int yysize_overflow = 0;
3085 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3086 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3087 int yyx;
3088
3089# if 0
3090 /* This is so xgettext sees the translatable formats that are
3091 constructed on the fly. */
3092 YY_("syntax error, unexpected %s");
3093 YY_("syntax error, unexpected %s, expecting %s");
3094 YY_("syntax error, unexpected %s, expecting %s or %s");
3095 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3096 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3097# endif
3098 char *yyfmt;
3099 char const *yyf;
3100 static char const yyunexpected[] = "syntax error, unexpected %s";
3101 static char const yyexpecting[] = ", expecting %s";
3102 static char const yyor[] = " or %s";
3103 char yyformat[sizeof yyunexpected
3104 + sizeof yyexpecting - 1
3105 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3106 * (sizeof yyor - 1))];
3107 char const *yyprefix = yyexpecting;
3108
3109 /* Start YYX at -YYN if negative to avoid negative indexes in
3110 YYCHECK. */
3111 int yyxbegin = yyn < 0 ? -yyn : 0;
3112
3113 /* Stay within bounds of both yycheck and yytname. */
3114 int yychecklim = YYLAST - yyn + 1;
3115 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3116 int yycount = 1;
3117
3118 yyarg[0] = yytname[yytype];
3119 yyfmt = yystpcpy (yyformat, yyunexpected);
3120
3121 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3122 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3123 {
3124 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3125 {
3126 yycount = 1;
3127 yysize = yysize0;
3128 yyformat[sizeof yyunexpected - 1] = '\0';
3129 break;
3130 }
3131 yyarg[yycount++] = yytname[yyx];
3132 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3133 yysize_overflow |= (yysize1 < yysize);
3134 yysize = yysize1;
3135 yyfmt = yystpcpy (yyfmt, yyprefix);
3136 yyprefix = yyor;
3137 }
3138
3139 yyf = YY_(yyformat);
3140 yysize1 = yysize + yystrlen (yyf);
3141 yysize_overflow |= (yysize1 < yysize);
3142 yysize = yysize1;
3143
3144 if (yysize_overflow)
3145 return YYSIZE_MAXIMUM;
3146
3147 if (yyresult)
3148 {
3149 /* Avoid sprintf, as that infringes on the user's name space.
3150 Don't have undefined behavior even if the translation
3151 produced a string with the wrong number of "%s"s. */
3152 char *yyp = yyresult;
3153 int yyi = 0;
3154 while ((*yyp = *yyf) != '\0')
3155 {
3156 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3157 {
3158 yyp += yytnamerr (yyp, yyarg[yyi++]);
3159 yyf += 2;
3160 }
3161 else
3162 {
3163 yyp++;
3164 yyf++;
3165 }
3166 }
3167 }
3168 return yysize;
3169 }
3170}
3171#endif /* YYERROR_VERBOSE */
3172
3173
3174/*-----------------------------------------------.
3175| Release the memory associated to this symbol. |
3176`-----------------------------------------------*/
3177
3178/*ARGSUSED*/
3179#if (defined __STDC__ || defined __C99__FUNC__ \
3180 || defined __cplusplus || defined _MSC_VER)
3181static void
3182yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3183#else
3184static void
3185yydestruct (yymsg, yytype, yyvaluep)
3186 const char *yymsg;
3187 int yytype;
3188 YYSTYPE *yyvaluep;
3189#endif
3190{
3191 YYUSE (yyvaluep);
3192
3193 if (!yymsg)
3194 yymsg = "Deleting";
3195 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3196
3197 switch (yytype)
3198 {
3199
3200 default:
3201 break;
3202 }
3203}
3204
3205
3206/* Prevent warnings from -Wmissing-prototypes. */
3207
3208#ifdef YYPARSE_PARAM
3209#if defined __STDC__ || defined __cplusplus
3210int yyparse (void *YYPARSE_PARAM);
3211#else
3212int yyparse ();
3213#endif
3214#else /* ! YYPARSE_PARAM */
3215#if defined __STDC__ || defined __cplusplus
David Greene48556392007-09-04 18:46:50 +00003216int yyparse (void);
Gabor Greif89f01162008-04-06 23:07:54 +00003217#else
Dan Gohman54392c12008-04-19 00:24:39 +00003218int yyparse ();
Scott Michel6d1aba82008-01-30 03:10:00 +00003219#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003220#endif /* ! YYPARSE_PARAM */
Scott Michel5a6f17b2008-01-30 02:55:46 +00003221
Chris Lattner59363a32008-02-19 04:36:25 +00003222
Dan Gohman54392c12008-04-19 00:24:39 +00003223
3224/* The look-ahead symbol. */
3225int yychar;
3226
3227/* The semantic value of the look-ahead symbol. */
3228YYSTYPE yylval;
3229
3230/* Number of syntax errors so far. */
3231int yynerrs;
3232
3233
3234
3235/*----------.
3236| yyparse. |
3237`----------*/
3238
3239#ifdef YYPARSE_PARAM
3240#if (defined __STDC__ || defined __C99__FUNC__ \
3241 || defined __cplusplus || defined _MSC_VER)
3242int
3243yyparse (void *YYPARSE_PARAM)
3244#else
3245int
3246yyparse (YYPARSE_PARAM)
3247 void *YYPARSE_PARAM;
3248#endif
3249#else /* ! YYPARSE_PARAM */
3250#if (defined __STDC__ || defined __C99__FUNC__ \
3251 || defined __cplusplus || defined _MSC_VER)
3252int
3253yyparse (void)
3254#else
3255int
3256yyparse ()
3257
Gabor Greif89f01162008-04-06 23:07:54 +00003258#endif
3259#endif
Dan Gohman54392c12008-04-19 00:24:39 +00003260{
3261
3262 int yystate;
3263 int yyn;
3264 int yyresult;
3265 /* Number of tokens to shift before error messages enabled. */
3266 int yyerrstatus;
3267 /* Look-ahead token as an internal (translated) token number. */
3268 int yytoken = 0;
3269#if YYERROR_VERBOSE
3270 /* Buffer for error messages, and its allocated size. */
3271 char yymsgbuf[128];
3272 char *yymsg = yymsgbuf;
3273 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
Gabor Greif89f01162008-04-06 23:07:54 +00003274#endif
Chris Lattner59363a32008-02-19 04:36:25 +00003275
Dan Gohman54392c12008-04-19 00:24:39 +00003276 /* Three stacks and their tools:
3277 `yyss': related to states,
3278 `yyvs': related to semantic values,
3279 `yyls': related to locations.
3280
3281 Refer to the stacks thru separate pointers, to allow yyoverflow
3282 to reallocate them elsewhere. */
3283
3284 /* The state stack. */
3285 yytype_int16 yyssa[YYINITDEPTH];
3286 yytype_int16 *yyss = yyssa;
3287 yytype_int16 *yyssp;
3288
3289 /* The semantic value stack. */
3290 YYSTYPE yyvsa[YYINITDEPTH];
3291 YYSTYPE *yyvs = yyvsa;
3292 YYSTYPE *yyvsp;
3293
3294
3295
3296#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3297
3298 YYSIZE_T yystacksize = YYINITDEPTH;
3299
3300 /* The variables used to return semantic value and location from the
3301 action routines. */
3302 YYSTYPE yyval;
3303
3304
3305 /* The number of symbols on the RHS of the reduced rule.
3306 Keep to zero when no symbol should be popped. */
3307 int yylen = 0;
3308
3309 YYDPRINTF ((stderr, "Starting parse\n"));
3310
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003311 yystate = 0;
3312 yyerrstatus = 0;
3313 yynerrs = 0;
3314 yychar = YYEMPTY; /* Cause a token to be read. */
3315
3316 /* Initialize stack pointers.
3317 Waste one element of value and location stack
3318 so that they stay on the same level as the state stack.
3319 The wasted elements are never initialized. */
3320
Dan Gohman54392c12008-04-19 00:24:39 +00003321 yyssp = yyss;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003322 yyvsp = yyvs;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003323
Dan Gohman54392c12008-04-19 00:24:39 +00003324 goto yysetstate;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003325
Dan Gohman54392c12008-04-19 00:24:39 +00003326/*------------------------------------------------------------.
3327| yynewstate -- Push a new state, which is found in yystate. |
3328`------------------------------------------------------------*/
3329 yynewstate:
3330 /* In all cases, when you get here, the value and location stacks
3331 have just been pushed. So pushing a state here evens the stacks. */
3332 yyssp++;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003333
Dan Gohman54392c12008-04-19 00:24:39 +00003334 yysetstate:
3335 *yyssp = yystate;
3336
3337 if (yyss + yystacksize - 1 <= yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003338 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003339 /* Get the current used size of the three stacks, in elements. */
Dan Gohman54392c12008-04-19 00:24:39 +00003340 YYSIZE_T yysize = yyssp - yyss + 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003341
3342#ifdef yyoverflow
Dan Gohman54392c12008-04-19 00:24:39 +00003343 {
3344 /* Give user a chance to reallocate the stack. Use copies of
3345 these so that the &'s don't force the real ones into
3346 memory. */
3347 YYSTYPE *yyvs1 = yyvs;
3348 yytype_int16 *yyss1 = yyss;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003349
Dan Gohman54392c12008-04-19 00:24:39 +00003350
3351 /* Each stack pointer address is followed by the size of the
3352 data in use in that stack, in bytes. This used to be a
3353 conditional around just the two extra args, but that might
3354 be undefined if yyoverflow is a macro. */
3355 yyoverflow (YY_("memory exhausted"),
3356 &yyss1, yysize * sizeof (*yyssp),
3357 &yyvs1, yysize * sizeof (*yyvsp),
3358
3359 &yystacksize);
3360
3361 yyss = yyss1;
3362 yyvs = yyvs1;
3363 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003364#else /* no yyoverflow */
Dan Gohman54392c12008-04-19 00:24:39 +00003365# ifndef YYSTACK_RELOCATE
3366 goto yyexhaustedlab;
3367# else
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003368 /* Extend the stack our own way. */
Dan Gohman54392c12008-04-19 00:24:39 +00003369 if (YYMAXDEPTH <= yystacksize)
3370 goto yyexhaustedlab;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003371 yystacksize *= 2;
Dan Gohman54392c12008-04-19 00:24:39 +00003372 if (YYMAXDEPTH < yystacksize)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003373 yystacksize = YYMAXDEPTH;
Dan Gohman54392c12008-04-19 00:24:39 +00003374
3375 {
3376 yytype_int16 *yyss1 = yyss;
3377 union yyalloc *yyptr =
3378 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3379 if (! yyptr)
3380 goto yyexhaustedlab;
3381 YYSTACK_RELOCATE (yyss);
3382 YYSTACK_RELOCATE (yyvs);
3383
3384# undef YYSTACK_RELOCATE
3385 if (yyss1 != yyssa)
3386 YYSTACK_FREE (yyss1);
3387 }
3388# endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003389#endif /* no yyoverflow */
3390
Dan Gohman54392c12008-04-19 00:24:39 +00003391 yyssp = yyss + yysize - 1;
3392 yyvsp = yyvs + yysize - 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003393
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003394
Dan Gohman54392c12008-04-19 00:24:39 +00003395 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3396 (unsigned long int) yystacksize));
3397
3398 if (yyss + yystacksize - 1 <= yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003399 YYABORT;
3400 }
3401
Dan Gohman54392c12008-04-19 00:24:39 +00003402 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003403
3404 goto yybackup;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003405
Dan Gohman54392c12008-04-19 00:24:39 +00003406/*-----------.
3407| yybackup. |
3408`-----------*/
3409yybackup:
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003410
Dan Gohman54392c12008-04-19 00:24:39 +00003411 /* Do appropriate processing given the current state. Read a
3412 look-ahead token if we need one and don't already have one. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003413
Dan Gohman54392c12008-04-19 00:24:39 +00003414 /* First try to decide what to do without reference to look-ahead token. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003415 yyn = yypact[yystate];
Dan Gohman54392c12008-04-19 00:24:39 +00003416 if (yyn == YYPACT_NINF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003417 goto yydefault;
3418
Dan Gohman54392c12008-04-19 00:24:39 +00003419 /* Not known => get a look-ahead token if don't already have one. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003420
Dan Gohman54392c12008-04-19 00:24:39 +00003421 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003422 if (yychar == YYEMPTY)
3423 {
Dan Gohman54392c12008-04-19 00:24:39 +00003424 YYDPRINTF ((stderr, "Reading a token: "));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003425 yychar = YYLEX;
3426 }
3427
Dan Gohman54392c12008-04-19 00:24:39 +00003428 if (yychar <= YYEOF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003429 {
Dan Gohman54392c12008-04-19 00:24:39 +00003430 yychar = yytoken = YYEOF;
3431 YYDPRINTF ((stderr, "Now at end of input.\n"));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003432 }
3433 else
3434 {
Dan Gohman54392c12008-04-19 00:24:39 +00003435 yytoken = YYTRANSLATE (yychar);
3436 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003437 }
3438
Dan Gohman54392c12008-04-19 00:24:39 +00003439 /* If the proper action on seeing token YYTOKEN is to reduce or to
3440 detect an error, take that action. */
3441 yyn += yytoken;
3442 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003443 goto yydefault;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003444 yyn = yytable[yyn];
Dan Gohman54392c12008-04-19 00:24:39 +00003445 if (yyn <= 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003446 {
Dan Gohman54392c12008-04-19 00:24:39 +00003447 if (yyn == 0 || yyn == YYTABLE_NINF)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003448 goto yyerrlab;
3449 yyn = -yyn;
3450 goto yyreduce;
3451 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003452
3453 if (yyn == YYFINAL)
3454 YYACCEPT;
3455
Dan Gohman54392c12008-04-19 00:24:39 +00003456 /* Count tokens shifted since error; after three, turn off error
3457 status. */
3458 if (yyerrstatus)
3459 yyerrstatus--;
Dale Johannesen3afee192007-09-07 21:07:57 +00003460
Dan Gohman54392c12008-04-19 00:24:39 +00003461 /* Shift the look-ahead token. */
3462 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003463
Dan Gohman54392c12008-04-19 00:24:39 +00003464 /* Discard the shifted token unless it is eof. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003465 if (yychar != YYEOF)
3466 yychar = YYEMPTY;
3467
Gabor Greif89f01162008-04-06 23:07:54 +00003468 yystate = yyn;
Dan Gohman54392c12008-04-19 00:24:39 +00003469 *++yyvsp = yylval;
3470
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003471 goto yynewstate;
3472
Gabor Greif89f01162008-04-06 23:07:54 +00003473
Dan Gohman54392c12008-04-19 00:24:39 +00003474/*-----------------------------------------------------------.
3475| yydefault -- do the default action for the current state. |
3476`-----------------------------------------------------------*/
3477yydefault:
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003478 yyn = yydefact[yystate];
3479 if (yyn == 0)
3480 goto yyerrlab;
Dan Gohman54392c12008-04-19 00:24:39 +00003481 goto yyreduce;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003482
Dan Gohman54392c12008-04-19 00:24:39 +00003483
3484/*-----------------------------.
3485| yyreduce -- Do a reduction. |
3486`-----------------------------*/
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003487yyreduce:
Dan Gohman54392c12008-04-19 00:24:39 +00003488 /* yyn is the number of a rule to reduce with. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003489 yylen = yyr2[yyn];
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003490
Dan Gohman54392c12008-04-19 00:24:39 +00003491 /* If YYLEN is nonzero, implement the default value of the action:
3492 `$$ = $1'.
3493
3494 Otherwise, the following line sets YYVAL to garbage.
3495 This behavior is undocumented and Bison
3496 users should not rely upon it. Assigning to YYVAL
3497 unconditionally makes the parser a bit smaller, and it avoids a
3498 GCC warning that YYVAL may be used uninitialized. */
3499 yyval = yyvsp[1-yylen];
3500
3501
3502 YY_REDUCE_PRINT (yyn);
3503 switch (yyn)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003504 {
Dan Gohman54392c12008-04-19 00:24:39 +00003505 case 29:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003506#line 1117 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003507 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3508 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003509
Dan Gohman54392c12008-04-19 00:24:39 +00003510 case 30:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003511#line 1117 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003512 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3513 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003514
Dan Gohman54392c12008-04-19 00:24:39 +00003515 case 31:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003516#line 1118 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003517 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3518 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003519
Dan Gohman54392c12008-04-19 00:24:39 +00003520 case 32:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003521#line 1118 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003522 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3523 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003524
Dan Gohman54392c12008-04-19 00:24:39 +00003525 case 33:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003526#line 1119 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003527 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3528 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003529
Dan Gohman54392c12008-04-19 00:24:39 +00003530 case 34:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003531#line 1119 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003532 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3533 break;
3534
3535 case 35:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003536#line 1120 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003537 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3538 break;
3539
3540 case 36:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003541#line 1120 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003542 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3543 break;
3544
3545 case 37:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003546#line 1121 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003547 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3548 break;
3549
3550 case 38:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003551#line 1121 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003552 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3553 break;
3554
3555 case 39:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003556#line 1125 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003557 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3558 break;
3559
3560 case 40:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003561#line 1125 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003562 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3563 break;
3564
3565 case 41:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003566#line 1126 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003567 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3568 break;
3569
3570 case 42:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003571#line 1126 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003572 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3573 break;
3574
3575 case 43:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003576#line 1127 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003577 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3578 break;
3579
3580 case 44:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003581#line 1127 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003582 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3583 break;
3584
3585 case 45:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003586#line 1128 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003587 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3588 break;
3589
3590 case 46:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003591#line 1128 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003592 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3593 break;
3594
3595 case 47:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003596#line 1129 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003597 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3598 break;
3599
3600 case 48:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003601#line 1129 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003602 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3603 break;
3604
3605 case 49:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003606#line 1130 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003607 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3608 break;
3609
3610 case 50:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003611#line 1130 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003612 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3613 break;
3614
3615 case 51:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003616#line 1131 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003617 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3618 break;
3619
3620 case 52:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003621#line 1131 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003622 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3623 break;
3624
3625 case 53:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003626#line 1132 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003627 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3628 break;
3629
3630 case 54:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003631#line 1133 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003632 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3633 break;
3634
3635 case 65:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003636#line 1142 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003637 { (yyval.StrVal) = 0; ;}
3638 break;
3639
3640 case 66:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003641#line 1144 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003642 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3643 break;
3644
3645 case 67:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003646#line 1145 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003647 { (yyval.UIntVal)=0; ;}
3648 break;
3649
3650 case 68:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003651#line 1149 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003652 {
3653 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003654 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003655 ;}
3656 break;
3657
3658 case 69:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003659#line 1153 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003660 {
3661 (yyval.StrVal) = 0;
Christopher Lamb668d9a02007-12-12 08:45:45 +00003662 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003663 ;}
3664 break;
3665
3666 case 73:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003667#line 1161 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003668 {
3669 (yyval.StrVal) = 0;
Christopher Lamb668d9a02007-12-12 08:45:45 +00003670 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003671 ;}
3672 break;
3673
3674 case 74:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003675#line 1166 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003676 {
3677 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00003678 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003679 ;}
3680 break;
3681
3682 case 75:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003683#line 1172 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003684 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3685 break;
3686
3687 case 76:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003688#line 1173 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003689 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3690 break;
3691
3692 case 77:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003693#line 1174 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003694 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3695 break;
3696
3697 case 78:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003698#line 1175 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003699 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3700 break;
3701
3702 case 79:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003703#line 1176 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003704 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3705 break;
3706
3707 case 80:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003708#line 1177 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3709 { (yyval.Linkage) = GlobalValue::CommonLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003710 break;
3711
3712 case 81:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003713#line 1181 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3714 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003715 break;
3716
3717 case 82:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003718#line 1182 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3719 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003720 break;
3721
3722 case 83:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003723#line 1183 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3724 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003725 break;
3726
3727 case 84:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003728#line 1187 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003729 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3730 break;
3731
3732 case 85:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003733#line 1188 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3734 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003735 break;
3736
3737 case 86:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003738#line 1189 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3739 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003740 break;
3741
3742 case 87:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003743#line 1190 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3744 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003745 break;
3746
3747 case 88:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003748#line 1194 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3749 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003750 break;
3751
3752 case 89:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003753#line 1195 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3754 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003755 break;
3756
3757 case 90:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003758#line 1196 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3759 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003760 break;
3761
3762 case 91:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003763#line 1200 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003764 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3765 break;
3766
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003767 case 92:
3768#line 1201 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003769 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3770 break;
3771
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003772 case 93:
3773#line 1202 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3774 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3775 break;
3776
3777 case 94:
3778#line 1203 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3779 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3780 break;
3781
3782 case 95:
3783#line 1204 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3784 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3785 break;
3786
3787 case 96:
3788#line 1208 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3789 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3790 break;
3791
3792 case 97:
3793#line 1209 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3794 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3795 break;
3796
Dan Gohman54392c12008-04-19 00:24:39 +00003797 case 98:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003798#line 1210 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3799 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003800 break;
3801
3802 case 99:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003803#line 1213 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003804 { (yyval.UIntVal) = CallingConv::C; ;}
3805 break;
3806
3807 case 100:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003808#line 1214 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3809 { (yyval.UIntVal) = CallingConv::C; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003810 break;
3811
3812 case 101:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003813#line 1215 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3814 { (yyval.UIntVal) = CallingConv::Fast; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003815 break;
3816
3817 case 102:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003818#line 1216 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3819 { (yyval.UIntVal) = CallingConv::Cold; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003820 break;
3821
3822 case 103:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003823#line 1217 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3824 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003825 break;
3826
3827 case 104:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003828#line 1218 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3829 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3830 break;
3831
3832 case 105:
3833#line 1219 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003834 {
3835 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003836 GEN_ERROR("Calling conv too large");
Dan Gohman54392c12008-04-19 00:24:39 +00003837 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003838 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003839 ;}
3840 break;
3841
Dan Gohman54392c12008-04-19 00:24:39 +00003842 case 106:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003843#line 1226 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003844 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3845 break;
3846
3847 case 107:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003848#line 1227 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3849 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003850 break;
3851
3852 case 108:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003853#line 1228 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003854 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3855 break;
3856
3857 case 109:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003858#line 1229 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3859 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003860 break;
3861
3862 case 110:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003863#line 1230 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3864 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003865 break;
3866
3867 case 111:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003868#line 1231 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3869 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003870 break;
3871
3872 case 112:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003873#line 1232 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3874 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003875 break;
3876
3877 case 113:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003878#line 1233 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3879 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003880 break;
3881
3882 case 114:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003883#line 1234 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3884 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
3885 break;
3886
3887 case 115:
3888#line 1235 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003889 { (yyval.ParamAttrs) =
3890 ParamAttr::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
3891 break;
3892
Dan Gohman54392c12008-04-19 00:24:39 +00003893 case 116:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003894#line 1239 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3895 { (yyval.ParamAttrs) = ParamAttr::None; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003896 break;
3897
3898 case 117:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003899#line 1240 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003900 {
3901 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3902 ;}
3903 break;
3904
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003905 case 118:
3906#line 1245 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3907 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
3908 break;
3909
3910 case 119:
3911#line 1246 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3912 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
3913 break;
3914
3915 case 120:
3916#line 1247 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3917 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3918 break;
3919
3920 case 121:
3921#line 1248 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3922 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3923 break;
3924
3925 case 122:
3926#line 1249 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3927 { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
3928 break;
3929
3930 case 123:
3931#line 1250 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3932 { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
3933 break;
3934
3935 case 124:
3936#line 1253 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3937 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3938 break;
3939
Dan Gohman54392c12008-04-19 00:24:39 +00003940 case 125:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003941#line 1254 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3942 {
3943 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3944 ;}
Dan Gohman54392c12008-04-19 00:24:39 +00003945 break;
3946
3947 case 126:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003948#line 1259 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3949 { (yyval.StrVal) = 0; ;}
3950 break;
3951
3952 case 127:
3953#line 1260 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003954 {
3955 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3956 ;}
3957 break;
3958
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003959 case 128:
3960#line 1267 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003961 { (yyval.UIntVal) = 0; ;}
3962 break;
3963
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003964 case 129:
3965#line 1268 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003966 {
3967 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3968 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003969 GEN_ERROR("Alignment must be a power of two");
3970 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003971;}
3972 break;
3973
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003974 case 130:
3975#line 1274 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003976 { (yyval.UIntVal) = 0; ;}
3977 break;
3978
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003979 case 131:
3980#line 1275 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003981 {
3982 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
3983 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Christopher Lamb668d9a02007-12-12 08:45:45 +00003984 GEN_ERROR("Alignment must be a power of two");
3985 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003986;}
3987 break;
3988
Dale Johannesen280e7bc2008-05-14 20:13:36 +00003989 case 132:
3990#line 1284 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00003991 {
3992 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
3993 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003994 GEN_ERROR("Invalid character in section name");
Dan Gohman54392c12008-04-19 00:24:39 +00003995 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003996 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00003997;}
3998 break;
3999
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004000 case 133:
4001#line 1292 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004002 { (yyval.StrVal) = 0; ;}
4003 break;
4004
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004005 case 134:
4006#line 1293 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004007 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
4008 break;
4009
Dan Gohman54392c12008-04-19 00:24:39 +00004010 case 135:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004011#line 1298 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004012 {;}
4013 break;
4014
4015 case 136:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004016#line 1299 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4017 {;}
4018 break;
4019
4020 case 137:
4021#line 1300 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004022 {
4023 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
4024 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004025 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004026 ;}
4027 break;
4028
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004029 case 138:
4030#line 1305 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004031 {
4032 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004033 GEN_ERROR("Alignment must be a power of two");
Dan Gohman54392c12008-04-19 00:24:39 +00004034 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004035 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004036 ;}
4037 break;
4038
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004039 case 146:
4040#line 1321 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004041 {
4042 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004043 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004044 ;}
4045 break;
4046
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004047 case 147:
4048#line 1325 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004049 {
4050 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004051 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004052 ;}
4053 break;
4054
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004055 case 148:
4056#line 1329 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004057 { // Pointer type?
4058 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
Christopher Lamb668d9a02007-12-12 08:45:45 +00004059 GEN_ERROR("Cannot form a pointer to a basic block");
Dan Gohman54392c12008-04-19 00:24:39 +00004060 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4061 delete (yyvsp[(1) - (3)].TypeVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00004062 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004063 ;}
4064 break;
4065
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004066 case 149:
4067#line 1336 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004068 { // Named types are also simple types...
4069 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
Christopher Lamb0a243582007-12-11 09:02:08 +00004070 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004071 (yyval.TypeVal) = new PATypeHolder(tmp);
4072 ;}
4073 break;
4074
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004075 case 150:
4076#line 1341 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004077 { // Type UpReference
4078 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004079 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Dan Gohman54392c12008-04-19 00:24:39 +00004080 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4081 (yyval.TypeVal) = new PATypeHolder(OT);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004082 UR_OUT("New Upreference!\n");
4083 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004084 ;}
4085 break;
4086
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004087 case 151:
4088#line 1349 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004089 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004090 // Allow but ignore attributes on function types; this permits auto-upgrade.
4091 // FIXME: remove in LLVM 3.0.
Chris Lattner73de3c02008-04-23 05:37:08 +00004092 const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal);
4093 if (!FunctionType::isValidReturnType(RetTy))
4094 GEN_ERROR("Invalid result type for LLVM function");
4095
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004096 std::vector<const Type*> Params;
Dan Gohman54392c12008-04-19 00:24:39 +00004097 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004098 for (; I != E; ++I ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004099 const Type *Ty = I->Ty->get();
4100 Params.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004101 }
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004102
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004103 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4104 if (isVarArg) Params.pop_back();
4105
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004106 for (unsigned i = 0; i != Params.size(); ++i)
4107 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4108 GEN_ERROR("Function arguments must be value types!");
4109
4110 CHECK_FOR_ERROR
4111
Anton Korobeynikov0cdd2692007-12-03 19:17:47 +00004112 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
Dan Gohman54392c12008-04-19 00:24:39 +00004113 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4114 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4115 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004116 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004117 ;}
4118 break;
4119
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004120 case 152:
4121#line 1378 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004122 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004123 // Allow but ignore attributes on function types; this permits auto-upgrade.
4124 // FIXME: remove in LLVM 3.0.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004125 std::vector<const Type*> Params;
Dan Gohman54392c12008-04-19 00:24:39 +00004126 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004127 for ( ; I != E; ++I ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004128 const Type* Ty = I->Ty->get();
4129 Params.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004130 }
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004131
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004132 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4133 if (isVarArg) Params.pop_back();
4134
Anton Korobeynikove286f6d2007-12-03 21:01:29 +00004135 for (unsigned i = 0; i != Params.size(); ++i)
4136 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4137 GEN_ERROR("Function arguments must be value types!");
4138
4139 CHECK_FOR_ERROR
4140
Dan Gohman54392c12008-04-19 00:24:39 +00004141 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4142 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4143 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004144 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004145 ;}
4146 break;
4147
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004148 case 153:
4149#line 1403 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004150 { // Sized array type?
4151 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4152 delete (yyvsp[(4) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004153 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004154 ;}
4155 break;
4156
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004157 case 154:
4158#line 1408 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004159 { // Vector type?
4160 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4161 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004162 GEN_ERROR("Unsigned result not equal to signed result");
4163 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4164 GEN_ERROR("Element type of a VectorType must be primitive");
Dan Gohman54392c12008-04-19 00:24:39 +00004165 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4166 delete (yyvsp[(4) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004167 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004168 ;}
4169 break;
4170
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004171 case 155:
4172#line 1418 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004173 { // Structure type?
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[(2) - (3)].TypeList)->begin(),
4176 E = (yyvsp[(2) - (3)].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)));
4180 delete (yyvsp[(2) - (3)].TypeList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004181 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004182 ;}
4183 break;
4184
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004185 case 156:
4186#line 1428 "/Volumes/MacOS9/gcc/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*>()));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004189 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004190 ;}
4191 break;
4192
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004193 case 157:
4194#line 1432 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004195 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004196 std::vector<const Type*> Elements;
Dan Gohman54392c12008-04-19 00:24:39 +00004197 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4198 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004199 Elements.push_back(*I);
4200
Dan Gohman54392c12008-04-19 00:24:39 +00004201 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4202 delete (yyvsp[(3) - (5)].TypeList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004203 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004204 ;}
4205 break;
4206
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004207 case 158:
4208#line 1442 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004209 { // Empty structure type?
4210 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004211 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004212 ;}
4213 break;
4214
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004215 case 159:
4216#line 1449 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004217 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00004218 // Allow but ignore attributes on function types; this permits auto-upgrade.
4219 // FIXME: remove in LLVM 3.0.
Dan Gohman54392c12008-04-19 00:24:39 +00004220 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4221 (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
4222 ;}
4223 break;
4224
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004225 case 160:
4226#line 1458 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004227 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004228 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004229 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4230 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004231 GEN_ERROR("LLVM functions cannot return aggregate types");
Dan Gohman54392c12008-04-19 00:24:39 +00004232 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4233 ;}
4234 break;
4235
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004236 case 161:
4237#line 1465 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004238 {
4239 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4240 ;}
4241 break;
4242
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004243 case 162:
4244#line 1470 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004245 {
4246 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4247 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004248 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004249 ;}
4250 break;
4251
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004252 case 163:
4253#line 1475 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004254 {
4255 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004256 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004257 ;}
4258 break;
4259
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004260 case 165:
4261#line 1483 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004262 {
4263 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004264 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4265 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohman54392c12008-04-19 00:24:39 +00004266 (yyval.TypeWithAttrsList)->push_back(TWA);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004267 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004268 ;}
4269 break;
4270
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004271 case 166:
4272#line 1490 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004273 {
4274 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004275 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4276 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohman54392c12008-04-19 00:24:39 +00004277 (yyval.TypeWithAttrsList)->push_back(TWA);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004278 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004279 ;}
4280 break;
4281
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004282 case 167:
4283#line 1497 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004284 {
4285 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004286 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004287 ;}
4288 break;
4289
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004290 case 168:
4291#line 1505 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004292 {
4293 (yyval.TypeList) = new std::list<PATypeHolder>();
4294 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4295 delete (yyvsp[(1) - (1)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004296 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004297 ;}
4298 break;
4299
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004300 case 169:
4301#line 1511 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004302 {
4303 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4304 delete (yyvsp[(3) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004305 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004306 ;}
4307 break;
4308
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004309 case 170:
4310#line 1523 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004311 { // Nonempty unsized arr
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004312 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004313 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4314 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004315 if (ATy == 0)
4316 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004317 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004318 const Type *ETy = ATy->getElementType();
4319 int NumElements = ATy->getNumElements();
4320
4321 // Verify that we have the correct size...
Dan Gohman54392c12008-04-19 00:24:39 +00004322 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004323 GEN_ERROR("Type mismatch: constant sized array initialized with " +
Dan Gohman54392c12008-04-19 00:24:39 +00004324 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004325 itostr(NumElements) + "");
4326
4327 // Verify all elements are correct type!
Dan Gohman54392c12008-04-19 00:24:39 +00004328 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4329 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004330 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4331 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohman54392c12008-04-19 00:24:39 +00004332 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004333 }
4334
Dan Gohman54392c12008-04-19 00:24:39 +00004335 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4336 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004337 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004338 ;}
4339 break;
4340
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004341 case 171:
4342#line 1551 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004343 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004344 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004345 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4346 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004347 if (ATy == 0)
4348 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004349 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004350
4351 int NumElements = ATy->getNumElements();
4352 if (NumElements != -1 && NumElements != 0)
4353 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
4354 " arguments, but has size of " + itostr(NumElements) +"");
Dan Gohman54392c12008-04-19 00:24:39 +00004355 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4356 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004357 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004358 ;}
4359 break;
4360
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004361 case 172:
4362#line 1567 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004363 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004364 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004365 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4366 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004367 if (ATy == 0)
4368 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004369 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004370
4371 int NumElements = ATy->getNumElements();
4372 const Type *ETy = ATy->getElementType();
Dan Gohman54392c12008-04-19 00:24:39 +00004373 if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004374 GEN_ERROR("Can't build string constant of size " +
Dan Gohman54392c12008-04-19 00:24:39 +00004375 itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004376 " when array has size " + itostr(NumElements) + "");
4377 std::vector<Constant*> Vals;
4378 if (ETy == Type::Int8Ty) {
Dan Gohman54392c12008-04-19 00:24:39 +00004379 for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
4380 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004381 } else {
Dan Gohman54392c12008-04-19 00:24:39 +00004382 delete (yyvsp[(3) - (3)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004383 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4384 }
Dan Gohman54392c12008-04-19 00:24:39 +00004385 delete (yyvsp[(3) - (3)].StrVal);
4386 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4387 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004388 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004389 ;}
4390 break;
4391
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004392 case 173:
4393#line 1594 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004394 { // Nonempty unsized arr
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004395 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004396 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4397 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004398 if (PTy == 0)
4399 GEN_ERROR("Cannot make packed constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004400 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004401 const Type *ETy = PTy->getElementType();
4402 int NumElements = PTy->getNumElements();
4403
4404 // Verify that we have the correct size...
Dan Gohman54392c12008-04-19 00:24:39 +00004405 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004406 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
Dan Gohman54392c12008-04-19 00:24:39 +00004407 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004408 itostr(NumElements) + "");
4409
4410 // Verify all elements are correct type!
Dan Gohman54392c12008-04-19 00:24:39 +00004411 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4412 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004413 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4414 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohman54392c12008-04-19 00:24:39 +00004415 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004416 }
4417
Dan Gohman54392c12008-04-19 00:24:39 +00004418 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4419 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004420 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004421 ;}
4422 break;
4423
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004424 case 174:
4425#line 1622 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004426 {
4427 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004428 if (STy == 0)
4429 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004430 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004431
Dan Gohman54392c12008-04-19 00:24:39 +00004432 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004433 GEN_ERROR("Illegal number of initializers for structure type");
4434
4435 // Check to ensure that constants are compatible with the type initializer!
Dan Gohman54392c12008-04-19 00:24:39 +00004436 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4437 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004438 GEN_ERROR("Expected type '" +
4439 STy->getElementType(i)->getDescription() +
4440 "' for element #" + utostr(i) +
4441 " of structure initializer");
4442
4443 // Check to ensure that Type is not packed
4444 if (STy->isPacked())
4445 GEN_ERROR("Unpacked Initializer to vector type '" +
4446 STy->getDescription() + "'");
4447
Dan Gohman54392c12008-04-19 00:24:39 +00004448 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4449 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004450 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004451 ;}
4452 break;
4453
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004454 case 175:
4455#line 1648 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004456 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004457 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004458 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4459 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].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) - (3)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004463
4464 if (STy->getNumContainedTypes() != 0)
4465 GEN_ERROR("Illegal number of initializers for structure type");
4466
4467 // Check to ensure that Type is not packed
4468 if (STy->isPacked())
4469 GEN_ERROR("Unpacked Initializer to vector type '" +
4470 STy->getDescription() + "'");
4471
Dan Gohman54392c12008-04-19 00:24:39 +00004472 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4473 delete (yyvsp[(1) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004474 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004475 ;}
4476 break;
4477
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004478 case 176:
4479#line 1668 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004480 {
4481 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004482 if (STy == 0)
4483 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004484 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004485
Dan Gohman54392c12008-04-19 00:24:39 +00004486 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004487 GEN_ERROR("Illegal number of initializers for structure type");
4488
4489 // Check to ensure that constants are compatible with the type initializer!
Dan Gohman54392c12008-04-19 00:24:39 +00004490 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4491 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004492 GEN_ERROR("Expected type '" +
4493 STy->getElementType(i)->getDescription() +
4494 "' for element #" + utostr(i) +
4495 " of structure initializer");
4496
4497 // Check to ensure that Type is packed
4498 if (!STy->isPacked())
4499 GEN_ERROR("Vector initializer to non-vector type '" +
4500 STy->getDescription() + "'");
4501
Dan Gohman54392c12008-04-19 00:24:39 +00004502 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4503 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004504 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004505 ;}
4506 break;
4507
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004508 case 177:
4509#line 1694 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004510 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004511 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004512 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4513 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004514 if (STy == 0)
4515 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004516 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004517
4518 if (STy->getNumContainedTypes() != 0)
4519 GEN_ERROR("Illegal number of initializers for structure type");
4520
4521 // Check to ensure that Type is packed
4522 if (!STy->isPacked())
4523 GEN_ERROR("Vector initializer to non-vector type '" +
4524 STy->getDescription() + "'");
4525
Dan Gohman54392c12008-04-19 00:24:39 +00004526 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4527 delete (yyvsp[(1) - (5)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004528 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004529 ;}
4530 break;
4531
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004532 case 178:
4533#line 1714 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004534 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004535 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004536 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4537 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004538 if (PTy == 0)
4539 GEN_ERROR("Cannot make null pointer constant with type: '" +
Dan Gohman54392c12008-04-19 00:24:39 +00004540 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004541
Dan Gohman54392c12008-04-19 00:24:39 +00004542 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4543 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004544 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004545 ;}
4546 break;
4547
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004548 case 179:
4549#line 1726 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004550 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004551 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004552 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4553 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4554 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004555 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004556 ;}
4557 break;
4558
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004559 case 180:
4560#line 1733 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004561 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004562 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004563 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4564 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004565 if (Ty == 0)
Dan Gohman54392c12008-04-19 00:24:39 +00004566 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004567
4568 // ConstExprs can exist in the body of a function, thus creating
4569 // GlobalValues whenever they refer to a variable. Because we are in
4570 // the context of a function, getExistingVal will search the functions
4571 // symbol table instead of the module symbol table for the global symbol,
4572 // which throws things all off. To get around this, we just tell
4573 // getExistingVal that we are at global scope here.
4574 //
4575 Function *SavedCurFn = CurFun.CurrentFunction;
4576 CurFun.CurrentFunction = 0;
4577
Dan Gohman54392c12008-04-19 00:24:39 +00004578 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004579 CHECK_FOR_ERROR
4580
4581 CurFun.CurrentFunction = SavedCurFn;
4582
4583 // If this is an initializer for a constant pointer, which is referencing a
4584 // (currently) undefined variable, create a stub now that shall be replaced
4585 // in the future with the right type of variable.
4586 //
4587 if (V == 0) {
4588 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4589 const PointerType *PT = cast<PointerType>(Ty);
4590
4591 // First check to see if the forward references value is already created!
4592 PerModuleInfo::GlobalRefsType::iterator I =
Dan Gohman54392c12008-04-19 00:24:39 +00004593 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004594
4595 if (I != CurModule.GlobalRefs.end()) {
4596 V = I->second; // Placeholder already exists, use it...
Dan Gohman54392c12008-04-19 00:24:39 +00004597 (yyvsp[(2) - (2)].ValIDVal).destroy();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004598 } else {
4599 std::string Name;
Dan Gohman54392c12008-04-19 00:24:39 +00004600 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4601 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4602 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004603 GEN_ERROR("Invalid reference to global");
4604
4605 // Create the forward referenced global.
4606 GlobalValue *GV;
4607 if (const FunctionType *FTy =
4608 dyn_cast<FunctionType>(PT->getElementType())) {
Gabor Greif89f01162008-04-06 23:07:54 +00004609 GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
4610 CurModule.CurrentModule);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004611 } else {
4612 GV = new GlobalVariable(PT->getElementType(), false,
4613 GlobalValue::ExternalWeakLinkage, 0,
4614 Name, CurModule.CurrentModule);
4615 }
4616
4617 // Keep track of the fact that we have a forward ref to recycle it
Dan Gohman54392c12008-04-19 00:24:39 +00004618 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004619 V = GV;
4620 }
4621 }
4622
Dan Gohman54392c12008-04-19 00:24:39 +00004623 (yyval.ConstVal) = cast<GlobalValue>(V);
4624 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004625 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004626 ;}
4627 break;
4628
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004629 case 181:
4630#line 1799 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004631 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004632 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004633 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4634 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004635 GEN_ERROR("Mismatched types for constant expression: " +
Dan Gohman54392c12008-04-19 00:24:39 +00004636 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4637 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4638 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004639 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004640 ;}
4641 break;
4642
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004643 case 182:
4644#line 1809 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004645 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004646 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004647 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4648 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004649 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4650 GEN_ERROR("Cannot create a null initialized value of this type");
Dan Gohman54392c12008-04-19 00:24:39 +00004651 (yyval.ConstVal) = Constant::getNullValue(Ty);
4652 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004653 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004654 ;}
4655 break;
4656
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004657 case 183:
4658#line 1819 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004659 { // integral constants
4660 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004661 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohman54392c12008-04-19 00:24:39 +00004662 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004663 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004664 ;}
4665 break;
4666
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004667 case 184:
4668#line 1825 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004669 { // arbitrary precision integer constants
4670 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4671 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004672 GEN_ERROR("Constant value does not fit in type");
4673 }
Dan Gohman54392c12008-04-19 00:24:39 +00004674 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4675 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4676 delete (yyvsp[(2) - (2)].APIntVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004677 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004678 ;}
4679 break;
4680
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004681 case 185:
4682#line 1835 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004683 { // integral constants
4684 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004685 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohman54392c12008-04-19 00:24:39 +00004686 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004687 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004688 ;}
4689 break;
4690
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004691 case 186:
4692#line 1841 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004693 { // arbitrary precision integer constants
4694 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4695 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004696 GEN_ERROR("Constant value does not fit in type");
4697 }
Dan Gohman54392c12008-04-19 00:24:39 +00004698 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4699 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4700 delete (yyvsp[(2) - (2)].APIntVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004701 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004702 ;}
4703 break;
4704
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004705 case 187:
4706#line 1851 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004707 { // Boolean constants
4708 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4709 (yyval.ConstVal) = ConstantInt::getTrue();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004710 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004711 ;}
4712 break;
4713
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004714 case 188:
4715#line 1856 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004716 { // Boolean constants
4717 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4718 (yyval.ConstVal) = ConstantInt::getFalse();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004719 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004720 ;}
4721 break;
4722
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004723 case 189:
4724#line 1861 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004725 { // Floating point constants
4726 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004727 GEN_ERROR("Floating point constant invalid for type");
Dale Johannesen255b8fe2007-09-11 18:33:39 +00004728 // Lexer has no type info, so builds all float and double FP constants
4729 // as double. Fix this here. Long double is done right.
Dan Gohman54392c12008-04-19 00:24:39 +00004730 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4731 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
Chris Lattner05ba86e2008-04-20 00:41:19 +00004732 (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal));
Dan Gohman54392c12008-04-19 00:24:39 +00004733 delete (yyvsp[(2) - (2)].FPVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004734 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004735 ;}
4736 break;
4737
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004738 case 190:
4739#line 1874 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004740 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004741 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00004742 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4743 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4744 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4745 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004746 GEN_ERROR("invalid cast opcode for cast from '" +
4747 Val->getType()->getDescription() + "' to '" +
4748 DestTy->getDescription() + "'");
Dan Gohman54392c12008-04-19 00:24:39 +00004749 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4750 delete (yyvsp[(5) - (6)].TypeVal);
4751 ;}
4752 break;
4753
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004754 case 191:
4755#line 1886 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004756 {
4757 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004758 GEN_ERROR("GetElementPtr requires a pointer operand");
4759
4760 const Type *IdxTy =
Dan Gohman54392c12008-04-19 00:24:39 +00004761 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end(),
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004762 true);
4763 if (!IdxTy)
4764 GEN_ERROR("Index list invalid for constant getelementptr");
4765
4766 SmallVector<Constant*, 8> IdxVec;
Dan Gohman54392c12008-04-19 00:24:39 +00004767 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4768 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004769 IdxVec.push_back(C);
4770 else
4771 GEN_ERROR("Indices to constant getelementptr must be constants");
4772
Dan Gohman54392c12008-04-19 00:24:39 +00004773 delete (yyvsp[(4) - (5)].ValueList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004774
Dan Gohman54392c12008-04-19 00:24:39 +00004775 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004776 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004777 ;}
4778 break;
4779
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004780 case 192:
4781#line 1908 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004782 {
4783 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004784 GEN_ERROR("Select condition must be of boolean type");
Dan Gohman54392c12008-04-19 00:24:39 +00004785 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004786 GEN_ERROR("Select operand types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00004787 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004788 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004789 ;}
4790 break;
4791
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004792 case 193:
4793#line 1916 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004794 {
4795 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004796 GEN_ERROR("Binary operator types must match");
4797 CHECK_FOR_ERROR;
Dan Gohman54392c12008-04-19 00:24:39 +00004798 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4799 ;}
4800 break;
4801
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004802 case 194:
4803#line 1922 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004804 {
4805 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004806 GEN_ERROR("Logical operator types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00004807 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
4808 if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
4809 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004810 GEN_ERROR("Logical operator requires integral operands");
4811 }
Dan Gohman54392c12008-04-19 00:24:39 +00004812 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004813 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004814 ;}
4815 break;
4816
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004817 case 195:
4818#line 1933 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004819 {
4820 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004821 GEN_ERROR("icmp operand types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00004822 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4823 ;}
4824 break;
4825
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004826 case 196:
4827#line 1938 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004828 {
4829 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004830 GEN_ERROR("fcmp operand types must match");
Dan Gohman54392c12008-04-19 00:24:39 +00004831 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4832 ;}
4833 break;
4834
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004835 case 197:
4836#line 1943 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00004837 {
4838 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4839 GEN_ERROR("vicmp operand types must match");
4840 (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4841 ;}
4842 break;
4843
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004844 case 198:
4845#line 1948 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00004846 {
4847 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4848 GEN_ERROR("vfcmp operand types must match");
4849 (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4850 ;}
4851 break;
4852
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004853 case 199:
4854#line 1953 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004855 {
4856 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004857 GEN_ERROR("Invalid extractelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00004858 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004859 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004860 ;}
4861 break;
4862
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004863 case 200:
4864#line 1959 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004865 {
4866 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004867 GEN_ERROR("Invalid insertelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00004868 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004869 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004870 ;}
4871 break;
4872
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004873 case 201:
4874#line 1965 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004875 {
4876 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004877 GEN_ERROR("Invalid shufflevector operands");
Dan Gohman54392c12008-04-19 00:24:39 +00004878 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004879 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004880 ;}
4881 break;
4882
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004883 case 202:
4884#line 1974 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004885 {
4886 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004887 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004888 ;}
4889 break;
4890
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004891 case 203:
4892#line 1978 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004893 {
4894 (yyval.ConstVector) = new std::vector<Constant*>();
4895 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004896 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004897 ;}
4898 break;
4899
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004900 case 204:
4901#line 1986 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00004902 { (yyval.BoolVal) = false; ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004903 break;
4904
Dan Gohman54392c12008-04-19 00:24:39 +00004905 case 205:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004906#line 1986 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00004907 { (yyval.BoolVal) = true; ;}
4908 break;
4909
4910 case 206:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004911#line 1989 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4912 { (yyval.BoolVal) = true; ;}
Nate Begeman646fa482008-05-12 19:01:56 +00004913 break;
4914
4915 case 207:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004916#line 1989 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4917 { (yyval.BoolVal) = false; ;}
4918 break;
4919
4920 case 208:
4921#line 1992 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004922 {
4923 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
4924 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
Chris Lattnerbb856a32007-08-06 21:00:46 +00004925 CHECK_FOR_ERROR
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004926 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
4927 if (!Aliasee)
4928 GEN_ERROR("Aliases can be created only to global values");
4929
Dan Gohman54392c12008-04-19 00:24:39 +00004930 (yyval.ConstVal) = Aliasee;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004931 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004932 delete (yyvsp[(1) - (2)].TypeVal);
4933 ;}
4934 break;
4935
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004936 case 209:
4937#line 2004 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004938 {
4939 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4940 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4941 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004942 GEN_ERROR("invalid cast opcode for cast from '" +
4943 Val->getType()->getDescription() + "' to '" +
4944 DestTy->getDescription() + "'");
4945
Dan Gohman54392c12008-04-19 00:24:39 +00004946 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004947 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004948 delete (yyvsp[(5) - (6)].TypeVal);
4949 ;}
4950 break;
4951
Nate Begeman646fa482008-05-12 19:01:56 +00004952 case 210:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004953#line 2025 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004954 {
4955 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
Dale Johannesena79ecf32008-02-20 21:15:43 +00004956 CurModule.ModuleDone();
4957 CHECK_FOR_ERROR;
Dan Gohman54392c12008-04-19 00:24:39 +00004958 ;}
4959 break;
4960
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004961 case 211:
4962#line 2030 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4963 {
4964 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4965 CurModule.ModuleDone();
4966 CHECK_FOR_ERROR;
4967 ;}
Dan Gohman54392c12008-04-19 00:24:39 +00004968 break;
4969
Nate Begeman646fa482008-05-12 19:01:56 +00004970 case 214:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004971#line 2043 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4972 { CurFun.isDeclare = false; ;}
4973 break;
4974
4975 case 215:
4976#line 2043 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004977 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004978 CurFun.FunctionDone();
4979 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00004980 ;}
4981 break;
4982
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004983 case 216:
4984#line 2047 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00004985 { CurFun.isDeclare = true; ;}
4986 break;
4987
Nate Begeman646fa482008-05-12 19:01:56 +00004988 case 217:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004989#line 2047 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00004990 {
4991 CHECK_FOR_ERROR
4992 ;}
4993 break;
4994
4995 case 218:
Dale Johannesen280e7bc2008-05-14 20:13:36 +00004996#line 2050 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4997 {
4998 CHECK_FOR_ERROR
4999 ;}
5000 break;
5001
5002 case 219:
5003#line 2053 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005004 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005005 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005006 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005007 // Eagerly resolve types. This is not an optimization, this is a
5008 // requirement that is due to the fact that we could have this:
5009 //
5010 // %list = type { %list * }
5011 // %list = type { %list * } ; repeated type decl
5012 //
5013 // If types are not resolved eagerly, then the two types will not be
5014 // determined to be the same type!
5015 //
Dan Gohman54392c12008-04-19 00:24:39 +00005016 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005017
Dan Gohman54392c12008-04-19 00:24:39 +00005018 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005019 CHECK_FOR_ERROR
5020 // If this is a named type that is not a redefinition, add it to the slot
5021 // table.
Dan Gohman54392c12008-04-19 00:24:39 +00005022 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005023 }
5024
Dan Gohman54392c12008-04-19 00:24:39 +00005025 delete (yyvsp[(3) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005026 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005027 ;}
5028 break;
Reid Spenceraa8ae282007-07-31 03:50:36 +00005029
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005030 case 220:
5031#line 2077 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005032 {
5033 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
5034
5035 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005036 CHECK_FOR_ERROR
5037 // If this is a named type that is not a redefinition, add it to the slot
5038 // table.
Dan Gohman54392c12008-04-19 00:24:39 +00005039 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005040 }
5041 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005042 ;}
5043 break;
5044
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005045 case 221:
5046#line 2089 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005047 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005048 /* "Externally Visible" Linkage */
Dan Gohman54392c12008-04-19 00:24:39 +00005049 if ((yyvsp[(5) - (6)].ConstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005050 GEN_ERROR("Global value initializer is not a constant");
Dan Gohman54392c12008-04-19 00:24:39 +00005051 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5052 (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 +00005053 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005054 ;}
5055 break;
5056
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005057 case 222:
5058#line 2096 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005059 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005060 CurGV = 0;
Dan Gohman54392c12008-04-19 00:24:39 +00005061 ;}
5062 break;
5063
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005064 case 223:
5065#line 2100 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005066 {
5067 if ((yyvsp[(6) - (7)].ConstVal) == 0)
Christopher Lamb668d9a02007-12-12 08:45:45 +00005068 GEN_ERROR("Global value initializer is not a constant");
Dan Gohman54392c12008-04-19 00:24:39 +00005069 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 +00005070 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005071 ;}
5072 break;
5073
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005074 case 224:
5075#line 2105 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005076 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005077 CurGV = 0;
Dan Gohman54392c12008-04-19 00:24:39 +00005078 ;}
5079 break;
5080
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005081 case 225:
5082#line 2109 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005083 {
Christopher Lamb668d9a02007-12-12 08:45:45 +00005084 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005085 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5086 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 +00005087 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005088 delete (yyvsp[(6) - (7)].TypeVal);
5089 ;}
5090 break;
5091
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005092 case 226:
5093#line 2115 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005094 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005095 CurGV = 0;
5096 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005097 ;}
5098 break;
5099
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005100 case 227:
5101#line 2119 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005102 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005103 std::string Name;
Dan Gohman54392c12008-04-19 00:24:39 +00005104 if ((yyvsp[(1) - (5)].StrVal)) {
5105 Name = *(yyvsp[(1) - (5)].StrVal);
5106 delete (yyvsp[(1) - (5)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005107 }
5108 if (Name.empty())
5109 GEN_ERROR("Alias name cannot be empty");
5110
Dan Gohman54392c12008-04-19 00:24:39 +00005111 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005112 if (Aliasee == 0)
5113 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
5114
Dan Gohman54392c12008-04-19 00:24:39 +00005115 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005116 CurModule.CurrentModule);
Dan Gohman54392c12008-04-19 00:24:39 +00005117 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005118 InsertValue(GA, CurModule.Values);
Chris Lattner5eefce32007-09-10 23:24:14 +00005119
5120
5121 // If there was a forward reference of this alias, resolve it now.
5122
5123 ValID ID;
5124 if (!Name.empty())
5125 ID = ValID::createGlobalName(Name);
5126 else
5127 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5128
5129 if (GlobalValue *FWGV =
5130 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5131 // Replace uses of the fwdref with the actual alias.
5132 FWGV->replaceAllUsesWith(GA);
5133 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5134 GV->eraseFromParent();
5135 else
5136 cast<Function>(FWGV)->eraseFromParent();
5137 }
5138 ID.destroy();
5139
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005140 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005141 ;}
5142 break;
5143
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005144 case 228:
5145#line 2159 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005146 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005147 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005148 ;}
5149 break;
5150
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005151 case 229:
5152#line 2162 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005153 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005154 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005155 ;}
5156 break;
5157
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005158 case 230:
5159#line 2168 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005160 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005161 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
5162 if (AsmSoFar.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005163 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005164 else
Dan Gohman54392c12008-04-19 00:24:39 +00005165 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5166 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005167 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005168;}
5169 break;
5170
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005171 case 231:
5172#line 2178 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005173 {
5174 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5175 delete (yyvsp[(3) - (3)].StrVal);
5176 ;}
5177 break;
5178
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005179 case 232:
5180#line 2182 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005181 {
5182 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5183 delete (yyvsp[(3) - (3)].StrVal);
5184 ;}
5185 break;
5186
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005187 case 234:
5188#line 2189 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005189 {
5190 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5191 delete (yyvsp[(3) - (3)].StrVal);
Christopher Lamb668d9a02007-12-12 08:45:45 +00005192 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005193 ;}
5194 break;
5195
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005196 case 235:
5197#line 2194 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005198 {
5199 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5200 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer47470022007-07-31 14:41:17 +00005201 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005202 ;}
5203 break;
5204
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005205 case 236:
5206#line 2199 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005207 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005208 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005209 ;}
5210 break;
5211
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005212 case 237:
5213#line 2208 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005214 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005215 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005216 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
5217 if (*(yyvsp[(3) - (5)].TypeVal) == Type::VoidTy)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005218 GEN_ERROR("void typed arguments are invalid");
Dan Gohman54392c12008-04-19 00:24:39 +00005219 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5220 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5221 (yyvsp[(1) - (5)].ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005222 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005223 ;}
5224 break;
5225
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005226 case 238:
5227#line 2218 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005228 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005229 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005230 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
5231 if (*(yyvsp[(1) - (3)].TypeVal) == Type::VoidTy)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005232 GEN_ERROR("void typed arguments are invalid");
Dan Gohman54392c12008-04-19 00:24:39 +00005233 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5234 (yyval.ArgList) = new ArgListType;
5235 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005236 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005237 ;}
5238 break;
5239
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005240 case 239:
5241#line 2229 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005242 {
5243 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005244 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005245 ;}
5246 break;
5247
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005248 case 240:
5249#line 2233 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005250 {
5251 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005252 struct ArgListEntry E;
5253 E.Ty = new PATypeHolder(Type::VoidTy);
5254 E.Name = 0;
5255 E.Attrs = ParamAttr::None;
Dan Gohman54392c12008-04-19 00:24:39 +00005256 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005257 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005258 ;}
5259 break;
5260
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005261 case 241:
5262#line 2242 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005263 {
5264 (yyval.ArgList) = new ArgListType;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005265 struct ArgListEntry E;
5266 E.Ty = new PATypeHolder(Type::VoidTy);
5267 E.Name = 0;
5268 E.Attrs = ParamAttr::None;
Dan Gohman54392c12008-04-19 00:24:39 +00005269 (yyval.ArgList)->push_back(E);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005270 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005271 ;}
5272 break;
5273
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005274 case 242:
5275#line 2251 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005276 {
5277 (yyval.ArgList) = 0;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005278 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005279 ;}
5280 break;
5281
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005282 case 243:
5283#line 2257 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005284 {
5285 std::string FunctionName(*(yyvsp[(3) - (10)].StrVal));
5286 delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory!
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005287
5288 // Check the function result for abstractness if this is a define. We should
5289 // have no abstract types at this point
Dan Gohman54392c12008-04-19 00:24:39 +00005290 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal)))
5291 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005292
Chris Lattner73de3c02008-04-23 05:37:08 +00005293 if (!FunctionType::isValidReturnType(*(yyvsp[(2) - (10)].TypeVal)))
5294 GEN_ERROR("Invalid result type for LLVM function");
5295
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005296 std::vector<const Type*> ParamTypeList;
Chris Lattner1c8733e2008-03-12 17:45:29 +00005297 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohman54392c12008-04-19 00:24:39 +00005298 if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None)
5299 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(7) - (10)].ParamAttrs)));
5300 if ((yyvsp[(5) - (10)].ArgList)) { // If there are arguments...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005301 unsigned index = 1;
Dan Gohman54392c12008-04-19 00:24:39 +00005302 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); I != (yyvsp[(5) - (10)].ArgList)->end(); ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005303 const Type* Ty = I->Ty->get();
5304 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5305 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
5306 ParamTypeList.push_back(Ty);
Chris Lattner1c8733e2008-03-12 17:45:29 +00005307 if (Ty != Type::VoidTy && I->Attrs != ParamAttr::None)
5308 Attrs.push_back(ParamAttrsWithIndex::get(index, I->Attrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005309 }
5310 }
5311
5312 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5313 if (isVarArg) ParamTypeList.pop_back();
5314
Chris Lattner1c8733e2008-03-12 17:45:29 +00005315 PAListPtr PAL;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005316 if (!Attrs.empty())
Chris Lattner1c8733e2008-03-12 17:45:29 +00005317 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005318
Dan Gohman54392c12008-04-19 00:24:39 +00005319 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg);
Christopher Lambfb623c62007-12-17 01:17:35 +00005320 const PointerType *PFT = PointerType::getUnqual(FT);
Dan Gohman54392c12008-04-19 00:24:39 +00005321 delete (yyvsp[(2) - (10)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005322
5323 ValID ID;
5324 if (!FunctionName.empty()) {
5325 ID = ValID::createGlobalName((char*)FunctionName.c_str());
5326 } else {
5327 ID = ValID::createGlobalID(CurModule.Values.size());
5328 }
5329
5330 Function *Fn = 0;
5331 // See if this function was forward referenced. If so, recycle the object.
5332 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5333 // Move the function to the end of the list, from whereever it was
5334 // previously inserted.
5335 Fn = cast<Function>(FWRef);
Chris Lattner1c8733e2008-03-12 17:45:29 +00005336 assert(Fn->getParamAttrs().isEmpty() &&
5337 "Forward reference has parameter attributes!");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005338 CurModule.CurrentModule->getFunctionList().remove(Fn);
5339 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5340 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
5341 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005342 if (Fn->getFunctionType() != FT ) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005343 // The existing function doesn't have the same type. This is an overload
5344 // error.
5345 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005346 } else if (Fn->getParamAttrs() != PAL) {
5347 // The existing function doesn't have the same parameter attributes.
5348 // This is an overload error.
5349 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005350 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
5351 // Neither the existing or the current function is a declaration and they
5352 // have the same name and same type. Clearly this is a redefinition.
5353 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005354 } else if (Fn->isDeclaration()) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005355 // Make sure to strip off any argument names so we can't get conflicts.
5356 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5357 AI != AE; ++AI)
5358 AI->setName("");
5359 }
5360 } else { // Not already defined?
Gabor Greif89f01162008-04-06 23:07:54 +00005361 Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5362 CurModule.CurrentModule);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005363 InsertValue(Fn, CurModule.Values);
5364 }
5365
5366 CurFun.FunctionStart(Fn);
5367
5368 if (CurFun.isDeclare) {
5369 // If we have declaration, always overwrite linkage. This will allow us to
5370 // correctly handle cases, when pointer to function is passed as argument to
5371 // another function.
5372 Fn->setLinkage(CurFun.Linkage);
5373 Fn->setVisibility(CurFun.Visibility);
5374 }
Dan Gohman54392c12008-04-19 00:24:39 +00005375 Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005376 Fn->setParamAttrs(PAL);
Dan Gohman54392c12008-04-19 00:24:39 +00005377 Fn->setAlignment((yyvsp[(9) - (10)].UIntVal));
5378 if ((yyvsp[(8) - (10)].StrVal)) {
5379 Fn->setSection(*(yyvsp[(8) - (10)].StrVal));
5380 delete (yyvsp[(8) - (10)].StrVal);
Gordon Henriksen13fe5e32007-12-10 03:18:06 +00005381 }
Dan Gohman54392c12008-04-19 00:24:39 +00005382 if ((yyvsp[(10) - (10)].StrVal)) {
5383 Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str());
5384 delete (yyvsp[(10) - (10)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005385 }
5386
5387 // Add all of the arguments we parsed to the function...
Dan Gohman54392c12008-04-19 00:24:39 +00005388 if ((yyvsp[(5) - (10)].ArgList)) { // Is null if empty...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005389 if (isVarArg) { // Nuke the last entry
Dan Gohman54392c12008-04-19 00:24:39 +00005390 assert((yyvsp[(5) - (10)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (10)].ArgList)->back().Name == 0 &&
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005391 "Not a varargs marker!");
Dan Gohman54392c12008-04-19 00:24:39 +00005392 delete (yyvsp[(5) - (10)].ArgList)->back().Ty;
5393 (yyvsp[(5) - (10)].ArgList)->pop_back(); // Delete the last entry
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005394 }
5395 Function::arg_iterator ArgIt = Fn->arg_begin();
5396 Function::arg_iterator ArgEnd = Fn->arg_end();
5397 unsigned Idx = 1;
Dan Gohman54392c12008-04-19 00:24:39 +00005398 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin();
5399 I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005400 delete I->Ty; // Delete the typeholder...
5401 setValueName(ArgIt, I->Name); // Insert arg into symtab...
5402 CHECK_FOR_ERROR
5403 InsertValue(ArgIt);
5404 Idx++;
5405 }
5406
Dan Gohman54392c12008-04-19 00:24:39 +00005407 delete (yyvsp[(5) - (10)].ArgList); // We're now done with the argument list
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005408 }
5409 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005410;}
5411 break;
5412
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005413 case 246:
5414#line 2387 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005415 {
5416 (yyval.FunctionVal) = CurFun.CurrentFunction;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005417
5418 // Make sure that we keep track of the linkage type even if there was a
5419 // previous "declare".
Dan Gohman54392c12008-04-19 00:24:39 +00005420 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5421 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5422;}
5423 break;
5424
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005425 case 249:
5426#line 2398 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005427 {
5428 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005429 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005430;}
5431 break;
5432
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005433 case 250:
5434#line 2403 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005435 {
5436 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5437 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5438 (yyval.FunctionVal) = CurFun.CurrentFunction;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005439 CurFun.FunctionDone();
5440 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005441 ;}
5442 break;
5443
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005444 case 251:
5445#line 2415 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005446 {
5447 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005448 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005449 ;}
5450 break;
5451
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005452 case 252:
5453#line 2419 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005454 {
5455 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005456 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005457 ;}
5458 break;
5459
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005460 case 253:
5461#line 2424 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005462 { // A reference to a direct constant
5463 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005464 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005465 ;}
5466 break;
5467
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005468 case 254:
5469#line 2428 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005470 {
5471 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005472 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005473 ;}
5474 break;
5475
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005476 case 255:
5477#line 2432 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005478 { // Perhaps it's an FP constant?
5479 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005480 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005481 ;}
5482 break;
5483
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005484 case 256:
5485#line 2436 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005486 {
5487 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005488 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005489 ;}
5490 break;
5491
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005492 case 257:
5493#line 2440 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005494 {
5495 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005496 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005497 ;}
5498 break;
5499
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005500 case 258:
5501#line 2444 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005502 {
5503 (yyval.ValIDVal) = ValID::createNull();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005504 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005505 ;}
5506 break;
5507
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005508 case 259:
5509#line 2448 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005510 {
5511 (yyval.ValIDVal) = ValID::createUndef();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005512 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005513 ;}
5514 break;
5515
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005516 case 260:
5517#line 2452 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005518 { // A vector zero constant.
5519 (yyval.ValIDVal) = ValID::createZeroInit();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005520 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005521 ;}
5522 break;
5523
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005524 case 261:
5525#line 2456 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005526 { // Nonempty unsized packed vector
5527 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5528 int NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005529
5530 VectorType* pt = VectorType::get(ETy, NumElements);
5531 PATypeHolder* PTy = new PATypeHolder(
5532 HandleUpRefs(
5533 VectorType::get(
5534 ETy,
5535 NumElements)
5536 )
5537 );
5538
5539 // Verify all elements are correct type!
Dan Gohman54392c12008-04-19 00:24:39 +00005540 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5541 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005542 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5543 ETy->getDescription() +"' as required!\nIt is of type '" +
Dan Gohman54392c12008-04-19 00:24:39 +00005544 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005545 }
5546
Dan Gohman54392c12008-04-19 00:24:39 +00005547 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5548 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005549 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005550 ;}
5551 break;
5552
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005553 case 262:
5554#line 2481 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005555 {
5556 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005557 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005558 ;}
5559 break;
5560
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005561 case 263:
5562#line 2485 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005563 {
5564 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5565 delete (yyvsp[(3) - (5)].StrVal);
5566 delete (yyvsp[(5) - (5)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005567 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005568 ;}
5569 break;
5570
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005571 case 264:
5572#line 2495 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005573 { // Is it an integer reference...?
5574 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005575 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005576 ;}
5577 break;
5578
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005579 case 265:
5580#line 2499 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005581 {
5582 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005583 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005584 ;}
5585 break;
5586
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005587 case 266:
5588#line 2503 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005589 { // Is it a named reference...?
5590 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5591 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005592 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005593 ;}
5594 break;
5595
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005596 case 267:
5597#line 2508 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005598 { // Is it a named reference...?
5599 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5600 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005601 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005602 ;}
5603 break;
5604
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005605 case 270:
5606#line 2521 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005607 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005608 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005609 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5610 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5611 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005612 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005613 ;}
5614 break;
5615
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005616 case 271:
5617#line 2530 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005618 {
5619 (yyval.ValueList) = new std::vector<Value *>();
5620 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
Devang Patelbf507402008-02-20 22:40:23 +00005621 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005622 ;}
5623 break;
5624
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005625 case 272:
5626#line 2535 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005627 {
5628 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
Devang Patelbf507402008-02-20 22:40:23 +00005629 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005630 ;}
5631 break;
5632
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005633 case 273:
5634#line 2540 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005635 {
5636 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005637 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005638 ;}
5639 break;
5640
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005641 case 274:
5642#line 2544 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005643 { // Do not allow functions with 0 basic blocks
5644 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005645 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005646 ;}
5647 break;
5648
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005649 case 275:
5650#line 2553 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005651 {
5652 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005653 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005654 InsertValue((yyvsp[(3) - (3)].TermInstVal));
5655 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
5656 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005657 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005658 ;}
5659 break;
5660
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005661 case 276:
5662#line 2562 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005663 {
5664 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005665 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5666 if (CI2->getParent() == 0)
Dan Gohman54392c12008-04-19 00:24:39 +00005667 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
5668 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
5669 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005670 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005671 ;}
5672 break;
Chris Lattner59363a32008-02-19 04:36:25 +00005673
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005674 case 277:
5675#line 2571 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005676 { // Empty space between instruction lists
Chris Lattnere7e9b602008-05-04 17:18:47 +00005677 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
Dan Gohman54392c12008-04-19 00:24:39 +00005678 CHECK_FOR_ERROR
5679 ;}
5680 break;
5681
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005682 case 278:
5683#line 2575 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnere7e9b602008-05-04 17:18:47 +00005684 { // Labelled (named) basic block
5685 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
5686 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohman54392c12008-04-19 00:24:39 +00005687 CHECK_FOR_ERROR
Chris Lattnere7e9b602008-05-04 17:18:47 +00005688
Dan Gohman54392c12008-04-19 00:24:39 +00005689 ;}
5690 break;
5691
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005692 case 279:
5693#line 2583 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005694 { // Return with a result...
5695 ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
5696 assert(!VL.empty() && "Invalid ret operands!");
5697 (yyval.TermInstVal) = ReturnInst::Create(&VL[0], VL.size());
5698 delete (yyvsp[(2) - (2)].ValueList);
5699 CHECK_FOR_ERROR
5700 ;}
5701 break;
5702
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005703 case 280:
5704#line 2590 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005705 { // Return with no result...
5706 (yyval.TermInstVal) = ReturnInst::Create();
5707 CHECK_FOR_ERROR
5708 ;}
5709 break;
5710
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005711 case 281:
5712#line 2594 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005713 { // Unconditional Branch...
5714 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
5715 CHECK_FOR_ERROR
5716 (yyval.TermInstVal) = BranchInst::Create(tmpBB);
5717 ;}
5718 break;
5719
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005720 case 282:
5721#line 2599 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005722 {
5723 assert(cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?");
5724 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5725 CHECK_FOR_ERROR
5726 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
5727 CHECK_FOR_ERROR
5728 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
5729 CHECK_FOR_ERROR
5730 (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal);
5731 ;}
5732 break;
5733
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005734 case 283:
5735#line 2609 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005736 {
5737 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
5738 CHECK_FOR_ERROR
5739 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5740 CHECK_FOR_ERROR
5741 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
5742 (yyval.TermInstVal) = S;
5743
5744 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
5745 E = (yyvsp[(8) - (9)].JumpTable)->end();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005746 for (; I != E; ++I) {
5747 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5748 S->addCase(CI, I->second);
5749 else
5750 GEN_ERROR("Switch case is constant, but not a simple integer");
5751 }
Dan Gohman54392c12008-04-19 00:24:39 +00005752 delete (yyvsp[(8) - (9)].JumpTable);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005753 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005754 ;}
5755 break;
5756
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005757 case 284:
5758#line 2628 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005759 {
5760 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005761 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005762 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005763 CHECK_FOR_ERROR
Gabor Greif89f01162008-04-06 23:07:54 +00005764 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0);
Dan Gohman54392c12008-04-19 00:24:39 +00005765 (yyval.TermInstVal) = S;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005766 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005767 ;}
5768 break;
5769
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005770 case 285:
5771#line 2638 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005772 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005773
5774 // Handle the short syntax
5775 const PointerType *PFTy = 0;
5776 const FunctionType *Ty = 0;
Dan Gohman54392c12008-04-19 00:24:39 +00005777 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005778 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5779 // Pull out the types of all of the arguments...
5780 std::vector<const Type*> ParamTypes;
Dan Gohman54392c12008-04-19 00:24:39 +00005781 ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005782 for (; I != E; ++I) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005783 const Type *Ty = I->Val->getType();
5784 if (Ty == Type::VoidTy)
5785 GEN_ERROR("Short call syntax cannot be used with varargs");
5786 ParamTypes.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005787 }
Chris Lattner73de3c02008-04-23 05:37:08 +00005788
5789 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (14)].TypeVal)))
5790 GEN_ERROR("Invalid result type for LLVM function");
5791
Dan Gohman54392c12008-04-19 00:24:39 +00005792 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
Christopher Lambfb623c62007-12-17 01:17:35 +00005793 PFTy = PointerType::getUnqual(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005794 }
5795
Dan Gohman54392c12008-04-19 00:24:39 +00005796 delete (yyvsp[(3) - (14)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005797
Dan Gohman54392c12008-04-19 00:24:39 +00005798 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005799 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005800 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005801 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005802 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005803 CHECK_FOR_ERROR
5804
Chris Lattner1c8733e2008-03-12 17:45:29 +00005805 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohman54392c12008-04-19 00:24:39 +00005806 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None)
5807 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (14)].ParamAttrs)));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005808
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005809 // Check the arguments
5810 ValueList Args;
Dan Gohman54392c12008-04-19 00:24:39 +00005811 if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005812 // Make sure no arguments is a good thing!
5813 if (Ty->getNumParams() != 0)
5814 GEN_ERROR("No arguments passed to a function that "
5815 "expects arguments");
5816 } else { // Has arguments?
5817 // Loop through FunctionType's arguments and ensure they are specified
5818 // correctly!
5819 FunctionType::param_iterator I = Ty->param_begin();
5820 FunctionType::param_iterator E = Ty->param_end();
Dan Gohman54392c12008-04-19 00:24:39 +00005821 ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005822 unsigned index = 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005823
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005824 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005825 if (ArgI->Val->getType() != *I)
5826 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
5827 (*I)->getDescription() + "'");
5828 Args.push_back(ArgI->Val);
Chris Lattner1c8733e2008-03-12 17:45:29 +00005829 if (ArgI->Attrs != ParamAttr::None)
5830 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005831 }
5832
5833 if (Ty->isVarArg()) {
5834 if (I == E)
Chris Lattner59363a32008-02-19 04:36:25 +00005835 for (; ArgI != ArgE; ++ArgI, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005836 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner1c8733e2008-03-12 17:45:29 +00005837 if (ArgI->Attrs != ParamAttr::None)
5838 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Chris Lattner59363a32008-02-19 04:36:25 +00005839 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005840 } else if (I != E || ArgI != ArgE)
5841 GEN_ERROR("Invalid number of parameters detected");
5842 }
5843
Chris Lattner1c8733e2008-03-12 17:45:29 +00005844 PAListPtr PAL;
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005845 if (!Attrs.empty())
Chris Lattner1c8733e2008-03-12 17:45:29 +00005846 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005847
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005848 // Create the InvokeInst
Gabor Greif89f01162008-04-06 23:07:54 +00005849 InvokeInst *II = InvokeInst::Create(V, Normal, Except, Args.begin(),Args.end());
Dan Gohman54392c12008-04-19 00:24:39 +00005850 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005851 II->setParamAttrs(PAL);
Dan Gohman54392c12008-04-19 00:24:39 +00005852 (yyval.TermInstVal) = II;
5853 delete (yyvsp[(6) - (14)].ParamList);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005854 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005855 ;}
5856 break;
5857
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005858 case 286:
5859#line 2722 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005860 {
5861 (yyval.TermInstVal) = new UnwindInst();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005862 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005863 ;}
5864 break;
5865
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005866 case 287:
5867#line 2726 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005868 {
5869 (yyval.TermInstVal) = new UnreachableInst();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005870 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005871 ;}
5872 break;
5873
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005874 case 288:
5875#line 2733 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005876 {
5877 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
5878 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005879 CHECK_FOR_ERROR
5880 if (V == 0)
5881 GEN_ERROR("May only switch on a constant pool value");
5882
Dan Gohman54392c12008-04-19 00:24:39 +00005883 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005884 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005885 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5886 ;}
5887 break;
5888
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005889 case 289:
5890#line 2744 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005891 {
5892 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5893 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005894 CHECK_FOR_ERROR
5895
5896 if (V == 0)
5897 GEN_ERROR("May only switch on a constant pool value");
5898
Dan Gohman54392c12008-04-19 00:24:39 +00005899 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005900 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005901 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5902 ;}
5903 break;
5904
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005905 case 290:
5906#line 2757 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005907 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005908 // Is this definition named?? if so, assign the name...
Dan Gohman54392c12008-04-19 00:24:39 +00005909 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005910 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005911 InsertValue((yyvsp[(2) - (2)].InstVal));
5912 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005913 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005914 ;}
5915 break;
5916
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005917 case 291:
5918#line 2767 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005919 { // Used for PHI nodes
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005920 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005921 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
5922 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5923 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005924 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005925 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005926 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005927 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5928 delete (yyvsp[(1) - (6)].TypeVal);
5929 ;}
5930 break;
5931
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005932 case 292:
5933#line 2778 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005934 {
5935 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
5936 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005937 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005938 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005939 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005940 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5941 ;}
5942 break;
5943
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005944 case 293:
5945#line 2788 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005946 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005947 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005948 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005949 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005950 // Used for call and invoke instructions
Dan Gohman54392c12008-04-19 00:24:39 +00005951 (yyval.ParamList) = new ParamList();
5952 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
5953 (yyval.ParamList)->push_back(E);
5954 delete (yyvsp[(1) - (4)].TypeVal);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005955 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005956 ;}
5957 break;
5958
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005959 case 294:
5960#line 2799 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005961 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005962 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dale Johannesencfb19e62007-11-05 21:20:28 +00005963 // Labels are only valid in ASMs
Dan Gohman54392c12008-04-19 00:24:39 +00005964 (yyval.ParamList) = new ParamList();
5965 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
5966 (yyval.ParamList)->push_back(E);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005967 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005968 ;}
5969 break;
5970
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005971 case 295:
5972#line 2807 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005973 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005974 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005975 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00005976 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5977 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5978 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
5979 (yyval.ParamList)->push_back(E);
5980 delete (yyvsp[(3) - (6)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005981 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005982 ;}
5983 break;
5984
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005985 case 296:
5986#line 2817 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005987 {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00005988 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dan Gohman54392c12008-04-19 00:24:39 +00005989 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5990 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
5991 (yyval.ParamList)->push_back(E);
Dale Johannesencfb19e62007-11-05 21:20:28 +00005992 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00005993 ;}
5994 break;
5995
Dale Johannesen280e7bc2008-05-14 20:13:36 +00005996 case 297:
5997#line 2824 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00005998 { (yyval.ParamList) = new ParamList(); ;}
5999 break;
6000
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006001 case 298:
6002#line 2827 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006003 { (yyval.ValueList) = new std::vector<Value*>(); ;}
6004 break;
6005
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006006 case 299:
6007#line 2828 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006008 {
6009 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
6010 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006011 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006012 ;}
6013 break;
6014
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006015 case 300:
6016#line 2835 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006017 {
6018 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006019 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006020 ;}
6021 break;
6022
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006023 case 301:
6024#line 2839 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006025 {
6026 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006027 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006028 ;}
6029 break;
6030
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006031 case 302:
6032#line 2844 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006033 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006034 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006035 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6036 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
6037 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006038 GEN_ERROR(
6039 "Arithmetic operator requires integer, FP, or packed operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006040 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006041 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006042 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006043 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006044 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
6045 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006046 GEN_ERROR("binary operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006047 delete (yyvsp[(2) - (5)].TypeVal);
6048 ;}
6049 break;
6050
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006051 case 303:
6052#line 2860 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006053 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006054 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006055 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6056 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
6057 if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
6058 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006059 GEN_ERROR("Logical operator requires integral operands");
6060 }
Dan Gohman54392c12008-04-19 00:24:39 +00006061 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006062 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006063 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006064 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006065 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
6066 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006067 GEN_ERROR("binary operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006068 delete (yyvsp[(2) - (5)].TypeVal);
6069 ;}
6070 break;
6071
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006072 case 304:
6073#line 2877 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006074 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006075 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006076 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6077 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006078 GEN_ERROR("Vector types not supported by icmp instruction");
Dan Gohman54392c12008-04-19 00:24:39 +00006079 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006080 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006081 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006082 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006083 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
6084 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006085 GEN_ERROR("icmp operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006086 delete (yyvsp[(3) - (6)].TypeVal);
6087 ;}
6088 break;
6089
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006090 case 305:
6091#line 2891 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006092 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006093 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006094 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6095 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006096 GEN_ERROR("Vector types not supported by fcmp instruction");
Dan Gohman54392c12008-04-19 00:24:39 +00006097 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006098 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006099 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006100 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006101 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
6102 if ((yyval.InstVal) == 0)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006103 GEN_ERROR("fcmp operator returned null");
Dan Gohman54392c12008-04-19 00:24:39 +00006104 delete (yyvsp[(3) - (6)].TypeVal);
6105 ;}
6106 break;
6107
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006108 case 306:
6109#line 2905 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00006110 {
6111 if (!UpRefs.empty())
6112 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6113 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6114 GEN_ERROR("Scalar types not supported by vicmp instruction");
6115 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6116 CHECK_FOR_ERROR
6117 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6118 CHECK_FOR_ERROR
6119 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
6120 if ((yyval.InstVal) == 0)
6121 GEN_ERROR("icmp operator returned null");
6122 delete (yyvsp[(3) - (6)].TypeVal);
6123 ;}
6124 break;
6125
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006126 case 307:
6127#line 2919 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begeman646fa482008-05-12 19:01:56 +00006128 {
6129 if (!UpRefs.empty())
6130 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6131 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6132 GEN_ERROR("Scalar types not supported by vfcmp instruction");
6133 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6134 CHECK_FOR_ERROR
6135 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6136 CHECK_FOR_ERROR
6137 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
6138 if ((yyval.InstVal) == 0)
6139 GEN_ERROR("fcmp operator returned null");
6140 delete (yyvsp[(3) - (6)].TypeVal);
6141 ;}
6142 break;
6143
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006144 case 308:
6145#line 2933 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006146 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006147 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006148 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6149 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6150 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6151 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006152 GEN_ERROR("invalid cast opcode for cast from '" +
6153 Val->getType()->getDescription() + "' to '" +
6154 DestTy->getDescription() + "'");
Dan Gohman54392c12008-04-19 00:24:39 +00006155 (yyval.InstVal) = CastInst::create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
6156 delete (yyvsp[(4) - (4)].TypeVal);
6157 ;}
6158 break;
6159
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006160 case 309:
6161#line 2945 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006162 {
6163 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006164 GEN_ERROR("select condition must be boolean");
Dan Gohman54392c12008-04-19 00:24:39 +00006165 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006166 GEN_ERROR("select value types should match");
Dan Gohman54392c12008-04-19 00:24:39 +00006167 (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006168 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006169 ;}
6170 break;
6171
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006172 case 310:
6173#line 2953 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006174 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006175 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006176 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6177 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6178 delete (yyvsp[(4) - (4)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006179 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006180 ;}
6181 break;
6182
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006183 case 311:
6184#line 2960 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006185 {
6186 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006187 GEN_ERROR("Invalid extractelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006188 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006189 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006190 ;}
6191 break;
6192
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006193 case 312:
6194#line 2966 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006195 {
6196 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006197 GEN_ERROR("Invalid insertelement operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006198 (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006199 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006200 ;}
6201 break;
6202
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006203 case 313:
6204#line 2972 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006205 {
6206 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006207 GEN_ERROR("Invalid shufflevector operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006208 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006209 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006210 ;}
6211 break;
6212
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006213 case 314:
6214#line 2978 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006215 {
6216 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006217 if (!Ty->isFirstClassType())
6218 GEN_ERROR("PHI node operands must be of first class type");
Dan Gohman54392c12008-04-19 00:24:39 +00006219 (yyval.InstVal) = PHINode::Create(Ty);
6220 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6221 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6222 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006223 GEN_ERROR("All elements of a PHI node must be of the same type");
Dan Gohman54392c12008-04-19 00:24:39 +00006224 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6225 (yyvsp[(2) - (2)].PHIList)->pop_front();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006226 }
Dan Gohman54392c12008-04-19 00:24:39 +00006227 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006228 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006229 ;}
6230 break;
6231
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006232 case 315:
6233#line 2994 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006234 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006235
6236 // Handle the short syntax
6237 const PointerType *PFTy = 0;
6238 const FunctionType *Ty = 0;
Dan Gohman54392c12008-04-19 00:24:39 +00006239 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006240 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6241 // Pull out the types of all of the arguments...
6242 std::vector<const Type*> ParamTypes;
Dan Gohman54392c12008-04-19 00:24:39 +00006243 ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006244 for (; I != E; ++I) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006245 const Type *Ty = I->Val->getType();
6246 if (Ty == Type::VoidTy)
6247 GEN_ERROR("Short call syntax cannot be used with varargs");
6248 ParamTypes.push_back(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006249 }
Chris Lattner73de3c02008-04-23 05:37:08 +00006250
6251 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (8)].TypeVal)))
6252 GEN_ERROR("Invalid result type for LLVM function");
6253
Dan Gohman54392c12008-04-19 00:24:39 +00006254 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
Christopher Lambfb623c62007-12-17 01:17:35 +00006255 PFTy = PointerType::getUnqual(Ty);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006256 }
6257
Dan Gohman54392c12008-04-19 00:24:39 +00006258 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006259 CHECK_FOR_ERROR
6260
6261 // Check for call to invalid intrinsic to avoid crashing later.
6262 if (Function *theF = dyn_cast<Function>(V)) {
6263 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
6264 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6265 !theF->getIntrinsicID(true))
6266 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6267 theF->getName() + "'");
6268 }
6269
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006270 // Set up the ParamAttrs for the function
Chris Lattner1c8733e2008-03-12 17:45:29 +00006271 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohman54392c12008-04-19 00:24:39 +00006272 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None)
6273 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (8)].ParamAttrs)));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006274 // Check the arguments
6275 ValueList Args;
Dan Gohman54392c12008-04-19 00:24:39 +00006276 if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments?
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006277 // Make sure no arguments is a good thing!
6278 if (Ty->getNumParams() != 0)
6279 GEN_ERROR("No arguments passed to a function that "
6280 "expects arguments");
6281 } else { // Has arguments?
6282 // Loop through FunctionType's arguments and ensure they are specified
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006283 // correctly. Also, gather any parameter attributes.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006284 FunctionType::param_iterator I = Ty->param_begin();
6285 FunctionType::param_iterator E = Ty->param_end();
Dan Gohman54392c12008-04-19 00:24:39 +00006286 ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006287 unsigned index = 1;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006288
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006289 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006290 if (ArgI->Val->getType() != *I)
6291 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
6292 (*I)->getDescription() + "'");
6293 Args.push_back(ArgI->Val);
Chris Lattner1c8733e2008-03-12 17:45:29 +00006294 if (ArgI->Attrs != ParamAttr::None)
6295 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006296 }
6297 if (Ty->isVarArg()) {
6298 if (I == E)
Chris Lattner59363a32008-02-19 04:36:25 +00006299 for (; ArgI != ArgE; ++ArgI, ++index) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006300 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner1c8733e2008-03-12 17:45:29 +00006301 if (ArgI->Attrs != ParamAttr::None)
6302 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Chris Lattner59363a32008-02-19 04:36:25 +00006303 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006304 } else if (I != E || ArgI != ArgE)
6305 GEN_ERROR("Invalid number of parameters detected");
6306 }
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006307
6308 // Finish off the ParamAttrs and check them
Chris Lattner1c8733e2008-03-12 17:45:29 +00006309 PAListPtr PAL;
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006310 if (!Attrs.empty())
Chris Lattner1c8733e2008-03-12 17:45:29 +00006311 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006312
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006313 // Create the call node
Gabor Greif89f01162008-04-06 23:07:54 +00006314 CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
Dan Gohman54392c12008-04-19 00:24:39 +00006315 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6316 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006317 CI->setParamAttrs(PAL);
Dan Gohman54392c12008-04-19 00:24:39 +00006318 (yyval.InstVal) = CI;
6319 delete (yyvsp[(6) - (8)].ParamList);
6320 delete (yyvsp[(3) - (8)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006321 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006322 ;}
6323 break;
6324
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006325 case 316:
6326#line 3083 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006327 {
6328 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006329 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006330 ;}
6331 break;
6332
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006333 case 317:
6334#line 3088 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006335 {
6336 (yyval.BoolVal) = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006337 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006338 ;}
6339 break;
6340
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006341 case 318:
6342#line 3092 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006343 {
6344 (yyval.BoolVal) = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006345 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006346 ;}
6347 break;
6348
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006349 case 319:
6350#line 3099 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006351 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006352 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006353 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6354 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6355 delete (yyvsp[(2) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006356 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006357 ;}
6358 break;
6359
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006360 case 320:
6361#line 3106 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006362 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006363 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006364 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6365 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006366 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006367 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6368 delete (yyvsp[(2) - (6)].TypeVal);
6369 ;}
6370 break;
6371
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006372 case 321:
6373#line 3114 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006374 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006375 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006376 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6377 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6378 delete (yyvsp[(2) - (3)].TypeVal);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006379 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006380 ;}
6381 break;
6382
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006383 case 322:
6384#line 3121 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006385 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006386 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006387 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6388 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006389 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006390 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6391 delete (yyvsp[(2) - (6)].TypeVal);
6392 ;}
6393 break;
6394
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006395 case 323:
6396#line 3129 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006397 {
6398 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006399 GEN_ERROR("Trying to free nonpointer type " +
Dan Gohman54392c12008-04-19 00:24:39 +00006400 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6401 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006402 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006403 ;}
6404 break;
6405
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006406 case 324:
6407#line 3137 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006408 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006409 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006410 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6411 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006412 GEN_ERROR("Can't load from nonpointer type: " +
Dan Gohman54392c12008-04-19 00:24:39 +00006413 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6414 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006415 GEN_ERROR("Can't load from pointer of non-first-class type: " +
Dan Gohman54392c12008-04-19 00:24:39 +00006416 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6417 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006418 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006419 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6420 delete (yyvsp[(3) - (5)].TypeVal);
6421 ;}
6422 break;
6423
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006424 case 325:
6425#line 3151 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006426 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006427 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006428 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6429 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006430 if (!PT)
6431 GEN_ERROR("Can't store to a nonpointer type: " +
Dan Gohman54392c12008-04-19 00:24:39 +00006432 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006433 const Type *ElTy = PT->getElementType();
Dan Gohman54392c12008-04-19 00:24:39 +00006434 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6435 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006436 "' into space of type '" + ElTy->getDescription() + "'");
6437
Dan Gohman54392c12008-04-19 00:24:39 +00006438 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006439 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006440 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6441 delete (yyvsp[(5) - (7)].TypeVal);
6442 ;}
6443 break;
6444
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006445 case 326:
6446#line 3168 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006447 {
6448 Value *TmpVal = getVal((yyvsp[(2) - (5)].TypeVal)->get(), (yyvsp[(3) - (5)].ValIDVal));
6449 if (!GetResultInst::isValidOperands(TmpVal, (yyvsp[(5) - (5)].UInt64Val)))
Devang Patel3b8849c2008-02-19 22:27:01 +00006450 GEN_ERROR("Invalid getresult operands");
Dan Gohman54392c12008-04-19 00:24:39 +00006451 (yyval.InstVal) = new GetResultInst(TmpVal, (yyvsp[(5) - (5)].UInt64Val));
6452 delete (yyvsp[(2) - (5)].TypeVal);
Devang Patel3b8849c2008-02-19 22:27:01 +00006453 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006454 ;}
6455 break;
6456
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006457 case 327:
6458#line 3176 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman54392c12008-04-19 00:24:39 +00006459 {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006460 if (!UpRefs.empty())
Dan Gohman54392c12008-04-19 00:24:39 +00006461 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6462 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006463 GEN_ERROR("getelementptr insn requires pointer operand");
6464
Dan Gohman54392c12008-04-19 00:24:39 +00006465 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 +00006466 GEN_ERROR("Invalid getelementptr indices for type '" +
Dan Gohman54392c12008-04-19 00:24:39 +00006467 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6468 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006469 CHECK_FOR_ERROR
Dan Gohman54392c12008-04-19 00:24:39 +00006470 (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6471 delete (yyvsp[(2) - (4)].TypeVal);
6472 delete (yyvsp[(4) - (4)].ValueList);
6473 ;}
6474 break;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006475
Dan Gohman54392c12008-04-19 00:24:39 +00006476
6477/* Line 1267 of yacc.c. */
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006478#line 6479 "llvmAsmParser.tab.c"
Dan Gohman54392c12008-04-19 00:24:39 +00006479 default: break;
Dale Johannesen3afee192007-09-07 21:07:57 +00006480 }
Dan Gohman54392c12008-04-19 00:24:39 +00006481 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6482
6483 YYPOPSTACK (yylen);
6484 yylen = 0;
6485 YY_STACK_PRINT (yyss, yyssp);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006486
6487 *++yyvsp = yyval;
6488
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006489
Dan Gohman54392c12008-04-19 00:24:39 +00006490 /* Now `shift' the result of the reduction. Determine what state
6491 that goes to, based on the state we popped back to and the rule
6492 number reduced by. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006493
6494 yyn = yyr1[yyn];
6495
Dan Gohman54392c12008-04-19 00:24:39 +00006496 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6497 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006498 yystate = yytable[yystate];
6499 else
Dan Gohman54392c12008-04-19 00:24:39 +00006500 yystate = yydefgoto[yyn - YYNTOKENS];
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006501
6502 goto yynewstate;
6503
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006504
Dan Gohman54392c12008-04-19 00:24:39 +00006505/*------------------------------------.
6506| yyerrlab -- here on detecting error |
6507`------------------------------------*/
6508yyerrlab:
6509 /* If not already recovering from an error, report this error. */
6510 if (!yyerrstatus)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006511 {
6512 ++yynerrs;
Dan Gohman54392c12008-04-19 00:24:39 +00006513#if ! YYERROR_VERBOSE
6514 yyerror (YY_("syntax error"));
6515#else
6516 {
6517 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
6518 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
6519 {
6520 YYSIZE_T yyalloc = 2 * yysize;
6521 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
6522 yyalloc = YYSTACK_ALLOC_MAXIMUM;
6523 if (yymsg != yymsgbuf)
6524 YYSTACK_FREE (yymsg);
6525 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
6526 if (yymsg)
6527 yymsg_alloc = yyalloc;
6528 else
6529 {
6530 yymsg = yymsgbuf;
6531 yymsg_alloc = sizeof yymsgbuf;
6532 }
6533 }
Dale Johannesen3afee192007-09-07 21:07:57 +00006534
Dan Gohman54392c12008-04-19 00:24:39 +00006535 if (0 < yysize && yysize <= yymsg_alloc)
6536 {
6537 (void) yysyntax_error (yymsg, yystate, yychar);
6538 yyerror (yymsg);
6539 }
6540 else
6541 {
6542 yyerror (YY_("syntax error"));
6543 if (yysize != 0)
6544 goto yyexhaustedlab;
6545 }
6546 }
6547#endif
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006548 }
6549
Dan Gohman54392c12008-04-19 00:24:39 +00006550
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006551
6552 if (yyerrstatus == 3)
6553 {
Dan Gohman54392c12008-04-19 00:24:39 +00006554 /* If just tried and failed to reuse look-ahead token after an
6555 error, discard it. */
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006556
Dan Gohman54392c12008-04-19 00:24:39 +00006557 if (yychar <= YYEOF)
6558 {
6559 /* Return failure if at end of input. */
6560 if (yychar == YYEOF)
6561 YYABORT;
6562 }
6563 else
6564 {
6565 yydestruct ("Error: discarding",
6566 yytoken, &yylval);
6567 yychar = YYEMPTY;
6568 }
6569 }
6570
6571 /* Else will try to reuse look-ahead token after shifting the error
6572 token. */
6573 goto yyerrlab1;
6574
6575
6576/*---------------------------------------------------.
6577| yyerrorlab -- error raised explicitly by YYERROR. |
6578`---------------------------------------------------*/
6579yyerrorlab:
6580
6581 /* Pacify compilers like GCC when the user code never invokes
6582 YYERROR and the label yyerrorlab therefore never appears in user
6583 code. */
6584 if (/*CONSTCOND*/ 0)
6585 goto yyerrorlab;
6586
6587 /* Do not reclaim the symbols of the rule which action triggered
6588 this YYERROR. */
6589 YYPOPSTACK (yylen);
6590 yylen = 0;
6591 YY_STACK_PRINT (yyss, yyssp);
6592 yystate = *yyssp;
6593 goto yyerrlab1;
6594
6595
6596/*-------------------------------------------------------------.
6597| yyerrlab1 -- common code for both syntax error and YYERROR. |
6598`-------------------------------------------------------------*/
6599yyerrlab1:
6600 yyerrstatus = 3; /* Each real token shifted decrements this. */
6601
6602 for (;;)
6603 {
6604 yyn = yypact[yystate];
6605 if (yyn != YYPACT_NINF)
6606 {
6607 yyn += YYTERROR;
6608 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6609 {
6610 yyn = yytable[yyn];
6611 if (0 < yyn)
6612 break;
6613 }
6614 }
6615
6616 /* Pop the current state because it cannot handle the error token. */
6617 if (yyssp == yyss)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006618 YYABORT;
6619
Dale Johannesen3afee192007-09-07 21:07:57 +00006620
Dan Gohman54392c12008-04-19 00:24:39 +00006621 yydestruct ("Error: popping",
6622 yystos[yystate], yyvsp);
6623 YYPOPSTACK (1);
6624 yystate = *yyssp;
6625 YY_STACK_PRINT (yyss, yyssp);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006626 }
6627
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006628 if (yyn == YYFINAL)
6629 YYACCEPT;
6630
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006631 *++yyvsp = yylval;
Dan Gohman54392c12008-04-19 00:24:39 +00006632
6633
6634 /* Shift the error token. */
6635 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spenceraa8ae282007-07-31 03:50:36 +00006636
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006637 yystate = yyn;
6638 goto yynewstate;
6639
Gabor Greif89f01162008-04-06 23:07:54 +00006640
Dan Gohman54392c12008-04-19 00:24:39 +00006641/*-------------------------------------.
6642| yyacceptlab -- YYACCEPT comes here. |
6643`-------------------------------------*/
6644yyacceptlab:
6645 yyresult = 0;
6646 goto yyreturn;
6647
6648/*-----------------------------------.
6649| yyabortlab -- YYABORT comes here. |
6650`-----------------------------------*/
6651yyabortlab:
6652 yyresult = 1;
6653 goto yyreturn;
6654
6655#ifndef yyoverflow
6656/*-------------------------------------------------.
6657| yyexhaustedlab -- memory exhaustion comes here. |
6658`-------------------------------------------------*/
6659yyexhaustedlab:
6660 yyerror (YY_("memory exhausted"));
6661 yyresult = 2;
6662 /* Fall through. */
Chris Lattner59363a32008-02-19 04:36:25 +00006663#endif
Dan Gohman54392c12008-04-19 00:24:39 +00006664
6665yyreturn:
6666 if (yychar != YYEOF && yychar != YYEMPTY)
6667 yydestruct ("Cleanup: discarding lookahead",
6668 yytoken, &yylval);
6669 /* Do not reclaim the symbols of the rule which action triggered
6670 this YYABORT or YYACCEPT. */
6671 YYPOPSTACK (yylen);
6672 YY_STACK_PRINT (yyss, yyssp);
6673 while (yyssp != yyss)
6674 {
6675 yydestruct ("Cleanup: popping",
6676 yystos[*yyssp], yyvsp);
6677 YYPOPSTACK (1);
Gabor Greif89f01162008-04-06 23:07:54 +00006678 }
Dan Gohman54392c12008-04-19 00:24:39 +00006679#ifndef yyoverflow
6680 if (yyss != yyssa)
6681 YYSTACK_FREE (yyss);
6682#endif
6683#if YYERROR_VERBOSE
6684 if (yymsg != yymsgbuf)
6685 YYSTACK_FREE (yymsg);
6686#endif
6687 /* Make sure YYID is used. */
6688 return YYID (yyresult);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006689}
Dan Gohman54392c12008-04-19 00:24:39 +00006690
6691
Dale Johannesen280e7bc2008-05-14 20:13:36 +00006692#line 3193 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006693
6694
6695// common code from the two 'RunVMAsmParser' functions
6696static Module* RunParser(Module * M) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006697 CurModule.CurrentModule = M;
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006698 // Check to make sure the parser succeeded
6699 if (yyparse()) {
6700 if (ParserResult)
6701 delete ParserResult;
6702 return 0;
6703 }
6704
6705 // Emit an error if there are any unresolved types left.
6706 if (!CurModule.LateResolveTypes.empty()) {
6707 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6708 if (DID.Type == ValID::LocalName) {
6709 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6710 } else {
6711 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
6712 }
6713 if (ParserResult)
6714 delete ParserResult;
6715 return 0;
6716 }
6717
6718 // Emit an error if there are any unresolved values left.
6719 if (!CurModule.LateResolveValues.empty()) {
6720 Value *V = CurModule.LateResolveValues.back();
6721 std::map<Value*, std::pair<ValID, int> >::iterator I =
6722 CurModule.PlaceHolderInfo.find(V);
6723
6724 if (I != CurModule.PlaceHolderInfo.end()) {
6725 ValID &DID = I->second.first;
6726 if (DID.Type == ValID::LocalName) {
6727 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
6728 } else {
6729 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
6730 }
6731 if (ParserResult)
6732 delete ParserResult;
6733 return 0;
6734 }
6735 }
6736
6737 // Check to make sure that parsing produced a result
6738 if (!ParserResult)
6739 return 0;
6740
6741 // Reset ParserResult variable while saving its value for the result.
6742 Module *Result = ParserResult;
6743 ParserResult = 0;
6744
6745 return Result;
6746}
6747
6748void llvm::GenerateError(const std::string &message, int LineNo) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006749 if (LineNo == -1) LineNo = LLLgetLineNo();
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006750 // TODO: column number in exception
6751 if (TheParseError)
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006752 TheParseError->setError(LLLgetFilename(), message, LineNo);
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006753 TriggerError = 1;
6754}
6755
6756int yyerror(const char *ErrorMsg) {
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006757 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006758 std::string errMsg = where + "error: " + std::string(ErrorMsg);
Duncan Sandsf5588dc2007-11-27 13:23:08 +00006759 if (yychar != YYEMPTY && yychar != 0) {
6760 errMsg += " while reading token: '";
6761 errMsg += std::string(LLLgetTokenStart(),
6762 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
6763 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006764 GenerateError(errMsg);
6765 return 0;
6766}
Dan Gohman54392c12008-04-19 00:24:39 +00006767