blob: 0381d12511896a7fb6645da67bd833ce259f6865 [file] [log] [blame]
Dan Gohmanf4423b12008-04-19 00:24:39 +00001/* A Bison parser, made by GNU Bison 2.3. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002
Dan Gohmanf4423b12008-04-19 00:24:39 +00003/* Skeleton implementation for Bison's Yacc-like parsers in C
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004
Dan Gohmanf4423b12008-04-19 00:24:39 +00005 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
Anton Korobeynikov178a3522007-01-12 19:22:51 +00007
Dan Gohmanf4423b12008-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. */
Reid Spencer68a24bd2005-08-27 18:50:39 +000062#define yyparse llvmAsmparse
Dan Gohmanf4423b12008-04-19 00:24:39 +000063#define yylex llvmAsmlex
Reid Spencer68a24bd2005-08-27 18:50:39 +000064#define yyerror llvmAsmerror
Dan Gohmanf4423b12008-04-19 00:24:39 +000065#define yylval llvmAsmlval
66#define yychar llvmAsmchar
Reid Spencer68a24bd2005-08-27 18:50:39 +000067#define yydebug llvmAsmdebug
68#define yynerrs llvmAsmnerrs
69
Dan Gohmanf4423b12008-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 Johannesenc7071cc2008-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,
Dale Johannesendfe8c842008-09-26 19:32:34 +0000142 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 EXTRACTVALUE = 394,
214 INSERTVALUE = 395,
215 SIGNEXT = 396,
216 ZEROEXT = 397,
217 NORETURN = 398,
218 INREG = 399,
219 SRET = 400,
220 NOUNWIND = 401,
221 NOALIAS = 402,
222 BYVAL = 403,
223 NEST = 404,
224 READNONE = 405,
225 READONLY = 406,
226 GC = 407,
Devang Patel652203f2008-09-29 20:49:50 +0000227 OPTSIZE = 408,
228 NOINLINE = 409,
229 ALWAYSINLINE = 410,
230 DEFAULT = 411,
231 HIDDEN = 412,
232 PROTECTED = 413
Dan Gohmanf4423b12008-04-19 00:24:39 +0000233 };
234#endif
235/* Tokens. */
236#define ESINT64VAL 258
237#define EUINT64VAL 259
238#define ESAPINTVAL 260
239#define EUAPINTVAL 261
240#define LOCALVAL_ID 262
241#define GLOBALVAL_ID 263
242#define FPVAL 264
243#define VOID 265
244#define INTTYPE 266
245#define FLOAT 267
246#define DOUBLE 268
247#define X86_FP80 269
248#define FP128 270
249#define PPC_FP128 271
250#define LABEL 272
251#define TYPE 273
252#define LOCALVAR 274
253#define GLOBALVAR 275
254#define LABELSTR 276
255#define STRINGCONSTANT 277
256#define ATSTRINGCONSTANT 278
257#define PCTSTRINGCONSTANT 279
258#define ZEROINITIALIZER 280
259#define TRUETOK 281
260#define FALSETOK 282
261#define BEGINTOK 283
262#define ENDTOK 284
263#define DECLARE 285
264#define DEFINE 286
265#define GLOBAL 287
266#define CONSTANT 288
267#define SECTION 289
268#define ALIAS 290
269#define VOLATILE 291
270#define THREAD_LOCAL 292
271#define TO 293
272#define DOTDOTDOT 294
273#define NULL_TOK 295
274#define UNDEF 296
275#define INTERNAL 297
276#define LINKONCE 298
277#define WEAK 299
278#define APPENDING 300
279#define DLLIMPORT 301
280#define DLLEXPORT 302
281#define EXTERN_WEAK 303
Dale Johannesenc7071cc2008-05-14 20:13:36 +0000282#define COMMON 304
283#define OPAQUE 305
284#define EXTERNAL 306
285#define TARGET 307
286#define TRIPLE 308
287#define ALIGN 309
288#define ADDRSPACE 310
289#define DEPLIBS 311
290#define CALL 312
291#define TAIL 313
292#define ASM_TOK 314
293#define MODULE 315
294#define SIDEEFFECT 316
295#define CC_TOK 317
296#define CCC_TOK 318
297#define FASTCC_TOK 319
298#define COLDCC_TOK 320
299#define X86_STDCALLCC_TOK 321
300#define X86_FASTCALLCC_TOK 322
Dale Johannesendfe8c842008-09-26 19:32:34 +0000301#define DATALAYOUT 323
302#define RET 324
303#define BR 325
304#define SWITCH 326
305#define INVOKE 327
306#define UNWIND 328
307#define UNREACHABLE 329
308#define ADD 330
309#define SUB 331
310#define MUL 332
311#define UDIV 333
312#define SDIV 334
313#define FDIV 335
314#define UREM 336
315#define SREM 337
316#define FREM 338
317#define AND 339
318#define OR 340
319#define XOR 341
320#define SHL 342
321#define LSHR 343
322#define ASHR 344
323#define ICMP 345
324#define FCMP 346
325#define VICMP 347
326#define VFCMP 348
327#define EQ 349
328#define NE 350
329#define SLT 351
330#define SGT 352
331#define SLE 353
332#define SGE 354
333#define ULT 355
334#define UGT 356
335#define ULE 357
336#define UGE 358
337#define OEQ 359
338#define ONE 360
339#define OLT 361
340#define OGT 362
341#define OLE 363
342#define OGE 364
343#define ORD 365
344#define UNO 366
345#define UEQ 367
346#define UNE 368
347#define MALLOC 369
348#define ALLOCA 370
349#define FREE 371
350#define LOAD 372
351#define STORE 373
352#define GETELEMENTPTR 374
353#define TRUNC 375
354#define ZEXT 376
355#define SEXT 377
356#define FPTRUNC 378
357#define FPEXT 379
358#define BITCAST 380
359#define UITOFP 381
360#define SITOFP 382
361#define FPTOUI 383
362#define FPTOSI 384
363#define INTTOPTR 385
364#define PTRTOINT 386
365#define PHI_TOK 387
366#define SELECT 388
367#define VAARG 389
368#define EXTRACTELEMENT 390
369#define INSERTELEMENT 391
370#define SHUFFLEVECTOR 392
371#define GETRESULT 393
372#define EXTRACTVALUE 394
373#define INSERTVALUE 395
374#define SIGNEXT 396
375#define ZEROEXT 397
376#define NORETURN 398
377#define INREG 399
378#define SRET 400
379#define NOUNWIND 401
380#define NOALIAS 402
381#define BYVAL 403
382#define NEST 404
383#define READNONE 405
384#define READONLY 406
385#define GC 407
Devang Patel652203f2008-09-29 20:49:50 +0000386#define OPTSIZE 408
387#define NOINLINE 409
388#define ALWAYSINLINE 410
389#define DEFAULT 411
390#define HIDDEN 412
391#define PROTECTED 413
Dan Gohmanf4423b12008-04-19 00:24:39 +0000392
393
394
395
396/* Copy the first part of user declarations. */
Dale Johannesen236bbd42008-10-09 23:01:34 +0000397#line 14 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000398
399#include "ParserInternals.h"
400#include "llvm/CallingConv.h"
Chris Lattner0e9c3762006-01-25 22:27:16 +0000401#include "llvm/InlineAsm.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000402#include "llvm/Instructions.h"
403#include "llvm/Module.h"
Reid Spenceref9b9a72007-02-05 20:47:22 +0000404#include "llvm/ValueSymbolTable.h"
Chandler Carruth02202192007-08-04 01:56:21 +0000405#include "llvm/AutoUpgrade.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000406#include "llvm/Support/GetElementPtrTypeIterator.h"
Reid Spencer14310612006-12-31 05:40:51 +0000407#include "llvm/Support/CommandLine.h"
Chris Lattnerf7469af2007-01-31 04:44:08 +0000408#include "llvm/ADT/SmallVector.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000409#include "llvm/ADT/STLExtras.h"
Chris Lattner0019bbe2005-11-06 06:46:53 +0000410#include "llvm/Support/MathExtras.h"
Reid Spencer481169e2006-12-01 00:33:46 +0000411#include "llvm/Support/Streams.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000412#include <algorithm>
Reid Spencer68a24bd2005-08-27 18:50:39 +0000413#include <list>
Chris Lattner8adde282007-02-11 21:40:10 +0000414#include <map>
Reid Spencer68a24bd2005-08-27 18:50:39 +0000415#include <utility>
416
Reid Spencere4f47592006-08-18 17:32:55 +0000417// The following is a gross hack. In order to rid the libAsmParser library of
418// exceptions, we have to have a way of getting the yyparse function to go into
419// an error situation. So, whenever we want an error to occur, the GenerateError
Eric Christopher2a5196f2008-09-24 04:55:49 +0000420// function (see bottom of file) sets TriggerError. Then, at the end of each
421// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
422// (a goto) to put YACC in error state. Furthermore, several calls to
Reid Spencere4f47592006-08-18 17:32:55 +0000423// GenerateError are made from inside productions and they must simulate the
424// previous exception behavior by exiting the production immediately. We have
425// replaced these with the GEN_ERROR macro which calls GeneratError and then
Eric Christopher2a5196f2008-09-24 04:55:49 +0000426// immediately invokes YYERROR. This would be so much cleaner if it was a
Reid Spencere4f47592006-08-18 17:32:55 +0000427// recursive descent parser.
Reid Spencer61c83e02006-08-18 08:43:06 +0000428static bool TriggerError = false;
Reid Spencerf63697d2006-10-09 17:36:59 +0000429#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
Reid Spencer61c83e02006-08-18 08:43:06 +0000430#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
431
Reid Spencer68a24bd2005-08-27 18:50:39 +0000432int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
433int yylex(); // declaration" of xxx warnings.
434int yyparse();
Reid Spencer68a24bd2005-08-27 18:50:39 +0000435using namespace llvm;
436
437static Module *ParserResult;
438
439// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
440// relating to upreferences in the input stream.
441//
442//#define DEBUG_UPREFS 1
443#ifdef DEBUG_UPREFS
Bill Wendlinge8156192006-12-07 01:30:32 +0000444#define UR_OUT(X) cerr << X
Reid Spencer68a24bd2005-08-27 18:50:39 +0000445#else
446#define UR_OUT(X)
447#endif
448
449#define YYERROR_VERBOSE 1
450
Chris Lattnerb475c422005-11-12 18:22:38 +0000451static GlobalVariable *CurGV;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000452
453
454// This contains info used when building the body of a function. It is
455// destroyed when the function is completed.
456//
457typedef std::vector<Value *> ValueList; // Numbered defs
Reid Spencer14310612006-12-31 05:40:51 +0000458
Eric Christopher2a5196f2008-09-24 04:55:49 +0000459static void
Reid Spencer93c40032007-03-19 18:40:50 +0000460ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000461
462static struct PerModuleInfo {
463 Module *CurrentModule;
Reid Spencer93c40032007-03-19 18:40:50 +0000464 ValueList Values; // Module level numbered definitions
465 ValueList LateResolveValues;
Reid Spencer861d9d62006-11-28 07:29:44 +0000466 std::vector<PATypeHolder> Types;
467 std::map<ValID, PATypeHolder> LateResolveTypes;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000468
469 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
Chris Lattner0ad19702006-06-21 16:53:00 +0000470 /// how they were referenced and on which line of the input they came from so
Reid Spencer68a24bd2005-08-27 18:50:39 +0000471 /// that we can resolve them later and print error messages as appropriate.
472 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
473
474 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
475 // references to global values. Global values may be referenced before they
476 // are defined, and if so, the temporary object that they represent is held
477 // here. This is used for forward references of GlobalValues.
478 //
479 typedef std::map<std::pair<const PointerType *,
480 ValID>, GlobalValue*> GlobalRefsType;
481 GlobalRefsType GlobalRefs;
482
483 void ModuleDone() {
484 // If we could not resolve some functions at function compilation time
485 // (calls to functions before they are defined), resolve them now... Types
486 // are resolved when the constant pool has been completely parsed.
487 //
488 ResolveDefinitions(LateResolveValues);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000489 if (TriggerError)
490 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000491
492 // Check to make sure that all global value forward references have been
493 // resolved!
494 //
495 if (!GlobalRefs.empty()) {
496 std::string UndefinedReferences = "Unresolved global references exist:\n";
497
498 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
499 I != E; ++I) {
500 UndefinedReferences += " " + I->first.first->getDescription() + " " +
501 I->first.second.getName() + "\n";
502 }
Reid Spencer61c83e02006-08-18 08:43:06 +0000503 GenerateError(UndefinedReferences);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000504 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000505 }
506
Chandler Carruth02202192007-08-04 01:56:21 +0000507 // Look for intrinsic functions and CallInst that need to be upgraded
508 for (Module::iterator FI = CurrentModule->begin(),
509 FE = CurrentModule->end(); FI != FE; )
510 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
511
Reid Spencer68a24bd2005-08-27 18:50:39 +0000512 Values.clear(); // Clear out function local definitions
513 Types.clear();
514 CurrentModule = 0;
515 }
516
Reid Spencer68a24bd2005-08-27 18:50:39 +0000517 // GetForwardRefForGlobal - Check to see if there is a forward reference
518 // for this global. If so, remove it from the GlobalRefs map and return it.
519 // If not, just return null.
520 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
521 // Check to see if there is a forward reference to this global variable...
522 // if there is, eliminate it and patch the reference to use the new def'n.
523 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
524 GlobalValue *Ret = 0;
525 if (I != GlobalRefs.end()) {
526 Ret = I->second;
527 GlobalRefs.erase(I);
528 }
529 return Ret;
530 }
Reid Spencer8c8a2dc2007-01-02 21:54:12 +0000531
532 bool TypeIsUnresolved(PATypeHolder* PATy) {
533 // If it isn't abstract, its resolved
534 const Type* Ty = PATy->get();
535 if (!Ty->isAbstract())
536 return false;
537 // Traverse the type looking for abstract types. If it isn't abstract then
Eric Christopher2a5196f2008-09-24 04:55:49 +0000538 // we don't need to traverse that leg of the type.
Reid Spencer8c8a2dc2007-01-02 21:54:12 +0000539 std::vector<const Type*> WorkList, SeenList;
540 WorkList.push_back(Ty);
541 while (!WorkList.empty()) {
542 const Type* Ty = WorkList.back();
543 SeenList.push_back(Ty);
544 WorkList.pop_back();
545 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
546 // Check to see if this is an unresolved type
547 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
548 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
549 for ( ; I != E; ++I) {
550 if (I->second.get() == OpTy)
551 return true;
552 }
553 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
554 const Type* TheTy = SeqTy->getElementType();
555 if (TheTy->isAbstract() && TheTy != Ty) {
Eric Christopher2a5196f2008-09-24 04:55:49 +0000556 std::vector<const Type*>::iterator I = SeenList.begin(),
Reid Spencer8c8a2dc2007-01-02 21:54:12 +0000557 E = SeenList.end();
558 for ( ; I != E; ++I)
559 if (*I == TheTy)
560 break;
561 if (I == E)
562 WorkList.push_back(TheTy);
563 }
564 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
565 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
566 const Type* TheTy = StrTy->getElementType(i);
567 if (TheTy->isAbstract() && TheTy != Ty) {
Eric Christopher2a5196f2008-09-24 04:55:49 +0000568 std::vector<const Type*>::iterator I = SeenList.begin(),
Reid Spencer8c8a2dc2007-01-02 21:54:12 +0000569 E = SeenList.end();
570 for ( ; I != E; ++I)
571 if (*I == TheTy)
572 break;
573 if (I == E)
574 WorkList.push_back(TheTy);
575 }
576 }
577 }
578 }
579 return false;
580 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000581} CurModule;
582
583static struct PerFunctionInfo {
584 Function *CurrentFunction; // Pointer to current function being created
585
Reid Spencer93c40032007-03-19 18:40:50 +0000586 ValueList Values; // Keep track of #'d definitions
587 unsigned NextValNum;
588 ValueList LateResolveValues;
Reid Spenceref9b9a72007-02-05 20:47:22 +0000589 bool isDeclare; // Is this function a forward declararation?
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000590 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000591 GlobalValue::VisibilityTypes Visibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000592
593 /// BBForwardRefs - When we see forward references to basic blocks, keep
594 /// track of them here.
Reid Spencer93c40032007-03-19 18:40:50 +0000595 std::map<ValID, BasicBlock*> BBForwardRefs;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000596
597 inline PerFunctionInfo() {
598 CurrentFunction = 0;
599 isDeclare = false;
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000600 Linkage = GlobalValue::ExternalLinkage;
601 Visibility = GlobalValue::DefaultVisibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000602 }
603
604 inline void FunctionStart(Function *M) {
605 CurrentFunction = M;
Reid Spencer93c40032007-03-19 18:40:50 +0000606 NextValNum = 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000607 }
608
609 void FunctionDone() {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000610 // Any forward referenced blocks left?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000611 if (!BBForwardRefs.empty()) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000612 GenerateError("Undefined reference to label " +
Reid Spencer93c40032007-03-19 18:40:50 +0000613 BBForwardRefs.begin()->second->getName());
Reid Spencer5b7e7532006-09-28 19:28:24 +0000614 return;
615 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000616
617 // Resolve all forward references now.
618 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
619
620 Values.clear(); // Clear out function local definitions
Reid Spencer93c40032007-03-19 18:40:50 +0000621 BBForwardRefs.clear();
Reid Spencer68a24bd2005-08-27 18:50:39 +0000622 CurrentFunction = 0;
623 isDeclare = false;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000624 Linkage = GlobalValue::ExternalLinkage;
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000625 Visibility = GlobalValue::DefaultVisibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000626 }
627} CurFun; // Info for the current function...
628
629static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
630
631
632//===----------------------------------------------------------------------===//
633// Code to handle definitions of all the types
634//===----------------------------------------------------------------------===//
635
Chris Lattner15bd0952008-08-29 17:20:18 +0000636/// InsertValue - Insert a value into the value table. If it is named, this
637/// returns -1, otherwise it returns the slot number for the value.
638static int InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
Reid Spencer93c40032007-03-19 18:40:50 +0000639 // Things that have names or are void typed don't get slot numbers
640 if (V->hasName() || (V->getType() == Type::VoidTy))
Chris Lattner15bd0952008-08-29 17:20:18 +0000641 return -1;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000642
Reid Spencer93c40032007-03-19 18:40:50 +0000643 // In the case of function values, we have to allow for the forward reference
644 // of basic blocks, which are included in the numbering. Consequently, we keep
Eric Christopher2a5196f2008-09-24 04:55:49 +0000645 // track of the next insertion location with NextValNum. When a BB gets
Reid Spencer93c40032007-03-19 18:40:50 +0000646 // inserted, it could change the size of the CurFun.Values vector.
647 if (&ValueTab == &CurFun.Values) {
648 if (ValueTab.size() <= CurFun.NextValNum)
649 ValueTab.resize(CurFun.NextValNum+1);
650 ValueTab[CurFun.NextValNum++] = V;
Chris Lattner15bd0952008-08-29 17:20:18 +0000651 return CurFun.NextValNum-1;
Eric Christopher2a5196f2008-09-24 04:55:49 +0000652 }
Reid Spencer93c40032007-03-19 18:40:50 +0000653 // For all other lists, its okay to just tack it on the back of the vector.
654 ValueTab.push_back(V);
Chris Lattner15bd0952008-08-29 17:20:18 +0000655 return ValueTab.size()-1;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000656}
657
658static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
659 switch (D.Type) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000660 case ValID::LocalID: // Is it a numbered definition?
Reid Spencer68a24bd2005-08-27 18:50:39 +0000661 // Module constants occupy the lowest numbered slots...
Reid Spencer41dff5e2007-01-26 08:05:27 +0000662 if (D.Num < CurModule.Types.size())
663 return CurModule.Types[D.Num];
Reid Spencer68a24bd2005-08-27 18:50:39 +0000664 break;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000665 case ValID::LocalName: // Is it a named definition?
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000666 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000667 D.destroy(); // Free old strdup'd memory...
668 return N;
669 }
670 break;
671 default:
Reid Spencerb5334b02007-02-05 10:18:06 +0000672 GenerateError("Internal parser error: Invalid symbol type reference");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000673 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000674 }
675
676 // If we reached here, we referenced either a symbol that we don't know about
677 // or an id number that hasn't been read yet. We may be referencing something
678 // forward, so just create an entry to be resolved later and get to it...
679 //
680 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
681
682
683 if (inFunctionScope()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000684 if (D.Type == ValID::LocalName) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000685 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000686 return 0;
687 } else {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000688 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
Reid Spencer5b7e7532006-09-28 19:28:24 +0000689 return 0;
690 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000691 }
692
Reid Spencer861d9d62006-11-28 07:29:44 +0000693 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000694 if (I != CurModule.LateResolveTypes.end())
Reid Spencer861d9d62006-11-28 07:29:44 +0000695 return I->second;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000696
Reid Spencer861d9d62006-11-28 07:29:44 +0000697 Type *Typ = OpaqueType::get();
698 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
699 return Typ;
Reid Spencera132e042006-12-03 05:46:11 +0000700 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000701
Reid Spencer93c40032007-03-19 18:40:50 +0000702// getExistingVal - Look up the value specified by the provided type and
Reid Spencer68a24bd2005-08-27 18:50:39 +0000703// the provided ValID. If the value exists and has already been defined, return
704// it. Otherwise return null.
705//
Reid Spencer93c40032007-03-19 18:40:50 +0000706static Value *getExistingVal(const Type *Ty, const ValID &D) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000707 if (isa<FunctionType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000708 GenerateError("Functions are not values and "
Reid Spencer68a24bd2005-08-27 18:50:39 +0000709 "must be referenced as pointers");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000710 return 0;
711 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000712
713 switch (D.Type) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000714 case ValID::LocalID: { // Is it a numbered definition?
Reid Spencer41dff5e2007-01-26 08:05:27 +0000715 // Check that the number is within bounds.
Eric Christopher2a5196f2008-09-24 04:55:49 +0000716 if (D.Num >= CurFun.Values.size())
Reid Spencer93c40032007-03-19 18:40:50 +0000717 return 0;
718 Value *Result = CurFun.Values[D.Num];
719 if (Ty != Result->getType()) {
720 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
Eric Christopher2a5196f2008-09-24 04:55:49 +0000721 Result->getType()->getDescription() + "' does not match "
Reid Spencer93c40032007-03-19 18:40:50 +0000722 "expected type, '" + Ty->getDescription() + "'");
723 return 0;
724 }
725 return Result;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000726 }
727 case ValID::GlobalID: { // Is it a numbered definition?
Eric Christopher2a5196f2008-09-24 04:55:49 +0000728 if (D.Num >= CurModule.Values.size())
Reid Spenceref9b9a72007-02-05 20:47:22 +0000729 return 0;
Reid Spencer93c40032007-03-19 18:40:50 +0000730 Value *Result = CurModule.Values[D.Num];
731 if (Ty != Result->getType()) {
732 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
Eric Christopher2a5196f2008-09-24 04:55:49 +0000733 Result->getType()->getDescription() + "' does not match "
Reid Spencer93c40032007-03-19 18:40:50 +0000734 "expected type, '" + Ty->getDescription() + "'");
Reid Spenceref9b9a72007-02-05 20:47:22 +0000735 return 0;
Reid Spencer93c40032007-03-19 18:40:50 +0000736 }
737 return Result;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000738 }
Eric Christopher2a5196f2008-09-24 04:55:49 +0000739
Reid Spencer41dff5e2007-01-26 08:05:27 +0000740 case ValID::LocalName: { // Is it a named definition?
Eric Christopher2a5196f2008-09-24 04:55:49 +0000741 if (!inFunctionScope())
Reid Spenceref9b9a72007-02-05 20:47:22 +0000742 return 0;
743 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000744 Value *N = SymTab.lookup(D.getName());
Eric Christopher2a5196f2008-09-24 04:55:49 +0000745 if (N == 0)
Reid Spenceref9b9a72007-02-05 20:47:22 +0000746 return 0;
747 if (N->getType() != Ty)
748 return 0;
Eric Christopher2a5196f2008-09-24 04:55:49 +0000749
Reid Spencer41dff5e2007-01-26 08:05:27 +0000750 D.destroy(); // Free old strdup'd memory...
751 return N;
752 }
753 case ValID::GlobalName: { // Is it a named definition?
Reid Spenceref9b9a72007-02-05 20:47:22 +0000754 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000755 Value *N = SymTab.lookup(D.getName());
Eric Christopher2a5196f2008-09-24 04:55:49 +0000756 if (N == 0)
Reid Spenceref9b9a72007-02-05 20:47:22 +0000757 return 0;
758 if (N->getType() != Ty)
759 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000760
761 D.destroy(); // Free old strdup'd memory...
762 return N;
763 }
764
765 // Check to make sure that "Ty" is an integral type, and that our
766 // value will fit into the specified type...
767 case ValID::ConstSIntVal: // Is it a constant pool reference??
Chris Lattner38905612008-02-19 04:36:25 +0000768 if (!isa<IntegerType>(Ty) ||
769 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000770 GenerateError("Signed integral constant '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000771 itostr(D.ConstPool64) + "' is invalid for type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +0000772 Ty->getDescription() + "'");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000773 return 0;
774 }
Reid Spencer49d273e2007-03-19 20:40:51 +0000775 return ConstantInt::get(Ty, D.ConstPool64, true);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000776
777 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
Chris Lattner38905612008-02-19 04:36:25 +0000778 if (isa<IntegerType>(Ty) &&
779 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
Reid Spencerb83eb642006-10-20 07:07:24 +0000780 return ConstantInt::get(Ty, D.UConstPool64);
Chris Lattner38905612008-02-19 04:36:25 +0000781
782 if (!isa<IntegerType>(Ty) ||
783 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
784 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
785 "' is invalid or out of range for type '" +
786 Ty->getDescription() + "'");
787 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000788 }
Chris Lattner38905612008-02-19 04:36:25 +0000789 // This is really a signed reference. Transmogrify.
790 return ConstantInt::get(Ty, D.ConstPool64, true);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000791
Chris Lattner1913b942008-07-11 00:30:39 +0000792 case ValID::ConstAPInt: // Is it an unsigned const pool reference?
793 if (!isa<IntegerType>(Ty)) {
794 GenerateError("Integral constant '" + D.getName() +
795 "' is invalid or out of range for type '" +
796 Ty->getDescription() + "'");
797 return 0;
798 }
Eric Christopher2a5196f2008-09-24 04:55:49 +0000799
Chris Lattner1913b942008-07-11 00:30:39 +0000800 {
801 APSInt Tmp = *D.ConstPoolInt;
802 Tmp.extOrTrunc(Ty->getPrimitiveSizeInBits());
803 return ConstantInt::get(Tmp);
804 }
Eric Christopher2a5196f2008-09-24 04:55:49 +0000805
Reid Spencer68a24bd2005-08-27 18:50:39 +0000806 case ValID::ConstFPVal: // Is it a floating point const pool reference?
Chris Lattner38905612008-02-19 04:36:25 +0000807 if (!Ty->isFloatingPoint() ||
808 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000809 GenerateError("FP constant invalid for type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000810 return 0;
811 }
Eric Christopher2a5196f2008-09-24 04:55:49 +0000812 // Lexer has no type info, so builds all float and double FP constants
Dale Johannesenc72cd7e2007-09-11 18:33:39 +0000813 // as double. Fix this here. Long double does not need this.
814 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
Dale Johannesen236bbd42008-10-09 23:01:34 +0000815 Ty==Type::FloatTy) {
816 bool ignored;
817 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven,
818 &ignored);
819 }
Chris Lattnerd8eb63f2008-04-20 00:41:19 +0000820 return ConstantFP::get(*D.ConstPoolFP);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000821
822 case ValID::ConstNullVal: // Is it a null value?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000823 if (!isa<PointerType>(Ty)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000824 GenerateError("Cannot create a a non pointer null");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000825 return 0;
826 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000827 return ConstantPointerNull::get(cast<PointerType>(Ty));
828
829 case ValID::ConstUndefVal: // Is it an undef value?
830 return UndefValue::get(Ty);
831
Chris Lattner7aa61892005-12-21 17:53:23 +0000832 case ValID::ConstZeroVal: // Is it a zero value?
833 return Constant::getNullValue(Ty);
Eric Christopher2a5196f2008-09-24 04:55:49 +0000834
Reid Spencer68a24bd2005-08-27 18:50:39 +0000835 case ValID::ConstantVal: // Fully resolved constant?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000836 if (D.ConstantValue->getType() != Ty) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000837 GenerateError("Constant expression type different from required type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000838 return 0;
839 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000840 return D.ConstantValue;
841
Chris Lattner0e9c3762006-01-25 22:27:16 +0000842 case ValID::InlineAsmVal: { // Inline asm expression
843 const PointerType *PTy = dyn_cast<PointerType>(Ty);
844 const FunctionType *FTy =
845 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000846 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000847 GenerateError("Invalid type for asm constraint string");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000848 return 0;
849 }
Chris Lattner0e9c3762006-01-25 22:27:16 +0000850 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
851 D.IAD->HasSideEffects);
852 D.destroy(); // Free InlineAsmDescriptor.
853 return IA;
854 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000855 default:
Reid Spencera9720f52007-02-05 17:04:00 +0000856 assert(0 && "Unhandled case!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000857 return 0;
858 } // End of switch
859
Reid Spencera9720f52007-02-05 17:04:00 +0000860 assert(0 && "Unhandled case!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000861 return 0;
862}
863
Reid Spencer93c40032007-03-19 18:40:50 +0000864// getVal - This function is identical to getExistingVal, except that if a
Reid Spencer68a24bd2005-08-27 18:50:39 +0000865// value is not already defined, it "improvises" by creating a placeholder var
866// that looks and acts just like the requested variable. When the value is
867// defined later, all uses of the placeholder variable are replaced with the
868// real thing.
869//
870static Value *getVal(const Type *Ty, const ValID &ID) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000871 if (Ty == Type::LabelTy) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000872 GenerateError("Cannot use a basic block here");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000873 return 0;
874 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000875
876 // See if the value has already been defined.
Reid Spencer93c40032007-03-19 18:40:50 +0000877 Value *V = getExistingVal(Ty, ID);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000878 if (V) return V;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000879 if (TriggerError) return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000880
Reid Spencer5b7e7532006-09-28 19:28:24 +0000881 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
Dan Gohmane4977cf2008-05-23 01:55:30 +0000882 GenerateError("Invalid use of a non-first-class type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000883 return 0;
884 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000885
886 // If we reached here, we referenced either a symbol that we don't know about
887 // or an id number that hasn't been read yet. We may be referencing something
888 // forward, so just create an entry to be resolved later and get to it...
889 //
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000890 switch (ID.Type) {
891 case ValID::GlobalName:
Reid Spencer9c9b63a2007-04-28 16:07:31 +0000892 case ValID::GlobalID: {
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000893 const PointerType *PTy = dyn_cast<PointerType>(Ty);
894 if (!PTy) {
895 GenerateError("Invalid type for reference to global" );
896 return 0;
897 }
898 const Type* ElTy = PTy->getElementType();
899 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
Gabor Greife64d2482008-04-06 23:07:54 +0000900 V = Function::Create(FTy, GlobalValue::ExternalLinkage);
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000901 else
Christopher Lamba8ed9bf2007-12-11 09:02:08 +0000902 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
903 (Module*)0, false, PTy->getAddressSpace());
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000904 break;
Reid Spencer9c9b63a2007-04-28 16:07:31 +0000905 }
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000906 default:
907 V = new Argument(Ty);
908 }
Eric Christopher2a5196f2008-09-24 04:55:49 +0000909
Reid Spencer68a24bd2005-08-27 18:50:39 +0000910 // Remember where this forward reference came from. FIXME, shouldn't we try
911 // to recycle these things??
912 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
Duncan Sandsdc024672007-11-27 13:23:08 +0000913 LLLgetLineNo())));
Reid Spencer68a24bd2005-08-27 18:50:39 +0000914
915 if (inFunctionScope())
916 InsertValue(V, CurFun.LateResolveValues);
917 else
918 InsertValue(V, CurModule.LateResolveValues);
919 return V;
920}
921
Reid Spencer93c40032007-03-19 18:40:50 +0000922/// defineBBVal - This is a definition of a new basic block with the specified
923/// identifier which must be the same as CurFun.NextValNum, if its numeric.
Chris Lattnercc81d152008-05-04 17:18:47 +0000924static BasicBlock *defineBBVal(const ValID &ID) {
Reid Spencera9720f52007-02-05 17:04:00 +0000925 assert(inFunctionScope() && "Can't get basic block at global scope!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000926
Reid Spencer68a24bd2005-08-27 18:50:39 +0000927 BasicBlock *BB = 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000928
Reid Spencer93c40032007-03-19 18:40:50 +0000929 // First, see if this was forward referenced
Reid Spencer68a24bd2005-08-27 18:50:39 +0000930
Reid Spencer93c40032007-03-19 18:40:50 +0000931 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
932 if (BBI != CurFun.BBForwardRefs.end()) {
933 BB = BBI->second;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000934 // The forward declaration could have been inserted anywhere in the
935 // function: insert it into the correct place now.
936 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
937 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
Reid Spencer93c40032007-03-19 18:40:50 +0000938
Reid Spencer66728ef2007-03-20 01:13:36 +0000939 // We're about to erase the entry, save the key so we can clean it up.
940 ValID Tmp = BBI->first;
941
Reid Spencer93c40032007-03-19 18:40:50 +0000942 // Erase the forward ref from the map as its no longer "forward"
943 CurFun.BBForwardRefs.erase(ID);
944
Eric Christopher2a5196f2008-09-24 04:55:49 +0000945 // The key has been removed from the map but so we don't want to leave
Reid Spencer66728ef2007-03-20 01:13:36 +0000946 // strdup'd memory around so destroy it too.
947 Tmp.destroy();
948
Reid Spencer93c40032007-03-19 18:40:50 +0000949 // If its a numbered definition, bump the number and set the BB value.
950 if (ID.Type == ValID::LocalID) {
951 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
952 InsertValue(BB);
953 }
Eric Christopher2a5196f2008-09-24 04:55:49 +0000954 } else {
955 // We haven't seen this BB before and its first mention is a definition.
Devang Patel67909432008-03-03 18:58:47 +0000956 // Just create it and return it.
957 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
Gabor Greife64d2482008-04-06 23:07:54 +0000958 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Devang Patel67909432008-03-03 18:58:47 +0000959 if (ID.Type == ValID::LocalID) {
960 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
961 InsertValue(BB);
962 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000963 }
Reid Spencer93c40032007-03-19 18:40:50 +0000964
Devang Patel67909432008-03-03 18:58:47 +0000965 ID.destroy();
Reid Spencer93c40032007-03-19 18:40:50 +0000966 return BB;
967}
968
969/// getBBVal - get an existing BB value or create a forward reference for it.
Eric Christopher2a5196f2008-09-24 04:55:49 +0000970///
Reid Spencer93c40032007-03-19 18:40:50 +0000971static BasicBlock *getBBVal(const ValID &ID) {
972 assert(inFunctionScope() && "Can't get basic block at global scope!");
973
974 BasicBlock *BB = 0;
975
976 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
977 if (BBI != CurFun.BBForwardRefs.end()) {
978 BB = BBI->second;
979 } if (ID.Type == ValID::LocalName) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000980 std::string Name = ID.getName();
Reid Spencer93c40032007-03-19 18:40:50 +0000981 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
Anton Korobeynikovc70d7732008-02-20 12:10:37 +0000982 if (N) {
Reid Spencer93c40032007-03-19 18:40:50 +0000983 if (N->getType()->getTypeID() == Type::LabelTyID)
984 BB = cast<BasicBlock>(N);
985 else
986 GenerateError("Reference to label '" + Name + "' is actually of type '"+
987 N->getType()->getDescription() + "'");
Anton Korobeynikovc70d7732008-02-20 12:10:37 +0000988 }
Reid Spencer93c40032007-03-19 18:40:50 +0000989 } else if (ID.Type == ValID::LocalID) {
990 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
991 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
992 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
993 else
Eric Christopher2a5196f2008-09-24 04:55:49 +0000994 GenerateError("Reference to label '%" + utostr(ID.Num) +
995 "' is actually of type '"+
Reid Spencer93c40032007-03-19 18:40:50 +0000996 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
997 }
998 } else {
999 GenerateError("Illegal label reference " + ID.getName());
1000 return 0;
1001 }
1002
1003 // If its already been defined, return it now.
1004 if (BB) {
1005 ID.destroy(); // Free strdup'd memory.
1006 return BB;
1007 }
1008
1009 // Otherwise, this block has not been seen before, create it.
1010 std::string Name;
1011 if (ID.Type == ValID::LocalName)
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001012 Name = ID.getName();
Gabor Greife64d2482008-04-06 23:07:54 +00001013 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Reid Spencer93c40032007-03-19 18:40:50 +00001014
1015 // Insert it in the forward refs map.
1016 CurFun.BBForwardRefs[ID] = BB;
1017
Reid Spencer68a24bd2005-08-27 18:50:39 +00001018 return BB;
1019}
1020
1021
1022//===----------------------------------------------------------------------===//
1023// Code to handle forward references in instructions
1024//===----------------------------------------------------------------------===//
1025//
1026// This code handles the late binding needed with statements that reference
1027// values not defined yet... for example, a forward branch, or the PHI node for
1028// a loop body.
1029//
1030// This keeps a table (CurFun.LateResolveValues) of all such forward references
1031// and back patchs after we are done.
1032//
1033
1034// ResolveDefinitions - If we could not resolve some defs at parsing
1035// time (forward branches, phi functions for loops, etc...) resolve the
1036// defs now...
1037//
Eric Christopher2a5196f2008-09-24 04:55:49 +00001038static void
Reid Spencer93c40032007-03-19 18:40:50 +00001039ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001040 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
Reid Spencer93c40032007-03-19 18:40:50 +00001041 while (!LateResolvers.empty()) {
1042 Value *V = LateResolvers.back();
1043 LateResolvers.pop_back();
Reid Spencer68a24bd2005-08-27 18:50:39 +00001044
Reid Spencer93c40032007-03-19 18:40:50 +00001045 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1046 CurModule.PlaceHolderInfo.find(V);
1047 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001048
Reid Spencer93c40032007-03-19 18:40:50 +00001049 ValID &DID = PHI->second.first;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001050
Reid Spencer93c40032007-03-19 18:40:50 +00001051 Value *TheRealValue = getExistingVal(V->getType(), DID);
1052 if (TriggerError)
1053 return;
1054 if (TheRealValue) {
1055 V->replaceAllUsesWith(TheRealValue);
1056 delete V;
1057 CurModule.PlaceHolderInfo.erase(PHI);
1058 } else if (FutureLateResolvers) {
1059 // Functions have their unresolved items forwarded to the module late
1060 // resolver table
1061 InsertValue(V, *FutureLateResolvers);
1062 } else {
1063 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1064 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1065 "' of type '" + V->getType()->getDescription() + "'",
1066 PHI->second.second);
Reid Spencer5b7e7532006-09-28 19:28:24 +00001067 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001068 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00001069 GenerateError("Reference to an invalid definition: #" +
1070 itostr(DID.Num) + " of type '" +
1071 V->getType()->getDescription() + "'",
1072 PHI->second.second);
1073 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001074 }
1075 }
1076 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001077 LateResolvers.clear();
1078}
1079
1080// ResolveTypeTo - A brand new type was just declared. This means that (if
1081// name is not null) things referencing Name can be resolved. Otherwise, things
1082// refering to the number can be resolved. Do this now.
1083//
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001084static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001085 ValID D;
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001086 if (Name)
1087 D = ValID::createLocalName(*Name);
Eric Christopher2a5196f2008-09-24 04:55:49 +00001088 else
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001089 D = ValID::createLocalID(CurModule.Types.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00001090
Reid Spencer861d9d62006-11-28 07:29:44 +00001091 std::map<ValID, PATypeHolder>::iterator I =
Reid Spencer68a24bd2005-08-27 18:50:39 +00001092 CurModule.LateResolveTypes.find(D);
1093 if (I != CurModule.LateResolveTypes.end()) {
Reid Spencer861d9d62006-11-28 07:29:44 +00001094 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001095 CurModule.LateResolveTypes.erase(I);
1096 }
Nuno Lopes191dfb92008-10-03 15:52:39 +00001097 D.destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +00001098}
1099
1100// setValueName - Set the specified value to the name given. The name may be
1101// null potentially, in which case this is a noop. The string passed in is
1102// assumed to be a malloc'd string buffer, and is free'd by this function.
1103//
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001104static void setValueName(Value *V, std::string *NameStr) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00001105 if (!NameStr) return;
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001106 std::string Name(*NameStr); // Copy string
1107 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001108
Reid Spencer41dff5e2007-01-26 08:05:27 +00001109 if (V->getType() == Type::VoidTy) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001110 GenerateError("Can't assign name '" + Name+"' to value with void type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00001111 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001112 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00001113
Reid Spencera9720f52007-02-05 17:04:00 +00001114 assert(inFunctionScope() && "Must be in function scope!");
Reid Spenceref9b9a72007-02-05 20:47:22 +00001115 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1116 if (ST.lookup(Name)) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00001117 GenerateError("Redefinition of value '" + Name + "' of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00001118 V->getType()->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00001119 return;
1120 }
1121
1122 // Set the name.
1123 V->setName(Name);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001124}
1125
1126/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1127/// this is a declaration, otherwise it is a definition.
Chris Lattnerb475c422005-11-12 18:22:38 +00001128static GlobalVariable *
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001129ParseGlobalVariable(std::string *NameStr,
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001130 GlobalValue::LinkageTypes Linkage,
1131 GlobalValue::VisibilityTypes Visibility,
Chris Lattnerb475c422005-11-12 18:22:38 +00001132 bool isConstantGlobal, const Type *Ty,
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001133 Constant *Initializer, bool IsThreadLocal,
1134 unsigned AddressSpace = 0) {
Reid Spencer5b7e7532006-09-28 19:28:24 +00001135 if (isa<FunctionType>(Ty)) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001136 GenerateError("Cannot declare global vars of function type");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001137 return 0;
1138 }
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001139 if (Ty == Type::LabelTy) {
1140 GenerateError("Cannot declare global vars of label type");
1141 return 0;
1142 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001143
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001144 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001145
1146 std::string Name;
1147 if (NameStr) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001148 Name = *NameStr; // Copy string
1149 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001150 }
1151
1152 // See if this global value was forward referenced. If so, recycle the
1153 // object.
1154 ValID ID;
1155 if (!Name.empty()) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001156 ID = ValID::createGlobalName(Name);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001157 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00001158 ID = ValID::createGlobalID(CurModule.Values.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00001159 }
1160
1161 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1162 // Move the global to the end of the list, from whereever it was
1163 // previously inserted.
1164 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1165 CurModule.CurrentModule->getGlobalList().remove(GV);
1166 CurModule.CurrentModule->getGlobalList().push_back(GV);
1167 GV->setInitializer(Initializer);
1168 GV->setLinkage(Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001169 GV->setVisibility(Visibility);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001170 GV->setConstant(isConstantGlobal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00001171 GV->setThreadLocal(IsThreadLocal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001172 InsertValue(GV, CurModule.Values);
Nuno Lopes191dfb92008-10-03 15:52:39 +00001173 ID.destroy();
Chris Lattnerb475c422005-11-12 18:22:38 +00001174 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001175 }
1176
Nuno Lopes191dfb92008-10-03 15:52:39 +00001177 ID.destroy();
1178
Reid Spenceref9b9a72007-02-05 20:47:22 +00001179 // If this global has a name
Reid Spencer68a24bd2005-08-27 18:50:39 +00001180 if (!Name.empty()) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00001181 // if the global we're parsing has an initializer (is a definition) and
1182 // has external linkage.
1183 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1184 // If there is already a global with external linkage with this name
1185 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1186 // If we allow this GVar to get created, it will be renamed in the
1187 // symbol table because it conflicts with an existing GVar. We can't
1188 // allow redefinition of GVars whose linking indicates that their name
1189 // must stay the same. Issue the error.
1190 GenerateError("Redefinition of global variable named '" + Name +
1191 "' of type '" + Ty->getDescription() + "'");
1192 return 0;
1193 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001194 }
1195
1196 // Otherwise there is no existing GV to use, create one now.
1197 GlobalVariable *GV =
1198 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001199 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001200 GV->setVisibility(Visibility);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001201 InsertValue(GV, CurModule.Values);
Chris Lattnerb475c422005-11-12 18:22:38 +00001202 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001203}
1204
1205// setTypeName - Set the specified type to the name given. The name may be
1206// null potentially, in which case this is a noop. The string passed in is
1207// assumed to be a malloc'd string buffer, and is freed by this function.
1208//
1209// This function returns true if the type has already been defined, but is
1210// allowed to be redefined in the specified context. If the name is a new name
1211// for the type plane, it is inserted and false is returned.
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001212static bool setTypeName(const Type *T, std::string *NameStr) {
Reid Spencera9720f52007-02-05 17:04:00 +00001213 assert(!inFunctionScope() && "Can't give types function-local names!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001214 if (NameStr == 0) return false;
Eric Christopher2a5196f2008-09-24 04:55:49 +00001215
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001216 std::string Name(*NameStr); // Copy string
1217 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001218
1219 // We don't allow assigning names to void type
Reid Spencer5b7e7532006-09-28 19:28:24 +00001220 if (T == Type::VoidTy) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001221 GenerateError("Can't assign name '" + Name + "' to the void type");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001222 return false;
1223 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001224
1225 // Set the type name, checking for conflicts as we do so.
1226 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1227
1228 if (AlreadyExists) { // Inserting a name that is already defined???
1229 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
Reid Spencera9720f52007-02-05 17:04:00 +00001230 assert(Existing && "Conflict but no matching type?!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001231
1232 // There is only one case where this is allowed: when we are refining an
1233 // opaque type. In this case, Existing will be an opaque type.
1234 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1235 // We ARE replacing an opaque type!
1236 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1237 return true;
1238 }
1239
1240 // Otherwise, this is an attempt to redefine a type. That's okay if
1241 // the redefinition is identical to the original. This will be so if
1242 // Existing and T point to the same Type object. In this one case we
1243 // allow the equivalent redefinition.
1244 if (Existing == T) return true; // Yes, it's equal.
1245
1246 // Any other kind of (non-equivalent) redefinition is an error.
Reid Spencer63c34452007-01-05 21:51:07 +00001247 GenerateError("Redefinition of type named '" + Name + "' of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00001248 T->getDescription() + "'");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001249 }
1250
1251 return false;
1252}
1253
1254//===----------------------------------------------------------------------===//
1255// Code for handling upreferences in type names...
1256//
1257
1258// TypeContains - Returns true if Ty directly contains E in it.
1259//
1260static bool TypeContains(const Type *Ty, const Type *E) {
1261 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1262 E) != Ty->subtype_end();
1263}
1264
1265namespace {
1266 struct UpRefRecord {
1267 // NestingLevel - The number of nesting levels that need to be popped before
1268 // this type is resolved.
1269 unsigned NestingLevel;
1270
1271 // LastContainedTy - This is the type at the current binding level for the
1272 // type. Every time we reduce the nesting level, this gets updated.
1273 const Type *LastContainedTy;
1274
1275 // UpRefTy - This is the actual opaque type that the upreference is
1276 // represented with.
1277 OpaqueType *UpRefTy;
1278
1279 UpRefRecord(unsigned NL, OpaqueType *URTy)
1280 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1281 };
1282}
1283
1284// UpRefs - A list of the outstanding upreferences that need to be resolved.
1285static std::vector<UpRefRecord> UpRefs;
1286
1287/// HandleUpRefs - Every time we finish a new layer of types, this function is
1288/// called. It loops through the UpRefs vector, which is a list of the
1289/// currently active types. For each type, if the up reference is contained in
1290/// the newly completed type, we decrement the level count. When the level
1291/// count reaches zero, the upreferenced type is the type that is passed in:
1292/// thus we can complete the cycle.
1293///
1294static PATypeHolder HandleUpRefs(const Type *ty) {
Chris Lattner224f84f2006-08-18 17:34:45 +00001295 // If Ty isn't abstract, or if there are no up-references in it, then there is
1296 // nothing to resolve here.
1297 if (!ty->isAbstract() || UpRefs.empty()) return ty;
Eric Christopher2a5196f2008-09-24 04:55:49 +00001298
Reid Spencer68a24bd2005-08-27 18:50:39 +00001299 PATypeHolder Ty(ty);
1300 UR_OUT("Type '" << Ty->getDescription() <<
1301 "' newly formed. Resolving upreferences.\n" <<
1302 UpRefs.size() << " upreferences active!\n");
1303
1304 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1305 // to zero), we resolve them all together before we resolve them to Ty. At
1306 // the end of the loop, if there is anything to resolve to Ty, it will be in
1307 // this variable.
1308 OpaqueType *TypeToResolve = 0;
1309
1310 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1311 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1312 << UpRefs[i].second->getDescription() << ") = "
1313 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1314 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1315 // Decrement level of upreference
1316 unsigned Level = --UpRefs[i].NestingLevel;
1317 UpRefs[i].LastContainedTy = Ty;
1318 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1319 if (Level == 0) { // Upreference should be resolved!
1320 if (!TypeToResolve) {
1321 TypeToResolve = UpRefs[i].UpRefTy;
1322 } else {
1323 UR_OUT(" * Resolving upreference for "
1324 << UpRefs[i].second->getDescription() << "\n";
1325 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1326 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1327 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1328 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1329 }
1330 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1331 --i; // Do not skip the next element...
1332 }
1333 }
1334 }
1335
1336 if (TypeToResolve) {
1337 UR_OUT(" * Resolving upreference for "
1338 << UpRefs[i].second->getDescription() << "\n";
1339 std::string OldName = TypeToResolve->getDescription());
1340 TypeToResolve->refineAbstractTypeTo(Ty);
1341 }
1342
1343 return Ty;
1344}
1345
Reid Spencer68a24bd2005-08-27 18:50:39 +00001346//===----------------------------------------------------------------------===//
1347// RunVMAsmParser - Define an interface to this parser
1348//===----------------------------------------------------------------------===//
1349//
Reid Spencer14310612006-12-31 05:40:51 +00001350static Module* RunParser(Module * M);
1351
Duncan Sandsdc024672007-11-27 13:23:08 +00001352Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1353 InitLLLexer(MB);
1354 Module *M = RunParser(new Module(LLLgetFilename()));
1355 FreeLexer();
1356 return M;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001357}
1358
1359
Dan Gohmanf4423b12008-04-19 00:24:39 +00001360
1361/* Enabling traces. */
1362#ifndef YYDEBUG
1363# define YYDEBUG 0
1364#endif
1365
1366/* Enabling verbose error messages. */
1367#ifdef YYERROR_VERBOSE
1368# undef YYERROR_VERBOSE
1369# define YYERROR_VERBOSE 1
1370#else
1371# define YYERROR_VERBOSE 0
1372#endif
1373
1374/* Enabling the token table. */
1375#ifndef YYTOKEN_TABLE
1376# define YYTOKEN_TABLE 0
1377#endif
1378
1379#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1380typedef union YYSTYPE
Dale Johannesen236bbd42008-10-09 23:01:34 +00001381#line 977 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00001382{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001383 llvm::Module *ModuleVal;
1384 llvm::Function *FunctionVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001385 llvm::BasicBlock *BasicBlockVal;
1386 llvm::TerminatorInst *TermInstVal;
1387 llvm::Instruction *InstVal;
Reid Spencera132e042006-12-03 05:46:11 +00001388 llvm::Constant *ConstVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001389
Reid Spencera132e042006-12-03 05:46:11 +00001390 const llvm::Type *PrimType;
Reid Spencer14310612006-12-31 05:40:51 +00001391 std::list<llvm::PATypeHolder> *TypeList;
Reid Spencera132e042006-12-03 05:46:11 +00001392 llvm::PATypeHolder *TypeVal;
1393 llvm::Value *ValueVal;
Reid Spencera132e042006-12-03 05:46:11 +00001394 std::vector<llvm::Value*> *ValueList;
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001395 std::vector<unsigned> *ConstantList;
Reid Spencer14310612006-12-31 05:40:51 +00001396 llvm::ArgListType *ArgList;
1397 llvm::TypeWithAttrs TypeWithAttrs;
1398 llvm::TypeWithAttrsList *TypeWithAttrsList;
Dale Johanneseneb57ea72007-11-05 21:20:28 +00001399 llvm::ParamList *ParamList;
Reid Spencer14310612006-12-31 05:40:51 +00001400
Reid Spencer68a24bd2005-08-27 18:50:39 +00001401 // Represent the RHS of PHI node
Reid Spencera132e042006-12-03 05:46:11 +00001402 std::list<std::pair<llvm::Value*,
1403 llvm::BasicBlock*> > *PHIList;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001404 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
Reid Spencera132e042006-12-03 05:46:11 +00001405 std::vector<llvm::Constant*> *ConstVector;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001406
1407 llvm::GlobalValue::LinkageTypes Linkage;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001408 llvm::GlobalValue::VisibilityTypes Visibility;
Devang Patel05988662008-09-25 21:00:45 +00001409 llvm::Attributes Attributes;
Reid Spencer38c91a92007-02-28 02:24:54 +00001410 llvm::APInt *APIntVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001411 int64_t SInt64Val;
1412 uint64_t UInt64Val;
1413 int SIntVal;
1414 unsigned UIntVal;
Dale Johannesencdd509a2007-09-07 21:07:57 +00001415 llvm::APFloat *FPVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001416 bool BoolVal;
1417
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001418 std::string *StrVal; // This memory must be deleted
1419 llvm::ValID ValIDVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001420
Reid Spencera132e042006-12-03 05:46:11 +00001421 llvm::Instruction::BinaryOps BinaryOpVal;
1422 llvm::Instruction::TermOps TermOpVal;
1423 llvm::Instruction::MemoryOps MemOpVal;
1424 llvm::Instruction::CastOps CastOpVal;
1425 llvm::Instruction::OtherOps OtherOpVal;
Reid Spencera132e042006-12-03 05:46:11 +00001426 llvm::ICmpInst::Predicate IPredicate;
1427 llvm::FCmpInst::Predicate FPredicate;
Dan Gohmanf4423b12008-04-19 00:24:39 +00001428}
Chris Lattner9fc4da42008-10-08 06:44:45 +00001429/* Line 193 of yacc.c. */
Dale Johannesen236bbd42008-10-09 23:01:34 +00001430#line 1431 "llvmAsmParser.tab.c"
Dan Gohmanf4423b12008-04-19 00:24:39 +00001431 YYSTYPE;
1432# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1433# define YYSTYPE_IS_DECLARED 1
1434# define YYSTYPE_IS_TRIVIAL 1
Reid Spencer68a24bd2005-08-27 18:50:39 +00001435#endif
1436
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001437
Reid Spencer68a24bd2005-08-27 18:50:39 +00001438
Dan Gohmanf4423b12008-04-19 00:24:39 +00001439/* Copy the second part of user declarations. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001440
1441
Dan Gohmanf4423b12008-04-19 00:24:39 +00001442/* Line 216 of yacc.c. */
Dale Johannesen236bbd42008-10-09 23:01:34 +00001443#line 1444 "llvmAsmParser.tab.c"
Reid Spencerb8f85052007-07-31 03:50:36 +00001444
Dan Gohmanf4423b12008-04-19 00:24:39 +00001445#ifdef short
1446# undef short
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001447#endif
1448
Dan Gohmanf4423b12008-04-19 00:24:39 +00001449#ifdef YYTYPE_UINT8
1450typedef YYTYPE_UINT8 yytype_uint8;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001451#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00001452typedef unsigned char yytype_uint8;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001453#endif
1454
Dan Gohmanf4423b12008-04-19 00:24:39 +00001455#ifdef YYTYPE_INT8
1456typedef YYTYPE_INT8 yytype_int8;
1457#elif (defined __STDC__ || defined __C99__FUNC__ \
1458 || defined __cplusplus || defined _MSC_VER)
1459typedef signed char yytype_int8;
1460#else
1461typedef short int yytype_int8;
1462#endif
1463
1464#ifdef YYTYPE_UINT16
1465typedef YYTYPE_UINT16 yytype_uint16;
1466#else
1467typedef unsigned short int yytype_uint16;
1468#endif
1469
1470#ifdef YYTYPE_INT16
1471typedef YYTYPE_INT16 yytype_int16;
1472#else
1473typedef short int yytype_int16;
1474#endif
1475
1476#ifndef YYSIZE_T
1477# ifdef __SIZE_TYPE__
1478# define YYSIZE_T __SIZE_TYPE__
1479# elif defined size_t
1480# define YYSIZE_T size_t
1481# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1482 || defined __cplusplus || defined _MSC_VER)
1483# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1484# define YYSIZE_T size_t
1485# else
1486# define YYSIZE_T unsigned int
1487# endif
1488#endif
1489
1490#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1491
1492#ifndef YY_
Chris Lattner9fc4da42008-10-08 06:44:45 +00001493# if defined YYENABLE_NLS && YYENABLE_NLS
Dan Gohmanf4423b12008-04-19 00:24:39 +00001494# if ENABLE_NLS
1495# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1496# define YY_(msgid) dgettext ("bison-runtime", msgid)
1497# endif
1498# endif
1499# ifndef YY_
1500# define YY_(msgid) msgid
1501# endif
1502#endif
1503
1504/* Suppress unused-variable warnings by "using" E. */
1505#if ! defined lint || defined __GNUC__
1506# define YYUSE(e) ((void) (e))
1507#else
1508# define YYUSE(e) /* empty */
1509#endif
1510
1511/* Identity function, used to suppress warnings about constant conditions. */
1512#ifndef lint
1513# define YYID(n) (n)
1514#else
1515#if (defined __STDC__ || defined __C99__FUNC__ \
1516 || defined __cplusplus || defined _MSC_VER)
1517static int
1518YYID (int i)
1519#else
1520static int
1521YYID (i)
1522 int i;
1523#endif
1524{
1525 return i;
1526}
1527#endif
1528
1529#if ! defined yyoverflow || YYERROR_VERBOSE
1530
1531/* The parser invokes alloca or malloc; define the necessary symbols. */
1532
1533# ifdef YYSTACK_USE_ALLOCA
1534# if YYSTACK_USE_ALLOCA
1535# ifdef __GNUC__
1536# define YYSTACK_ALLOC __builtin_alloca
1537# elif defined __BUILTIN_VA_ARG_INCR
1538# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1539# elif defined _AIX
1540# define YYSTACK_ALLOC __alloca
1541# elif defined _MSC_VER
1542# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1543# define alloca _alloca
1544# else
1545# define YYSTACK_ALLOC alloca
1546# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1547 || defined __cplusplus || defined _MSC_VER)
1548# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1549# ifndef _STDLIB_H
1550# define _STDLIB_H 1
1551# endif
1552# endif
1553# endif
1554# endif
1555# endif
1556
1557# ifdef YYSTACK_ALLOC
1558 /* Pacify GCC's `empty if-body' warning. */
1559# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1560# ifndef YYSTACK_ALLOC_MAXIMUM
1561 /* The OS might guarantee only one guard page at the bottom of the stack,
1562 and a page size can be as small as 4096 bytes. So we cannot safely
1563 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1564 to allow for a few compiler-allocated temporary stack slots. */
1565# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1566# endif
1567# else
1568# define YYSTACK_ALLOC YYMALLOC
1569# define YYSTACK_FREE YYFREE
1570# ifndef YYSTACK_ALLOC_MAXIMUM
1571# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1572# endif
1573# if (defined __cplusplus && ! defined _STDLIB_H \
1574 && ! ((defined YYMALLOC || defined malloc) \
1575 && (defined YYFREE || defined free)))
1576# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1577# ifndef _STDLIB_H
1578# define _STDLIB_H 1
1579# endif
1580# endif
1581# ifndef YYMALLOC
1582# define YYMALLOC malloc
1583# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1584 || defined __cplusplus || defined _MSC_VER)
1585void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1586# endif
1587# endif
1588# ifndef YYFREE
1589# define YYFREE free
1590# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1591 || defined __cplusplus || defined _MSC_VER)
1592void free (void *); /* INFRINGES ON USER NAME SPACE */
1593# endif
1594# endif
1595# endif
1596#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1597
1598
1599#if (! defined yyoverflow \
1600 && (! defined __cplusplus \
1601 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1602
1603/* A type that is properly aligned for any stack member. */
1604union yyalloc
1605{
1606 yytype_int16 yyss;
1607 YYSTYPE yyvs;
1608 };
1609
1610/* The size of the maximum gap between one aligned stack and the next. */
1611# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1612
1613/* The size of an array large to enough to hold all stacks, each with
1614 N elements. */
1615# define YYSTACK_BYTES(N) \
1616 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1617 + YYSTACK_GAP_MAXIMUM)
1618
1619/* Copy COUNT objects from FROM to TO. The source and destination do
1620 not overlap. */
1621# ifndef YYCOPY
1622# if defined __GNUC__ && 1 < __GNUC__
1623# define YYCOPY(To, From, Count) \
1624 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1625# else
1626# define YYCOPY(To, From, Count) \
1627 do \
1628 { \
1629 YYSIZE_T yyi; \
1630 for (yyi = 0; yyi < (Count); yyi++) \
1631 (To)[yyi] = (From)[yyi]; \
1632 } \
1633 while (YYID (0))
1634# endif
1635# endif
1636
1637/* Relocate STACK from its old location to the new one. The
1638 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1639 elements in the stack, and YYPTR gives the new location of the
1640 stack. Advance YYPTR to a properly aligned location for the next
1641 stack. */
1642# define YYSTACK_RELOCATE(Stack) \
1643 do \
1644 { \
1645 YYSIZE_T yynewbytes; \
1646 YYCOPY (&yyptr->Stack, Stack, yysize); \
1647 Stack = &yyptr->Stack; \
1648 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1649 yyptr += yynewbytes / sizeof (*yyptr); \
1650 } \
1651 while (YYID (0))
1652
1653#endif
1654
1655/* YYFINAL -- State number of the termination state. */
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001656#define YYFINAL 44
Dan Gohmanf4423b12008-04-19 00:24:39 +00001657/* YYLAST -- Last index in YYTABLE. */
Devang Patel652203f2008-09-29 20:49:50 +00001658#define YYLAST 2439
Dan Gohmanf4423b12008-04-19 00:24:39 +00001659
1660/* YYNTOKENS -- Number of terminals. */
Devang Patel652203f2008-09-29 20:49:50 +00001661#define YYNTOKENS 173
Dan Gohmanf4423b12008-04-19 00:24:39 +00001662/* YYNNTS -- Number of nonterminals. */
Devang Patel652203f2008-09-29 20:49:50 +00001663#define YYNNTS 89
Dan Gohmanf4423b12008-04-19 00:24:39 +00001664/* YYNRULES -- Number of rules. */
Devang Patel652203f2008-09-29 20:49:50 +00001665#define YYNRULES 354
Dan Gohmanf4423b12008-04-19 00:24:39 +00001666/* YYNRULES -- Number of states. */
Devang Patel652203f2008-09-29 20:49:50 +00001667#define YYNSTATES 717
Dan Gohmanf4423b12008-04-19 00:24:39 +00001668
1669/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1670#define YYUNDEFTOK 2
Devang Patel652203f2008-09-29 20:49:50 +00001671#define YYMAXUTOK 413
Dan Gohmanf4423b12008-04-19 00:24:39 +00001672
1673#define YYTRANSLATE(YYX) \
1674 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1675
1676/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1677static const yytype_uint8 yytranslate[] =
1678{
1679 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1680 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1681 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1682 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patel652203f2008-09-29 20:49:50 +00001683 159, 160, 163, 2, 162, 2, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001684 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patel652203f2008-09-29 20:49:50 +00001685 168, 161, 169, 2, 2, 2, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001686 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1687 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patel652203f2008-09-29 20:49:50 +00001688 2, 165, 164, 167, 2, 2, 2, 2, 2, 172,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001689 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1690 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patel652203f2008-09-29 20:49:50 +00001691 166, 2, 2, 170, 2, 171, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001692 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1693 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1694 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1695 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1696 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1697 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1698 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1699 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1700 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1701 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1702 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1703 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1704 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1705 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1706 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1707 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1708 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1709 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1710 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1711 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1712 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1713 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1714 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1715 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1716 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1717 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1718 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001719 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
Devang Patel652203f2008-09-29 20:49:50 +00001720 155, 156, 157, 158
Dan Gohmanf4423b12008-04-19 00:24:39 +00001721};
1722
1723#if YYDEBUG
1724/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1725 YYRHS. */
1726static const yytype_uint16 yyprhs[] =
1727{
1728 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1729 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1730 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1731 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1732 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1733 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1734 119, 121, 123, 125, 127, 129, 130, 135, 136, 139,
Chris Lattner15bd0952008-08-29 17:20:18 +00001735 140, 143, 145, 147, 149, 150, 153, 155, 157, 159,
1736 161, 163, 165, 167, 169, 171, 172, 174, 176, 178,
1737 179, 181, 183, 184, 186, 188, 190, 192, 193, 195,
Dale Johannesendfe8c842008-09-26 19:32:34 +00001738 197, 198, 200, 202, 204, 206, 208, 211, 213, 215,
1739 217, 219, 221, 223, 225, 227, 229, 232, 233, 236,
Devang Patel652203f2008-09-29 20:49:50 +00001740 238, 240, 242, 243, 246, 248, 250, 252, 254, 256,
1741 258, 260, 262, 264, 266, 267, 270, 271, 274, 275,
1742 278, 279, 283, 286, 287, 289, 290, 294, 296, 299,
1743 301, 303, 305, 307, 309, 311, 313, 315, 317, 321,
1744 323, 326, 332, 338, 344, 350, 354, 357, 363, 368,
1745 371, 373, 375, 377, 381, 383, 387, 389, 390, 392,
1746 396, 401, 405, 409, 414, 419, 423, 430, 436, 439,
1747 442, 445, 448, 451, 454, 457, 460, 463, 466, 469,
1748 472, 479, 485, 494, 501, 508, 516, 524, 532, 540,
1749 547, 556, 565, 571, 579, 583, 585, 587, 589, 591,
1750 592, 595, 602, 604, 605, 607, 610, 611, 615, 616,
1751 620, 624, 628, 632, 633, 642, 643, 653, 654, 664,
1752 670, 673, 677, 679, 683, 687, 691, 695, 697, 698,
1753 704, 708, 710, 714, 716, 717, 729, 731, 733, 738,
1754 740, 742, 745, 749, 750, 752, 754, 756, 758, 760,
1755 762, 764, 766, 768, 770, 772, 776, 780, 783, 786,
1756 790, 793, 799, 804, 806, 812, 814, 816, 818, 820,
1757 822, 824, 827, 829, 833, 836, 839, 843, 847, 850,
1758 851, 853, 856, 859, 863, 873, 883, 892, 908, 910,
1759 912, 919, 925, 928, 931, 938, 946, 951, 956, 963,
1760 970, 971, 972, 976, 979, 983, 986, 988, 994, 1000,
1761 1007, 1014, 1021, 1028, 1033, 1040, 1045, 1050, 1057, 1064,
1762 1067, 1077, 1079, 1081, 1082, 1086, 1093, 1097, 1104, 1107,
1763 1113, 1121, 1127, 1132, 1137
Dan Gohmanf4423b12008-04-19 00:24:39 +00001764};
1765
1766/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1767static const yytype_int16 yyrhs[] =
1768{
Devang Patel652203f2008-09-29 20:49:50 +00001769 222, 0, -1, 75, -1, 76, -1, 77, -1, 78,
Dale Johannesendfe8c842008-09-26 19:32:34 +00001770 -1, 79, -1, 80, -1, 81, -1, 82, -1, 83,
1771 -1, 87, -1, 88, -1, 89, -1, 84, -1, 85,
1772 -1, 86, -1, 120, -1, 121, -1, 122, -1, 123,
1773 -1, 124, -1, 125, -1, 126, -1, 127, -1, 128,
1774 -1, 129, -1, 130, -1, 131, -1, 94, -1, 95,
1775 -1, 96, -1, 97, -1, 98, -1, 99, -1, 100,
1776 -1, 101, -1, 102, -1, 103, -1, 104, -1, 105,
1777 -1, 106, -1, 107, -1, 108, -1, 109, -1, 110,
1778 -1, 111, -1, 112, -1, 113, -1, 100, -1, 101,
1779 -1, 102, -1, 103, -1, 26, -1, 27, -1, 11,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001780 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
Devang Patel652203f2008-09-29 20:49:50 +00001781 -1, 19, -1, 22, -1, 24, -1, 181, -1, -1,
1782 55, 159, 4, 160, -1, -1, 181, 161, -1, -1,
1783 7, 161, -1, 20, -1, 23, -1, 188, -1, -1,
1784 186, 161, -1, 42, -1, 44, -1, 43, -1, 45,
Chris Lattner15bd0952008-08-29 17:20:18 +00001785 -1, 47, -1, 49, -1, 46, -1, 48, -1, 51,
Devang Patel652203f2008-09-29 20:49:50 +00001786 -1, -1, 156, -1, 157, -1, 158, -1, -1, 46,
Chris Lattner15bd0952008-08-29 17:20:18 +00001787 -1, 48, -1, -1, 42, -1, 43, -1, 44, -1,
1788 47, -1, -1, 44, -1, 42, -1, -1, 63, -1,
Dale Johannesendfe8c842008-09-26 19:32:34 +00001789 64, -1, 65, -1, 66, -1, 67, -1, 62, 4,
1790 -1, 142, -1, 121, -1, 141, -1, 122, -1, 144,
1791 -1, 145, -1, 147, -1, 148, -1, 149, -1, 54,
Devang Patel652203f2008-09-29 20:49:50 +00001792 4, -1, -1, 197, 196, -1, 144, -1, 142, -1,
1793 141, -1, -1, 199, 198, -1, 143, -1, 146, -1,
Dale Johannesendfe8c842008-09-26 19:32:34 +00001794 144, -1, 142, -1, 141, -1, 150, -1, 151, -1,
Devang Patel652203f2008-09-29 20:49:50 +00001795 154, -1, 155, -1, 153, -1, -1, 201, 200, -1,
1796 -1, 152, 22, -1, -1, 54, 4, -1, -1, 162,
1797 54, 4, -1, 34, 22, -1, -1, 205, -1, -1,
1798 162, 208, 207, -1, 205, -1, 54, 4, -1, 11,
1799 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
1800 -1, 17, -1, 50, -1, 209, -1, 210, 183, 163,
1801 -1, 244, -1, 164, 4, -1, 210, 159, 214, 160,
1802 201, -1, 10, 159, 214, 160, 201, -1, 165, 4,
1803 166, 210, 167, -1, 168, 4, 166, 210, 169, -1,
1804 170, 215, 171, -1, 170, 171, -1, 168, 170, 215,
1805 171, 169, -1, 168, 170, 171, 169, -1, 210, 197,
1806 -1, 210, -1, 10, -1, 211, -1, 213, 162, 211,
1807 -1, 213, -1, 213, 162, 39, -1, 39, -1, -1,
1808 210, -1, 215, 162, 210, -1, 210, 165, 218, 167,
1809 -1, 210, 165, 167, -1, 210, 172, 22, -1, 210,
1810 168, 218, 169, -1, 210, 170, 218, 171, -1, 210,
1811 170, 171, -1, 210, 168, 170, 218, 171, 169, -1,
1812 210, 168, 170, 171, 169, -1, 210, 40, -1, 210,
1813 41, -1, 210, 244, -1, 210, 217, -1, 210, 25,
1814 -1, 179, 3, -1, 179, 5, -1, 179, 4, -1,
1815 179, 6, -1, 11, 26, -1, 11, 27, -1, 180,
1816 9, -1, 176, 159, 216, 38, 210, 160, -1, 119,
1817 159, 216, 256, 160, -1, 133, 159, 216, 162, 216,
1818 162, 216, 160, -1, 174, 159, 216, 162, 216, 160,
1819 -1, 175, 159, 216, 162, 216, 160, -1, 90, 177,
1820 159, 216, 162, 216, 160, -1, 91, 178, 159, 216,
1821 162, 216, 160, -1, 92, 177, 159, 216, 162, 216,
1822 160, -1, 93, 178, 159, 216, 162, 216, 160, -1,
1823 135, 159, 216, 162, 216, 160, -1, 136, 159, 216,
1824 162, 216, 162, 216, 160, -1, 137, 159, 216, 162,
1825 216, 162, 216, 160, -1, 139, 159, 216, 257, 160,
1826 -1, 140, 159, 216, 162, 216, 257, 160, -1, 218,
1827 162, 216, -1, 216, -1, 32, -1, 33, -1, 37,
1828 -1, -1, 212, 244, -1, 125, 159, 221, 38, 210,
1829 160, -1, 223, -1, -1, 224, -1, 223, 224, -1,
1830 -1, 31, 225, 240, -1, -1, 30, 226, 241, -1,
1831 60, 59, 230, -1, 184, 18, 210, -1, 184, 18,
1832 10, -1, -1, 187, 191, 220, 219, 216, 183, 227,
1833 207, -1, -1, 187, 189, 191, 220, 219, 216, 183,
1834 228, 207, -1, -1, 187, 190, 191, 220, 219, 210,
1835 183, 229, 207, -1, 187, 191, 35, 194, 221, -1,
1836 52, 231, -1, 56, 161, 232, -1, 22, -1, 53,
1837 161, 22, -1, 68, 161, 22, -1, 165, 233, 167,
1838 -1, 233, 162, 22, -1, 22, -1, -1, 234, 162,
1839 210, 197, 182, -1, 210, 197, 182, -1, 234, -1,
1840 234, 162, 39, -1, 39, -1, -1, 195, 199, 212,
1841 186, 159, 235, 160, 201, 206, 203, 202, -1, 28,
1842 -1, 170, -1, 193, 191, 236, 237, -1, 29, -1,
1843 171, -1, 248, 239, -1, 192, 191, 236, -1, -1,
1844 61, -1, 3, -1, 4, -1, 5, -1, 6, -1,
1845 9, -1, 26, -1, 27, -1, 40, -1, 41, -1,
1846 25, -1, 168, 218, 169, -1, 165, 218, 167, -1,
1847 165, 167, -1, 172, 22, -1, 170, 218, 171, -1,
1848 170, 171, -1, 168, 170, 218, 171, 169, -1, 168,
1849 170, 171, 169, -1, 217, -1, 59, 242, 22, 162,
1850 22, -1, 7, -1, 8, -1, 181, -1, 186, -1,
1851 244, -1, 243, -1, 210, 245, -1, 246, -1, 247,
1852 162, 246, -1, 248, 249, -1, 238, 249, -1, 250,
1853 184, 251, -1, 250, 185, 251, -1, 250, 253, -1,
1854 -1, 21, -1, 69, 247, -1, 69, 10, -1, 70,
1855 17, 245, -1, 70, 11, 245, 162, 17, 245, 162,
1856 17, 245, -1, 71, 179, 245, 162, 17, 245, 165,
1857 252, 167, -1, 71, 179, 245, 162, 17, 245, 165,
1858 167, -1, 72, 195, 199, 212, 245, 159, 255, 160,
1859 201, 38, 17, 245, 73, 17, 245, -1, 73, -1,
1860 74, -1, 252, 179, 243, 162, 17, 245, -1, 179,
1861 243, 162, 17, 245, -1, 184, 259, -1, 185, 259,
1862 -1, 210, 165, 245, 162, 245, 167, -1, 254, 162,
1863 165, 245, 162, 245, 167, -1, 210, 197, 245, 197,
1864 -1, 17, 197, 245, 197, -1, 255, 162, 210, 197,
1865 245, 197, -1, 255, 162, 17, 197, 245, 197, -1,
1866 -1, -1, 256, 162, 246, -1, 162, 4, -1, 257,
1867 162, 4, -1, 58, 57, -1, 57, -1, 174, 210,
1868 245, 162, 245, -1, 175, 210, 245, 162, 245, -1,
1869 90, 177, 210, 245, 162, 245, -1, 91, 178, 210,
1870 245, 162, 245, -1, 92, 177, 210, 245, 162, 245,
1871 -1, 93, 178, 210, 245, 162, 245, -1, 176, 246,
1872 38, 210, -1, 133, 246, 162, 246, 162, 246, -1,
1873 134, 246, 162, 210, -1, 135, 246, 162, 246, -1,
1874 136, 246, 162, 246, 162, 246, -1, 137, 246, 162,
1875 246, 162, 246, -1, 132, 254, -1, 258, 195, 199,
1876 212, 245, 159, 255, 160, 201, -1, 261, -1, 36,
1877 -1, -1, 114, 210, 204, -1, 114, 210, 162, 11,
1878 245, 204, -1, 115, 210, 204, -1, 115, 210, 162,
1879 11, 245, 204, -1, 116, 246, -1, 260, 117, 210,
1880 245, 204, -1, 260, 118, 246, 162, 210, 245, 204,
1881 -1, 138, 210, 245, 162, 4, -1, 119, 210, 245,
1882 256, -1, 139, 210, 245, 257, -1, 140, 210, 245,
1883 162, 210, 245, 257, -1
Dan Gohmanf4423b12008-04-19 00:24:39 +00001884};
1885
1886/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1887static const yytype_uint16 yyrline[] =
1888{
Dale Johannesen236bbd42008-10-09 23:01:34 +00001889 0, 1143, 1143, 1143, 1143, 1143, 1143, 1143, 1143, 1143,
1890 1143, 1144, 1144, 1144, 1144, 1144, 1144, 1145, 1145, 1145,
1891 1145, 1145, 1145, 1146, 1146, 1146, 1146, 1146, 1146, 1149,
1892 1149, 1150, 1150, 1151, 1151, 1152, 1152, 1153, 1153, 1157,
1893 1157, 1158, 1158, 1159, 1159, 1160, 1160, 1161, 1161, 1162,
1894 1162, 1163, 1163, 1164, 1165, 1170, 1171, 1171, 1171, 1171,
1895 1171, 1173, 1173, 1173, 1174, 1174, 1176, 1177, 1181, 1185,
1896 1190, 1196, 1196, 1198, 1199, 1204, 1210, 1211, 1212, 1213,
1897 1214, 1215, 1219, 1220, 1221, 1225, 1226, 1227, 1228, 1232,
1898 1233, 1234, 1238, 1239, 1240, 1241, 1242, 1246, 1247, 1248,
1899 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1264, 1265, 1266,
1900 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1277, 1278, 1283,
1901 1284, 1285, 1288, 1289, 1295, 1296, 1297, 1298, 1299, 1300,
1902 1301, 1302, 1303, 1304, 1307, 1308, 1314, 1315, 1322, 1323,
1903 1329, 1330, 1339, 1347, 1348, 1353, 1354, 1355, 1360, 1373,
1904 1373, 1373, 1373, 1373, 1373, 1373, 1376, 1380, 1384, 1391,
1905 1396, 1404, 1439, 1470, 1475, 1485, 1495, 1499, 1509, 1516,
1906 1525, 1532, 1537, 1542, 1549, 1550, 1557, 1564, 1572, 1578,
1907 1590, 1618, 1634, 1661, 1689, 1715, 1735, 1761, 1781, 1793,
1908 1800, 1866, 1876, 1886, 1892, 1902, 1908, 1918, 1924, 1930,
1909 1946, 1958, 1979, 1987, 1993, 2004, 2009, 2014, 2019, 2024,
1910 2030, 2036, 2042, 2050, 2061, 2065, 2073, 2073, 2076, 2076,
1911 2079, 2091, 2112, 2117, 2125, 2126, 2130, 2130, 2134, 2134,
1912 2137, 2140, 2164, 2176, 2175, 2187, 2186, 2196, 2195, 2206,
1913 2246, 2249, 2255, 2265, 2269, 2274, 2276, 2281, 2286, 2295,
1914 2305, 2316, 2320, 2329, 2338, 2343, 2492, 2492, 2494, 2503,
1915 2503, 2505, 2510, 2522, 2526, 2531, 2535, 2539, 2544, 2549,
1916 2553, 2557, 2561, 2565, 2569, 2573, 2595, 2617, 2623, 2636,
1917 2648, 2653, 2665, 2671, 2675, 2685, 2689, 2693, 2698, 2705,
1918 2705, 2711, 2720, 2725, 2730, 2734, 2743, 2752, 2765, 2774,
1919 2778, 2786, 2806, 2810, 2815, 2826, 2845, 2854, 2958, 2962,
1920 2969, 2980, 2993, 3002, 3015, 3026, 3036, 3047, 3055, 3065,
1921 3072, 3075, 3076, 3084, 3090, 3099, 3103, 3108, 3124, 3141,
1922 3153, 3165, 3179, 3193, 3205, 3226, 3233, 3239, 3245, 3251,
1923 3266, 3376, 3381, 3385, 3392, 3399, 3409, 3416, 3426, 3434,
1924 3448, 3465, 3479, 3494, 3509
Dan Gohmanf4423b12008-04-19 00:24:39 +00001925};
1926#endif
1927
1928#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1929/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1930 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1931static const char *const yytname[] =
1932{
1933 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1934 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1935 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1936 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1937 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1938 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1939 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1940 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001941 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "COMMON", "OPAQUE",
Dan Gohmanf4423b12008-04-19 00:24:39 +00001942 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1943 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1944 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
Dale Johannesendfe8c842008-09-26 19:32:34 +00001945 "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE",
1946 "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM",
1947 "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "VICMP",
1948 "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1949 "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1950 "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1951 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1952 "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1953 "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
1954 "GETRESULT", "EXTRACTVALUE", "INSERTVALUE", "SIGNEXT", "ZEROEXT",
1955 "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL", "NEST",
Devang Patel652203f2008-09-29 20:49:50 +00001956 "READNONE", "READONLY", "GC", "OPTSIZE", "NOINLINE", "ALWAYSINLINE",
1957 "DEFAULT", "HIDDEN", "PROTECTED", "'('", "')'", "'='", "','", "'*'",
1958 "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'c'",
1959 "$accept", "ArithmeticOps", "LogicalOps", "CastOps", "IPredicates",
1960 "FPredicates", "IntType", "FPType", "LocalName", "OptLocalName",
1961 "OptAddrSpace", "OptLocalAssign", "LocalNumber", "GlobalName",
1962 "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
Devang Pateld4980812008-09-02 20:52:40 +00001963 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
Devang Patel05988662008-09-25 21:00:45 +00001964 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "Attribute",
Devang Patel652203f2008-09-29 20:49:50 +00001965 "OptAttributes", "RetAttr", "OptRetAttrs", "FuncAttr", "OptFuncAttrs",
1966 "OptGC", "OptAlign", "OptCAlign", "SectionString", "OptSection",
1967 "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types",
1968 "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", "TypeListI",
1969 "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "ThreadLocal",
1970 "AliaseeRef", "Module", "DefinitionList", "Definition", "@1", "@2", "@3",
1971 "@4", "@5", "AsmBlock", "TargetDefinition", "LibrariesDefinition",
1972 "LibList", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN",
1973 "FunctionHeader", "END", "Function", "FunctionProto", "OptSideEffect",
1974 "ConstValueRef", "SymbolicValueRef", "ValueRef", "ResolvedVal",
1975 "ReturnedVal", "BasicBlockList", "BasicBlock", "InstructionList",
1976 "BBTerminatorInst", "JumpTable", "Inst", "PHIList", "ParamList",
1977 "IndexList", "ConstantIndexList", "OptTailCall", "InstVal",
Chris Lattner15bd0952008-08-29 17:20:18 +00001978 "OptVolatile", "MemoryInst", 0
Dan Gohmanf4423b12008-04-19 00:24:39 +00001979};
1980#endif
1981
1982# ifdef YYPRINT
1983/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1984 token YYLEX-NUM. */
1985static const yytype_uint16 yytoknum[] =
1986{
1987 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1988 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1989 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1990 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1991 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1992 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1993 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1994 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1995 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1996 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1997 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1998 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1999 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
2000 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
2001 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
Devang Patel652203f2008-09-29 20:49:50 +00002002 405, 406, 407, 408, 409, 410, 411, 412, 413, 40,
2003 41, 61, 44, 42, 92, 91, 120, 93, 60, 62,
2004 123, 125, 99
Dan Gohmanf4423b12008-04-19 00:24:39 +00002005};
2006# endif
2007
2008/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002009static const yytype_uint16 yyr1[] =
Dan Gohmanf4423b12008-04-19 00:24:39 +00002010{
Devang Patel652203f2008-09-29 20:49:50 +00002011 0, 173, 174, 174, 174, 174, 174, 174, 174, 174,
2012 174, 175, 175, 175, 175, 175, 175, 176, 176, 176,
2013 176, 176, 176, 176, 176, 176, 176, 176, 176, 177,
2014 177, 177, 177, 177, 177, 177, 177, 177, 177, 178,
2015 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
2016 178, 178, 178, 178, 178, 179, 180, 180, 180, 180,
2017 180, 181, 181, 181, 182, 182, 183, 183, 184, 184,
2018 185, 186, 186, 187, 187, 188, 189, 189, 189, 189,
2019 189, 189, 190, 190, 190, 191, 191, 191, 191, 192,
2020 192, 192, 193, 193, 193, 193, 193, 194, 194, 194,
2021 195, 195, 195, 195, 195, 195, 195, 196, 196, 196,
2022 196, 196, 196, 196, 196, 196, 196, 197, 197, 198,
2023 198, 198, 199, 199, 200, 200, 200, 200, 200, 200,
2024 200, 200, 200, 200, 201, 201, 202, 202, 203, 203,
2025 204, 204, 205, 206, 206, 207, 207, 208, 208, 209,
2026 209, 209, 209, 209, 209, 209, 210, 210, 210, 210,
2027 210, 210, 210, 210, 210, 210, 210, 210, 210, 211,
2028 212, 212, 213, 213, 214, 214, 214, 214, 215, 215,
2029 216, 216, 216, 216, 216, 216, 216, 216, 216, 216,
2030 216, 216, 216, 216, 216, 216, 216, 216, 216, 216,
2031 217, 217, 217, 217, 217, 217, 217, 217, 217, 217,
2032 217, 217, 217, 217, 218, 218, 219, 219, 220, 220,
2033 221, 221, 222, 222, 223, 223, 225, 224, 226, 224,
2034 224, 224, 224, 227, 224, 228, 224, 229, 224, 224,
2035 224, 224, 230, 231, 231, 232, 233, 233, 233, 234,
2036 234, 235, 235, 235, 235, 236, 237, 237, 238, 239,
2037 239, 240, 241, 242, 242, 243, 243, 243, 243, 243,
2038 243, 243, 243, 243, 243, 243, 243, 243, 243, 243,
2039 243, 243, 243, 243, 243, 244, 244, 244, 244, 245,
2040 245, 246, 247, 247, 248, 248, 249, 249, 250, 250,
2041 250, 251, 251, 251, 251, 251, 251, 251, 251, 251,
2042 252, 252, 253, 253, 254, 254, 255, 255, 255, 255,
2043 255, 256, 256, 257, 257, 258, 258, 259, 259, 259,
2044 259, 259, 259, 259, 259, 259, 259, 259, 259, 259,
2045 259, 259, 260, 260, 261, 261, 261, 261, 261, 261,
2046 261, 261, 261, 261, 261
Dan Gohmanf4423b12008-04-19 00:24:39 +00002047};
2048
2049/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
2050static const yytype_uint8 yyr2[] =
2051{
2052 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
2053 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2054 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2055 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2056 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2057 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2058 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
Chris Lattner15bd0952008-08-29 17:20:18 +00002059 2, 1, 1, 1, 0, 2, 1, 1, 1, 1,
2060 1, 1, 1, 1, 1, 0, 1, 1, 1, 0,
2061 1, 1, 0, 1, 1, 1, 1, 0, 1, 1,
Dale Johannesendfe8c842008-09-26 19:32:34 +00002062 0, 1, 1, 1, 1, 1, 2, 1, 1, 1,
2063 1, 1, 1, 1, 1, 1, 2, 0, 2, 1,
Devang Patel652203f2008-09-29 20:49:50 +00002064 1, 1, 0, 2, 1, 1, 1, 1, 1, 1,
2065 1, 1, 1, 1, 0, 2, 0, 2, 0, 2,
2066 0, 3, 2, 0, 1, 0, 3, 1, 2, 1,
2067 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
2068 2, 5, 5, 5, 5, 3, 2, 5, 4, 2,
2069 1, 1, 1, 3, 1, 3, 1, 0, 1, 3,
2070 4, 3, 3, 4, 4, 3, 6, 5, 2, 2,
2071 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2072 6, 5, 8, 6, 6, 7, 7, 7, 7, 6,
2073 8, 8, 5, 7, 3, 1, 1, 1, 1, 0,
2074 2, 6, 1, 0, 1, 2, 0, 3, 0, 3,
2075 3, 3, 3, 0, 8, 0, 9, 0, 9, 5,
2076 2, 3, 1, 3, 3, 3, 3, 1, 0, 5,
2077 3, 1, 3, 1, 0, 11, 1, 1, 4, 1,
2078 1, 2, 3, 0, 1, 1, 1, 1, 1, 1,
2079 1, 1, 1, 1, 1, 3, 3, 2, 2, 3,
2080 2, 5, 4, 1, 5, 1, 1, 1, 1, 1,
2081 1, 2, 1, 3, 2, 2, 3, 3, 2, 0,
2082 1, 2, 2, 3, 9, 9, 8, 15, 1, 1,
2083 6, 5, 2, 2, 6, 7, 4, 4, 6, 6,
2084 0, 0, 3, 2, 3, 2, 1, 5, 5, 6,
2085 6, 6, 6, 4, 6, 4, 4, 6, 6, 2,
2086 9, 1, 1, 0, 3, 6, 3, 6, 2, 5,
2087 7, 5, 4, 4, 7
Dan Gohmanf4423b12008-04-19 00:24:39 +00002088};
2089
2090/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2091 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2092 means the default is an error. */
2093static const yytype_uint16 yydefact[] =
2094{
Devang Patel652203f2008-09-29 20:49:50 +00002095 74, 61, 71, 62, 72, 63, 228, 226, 0, 0,
2096 0, 0, 0, 0, 85, 73, 0, 74, 224, 89,
2097 92, 0, 0, 240, 0, 0, 68, 0, 75, 76,
Chris Lattner15bd0952008-08-29 17:20:18 +00002098 78, 77, 79, 82, 80, 83, 81, 84, 86, 87,
Devang Patel652203f2008-09-29 20:49:50 +00002099 88, 85, 85, 219, 1, 225, 90, 91, 85, 229,
2100 93, 94, 95, 96, 85, 299, 227, 299, 0, 0,
2101 248, 241, 242, 230, 285, 286, 232, 149, 150, 151,
2102 154, 153, 152, 155, 156, 0, 0, 0, 0, 287,
2103 288, 157, 231, 159, 219, 219, 97, 218, 0, 100,
2104 100, 300, 295, 69, 259, 260, 261, 294, 243, 244,
2105 247, 0, 177, 160, 0, 0, 0, 0, 166, 178,
2106 0, 0, 177, 0, 0, 0, 99, 98, 0, 216,
2107 217, 0, 0, 101, 102, 103, 104, 105, 122, 262,
2108 0, 0, 343, 343, 298, 0, 245, 176, 117, 172,
2109 174, 0, 0, 0, 0, 0, 0, 165, 0, 0,
2110 158, 0, 0, 171, 0, 170, 0, 239, 149, 150,
2111 151, 154, 153, 152, 0, 0, 67, 67, 106, 0,
2112 256, 257, 258, 70, 342, 326, 0, 0, 0, 0,
2113 100, 308, 309, 2, 3, 4, 5, 6, 7, 8,
Dale Johannesendfe8c842008-09-26 19:32:34 +00002114 9, 10, 14, 15, 16, 11, 12, 13, 0, 0,
2115 0, 0, 0, 0, 0, 0, 17, 18, 19, 20,
2116 21, 22, 23, 24, 25, 26, 27, 28, 0, 0,
Nate Begemanac80ade2008-05-12 19:01:56 +00002117 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patel652203f2008-09-29 20:49:50 +00002118 296, 100, 312, 0, 341, 297, 313, 246, 169, 0,
2119 134, 67, 67, 168, 0, 179, 0, 134, 67, 67,
2120 0, 220, 197, 198, 193, 195, 194, 196, 199, 192,
2121 188, 189, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002122 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patel652203f2008-09-29 20:49:50 +00002123 191, 190, 233, 121, 120, 119, 123, 0, 325, 302,
2124 67, 292, 301, 0, 0, 55, 0, 122, 29, 30,
2125 31, 32, 33, 34, 35, 36, 37, 38, 0, 53,
2126 54, 49, 50, 51, 52, 39, 40, 41, 42, 43,
2127 44, 45, 46, 47, 48, 0, 0, 0, 140, 140,
2128 348, 67, 67, 339, 0, 0, 0, 0, 0, 67,
2129 67, 67, 67, 67, 0, 122, 0, 0, 0, 108,
2130 110, 109, 107, 111, 112, 113, 114, 115, 118, 175,
2131 173, 162, 163, 164, 167, 66, 161, 235, 237, 0,
Chris Lattner15bd0952008-08-29 17:20:18 +00002132 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patel652203f2008-09-29 20:49:50 +00002133 0, 181, 215, 0, 0, 0, 185, 0, 182, 0,
2134 0, 0, 145, 0, 265, 266, 267, 268, 269, 274,
2135 270, 271, 272, 273, 263, 0, 0, 0, 0, 283,
2136 290, 289, 291, 0, 0, 303, 0, 0, 67, 67,
2137 67, 67, 0, 344, 0, 346, 321, 0, 0, 0,
2138 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2139 0, 67, 0, 116, 128, 127, 124, 126, 125, 129,
2140 130, 133, 131, 132, 135, 145, 145, 0, 0, 0,
2141 0, 0, 321, 0, 0, 0, 0, 0, 0, 0,
2142 180, 166, 178, 0, 183, 184, 0, 0, 0, 0,
2143 234, 254, 264, 0, 277, 0, 0, 0, 280, 0,
2144 278, 293, 0, 0, 0, 0, 0, 0, 0, 0,
2145 0, 0, 352, 0, 0, 0, 335, 336, 0, 0,
2146 0, 0, 353, 0, 0, 0, 333, 0, 140, 0,
2147 236, 238, 67, 0, 0, 0, 0, 0, 0, 0,
2148 0, 0, 0, 0, 214, 187, 0, 0, 0, 0,
2149 0, 0, 147, 145, 253, 117, 251, 0, 0, 276,
2150 166, 0, 275, 279, 0, 0, 0, 0, 0, 0,
2151 0, 140, 141, 140, 0, 0, 0, 0, 0, 0,
2152 351, 323, 0, 67, 327, 328, 0, 0, 349, 67,
2153 221, 0, 0, 0, 0, 201, 0, 0, 0, 0,
2154 212, 0, 186, 0, 0, 67, 142, 148, 146, 65,
2155 0, 134, 0, 282, 0, 0, 0, 320, 329, 330,
2156 331, 332, 345, 347, 322, 0, 0, 334, 337, 338,
2157 324, 0, 320, 140, 0, 0, 0, 0, 0, 209,
2158 0, 0, 0, 203, 204, 200, 64, 250, 252, 117,
2159 143, 284, 281, 0, 0, 117, 117, 0, 314, 0,
2160 354, 0, 350, 205, 206, 207, 208, 0, 0, 0,
2161 213, 65, 144, 138, 0, 306, 0, 0, 0, 0,
2162 134, 0, 315, 134, 202, 210, 211, 249, 0, 136,
2163 304, 0, 305, 0, 108, 110, 117, 117, 0, 117,
2164 117, 340, 139, 0, 255, 0, 0, 317, 316, 0,
2165 0, 0, 137, 0, 0, 0, 117, 117, 311, 0,
2166 0, 319, 318, 310, 0, 0, 307
Dan Gohmanf4423b12008-04-19 00:24:39 +00002167};
2168
2169/* YYDEFGOTO[NTERM-NUM]. */
2170static const yytype_int16 yydefgoto[] =
2171{
Devang Patel652203f2008-09-29 20:49:50 +00002172 -1, 277, 278, 279, 308, 325, 164, 165, 79, 637,
Dale Johannesendfe8c842008-09-26 19:32:34 +00002173 113, 12, 133, 80, 14, 15, 41, 42, 43, 48,
Devang Patel652203f2008-09-29 20:49:50 +00002174 54, 118, 128, 358, 238, 286, 169, 454, 361, 694,
2175 679, 423, 542, 663, 480, 543, 81, 166, 139, 156,
2176 140, 141, 110, 382, 409, 383, 121, 88, 157, 16,
2177 17, 18, 20, 19, 392, 455, 456, 63, 23, 61,
2178 101, 546, 547, 129, 172, 55, 96, 56, 49, 483,
2179 410, 83, 412, 291, 292, 57, 92, 93, 230, 667,
2180 134, 333, 647, 502, 512, 231, 232, 233, 234
Dan Gohmanf4423b12008-04-19 00:24:39 +00002181};
2182
2183/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2184 STATE-NUM. */
Devang Patel652203f2008-09-29 20:49:50 +00002185#define YYPACT_NINF -620
Dan Gohmanf4423b12008-04-19 00:24:39 +00002186static const yytype_int16 yypact[] =
2187{
Devang Patel652203f2008-09-29 20:49:50 +00002188 484, -620, -620, -620, -620, -620, -620, -620, -14, -116,
2189 -6, -83, 104, -31, 24, -620, 161, 528, -620, 238,
2190 204, 43, 49, -620, 5, 196, -620, 1912, -620, -620,
2191 -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,
2192 -620, 173, 173, 227, -620, -620, -620, -620, 173, -620,
2193 -620, -620, -620, -620, 173, 202, -620, -9, 234, 243,
2194 246, -620, -620, -620, -620, -620, 67, -620, -620, -620,
2195 -620, -620, -620, -620, -620, 273, 285, 3, 624, -620,
2196 -620, -620, 4, -620, 201, 201, 253, -620, 81, 240,
2197 240, -620, -620, 39, -620, -620, -620, -620, -620, -620,
2198 -620, -59, 1564, -620, 128, 132, 643, 67, -620, 4,
2199 -114, 165, 1564, 145, 81, 81, -620, -620, 1605, -620,
2200 -620, 2014, 324, -620, -620, -620, -620, -620, -620, -620,
2201 -13, 188, 2299, 2299, -620, 328, -620, -620, 4, -620,
2202 189, 194, 2076, 2076, 186, -111, 2076, -620, 352, 205,
2203 -620, 2014, 2076, 67, 208, 4, 247, -620, 216, 351,
2204 355, 359, 365, 368, 269, 372, 1625, 306, -620, 1517,
2205 -620, -620, -620, -620, -620, -620, 325, 2094, 38, 373,
2206 240, -620, -620, -620, -620, -620, -620, -620, -620, -620,
2207 -620, -620, -620, -620, -620, -620, -620, -620, 298, 336,
2208 298, 336, 2076, 2076, 2076, 2076, -620, -620, -620, -620,
2209 -620, -620, -620, -620, -620, -620, -620, -620, 2076, 2076,
2210 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076,
2211 -620, 240, -620, 66, -620, -620, -620, -620, 231, 1791,
2212 -620, -17, -21, -620, 214, 4, 225, -620, 306, -5,
2213 1605, -620, -620, -620, -620, -620, -620, -620, -620, -620,
2214 -620, -620, 298, 336, 298, 336, 229, 230, 249, 250,
2215 251, 252, 256, 1809, 2117, 690, 364, 257, 259, 261,
2216 -620, -620, -620, -620, -620, -620, -620, 114, -620, 67,
2217 1019, -620, 262, 1189, 1189, -620, 1189, -620, -620, -620,
2218 -620, -620, -620, -620, -620, -620, -620, -620, 2076, -620,
2219 -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,
2220 -620, -620, -620, -620, -620, 2076, 2076, 2076, -23, 28,
2221 -620, 1019, -18, 265, 266, 268, 272, 288, 289, 1019,
2222 1019, 1019, 1019, 1019, 383, -620, 2076, 2076, 398, -620,
2223 -620, -620, -620, -620, -620, -620, -620, -620, -620, -620,
2224 -620, 137, -620, -620, -620, -620, 137, -620, 145, 385,
2225 293, 294, 295, 297, 2014, 2014, 2014, 2014, 2014, 2014,
2226 2014, -620, -620, -56, 1069, -74, -620, -80, -620, 2014,
2227 2014, 2014, 296, 300, -620, -620, -620, -620, -620, -620,
2228 -620, -620, -620, -620, 396, 1832, 2135, 1239, 403, -620,
2229 -620, -620, -620, 2076, 299, -620, 301, 1517, 1019, 1019,
2230 1019, 1019, 8, -620, 33, -620, -620, 1189, 303, 2076,
2231 2076, 2076, 2076, 2076, 302, 304, 307, 308, 309, 2076,
2232 1517, 1019, 312, -620, -620, -620, -620, -620, -620, -620,
2233 -620, -620, -620, -620, -620, 296, 296, 2076, 2014, 2014,
2234 2014, 2014, -620, 317, 318, 319, 320, 304, 323, 2014,
2235 -620, 326, 1471, -77, -620, -620, 327, 330, 424, 2,
2236 -620, 1850, -620, 443, -620, -52, 1280, -73, -620, -72,
2237 -620, -620, 469, 471, 1189, 332, 334, 337, 338, 1189,
2238 494, 1189, 339, 343, 1189, 347, 4, -620, 348, 349,
2239 508, 519, 362, 2076, 1189, 1189, 4, 1189, 363, 2076,
2240 -620, -620, 26, 367, 375, 377, 387, 149, 2014, 2014,
2241 2014, 2014, 157, 2014, -620, -620, 357, 2014, 2014, 2076,
2242 505, 526, -620, 296, -620, 4, 391, 394, 393, -620,
2243 366, -62, -620, -620, 1189, 1189, 386, 1189, 1189, 1189,
2244 1189, 363, -620, 363, 2076, 1189, 395, 2076, 2076, 2076,
2245 -620, -620, 552, 1019, -620, -620, 405, 511, -620, 1019,
2246 -620, 2014, 2014, 2014, 2014, -620, 400, 406, 407, 408,
2247 -620, 304, -620, 411, 412, 57, -620, -620, -620, 11,
2248 1891, -620, 545, -620, 399, 413, 414, 2179, -620, -620,
2249 -620, -620, -620, -620, -620, 409, 1189, -620, -620, -620,
2250 -620, 304, 2179, 363, 417, 418, 423, 425, 2014, -620,
2251 2014, 2014, 180, -620, -620, -620, -620, -620, -620, 4,
2252 172, -620, -620, 556, -3, 46, 4, 181, -620, 422,
2253 362, 184, -620, -620, -620, -620, -620, 430, 431, 432,
2254 -620, 11, -620, 539, 1189, -620, 1337, -1, 865, 865,
2255 -620, 2197, -620, -620, -620, -620, -620, -620, 590, 445,
2256 -620, 433, -620, 1337, 446, 453, -620, -620, 86, 46,
2257 4, 137, -620, 582, -620, 596, 452, 231, 231, 598,
2258 865, 865, -620, 1189, 599, 1189, -620, -620, -620, 1189,
2259 544, 231, 231, -620, 603, 1189, -620
Dan Gohmanf4423b12008-04-19 00:24:39 +00002260};
2261
2262/* YYPGOTO[NTERM-NUM]. */
2263static const yytype_int16 yypgoto[] =
2264{
Devang Patel652203f2008-09-29 20:49:50 +00002265 -620, 42, 112, 200, -160, -158, -177, -620, 0, -39,
2266 -151, 531, -620, 9, -620, -620, -620, -620, 77, -620,
2267 -620, -620, -152, -620, -518, -620, -268, -620, -244, -620,
2268 -620, -311, -15, -620, -414, -620, -620, -26, 389, -164,
2269 -620, 514, 523, 142, -162, -261, 220, 263, 380, -620,
2270 -620, 625, -620, -620, -620, -620, -620, -620, -620, -620,
2271 -620, -620, -620, 559, -620, -620, -620, -620, -620, -620,
2272 -619, -82, 267, -198, -620, -620, 595, -620, 535, -620,
2273 -620, -620, 47, 215, -456, -620, 543, -620, -620
Dan Gohmanf4423b12008-04-19 00:24:39 +00002274};
2275
2276/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2277 positive, shift that token. If negative, reduce the rule which
2278 number is the opposite. If zero, do what YYDEFACT says.
2279 If YYTABLE_NINF, syntax error. */
Devang Patel652203f2008-09-29 20:49:50 +00002280#define YYTABLE_NINF -224
Dan Gohmanf4423b12008-04-19 00:24:39 +00002281static const yytype_int16 yytable[] =
2282{
Devang Patel652203f2008-09-29 20:49:50 +00002283 11, 82, 296, 366, 280, 287, 330, 105, 295, 13,
2284 295, 532, 91, 385, 387, 170, 282, 11, 425, 499,
2285 94, 334, 335, 336, 337, 338, 13, 599, 297, 417,
2286 1, 344, 111, 3, 111, 5, 540, 111, 111, 21,
2287 326, 520, 521, 327, 501, 24, 131, 681, 146, 293,
2288 111, 146, 109, 25, 22, 294, 541, 147, 1, 111,
2289 244, 3, 500, 5, 696, 348, 29, 30, 31, 32,
2290 33, 34, 35, 36, 251, 37, 138, 440, 26, 345,
2291 109, 111, 469, 111, 281, 469, 138, 500, 469, 469,
2292 469, 475, 155, 11, 536, 474, 552, 367, 368, 553,
2293 469, -155, 370, 135, 372, 371, 469, 373, 136, 604,
2294 469, 470, 111, 119, 120, 549, 241, 242, 84, 85,
2295 245, 661, 27, 473, 699, 89, 249, 668, 669, 598,
2296 28, 90, 349, 350, 2, 632, 112, 4, 112, 422,
2297 -67, 112, 112, 155, 485, 487, 489, 427, 363, 442,
2298 362, 290, 351, 352, 112, 353, 354, 171, 355, 356,
2299 357, 44, 95, 112, 665, 650, 682, -67, 697, 698,
2300 60, 700, 701, 106, 227, 227, 328, 329, 290, 331,
2301 38, 39, 40, 346, 347, 112, 580, 112, 711, 712,
2302 424, -67, 332, 290, 290, 290, 290, 290, 339, 340,
2303 341, 342, 343, 290, 58, -155, 540, 578, 411, -155,
2304 59, 411, 411, 138, 411, 491, 112, 635, 62, -55,
2305 -55, -55, -55, 91, 155, 551, 102, 444, 445, 446,
2306 447, 505, 448, 507, 508, 509, 449, 450, 87, 451,
2307 452, 453, 252, 253, 228, 228, 50, 51, 52, 411,
2308 612, 53, 613, 494, 64, 65, 98, 411, 411, 411,
2309 411, 411, 86, 167, 87, 99, 1, 2, 100, 3,
2310 4, 5, 254, 255, 256, 257, 517, 103, 444, 445,
2311 446, 447, 418, 448, 46, 348, 47, 449, 450, 104,
2312 451, 452, 453, 248, 142, 116, 393, 117, 143, 419,
2313 420, 421, 122, 123, 124, 125, 126, 127, 150, 585,
2314 280, 564, 652, 444, 445, 446, 447, 590, 448, 572,
2315 441, 290, 449, 450, 148, 451, 452, 453, 168, 38,
2316 39, 40, 229, 229, 151, 152, 411, 411, 411, 411,
2317 660, 670, 572, 671, 673, 411, 671, 114, 115, 173,
2318 237, 239, 349, 350, 240, 243, 246, 640, 472, 411,
2319 -56, 111, 309, 310, -57, 247, 614, 250, -60, 617,
2320 618, 619, 351, 352, -59, 353, 354, -58, 355, 356,
2321 357, 258, 288, 364, 295, 365, 388, 290, 374, 375,
2322 281, 155, 298, 299, 300, 301, 302, 303, 304, 305,
2323 306, 307, 443, 290, 506, 290, 290, 290, 376, 377,
2324 378, 379, 411, 516, 155, 380, 389, 411, 390, 411,
2325 391, 439, 411, 457, 413, 490, 688, 428, 429, 691,
2326 430, 522, 411, 411, 431, 411, 311, 312, 313, 314,
2327 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
2328 432, 433, 458, 459, 460, 545, 461, 482, 479, 481,
2329 472, 492, 539, 493, 510, 548, 511, 666, 504, 513,
2330 514, 515, 411, 411, 519, 411, 411, 411, 411, 528,
2331 529, 530, 531, 411, -223, 533, 554, 573, 555, 537,
2332 683, 411, 538, 579, 557, 535, 558, 411, 562, 559,
2333 560, 564, -69, 1, 2, 565, 3, 4, 5, 567,
2334 568, 569, 570, 595, 6, 7, 462, 463, 464, 465,
2335 466, 467, 468, 571, 572, 577, 592, 596, -222, 581,
2336 597, 476, 477, 478, 411, 603, 8, 582, 290, 583,
2337 9, 290, 290, 290, 10, 607, -69, 1, 2, 584,
2338 3, 4, 5, 600, 601, 602, 620, 616, 6, 7,
2339 414, 415, 628, 416, 622, 500, 629, 641, 642, 630,
2340 631, 633, 634, 664, 639, 643, 648, 653, 654, 644,
2341 8, 646, 411, 655, 9, 656, 411, 411, 10, 672,
2342 674, 675, 676, 678, 692, 695, 646, 693, 426, 636,
2343 523, 524, 525, 526, 702, -18, 434, 435, 436, 437,
2344 438, 534, -19, 703, 704, 705, 709, 714, 411, 411,
2345 715, 411, 677, 411, 132, 662, 149, 411, 360, 145,
2346 369, 64, 65, 411, 107, 67, 68, 69, 70, 71,
2347 72, 73, 45, 1, 2, 690, 3, 4, 5, 130,
2348 64, 65, 97, 107, 67, 68, 69, 70, 71, 72,
2349 73, 636, 1, 2, 0, 3, 4, 5, 235, 651,
2350 586, 587, 588, 589, 74, 591, 236, 527, 0, 593,
2351 594, 0, 0, 0, 0, 495, 496, 497, 498, 0,
2352 0, 0, 0, 74, 503, 0, 0, 64, 65, 0,
2353 107, 158, 159, 160, 161, 162, 163, 73, 518, 1,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002354 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
Devang Patel652203f2008-09-29 20:49:50 +00002355 0, 0, 0, 624, 625, 626, 627, 0, 0, 0,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002356 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesendfe8c842008-09-26 19:32:34 +00002357 74, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner15bd0952008-08-29 17:20:18 +00002358 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patel652203f2008-09-29 20:49:50 +00002359 0, 556, 0, 0, 0, 0, 561, 0, 563, 0,
2360 657, 566, 658, 659, 0, 0, 0, 0, 0, 0,
2361 0, 574, 575, 0, 576, 0, 0, 0, 75, 76,
2362 0, 0, 77, 0, 78, 108, 0, 0, 0, 0,
2363 0, 0, 0, 0, 0, 0, 0, 75, 76, 0,
2364 0, 77, 0, 78, 144, 0, 0, 0, 0, 0,
2365 0, 605, 606, 0, 608, 609, 610, 611, 0, 0,
2366 0, 0, 615, 0, 0, 0, 0, 0, 0, 0,
2367 621, 0, 0, 0, 0, 0, 623, 0, 0, 0,
2368 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2369 78, 386, 0, 0, 0, 0, 0, 0, 394, 395,
2370 396, 397, 64, 65, 398, 0, 0, 0, 0, 0,
2371 0, 0, 0, 649, 1, 2, 0, 3, 4, 5,
2372 399, 400, 401, 0, 0, 0, 0, 0, 0, 0,
2373 0, 0, 0, 0, 0, 402, 403, 0, 0, 0,
2374 0, 0, 0, 0, 0, 0, 0, 0, 0, 348,
2375 0, 0, 0, 0, 404, 0, 0, 0, 0, 0,
2376 0, 680, 0, 0, 0, 686, 687, 0, 0, 0,
2377 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
2378 193, 194, 195, 196, 197, 262, 263, 264, 265, 0,
2379 0, 0, 0, 0, 0, 0, 0, 706, 707, 0,
2380 708, 0, 710, 0, 0, 0, 713, 0, 0, 0,
2381 0, 0, 716, 0, 266, 206, 684, 685, 209, 210,
2382 211, 212, 213, 214, 215, 216, 217, 0, 267, 0,
2383 268, 269, 270, 0, 271, 272, 351, 352, 0, 353,
2384 354, 0, 355, 356, 357, 0, 0, 0, 0, 0,
2385 0, 0, 394, 395, 396, 397, 64, 65, 398, 0,
2386 405, 0, 0, 406, 0, 407, 0, 408, 1, 2,
2387 0, 3, 4, 5, 399, 400, 401, 0, 0, 0,
2388 0, 0, 0, 0, 0, 0, 0, 0, 0, 402,
2389 403, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2390 0, 0, 0, 0, 111, 0, 64, 65, 404, 107,
2391 158, 159, 160, 161, 162, 163, 73, 0, 1, 2,
2392 0, 3, 4, 5, 183, 184, 185, 186, 187, 188,
2393 189, 190, 191, 192, 193, 194, 195, 196, 197, 262,
2394 263, 264, 265, 0, 0, 0, 0, 0, 0, 74,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002395 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patel652203f2008-09-29 20:49:50 +00002396 0, 0, 0, 0, 0, 0, 0, 0, 266, 206,
2397 207, 208, 209, 210, 211, 212, 213, 214, 215, 216,
2398 217, 0, 267, 0, 268, 269, 270, 0, 271, 272,
Dale Johannesendfe8c842008-09-26 19:32:34 +00002399 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patel652203f2008-09-29 20:49:50 +00002400 0, 0, 0, 0, 0, 0, 0, 0, 112, 0,
2401 0, 0, 0, 0, 405, 0, 0, 406, 0, 407,
2402 0, 408, 394, 395, 396, 397, 64, 65, 398, 0,
2403 0, 0, 0, 0, 0, 0, 0, 0, 1, 2,
2404 0, 3, 4, 5, 399, 400, 401, 0, 0, 0,
2405 0, 0, 0, 0, 0, 0, 0, 0, 0, 402,
2406 403, 0, 0, 75, 76, 0, 0, 77, 0, 78,
2407 471, 0, 0, 0, 0, 0, 64, 65, 404, 107,
2408 158, 159, 160, 161, 162, 163, 73, 0, 1, 2,
2409 0, 3, 4, 5, 183, 184, 185, 186, 187, 188,
2410 189, 190, 191, 192, 193, 194, 195, 196, 197, 262,
2411 263, 264, 265, 0, 0, 0, 0, 64, 65, 74,
2412 107, 158, 159, 160, 161, 162, 163, 73, 0, 1,
2413 2, 0, 3, 4, 5, 0, 0, 0, 266, 206,
2414 207, 208, 209, 210, 211, 212, 213, 214, 215, 216,
2415 217, 0, 267, 0, 268, 269, 270, 0, 271, 272,
2416 74, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2417 394, 395, 396, 397, 0, 0, 398, 0, 0, 0,
2418 0, 0, 0, 0, 405, 0, 0, 406, 0, 407,
2419 0, 408, 399, 400, 401, 0, 0, 0, 0, 0,
2420 0, 0, 0, 0, 0, 0, 0, 402, 403, 0,
2421 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2422 0, 0, 0, 0, 0, 0, 404, 0, 0, 0,
2423 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
2424 488, 0, 183, 184, 185, 186, 187, 188, 189, 190,
2425 191, 192, 193, 194, 195, 196, 197, 262, 263, 264,
2426 265, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2427 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2428 78, 550, 0, 0, 0, 0, 266, 206, 207, 208,
2429 209, 210, 211, 212, 213, 214, 215, 216, 217, 0,
2430 267, 0, 268, 269, 270, 0, 271, 272, 64, 65,
2431 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2432 1, 2, 0, 3, 4, 5, 259, 0, 0, 0,
2433 0, 0, 405, 0, 0, 406, 0, 407, 0, 408,
2434 0, 260, 261, 0, 0, 0, 0, 0, 0, 0,
2435 0, 0, 0, 0, 64, 65, 111, 153, 67, 68,
2436 69, 70, 71, 72, 73, 0, 1, 2, 0, 3,
2437 4, 5, 0, 0, 0, 0, 183, 184, 185, 186,
2438 187, 188, 189, 190, 191, 192, 193, 194, 195, 196,
2439 197, 262, 263, 264, 265, 0, 0, 74, 0, 0,
2440 0, 64, 65, 0, 107, 67, 68, 69, 70, 71,
2441 72, 73, 0, 1, 2, 0, 3, 4, 5, 0,
2442 266, 206, 207, 208, 209, 210, 211, 212, 213, 214,
2443 215, 216, 217, 137, 267, 0, 268, 269, 270, 0,
2444 271, 272, 64, 65, 74, 153, 67, 68, 69, 70,
2445 71, 72, 73, 0, 1, 2, 0, 3, 4, 5,
2446 112, 0, 64, 65, -67, 0, 273, 0, 0, 274,
2447 0, 275, 0, 276, 1, 2, 0, 3, 4, 5,
2448 259, 0, 0, 0, 0, 74, 0, 0, 283, 284,
2449 0, 285, 0, 0, 0, 260, 261, 0, 0, 0,
2450 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2451 111, 75, 76, 0, 0, 77, 0, 78, 0, 0,
2452 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2453 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
2454 193, 194, 195, 196, 197, 262, 263, 264, 265, 0,
2455 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2456 154, 0, 77, 0, 78, 0, 0, 0, 0, 0,
2457 0, 0, 0, 0, 266, 206, 207, 208, 209, 210,
2458 211, 212, 213, 214, 215, 216, 217, 0, 267, 0,
2459 268, 269, 270, 0, 271, 272, 0, 0, 0, 75,
2460 76, 0, 0, 77, 0, 78, 0, 0, 0, 0,
2461 0, 0, 0, 0, 112, 0, 0, 0, 0, 0,
2462 273, 0, 0, 274, 0, 275, 0, 276, 64, 65,
2463 0, 107, 67, 68, 69, 70, 71, 72, 73, 0,
2464 1, 2, 0, 3, 4, 5, 64, 65, 0, 107,
2465 158, 159, 160, 161, 162, 163, 73, 0, 1, 2,
2466 359, 3, 4, 5, 0, 0, 0, 0, 0, 64,
2467 65, 74, 107, 158, 159, 160, 161, 162, 163, 73,
2468 0, 1, 2, 0, 3, 4, 5, 64, 65, 74,
2469 107, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2470 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2471 0, 0, 74, 0, 0, 0, 0, 0, 0, 544,
2472 0, 0, 0, 0, 0, 0, 0, 0, 64, 65,
2473 74, 107, 67, 68, 69, 70, 71, 72, 73, 0,
2474 1, 2, 0, 3, 4, 5, 0, 0, 0, 64,
2475 65, 0, 66, 67, 68, 69, 70, 71, 72, 73,
2476 638, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2477 0, 74, 0, 0, 0, 0, 0, 0, 0, 0,
2478 0, 0, 0, 0, 0, 75, 76, 0, 0, 77,
2479 0, 78, 74, 0, 0, 0, 0, 0, 0, 0,
2480 0, 0, 0, 75, 76, 0, 381, 77, 0, 78,
2481 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2482 0, 0, 0, 0, 0, 0, 75, 76, 0, 484,
2483 77, 0, 78, 0, 0, 0, 0, 0, 0, 0,
2484 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2485 78, 64, 65, 0, 107, 158, 159, 160, 161, 162,
2486 163, 73, 0, 1, 2, 0, 3, 4, 5, 0,
2487 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2488 0, 0, 0, 0, 0, 75, 76, 0, 0, 77,
2489 0, 78, 0, 0, 74, 0, 0, 0, 0, 0,
2490 0, 0, 0, 0, 0, 0, 75, 76, 0, 0,
2491 77, 0, 78, 64, 65, 0, 107, 67, 68, 69,
2492 70, 71, 72, 73, 0, 1, 2, 0, 3, 4,
2493 5, 64, 65, 0, 289, 67, 68, 69, 70, 71,
2494 72, 73, 0, 1, 2, 0, 3, 4, 5, 0,
2495 0, 0, 0, 0, 64, 65, 74, 107, 158, 159,
2496 160, 161, 162, 163, 73, 0, 1, 2, 0, 3,
2497 4, 5, 64, 65, 74, 107, 158, 159, 160, 161,
2498 162, 163, 73, 0, 1, 2, 0, 3, 4, 5,
2499 0, 0, 0, 0, 0, 0, 0, 74, 0, 0,
2500 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2501 0, 0, 77, 0, 78, 74, 64, 65, 0, 107,
2502 67, 68, 69, 70, 71, 72, 645, 0, 1, 2,
2503 0, 3, 4, 5, 64, 65, 0, 107, 67, 68,
2504 69, 70, 71, 72, 689, 0, 1, 2, 0, 3,
2505 4, 5, 0, 0, 0, 0, 0, 0, 0, 74,
2506 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2507 75, 76, 0, 0, 77, 0, 78, 74, 0, 0,
2508 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2509 0, 0, 77, 0, 78, 0, 0, 0, 0, 0,
2510 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2511 0, 75, 76, 0, 0, 77, 0, 384, 0, 0,
2512 0, 0, 0, 0, 0, 0, 0, 0, 0, 75,
2513 76, 0, 0, 77, 0, 486, 0, 0, 0, 0,
Dale Johannesendfe8c842008-09-26 19:32:34 +00002514 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2515 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patel652203f2008-09-29 20:49:50 +00002516 0, 0, 0, 0, 0, 174, 0, 0, 0, 0,
2517 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
2518 0, 0, 0, 0, 0, 0, 175, 176, 0, 0,
2519 0, 75, 76, 0, 0, 77, 0, 78, 177, 178,
2520 179, 180, 181, 182, 183, 184, 185, 186, 187, 188,
2521 189, 190, 191, 192, 193, 194, 195, 196, 197, 198,
2522 199, 200, 201, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesendfe8c842008-09-26 19:32:34 +00002523 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patel652203f2008-09-29 20:49:50 +00002524 0, 0, 0, 202, 203, 204, 0, 0, 205, 206,
2525 207, 208, 209, 210, 211, 212, 213, 214, 215, 216,
2526 217, 218, 219, 220, 221, 222, 223, 224, 225, 226
Dan Gohmanf4423b12008-04-19 00:24:39 +00002527};
2528
2529static const yytype_int16 yycheck[] =
2530{
Devang Patel652203f2008-09-29 20:49:50 +00002531 0, 27, 179, 247, 166, 169, 204, 4, 11, 0,
2532 11, 467, 21, 274, 275, 28, 167, 17, 329, 11,
2533 29, 219, 220, 221, 222, 223, 17, 545, 180, 297,
2534 19, 229, 55, 22, 55, 24, 34, 55, 55, 53,
2535 200, 455, 456, 201, 11, 161, 7, 666, 162, 11,
2536 55, 162, 78, 59, 68, 17, 54, 171, 19, 55,
2537 171, 22, 54, 24, 683, 54, 42, 43, 44, 45,
2538 46, 47, 48, 49, 156, 51, 102, 345, 161, 231,
2539 106, 55, 162, 55, 166, 162, 112, 54, 162, 162,
2540 162, 171, 118, 93, 171, 169, 169, 248, 249, 171,
2541 162, 55, 262, 162, 264, 263, 162, 265, 167, 171,
2542 162, 167, 55, 32, 33, 167, 142, 143, 41, 42,
2543 146, 639, 18, 384, 38, 48, 152, 645, 646, 543,
2544 161, 54, 121, 122, 20, 591, 159, 23, 159, 162,
2545 163, 159, 159, 169, 405, 406, 407, 165, 169, 347,
2546 167, 177, 141, 142, 159, 144, 145, 170, 147, 148,
2547 149, 0, 171, 159, 167, 621, 167, 163, 686, 687,
2548 165, 689, 690, 170, 132, 133, 202, 203, 204, 205,
2549 156, 157, 158, 117, 118, 159, 160, 159, 706, 707,
2550 162, 163, 218, 219, 220, 221, 222, 223, 224, 225,
2551 226, 227, 228, 229, 161, 159, 34, 518, 290, 163,
2552 161, 293, 294, 239, 296, 413, 159, 160, 22, 3,
2553 4, 5, 6, 21, 250, 486, 159, 141, 142, 143,
2554 144, 429, 146, 431, 432, 433, 150, 151, 37, 153,
2555 154, 155, 26, 27, 132, 133, 42, 43, 44, 331,
2556 561, 47, 563, 417, 7, 8, 22, 339, 340, 341,
2557 342, 343, 35, 121, 37, 22, 19, 20, 22, 22,
2558 23, 24, 3, 4, 5, 6, 440, 4, 141, 142,
2559 143, 144, 308, 146, 46, 54, 48, 150, 151, 4,
2560 153, 154, 155, 151, 166, 42, 287, 44, 166, 325,
2561 326, 327, 62, 63, 64, 65, 66, 67, 163, 160,
2562 472, 162, 623, 141, 142, 143, 144, 160, 146, 162,
2563 346, 347, 150, 151, 159, 153, 154, 155, 4, 156,
2564 157, 158, 132, 133, 114, 115, 418, 419, 420, 421,
2565 160, 160, 162, 162, 160, 427, 162, 84, 85, 161,
2566 22, 162, 121, 122, 160, 169, 4, 601, 384, 441,
2567 9, 55, 26, 27, 9, 160, 564, 159, 9, 567,
2568 568, 569, 141, 142, 9, 144, 145, 9, 147, 148,
2569 149, 9, 57, 169, 11, 160, 22, 413, 159, 159,
2570 472, 417, 94, 95, 96, 97, 98, 99, 100, 101,
2571 102, 103, 4, 429, 430, 431, 432, 433, 159, 159,
2572 159, 159, 494, 439, 440, 159, 159, 499, 159, 501,
2573 159, 38, 504, 38, 162, 22, 670, 162, 162, 673,
2574 162, 457, 514, 515, 162, 517, 100, 101, 102, 103,
2575 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
2576 162, 162, 159, 159, 159, 481, 159, 61, 162, 159,
2577 486, 162, 38, 162, 162, 22, 162, 644, 165, 162,
2578 162, 162, 554, 555, 162, 557, 558, 559, 560, 162,
2579 162, 162, 162, 565, 0, 162, 17, 513, 17, 162,
2580 667, 573, 162, 519, 162, 169, 162, 579, 4, 162,
2581 162, 162, 18, 19, 20, 162, 22, 23, 24, 162,
2582 162, 162, 4, 539, 30, 31, 374, 375, 376, 377,
2583 378, 379, 380, 4, 162, 162, 169, 22, 0, 162,
2584 4, 389, 390, 391, 616, 169, 52, 162, 564, 162,
2585 56, 567, 568, 569, 60, 159, 18, 19, 20, 162,
2586 22, 23, 24, 162, 160, 162, 4, 162, 30, 31,
2587 293, 294, 162, 296, 159, 54, 160, 22, 169, 162,
2588 162, 160, 160, 17, 600, 162, 167, 160, 160, 165,
2589 52, 607, 664, 160, 56, 160, 668, 669, 60, 167,
2590 160, 160, 160, 54, 4, 162, 622, 152, 331, 599,
2591 458, 459, 460, 461, 22, 159, 339, 340, 341, 342,
2592 343, 469, 159, 17, 162, 17, 17, 73, 700, 701,
2593 17, 703, 661, 705, 93, 640, 112, 709, 239, 106,
2594 250, 7, 8, 715, 10, 11, 12, 13, 14, 15,
2595 16, 17, 17, 19, 20, 671, 22, 23, 24, 90,
2596 7, 8, 57, 10, 11, 12, 13, 14, 15, 16,
2597 17, 661, 19, 20, -1, 22, 23, 24, 133, 622,
2598 528, 529, 530, 531, 50, 533, 133, 462, -1, 537,
2599 538, -1, -1, -1, -1, 418, 419, 420, 421, -1,
2600 -1, -1, -1, 50, 427, -1, -1, 7, 8, -1,
2601 10, 11, 12, 13, 14, 15, 16, 17, 441, 19,
Dale Johannesendfe8c842008-09-26 19:32:34 +00002602 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
Devang Patel652203f2008-09-29 20:49:50 +00002603 -1, -1, -1, 581, 582, 583, 584, -1, -1, -1,
Dale Johannesendfe8c842008-09-26 19:32:34 +00002604 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patel652203f2008-09-29 20:49:50 +00002605 50, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesendfe8c842008-09-26 19:32:34 +00002606 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patel652203f2008-09-29 20:49:50 +00002607 -1, 494, -1, -1, -1, -1, 499, -1, 501, -1,
2608 628, 504, 630, 631, -1, -1, -1, -1, -1, -1,
2609 -1, 514, 515, -1, 517, -1, -1, -1, 164, 165,
2610 -1, -1, 168, -1, 170, 171, -1, -1, -1, -1,
2611 -1, -1, -1, -1, -1, -1, -1, 164, 165, -1,
2612 -1, 168, -1, 170, 171, -1, -1, -1, -1, -1,
2613 -1, 554, 555, -1, 557, 558, 559, 560, -1, -1,
2614 -1, -1, 565, -1, -1, -1, -1, -1, -1, -1,
2615 573, -1, -1, -1, -1, -1, 579, -1, -1, -1,
2616 -1, -1, -1, -1, 164, 165, -1, -1, 168, -1,
2617 170, 171, -1, -1, -1, -1, -1, -1, 3, 4,
2618 5, 6, 7, 8, 9, -1, -1, -1, -1, -1,
2619 -1, -1, -1, 616, 19, 20, -1, 22, 23, 24,
2620 25, 26, 27, -1, -1, -1, -1, -1, -1, -1,
2621 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
2622 -1, -1, -1, -1, -1, -1, -1, -1, -1, 54,
2623 -1, -1, -1, -1, 59, -1, -1, -1, -1, -1,
2624 -1, 664, -1, -1, -1, 668, 669, -1, -1, -1,
2625 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2626 85, 86, 87, 88, 89, 90, 91, 92, 93, -1,
2627 -1, -1, -1, -1, -1, -1, -1, 700, 701, -1,
2628 703, -1, 705, -1, -1, -1, 709, -1, -1, -1,
2629 -1, -1, 715, -1, 119, 120, 121, 122, 123, 124,
2630 125, 126, 127, 128, 129, 130, 131, -1, 133, -1,
2631 135, 136, 137, -1, 139, 140, 141, 142, -1, 144,
2632 145, -1, 147, 148, 149, -1, -1, -1, -1, -1,
2633 -1, -1, 3, 4, 5, 6, 7, 8, 9, -1,
2634 165, -1, -1, 168, -1, 170, -1, 172, 19, 20,
2635 -1, 22, 23, 24, 25, 26, 27, -1, -1, -1,
2636 -1, -1, -1, -1, -1, -1, -1, -1, -1, 40,
2637 41, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2638 -1, -1, -1, -1, 55, -1, 7, 8, 59, 10,
Devang Pateld4980812008-09-02 20:52:40 +00002639 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
Devang Patel652203f2008-09-29 20:49:50 +00002640 -1, 22, 23, 24, 75, 76, 77, 78, 79, 80,
2641 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2642 91, 92, 93, -1, -1, -1, -1, -1, -1, 50,
Devang Pateld4980812008-09-02 20:52:40 +00002643 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patel652203f2008-09-29 20:49:50 +00002644 -1, -1, -1, -1, -1, -1, -1, -1, 119, 120,
2645 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
2646 131, -1, 133, -1, 135, 136, 137, -1, 139, 140,
2647 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2648 -1, -1, -1, -1, -1, -1, -1, -1, 159, -1,
2649 -1, -1, -1, -1, 165, -1, -1, 168, -1, 170,
2650 -1, 172, 3, 4, 5, 6, 7, 8, 9, -1,
2651 -1, -1, -1, -1, -1, -1, -1, -1, 19, 20,
2652 -1, 22, 23, 24, 25, 26, 27, -1, -1, -1,
2653 -1, -1, -1, -1, -1, -1, -1, -1, -1, 40,
2654 41, -1, -1, 164, 165, -1, -1, 168, -1, 170,
2655 171, -1, -1, -1, -1, -1, 7, 8, 59, 10,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002656 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
Devang Patel652203f2008-09-29 20:49:50 +00002657 -1, 22, 23, 24, 75, 76, 77, 78, 79, 80,
2658 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2659 91, 92, 93, -1, -1, -1, -1, 7, 8, 50,
Devang Pateld4980812008-09-02 20:52:40 +00002660 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
Devang Patel652203f2008-09-29 20:49:50 +00002661 20, -1, 22, 23, 24, -1, -1, -1, 119, 120,
2662 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
2663 131, -1, 133, -1, 135, 136, 137, -1, 139, 140,
2664 50, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2665 3, 4, 5, 6, -1, -1, 9, -1, -1, -1,
2666 -1, -1, -1, -1, 165, -1, -1, 168, -1, 170,
2667 -1, 172, 25, 26, 27, -1, -1, -1, -1, -1,
2668 -1, -1, -1, -1, -1, -1, -1, 40, 41, -1,
Devang Pateld4980812008-09-02 20:52:40 +00002669 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patel652203f2008-09-29 20:49:50 +00002670 -1, -1, -1, -1, -1, -1, 59, -1, -1, -1,
2671 -1, -1, -1, 164, 165, -1, -1, 168, -1, 170,
2672 171, -1, 75, 76, 77, 78, 79, 80, 81, 82,
2673 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
2674 93, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2675 -1, -1, -1, -1, 164, 165, -1, -1, 168, -1,
2676 170, 171, -1, -1, -1, -1, 119, 120, 121, 122,
2677 123, 124, 125, 126, 127, 128, 129, 130, 131, -1,
2678 133, -1, 135, 136, 137, -1, 139, 140, 7, 8,
2679 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2680 19, 20, -1, 22, 23, 24, 25, -1, -1, -1,
2681 -1, -1, 165, -1, -1, 168, -1, 170, -1, 172,
2682 -1, 40, 41, -1, -1, -1, -1, -1, -1, -1,
2683 -1, -1, -1, -1, 7, 8, 55, 10, 11, 12,
2684 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2685 23, 24, -1, -1, -1, -1, 75, 76, 77, 78,
2686 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2687 89, 90, 91, 92, 93, -1, -1, 50, -1, -1,
2688 -1, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2689 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2690 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
2691 129, 130, 131, 39, 133, -1, 135, 136, 137, -1,
2692 139, 140, 7, 8, 50, 10, 11, 12, 13, 14,
2693 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2694 159, -1, 7, 8, 163, -1, 165, -1, -1, 168,
2695 -1, 170, -1, 172, 19, 20, -1, 22, 23, 24,
2696 25, -1, -1, -1, -1, 50, -1, -1, 141, 142,
2697 -1, 144, -1, -1, -1, 40, 41, -1, -1, -1,
2698 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2699 55, 164, 165, -1, -1, 168, -1, 170, -1, -1,
2700 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2701 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2702 85, 86, 87, 88, 89, 90, 91, 92, 93, -1,
2703 -1, -1, -1, -1, -1, -1, -1, -1, 164, 165,
2704 125, -1, 168, -1, 170, -1, -1, -1, -1, -1,
2705 -1, -1, -1, -1, 119, 120, 121, 122, 123, 124,
2706 125, 126, 127, 128, 129, 130, 131, -1, 133, -1,
2707 135, 136, 137, -1, 139, 140, -1, -1, -1, 164,
2708 165, -1, -1, 168, -1, 170, -1, -1, -1, -1,
2709 -1, -1, -1, -1, 159, -1, -1, -1, -1, -1,
2710 165, -1, -1, 168, -1, 170, -1, 172, 7, 8,
2711 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
Dale Johannesendfe8c842008-09-26 19:32:34 +00002712 19, 20, -1, 22, 23, 24, 7, 8, -1, 10,
2713 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
Devang Patel652203f2008-09-29 20:49:50 +00002714 39, 22, 23, 24, -1, -1, -1, -1, -1, 7,
2715 8, 50, 10, 11, 12, 13, 14, 15, 16, 17,
2716 -1, 19, 20, -1, 22, 23, 24, 7, 8, 50,
Dale Johannesendfe8c842008-09-26 19:32:34 +00002717 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2718 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
Devang Patel652203f2008-09-29 20:49:50 +00002719 -1, -1, 50, -1, -1, -1, -1, -1, -1, 39,
2720 -1, -1, -1, -1, -1, -1, -1, -1, 7, 8,
2721 50, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2722 19, 20, -1, 22, 23, 24, -1, -1, -1, 7,
2723 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2724 39, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2725 -1, 50, -1, -1, -1, -1, -1, -1, -1, -1,
2726 -1, -1, -1, -1, -1, 164, 165, -1, -1, 168,
2727 -1, 170, 50, -1, -1, -1, -1, -1, -1, -1,
2728 -1, -1, -1, 164, 165, -1, 167, 168, -1, 170,
Chris Lattner15bd0952008-08-29 17:20:18 +00002729 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patel652203f2008-09-29 20:49:50 +00002730 -1, -1, -1, -1, -1, -1, 164, 165, -1, 167,
2731 168, -1, 170, -1, -1, -1, -1, -1, -1, -1,
2732 -1, -1, -1, -1, 164, 165, -1, -1, 168, -1,
2733 170, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2734 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
Dale Johannesendfe8c842008-09-26 19:32:34 +00002735 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patel652203f2008-09-29 20:49:50 +00002736 -1, -1, -1, -1, -1, 164, 165, -1, -1, 168,
2737 -1, 170, -1, -1, 50, -1, -1, -1, -1, -1,
2738 -1, -1, -1, -1, -1, -1, 164, 165, -1, -1,
2739 168, -1, 170, 7, 8, -1, 10, 11, 12, 13,
Dale Johannesendfe8c842008-09-26 19:32:34 +00002740 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2741 24, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2742 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
Devang Patel652203f2008-09-29 20:49:50 +00002743 -1, -1, -1, -1, 7, 8, 50, 10, 11, 12,
2744 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2745 23, 24, 7, 8, 50, 10, 11, 12, 13, 14,
Dale Johannesendfe8c842008-09-26 19:32:34 +00002746 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
Devang Patel652203f2008-09-29 20:49:50 +00002747 -1, -1, -1, -1, -1, -1, -1, 50, -1, -1,
2748 -1, -1, -1, -1, -1, -1, -1, -1, 164, 165,
2749 -1, -1, 168, -1, 170, 50, 7, 8, -1, 10,
2750 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2751 -1, 22, 23, 24, 7, 8, -1, 10, 11, 12,
2752 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2753 23, 24, -1, -1, -1, -1, -1, -1, -1, 50,
Dale Johannesendfe8c842008-09-26 19:32:34 +00002754 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patel652203f2008-09-29 20:49:50 +00002755 164, 165, -1, -1, 168, -1, 170, 50, -1, -1,
2756 -1, -1, -1, -1, -1, -1, -1, -1, 164, 165,
2757 -1, -1, 168, -1, 170, -1, -1, -1, -1, -1,
2758 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2759 -1, 164, 165, -1, -1, 168, -1, 170, -1, -1,
2760 -1, -1, -1, -1, -1, -1, -1, -1, -1, 164,
2761 165, -1, -1, 168, -1, 170, -1, -1, -1, -1,
Chris Lattner15bd0952008-08-29 17:20:18 +00002762 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002763 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patel652203f2008-09-29 20:49:50 +00002764 -1, -1, -1, -1, -1, 36, -1, -1, -1, -1,
2765 -1, -1, -1, 164, 165, -1, -1, 168, -1, 170,
2766 -1, -1, -1, -1, -1, -1, 57, 58, -1, -1,
2767 -1, 164, 165, -1, -1, 168, -1, 170, 69, 70,
2768 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2769 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2770 91, 92, 93, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesendfe8c842008-09-26 19:32:34 +00002771 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patel652203f2008-09-29 20:49:50 +00002772 -1, -1, -1, 114, 115, 116, -1, -1, 119, 120,
2773 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
2774 131, 132, 133, 134, 135, 136, 137, 138, 139, 140
Dan Gohmanf4423b12008-04-19 00:24:39 +00002775};
2776
2777/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2778 symbol of state STATE-NUM. */
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002779static const yytype_uint16 yystos[] =
Dan Gohmanf4423b12008-04-19 00:24:39 +00002780{
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002781 0, 19, 20, 22, 23, 24, 30, 31, 52, 56,
Devang Patel652203f2008-09-29 20:49:50 +00002782 60, 181, 184, 186, 187, 188, 222, 223, 224, 226,
2783 225, 53, 68, 231, 161, 59, 161, 18, 161, 42,
2784 43, 44, 45, 46, 47, 48, 49, 51, 156, 157,
2785 158, 189, 190, 191, 0, 224, 46, 48, 192, 241,
2786 42, 43, 44, 47, 193, 238, 240, 248, 161, 161,
2787 165, 232, 22, 230, 7, 8, 10, 11, 12, 13,
2788 14, 15, 16, 17, 50, 164, 165, 168, 170, 181,
2789 186, 209, 210, 244, 191, 191, 35, 37, 220, 191,
2790 191, 21, 249, 250, 29, 171, 239, 249, 22, 22,
2791 22, 233, 159, 4, 4, 4, 170, 10, 171, 210,
2792 215, 55, 159, 183, 220, 220, 42, 44, 194, 32,
2793 33, 219, 62, 63, 64, 65, 66, 67, 195, 236,
2794 236, 7, 184, 185, 253, 162, 167, 39, 210, 211,
2795 213, 214, 166, 166, 171, 215, 162, 171, 159, 214,
2796 163, 219, 219, 10, 125, 210, 212, 221, 11, 12,
2797 13, 14, 15, 16, 179, 180, 210, 216, 4, 199,
2798 28, 170, 237, 161, 36, 57, 58, 69, 70, 71,
Chris Lattner15bd0952008-08-29 17:20:18 +00002799 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
2800 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
Dale Johannesendfe8c842008-09-26 19:32:34 +00002801 92, 93, 114, 115, 116, 119, 120, 121, 122, 123,
Chris Lattner15bd0952008-08-29 17:20:18 +00002802 124, 125, 126, 127, 128, 129, 130, 131, 132, 133,
Devang Patel652203f2008-09-29 20:49:50 +00002803 134, 135, 136, 137, 138, 139, 140, 174, 175, 176,
2804 251, 258, 259, 260, 261, 251, 259, 22, 197, 162,
2805 160, 210, 210, 169, 171, 210, 4, 160, 216, 210,
2806 159, 244, 26, 27, 3, 4, 5, 6, 9, 25,
Dale Johannesendfe8c842008-09-26 19:32:34 +00002807 40, 41, 90, 91, 92, 93, 119, 133, 135, 136,
Devang Patel652203f2008-09-29 20:49:50 +00002808 137, 139, 140, 165, 168, 170, 172, 174, 175, 176,
2809 217, 244, 183, 141, 142, 144, 198, 212, 57, 10,
2810 210, 246, 247, 11, 17, 11, 179, 195, 94, 95,
2811 96, 97, 98, 99, 100, 101, 102, 103, 177, 26,
2812 27, 100, 101, 102, 103, 104, 105, 106, 107, 108,
2813 109, 110, 111, 112, 113, 178, 177, 178, 210, 210,
2814 246, 210, 210, 254, 246, 246, 246, 246, 246, 210,
2815 210, 210, 210, 210, 246, 195, 117, 118, 54, 121,
2816 122, 141, 142, 144, 145, 147, 148, 149, 196, 39,
2817 211, 201, 167, 169, 169, 160, 201, 183, 183, 221,
2818 177, 178, 177, 178, 159, 159, 159, 159, 159, 159,
2819 159, 167, 216, 218, 170, 218, 171, 218, 22, 159,
2820 159, 159, 227, 186, 3, 4, 5, 6, 9, 25,
2821 26, 27, 40, 41, 59, 165, 168, 170, 172, 217,
2822 243, 244, 245, 162, 245, 245, 245, 199, 210, 210,
2823 210, 210, 162, 204, 162, 204, 245, 165, 162, 162,
2824 162, 162, 162, 162, 245, 245, 245, 245, 245, 38,
2825 199, 210, 246, 4, 141, 142, 143, 144, 146, 150,
2826 151, 153, 154, 155, 200, 228, 229, 38, 159, 159,
2827 159, 159, 216, 216, 216, 216, 216, 216, 216, 162,
2828 167, 171, 210, 218, 169, 171, 216, 216, 216, 162,
2829 207, 159, 61, 242, 167, 218, 170, 218, 171, 218,
2830 22, 246, 162, 162, 212, 245, 245, 245, 245, 11,
2831 54, 11, 256, 245, 165, 246, 210, 246, 246, 246,
2832 162, 162, 257, 162, 162, 162, 210, 212, 245, 162,
2833 207, 207, 210, 216, 216, 216, 216, 256, 162, 162,
2834 162, 162, 257, 162, 216, 169, 171, 162, 162, 38,
2835 34, 54, 205, 208, 39, 210, 234, 235, 22, 167,
2836 171, 218, 169, 171, 17, 17, 245, 162, 162, 162,
2837 162, 245, 4, 245, 162, 162, 245, 162, 162, 162,
2838 4, 4, 162, 210, 245, 245, 245, 162, 204, 210,
2839 160, 162, 162, 162, 162, 160, 216, 216, 216, 216,
2840 160, 216, 169, 216, 216, 210, 22, 4, 207, 197,
2841 162, 160, 162, 169, 171, 245, 245, 159, 245, 245,
2842 245, 245, 204, 204, 246, 245, 162, 246, 246, 246,
2843 4, 245, 159, 245, 216, 216, 216, 216, 162, 160,
2844 162, 162, 257, 160, 160, 160, 181, 182, 39, 210,
2845 201, 22, 169, 162, 165, 17, 210, 255, 167, 245,
2846 257, 255, 204, 160, 160, 160, 160, 216, 216, 216,
2847 160, 197, 205, 206, 17, 167, 179, 252, 197, 197,
2848 160, 162, 167, 160, 160, 160, 160, 182, 54, 203,
2849 245, 243, 167, 179, 121, 122, 245, 245, 201, 17,
2850 210, 201, 4, 152, 202, 162, 243, 197, 197, 38,
2851 197, 197, 22, 17, 162, 17, 245, 245, 245, 17,
2852 245, 197, 197, 245, 73, 17, 245
Dan Gohmanf4423b12008-04-19 00:24:39 +00002853};
David Greene718fda32007-08-01 03:59:32 +00002854
Reid Spencer68a24bd2005-08-27 18:50:39 +00002855#define yyerrok (yyerrstatus = 0)
2856#define yyclearin (yychar = YYEMPTY)
Dan Gohmanf4423b12008-04-19 00:24:39 +00002857#define YYEMPTY (-2)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002858#define YYEOF 0
Dan Gohmanf4423b12008-04-19 00:24:39 +00002859
Reid Spencer68a24bd2005-08-27 18:50:39 +00002860#define YYACCEPT goto yyacceptlab
Dan Gohmanf4423b12008-04-19 00:24:39 +00002861#define YYABORT goto yyabortlab
2862#define YYERROR goto yyerrorlab
2863
2864
2865/* Like YYERROR except do call yyerror. This remains here temporarily
2866 to ease the transition to the new meaning of YYERROR, for GCC.
Reid Spencer68a24bd2005-08-27 18:50:39 +00002867 Once GCC version 2 has supplanted version 1, this can go. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00002868
Reid Spencer68a24bd2005-08-27 18:50:39 +00002869#define YYFAIL goto yyerrlab
Dan Gohmanf4423b12008-04-19 00:24:39 +00002870
Reid Spencer68a24bd2005-08-27 18:50:39 +00002871#define YYRECOVERING() (!!yyerrstatus)
Dan Gohmanf4423b12008-04-19 00:24:39 +00002872
2873#define YYBACKUP(Token, Value) \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002874do \
2875 if (yychar == YYEMPTY && yylen == 1) \
Dan Gohmanf4423b12008-04-19 00:24:39 +00002876 { \
2877 yychar = (Token); \
2878 yylval = (Value); \
2879 yytoken = YYTRANSLATE (yychar); \
2880 YYPOPSTACK (1); \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002881 goto yybackup; \
2882 } \
2883 else \
Dan Gohmanf4423b12008-04-19 00:24:39 +00002884 { \
2885 yyerror (YY_("syntax error: cannot back up")); \
2886 YYERROR; \
2887 } \
2888while (YYID (0))
2889
Anton Korobeynikov38e09802007-04-28 13:48:45 +00002890
Reid Spencer68a24bd2005-08-27 18:50:39 +00002891#define YYTERROR 1
2892#define YYERRCODE 256
2893
Dan Gohmanf4423b12008-04-19 00:24:39 +00002894
2895/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2896 If N is 0, then set CURRENT to the empty location which ends
2897 the previous symbol: RHS[0] (always defined). */
2898
2899#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2900#ifndef YYLLOC_DEFAULT
2901# define YYLLOC_DEFAULT(Current, Rhs, N) \
2902 do \
2903 if (YYID (N)) \
2904 { \
2905 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2906 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2907 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2908 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2909 } \
2910 else \
2911 { \
2912 (Current).first_line = (Current).last_line = \
2913 YYRHSLOC (Rhs, 0).last_line; \
2914 (Current).first_column = (Current).last_column = \
2915 YYRHSLOC (Rhs, 0).last_column; \
2916 } \
2917 while (YYID (0))
Reid Spencer68a24bd2005-08-27 18:50:39 +00002918#endif
2919
Dan Gohmanf4423b12008-04-19 00:24:39 +00002920
2921/* YY_LOCATION_PRINT -- Print the location on the stream.
2922 This macro was not mandated originally: define only if we know
2923 we won't break user code: when these are the locations we know. */
2924
2925#ifndef YY_LOCATION_PRINT
Chris Lattner9fc4da42008-10-08 06:44:45 +00002926# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
Dan Gohmanf4423b12008-04-19 00:24:39 +00002927# define YY_LOCATION_PRINT(File, Loc) \
2928 fprintf (File, "%d.%d-%d.%d", \
2929 (Loc).first_line, (Loc).first_column, \
2930 (Loc).last_line, (Loc).last_column)
2931# else
2932# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2933# endif
2934#endif
2935
2936
2937/* YYLEX -- calling `yylex' with the right arguments. */
2938
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00002939#ifdef YYLEX_PARAM
Dan Gohmanf4423b12008-04-19 00:24:39 +00002940# define YYLEX yylex (YYLEX_PARAM)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00002941#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00002942# define YYLEX yylex ()
Gabor Greife64d2482008-04-06 23:07:54 +00002943#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002944
2945/* Enable debugging if requested. */
2946#if YYDEBUG
2947
2948# ifndef YYFPRINTF
2949# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2950# define YYFPRINTF fprintf
2951# endif
2952
2953# define YYDPRINTF(Args) \
2954do { \
2955 if (yydebug) \
2956 YYFPRINTF Args; \
2957} while (YYID (0))
2958
2959# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2960do { \
2961 if (yydebug) \
2962 { \
2963 YYFPRINTF (stderr, "%s ", Title); \
2964 yy_symbol_print (stderr, \
2965 Type, Value); \
2966 YYFPRINTF (stderr, "\n"); \
2967 } \
2968} while (YYID (0))
2969
2970
2971/*--------------------------------.
2972| Print this symbol on YYOUTPUT. |
2973`--------------------------------*/
2974
2975/*ARGSUSED*/
2976#if (defined __STDC__ || defined __C99__FUNC__ \
2977 || defined __cplusplus || defined _MSC_VER)
2978static void
2979yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
Gabor Greife64d2482008-04-06 23:07:54 +00002980#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00002981static void
2982yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2983 FILE *yyoutput;
2984 int yytype;
2985 YYSTYPE const * const yyvaluep;
Gabor Greife64d2482008-04-06 23:07:54 +00002986#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002987{
2988 if (!yyvaluep)
2989 return;
2990# ifdef YYPRINT
2991 if (yytype < YYNTOKENS)
2992 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2993# else
2994 YYUSE (yyoutput);
2995# endif
2996 switch (yytype)
2997 {
2998 default:
2999 break;
3000 }
3001}
3002
3003
3004/*--------------------------------.
3005| Print this symbol on YYOUTPUT. |
3006`--------------------------------*/
3007
3008#if (defined __STDC__ || defined __C99__FUNC__ \
3009 || defined __cplusplus || defined _MSC_VER)
3010static void
3011yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
3012#else
3013static void
3014yy_symbol_print (yyoutput, yytype, yyvaluep)
3015 FILE *yyoutput;
3016 int yytype;
3017 YYSTYPE const * const yyvaluep;
Scott Michel15dcd8e2008-01-30 03:10:00 +00003018#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003019{
3020 if (yytype < YYNTOKENS)
3021 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
3022 else
3023 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
Chris Lattner38905612008-02-19 04:36:25 +00003024
Dan Gohmanf4423b12008-04-19 00:24:39 +00003025 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
3026 YYFPRINTF (yyoutput, ")");
3027}
Chris Lattner38905612008-02-19 04:36:25 +00003028
Dan Gohmanf4423b12008-04-19 00:24:39 +00003029/*------------------------------------------------------------------.
3030| yy_stack_print -- Print the state stack from its BOTTOM up to its |
3031| TOP (included). |
3032`------------------------------------------------------------------*/
Chris Lattner38905612008-02-19 04:36:25 +00003033
Dan Gohmanf4423b12008-04-19 00:24:39 +00003034#if (defined __STDC__ || defined __C99__FUNC__ \
3035 || defined __cplusplus || defined _MSC_VER)
3036static void
3037yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
3038#else
3039static void
3040yy_stack_print (bottom, top)
3041 yytype_int16 *bottom;
3042 yytype_int16 *top;
Scott Michel15dcd8e2008-01-30 03:10:00 +00003043#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003044{
3045 YYFPRINTF (stderr, "Stack now");
3046 for (; bottom <= top; ++bottom)
3047 YYFPRINTF (stderr, " %d", *bottom);
3048 YYFPRINTF (stderr, "\n");
3049}
Chris Lattner38905612008-02-19 04:36:25 +00003050
Dan Gohmanf4423b12008-04-19 00:24:39 +00003051# define YY_STACK_PRINT(Bottom, Top) \
3052do { \
3053 if (yydebug) \
3054 yy_stack_print ((Bottom), (Top)); \
3055} while (YYID (0))
Chris Lattner38905612008-02-19 04:36:25 +00003056
Dan Gohmanf4423b12008-04-19 00:24:39 +00003057
3058/*------------------------------------------------.
3059| Report that the YYRULE is going to be reduced. |
3060`------------------------------------------------*/
3061
3062#if (defined __STDC__ || defined __C99__FUNC__ \
3063 || defined __cplusplus || defined _MSC_VER)
3064static void
3065yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
3066#else
3067static void
3068yy_reduce_print (yyvsp, yyrule)
3069 YYSTYPE *yyvsp;
3070 int yyrule;
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00003071#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003072{
3073 int yynrhs = yyr2[yyrule];
3074 int yyi;
3075 unsigned long int yylno = yyrline[yyrule];
3076 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
3077 yyrule - 1, yylno);
3078 /* The symbols being reduced. */
3079 for (yyi = 0; yyi < yynrhs; yyi++)
3080 {
3081 fprintf (stderr, " $%d = ", yyi + 1);
3082 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
3083 &(yyvsp[(yyi + 1) - (yynrhs)])
3084 );
3085 fprintf (stderr, "\n");
3086 }
3087}
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003088
Dan Gohmanf4423b12008-04-19 00:24:39 +00003089# define YY_REDUCE_PRINT(Rule) \
3090do { \
3091 if (yydebug) \
3092 yy_reduce_print (yyvsp, Rule); \
3093} while (YYID (0))
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003094
Dan Gohmanf4423b12008-04-19 00:24:39 +00003095/* Nonzero means print parse trace. It is left uninitialized so that
3096 multiple parsers can coexist. */
3097int yydebug;
3098#else /* !YYDEBUG */
3099# define YYDPRINTF(Args)
3100# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
3101# define YY_STACK_PRINT(Bottom, Top)
3102# define YY_REDUCE_PRINT(Rule)
3103#endif /* !YYDEBUG */
3104
3105
3106/* YYINITDEPTH -- initial size of the parser's stacks. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003107#ifndef YYINITDEPTH
Dan Gohmanf4423b12008-04-19 00:24:39 +00003108# define YYINITDEPTH 200
Reid Spencer68a24bd2005-08-27 18:50:39 +00003109#endif
3110
Dan Gohmanf4423b12008-04-19 00:24:39 +00003111/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
3112 if the built-in stack extension method is used).
Reid Spencer68a24bd2005-08-27 18:50:39 +00003113
Dan Gohmanf4423b12008-04-19 00:24:39 +00003114 Do not make this value too large; the results are undefined if
3115 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
3116 evaluated with infinite-precision integer arithmetic. */
David Greene718fda32007-08-01 03:59:32 +00003117
Reid Spencer68a24bd2005-08-27 18:50:39 +00003118#ifndef YYMAXDEPTH
Dan Gohmanf4423b12008-04-19 00:24:39 +00003119# define YYMAXDEPTH 10000
Reid Spencer68a24bd2005-08-27 18:50:39 +00003120#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003121
Reid Spencer68a24bd2005-08-27 18:50:39 +00003122
3123
Dan Gohmanf4423b12008-04-19 00:24:39 +00003124#if YYERROR_VERBOSE
Reid Spencer68a24bd2005-08-27 18:50:39 +00003125
Dan Gohmanf4423b12008-04-19 00:24:39 +00003126# ifndef yystrlen
3127# if defined __GLIBC__ && defined _STRING_H
3128# define yystrlen strlen
3129# else
3130/* Return the length of YYSTR. */
3131#if (defined __STDC__ || defined __C99__FUNC__ \
3132 || defined __cplusplus || defined _MSC_VER)
3133static YYSIZE_T
3134yystrlen (const char *yystr)
Chris Lattner38905612008-02-19 04:36:25 +00003135#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00003136static YYSIZE_T
3137yystrlen (yystr)
3138 const char *yystr;
3139#endif
3140{
3141 YYSIZE_T yylen;
3142 for (yylen = 0; yystr[yylen]; yylen++)
3143 continue;
3144 return yylen;
3145}
3146# endif
3147# endif
3148
3149# ifndef yystpcpy
3150# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
3151# define yystpcpy stpcpy
3152# else
3153/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
3154 YYDEST. */
3155#if (defined __STDC__ || defined __C99__FUNC__ \
3156 || defined __cplusplus || defined _MSC_VER)
3157static char *
3158yystpcpy (char *yydest, const char *yysrc)
3159#else
3160static char *
3161yystpcpy (yydest, yysrc)
3162 char *yydest;
3163 const char *yysrc;
3164#endif
3165{
3166 char *yyd = yydest;
3167 const char *yys = yysrc;
3168
3169 while ((*yyd++ = *yys++) != '\0')
3170 continue;
3171
3172 return yyd - 1;
3173}
3174# endif
3175# endif
3176
3177# ifndef yytnamerr
3178/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3179 quotes and backslashes, so that it's suitable for yyerror. The
3180 heuristic is that double-quoting is unnecessary unless the string
3181 contains an apostrophe, a comma, or backslash (other than
3182 backslash-backslash). YYSTR is taken from yytname. If YYRES is
3183 null, do not copy; instead, return the length of what the result
3184 would have been. */
3185static YYSIZE_T
3186yytnamerr (char *yyres, const char *yystr)
3187{
3188 if (*yystr == '"')
3189 {
3190 YYSIZE_T yyn = 0;
3191 char const *yyp = yystr;
3192
3193 for (;;)
3194 switch (*++yyp)
3195 {
3196 case '\'':
3197 case ',':
3198 goto do_not_strip_quotes;
3199
3200 case '\\':
3201 if (*++yyp != '\\')
3202 goto do_not_strip_quotes;
3203 /* Fall through. */
3204 default:
3205 if (yyres)
3206 yyres[yyn] = *yyp;
3207 yyn++;
3208 break;
3209
3210 case '"':
3211 if (yyres)
3212 yyres[yyn] = '\0';
3213 return yyn;
3214 }
3215 do_not_strip_quotes: ;
3216 }
3217
3218 if (! yyres)
3219 return yystrlen (yystr);
3220
3221 return yystpcpy (yyres, yystr) - yyres;
3222}
3223# endif
3224
3225/* Copy into YYRESULT an error message about the unexpected token
3226 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3227 including the terminating null byte. If YYRESULT is null, do not
3228 copy anything; just return the number of bytes that would be
3229 copied. As a special case, return 0 if an ordinary "syntax error"
3230 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3231 size calculation. */
3232static YYSIZE_T
3233yysyntax_error (char *yyresult, int yystate, int yychar)
3234{
3235 int yyn = yypact[yystate];
3236
3237 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3238 return 0;
3239 else
3240 {
3241 int yytype = YYTRANSLATE (yychar);
3242 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3243 YYSIZE_T yysize = yysize0;
3244 YYSIZE_T yysize1;
3245 int yysize_overflow = 0;
3246 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3247 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3248 int yyx;
3249
3250# if 0
3251 /* This is so xgettext sees the translatable formats that are
3252 constructed on the fly. */
3253 YY_("syntax error, unexpected %s");
3254 YY_("syntax error, unexpected %s, expecting %s");
3255 YY_("syntax error, unexpected %s, expecting %s or %s");
3256 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3257 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3258# endif
3259 char *yyfmt;
3260 char const *yyf;
3261 static char const yyunexpected[] = "syntax error, unexpected %s";
3262 static char const yyexpecting[] = ", expecting %s";
3263 static char const yyor[] = " or %s";
3264 char yyformat[sizeof yyunexpected
3265 + sizeof yyexpecting - 1
3266 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3267 * (sizeof yyor - 1))];
3268 char const *yyprefix = yyexpecting;
3269
3270 /* Start YYX at -YYN if negative to avoid negative indexes in
3271 YYCHECK. */
3272 int yyxbegin = yyn < 0 ? -yyn : 0;
3273
3274 /* Stay within bounds of both yycheck and yytname. */
3275 int yychecklim = YYLAST - yyn + 1;
3276 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3277 int yycount = 1;
3278
3279 yyarg[0] = yytname[yytype];
3280 yyfmt = yystpcpy (yyformat, yyunexpected);
3281
3282 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3283 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3284 {
3285 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3286 {
3287 yycount = 1;
3288 yysize = yysize0;
3289 yyformat[sizeof yyunexpected - 1] = '\0';
3290 break;
3291 }
3292 yyarg[yycount++] = yytname[yyx];
3293 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3294 yysize_overflow |= (yysize1 < yysize);
3295 yysize = yysize1;
3296 yyfmt = yystpcpy (yyfmt, yyprefix);
3297 yyprefix = yyor;
3298 }
3299
3300 yyf = YY_(yyformat);
3301 yysize1 = yysize + yystrlen (yyf);
3302 yysize_overflow |= (yysize1 < yysize);
3303 yysize = yysize1;
3304
3305 if (yysize_overflow)
3306 return YYSIZE_MAXIMUM;
3307
3308 if (yyresult)
3309 {
3310 /* Avoid sprintf, as that infringes on the user's name space.
3311 Don't have undefined behavior even if the translation
3312 produced a string with the wrong number of "%s"s. */
3313 char *yyp = yyresult;
3314 int yyi = 0;
3315 while ((*yyp = *yyf) != '\0')
3316 {
3317 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3318 {
3319 yyp += yytnamerr (yyp, yyarg[yyi++]);
3320 yyf += 2;
3321 }
3322 else
3323 {
3324 yyp++;
3325 yyf++;
3326 }
3327 }
3328 }
3329 return yysize;
3330 }
3331}
3332#endif /* YYERROR_VERBOSE */
3333
3334
3335/*-----------------------------------------------.
3336| Release the memory associated to this symbol. |
3337`-----------------------------------------------*/
3338
3339/*ARGSUSED*/
3340#if (defined __STDC__ || defined __C99__FUNC__ \
3341 || defined __cplusplus || defined _MSC_VER)
3342static void
3343yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3344#else
3345static void
3346yydestruct (yymsg, yytype, yyvaluep)
3347 const char *yymsg;
3348 int yytype;
3349 YYSTYPE *yyvaluep;
3350#endif
3351{
3352 YYUSE (yyvaluep);
3353
3354 if (!yymsg)
3355 yymsg = "Deleting";
3356 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3357
3358 switch (yytype)
3359 {
3360
3361 default:
3362 break;
3363 }
3364}
3365
3366
3367/* Prevent warnings from -Wmissing-prototypes. */
3368
3369#ifdef YYPARSE_PARAM
3370#if defined __STDC__ || defined __cplusplus
3371int yyparse (void *YYPARSE_PARAM);
3372#else
3373int yyparse ();
3374#endif
3375#else /* ! YYPARSE_PARAM */
3376#if defined __STDC__ || defined __cplusplus
David Greene5fd22a82007-09-04 18:46:50 +00003377int yyparse (void);
Gabor Greife64d2482008-04-06 23:07:54 +00003378#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00003379int yyparse ();
Scott Michel15dcd8e2008-01-30 03:10:00 +00003380#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003381#endif /* ! YYPARSE_PARAM */
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003382
Chris Lattner38905612008-02-19 04:36:25 +00003383
Dan Gohmanf4423b12008-04-19 00:24:39 +00003384
3385/* The look-ahead symbol. */
3386int yychar;
3387
3388/* The semantic value of the look-ahead symbol. */
3389YYSTYPE yylval;
3390
3391/* Number of syntax errors so far. */
3392int yynerrs;
3393
3394
3395
3396/*----------.
3397| yyparse. |
3398`----------*/
3399
3400#ifdef YYPARSE_PARAM
3401#if (defined __STDC__ || defined __C99__FUNC__ \
3402 || defined __cplusplus || defined _MSC_VER)
3403int
3404yyparse (void *YYPARSE_PARAM)
3405#else
3406int
3407yyparse (YYPARSE_PARAM)
3408 void *YYPARSE_PARAM;
3409#endif
3410#else /* ! YYPARSE_PARAM */
3411#if (defined __STDC__ || defined __C99__FUNC__ \
3412 || defined __cplusplus || defined _MSC_VER)
3413int
3414yyparse (void)
3415#else
3416int
3417yyparse ()
3418
Gabor Greife64d2482008-04-06 23:07:54 +00003419#endif
3420#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003421{
3422
3423 int yystate;
3424 int yyn;
3425 int yyresult;
3426 /* Number of tokens to shift before error messages enabled. */
3427 int yyerrstatus;
3428 /* Look-ahead token as an internal (translated) token number. */
3429 int yytoken = 0;
3430#if YYERROR_VERBOSE
3431 /* Buffer for error messages, and its allocated size. */
3432 char yymsgbuf[128];
3433 char *yymsg = yymsgbuf;
3434 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
Gabor Greife64d2482008-04-06 23:07:54 +00003435#endif
Chris Lattner38905612008-02-19 04:36:25 +00003436
Dan Gohmanf4423b12008-04-19 00:24:39 +00003437 /* Three stacks and their tools:
3438 `yyss': related to states,
3439 `yyvs': related to semantic values,
3440 `yyls': related to locations.
3441
3442 Refer to the stacks thru separate pointers, to allow yyoverflow
3443 to reallocate them elsewhere. */
3444
3445 /* The state stack. */
3446 yytype_int16 yyssa[YYINITDEPTH];
3447 yytype_int16 *yyss = yyssa;
3448 yytype_int16 *yyssp;
3449
3450 /* The semantic value stack. */
3451 YYSTYPE yyvsa[YYINITDEPTH];
3452 YYSTYPE *yyvs = yyvsa;
3453 YYSTYPE *yyvsp;
3454
3455
3456
3457#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3458
3459 YYSIZE_T yystacksize = YYINITDEPTH;
3460
3461 /* The variables used to return semantic value and location from the
3462 action routines. */
3463 YYSTYPE yyval;
3464
3465
3466 /* The number of symbols on the RHS of the reduced rule.
3467 Keep to zero when no symbol should be popped. */
3468 int yylen = 0;
3469
3470 YYDPRINTF ((stderr, "Starting parse\n"));
3471
Reid Spencer68a24bd2005-08-27 18:50:39 +00003472 yystate = 0;
3473 yyerrstatus = 0;
3474 yynerrs = 0;
3475 yychar = YYEMPTY; /* Cause a token to be read. */
3476
3477 /* Initialize stack pointers.
3478 Waste one element of value and location stack
3479 so that they stay on the same level as the state stack.
3480 The wasted elements are never initialized. */
3481
Dan Gohmanf4423b12008-04-19 00:24:39 +00003482 yyssp = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003483 yyvsp = yyvs;
3484
Dan Gohmanf4423b12008-04-19 00:24:39 +00003485 goto yysetstate;
Jeff Cohen66c5fd62005-10-23 04:37:20 +00003486
Dan Gohmanf4423b12008-04-19 00:24:39 +00003487/*------------------------------------------------------------.
3488| yynewstate -- Push a new state, which is found in yystate. |
3489`------------------------------------------------------------*/
3490 yynewstate:
3491 /* In all cases, when you get here, the value and location stacks
3492 have just been pushed. So pushing a state here evens the stacks. */
3493 yyssp++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003494
Dan Gohmanf4423b12008-04-19 00:24:39 +00003495 yysetstate:
3496 *yyssp = yystate;
3497
3498 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003499 {
3500 /* Get the current used size of the three stacks, in elements. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003501 YYSIZE_T yysize = yyssp - yyss + 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003502
3503#ifdef yyoverflow
Dan Gohmanf4423b12008-04-19 00:24:39 +00003504 {
3505 /* Give user a chance to reallocate the stack. Use copies of
3506 these so that the &'s don't force the real ones into
3507 memory. */
3508 YYSTYPE *yyvs1 = yyvs;
3509 yytype_int16 *yyss1 = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003510
Dan Gohmanf4423b12008-04-19 00:24:39 +00003511
3512 /* Each stack pointer address is followed by the size of the
3513 data in use in that stack, in bytes. This used to be a
3514 conditional around just the two extra args, but that might
3515 be undefined if yyoverflow is a macro. */
3516 yyoverflow (YY_("memory exhausted"),
3517 &yyss1, yysize * sizeof (*yyssp),
3518 &yyvs1, yysize * sizeof (*yyvsp),
3519
3520 &yystacksize);
3521
3522 yyss = yyss1;
3523 yyvs = yyvs1;
3524 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00003525#else /* no yyoverflow */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003526# ifndef YYSTACK_RELOCATE
3527 goto yyexhaustedlab;
3528# else
Reid Spencer68a24bd2005-08-27 18:50:39 +00003529 /* Extend the stack our own way. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003530 if (YYMAXDEPTH <= yystacksize)
3531 goto yyexhaustedlab;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003532 yystacksize *= 2;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003533 if (YYMAXDEPTH < yystacksize)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003534 yystacksize = YYMAXDEPTH;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003535
3536 {
3537 yytype_int16 *yyss1 = yyss;
3538 union yyalloc *yyptr =
3539 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3540 if (! yyptr)
3541 goto yyexhaustedlab;
3542 YYSTACK_RELOCATE (yyss);
3543 YYSTACK_RELOCATE (yyvs);
3544
3545# undef YYSTACK_RELOCATE
3546 if (yyss1 != yyssa)
3547 YYSTACK_FREE (yyss1);
3548 }
3549# endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00003550#endif /* no yyoverflow */
3551
Dan Gohmanf4423b12008-04-19 00:24:39 +00003552 yyssp = yyss + yysize - 1;
3553 yyvsp = yyvs + yysize - 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003554
3555
Dan Gohmanf4423b12008-04-19 00:24:39 +00003556 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3557 (unsigned long int) yystacksize));
3558
3559 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003560 YYABORT;
3561 }
3562
Dan Gohmanf4423b12008-04-19 00:24:39 +00003563 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003564
3565 goto yybackup;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003566
Dan Gohmanf4423b12008-04-19 00:24:39 +00003567/*-----------.
3568| yybackup. |
3569`-----------*/
3570yybackup:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003571
Dan Gohmanf4423b12008-04-19 00:24:39 +00003572 /* Do appropriate processing given the current state. Read a
3573 look-ahead token if we need one and don't already have one. */
Reid Spencer7780acb2007-04-16 06:56:07 +00003574
Dan Gohmanf4423b12008-04-19 00:24:39 +00003575 /* First try to decide what to do without reference to look-ahead token. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003576 yyn = yypact[yystate];
Dan Gohmanf4423b12008-04-19 00:24:39 +00003577 if (yyn == YYPACT_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003578 goto yydefault;
3579
Dan Gohmanf4423b12008-04-19 00:24:39 +00003580 /* Not known => get a look-ahead token if don't already have one. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003581
Dan Gohmanf4423b12008-04-19 00:24:39 +00003582 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003583 if (yychar == YYEMPTY)
3584 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003585 YYDPRINTF ((stderr, "Reading a token: "));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003586 yychar = YYLEX;
3587 }
3588
Dan Gohmanf4423b12008-04-19 00:24:39 +00003589 if (yychar <= YYEOF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003590 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003591 yychar = yytoken = YYEOF;
3592 YYDPRINTF ((stderr, "Now at end of input.\n"));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003593 }
3594 else
3595 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003596 yytoken = YYTRANSLATE (yychar);
3597 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Reid Spencer68a24bd2005-08-27 18:50:39 +00003598 }
3599
Dan Gohmanf4423b12008-04-19 00:24:39 +00003600 /* If the proper action on seeing token YYTOKEN is to reduce or to
3601 detect an error, take that action. */
3602 yyn += yytoken;
3603 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003604 goto yydefault;
3605 yyn = yytable[yyn];
Dan Gohmanf4423b12008-04-19 00:24:39 +00003606 if (yyn <= 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003607 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003608 if (yyn == 0 || yyn == YYTABLE_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003609 goto yyerrlab;
3610 yyn = -yyn;
3611 goto yyreduce;
3612 }
3613
3614 if (yyn == YYFINAL)
3615 YYACCEPT;
3616
Dan Gohmanf4423b12008-04-19 00:24:39 +00003617 /* Count tokens shifted since error; after three, turn off error
3618 status. */
3619 if (yyerrstatus)
3620 yyerrstatus--;
Dale Johannesencdd509a2007-09-07 21:07:57 +00003621
Dan Gohmanf4423b12008-04-19 00:24:39 +00003622 /* Shift the look-ahead token. */
3623 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003624
Dan Gohmanf4423b12008-04-19 00:24:39 +00003625 /* Discard the shifted token unless it is eof. */
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003626 if (yychar != YYEOF)
3627 yychar = YYEMPTY;
3628
Gabor Greife64d2482008-04-06 23:07:54 +00003629 yystate = yyn;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003630 *++yyvsp = yylval;
3631
Reid Spencer68a24bd2005-08-27 18:50:39 +00003632 goto yynewstate;
3633
Gabor Greife64d2482008-04-06 23:07:54 +00003634
Dan Gohmanf4423b12008-04-19 00:24:39 +00003635/*-----------------------------------------------------------.
3636| yydefault -- do the default action for the current state. |
3637`-----------------------------------------------------------*/
3638yydefault:
Reid Spencer68a24bd2005-08-27 18:50:39 +00003639 yyn = yydefact[yystate];
3640 if (yyn == 0)
3641 goto yyerrlab;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003642 goto yyreduce;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003643
Dan Gohmanf4423b12008-04-19 00:24:39 +00003644
3645/*-----------------------------.
3646| yyreduce -- Do a reduction. |
3647`-----------------------------*/
Reid Spencer68a24bd2005-08-27 18:50:39 +00003648yyreduce:
Dan Gohmanf4423b12008-04-19 00:24:39 +00003649 /* yyn is the number of a rule to reduce with. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003650 yylen = yyr2[yyn];
3651
Dan Gohmanf4423b12008-04-19 00:24:39 +00003652 /* If YYLEN is nonzero, implement the default value of the action:
3653 `$$ = $1'.
3654
3655 Otherwise, the following line sets YYVAL to garbage.
3656 This behavior is undocumented and Bison
3657 users should not rely upon it. Assigning to YYVAL
3658 unconditionally makes the parser a bit smaller, and it avoids a
3659 GCC warning that YYVAL may be used uninitialized. */
3660 yyval = yyvsp[1-yylen];
3661
3662
3663 YY_REDUCE_PRINT (yyn);
3664 switch (yyn)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003665 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003666 case 29:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003667#line 1149 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003668 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3669 break;
Reid Spencer41dff5e2007-01-26 08:05:27 +00003670
Dan Gohmanf4423b12008-04-19 00:24:39 +00003671 case 30:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003672#line 1149 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003673 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3674 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003675
Dan Gohmanf4423b12008-04-19 00:24:39 +00003676 case 31:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003677#line 1150 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003678 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3679 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003680
Dan Gohmanf4423b12008-04-19 00:24:39 +00003681 case 32:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003682#line 1150 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003683 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3684 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003685
Dan Gohmanf4423b12008-04-19 00:24:39 +00003686 case 33:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003687#line 1151 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003688 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3689 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003690
Dan Gohmanf4423b12008-04-19 00:24:39 +00003691 case 34:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003692#line 1151 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003693 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3694 break;
3695
3696 case 35:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003697#line 1152 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003698 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3699 break;
3700
3701 case 36:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003702#line 1152 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003703 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3704 break;
3705
3706 case 37:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003707#line 1153 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003708 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3709 break;
3710
3711 case 38:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003712#line 1153 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003713 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3714 break;
3715
3716 case 39:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003717#line 1157 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003718 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3719 break;
3720
3721 case 40:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003722#line 1157 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003723 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3724 break;
3725
3726 case 41:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003727#line 1158 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003728 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3729 break;
3730
3731 case 42:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003732#line 1158 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003733 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3734 break;
3735
3736 case 43:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003737#line 1159 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003738 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3739 break;
3740
3741 case 44:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003742#line 1159 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003743 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3744 break;
3745
3746 case 45:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003747#line 1160 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003748 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3749 break;
3750
3751 case 46:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003752#line 1160 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003753 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3754 break;
3755
3756 case 47:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003757#line 1161 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003758 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3759 break;
3760
3761 case 48:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003762#line 1161 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003763 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3764 break;
3765
3766 case 49:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003767#line 1162 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003768 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3769 break;
3770
3771 case 50:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003772#line 1162 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003773 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3774 break;
3775
3776 case 51:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003777#line 1163 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003778 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3779 break;
3780
3781 case 52:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003782#line 1163 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003783 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3784 break;
3785
3786 case 53:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003787#line 1164 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003788 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3789 break;
3790
3791 case 54:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003792#line 1165 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003793 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3794 break;
3795
3796 case 65:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003797#line 1174 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003798 { (yyval.StrVal) = 0; ;}
3799 break;
3800
3801 case 66:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003802#line 1176 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003803 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3804 break;
3805
3806 case 67:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003807#line 1177 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003808 { (yyval.UIntVal)=0; ;}
3809 break;
3810
3811 case 68:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003812#line 1181 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003813 {
3814 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003815 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003816 ;}
3817 break;
3818
3819 case 69:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003820#line 1185 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003821 {
3822 (yyval.StrVal) = 0;
Christopher Lambbf3348d2007-12-12 08:45:45 +00003823 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003824 ;}
3825 break;
3826
Chris Lattner15bd0952008-08-29 17:20:18 +00003827 case 70:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003828#line 1190 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003829 {
Chris Lattner15bd0952008-08-29 17:20:18 +00003830 (yyval.UIntVal) = (yyvsp[(1) - (2)].UIntVal);
3831 CHECK_FOR_ERROR
3832;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003833 break;
3834
3835 case 74:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003836#line 1199 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003837 {
3838 (yyval.StrVal) = 0;
3839 CHECK_FOR_ERROR
3840 ;}
3841 break;
3842
3843 case 75:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003844#line 1204 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003845 {
3846 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00003847 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003848 ;}
3849 break;
3850
Chris Lattner15bd0952008-08-29 17:20:18 +00003851 case 76:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003852#line 1210 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003853 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3854 break;
3855
Chris Lattner15bd0952008-08-29 17:20:18 +00003856 case 77:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003857#line 1211 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003858 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3859 break;
3860
Chris Lattner15bd0952008-08-29 17:20:18 +00003861 case 78:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003862#line 1212 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003863 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3864 break;
3865
Chris Lattner15bd0952008-08-29 17:20:18 +00003866 case 79:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003867#line 1213 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003868 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3869 break;
3870
Chris Lattner15bd0952008-08-29 17:20:18 +00003871 case 80:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003872#line 1214 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003873 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3874 break;
3875
Chris Lattner15bd0952008-08-29 17:20:18 +00003876 case 81:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003877#line 1215 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003878 { (yyval.Linkage) = GlobalValue::CommonLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003879 break;
3880
Chris Lattner15bd0952008-08-29 17:20:18 +00003881 case 82:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003882#line 1219 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003883 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003884 break;
3885
Chris Lattner15bd0952008-08-29 17:20:18 +00003886 case 83:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003887#line 1220 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003888 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003889 break;
3890
Chris Lattner15bd0952008-08-29 17:20:18 +00003891 case 84:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003892#line 1221 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003893 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003894 break;
3895
Dan Gohmanf4423b12008-04-19 00:24:39 +00003896 case 85:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003897#line 1225 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003898 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003899 break;
3900
3901 case 86:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003902#line 1226 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003903 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003904 break;
3905
3906 case 87:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003907#line 1227 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003908 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003909 break;
3910
3911 case 88:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003912#line 1228 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003913 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003914 break;
3915
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003916 case 89:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003917#line 1232 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003918 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003919 break;
3920
3921 case 90:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003922#line 1233 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003923 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003924 break;
3925
3926 case 91:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003927#line 1234 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003928 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003929 break;
3930
3931 case 92:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003932#line 1238 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003933 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3934 break;
3935
Chris Lattner15bd0952008-08-29 17:20:18 +00003936 case 93:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003937#line 1239 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003938 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003939 break;
3940
Chris Lattner15bd0952008-08-29 17:20:18 +00003941 case 94:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003942#line 1240 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003943 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3944 break;
3945
3946 case 95:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003947#line 1241 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003948 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3949 break;
3950
3951 case 96:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003952#line 1242 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003953 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3954 break;
3955
3956 case 97:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003957#line 1246 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003958 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3959 break;
3960
3961 case 98:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003962#line 1247 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003963 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3964 break;
3965
Dan Gohmanf4423b12008-04-19 00:24:39 +00003966 case 99:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003967#line 1248 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003968 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003969 break;
3970
3971 case 100:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003972#line 1251 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003973 { (yyval.UIntVal) = CallingConv::C; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003974 break;
3975
3976 case 101:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003977#line 1252 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003978 { (yyval.UIntVal) = CallingConv::C; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003979 break;
3980
3981 case 102:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003982#line 1253 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003983 { (yyval.UIntVal) = CallingConv::Fast; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003984 break;
3985
3986 case 103:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003987#line 1254 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003988 { (yyval.UIntVal) = CallingConv::Cold; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003989 break;
3990
3991 case 104:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003992#line 1255 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003993 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003994 break;
3995
3996 case 105:
Dale Johannesen236bbd42008-10-09 23:01:34 +00003997#line 1256 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003998 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003999 break;
4000
4001 case 106:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004002#line 1257 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004003 {
4004 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004005 GEN_ERROR("Calling conv too large");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004006 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004007 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004008 ;}
4009 break;
4010
Dale Johannesendfe8c842008-09-26 19:32:34 +00004011 case 107:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004012#line 1264 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesendfe8c842008-09-26 19:32:34 +00004013 { (yyval.Attributes) = Attribute::ZExt; ;}
4014 break;
4015
Dan Gohmanf4423b12008-04-19 00:24:39 +00004016 case 108:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004017#line 1265 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004018 { (yyval.Attributes) = Attribute::ZExt; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004019 break;
4020
4021 case 109:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004022#line 1266 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesendfe8c842008-09-26 19:32:34 +00004023 { (yyval.Attributes) = Attribute::SExt; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004024 break;
4025
4026 case 110:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004027#line 1267 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004028 { (yyval.Attributes) = Attribute::SExt; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004029 break;
4030
4031 case 111:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004032#line 1268 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004033 { (yyval.Attributes) = Attribute::InReg; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004034 break;
4035
Dale Johannesendfe8c842008-09-26 19:32:34 +00004036 case 112:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004037#line 1269 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004038 { (yyval.Attributes) = Attribute::StructRet; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004039 break;
4040
Dale Johannesendfe8c842008-09-26 19:32:34 +00004041 case 113:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004042#line 1270 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004043 { (yyval.Attributes) = Attribute::NoAlias; ;}
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004044 break;
4045
Dale Johannesendfe8c842008-09-26 19:32:34 +00004046 case 114:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004047#line 1271 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004048 { (yyval.Attributes) = Attribute::ByVal; ;}
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004049 break;
4050
Dale Johannesendfe8c842008-09-26 19:32:34 +00004051 case 115:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004052#line 1272 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004053 { (yyval.Attributes) = Attribute::Nest; ;}
Chris Lattner15bd0952008-08-29 17:20:18 +00004054 break;
4055
Dale Johannesendfe8c842008-09-26 19:32:34 +00004056 case 116:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004057#line 1273 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004058 { (yyval.Attributes) =
4059 Attribute::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004060 break;
4061
Dale Johannesendfe8c842008-09-26 19:32:34 +00004062 case 117:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004063#line 1277 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004064 { (yyval.Attributes) = Attribute::None; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004065 break;
4066
Dale Johannesendfe8c842008-09-26 19:32:34 +00004067 case 118:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004068#line 1278 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesendfe8c842008-09-26 19:32:34 +00004069 {
4070 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
4071 ;}
4072 break;
4073
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004074 case 119:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004075#line 1283 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004076 { (yyval.Attributes) = Attribute::InReg; ;}
Chris Lattner15bd0952008-08-29 17:20:18 +00004077 break;
4078
Devang Patel652203f2008-09-29 20:49:50 +00004079 case 120:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004080#line 1284 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004081 { (yyval.Attributes) = Attribute::ZExt; ;}
Chris Lattner15bd0952008-08-29 17:20:18 +00004082 break;
4083
Devang Patel652203f2008-09-29 20:49:50 +00004084 case 121:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004085#line 1285 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004086 { (yyval.Attributes) = Attribute::SExt; ;}
Chris Lattner15bd0952008-08-29 17:20:18 +00004087 break;
4088
Devang Patel652203f2008-09-29 20:49:50 +00004089 case 122:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004090#line 1288 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004091 { (yyval.Attributes) = Attribute::None; ;}
Chris Lattnerccef6b52008-09-23 21:18:31 +00004092 break;
4093
Devang Patel652203f2008-09-29 20:49:50 +00004094 case 123:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004095#line 1289 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00004096 {
4097 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
4098 ;}
4099 break;
4100
4101 case 124:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004102#line 1295 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00004103 { (yyval.Attributes) = Attribute::NoReturn; ;}
4104 break;
4105
4106 case 125:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004107#line 1296 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00004108 { (yyval.Attributes) = Attribute::NoUnwind; ;}
4109 break;
4110
4111 case 126:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004112#line 1297 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00004113 { (yyval.Attributes) = Attribute::InReg; ;}
4114 break;
4115
Dale Johannesendfe8c842008-09-26 19:32:34 +00004116 case 127:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004117#line 1298 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00004118 { (yyval.Attributes) = Attribute::ZExt; ;}
4119 break;
4120
4121 case 128:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004122#line 1299 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00004123 { (yyval.Attributes) = Attribute::SExt; ;}
4124 break;
4125
4126 case 129:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004127#line 1300 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00004128 { (yyval.Attributes) = Attribute::ReadNone; ;}
4129 break;
4130
4131 case 130:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004132#line 1301 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00004133 { (yyval.Attributes) = Attribute::ReadOnly; ;}
4134 break;
4135
4136 case 131:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004137#line 1302 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner9fc4da42008-10-08 06:44:45 +00004138 { (yyval.Attributes) = Attribute::NoInline; ;}
Devang Patel652203f2008-09-29 20:49:50 +00004139 break;
4140
4141 case 132:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004142#line 1303 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner9fc4da42008-10-08 06:44:45 +00004143 { (yyval.Attributes) = Attribute::AlwaysInline; ;}
Devang Patel652203f2008-09-29 20:49:50 +00004144 break;
4145
4146 case 133:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004147#line 1304 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner9fc4da42008-10-08 06:44:45 +00004148 { (yyval.Attributes) = Attribute::OptimizeForSize; ;}
Devang Patel652203f2008-09-29 20:49:50 +00004149 break;
4150
4151 case 134:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004152#line 1307 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00004153 { (yyval.Attributes) = Attribute::None; ;}
4154 break;
4155
4156 case 135:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004157#line 1308 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004158 {
Devang Patel05988662008-09-25 21:00:45 +00004159 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
Chris Lattner15bd0952008-08-29 17:20:18 +00004160 ;}
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004161 break;
4162
Devang Patel652203f2008-09-29 20:49:50 +00004163 case 136:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004164#line 1314 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld4980812008-09-02 20:52:40 +00004165 { (yyval.StrVal) = 0; ;}
4166 break;
4167
Devang Patel652203f2008-09-29 20:49:50 +00004168 case 137:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004169#line 1315 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004170 {
4171 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
4172 ;}
4173 break;
4174
Devang Patel652203f2008-09-29 20:49:50 +00004175 case 138:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004176#line 1322 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004177 { (yyval.UIntVal) = 0; ;}
4178 break;
4179
Devang Patel652203f2008-09-29 20:49:50 +00004180 case 139:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004181#line 1323 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004182 {
4183 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
4184 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004185 GEN_ERROR("Alignment must be a power of two");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004186 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004187;}
4188 break;
4189
Devang Patel652203f2008-09-29 20:49:50 +00004190 case 140:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004191#line 1329 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004192 { (yyval.UIntVal) = 0; ;}
4193 break;
4194
Devang Patel652203f2008-09-29 20:49:50 +00004195 case 141:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004196#line 1330 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004197 {
4198 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
4199 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Christopher Lambbf3348d2007-12-12 08:45:45 +00004200 GEN_ERROR("Alignment must be a power of two");
4201 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004202;}
4203 break;
4204
Devang Patel652203f2008-09-29 20:49:50 +00004205 case 142:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004206#line 1339 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004207 {
4208 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
4209 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004210 GEN_ERROR("Invalid character in section name");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004211 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004212 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004213;}
4214 break;
4215
Devang Patel652203f2008-09-29 20:49:50 +00004216 case 143:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004217#line 1347 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004218 { (yyval.StrVal) = 0; ;}
4219 break;
4220
Devang Patel652203f2008-09-29 20:49:50 +00004221 case 144:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004222#line 1348 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004223 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
4224 break;
4225
Devang Pateld4980812008-09-02 20:52:40 +00004226 case 145:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004227#line 1353 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004228 {;}
4229 break;
4230
Devang Pateld4980812008-09-02 20:52:40 +00004231 case 146:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004232#line 1354 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00004233 {;}
4234 break;
4235
4236 case 147:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004237#line 1355 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004238 {
4239 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
4240 delete (yyvsp[(1) - (1)].StrVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004241 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004242 ;}
4243 break;
4244
Devang Patel652203f2008-09-29 20:49:50 +00004245 case 148:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004246#line 1360 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004247 {
4248 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004249 GEN_ERROR("Alignment must be a power of two");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004250 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004251 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004252 ;}
4253 break;
4254
Devang Patel652203f2008-09-29 20:49:50 +00004255 case 156:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004256#line 1376 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004257 {
4258 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004259 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004260 ;}
4261 break;
4262
Devang Patel652203f2008-09-29 20:49:50 +00004263 case 157:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004264#line 1380 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004265 {
4266 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004267 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004268 ;}
4269 break;
4270
Devang Patel652203f2008-09-29 20:49:50 +00004271 case 158:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004272#line 1384 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004273 { // Pointer type?
4274 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
Christopher Lambbf3348d2007-12-12 08:45:45 +00004275 GEN_ERROR("Cannot form a pointer to a basic block");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004276 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4277 delete (yyvsp[(1) - (3)].TypeVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00004278 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004279 ;}
4280 break;
4281
Devang Patel652203f2008-09-29 20:49:50 +00004282 case 159:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004283#line 1391 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004284 { // Named types are also simple types...
4285 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00004286 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004287 (yyval.TypeVal) = new PATypeHolder(tmp);
4288 ;}
4289 break;
4290
Devang Patel652203f2008-09-29 20:49:50 +00004291 case 160:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004292#line 1396 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004293 { // Type UpReference
4294 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004295 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Dan Gohmanf4423b12008-04-19 00:24:39 +00004296 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4297 (yyval.TypeVal) = new PATypeHolder(OT);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004298 UR_OUT("New Upreference!\n");
4299 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004300 ;}
4301 break;
4302
Devang Patel652203f2008-09-29 20:49:50 +00004303 case 161:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004304#line 1404 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004305 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004306 // Allow but ignore attributes on function types; this permits auto-upgrade.
4307 // FIXME: remove in LLVM 3.0.
Chris Lattnera925a142008-04-23 05:37:08 +00004308 const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal);
4309 if (!FunctionType::isValidReturnType(RetTy))
4310 GEN_ERROR("Invalid result type for LLVM function");
Eric Christopher2a5196f2008-09-24 04:55:49 +00004311
Reid Spencer41dff5e2007-01-26 08:05:27 +00004312 std::vector<const Type*> Params;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004313 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00004314 for (; I != E; ++I ) {
Reid Spencer66728ef2007-03-20 01:13:36 +00004315 const Type *Ty = I->Ty->get();
Reid Spencer66728ef2007-03-20 01:13:36 +00004316 Params.push_back(Ty);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004317 }
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004318
Reid Spencer41dff5e2007-01-26 08:05:27 +00004319 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4320 if (isVarArg) Params.pop_back();
4321
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004322 for (unsigned i = 0; i != Params.size(); ++i)
4323 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4324 GEN_ERROR("Function arguments must be value types!");
4325
4326 CHECK_FOR_ERROR
4327
Anton Korobeynikovc36284e2007-12-03 19:17:47 +00004328 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004329 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
Eric Christopher2a5196f2008-09-24 04:55:49 +00004330 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Nuno Lopes8a88a372008-10-05 16:49:34 +00004331
4332 // Delete the argument list
4333 for (I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin() ; I != E; ++I ) {
4334 delete I->Ty;
4335 }
4336 delete (yyvsp[(3) - (5)].TypeWithAttrsList);
4337
Reid Spencere4d87aa2006-12-23 06:05:41 +00004338 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004339 ;}
4340 break;
4341
Devang Patel652203f2008-09-29 20:49:50 +00004342 case 162:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004343#line 1439 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004344 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004345 // Allow but ignore attributes on function types; this permits auto-upgrade.
4346 // FIXME: remove in LLVM 3.0.
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004347 std::vector<const Type*> Params;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004348 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00004349 for ( ; I != E; ++I ) {
Reid Spencer66728ef2007-03-20 01:13:36 +00004350 const Type* Ty = I->Ty->get();
Reid Spencer66728ef2007-03-20 01:13:36 +00004351 Params.push_back(Ty);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004352 }
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004353
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004354 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4355 if (isVarArg) Params.pop_back();
4356
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004357 for (unsigned i = 0; i != Params.size(); ++i)
4358 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4359 GEN_ERROR("Function arguments must be value types!");
4360
4361 CHECK_FOR_ERROR
4362
Dan Gohmanf4423b12008-04-19 00:24:39 +00004363 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
Eric Christopher2a5196f2008-09-24 04:55:49 +00004364 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Nuno Lopes8a88a372008-10-05 16:49:34 +00004365
4366 // Delete the argument list
4367 for (I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin() ; I != E; ++I ) {
4368 delete I->Ty;
4369 }
4370 delete (yyvsp[(3) - (5)].TypeWithAttrsList);
4371
Reid Spencer41dff5e2007-01-26 08:05:27 +00004372 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004373 ;}
4374 break;
4375
Devang Patel652203f2008-09-29 20:49:50 +00004376 case 163:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004377#line 1470 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004378 { // Sized array type?
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004379 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (yyvsp[(2) - (5)].UInt64Val))));
Dan Gohmanf4423b12008-04-19 00:24:39 +00004380 delete (yyvsp[(4) - (5)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004381 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004382 ;}
4383 break;
4384
Devang Patel652203f2008-09-29 20:49:50 +00004385 case 164:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004386#line 1475 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004387 { // Vector type?
4388 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4389 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004390 GEN_ERROR("Unsigned result not equal to signed result");
4391 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4392 GEN_ERROR("Element type of a VectorType must be primitive");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004393 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4394 delete (yyvsp[(4) - (5)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004395 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004396 ;}
4397 break;
4398
Devang Patel652203f2008-09-29 20:49:50 +00004399 case 165:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004400#line 1485 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004401 { // Structure type?
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004402 std::vector<const Type*> Elements;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004403 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4404 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004405 Elements.push_back(*I);
4406
Dan Gohmanf4423b12008-04-19 00:24:39 +00004407 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4408 delete (yyvsp[(2) - (3)].TypeList);
Reid Spencer14310612006-12-31 05:40:51 +00004409 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004410 ;}
4411 break;
4412
Devang Patel652203f2008-09-29 20:49:50 +00004413 case 166:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004414#line 1495 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004415 { // Empty structure type?
4416 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Reid Spencer14310612006-12-31 05:40:51 +00004417 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004418 ;}
4419 break;
4420
Devang Patel652203f2008-09-29 20:49:50 +00004421 case 167:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004422#line 1499 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004423 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004424 std::vector<const Type*> Elements;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004425 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4426 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004427 Elements.push_back(*I);
4428
Dan Gohmanf4423b12008-04-19 00:24:39 +00004429 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4430 delete (yyvsp[(3) - (5)].TypeList);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004431 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004432 ;}
4433 break;
4434
Devang Patel652203f2008-09-29 20:49:50 +00004435 case 168:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004436#line 1509 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004437 { // Empty structure type?
4438 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004439 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004440 ;}
4441 break;
4442
Devang Patel652203f2008-09-29 20:49:50 +00004443 case 169:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004444#line 1516 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004445 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004446 // Allow but ignore attributes on function types; this permits auto-upgrade.
4447 // FIXME: remove in LLVM 3.0.
Eric Christopher2a5196f2008-09-24 04:55:49 +00004448 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
Devang Patel05988662008-09-25 21:00:45 +00004449 (yyval.TypeWithAttrs).Attrs = Attribute::None;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004450 ;}
4451 break;
4452
Devang Patel652203f2008-09-29 20:49:50 +00004453 case 170:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004454#line 1525 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004455 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004456 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004457 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4458 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004459 GEN_ERROR("LLVM functions cannot return aggregate types");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004460 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4461 ;}
4462 break;
4463
Devang Patel652203f2008-09-29 20:49:50 +00004464 case 171:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004465#line 1532 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004466 {
4467 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4468 ;}
4469 break;
4470
Devang Patel652203f2008-09-29 20:49:50 +00004471 case 172:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004472#line 1537 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004473 {
4474 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4475 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
Reid Spencer3da59db2006-11-27 01:05:10 +00004476 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004477 ;}
4478 break;
4479
Devang Patel652203f2008-09-29 20:49:50 +00004480 case 173:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004481#line 1542 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004482 {
4483 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004484 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004485 ;}
4486 break;
4487
Devang Patel652203f2008-09-29 20:49:50 +00004488 case 175:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004489#line 1550 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004490 {
4491 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
Devang Patel05988662008-09-25 21:00:45 +00004492 TypeWithAttrs TWA; TWA.Attrs = Attribute::None;
Reid Spencer41dff5e2007-01-26 08:05:27 +00004493 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004494 (yyval.TypeWithAttrsList)->push_back(TWA);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004495 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004496 ;}
4497 break;
4498
Devang Patel652203f2008-09-29 20:49:50 +00004499 case 176:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004500#line 1557 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004501 {
4502 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
Devang Patel05988662008-09-25 21:00:45 +00004503 TypeWithAttrs TWA; TWA.Attrs = Attribute::None;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004504 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004505 (yyval.TypeWithAttrsList)->push_back(TWA);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004506 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004507 ;}
4508 break;
4509
Devang Patel652203f2008-09-29 20:49:50 +00004510 case 177:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004511#line 1564 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004512 {
4513 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004514 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004515 ;}
4516 break;
4517
Devang Patel652203f2008-09-29 20:49:50 +00004518 case 178:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004519#line 1572 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004520 {
4521 (yyval.TypeList) = new std::list<PATypeHolder>();
Eric Christopher2a5196f2008-09-24 04:55:49 +00004522 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
Dan Gohmanf4423b12008-04-19 00:24:39 +00004523 delete (yyvsp[(1) - (1)].TypeVal);
Reid Spencer3da59db2006-11-27 01:05:10 +00004524 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004525 ;}
4526 break;
4527
Devang Patel652203f2008-09-29 20:49:50 +00004528 case 179:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004529#line 1578 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004530 {
Eric Christopher2a5196f2008-09-24 04:55:49 +00004531 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
Dan Gohmanf4423b12008-04-19 00:24:39 +00004532 delete (yyvsp[(3) - (3)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004533 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004534 ;}
4535 break;
4536
Devang Patel652203f2008-09-29 20:49:50 +00004537 case 180:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004538#line 1590 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004539 { // Nonempty unsized arr
Reid Spencer14310612006-12-31 05:40:51 +00004540 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004541 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4542 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004543 if (ATy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004544 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004545 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004546 const Type *ETy = ATy->getElementType();
Dan Gohman180c1692008-06-23 18:43:26 +00004547 uint64_t NumElements = ATy->getNumElements();
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004548
4549 // Verify that we have the correct size...
Mon P Wang28873102008-06-25 08:15:39 +00004550 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (4)].ConstVector)->size())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004551 GEN_ERROR("Type mismatch: constant sized array initialized with " +
Eric Christopher2a5196f2008-09-24 04:55:49 +00004552 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Mon P Wang28873102008-06-25 08:15:39 +00004553 utostr(NumElements) + "");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004554
4555 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004556 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4557 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Eric Christopher2a5196f2008-09-24 04:55:49 +00004558 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004559 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohmanf4423b12008-04-19 00:24:39 +00004560 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004561 }
4562
Dan Gohmanf4423b12008-04-19 00:24:39 +00004563 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4564 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004565 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004566 ;}
4567 break;
4568
Devang Patel652203f2008-09-29 20:49:50 +00004569 case 181:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004570#line 1618 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004571 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004572 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004573 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4574 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004575 if (ATy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004576 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004577 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004578
Dan Gohman180c1692008-06-23 18:43:26 +00004579 uint64_t NumElements = ATy->getNumElements();
Eric Christopher2a5196f2008-09-24 04:55:49 +00004580 if (NumElements != uint64_t(-1) && NumElements != 0)
Andrew Lenharth6353e052006-12-08 18:07:09 +00004581 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
Mon P Wang28873102008-06-25 08:15:39 +00004582 " arguments, but has size of " + utostr(NumElements) +"");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004583 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4584 delete (yyvsp[(1) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00004585 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004586 ;}
4587 break;
4588
Devang Patel652203f2008-09-29 20:49:50 +00004589 case 182:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004590#line 1634 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004591 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004592 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004593 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4594 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004595 if (ATy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004596 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004597 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004598
Dan Gohman180c1692008-06-23 18:43:26 +00004599 uint64_t NumElements = ATy->getNumElements();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004600 const Type *ETy = ATy->getElementType();
Mon P Wang28873102008-06-25 08:15:39 +00004601 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (3)].StrVal)->length())
Eric Christopher2a5196f2008-09-24 04:55:49 +00004602 GEN_ERROR("Can't build string constant of size " +
Mon P Wang28873102008-06-25 08:15:39 +00004603 utostr((yyvsp[(3) - (3)].StrVal)->length()) +
4604 " when array has size " + utostr(NumElements) + "");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004605 std::vector<Constant*> Vals;
4606 if (ETy == Type::Int8Ty) {
Mon P Wang28873102008-06-25 08:15:39 +00004607 for (uint64_t i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
Dan Gohmanf4423b12008-04-19 00:24:39 +00004608 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004609 } else {
Dan Gohmanf4423b12008-04-19 00:24:39 +00004610 delete (yyvsp[(3) - (3)].StrVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004611 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4612 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004613 delete (yyvsp[(3) - (3)].StrVal);
4614 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4615 delete (yyvsp[(1) - (3)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004616 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004617 ;}
4618 break;
4619
Devang Patel652203f2008-09-29 20:49:50 +00004620 case 183:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004621#line 1661 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004622 { // Nonempty unsized arr
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004623 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004624 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4625 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004626 if (PTy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004627 GEN_ERROR("Cannot make packed constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004628 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004629 const Type *ETy = PTy->getElementType();
Dan Gohman180c1692008-06-23 18:43:26 +00004630 unsigned NumElements = PTy->getNumElements();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004631
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004632 // Verify that we have the correct size...
Mon P Wang28873102008-06-25 08:15:39 +00004633 if (NumElements != unsigned(-1) && NumElements != (unsigned)(yyvsp[(3) - (4)].ConstVector)->size())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004634 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
Eric Christopher2a5196f2008-09-24 04:55:49 +00004635 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Mon P Wang28873102008-06-25 08:15:39 +00004636 utostr(NumElements) + "");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004637
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004638 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004639 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4640 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Eric Christopher2a5196f2008-09-24 04:55:49 +00004641 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004642 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohmanf4423b12008-04-19 00:24:39 +00004643 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004644 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00004645
Dan Gohmanf4423b12008-04-19 00:24:39 +00004646 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4647 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004648 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004649 ;}
4650 break;
4651
Devang Patel652203f2008-09-29 20:49:50 +00004652 case 184:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004653#line 1689 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004654 {
4655 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004656 if (STy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004657 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004658 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004659
Dan Gohmanf4423b12008-04-19 00:24:39 +00004660 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004661 GEN_ERROR("Illegal number of initializers for structure type");
4662
4663 // Check to ensure that constants are compatible with the type initializer!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004664 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4665 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004666 GEN_ERROR("Expected type '" +
4667 STy->getElementType(i)->getDescription() +
4668 "' for element #" + utostr(i) +
4669 " of structure initializer");
4670
4671 // Check to ensure that Type is not packed
4672 if (STy->isPacked())
4673 GEN_ERROR("Unpacked Initializer to vector type '" +
4674 STy->getDescription() + "'");
4675
Dan Gohmanf4423b12008-04-19 00:24:39 +00004676 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4677 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004678 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004679 ;}
4680 break;
4681
Devang Patel652203f2008-09-29 20:49:50 +00004682 case 185:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004683#line 1715 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004684 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004685 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004686 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4687 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004688 if (STy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004689 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004690 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004691
4692 if (STy->getNumContainedTypes() != 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00004693 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004694
4695 // Check to ensure that Type is not packed
4696 if (STy->isPacked())
Chris Lattner6cdc6822007-04-26 05:31:05 +00004697 GEN_ERROR("Unpacked Initializer to vector type '" +
4698 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004699
Dan Gohmanf4423b12008-04-19 00:24:39 +00004700 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4701 delete (yyvsp[(1) - (3)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004702 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004703 ;}
4704 break;
4705
Devang Patel652203f2008-09-29 20:49:50 +00004706 case 186:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004707#line 1735 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004708 {
4709 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004710 if (STy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004711 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004712 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004713
Dan Gohmanf4423b12008-04-19 00:24:39 +00004714 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
Reid Spencerb5334b02007-02-05 10:18:06 +00004715 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004716
4717 // Check to ensure that constants are compatible with the type initializer!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004718 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4719 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
Reid Spencer41dff5e2007-01-26 08:05:27 +00004720 GEN_ERROR("Expected type '" +
4721 STy->getElementType(i)->getDescription() +
4722 "' for element #" + utostr(i) +
Reid Spencerb5334b02007-02-05 10:18:06 +00004723 " of structure initializer");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004724
4725 // Check to ensure that Type is packed
4726 if (!STy->isPacked())
Eric Christopher2a5196f2008-09-24 04:55:49 +00004727 GEN_ERROR("Vector initializer to non-vector type '" +
Chris Lattner32980692007-02-19 07:44:24 +00004728 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004729
Dan Gohmanf4423b12008-04-19 00:24:39 +00004730 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4731 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004732 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004733 ;}
4734 break;
4735
Devang Patel652203f2008-09-29 20:49:50 +00004736 case 187:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004737#line 1761 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004738 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004739 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004740 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4741 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004742 if (STy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004743 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004744 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004745
4746 if (STy->getNumContainedTypes() != 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00004747 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004748
4749 // Check to ensure that Type is packed
4750 if (!STy->isPacked())
Eric Christopher2a5196f2008-09-24 04:55:49 +00004751 GEN_ERROR("Vector initializer to non-vector type '" +
Chris Lattner32980692007-02-19 07:44:24 +00004752 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004753
Dan Gohmanf4423b12008-04-19 00:24:39 +00004754 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4755 delete (yyvsp[(1) - (5)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004756 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004757 ;}
4758 break;
4759
Devang Patel652203f2008-09-29 20:49:50 +00004760 case 188:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004761#line 1781 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004762 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004763 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004764 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4765 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004766 if (PTy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004767 GEN_ERROR("Cannot make null pointer constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004768 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004769
Dan Gohmanf4423b12008-04-19 00:24:39 +00004770 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4771 delete (yyvsp[(1) - (2)].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004772 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004773 ;}
4774 break;
4775
Devang Patel652203f2008-09-29 20:49:50 +00004776 case 189:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004777#line 1793 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004778 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004779 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004780 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4781 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4782 delete (yyvsp[(1) - (2)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004783 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004784 ;}
4785 break;
4786
Devang Patel652203f2008-09-29 20:49:50 +00004787 case 190:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004788#line 1800 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004789 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004790 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004791 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4792 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004793 if (Ty == 0)
Dan Gohmanf4423b12008-04-19 00:24:39 +00004794 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004795
4796 // ConstExprs can exist in the body of a function, thus creating
4797 // GlobalValues whenever they refer to a variable. Because we are in
Reid Spencer93c40032007-03-19 18:40:50 +00004798 // the context of a function, getExistingVal will search the functions
Reid Spencer68a24bd2005-08-27 18:50:39 +00004799 // symbol table instead of the module symbol table for the global symbol,
4800 // which throws things all off. To get around this, we just tell
Reid Spencer93c40032007-03-19 18:40:50 +00004801 // getExistingVal that we are at global scope here.
Reid Spencer68a24bd2005-08-27 18:50:39 +00004802 //
4803 Function *SavedCurFn = CurFun.CurrentFunction;
4804 CurFun.CurrentFunction = 0;
4805
Dan Gohmanf4423b12008-04-19 00:24:39 +00004806 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00004807 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00004808
4809 CurFun.CurrentFunction = SavedCurFn;
4810
4811 // If this is an initializer for a constant pointer, which is referencing a
4812 // (currently) undefined variable, create a stub now that shall be replaced
4813 // in the future with the right type of variable.
4814 //
4815 if (V == 0) {
Reid Spencera9720f52007-02-05 17:04:00 +00004816 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004817 const PointerType *PT = cast<PointerType>(Ty);
4818
4819 // First check to see if the forward references value is already created!
4820 PerModuleInfo::GlobalRefsType::iterator I =
Dan Gohmanf4423b12008-04-19 00:24:39 +00004821 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
Eric Christopher2a5196f2008-09-24 04:55:49 +00004822
Reid Spencer68a24bd2005-08-27 18:50:39 +00004823 if (I != CurModule.GlobalRefs.end()) {
4824 V = I->second; // Placeholder already exists, use it...
Dan Gohmanf4423b12008-04-19 00:24:39 +00004825 (yyvsp[(2) - (2)].ValIDVal).destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +00004826 } else {
4827 std::string Name;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004828 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4829 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4830 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
Reid Spencer41dff5e2007-01-26 08:05:27 +00004831 GEN_ERROR("Invalid reference to global");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004832
4833 // Create the forward referenced global.
4834 GlobalValue *GV;
Eric Christopher2a5196f2008-09-24 04:55:49 +00004835 if (const FunctionType *FTy =
Reid Spencer68a24bd2005-08-27 18:50:39 +00004836 dyn_cast<FunctionType>(PT->getElementType())) {
Gabor Greife64d2482008-04-06 23:07:54 +00004837 GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
4838 CurModule.CurrentModule);
Reid Spencer68a24bd2005-08-27 18:50:39 +00004839 } else {
4840 GV = new GlobalVariable(PT->getElementType(), false,
Chris Lattner6cdc6822007-04-26 05:31:05 +00004841 GlobalValue::ExternalWeakLinkage, 0,
Reid Spencer68a24bd2005-08-27 18:50:39 +00004842 Name, CurModule.CurrentModule);
4843 }
4844
4845 // Keep track of the fact that we have a forward ref to recycle it
Dan Gohmanf4423b12008-04-19 00:24:39 +00004846 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004847 V = GV;
4848 }
4849 }
4850
Dan Gohmanf4423b12008-04-19 00:24:39 +00004851 (yyval.ConstVal) = cast<GlobalValue>(V);
4852 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
Reid Spencer61c83e02006-08-18 08:43:06 +00004853 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004854 ;}
4855 break;
4856
Devang Patel652203f2008-09-29 20:49:50 +00004857 case 191:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004858#line 1866 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004859 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004860 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004861 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4862 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
Eric Christopher2a5196f2008-09-24 04:55:49 +00004863 GEN_ERROR("Mismatched types for constant expression: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004864 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4865 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4866 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004867 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004868 ;}
4869 break;
4870
Devang Patel652203f2008-09-29 20:49:50 +00004871 case 192:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004872#line 1876 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004873 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004874 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004875 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4876 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004877 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4878 GEN_ERROR("Cannot create a null initialized value of this type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004879 (yyval.ConstVal) = Constant::getNullValue(Ty);
4880 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004881 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004882 ;}
4883 break;
4884
Devang Patel652203f2008-09-29 20:49:50 +00004885 case 193:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004886#line 1886 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004887 { // integral constants
4888 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004889 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004890 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
Reid Spencer38c91a92007-02-28 02:24:54 +00004891 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004892 ;}
4893 break;
4894
Devang Patel652203f2008-09-29 20:49:50 +00004895 case 194:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004896#line 1892 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004897 { // arbitrary precision integer constants
4898 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4899 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004900 GEN_ERROR("Constant value does not fit in type");
4901 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004902 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4903 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4904 delete (yyvsp[(2) - (2)].APIntVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004905 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004906 ;}
4907 break;
4908
Devang Patel652203f2008-09-29 20:49:50 +00004909 case 195:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004910#line 1902 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004911 { // integral constants
4912 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004913 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004914 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004915 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004916 ;}
4917 break;
4918
Devang Patel652203f2008-09-29 20:49:50 +00004919 case 196:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004920#line 1908 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004921 { // arbitrary precision integer constants
4922 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4923 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004924 GEN_ERROR("Constant value does not fit in type");
Eric Christopher2a5196f2008-09-24 04:55:49 +00004925 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004926 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4927 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4928 delete (yyvsp[(2) - (2)].APIntVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004929 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004930 ;}
4931 break;
4932
Devang Patel652203f2008-09-29 20:49:50 +00004933 case 197:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004934#line 1918 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004935 { // Boolean constants
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004936 if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1)
4937 GEN_ERROR("Constant true must have type i1");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004938 (yyval.ConstVal) = ConstantInt::getTrue();
Reid Spencer38c91a92007-02-28 02:24:54 +00004939 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004940 ;}
4941 break;
4942
Devang Patel652203f2008-09-29 20:49:50 +00004943 case 198:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004944#line 1924 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004945 { // Boolean constants
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004946 if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1)
4947 GEN_ERROR("Constant false must have type i1");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004948 (yyval.ConstVal) = ConstantInt::getFalse();
Reid Spencer6f407902007-01-13 05:00:46 +00004949 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004950 ;}
4951 break;
4952
Devang Patel652203f2008-09-29 20:49:50 +00004953 case 199:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004954#line 1930 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004955 { // Floating point constants
4956 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004957 GEN_ERROR("Floating point constant invalid for type");
Eric Christopher2a5196f2008-09-24 04:55:49 +00004958 // Lexer has no type info, so builds all float and double FP constants
Dale Johannesenc72cd7e2007-09-11 18:33:39 +00004959 // as double. Fix this here. Long double is done right.
Dale Johannesen236bbd42008-10-09 23:01:34 +00004960 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy) {
4961 bool ignored;
4962 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven,
4963 &ignored);
4964 }
Chris Lattnerd8eb63f2008-04-20 00:41:19 +00004965 (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal));
Dan Gohmanf4423b12008-04-19 00:24:39 +00004966 delete (yyvsp[(2) - (2)].FPVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004967 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004968 ;}
4969 break;
4970
Devang Patel652203f2008-09-29 20:49:50 +00004971 case 200:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004972#line 1946 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004973 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004974 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004975 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4976 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4977 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4978 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004979 GEN_ERROR("invalid cast opcode for cast from '" +
4980 Val->getType()->getDescription() + "' to '" +
Eric Christopher2a5196f2008-09-24 04:55:49 +00004981 DestTy->getDescription() + "'");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004982 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4983 delete (yyvsp[(5) - (6)].TypeVal);
4984 ;}
4985 break;
4986
Devang Patel652203f2008-09-29 20:49:50 +00004987 case 201:
Dale Johannesen236bbd42008-10-09 23:01:34 +00004988#line 1958 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004989 {
4990 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
Reid Spencerb5334b02007-02-05 10:18:06 +00004991 GEN_ERROR("GetElementPtr requires a pointer operand");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004992
4993 const Type *IdxTy =
Dan Gohman041e2eb2008-05-15 19:50:34 +00004994 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004995 if (!IdxTy)
Reid Spencerb5334b02007-02-05 10:18:06 +00004996 GEN_ERROR("Index list invalid for constant getelementptr");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004997
Chris Lattnerf7469af2007-01-31 04:44:08 +00004998 SmallVector<Constant*, 8> IdxVec;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004999 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
5000 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005001 IdxVec.push_back(C);
5002 else
Reid Spencerb5334b02007-02-05 10:18:06 +00005003 GEN_ERROR("Indices to constant getelementptr must be constants");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005004
Dan Gohmanf4423b12008-04-19 00:24:39 +00005005 delete (yyvsp[(4) - (5)].ValueList);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005006
Dan Gohmanf4423b12008-04-19 00:24:39 +00005007 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
Andrew Lenharth6353e052006-12-08 18:07:09 +00005008 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005009 ;}
5010 break;
5011
Devang Patel652203f2008-09-29 20:49:50 +00005012 case 202:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005013#line 1979 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005014 {
5015 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005016 GEN_ERROR("Select condition must be of boolean type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005017 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005018 GEN_ERROR("Select operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005019 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005020 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005021 ;}
5022 break;
5023
Devang Patel652203f2008-09-29 20:49:50 +00005024 case 203:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005025#line 1987 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005026 {
5027 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005028 GEN_ERROR("Binary operator types must match");
5029 CHECK_FOR_ERROR;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005030 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
5031 ;}
5032 break;
5033
Devang Patel652203f2008-09-29 20:49:50 +00005034 case 204:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005035#line 1993 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005036 {
5037 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005038 GEN_ERROR("Logical operator types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005039 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
Eric Christopher2a5196f2008-09-24 04:55:49 +00005040 if (!isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
Dan Gohmanf4423b12008-04-19 00:24:39 +00005041 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005042 GEN_ERROR("Logical operator requires integral operands");
5043 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00005044 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005045 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005046 ;}
5047 break;
5048
Devang Patel652203f2008-09-29 20:49:50 +00005049 case 205:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005050#line 2004 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005051 {
5052 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005053 GEN_ERROR("icmp operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005054 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5055 ;}
5056 break;
5057
Devang Patel652203f2008-09-29 20:49:50 +00005058 case 206:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005059#line 2009 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005060 {
5061 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005062 GEN_ERROR("fcmp operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005063 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5064 ;}
5065 break;
5066
Devang Patel652203f2008-09-29 20:49:50 +00005067 case 207:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005068#line 2014 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00005069 {
5070 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5071 GEN_ERROR("vicmp operand types must match");
5072 (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5073 ;}
5074 break;
5075
Devang Patel652203f2008-09-29 20:49:50 +00005076 case 208:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005077#line 2019 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00005078 {
5079 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5080 GEN_ERROR("vfcmp operand types must match");
5081 (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5082 ;}
5083 break;
5084
Devang Patel652203f2008-09-29 20:49:50 +00005085 case 209:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005086#line 2024 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005087 {
5088 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005089 GEN_ERROR("Invalid extractelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005090 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00005091 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005092 ;}
5093 break;
5094
Devang Patel652203f2008-09-29 20:49:50 +00005095 case 210:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005096#line 2030 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005097 {
5098 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005099 GEN_ERROR("Invalid insertelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005100 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00005101 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005102 ;}
5103 break;
5104
Devang Patel652203f2008-09-29 20:49:50 +00005105 case 211:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005106#line 2036 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005107 {
5108 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005109 GEN_ERROR("Invalid shufflevector operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005110 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00005111 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005112 ;}
5113 break;
5114
Devang Patel652203f2008-09-29 20:49:50 +00005115 case 212:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005116#line 2042 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005117 {
5118 if (!isa<StructType>((yyvsp[(3) - (5)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (5)].ConstVal)->getType()))
5119 GEN_ERROR("ExtractValue requires an aggregate operand");
5120
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005121 (yyval.ConstVal) = ConstantExpr::getExtractValue((yyvsp[(3) - (5)].ConstVal), &(*(yyvsp[(4) - (5)].ConstantList))[0], (yyvsp[(4) - (5)].ConstantList)->size());
5122 delete (yyvsp[(4) - (5)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00005123 CHECK_FOR_ERROR
5124 ;}
5125 break;
5126
Devang Patel652203f2008-09-29 20:49:50 +00005127 case 213:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005128#line 2050 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005129 {
5130 if (!isa<StructType>((yyvsp[(3) - (7)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (7)].ConstVal)->getType()))
5131 GEN_ERROR("InsertValue requires an aggregate operand");
5132
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005133 (yyval.ConstVal) = ConstantExpr::getInsertValue((yyvsp[(3) - (7)].ConstVal), (yyvsp[(5) - (7)].ConstVal), &(*(yyvsp[(6) - (7)].ConstantList))[0], (yyvsp[(6) - (7)].ConstantList)->size());
5134 delete (yyvsp[(6) - (7)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00005135 CHECK_FOR_ERROR
5136 ;}
5137 break;
5138
Devang Patel652203f2008-09-29 20:49:50 +00005139 case 214:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005140#line 2061 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005141 {
5142 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005143 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005144 ;}
5145 break;
5146
Devang Patel652203f2008-09-29 20:49:50 +00005147 case 215:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005148#line 2065 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005149 {
5150 (yyval.ConstVector) = new std::vector<Constant*>();
5151 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005152 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005153 ;}
5154 break;
5155
Devang Patel652203f2008-09-29 20:49:50 +00005156 case 216:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005157#line 2073 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005158 { (yyval.BoolVal) = false; ;}
Nate Begemanac80ade2008-05-12 19:01:56 +00005159 break;
5160
Devang Pateld4980812008-09-02 20:52:40 +00005161 case 217:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005162#line 2073 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00005163 { (yyval.BoolVal) = true; ;}
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005164 break;
5165
Devang Pateld4980812008-09-02 20:52:40 +00005166 case 218:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005167#line 2076 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00005168 { (yyval.BoolVal) = true; ;}
Chris Lattnerccef6b52008-09-23 21:18:31 +00005169 break;
5170
Dale Johannesendfe8c842008-09-26 19:32:34 +00005171 case 219:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005172#line 2076 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00005173 { (yyval.BoolVal) = false; ;}
5174 break;
5175
5176 case 220:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005177#line 2079 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005178 {
5179 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
5180 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
Chris Lattner0275cff2007-08-06 21:00:46 +00005181 CHECK_FOR_ERROR
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005182 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
5183 if (!Aliasee)
5184 GEN_ERROR("Aliases can be created only to global values");
5185
Dan Gohmanf4423b12008-04-19 00:24:39 +00005186 (yyval.ConstVal) = Aliasee;
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005187 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005188 delete (yyvsp[(1) - (2)].TypeVal);
5189 ;}
5190 break;
5191
Devang Patel652203f2008-09-29 20:49:50 +00005192 case 221:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005193#line 2091 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005194 {
5195 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
5196 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
5197 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005198 GEN_ERROR("invalid cast opcode for cast from '" +
5199 Val->getType()->getDescription() + "' to '" +
5200 DestTy->getDescription() + "'");
Eric Christopher2a5196f2008-09-24 04:55:49 +00005201
Dan Gohmanf4423b12008-04-19 00:24:39 +00005202 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005203 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005204 delete (yyvsp[(5) - (6)].TypeVal);
5205 ;}
5206 break;
5207
Devang Pateld4980812008-09-02 20:52:40 +00005208 case 222:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005209#line 2112 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00005210 {
5211 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5212 CurModule.ModuleDone();
5213 CHECK_FOR_ERROR;
5214 ;}
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005215 break;
5216
Devang Patel652203f2008-09-29 20:49:50 +00005217 case 223:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005218#line 2117 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00005219 {
5220 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5221 CurModule.ModuleDone();
5222 CHECK_FOR_ERROR;
5223 ;}
Chris Lattnerccef6b52008-09-23 21:18:31 +00005224 break;
5225
Dale Johannesendfe8c842008-09-26 19:32:34 +00005226 case 226:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005227#line 2130 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00005228 { CurFun.isDeclare = false; ;}
5229 break;
5230
5231 case 227:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005232#line 2130 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005233 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005234 CurFun.FunctionDone();
5235 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005236 ;}
5237 break;
5238
Devang Patel652203f2008-09-29 20:49:50 +00005239 case 228:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005240#line 2134 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005241 { CurFun.isDeclare = true; ;}
5242 break;
5243
Devang Pateld4980812008-09-02 20:52:40 +00005244 case 229:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005245#line 2134 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00005246 {
5247 CHECK_FOR_ERROR
5248 ;}
5249 break;
5250
Devang Pateld4980812008-09-02 20:52:40 +00005251 case 230:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005252#line 2137 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00005253 {
5254 CHECK_FOR_ERROR
5255 ;}
5256 break;
5257
5258 case 231:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005259#line 2140 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005260 {
Reid Spencer14310612006-12-31 05:40:51 +00005261 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005262 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005263 // Eagerly resolve types. This is not an optimization, this is a
5264 // requirement that is due to the fact that we could have this:
5265 //
5266 // %list = type { %list * }
5267 // %list = type { %list * } ; repeated type decl
5268 //
5269 // If types are not resolved eagerly, then the two types will not be
5270 // determined to be the same type!
5271 //
Dan Gohmanf4423b12008-04-19 00:24:39 +00005272 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005273
Dan Gohmanf4423b12008-04-19 00:24:39 +00005274 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Reid Spencer5b7e7532006-09-28 19:28:24 +00005275 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005276 // If this is a named type that is not a redefinition, add it to the slot
5277 // table.
Dan Gohmanf4423b12008-04-19 00:24:39 +00005278 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005279 }
Reid Spencera132e042006-12-03 05:46:11 +00005280
Dan Gohmanf4423b12008-04-19 00:24:39 +00005281 delete (yyvsp[(3) - (3)].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005282 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005283 ;}
5284 break;
Reid Spencerb8f85052007-07-31 03:50:36 +00005285
Devang Patel652203f2008-09-29 20:49:50 +00005286 case 232:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005287#line 2164 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005288 {
5289 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
5290
5291 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005292 CHECK_FOR_ERROR
5293 // If this is a named type that is not a redefinition, add it to the slot
5294 // table.
Dan Gohmanf4423b12008-04-19 00:24:39 +00005295 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005296 }
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005297 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005298 ;}
5299 break;
5300
Devang Patel652203f2008-09-29 20:49:50 +00005301 case 233:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005302#line 2176 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Eric Christopher2a5196f2008-09-24 04:55:49 +00005303 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005304 /* "Externally Visible" Linkage */
Eric Christopher2a5196f2008-09-24 04:55:49 +00005305 if ((yyvsp[(5) - (6)].ConstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005306 GEN_ERROR("Global value initializer is not a constant");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005307 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5308 (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));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005309 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005310 ;}
5311 break;
5312
Devang Patel652203f2008-09-29 20:49:50 +00005313 case 234:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005314#line 2183 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005315 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005316 CurGV = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005317 ;}
5318 break;
5319
Devang Patel652203f2008-09-29 20:49:50 +00005320 case 235:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005321#line 2187 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005322 {
Eric Christopher2a5196f2008-09-24 04:55:49 +00005323 if ((yyvsp[(6) - (7)].ConstVal) == 0)
Christopher Lambbf3348d2007-12-12 08:45:45 +00005324 GEN_ERROR("Global value initializer is not a constant");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005325 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 Lambbf3348d2007-12-12 08:45:45 +00005326 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005327 ;}
5328 break;
5329
Devang Patel652203f2008-09-29 20:49:50 +00005330 case 236:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005331#line 2192 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005332 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005333 CurGV = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005334 ;}
5335 break;
5336
Devang Patel652203f2008-09-29 20:49:50 +00005337 case 237:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005338#line 2196 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005339 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005340 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005341 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5342 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 Lambbf3348d2007-12-12 08:45:45 +00005343 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005344 delete (yyvsp[(6) - (7)].TypeVal);
5345 ;}
5346 break;
5347
Devang Patel652203f2008-09-29 20:49:50 +00005348 case 238:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005349#line 2202 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005350 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005351 CurGV = 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +00005352 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005353 ;}
5354 break;
5355
Devang Patel652203f2008-09-29 20:49:50 +00005356 case 239:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005357#line 2206 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005358 {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005359 std::string Name;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005360 if ((yyvsp[(1) - (5)].StrVal)) {
5361 Name = *(yyvsp[(1) - (5)].StrVal);
5362 delete (yyvsp[(1) - (5)].StrVal);
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005363 }
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005364 if (Name.empty())
5365 GEN_ERROR("Alias name cannot be empty");
Eric Christopher2a5196f2008-09-24 04:55:49 +00005366
Dan Gohmanf4423b12008-04-19 00:24:39 +00005367 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005368 if (Aliasee == 0)
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005369 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005370
Dan Gohmanf4423b12008-04-19 00:24:39 +00005371 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005372 CurModule.CurrentModule);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005373 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005374 InsertValue(GA, CurModule.Values);
Eric Christopher2a5196f2008-09-24 04:55:49 +00005375
5376
Chris Lattner569f7372007-09-10 23:24:14 +00005377 // If there was a forward reference of this alias, resolve it now.
Eric Christopher2a5196f2008-09-24 04:55:49 +00005378
Chris Lattner569f7372007-09-10 23:24:14 +00005379 ValID ID;
5380 if (!Name.empty())
5381 ID = ValID::createGlobalName(Name);
5382 else
5383 ID = ValID::createGlobalID(CurModule.Values.size()-1);
Eric Christopher2a5196f2008-09-24 04:55:49 +00005384
Chris Lattner569f7372007-09-10 23:24:14 +00005385 if (GlobalValue *FWGV =
5386 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5387 // Replace uses of the fwdref with the actual alias.
5388 FWGV->replaceAllUsesWith(GA);
5389 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5390 GV->eraseFromParent();
5391 else
5392 cast<Function>(FWGV)->eraseFromParent();
5393 }
5394 ID.destroy();
Eric Christopher2a5196f2008-09-24 04:55:49 +00005395
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005396 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005397 ;}
5398 break;
5399
Chris Lattnerccef6b52008-09-23 21:18:31 +00005400 case 240:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005401#line 2246 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Eric Christopher2a5196f2008-09-24 04:55:49 +00005402 {
Anton Korobeynikov77d0f972007-04-25 14:29:12 +00005403 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005404 ;}
5405 break;
5406
Chris Lattnerccef6b52008-09-23 21:18:31 +00005407 case 241:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005408#line 2249 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00005409 {
5410 CHECK_FOR_ERROR
5411 ;}
5412 break;
5413
5414 case 242:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005415#line 2255 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005416 {
Chris Lattner66316012006-01-24 04:14:29 +00005417 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
Chris Lattner66316012006-01-24 04:14:29 +00005418 if (AsmSoFar.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005419 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
Chris Lattner66316012006-01-24 04:14:29 +00005420 else
Dan Gohmanf4423b12008-04-19 00:24:39 +00005421 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5422 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00005423 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005424;}
5425 break;
5426
Devang Patel652203f2008-09-29 20:49:50 +00005427 case 243:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005428#line 2265 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005429 {
5430 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5431 delete (yyvsp[(3) - (3)].StrVal);
5432 ;}
5433 break;
5434
Devang Patel652203f2008-09-29 20:49:50 +00005435 case 244:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005436#line 2269 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005437 {
5438 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5439 delete (yyvsp[(3) - (3)].StrVal);
5440 ;}
5441 break;
5442
Devang Patel652203f2008-09-29 20:49:50 +00005443 case 246:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005444#line 2276 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005445 {
5446 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5447 delete (yyvsp[(3) - (3)].StrVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00005448 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005449 ;}
5450 break;
5451
Devang Patel652203f2008-09-29 20:49:50 +00005452 case 247:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005453#line 2281 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005454 {
5455 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5456 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer1013b4d2007-07-31 14:41:17 +00005457 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005458 ;}
5459 break;
5460
Devang Patel652203f2008-09-29 20:49:50 +00005461 case 248:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005462#line 2286 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005463 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005464 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005465 ;}
5466 break;
5467
Devang Patel652203f2008-09-29 20:49:50 +00005468 case 249:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005469#line 2295 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005470 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005471 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005472 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005473 if (!(*(yyvsp[(3) - (5)].TypeVal))->isFirstClassType())
5474 GEN_ERROR("Argument types must be first-class");
Devang Patel05988662008-09-25 21:00:45 +00005475 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].Attributes); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005476 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5477 (yyvsp[(1) - (5)].ArgList)->push_back(E);
Reid Spencer6f407902007-01-13 05:00:46 +00005478 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005479 ;}
5480 break;
5481
Devang Patel652203f2008-09-29 20:49:50 +00005482 case 250:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005483#line 2305 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005484 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005485 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005486 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005487 if (!(*(yyvsp[(1) - (3)].TypeVal))->isFirstClassType())
5488 GEN_ERROR("Argument types must be first-class");
Devang Patel05988662008-09-25 21:00:45 +00005489 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].Attributes); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005490 (yyval.ArgList) = new ArgListType;
5491 (yyval.ArgList)->push_back(E);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005492 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005493 ;}
5494 break;
5495
Devang Patel652203f2008-09-29 20:49:50 +00005496 case 251:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005497#line 2316 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005498 {
5499 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005500 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005501 ;}
5502 break;
5503
Devang Patel652203f2008-09-29 20:49:50 +00005504 case 252:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005505#line 2320 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005506 {
5507 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005508 struct ArgListEntry E;
5509 E.Ty = new PATypeHolder(Type::VoidTy);
5510 E.Name = 0;
Devang Patel05988662008-09-25 21:00:45 +00005511 E.Attrs = Attribute::None;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005512 (yyval.ArgList)->push_back(E);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005513 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005514 ;}
5515 break;
5516
Devang Patel652203f2008-09-29 20:49:50 +00005517 case 253:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005518#line 2329 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005519 {
5520 (yyval.ArgList) = new ArgListType;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005521 struct ArgListEntry E;
5522 E.Ty = new PATypeHolder(Type::VoidTy);
5523 E.Name = 0;
Devang Patel05988662008-09-25 21:00:45 +00005524 E.Attrs = Attribute::None;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005525 (yyval.ArgList)->push_back(E);
Reid Spencer61c83e02006-08-18 08:43:06 +00005526 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005527 ;}
5528 break;
5529
Devang Patel652203f2008-09-29 20:49:50 +00005530 case 254:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005531#line 2338 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005532 {
5533 (yyval.ArgList) = 0;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005534 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005535 ;}
5536 break;
5537
Devang Patel652203f2008-09-29 20:49:50 +00005538 case 255:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005539#line 2344 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005540 {
Devang Patel652203f2008-09-29 20:49:50 +00005541 std::string FunctionName(*(yyvsp[(4) - (11)].StrVal));
5542 delete (yyvsp[(4) - (11)].StrVal); // Free strdup'd memory!
Eric Christopher2a5196f2008-09-24 04:55:49 +00005543
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005544 // Check the function result for abstractness if this is a define. We should
5545 // have no abstract types at this point
Devang Patel652203f2008-09-29 20:49:50 +00005546 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(3) - (11)].TypeVal)))
5547 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(3) - (11)].TypeVal)->get()->getDescription());
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005548
Devang Patel652203f2008-09-29 20:49:50 +00005549 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (11)].TypeVal)))
Chris Lattnera925a142008-04-23 05:37:08 +00005550 GEN_ERROR("Invalid result type for LLVM function");
Eric Christopher2a5196f2008-09-24 04:55:49 +00005551
Reid Spencer68a24bd2005-08-27 18:50:39 +00005552 std::vector<const Type*> ParamTypeList;
Devang Patel05988662008-09-25 21:00:45 +00005553 SmallVector<AttributeWithIndex, 8> Attrs;
Dale Johannesene7261862008-09-26 23:46:20 +00005554 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
5555 //attributes.
Devang Patel652203f2008-09-29 20:49:50 +00005556 Attributes RetAttrs = (yyvsp[(2) - (11)].Attributes);
5557 if ((yyvsp[(8) - (11)].Attributes) != Attribute::None) {
5558 if ((yyvsp[(8) - (11)].Attributes) & Attribute::ZExt) {
Dale Johannesene7261862008-09-26 23:46:20 +00005559 RetAttrs = RetAttrs | Attribute::ZExt;
Devang Patel652203f2008-09-29 20:49:50 +00005560 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::ZExt;
Dale Johannesene7261862008-09-26 23:46:20 +00005561 }
Devang Patel652203f2008-09-29 20:49:50 +00005562 if ((yyvsp[(8) - (11)].Attributes) & Attribute::SExt) {
Dale Johannesene7261862008-09-26 23:46:20 +00005563 RetAttrs = RetAttrs | Attribute::SExt;
Devang Patel652203f2008-09-29 20:49:50 +00005564 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::SExt;
Dale Johannesene7261862008-09-26 23:46:20 +00005565 }
Devang Patel652203f2008-09-29 20:49:50 +00005566 if ((yyvsp[(8) - (11)].Attributes) & Attribute::InReg) {
Dale Johannesene7261862008-09-26 23:46:20 +00005567 RetAttrs = RetAttrs | Attribute::InReg;
Devang Patel652203f2008-09-29 20:49:50 +00005568 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::InReg;
Dale Johannesene7261862008-09-26 23:46:20 +00005569 }
Dale Johannesene7261862008-09-26 23:46:20 +00005570 }
Devang Patel652203f2008-09-29 20:49:50 +00005571 if (RetAttrs != Attribute::None)
5572 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
5573 if ((yyvsp[(6) - (11)].ArgList)) { // If there are arguments...
Reid Spencer7b5d4662007-04-09 06:16:21 +00005574 unsigned index = 1;
Devang Patel652203f2008-09-29 20:49:50 +00005575 for (ArgListType::iterator I = (yyvsp[(6) - (11)].ArgList)->begin(); I != (yyvsp[(6) - (11)].ArgList)->end(); ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00005576 const Type* Ty = I->Ty->get();
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005577 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5578 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
Reid Spencer14310612006-12-31 05:40:51 +00005579 ParamTypeList.push_back(Ty);
Devang Patel05988662008-09-25 21:00:45 +00005580 if (Ty != Type::VoidTy && I->Attrs != Attribute::None)
5581 Attrs.push_back(AttributeWithIndex::get(index, I->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00005582 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005583 }
Devang Patel652203f2008-09-29 20:49:50 +00005584 if ((yyvsp[(8) - (11)].Attributes) != Attribute::None)
5585 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(8) - (11)].Attributes)));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005586
5587 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5588 if (isVarArg) ParamTypeList.pop_back();
5589
Devang Patel05988662008-09-25 21:00:45 +00005590 AttrListPtr PAL;
Christopher Lamb5c104242007-04-22 20:09:11 +00005591 if (!Attrs.empty())
Devang Patel05988662008-09-25 21:00:45 +00005592 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
Reid Spencer7b5d4662007-04-09 06:16:21 +00005593
Devang Patel652203f2008-09-29 20:49:50 +00005594 FunctionType *FT = FunctionType::get(*(yyvsp[(3) - (11)].TypeVal), ParamTypeList, isVarArg);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00005595 const PointerType *PFT = PointerType::getUnqual(FT);
Devang Patel652203f2008-09-29 20:49:50 +00005596 delete (yyvsp[(3) - (11)].TypeVal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005597
5598 ValID ID;
5599 if (!FunctionName.empty()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005600 ID = ValID::createGlobalName((char*)FunctionName.c_str());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005601 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00005602 ID = ValID::createGlobalID(CurModule.Values.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005603 }
5604
5605 Function *Fn = 0;
5606 // See if this function was forward referenced. If so, recycle the object.
5607 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
Eric Christopher2a5196f2008-09-24 04:55:49 +00005608 // Move the function to the end of the list, from whereever it was
Reid Spencer68a24bd2005-08-27 18:50:39 +00005609 // previously inserted.
5610 Fn = cast<Function>(FWRef);
Devang Patel05988662008-09-25 21:00:45 +00005611 assert(Fn->getAttributes().isEmpty() &&
Chris Lattner58d74912008-03-12 17:45:29 +00005612 "Forward reference has parameter attributes!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005613 CurModule.CurrentModule->getFunctionList().remove(Fn);
5614 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5615 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
Reid Spenceref9b9a72007-02-05 20:47:22 +00005616 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
Duncan Sandsdc024672007-11-27 13:23:08 +00005617 if (Fn->getFunctionType() != FT ) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00005618 // The existing function doesn't have the same type. This is an overload
5619 // error.
5620 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Devang Patel05988662008-09-25 21:00:45 +00005621 } else if (Fn->getAttributes() != PAL) {
Duncan Sandsdc024672007-11-27 13:23:08 +00005622 // The existing function doesn't have the same parameter attributes.
5623 // This is an overload error.
5624 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Reid Spenceref9b9a72007-02-05 20:47:22 +00005625 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
Chris Lattner6cdc6822007-04-26 05:31:05 +00005626 // Neither the existing or the current function is a declaration and they
5627 // have the same name and same type. Clearly this is a redefinition.
5628 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
Duncan Sandsdc024672007-11-27 13:23:08 +00005629 } else if (Fn->isDeclaration()) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00005630 // Make sure to strip off any argument names so we can't get conflicts.
Reid Spencer68a24bd2005-08-27 18:50:39 +00005631 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5632 AI != AE; ++AI)
5633 AI->setName("");
Reid Spenceref9b9a72007-02-05 20:47:22 +00005634 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005635 } else { // Not already defined?
Gabor Greife64d2482008-04-06 23:07:54 +00005636 Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5637 CurModule.CurrentModule);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005638 InsertValue(Fn, CurModule.Values);
5639 }
5640
Nuno Lopes9e9631d2008-10-03 15:45:58 +00005641 ID.destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +00005642 CurFun.FunctionStart(Fn);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00005643
5644 if (CurFun.isDeclare) {
5645 // If we have declaration, always overwrite linkage. This will allow us to
5646 // correctly handle cases, when pointer to function is passed as argument to
5647 // another function.
5648 Fn->setLinkage(CurFun.Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005649 Fn->setVisibility(CurFun.Visibility);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00005650 }
Devang Pateld4980812008-09-02 20:52:40 +00005651 Fn->setCallingConv((yyvsp[(1) - (11)].UIntVal));
Devang Patel05988662008-09-25 21:00:45 +00005652 Fn->setAttributes(PAL);
Devang Patel652203f2008-09-29 20:49:50 +00005653 Fn->setAlignment((yyvsp[(10) - (11)].UIntVal));
5654 if ((yyvsp[(9) - (11)].StrVal)) {
5655 Fn->setSection(*(yyvsp[(9) - (11)].StrVal));
5656 delete (yyvsp[(9) - (11)].StrVal);
Gordon Henriksen80a75bf2007-12-10 03:18:06 +00005657 }
Devang Patel652203f2008-09-29 20:49:50 +00005658 if ((yyvsp[(11) - (11)].StrVal)) {
5659 Fn->setGC((yyvsp[(11) - (11)].StrVal)->c_str());
5660 delete (yyvsp[(11) - (11)].StrVal);
Chris Lattnere869eef2005-11-12 00:11:49 +00005661 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005662
5663 // Add all of the arguments we parsed to the function...
Devang Patel652203f2008-09-29 20:49:50 +00005664 if ((yyvsp[(6) - (11)].ArgList)) { // Is null if empty...
Reid Spencer68a24bd2005-08-27 18:50:39 +00005665 if (isVarArg) { // Nuke the last entry
Devang Patel652203f2008-09-29 20:49:50 +00005666 assert((yyvsp[(6) - (11)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(6) - (11)].ArgList)->back().Name == 0 &&
Reid Spencera9720f52007-02-05 17:04:00 +00005667 "Not a varargs marker!");
Devang Patel652203f2008-09-29 20:49:50 +00005668 delete (yyvsp[(6) - (11)].ArgList)->back().Ty;
5669 (yyvsp[(6) - (11)].ArgList)->pop_back(); // Delete the last entry
Reid Spencer68a24bd2005-08-27 18:50:39 +00005670 }
5671 Function::arg_iterator ArgIt = Fn->arg_begin();
Reid Spenceref9b9a72007-02-05 20:47:22 +00005672 Function::arg_iterator ArgEnd = Fn->arg_end();
Reid Spencer14310612006-12-31 05:40:51 +00005673 unsigned Idx = 1;
Devang Patel652203f2008-09-29 20:49:50 +00005674 for (ArgListType::iterator I = (yyvsp[(6) - (11)].ArgList)->begin();
5675 I != (yyvsp[(6) - (11)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
Reid Spencer14310612006-12-31 05:40:51 +00005676 delete I->Ty; // Delete the typeholder...
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005677 setValueName(ArgIt, I->Name); // Insert arg into symtab...
Reid Spencer5b7e7532006-09-28 19:28:24 +00005678 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005679 InsertValue(ArgIt);
Reid Spencer14310612006-12-31 05:40:51 +00005680 Idx++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005681 }
Reid Spencera132e042006-12-03 05:46:11 +00005682
Devang Patel652203f2008-09-29 20:49:50 +00005683 delete (yyvsp[(6) - (11)].ArgList); // We're now done with the argument list
Reid Spencer68a24bd2005-08-27 18:50:39 +00005684 }
Reid Spencer61c83e02006-08-18 08:43:06 +00005685 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005686;}
5687 break;
5688
Devang Patel652203f2008-09-29 20:49:50 +00005689 case 258:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005690#line 2494 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005691 {
5692 (yyval.FunctionVal) = CurFun.CurrentFunction;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005693
5694 // Make sure that we keep track of the linkage type even if there was a
5695 // previous "declare".
Dan Gohmanf4423b12008-04-19 00:24:39 +00005696 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5697 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5698;}
5699 break;
5700
Devang Patel652203f2008-09-29 20:49:50 +00005701 case 261:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005702#line 2505 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005703 {
5704 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005705 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005706;}
5707 break;
5708
Devang Patel652203f2008-09-29 20:49:50 +00005709 case 262:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005710#line 2510 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005711 {
5712 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5713 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5714 (yyval.FunctionVal) = CurFun.CurrentFunction;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005715 CurFun.FunctionDone();
Reid Spencer41dff5e2007-01-26 08:05:27 +00005716 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005717 ;}
5718 break;
5719
Devang Patel652203f2008-09-29 20:49:50 +00005720 case 263:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005721#line 2522 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005722 {
5723 (yyval.BoolVal) = false;
Reid Spencer61c83e02006-08-18 08:43:06 +00005724 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005725 ;}
5726 break;
5727
Devang Patel652203f2008-09-29 20:49:50 +00005728 case 264:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005729#line 2526 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005730 {
5731 (yyval.BoolVal) = true;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005732 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005733 ;}
5734 break;
5735
Devang Patel652203f2008-09-29 20:49:50 +00005736 case 265:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005737#line 2531 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005738 { // A reference to a direct constant
5739 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005740 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005741 ;}
5742 break;
5743
Devang Patel652203f2008-09-29 20:49:50 +00005744 case 266:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005745#line 2535 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005746 {
5747 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005748 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005749 ;}
5750 break;
5751
Devang Patel652203f2008-09-29 20:49:50 +00005752 case 267:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005753#line 2539 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner1913b942008-07-11 00:30:39 +00005754 { // arbitrary precision integer constants
5755 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), true);
5756 delete (yyvsp[(1) - (1)].APIntVal);
5757 CHECK_FOR_ERROR
5758 ;}
5759 break;
5760
Devang Patel652203f2008-09-29 20:49:50 +00005761 case 268:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005762#line 2544 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner1913b942008-07-11 00:30:39 +00005763 { // arbitrary precision integer constants
5764 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), false);
5765 delete (yyvsp[(1) - (1)].APIntVal);
5766 CHECK_FOR_ERROR
5767 ;}
5768 break;
5769
Devang Patel652203f2008-09-29 20:49:50 +00005770 case 269:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005771#line 2549 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005772 { // Perhaps it's an FP constant?
5773 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00005774 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005775 ;}
5776 break;
5777
Devang Patel652203f2008-09-29 20:49:50 +00005778 case 270:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005779#line 2553 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005780 {
5781 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
Reid Spencere4d87aa2006-12-23 06:05:41 +00005782 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005783 ;}
5784 break;
5785
Devang Patel652203f2008-09-29 20:49:50 +00005786 case 271:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005787#line 2557 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005788 {
5789 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00005790 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005791 ;}
5792 break;
5793
Devang Patel652203f2008-09-29 20:49:50 +00005794 case 272:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005795#line 2561 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005796 {
5797 (yyval.ValIDVal) = ValID::createNull();
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00005798 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005799 ;}
5800 break;
5801
Devang Patel652203f2008-09-29 20:49:50 +00005802 case 273:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005803#line 2565 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005804 {
5805 (yyval.ValIDVal) = ValID::createUndef();
Reid Spencer61c83e02006-08-18 08:43:06 +00005806 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005807 ;}
5808 break;
5809
Devang Patel652203f2008-09-29 20:49:50 +00005810 case 274:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005811#line 2569 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005812 { // A vector zero constant.
5813 (yyval.ValIDVal) = ValID::createZeroInit();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005814 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005815 ;}
5816 break;
5817
Devang Patel652203f2008-09-29 20:49:50 +00005818 case 275:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005819#line 2573 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005820 { // Nonempty unsized packed vector
5821 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
Eric Christopher2a5196f2008-09-24 04:55:49 +00005822 unsigned NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005823
5824 if (!ETy->isInteger() && !ETy->isFloatingPoint())
5825 GEN_ERROR("Invalid vector element type: " + ETy->getDescription());
Eric Christopher2a5196f2008-09-24 04:55:49 +00005826
Reid Spencer9d6565a2007-02-15 02:26:10 +00005827 VectorType* pt = VectorType::get(ETy, NumElements);
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005828 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(pt));
Eric Christopher2a5196f2008-09-24 04:55:49 +00005829
Reid Spencer68a24bd2005-08-27 18:50:39 +00005830 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00005831 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5832 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Eric Christopher2a5196f2008-09-24 04:55:49 +00005833 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +00005834 ETy->getDescription() +"' as required!\nIt is of type '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00005835 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005836 }
5837
Dan Gohmanf4423b12008-04-19 00:24:39 +00005838 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5839 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
Reid Spencer832254e2007-02-02 02:16:23 +00005840 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005841 ;}
5842 break;
5843
Devang Patel652203f2008-09-29 20:49:50 +00005844 case 276:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005845#line 2595 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005846 { // Nonempty unsized arr
5847 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
Eric Christopher2a5196f2008-09-24 04:55:49 +00005848 uint64_t NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005849
5850 if (!ETy->isFirstClassType())
5851 GEN_ERROR("Invalid array element type: " + ETy->getDescription());
5852
5853 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5854 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(ATy));
5855
5856 // Verify all elements are correct type!
5857 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5858 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Eric Christopher2a5196f2008-09-24 04:55:49 +00005859 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005860 ETy->getDescription() +"' as required!\nIt is of type '"+
5861 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5862 }
5863
5864 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, *(yyvsp[(2) - (3)].ConstVector)));
5865 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5866 CHECK_FOR_ERROR
5867 ;}
5868 break;
5869
Devang Patel652203f2008-09-29 20:49:50 +00005870 case 277:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005871#line 2617 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005872 {
Dan Gohman180c1692008-06-23 18:43:26 +00005873 // Use undef instead of an array because it's inconvenient to determine
5874 // the element type at this point, there being no elements to examine.
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005875 (yyval.ValIDVal) = ValID::createUndef();
5876 CHECK_FOR_ERROR
5877 ;}
5878 break;
5879
Devang Patel652203f2008-09-29 20:49:50 +00005880 case 278:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005881#line 2623 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005882 {
Dan Gohman180c1692008-06-23 18:43:26 +00005883 uint64_t NumElements = (yyvsp[(2) - (2)].StrVal)->length();
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005884 const Type *ETy = Type::Int8Ty;
5885
5886 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5887
5888 std::vector<Constant*> Vals;
5889 for (unsigned i = 0; i < (yyvsp[(2) - (2)].StrVal)->length(); ++i)
5890 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(2) - (2)].StrVal))[i]));
5891 delete (yyvsp[(2) - (2)].StrVal);
5892 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, Vals));
5893 CHECK_FOR_ERROR
5894 ;}
5895 break;
5896
Devang Patel652203f2008-09-29 20:49:50 +00005897 case 279:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005898#line 2636 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005899 {
5900 std::vector<const Type*> Elements((yyvsp[(2) - (3)].ConstVector)->size());
5901 for (unsigned i = 0, e = (yyvsp[(2) - (3)].ConstVector)->size(); i != e; ++i)
5902 Elements[i] = (*(yyvsp[(2) - (3)].ConstVector))[i]->getType();
5903
5904 const StructType *STy = StructType::get(Elements);
5905 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5906
5907 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(2) - (3)].ConstVector)));
5908 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5909 CHECK_FOR_ERROR
5910 ;}
5911 break;
5912
Devang Patel652203f2008-09-29 20:49:50 +00005913 case 280:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005914#line 2648 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005915 {
5916 const StructType *STy = StructType::get(std::vector<const Type*>());
5917 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5918 CHECK_FOR_ERROR
5919 ;}
5920 break;
5921
Devang Patel652203f2008-09-29 20:49:50 +00005922 case 281:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005923#line 2653 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005924 {
5925 std::vector<const Type*> Elements((yyvsp[(3) - (5)].ConstVector)->size());
5926 for (unsigned i = 0, e = (yyvsp[(3) - (5)].ConstVector)->size(); i != e; ++i)
5927 Elements[i] = (*(yyvsp[(3) - (5)].ConstVector))[i]->getType();
5928
5929 const StructType *STy = StructType::get(Elements, /*isPacked=*/true);
5930 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5931
5932 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(3) - (5)].ConstVector)));
5933 delete PTy; delete (yyvsp[(3) - (5)].ConstVector);
5934 CHECK_FOR_ERROR
5935 ;}
5936 break;
5937
Devang Patel652203f2008-09-29 20:49:50 +00005938 case 282:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005939#line 2665 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005940 {
5941 const StructType *STy = StructType::get(std::vector<const Type*>(),
5942 /*isPacked=*/true);
5943 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5944 CHECK_FOR_ERROR
5945 ;}
5946 break;
5947
Devang Patel652203f2008-09-29 20:49:50 +00005948 case 283:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005949#line 2671 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005950 {
5951 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
Reid Spencer832254e2007-02-02 02:16:23 +00005952 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005953 ;}
5954 break;
5955
Devang Patel652203f2008-09-29 20:49:50 +00005956 case 284:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005957#line 2675 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005958 {
5959 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5960 delete (yyvsp[(3) - (5)].StrVal);
5961 delete (yyvsp[(5) - (5)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005962 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005963 ;}
5964 break;
5965
Devang Patel652203f2008-09-29 20:49:50 +00005966 case 285:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005967#line 2685 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005968 { // Is it an integer reference...?
5969 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005970 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005971 ;}
5972 break;
5973
Devang Patel652203f2008-09-29 20:49:50 +00005974 case 286:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005975#line 2689 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005976 {
5977 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
Reid Spencer832254e2007-02-02 02:16:23 +00005978 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005979 ;}
5980 break;
5981
Devang Patel652203f2008-09-29 20:49:50 +00005982 case 287:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005983#line 2693 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005984 { // Is it a named reference...?
5985 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5986 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005987 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005988 ;}
5989 break;
5990
Devang Patel652203f2008-09-29 20:49:50 +00005991 case 288:
Dale Johannesen236bbd42008-10-09 23:01:34 +00005992#line 2698 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005993 { // Is it a named reference...?
5994 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5995 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005996 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005997 ;}
5998 break;
5999
Devang Patel652203f2008-09-29 20:49:50 +00006000 case 291:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006001#line 2711 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006002 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006003 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006004 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Eric Christopher2a5196f2008-09-24 04:55:49 +00006005 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
Dan Gohmanf4423b12008-04-19 00:24:39 +00006006 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer832254e2007-02-02 02:16:23 +00006007 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006008 ;}
6009 break;
6010
Devang Patel652203f2008-09-29 20:49:50 +00006011 case 292:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006012#line 2720 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006013 {
6014 (yyval.ValueList) = new std::vector<Value *>();
Eric Christopher2a5196f2008-09-24 04:55:49 +00006015 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
Devang Patel7990dc72008-02-20 22:40:23 +00006016 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006017 ;}
6018 break;
6019
Devang Patel652203f2008-09-29 20:49:50 +00006020 case 293:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006021#line 2725 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006022 {
Eric Christopher2a5196f2008-09-24 04:55:49 +00006023 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
Devang Patel7990dc72008-02-20 22:40:23 +00006024 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006025 ;}
6026 break;
6027
Devang Patel652203f2008-09-29 20:49:50 +00006028 case 294:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006029#line 2730 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006030 {
6031 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006032 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006033 ;}
6034 break;
6035
Devang Patel652203f2008-09-29 20:49:50 +00006036 case 295:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006037#line 2734 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Eric Christopher2a5196f2008-09-24 04:55:49 +00006038 { // Do not allow functions with 0 basic blocks
Dan Gohmanf4423b12008-04-19 00:24:39 +00006039 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006040 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006041 ;}
6042 break;
6043
Devang Patel652203f2008-09-29 20:49:50 +00006044 case 296:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006045#line 2743 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006046 {
6047 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006048 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006049 InsertValue((yyvsp[(3) - (3)].TermInstVal));
6050 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
6051 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006052 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006053 ;}
6054 break;
6055
Devang Patel652203f2008-09-29 20:49:50 +00006056 case 297:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006057#line 2752 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00006058 {
6059 CHECK_FOR_ERROR
6060 int ValNum = InsertValue((yyvsp[(3) - (3)].TermInstVal));
6061 if (ValNum != (int)(yyvsp[(2) - (3)].UIntVal))
6062 GEN_ERROR("Result value number %" + utostr((yyvsp[(2) - (3)].UIntVal)) +
6063 " is incorrect, expected %" + utostr((unsigned)ValNum));
Eric Christopher2a5196f2008-09-24 04:55:49 +00006064
Chris Lattner15bd0952008-08-29 17:20:18 +00006065 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
6066 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
6067 CHECK_FOR_ERROR
6068;}
6069 break;
6070
Devang Patel652203f2008-09-29 20:49:50 +00006071 case 298:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006072#line 2765 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006073 {
6074 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006075 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
6076 if (CI2->getParent() == 0)
Dan Gohmanf4423b12008-04-19 00:24:39 +00006077 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
6078 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
6079 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
Anton Korobeynikov38e09802007-04-28 13:48:45 +00006080 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006081 ;}
6082 break;
Chris Lattner38905612008-02-19 04:36:25 +00006083
Devang Patel652203f2008-09-29 20:49:50 +00006084 case 299:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006085#line 2774 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006086 { // Empty space between instruction lists
Chris Lattnercc81d152008-05-04 17:18:47 +00006087 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
Dan Gohmanf4423b12008-04-19 00:24:39 +00006088 CHECK_FOR_ERROR
6089 ;}
6090 break;
6091
Devang Patel652203f2008-09-29 20:49:50 +00006092 case 300:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006093#line 2778 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnercc81d152008-05-04 17:18:47 +00006094 { // Labelled (named) basic block
6095 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
6096 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006097 CHECK_FOR_ERROR
Chris Lattnercc81d152008-05-04 17:18:47 +00006098
Dan Gohmanf4423b12008-04-19 00:24:39 +00006099 ;}
6100 break;
6101
Devang Patel652203f2008-09-29 20:49:50 +00006102 case 301:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006103#line 2786 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006104 { // Return with a result...
6105 ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
6106 assert(!VL.empty() && "Invalid ret operands!");
Dan Gohman1a570242008-07-23 00:54:54 +00006107 const Type *ReturnType = CurFun.CurrentFunction->getReturnType();
6108 if (VL.size() > 1 ||
6109 (isa<StructType>(ReturnType) &&
6110 (VL.empty() || VL[0]->getType() != ReturnType))) {
6111 Value *RV = UndefValue::get(ReturnType);
6112 for (unsigned i = 0, e = VL.size(); i != e; ++i) {
6113 Instruction *I = InsertValueInst::Create(RV, VL[i], i, "mrv");
6114 ((yyvsp[(-1) - (2)].BasicBlockVal))->getInstList().push_back(I);
6115 RV = I;
6116 }
6117 (yyval.TermInstVal) = ReturnInst::Create(RV);
6118 } else {
6119 (yyval.TermInstVal) = ReturnInst::Create(VL[0]);
6120 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006121 delete (yyvsp[(2) - (2)].ValueList);
6122 CHECK_FOR_ERROR
6123 ;}
6124 break;
6125
Devang Patel652203f2008-09-29 20:49:50 +00006126 case 302:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006127#line 2806 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006128 { // Return with no result...
6129 (yyval.TermInstVal) = ReturnInst::Create();
6130 CHECK_FOR_ERROR
6131 ;}
6132 break;
6133
Devang Patel652203f2008-09-29 20:49:50 +00006134 case 303:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006135#line 2810 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006136 { // Unconditional Branch...
6137 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
6138 CHECK_FOR_ERROR
6139 (yyval.TermInstVal) = BranchInst::Create(tmpBB);
6140 ;}
6141 break;
6142
Devang Patel652203f2008-09-29 20:49:50 +00006143 case 304:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006144#line 2815 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Eric Christopher2a5196f2008-09-24 04:55:49 +00006145 {
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006146 if (cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() != 1)
6147 GEN_ERROR("Branch condition must have type i1");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006148 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6149 CHECK_FOR_ERROR
6150 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
6151 CHECK_FOR_ERROR
6152 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
6153 CHECK_FOR_ERROR
6154 (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal);
6155 ;}
6156 break;
6157
Devang Patel652203f2008-09-29 20:49:50 +00006158 case 305:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006159#line 2826 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006160 {
6161 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
6162 CHECK_FOR_ERROR
6163 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6164 CHECK_FOR_ERROR
6165 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
6166 (yyval.TermInstVal) = S;
6167
6168 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
6169 E = (yyvsp[(8) - (9)].JumpTable)->end();
Reid Spencer68a24bd2005-08-27 18:50:39 +00006170 for (; I != E; ++I) {
6171 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
6172 S->addCase(CI, I->second);
6173 else
Reid Spencerb5334b02007-02-05 10:18:06 +00006174 GEN_ERROR("Switch case is constant, but not a simple integer");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006175 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006176 delete (yyvsp[(8) - (9)].JumpTable);
Reid Spencer61c83e02006-08-18 08:43:06 +00006177 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006178 ;}
6179 break;
6180
Devang Patel652203f2008-09-29 20:49:50 +00006181 case 306:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006182#line 2845 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006183 {
6184 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006185 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006186 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006187 CHECK_FOR_ERROR
Gabor Greife64d2482008-04-06 23:07:54 +00006188 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006189 (yyval.TermInstVal) = S;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006190 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006191 ;}
6192 break;
6193
Devang Patel652203f2008-09-29 20:49:50 +00006194 case 307:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006195#line 2855 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006196 {
Reid Spencer3822ff52006-11-08 06:47:33 +00006197
Reid Spencer14310612006-12-31 05:40:51 +00006198 // Handle the short syntax
6199 const PointerType *PFTy = 0;
6200 const FunctionType *Ty = 0;
Devang Patel652203f2008-09-29 20:49:50 +00006201 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(4) - (15)].TypeVal)->get())) ||
Reid Spencer68a24bd2005-08-27 18:50:39 +00006202 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6203 // Pull out the types of all of the arguments...
6204 std::vector<const Type*> ParamTypes;
Devang Patel652203f2008-09-29 20:49:50 +00006205 ParamList::iterator I = (yyvsp[(7) - (15)].ParamList)->begin(), E = (yyvsp[(7) - (15)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006206 for (; I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00006207 const Type *Ty = I->Val->getType();
6208 if (Ty == Type::VoidTy)
6209 GEN_ERROR("Short call syntax cannot be used with varargs");
6210 ParamTypes.push_back(Ty);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006211 }
Eric Christopher2a5196f2008-09-24 04:55:49 +00006212
Devang Patel652203f2008-09-29 20:49:50 +00006213 if (!FunctionType::isValidReturnType(*(yyvsp[(4) - (15)].TypeVal)))
Chris Lattnera925a142008-04-23 05:37:08 +00006214 GEN_ERROR("Invalid result type for LLVM function");
6215
Devang Patel652203f2008-09-29 20:49:50 +00006216 Ty = FunctionType::get((yyvsp[(4) - (15)].TypeVal)->get(), ParamTypes, false);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00006217 PFTy = PointerType::getUnqual(Ty);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006218 }
6219
Devang Patel652203f2008-09-29 20:49:50 +00006220 delete (yyvsp[(4) - (15)].TypeVal);
Reid Spencer66728ef2007-03-20 01:13:36 +00006221
Devang Patel652203f2008-09-29 20:49:50 +00006222 Value *V = getVal(PFTy, (yyvsp[(5) - (15)].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00006223 CHECK_FOR_ERROR
Devang Patel652203f2008-09-29 20:49:50 +00006224 BasicBlock *Normal = getBBVal((yyvsp[(12) - (15)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006225 CHECK_FOR_ERROR
Devang Patel652203f2008-09-29 20:49:50 +00006226 BasicBlock *Except = getBBVal((yyvsp[(15) - (15)].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00006227 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00006228
Devang Patel05988662008-09-25 21:00:45 +00006229 SmallVector<AttributeWithIndex, 8> Attrs;
Dale Johannesene7261862008-09-26 23:46:20 +00006230 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
6231 //attributes.
Devang Patel652203f2008-09-29 20:49:50 +00006232 Attributes RetAttrs = (yyvsp[(3) - (15)].Attributes);
6233 if ((yyvsp[(9) - (15)].Attributes) != Attribute::None) {
6234 if ((yyvsp[(9) - (15)].Attributes) & Attribute::ZExt) {
Dale Johannesene7261862008-09-26 23:46:20 +00006235 RetAttrs = RetAttrs | Attribute::ZExt;
Devang Patel652203f2008-09-29 20:49:50 +00006236 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::ZExt;
Dale Johannesene7261862008-09-26 23:46:20 +00006237 }
Devang Patel652203f2008-09-29 20:49:50 +00006238 if ((yyvsp[(9) - (15)].Attributes) & Attribute::SExt) {
Dale Johannesene7261862008-09-26 23:46:20 +00006239 RetAttrs = RetAttrs | Attribute::SExt;
Devang Patel652203f2008-09-29 20:49:50 +00006240 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::SExt;
Dale Johannesene7261862008-09-26 23:46:20 +00006241 }
Devang Patel652203f2008-09-29 20:49:50 +00006242 if ((yyvsp[(9) - (15)].Attributes) & Attribute::InReg) {
Dale Johannesene7261862008-09-26 23:46:20 +00006243 RetAttrs = RetAttrs | Attribute::InReg;
Devang Patel652203f2008-09-29 20:49:50 +00006244 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::InReg;
Dale Johannesene7261862008-09-26 23:46:20 +00006245 }
Dale Johannesene7261862008-09-26 23:46:20 +00006246 }
Devang Patel652203f2008-09-29 20:49:50 +00006247 if (RetAttrs != Attribute::None)
6248 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
Dale Johannesene7261862008-09-26 23:46:20 +00006249
Reid Spencer14310612006-12-31 05:40:51 +00006250 // Check the arguments
6251 ValueList Args;
Devang Patel652203f2008-09-29 20:49:50 +00006252 if ((yyvsp[(7) - (15)].ParamList)->empty()) { // Has no arguments?
Reid Spencer14310612006-12-31 05:40:51 +00006253 // Make sure no arguments is a good thing!
6254 if (Ty->getNumParams() != 0)
6255 GEN_ERROR("No arguments passed to a function that "
Reid Spencerb5334b02007-02-05 10:18:06 +00006256 "expects arguments");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006257 } else { // Has arguments?
6258 // Loop through FunctionType's arguments and ensure they are specified
6259 // correctly!
Reid Spencer68a24bd2005-08-27 18:50:39 +00006260 FunctionType::param_iterator I = Ty->param_begin();
6261 FunctionType::param_iterator E = Ty->param_end();
Devang Patel652203f2008-09-29 20:49:50 +00006262 ParamList::iterator ArgI = (yyvsp[(7) - (15)].ParamList)->begin(), ArgE = (yyvsp[(7) - (15)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006263 unsigned index = 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00006264
Duncan Sandsdc024672007-11-27 13:23:08 +00006265 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006266 if (ArgI->Val->getType() != *I)
6267 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00006268 (*I)->getDescription() + "'");
Reid Spencer14310612006-12-31 05:40:51 +00006269 Args.push_back(ArgI->Val);
Devang Patel05988662008-09-25 21:00:45 +00006270 if (ArgI->Attrs != Attribute::None)
6271 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00006272 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00006273
Reid Spencer14310612006-12-31 05:40:51 +00006274 if (Ty->isVarArg()) {
6275 if (I == E)
Chris Lattner38905612008-02-19 04:36:25 +00006276 for (; ArgI != ArgE; ++ArgI, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006277 Args.push_back(ArgI->Val); // push the remaining varargs
Devang Patel05988662008-09-25 21:00:45 +00006278 if (ArgI->Attrs != Attribute::None)
6279 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Chris Lattner38905612008-02-19 04:36:25 +00006280 }
Reid Spencer14310612006-12-31 05:40:51 +00006281 } else if (I != E || ArgI != ArgE)
Reid Spencerb5334b02007-02-05 10:18:06 +00006282 GEN_ERROR("Invalid number of parameters detected");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006283 }
Devang Patel652203f2008-09-29 20:49:50 +00006284 if ((yyvsp[(9) - (15)].Attributes) != Attribute::None)
6285 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(9) - (15)].Attributes)));
Devang Patel05988662008-09-25 21:00:45 +00006286 AttrListPtr PAL;
Duncan Sandsdc024672007-11-27 13:23:08 +00006287 if (!Attrs.empty())
Devang Patel05988662008-09-25 21:00:45 +00006288 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsdc024672007-11-27 13:23:08 +00006289
Reid Spencer14310612006-12-31 05:40:51 +00006290 // Create the InvokeInst
Dan Gohman041e2eb2008-05-15 19:50:34 +00006291 InvokeInst *II = InvokeInst::Create(V, Normal, Except,
6292 Args.begin(), Args.end());
Devang Patel652203f2008-09-29 20:49:50 +00006293 II->setCallingConv((yyvsp[(2) - (15)].UIntVal));
Devang Patel05988662008-09-25 21:00:45 +00006294 II->setAttributes(PAL);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006295 (yyval.TermInstVal) = II;
Devang Patel652203f2008-09-29 20:49:50 +00006296 delete (yyvsp[(7) - (15)].ParamList);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006297 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006298 ;}
6299 break;
6300
Devang Patel652203f2008-09-29 20:49:50 +00006301 case 308:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006302#line 2958 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006303 {
6304 (yyval.TermInstVal) = new UnwindInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00006305 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006306 ;}
6307 break;
6308
Devang Patel652203f2008-09-29 20:49:50 +00006309 case 309:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006310#line 2962 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006311 {
6312 (yyval.TermInstVal) = new UnreachableInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00006313 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006314 ;}
6315 break;
6316
Devang Patel652203f2008-09-29 20:49:50 +00006317 case 310:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006318#line 2969 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006319 {
6320 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
6321 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006322 CHECK_FOR_ERROR
6323 if (V == 0)
6324 GEN_ERROR("May only switch on a constant pool value");
6325
Dan Gohmanf4423b12008-04-19 00:24:39 +00006326 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006327 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006328 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
6329 ;}
6330 break;
6331
Devang Patel652203f2008-09-29 20:49:50 +00006332 case 311:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006333#line 2980 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006334 {
6335 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
6336 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006337 CHECK_FOR_ERROR
6338
6339 if (V == 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00006340 GEN_ERROR("May only switch on a constant pool value");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006341
Dan Gohmanf4423b12008-04-19 00:24:39 +00006342 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006343 CHECK_FOR_ERROR
Eric Christopher2a5196f2008-09-24 04:55:49 +00006344 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
Dan Gohmanf4423b12008-04-19 00:24:39 +00006345 ;}
6346 break;
6347
Devang Patel652203f2008-09-29 20:49:50 +00006348 case 312:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006349#line 2993 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006350 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006351 // Is this definition named?? if so, assign the name...
Dan Gohmanf4423b12008-04-19 00:24:39 +00006352 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006353 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006354 InsertValue((yyvsp[(2) - (2)].InstVal));
6355 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006356 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006357 ;}
6358 break;
6359
Devang Patel652203f2008-09-29 20:49:50 +00006360 case 313:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006361#line 3002 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00006362 {
6363 CHECK_FOR_ERROR
6364 int ValNum = InsertValue((yyvsp[(2) - (2)].InstVal));
Eric Christopher2a5196f2008-09-24 04:55:49 +00006365
Chris Lattner15bd0952008-08-29 17:20:18 +00006366 if (ValNum != (int)(yyvsp[(1) - (2)].UIntVal))
6367 GEN_ERROR("Result value number %" + utostr((yyvsp[(1) - (2)].UIntVal)) +
6368 " is incorrect, expected %" + utostr((unsigned)ValNum));
6369
6370 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
6371 CHECK_FOR_ERROR
6372 ;}
6373 break;
6374
Devang Patel652203f2008-09-29 20:49:50 +00006375 case 314:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006376#line 3015 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006377 { // Used for PHI nodes
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006378 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006379 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
6380 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
6381 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
Reid Spencer6f407902007-01-13 05:00:46 +00006382 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006383 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006384 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006385 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6386 delete (yyvsp[(1) - (6)].TypeVal);
6387 ;}
6388 break;
6389
Devang Patel652203f2008-09-29 20:49:50 +00006390 case 315:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006391#line 3026 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006392 {
6393 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
6394 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006395 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006396 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006397 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006398 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6399 ;}
6400 break;
6401
Devang Patel652203f2008-09-29 20:49:50 +00006402 case 316:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006403#line 3036 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006404 {
Devang Patel05988662008-09-25 21:00:45 +00006405 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006406 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006407 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006408 // Used for call and invoke instructions
Dan Gohmanf4423b12008-04-19 00:24:39 +00006409 (yyval.ParamList) = new ParamList();
Devang Patel05988662008-09-25 21:00:45 +00006410 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].Attributes) | (yyvsp[(4) - (4)].Attributes); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
Dan Gohmanf4423b12008-04-19 00:24:39 +00006411 (yyval.ParamList)->push_back(E);
6412 delete (yyvsp[(1) - (4)].TypeVal);
Duncan Sandsdc024672007-11-27 13:23:08 +00006413 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006414 ;}
6415 break;
6416
Devang Patel652203f2008-09-29 20:49:50 +00006417 case 317:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006418#line 3047 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006419 {
Devang Patel05988662008-09-25 21:00:45 +00006420 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Dale Johanneseneb57ea72007-11-05 21:20:28 +00006421 // Labels are only valid in ASMs
Dan Gohmanf4423b12008-04-19 00:24:39 +00006422 (yyval.ParamList) = new ParamList();
Devang Patel05988662008-09-25 21:00:45 +00006423 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].Attributes) | (yyvsp[(4) - (4)].Attributes); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
Dan Gohmanf4423b12008-04-19 00:24:39 +00006424 (yyval.ParamList)->push_back(E);
Duncan Sandsdc024672007-11-27 13:23:08 +00006425 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006426 ;}
6427 break;
6428
Devang Patel652203f2008-09-29 20:49:50 +00006429 case 318:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006430#line 3055 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006431 {
Devang Patel05988662008-09-25 21:00:45 +00006432 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006433 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006434 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6435 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
Devang Patel05988662008-09-25 21:00:45 +00006436 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].Attributes) | (yyvsp[(6) - (6)].Attributes); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf4423b12008-04-19 00:24:39 +00006437 (yyval.ParamList)->push_back(E);
6438 delete (yyvsp[(3) - (6)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006439 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006440 ;}
6441 break;
6442
Devang Patel652203f2008-09-29 20:49:50 +00006443 case 319:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006444#line 3065 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006445 {
Devang Patel05988662008-09-25 21:00:45 +00006446 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf4423b12008-04-19 00:24:39 +00006447 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
Devang Patel05988662008-09-25 21:00:45 +00006448 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].Attributes) | (yyvsp[(6) - (6)].Attributes); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
Dan Gohmanf4423b12008-04-19 00:24:39 +00006449 (yyval.ParamList)->push_back(E);
Dale Johanneseneb57ea72007-11-05 21:20:28 +00006450 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006451 ;}
6452 break;
6453
Devang Patel652203f2008-09-29 20:49:50 +00006454 case 320:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006455#line 3072 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006456 { (yyval.ParamList) = new ParamList(); ;}
6457 break;
6458
Devang Patel652203f2008-09-29 20:49:50 +00006459 case 321:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006460#line 3075 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006461 { (yyval.ValueList) = new std::vector<Value*>(); ;}
6462 break;
6463
Devang Patel652203f2008-09-29 20:49:50 +00006464 case 322:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006465#line 3076 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006466 {
6467 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
6468 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00006469 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006470 ;}
6471 break;
6472
Devang Patel652203f2008-09-29 20:49:50 +00006473 case 323:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006474#line 3084 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006475 {
6476 (yyval.ConstantList) = new std::vector<unsigned>();
6477 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
6478 GEN_ERROR("Index " + utostr((yyvsp[(2) - (2)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6479 (yyval.ConstantList)->push_back((yyvsp[(2) - (2)].UInt64Val));
6480 ;}
6481 break;
6482
Devang Patel652203f2008-09-29 20:49:50 +00006483 case 324:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006484#line 3090 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006485 {
6486 (yyval.ConstantList) = (yyvsp[(1) - (3)].ConstantList);
6487 if ((unsigned)(yyvsp[(3) - (3)].UInt64Val) != (yyvsp[(3) - (3)].UInt64Val))
6488 GEN_ERROR("Index " + utostr((yyvsp[(3) - (3)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6489 (yyval.ConstantList)->push_back((yyvsp[(3) - (3)].UInt64Val));
6490 CHECK_FOR_ERROR
6491 ;}
6492 break;
6493
Devang Patel652203f2008-09-29 20:49:50 +00006494 case 325:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006495#line 3099 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006496 {
6497 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00006498 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006499 ;}
6500 break;
6501
Devang Patel652203f2008-09-29 20:49:50 +00006502 case 326:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006503#line 3103 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006504 {
6505 (yyval.BoolVal) = false;
Andrew Lenharth6353e052006-12-08 18:07:09 +00006506 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006507 ;}
6508 break;
6509
Devang Patel652203f2008-09-29 20:49:50 +00006510 case 327:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006511#line 3108 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006512 {
Reid Spencer14310612006-12-31 05:40:51 +00006513 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006514 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
Eric Christopher2a5196f2008-09-24 04:55:49 +00006515 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
Dan Gohmanf4423b12008-04-19 00:24:39 +00006516 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006517 GEN_ERROR(
6518 "Arithmetic operator requires integer, FP, or packed operands");
Eric Christopher2a5196f2008-09-24 04:55:49 +00006519 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006520 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006521 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006522 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006523 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006524 if ((yyval.InstVal) == 0)
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006525 GEN_ERROR("binary operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006526 delete (yyvsp[(2) - (5)].TypeVal);
6527 ;}
6528 break;
6529
Devang Patel652203f2008-09-29 20:49:50 +00006530 case 328:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006531#line 3124 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006532 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006533 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006534 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6535 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006536 if (!isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
Dan Gohmanf4423b12008-04-19 00:24:39 +00006537 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006538 GEN_ERROR("Logical operator requires integral operands");
6539 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006540 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006541 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006542 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006543 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006544 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006545 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006546 GEN_ERROR("binary operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006547 delete (yyvsp[(2) - (5)].TypeVal);
6548 ;}
6549 break;
6550
Devang Patel652203f2008-09-29 20:49:50 +00006551 case 329:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006552#line 3141 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006553 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006554 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006555 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
Dan Gohmanf4423b12008-04-19 00:24:39 +00006556 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006557 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006558 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006559 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006560 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006561 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006562 GEN_ERROR("icmp operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006563 delete (yyvsp[(3) - (6)].TypeVal);
6564 ;}
6565 break;
6566
Devang Patel652203f2008-09-29 20:49:50 +00006567 case 330:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006568#line 3153 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006569 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006570 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006571 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
Dan Gohmanf4423b12008-04-19 00:24:39 +00006572 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006573 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006574 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006575 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006576 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006577 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006578 GEN_ERROR("fcmp operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006579 delete (yyvsp[(3) - (6)].TypeVal);
6580 ;}
6581 break;
6582
Devang Patel652203f2008-09-29 20:49:50 +00006583 case 331:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006584#line 3165 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00006585 {
6586 if (!UpRefs.empty())
6587 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6588 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6589 GEN_ERROR("Scalar types not supported by vicmp instruction");
6590 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6591 CHECK_FOR_ERROR
6592 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6593 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006594 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Nate Begemanac80ade2008-05-12 19:01:56 +00006595 if ((yyval.InstVal) == 0)
Dan Gohmand8ee59b2008-09-09 01:13:24 +00006596 GEN_ERROR("vicmp operator returned null");
Nate Begemanac80ade2008-05-12 19:01:56 +00006597 delete (yyvsp[(3) - (6)].TypeVal);
6598 ;}
6599 break;
6600
Devang Patel652203f2008-09-29 20:49:50 +00006601 case 332:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006602#line 3179 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00006603 {
6604 if (!UpRefs.empty())
6605 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6606 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6607 GEN_ERROR("Scalar types not supported by vfcmp instruction");
6608 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6609 CHECK_FOR_ERROR
6610 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6611 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006612 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Nate Begemanac80ade2008-05-12 19:01:56 +00006613 if ((yyval.InstVal) == 0)
Dan Gohmand8ee59b2008-09-09 01:13:24 +00006614 GEN_ERROR("vfcmp operator returned null");
Nate Begemanac80ade2008-05-12 19:01:56 +00006615 delete (yyvsp[(3) - (6)].TypeVal);
6616 ;}
6617 break;
6618
Devang Patel652203f2008-09-29 20:49:50 +00006619 case 333:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006620#line 3193 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006621 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006622 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006623 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6624 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6625 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6626 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006627 GEN_ERROR("invalid cast opcode for cast from '" +
6628 Val->getType()->getDescription() + "' to '" +
Eric Christopher2a5196f2008-09-24 04:55:49 +00006629 DestTy->getDescription() + "'");
Dan Gohmane4977cf2008-05-23 01:55:30 +00006630 (yyval.InstVal) = CastInst::Create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006631 delete (yyvsp[(4) - (4)].TypeVal);
6632 ;}
6633 break;
6634
Devang Patel652203f2008-09-29 20:49:50 +00006635 case 334:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006636#line 3205 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006637 {
Dan Gohmand8ee59b2008-09-09 01:13:24 +00006638 if (isa<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType())) {
6639 // vector select
6640 if (!isa<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType())
6641 || !isa<VectorType>((yyvsp[(6) - (6)].ValueVal)->getType()) )
6642 GEN_ERROR("vector select value types must be vector types");
6643 const VectorType* cond_type = cast<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType());
6644 const VectorType* select_type = cast<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType());
6645 if (cond_type->getElementType() != Type::Int1Ty)
6646 GEN_ERROR("vector select condition element type must be boolean");
6647 if (cond_type->getNumElements() != select_type->getNumElements())
6648 GEN_ERROR("vector select number of elements must be the same");
6649 } else {
6650 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
6651 GEN_ERROR("select condition must be boolean");
6652 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006653 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
Dan Gohmand8ee59b2008-09-09 01:13:24 +00006654 GEN_ERROR("select value types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006655 (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006656 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006657 ;}
6658 break;
6659
Devang Patel652203f2008-09-29 20:49:50 +00006660 case 335:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006661#line 3226 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006662 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006663 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006664 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6665 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6666 delete (yyvsp[(4) - (4)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006667 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006668 ;}
6669 break;
6670
Devang Patel652203f2008-09-29 20:49:50 +00006671 case 336:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006672#line 3233 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006673 {
6674 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006675 GEN_ERROR("Invalid extractelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006676 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006677 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006678 ;}
6679 break;
6680
Devang Patel652203f2008-09-29 20:49:50 +00006681 case 337:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006682#line 3239 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006683 {
6684 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006685 GEN_ERROR("Invalid insertelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006686 (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006687 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006688 ;}
6689 break;
6690
Devang Patel652203f2008-09-29 20:49:50 +00006691 case 338:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006692#line 3245 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006693 {
6694 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006695 GEN_ERROR("Invalid shufflevector operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006696 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006697 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006698 ;}
6699 break;
6700
Devang Patel652203f2008-09-29 20:49:50 +00006701 case 339:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006702#line 3251 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006703 {
6704 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006705 if (!Ty->isFirstClassType())
6706 GEN_ERROR("PHI node operands must be of first class type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006707 (yyval.InstVal) = PHINode::Create(Ty);
6708 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6709 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
Eric Christopher2a5196f2008-09-24 04:55:49 +00006710 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006711 GEN_ERROR("All elements of a PHI node must be of the same type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006712 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6713 (yyvsp[(2) - (2)].PHIList)->pop_front();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006714 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006715 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006716 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006717 ;}
6718 break;
6719
Devang Patel652203f2008-09-29 20:49:50 +00006720 case 340:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006721#line 3267 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006722 {
Reid Spencer14310612006-12-31 05:40:51 +00006723
6724 // Handle the short syntax
Andrew Lenharth6353e052006-12-08 18:07:09 +00006725 const PointerType *PFTy = 0;
6726 const FunctionType *Ty = 0;
Devang Patel652203f2008-09-29 20:49:50 +00006727 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(4) - (9)].TypeVal)->get())) ||
Andrew Lenharth6353e052006-12-08 18:07:09 +00006728 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6729 // Pull out the types of all of the arguments...
6730 std::vector<const Type*> ParamTypes;
Devang Patel652203f2008-09-29 20:49:50 +00006731 ParamList::iterator I = (yyvsp[(7) - (9)].ParamList)->begin(), E = (yyvsp[(7) - (9)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006732 for (; I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00006733 const Type *Ty = I->Val->getType();
6734 if (Ty == Type::VoidTy)
6735 GEN_ERROR("Short call syntax cannot be used with varargs");
6736 ParamTypes.push_back(Ty);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006737 }
Chris Lattnera925a142008-04-23 05:37:08 +00006738
Devang Patel652203f2008-09-29 20:49:50 +00006739 if (!FunctionType::isValidReturnType(*(yyvsp[(4) - (9)].TypeVal)))
Chris Lattnera925a142008-04-23 05:37:08 +00006740 GEN_ERROR("Invalid result type for LLVM function");
6741
Devang Patel652203f2008-09-29 20:49:50 +00006742 Ty = FunctionType::get((yyvsp[(4) - (9)].TypeVal)->get(), ParamTypes, false);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00006743 PFTy = PointerType::getUnqual(Ty);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006744 }
Chris Lattner6cdc6822007-04-26 05:31:05 +00006745
Devang Patel652203f2008-09-29 20:49:50 +00006746 Value *V = getVal(PFTy, (yyvsp[(5) - (9)].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00006747 CHECK_FOR_ERROR
Chris Lattner6cdc6822007-04-26 05:31:05 +00006748
Reid Spencer7780acb2007-04-16 06:56:07 +00006749 // Check for call to invalid intrinsic to avoid crashing later.
6750 if (Function *theF = dyn_cast<Function>(V)) {
Reid Spencered48de22007-04-16 22:02:23 +00006751 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
Reid Spencer36fdde12007-04-16 20:35:38 +00006752 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6753 !theF->getIntrinsicID(true))
Reid Spencer7780acb2007-04-16 06:56:07 +00006754 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6755 theF->getName() + "'");
6756 }
6757
Devang Patel05988662008-09-25 21:00:45 +00006758 // Set up the Attributes for the function
6759 SmallVector<AttributeWithIndex, 8> Attrs;
Dale Johannesene7261862008-09-26 23:46:20 +00006760 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
6761 //attributes.
Devang Patel652203f2008-09-29 20:49:50 +00006762 Attributes RetAttrs = (yyvsp[(3) - (9)].Attributes);
6763 if ((yyvsp[(9) - (9)].Attributes) != Attribute::None) {
6764 if ((yyvsp[(9) - (9)].Attributes) & Attribute::ZExt) {
Dale Johannesene7261862008-09-26 23:46:20 +00006765 RetAttrs = RetAttrs | Attribute::ZExt;
Devang Patel652203f2008-09-29 20:49:50 +00006766 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::ZExt;
Dale Johannesene7261862008-09-26 23:46:20 +00006767 }
Devang Patel652203f2008-09-29 20:49:50 +00006768 if ((yyvsp[(9) - (9)].Attributes) & Attribute::SExt) {
Dale Johannesene7261862008-09-26 23:46:20 +00006769 RetAttrs = RetAttrs | Attribute::SExt;
Devang Patel652203f2008-09-29 20:49:50 +00006770 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::SExt;
Dale Johannesene7261862008-09-26 23:46:20 +00006771 }
Devang Patel652203f2008-09-29 20:49:50 +00006772 if ((yyvsp[(9) - (9)].Attributes) & Attribute::InReg) {
Dale Johannesene7261862008-09-26 23:46:20 +00006773 RetAttrs = RetAttrs | Attribute::InReg;
Devang Patel652203f2008-09-29 20:49:50 +00006774 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::InReg;
Dale Johannesene7261862008-09-26 23:46:20 +00006775 }
Dale Johannesene7261862008-09-26 23:46:20 +00006776 }
Devang Patel652203f2008-09-29 20:49:50 +00006777 if (RetAttrs != Attribute::None)
6778 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
Dale Johannesene7261862008-09-26 23:46:20 +00006779
Eric Christopher2a5196f2008-09-24 04:55:49 +00006780 // Check the arguments
Reid Spencer14310612006-12-31 05:40:51 +00006781 ValueList Args;
Devang Patel652203f2008-09-29 20:49:50 +00006782 if ((yyvsp[(7) - (9)].ParamList)->empty()) { // Has no arguments?
Andrew Lenharth6353e052006-12-08 18:07:09 +00006783 // Make sure no arguments is a good thing!
6784 if (Ty->getNumParams() != 0)
6785 GEN_ERROR("No arguments passed to a function that "
Reid Spencerb5334b02007-02-05 10:18:06 +00006786 "expects arguments");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006787 } else { // Has arguments?
6788 // Loop through FunctionType's arguments and ensure they are specified
Duncan Sandsdc024672007-11-27 13:23:08 +00006789 // correctly. Also, gather any parameter attributes.
Andrew Lenharth6353e052006-12-08 18:07:09 +00006790 FunctionType::param_iterator I = Ty->param_begin();
6791 FunctionType::param_iterator E = Ty->param_end();
Devang Patel652203f2008-09-29 20:49:50 +00006792 ParamList::iterator ArgI = (yyvsp[(7) - (9)].ParamList)->begin(), ArgE = (yyvsp[(7) - (9)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006793 unsigned index = 1;
Andrew Lenharth6353e052006-12-08 18:07:09 +00006794
Duncan Sandsdc024672007-11-27 13:23:08 +00006795 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006796 if (ArgI->Val->getType() != *I)
6797 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00006798 (*I)->getDescription() + "'");
Reid Spencer14310612006-12-31 05:40:51 +00006799 Args.push_back(ArgI->Val);
Devang Patel05988662008-09-25 21:00:45 +00006800 if (ArgI->Attrs != Attribute::None)
6801 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00006802 }
6803 if (Ty->isVarArg()) {
6804 if (I == E)
Chris Lattner38905612008-02-19 04:36:25 +00006805 for (; ArgI != ArgE; ++ArgI, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006806 Args.push_back(ArgI->Val); // push the remaining varargs
Devang Patel05988662008-09-25 21:00:45 +00006807 if (ArgI->Attrs != Attribute::None)
6808 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Chris Lattner38905612008-02-19 04:36:25 +00006809 }
Reid Spencer14310612006-12-31 05:40:51 +00006810 } else if (I != E || ArgI != ArgE)
Reid Spencerb5334b02007-02-05 10:18:06 +00006811 GEN_ERROR("Invalid number of parameters detected");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006812 }
Devang Patel652203f2008-09-29 20:49:50 +00006813 if ((yyvsp[(9) - (9)].Attributes) != Attribute::None)
6814 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(9) - (9)].Attributes)));
Duncan Sandsdc024672007-11-27 13:23:08 +00006815
Devang Patel05988662008-09-25 21:00:45 +00006816 // Finish off the Attributes and check them
6817 AttrListPtr PAL;
Duncan Sandsdc024672007-11-27 13:23:08 +00006818 if (!Attrs.empty())
Devang Patel05988662008-09-25 21:00:45 +00006819 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsdc024672007-11-27 13:23:08 +00006820
Reid Spencer14310612006-12-31 05:40:51 +00006821 // Create the call node
Gabor Greife64d2482008-04-06 23:07:54 +00006822 CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
Devang Patel652203f2008-09-29 20:49:50 +00006823 CI->setTailCall((yyvsp[(1) - (9)].BoolVal));
6824 CI->setCallingConv((yyvsp[(2) - (9)].UIntVal));
Devang Patel05988662008-09-25 21:00:45 +00006825 CI->setAttributes(PAL);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006826 (yyval.InstVal) = CI;
Devang Patel652203f2008-09-29 20:49:50 +00006827 delete (yyvsp[(7) - (9)].ParamList);
6828 delete (yyvsp[(4) - (9)].TypeVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00006829 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006830 ;}
6831 break;
6832
Devang Patel652203f2008-09-29 20:49:50 +00006833 case 341:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006834#line 3376 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006835 {
6836 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00006837 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006838 ;}
6839 break;
6840
Devang Patel652203f2008-09-29 20:49:50 +00006841 case 342:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006842#line 3381 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006843 {
6844 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00006845 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006846 ;}
6847 break;
6848
Devang Patel652203f2008-09-29 20:49:50 +00006849 case 343:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006850#line 3385 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006851 {
6852 (yyval.BoolVal) = false;
Reid Spencer61c83e02006-08-18 08:43:06 +00006853 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006854 ;}
6855 break;
6856
Devang Patel652203f2008-09-29 20:49:50 +00006857 case 344:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006858#line 3392 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006859 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006860 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006861 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6862 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6863 delete (yyvsp[(2) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006864 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006865 ;}
6866 break;
6867
Devang Patel652203f2008-09-29 20:49:50 +00006868 case 345:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006869#line 3399 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006870 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006871 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006872 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006873 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6874 GEN_ERROR("Malloc array size is not a 32-bit integer!");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006875 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00006876 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006877 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6878 delete (yyvsp[(2) - (6)].TypeVal);
6879 ;}
6880 break;
6881
Devang Patel652203f2008-09-29 20:49:50 +00006882 case 346:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006883#line 3409 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006884 {
Reid Spencer14310612006-12-31 05:40:51 +00006885 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006886 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6887 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6888 delete (yyvsp[(2) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006889 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006890 ;}
6891 break;
6892
Devang Patel652203f2008-09-29 20:49:50 +00006893 case 347:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006894#line 3416 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006895 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006896 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006897 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006898 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6899 GEN_ERROR("Alloca array size is not a 32-bit integer!");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006900 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006901 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006902 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6903 delete (yyvsp[(2) - (6)].TypeVal);
6904 ;}
6905 break;
6906
Devang Patel652203f2008-09-29 20:49:50 +00006907 case 348:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006908#line 3426 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006909 {
6910 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
Eric Christopher2a5196f2008-09-24 04:55:49 +00006911 GEN_ERROR("Trying to free nonpointer type " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006912 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6913 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006914 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006915 ;}
6916 break;
6917
Devang Patel652203f2008-09-29 20:49:50 +00006918 case 349:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006919#line 3434 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006920 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006921 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006922 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6923 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006924 GEN_ERROR("Can't load from nonpointer type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006925 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6926 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006927 GEN_ERROR("Can't load from pointer of non-first-class type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006928 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6929 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006930 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006931 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6932 delete (yyvsp[(3) - (5)].TypeVal);
6933 ;}
6934 break;
6935
Devang Patel652203f2008-09-29 20:49:50 +00006936 case 350:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006937#line 3448 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006938 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006939 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006940 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6941 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006942 if (!PT)
6943 GEN_ERROR("Can't store to a nonpointer type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006944 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006945 const Type *ElTy = PT->getElementType();
Dan Gohmanf4423b12008-04-19 00:24:39 +00006946 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6947 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006948 "' into space of type '" + ElTy->getDescription() + "'");
6949
Dan Gohmanf4423b12008-04-19 00:24:39 +00006950 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006951 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006952 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6953 delete (yyvsp[(5) - (7)].TypeVal);
6954 ;}
6955 break;
6956
Devang Patel652203f2008-09-29 20:49:50 +00006957 case 351:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006958#line 3465 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006959 {
Dan Gohman1a570242008-07-23 00:54:54 +00006960 if (!UpRefs.empty())
6961 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6962 if (!isa<StructType>((yyvsp[(2) - (5)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (5)].TypeVal)->get()))
6963 GEN_ERROR("getresult insn requires an aggregate operand");
6964 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].UInt64Val)))
6965 GEN_ERROR("Invalid getresult index for type '" +
6966 (*(yyvsp[(2) - (5)].TypeVal))->getDescription()+ "'");
6967
6968 Value *tmpVal = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Devang Patel5a970972008-02-19 22:27:01 +00006969 CHECK_FOR_ERROR
Dan Gohman1a570242008-07-23 00:54:54 +00006970 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(5) - (5)].UInt64Val));
6971 delete (yyvsp[(2) - (5)].TypeVal);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006972 ;}
6973 break;
6974
Devang Patel652203f2008-09-29 20:49:50 +00006975 case 352:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006976#line 3479 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006977 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006978 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006979 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6980 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
Reid Spencerb5334b02007-02-05 10:18:06 +00006981 GEN_ERROR("getelementptr insn requires pointer operand");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006982
Dan Gohman041e2eb2008-05-15 19:50:34 +00006983 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()))
Reid Spencer61c83e02006-08-18 08:43:06 +00006984 GEN_ERROR("Invalid getelementptr indices for type '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006985 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6986 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00006987 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006988 (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
Eric Christopher2a5196f2008-09-24 04:55:49 +00006989 delete (yyvsp[(2) - (4)].TypeVal);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006990 delete (yyvsp[(4) - (4)].ValueList);
6991 ;}
6992 break;
Reid Spencer7780acb2007-04-16 06:56:07 +00006993
Devang Patel652203f2008-09-29 20:49:50 +00006994 case 353:
Dale Johannesen236bbd42008-10-09 23:01:34 +00006995#line 3494 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00006996 {
6997 if (!UpRefs.empty())
6998 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6999 if (!isa<StructType>((yyvsp[(2) - (4)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (4)].TypeVal)->get()))
7000 GEN_ERROR("extractvalue insn requires an aggregate operand");
7001
Dan Gohman81a0c0b2008-05-31 00:58:22 +00007002 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end()))
Dan Gohmane4977cf2008-05-23 01:55:30 +00007003 GEN_ERROR("Invalid extractvalue indices for type '" +
7004 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
7005 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
7006 CHECK_FOR_ERROR
Dan Gohman81a0c0b2008-05-31 00:58:22 +00007007 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end());
Eric Christopher2a5196f2008-09-24 04:55:49 +00007008 delete (yyvsp[(2) - (4)].TypeVal);
Dan Gohman81a0c0b2008-05-31 00:58:22 +00007009 delete (yyvsp[(4) - (4)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00007010 ;}
7011 break;
7012
Devang Patel652203f2008-09-29 20:49:50 +00007013 case 354:
Dale Johannesen236bbd42008-10-09 23:01:34 +00007014#line 3509 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00007015 {
7016 if (!UpRefs.empty())
7017 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription());
7018 if (!isa<StructType>((yyvsp[(2) - (7)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (7)].TypeVal)->get()))
7019 GEN_ERROR("extractvalue insn requires an aggregate operand");
7020
Dan Gohman81a0c0b2008-05-31 00:58:22 +00007021 if (ExtractValueInst::getIndexedType(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end()) != (yyvsp[(5) - (7)].TypeVal)->get())
Dan Gohmane4977cf2008-05-23 01:55:30 +00007022 GEN_ERROR("Invalid insertvalue indices for type '" +
7023 (*(yyvsp[(2) - (7)].TypeVal))->getDescription()+ "'");
7024 Value* aggVal = getVal(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(3) - (7)].ValIDVal));
7025 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
7026 CHECK_FOR_ERROR
Dan Gohman81a0c0b2008-05-31 00:58:22 +00007027 (yyval.InstVal) = InsertValueInst::Create(aggVal, tmpVal, (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end());
Eric Christopher2a5196f2008-09-24 04:55:49 +00007028 delete (yyvsp[(2) - (7)].TypeVal);
Dan Gohmane4977cf2008-05-23 01:55:30 +00007029 delete (yyvsp[(5) - (7)].TypeVal);
Dan Gohman81a0c0b2008-05-31 00:58:22 +00007030 delete (yyvsp[(7) - (7)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00007031 ;}
7032 break;
7033
Dan Gohmanf4423b12008-04-19 00:24:39 +00007034
7035/* Line 1267 of yacc.c. */
Dale Johannesen236bbd42008-10-09 23:01:34 +00007036#line 7037 "llvmAsmParser.tab.c"
Dan Gohmanf4423b12008-04-19 00:24:39 +00007037 default: break;
Dale Johannesencdd509a2007-09-07 21:07:57 +00007038 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00007039 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
7040
7041 YYPOPSTACK (yylen);
7042 yylen = 0;
7043 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00007044
7045 *++yyvsp = yyval;
7046
7047
Dan Gohmanf4423b12008-04-19 00:24:39 +00007048 /* Now `shift' the result of the reduction. Determine what state
7049 that goes to, based on the state we popped back to and the rule
7050 number reduced by. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00007051
7052 yyn = yyr1[yyn];
7053
Dan Gohmanf4423b12008-04-19 00:24:39 +00007054 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
7055 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00007056 yystate = yytable[yystate];
7057 else
Dan Gohmanf4423b12008-04-19 00:24:39 +00007058 yystate = yydefgoto[yyn - YYNTOKENS];
Reid Spencer68a24bd2005-08-27 18:50:39 +00007059
7060 goto yynewstate;
7061
7062
Dan Gohmanf4423b12008-04-19 00:24:39 +00007063/*------------------------------------.
7064| yyerrlab -- here on detecting error |
7065`------------------------------------*/
7066yyerrlab:
7067 /* If not already recovering from an error, report this error. */
7068 if (!yyerrstatus)
Reid Spencer68a24bd2005-08-27 18:50:39 +00007069 {
7070 ++yynerrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00007071#if ! YYERROR_VERBOSE
7072 yyerror (YY_("syntax error"));
7073#else
7074 {
7075 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
7076 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
7077 {
7078 YYSIZE_T yyalloc = 2 * yysize;
7079 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
7080 yyalloc = YYSTACK_ALLOC_MAXIMUM;
7081 if (yymsg != yymsgbuf)
7082 YYSTACK_FREE (yymsg);
7083 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
7084 if (yymsg)
7085 yymsg_alloc = yyalloc;
7086 else
7087 {
7088 yymsg = yymsgbuf;
7089 yymsg_alloc = sizeof yymsgbuf;
7090 }
7091 }
Dale Johannesencdd509a2007-09-07 21:07:57 +00007092
Dan Gohmanf4423b12008-04-19 00:24:39 +00007093 if (0 < yysize && yysize <= yymsg_alloc)
7094 {
7095 (void) yysyntax_error (yymsg, yystate, yychar);
7096 yyerror (yymsg);
7097 }
7098 else
7099 {
7100 yyerror (YY_("syntax error"));
7101 if (yysize != 0)
7102 goto yyexhaustedlab;
7103 }
7104 }
7105#endif
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00007106 }
7107
Dan Gohmanf4423b12008-04-19 00:24:39 +00007108
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00007109
7110 if (yyerrstatus == 3)
7111 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00007112 /* If just tried and failed to reuse look-ahead token after an
7113 error, discard it. */
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00007114
Dan Gohmanf4423b12008-04-19 00:24:39 +00007115 if (yychar <= YYEOF)
7116 {
7117 /* Return failure if at end of input. */
7118 if (yychar == YYEOF)
7119 YYABORT;
7120 }
7121 else
7122 {
7123 yydestruct ("Error: discarding",
7124 yytoken, &yylval);
7125 yychar = YYEMPTY;
7126 }
7127 }
7128
7129 /* Else will try to reuse look-ahead token after shifting the error
7130 token. */
7131 goto yyerrlab1;
7132
7133
7134/*---------------------------------------------------.
7135| yyerrorlab -- error raised explicitly by YYERROR. |
7136`---------------------------------------------------*/
7137yyerrorlab:
7138
7139 /* Pacify compilers like GCC when the user code never invokes
7140 YYERROR and the label yyerrorlab therefore never appears in user
7141 code. */
7142 if (/*CONSTCOND*/ 0)
7143 goto yyerrorlab;
7144
7145 /* Do not reclaim the symbols of the rule which action triggered
7146 this YYERROR. */
7147 YYPOPSTACK (yylen);
7148 yylen = 0;
7149 YY_STACK_PRINT (yyss, yyssp);
7150 yystate = *yyssp;
7151 goto yyerrlab1;
7152
7153
7154/*-------------------------------------------------------------.
7155| yyerrlab1 -- common code for both syntax error and YYERROR. |
7156`-------------------------------------------------------------*/
7157yyerrlab1:
7158 yyerrstatus = 3; /* Each real token shifted decrements this. */
7159
7160 for (;;)
7161 {
7162 yyn = yypact[yystate];
7163 if (yyn != YYPACT_NINF)
7164 {
7165 yyn += YYTERROR;
7166 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
7167 {
7168 yyn = yytable[yyn];
7169 if (0 < yyn)
7170 break;
7171 }
7172 }
7173
7174 /* Pop the current state because it cannot handle the error token. */
7175 if (yyssp == yyss)
Reid Spencer68a24bd2005-08-27 18:50:39 +00007176 YYABORT;
7177
Dale Johannesencdd509a2007-09-07 21:07:57 +00007178
Dan Gohmanf4423b12008-04-19 00:24:39 +00007179 yydestruct ("Error: popping",
7180 yystos[yystate], yyvsp);
7181 YYPOPSTACK (1);
7182 yystate = *yyssp;
7183 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00007184 }
7185
7186 if (yyn == YYFINAL)
7187 YYACCEPT;
7188
Reid Spencer68a24bd2005-08-27 18:50:39 +00007189 *++yyvsp = yylval;
Dan Gohmanf4423b12008-04-19 00:24:39 +00007190
7191
7192 /* Shift the error token. */
7193 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spencerb8f85052007-07-31 03:50:36 +00007194
Reid Spencer68a24bd2005-08-27 18:50:39 +00007195 yystate = yyn;
7196 goto yynewstate;
7197
Gabor Greife64d2482008-04-06 23:07:54 +00007198
Dan Gohmanf4423b12008-04-19 00:24:39 +00007199/*-------------------------------------.
7200| yyacceptlab -- YYACCEPT comes here. |
7201`-------------------------------------*/
7202yyacceptlab:
7203 yyresult = 0;
7204 goto yyreturn;
7205
7206/*-----------------------------------.
7207| yyabortlab -- YYABORT comes here. |
7208`-----------------------------------*/
7209yyabortlab:
7210 yyresult = 1;
7211 goto yyreturn;
7212
7213#ifndef yyoverflow
7214/*-------------------------------------------------.
7215| yyexhaustedlab -- memory exhaustion comes here. |
7216`-------------------------------------------------*/
7217yyexhaustedlab:
7218 yyerror (YY_("memory exhausted"));
7219 yyresult = 2;
7220 /* Fall through. */
Chris Lattner38905612008-02-19 04:36:25 +00007221#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00007222
7223yyreturn:
7224 if (yychar != YYEOF && yychar != YYEMPTY)
7225 yydestruct ("Cleanup: discarding lookahead",
7226 yytoken, &yylval);
7227 /* Do not reclaim the symbols of the rule which action triggered
7228 this YYABORT or YYACCEPT. */
7229 YYPOPSTACK (yylen);
7230 YY_STACK_PRINT (yyss, yyssp);
7231 while (yyssp != yyss)
7232 {
7233 yydestruct ("Cleanup: popping",
7234 yystos[*yyssp], yyvsp);
7235 YYPOPSTACK (1);
Gabor Greife64d2482008-04-06 23:07:54 +00007236 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00007237#ifndef yyoverflow
7238 if (yyss != yyssa)
7239 YYSTACK_FREE (yyss);
7240#endif
7241#if YYERROR_VERBOSE
7242 if (yymsg != yymsgbuf)
7243 YYSTACK_FREE (yymsg);
7244#endif
7245 /* Make sure YYID is used. */
7246 return YYID (yyresult);
Reid Spencer68a24bd2005-08-27 18:50:39 +00007247}
Dan Gohmanf4423b12008-04-19 00:24:39 +00007248
7249
Dale Johannesen236bbd42008-10-09 23:01:34 +00007250#line 3528 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Reid Spencer61c83e02006-08-18 08:43:06 +00007251
7252
Reid Spencer14310612006-12-31 05:40:51 +00007253// common code from the two 'RunVMAsmParser' functions
7254static Module* RunParser(Module * M) {
Reid Spencer14310612006-12-31 05:40:51 +00007255 CurModule.CurrentModule = M;
Reid Spencer14310612006-12-31 05:40:51 +00007256 // Check to make sure the parser succeeded
7257 if (yyparse()) {
7258 if (ParserResult)
7259 delete ParserResult;
7260 return 0;
7261 }
7262
Reid Spencer0d60b5a2007-03-30 01:37:39 +00007263 // Emit an error if there are any unresolved types left.
7264 if (!CurModule.LateResolveTypes.empty()) {
7265 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
7266 if (DID.Type == ValID::LocalName) {
7267 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
7268 } else {
7269 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
7270 }
7271 if (ParserResult)
7272 delete ParserResult;
7273 return 0;
7274 }
7275
7276 // Emit an error if there are any unresolved values left.
7277 if (!CurModule.LateResolveValues.empty()) {
7278 Value *V = CurModule.LateResolveValues.back();
7279 std::map<Value*, std::pair<ValID, int> >::iterator I =
7280 CurModule.PlaceHolderInfo.find(V);
7281
7282 if (I != CurModule.PlaceHolderInfo.end()) {
7283 ValID &DID = I->second.first;
7284 if (DID.Type == ValID::LocalName) {
7285 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
7286 } else {
7287 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
7288 }
7289 if (ParserResult)
7290 delete ParserResult;
7291 return 0;
7292 }
7293 }
7294
Reid Spencer14310612006-12-31 05:40:51 +00007295 // Check to make sure that parsing produced a result
7296 if (!ParserResult)
7297 return 0;
7298
7299 // Reset ParserResult variable while saving its value for the result.
7300 Module *Result = ParserResult;
7301 ParserResult = 0;
7302
7303 return Result;
7304}
7305
Reid Spencer61c83e02006-08-18 08:43:06 +00007306void llvm::GenerateError(const std::string &message, int LineNo) {
Duncan Sandsdc024672007-11-27 13:23:08 +00007307 if (LineNo == -1) LineNo = LLLgetLineNo();
Reid Spencer61c83e02006-08-18 08:43:06 +00007308 // TODO: column number in exception
7309 if (TheParseError)
Duncan Sandsdc024672007-11-27 13:23:08 +00007310 TheParseError->setError(LLLgetFilename(), message, LineNo);
Reid Spencer61c83e02006-08-18 08:43:06 +00007311 TriggerError = 1;
7312}
Reid Spencer68a24bd2005-08-27 18:50:39 +00007313
7314int yyerror(const char *ErrorMsg) {
Duncan Sandsdc024672007-11-27 13:23:08 +00007315 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
Reid Spenceref9b9a72007-02-05 20:47:22 +00007316 std::string errMsg = where + "error: " + std::string(ErrorMsg);
Duncan Sandsdc024672007-11-27 13:23:08 +00007317 if (yychar != YYEMPTY && yychar != 0) {
7318 errMsg += " while reading token: '";
Eric Christopher2a5196f2008-09-24 04:55:49 +00007319 errMsg += std::string(LLLgetTokenStart(),
Duncan Sandsdc024672007-11-27 13:23:08 +00007320 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
7321 }
Reid Spencer61c83e02006-08-18 08:43:06 +00007322 GenerateError(errMsg);
Reid Spencer68a24bd2005-08-27 18:50:39 +00007323 return 0;
7324}
Dan Gohmanf4423b12008-04-19 00:24:39 +00007325