blob: 07a73bcf2740572c697ba758c5e01542113fc68a [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,
Nick Lewyckyd802be32008-12-19 09:41:54 +0000222 NOCAPTURE = 403,
223 BYVAL = 404,
Dale Johannesendfe8c842008-09-26 19:32:34 +0000224 READNONE = 405,
225 READONLY = 406,
226 GC = 407,
Devang Patel652203f2008-09-29 20:49:50 +0000227 OPTSIZE = 408,
228 NOINLINE = 409,
229 ALWAYSINLINE = 410,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +0000230 SSP = 411,
231 SSPREQ = 412,
Nick Lewyckyd802be32008-12-19 09:41:54 +0000232 NEST = 413,
233 DEFAULT = 414,
234 HIDDEN = 415,
235 PROTECTED = 416
Dan Gohmanf4423b12008-04-19 00:24:39 +0000236 };
237#endif
238/* Tokens. */
239#define ESINT64VAL 258
240#define EUINT64VAL 259
241#define ESAPINTVAL 260
242#define EUAPINTVAL 261
243#define LOCALVAL_ID 262
244#define GLOBALVAL_ID 263
245#define FPVAL 264
246#define VOID 265
247#define INTTYPE 266
248#define FLOAT 267
249#define DOUBLE 268
250#define X86_FP80 269
251#define FP128 270
252#define PPC_FP128 271
253#define LABEL 272
254#define TYPE 273
255#define LOCALVAR 274
256#define GLOBALVAR 275
257#define LABELSTR 276
258#define STRINGCONSTANT 277
259#define ATSTRINGCONSTANT 278
260#define PCTSTRINGCONSTANT 279
261#define ZEROINITIALIZER 280
262#define TRUETOK 281
263#define FALSETOK 282
264#define BEGINTOK 283
265#define ENDTOK 284
266#define DECLARE 285
267#define DEFINE 286
268#define GLOBAL 287
269#define CONSTANT 288
270#define SECTION 289
271#define ALIAS 290
272#define VOLATILE 291
273#define THREAD_LOCAL 292
274#define TO 293
275#define DOTDOTDOT 294
276#define NULL_TOK 295
277#define UNDEF 296
278#define INTERNAL 297
279#define LINKONCE 298
280#define WEAK 299
281#define APPENDING 300
282#define DLLIMPORT 301
283#define DLLEXPORT 302
284#define EXTERN_WEAK 303
Dale Johannesenc7071cc2008-05-14 20:13:36 +0000285#define COMMON 304
286#define OPAQUE 305
287#define EXTERNAL 306
288#define TARGET 307
289#define TRIPLE 308
290#define ALIGN 309
291#define ADDRSPACE 310
292#define DEPLIBS 311
293#define CALL 312
294#define TAIL 313
295#define ASM_TOK 314
296#define MODULE 315
297#define SIDEEFFECT 316
298#define CC_TOK 317
299#define CCC_TOK 318
300#define FASTCC_TOK 319
301#define COLDCC_TOK 320
302#define X86_STDCALLCC_TOK 321
303#define X86_FASTCALLCC_TOK 322
Dale Johannesendfe8c842008-09-26 19:32:34 +0000304#define DATALAYOUT 323
305#define RET 324
306#define BR 325
307#define SWITCH 326
308#define INVOKE 327
309#define UNWIND 328
310#define UNREACHABLE 329
311#define ADD 330
312#define SUB 331
313#define MUL 332
314#define UDIV 333
315#define SDIV 334
316#define FDIV 335
317#define UREM 336
318#define SREM 337
319#define FREM 338
320#define AND 339
321#define OR 340
322#define XOR 341
323#define SHL 342
324#define LSHR 343
325#define ASHR 344
326#define ICMP 345
327#define FCMP 346
328#define VICMP 347
329#define VFCMP 348
330#define EQ 349
331#define NE 350
332#define SLT 351
333#define SGT 352
334#define SLE 353
335#define SGE 354
336#define ULT 355
337#define UGT 356
338#define ULE 357
339#define UGE 358
340#define OEQ 359
341#define ONE 360
342#define OLT 361
343#define OGT 362
344#define OLE 363
345#define OGE 364
346#define ORD 365
347#define UNO 366
348#define UEQ 367
349#define UNE 368
350#define MALLOC 369
351#define ALLOCA 370
352#define FREE 371
353#define LOAD 372
354#define STORE 373
355#define GETELEMENTPTR 374
356#define TRUNC 375
357#define ZEXT 376
358#define SEXT 377
359#define FPTRUNC 378
360#define FPEXT 379
361#define BITCAST 380
362#define UITOFP 381
363#define SITOFP 382
364#define FPTOUI 383
365#define FPTOSI 384
366#define INTTOPTR 385
367#define PTRTOINT 386
368#define PHI_TOK 387
369#define SELECT 388
370#define VAARG 389
371#define EXTRACTELEMENT 390
372#define INSERTELEMENT 391
373#define SHUFFLEVECTOR 392
374#define GETRESULT 393
375#define EXTRACTVALUE 394
376#define INSERTVALUE 395
377#define SIGNEXT 396
378#define ZEROEXT 397
379#define NORETURN 398
380#define INREG 399
381#define SRET 400
382#define NOUNWIND 401
383#define NOALIAS 402
Nick Lewyckyd802be32008-12-19 09:41:54 +0000384#define NOCAPTURE 403
385#define BYVAL 404
Dale Johannesendfe8c842008-09-26 19:32:34 +0000386#define READNONE 405
387#define READONLY 406
388#define GC 407
Devang Patel652203f2008-09-29 20:49:50 +0000389#define OPTSIZE 408
390#define NOINLINE 409
391#define ALWAYSINLINE 410
Bill Wendling6ff4bfe2008-11-13 01:03:00 +0000392#define SSP 411
393#define SSPREQ 412
Nick Lewyckyd802be32008-12-19 09:41:54 +0000394#define NEST 413
395#define DEFAULT 414
396#define HIDDEN 415
397#define PROTECTED 416
Dan Gohmanf4423b12008-04-19 00:24:39 +0000398
399
400
401
402/* Copy the first part of user declarations. */
Nick Lewycky02ff3082008-11-24 03:41:24 +0000403#line 14 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000404
405#include "ParserInternals.h"
406#include "llvm/CallingConv.h"
Chris Lattner0e9c3762006-01-25 22:27:16 +0000407#include "llvm/InlineAsm.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000408#include "llvm/Instructions.h"
409#include "llvm/Module.h"
Reid Spenceref9b9a72007-02-05 20:47:22 +0000410#include "llvm/ValueSymbolTable.h"
Chandler Carruth02202192007-08-04 01:56:21 +0000411#include "llvm/AutoUpgrade.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000412#include "llvm/Support/GetElementPtrTypeIterator.h"
Reid Spencer14310612006-12-31 05:40:51 +0000413#include "llvm/Support/CommandLine.h"
Chris Lattnerf7469af2007-01-31 04:44:08 +0000414#include "llvm/ADT/SmallVector.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000415#include "llvm/ADT/STLExtras.h"
Chris Lattner0019bbe2005-11-06 06:46:53 +0000416#include "llvm/Support/MathExtras.h"
Reid Spencer481169e2006-12-01 00:33:46 +0000417#include "llvm/Support/Streams.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000418#include <algorithm>
Reid Spencer68a24bd2005-08-27 18:50:39 +0000419#include <list>
Chris Lattner8adde282007-02-11 21:40:10 +0000420#include <map>
Reid Spencer68a24bd2005-08-27 18:50:39 +0000421#include <utility>
422
Reid Spencere4f47592006-08-18 17:32:55 +0000423// The following is a gross hack. In order to rid the libAsmParser library of
424// exceptions, we have to have a way of getting the yyparse function to go into
425// an error situation. So, whenever we want an error to occur, the GenerateError
Eric Christopher2a5196f2008-09-24 04:55:49 +0000426// function (see bottom of file) sets TriggerError. Then, at the end of each
427// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
428// (a goto) to put YACC in error state. Furthermore, several calls to
Reid Spencere4f47592006-08-18 17:32:55 +0000429// GenerateError are made from inside productions and they must simulate the
430// previous exception behavior by exiting the production immediately. We have
431// replaced these with the GEN_ERROR macro which calls GeneratError and then
Eric Christopher2a5196f2008-09-24 04:55:49 +0000432// immediately invokes YYERROR. This would be so much cleaner if it was a
Reid Spencere4f47592006-08-18 17:32:55 +0000433// recursive descent parser.
Reid Spencer61c83e02006-08-18 08:43:06 +0000434static bool TriggerError = false;
Reid Spencerf63697d2006-10-09 17:36:59 +0000435#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
Reid Spencer61c83e02006-08-18 08:43:06 +0000436#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
437
Reid Spencer68a24bd2005-08-27 18:50:39 +0000438int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
439int yylex(); // declaration" of xxx warnings.
440int yyparse();
Reid Spencer68a24bd2005-08-27 18:50:39 +0000441using namespace llvm;
442
443static Module *ParserResult;
444
445// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
446// relating to upreferences in the input stream.
447//
448//#define DEBUG_UPREFS 1
449#ifdef DEBUG_UPREFS
Bill Wendlinge8156192006-12-07 01:30:32 +0000450#define UR_OUT(X) cerr << X
Reid Spencer68a24bd2005-08-27 18:50:39 +0000451#else
452#define UR_OUT(X)
453#endif
454
455#define YYERROR_VERBOSE 1
456
Chris Lattnerb475c422005-11-12 18:22:38 +0000457static GlobalVariable *CurGV;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000458
459
460// This contains info used when building the body of a function. It is
461// destroyed when the function is completed.
462//
463typedef std::vector<Value *> ValueList; // Numbered defs
Reid Spencer14310612006-12-31 05:40:51 +0000464
Eric Christopher2a5196f2008-09-24 04:55:49 +0000465static void
Reid Spencer93c40032007-03-19 18:40:50 +0000466ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000467
468static struct PerModuleInfo {
469 Module *CurrentModule;
Reid Spencer93c40032007-03-19 18:40:50 +0000470 ValueList Values; // Module level numbered definitions
471 ValueList LateResolveValues;
Reid Spencer861d9d62006-11-28 07:29:44 +0000472 std::vector<PATypeHolder> Types;
473 std::map<ValID, PATypeHolder> LateResolveTypes;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000474
475 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
Chris Lattner0ad19702006-06-21 16:53:00 +0000476 /// how they were referenced and on which line of the input they came from so
Reid Spencer68a24bd2005-08-27 18:50:39 +0000477 /// that we can resolve them later and print error messages as appropriate.
478 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
479
480 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
481 // references to global values. Global values may be referenced before they
482 // are defined, and if so, the temporary object that they represent is held
483 // here. This is used for forward references of GlobalValues.
484 //
485 typedef std::map<std::pair<const PointerType *,
486 ValID>, GlobalValue*> GlobalRefsType;
487 GlobalRefsType GlobalRefs;
488
489 void ModuleDone() {
490 // If we could not resolve some functions at function compilation time
491 // (calls to functions before they are defined), resolve them now... Types
492 // are resolved when the constant pool has been completely parsed.
493 //
494 ResolveDefinitions(LateResolveValues);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000495 if (TriggerError)
496 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000497
498 // Check to make sure that all global value forward references have been
499 // resolved!
500 //
501 if (!GlobalRefs.empty()) {
502 std::string UndefinedReferences = "Unresolved global references exist:\n";
503
504 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
505 I != E; ++I) {
506 UndefinedReferences += " " + I->first.first->getDescription() + " " +
507 I->first.second.getName() + "\n";
508 }
Reid Spencer61c83e02006-08-18 08:43:06 +0000509 GenerateError(UndefinedReferences);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000510 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000511 }
512
Chandler Carruth02202192007-08-04 01:56:21 +0000513 // Look for intrinsic functions and CallInst that need to be upgraded
514 for (Module::iterator FI = CurrentModule->begin(),
515 FE = CurrentModule->end(); FI != FE; )
516 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
517
Reid Spencer68a24bd2005-08-27 18:50:39 +0000518 Values.clear(); // Clear out function local definitions
519 Types.clear();
520 CurrentModule = 0;
521 }
522
Reid Spencer68a24bd2005-08-27 18:50:39 +0000523 // GetForwardRefForGlobal - Check to see if there is a forward reference
524 // for this global. If so, remove it from the GlobalRefs map and return it.
525 // If not, just return null.
526 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
527 // Check to see if there is a forward reference to this global variable...
528 // if there is, eliminate it and patch the reference to use the new def'n.
529 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
530 GlobalValue *Ret = 0;
531 if (I != GlobalRefs.end()) {
532 Ret = I->second;
Nuno Lopes8a5f3472008-10-15 12:05:02 +0000533 I->first.second.destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +0000534 GlobalRefs.erase(I);
535 }
536 return Ret;
537 }
Reid Spencer8c8a2dc2007-01-02 21:54:12 +0000538
539 bool TypeIsUnresolved(PATypeHolder* PATy) {
540 // If it isn't abstract, its resolved
541 const Type* Ty = PATy->get();
542 if (!Ty->isAbstract())
543 return false;
544 // Traverse the type looking for abstract types. If it isn't abstract then
Eric Christopher2a5196f2008-09-24 04:55:49 +0000545 // we don't need to traverse that leg of the type.
Reid Spencer8c8a2dc2007-01-02 21:54:12 +0000546 std::vector<const Type*> WorkList, SeenList;
547 WorkList.push_back(Ty);
548 while (!WorkList.empty()) {
549 const Type* Ty = WorkList.back();
550 SeenList.push_back(Ty);
551 WorkList.pop_back();
552 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
553 // Check to see if this is an unresolved type
554 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
555 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
556 for ( ; I != E; ++I) {
557 if (I->second.get() == OpTy)
558 return true;
559 }
560 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
561 const Type* TheTy = SeqTy->getElementType();
562 if (TheTy->isAbstract() && TheTy != Ty) {
Eric Christopher2a5196f2008-09-24 04:55:49 +0000563 std::vector<const Type*>::iterator I = SeenList.begin(),
Reid Spencer8c8a2dc2007-01-02 21:54:12 +0000564 E = SeenList.end();
565 for ( ; I != E; ++I)
566 if (*I == TheTy)
567 break;
568 if (I == E)
569 WorkList.push_back(TheTy);
570 }
571 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
572 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
573 const Type* TheTy = StrTy->getElementType(i);
574 if (TheTy->isAbstract() && TheTy != Ty) {
Eric Christopher2a5196f2008-09-24 04:55:49 +0000575 std::vector<const Type*>::iterator I = SeenList.begin(),
Reid Spencer8c8a2dc2007-01-02 21:54:12 +0000576 E = SeenList.end();
577 for ( ; I != E; ++I)
578 if (*I == TheTy)
579 break;
580 if (I == E)
581 WorkList.push_back(TheTy);
582 }
583 }
584 }
585 }
586 return false;
587 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000588} CurModule;
589
590static struct PerFunctionInfo {
591 Function *CurrentFunction; // Pointer to current function being created
592
Reid Spencer93c40032007-03-19 18:40:50 +0000593 ValueList Values; // Keep track of #'d definitions
594 unsigned NextValNum;
595 ValueList LateResolveValues;
Reid Spenceref9b9a72007-02-05 20:47:22 +0000596 bool isDeclare; // Is this function a forward declararation?
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000597 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000598 GlobalValue::VisibilityTypes Visibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000599
600 /// BBForwardRefs - When we see forward references to basic blocks, keep
601 /// track of them here.
Reid Spencer93c40032007-03-19 18:40:50 +0000602 std::map<ValID, BasicBlock*> BBForwardRefs;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000603
604 inline PerFunctionInfo() {
605 CurrentFunction = 0;
606 isDeclare = false;
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000607 Linkage = GlobalValue::ExternalLinkage;
608 Visibility = GlobalValue::DefaultVisibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000609 }
610
611 inline void FunctionStart(Function *M) {
612 CurrentFunction = M;
Reid Spencer93c40032007-03-19 18:40:50 +0000613 NextValNum = 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000614 }
615
616 void FunctionDone() {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000617 // Any forward referenced blocks left?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000618 if (!BBForwardRefs.empty()) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000619 GenerateError("Undefined reference to label " +
Reid Spencer93c40032007-03-19 18:40:50 +0000620 BBForwardRefs.begin()->second->getName());
Reid Spencer5b7e7532006-09-28 19:28:24 +0000621 return;
622 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000623
624 // Resolve all forward references now.
625 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
626
627 Values.clear(); // Clear out function local definitions
Reid Spencer93c40032007-03-19 18:40:50 +0000628 BBForwardRefs.clear();
Reid Spencer68a24bd2005-08-27 18:50:39 +0000629 CurrentFunction = 0;
630 isDeclare = false;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000631 Linkage = GlobalValue::ExternalLinkage;
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000632 Visibility = GlobalValue::DefaultVisibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000633 }
634} CurFun; // Info for the current function...
635
636static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
637
638
639//===----------------------------------------------------------------------===//
640// Code to handle definitions of all the types
641//===----------------------------------------------------------------------===//
642
Chris Lattner15bd0952008-08-29 17:20:18 +0000643/// InsertValue - Insert a value into the value table. If it is named, this
644/// returns -1, otherwise it returns the slot number for the value.
645static int InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
Reid Spencer93c40032007-03-19 18:40:50 +0000646 // Things that have names or are void typed don't get slot numbers
647 if (V->hasName() || (V->getType() == Type::VoidTy))
Chris Lattner15bd0952008-08-29 17:20:18 +0000648 return -1;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000649
Reid Spencer93c40032007-03-19 18:40:50 +0000650 // In the case of function values, we have to allow for the forward reference
651 // of basic blocks, which are included in the numbering. Consequently, we keep
Eric Christopher2a5196f2008-09-24 04:55:49 +0000652 // track of the next insertion location with NextValNum. When a BB gets
Reid Spencer93c40032007-03-19 18:40:50 +0000653 // inserted, it could change the size of the CurFun.Values vector.
654 if (&ValueTab == &CurFun.Values) {
655 if (ValueTab.size() <= CurFun.NextValNum)
656 ValueTab.resize(CurFun.NextValNum+1);
657 ValueTab[CurFun.NextValNum++] = V;
Chris Lattner15bd0952008-08-29 17:20:18 +0000658 return CurFun.NextValNum-1;
Eric Christopher2a5196f2008-09-24 04:55:49 +0000659 }
Reid Spencer93c40032007-03-19 18:40:50 +0000660 // For all other lists, its okay to just tack it on the back of the vector.
661 ValueTab.push_back(V);
Chris Lattner15bd0952008-08-29 17:20:18 +0000662 return ValueTab.size()-1;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000663}
664
665static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
666 switch (D.Type) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000667 case ValID::LocalID: // Is it a numbered definition?
Reid Spencer68a24bd2005-08-27 18:50:39 +0000668 // Module constants occupy the lowest numbered slots...
Reid Spencer41dff5e2007-01-26 08:05:27 +0000669 if (D.Num < CurModule.Types.size())
670 return CurModule.Types[D.Num];
Reid Spencer68a24bd2005-08-27 18:50:39 +0000671 break;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000672 case ValID::LocalName: // Is it a named definition?
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000673 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000674 D.destroy(); // Free old strdup'd memory...
675 return N;
676 }
677 break;
678 default:
Reid Spencerb5334b02007-02-05 10:18:06 +0000679 GenerateError("Internal parser error: Invalid symbol type reference");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000680 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000681 }
682
683 // If we reached here, we referenced either a symbol that we don't know about
684 // or an id number that hasn't been read yet. We may be referencing something
685 // forward, so just create an entry to be resolved later and get to it...
686 //
687 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
688
689
690 if (inFunctionScope()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000691 if (D.Type == ValID::LocalName) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000692 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000693 return 0;
694 } else {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000695 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
Reid Spencer5b7e7532006-09-28 19:28:24 +0000696 return 0;
697 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000698 }
699
Reid Spencer861d9d62006-11-28 07:29:44 +0000700 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
Nuno Lopesf05ff662008-10-15 11:20:21 +0000701 if (I != CurModule.LateResolveTypes.end()) {
702 D.destroy();
Reid Spencer861d9d62006-11-28 07:29:44 +0000703 return I->second;
Nuno Lopesf05ff662008-10-15 11:20:21 +0000704 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000705
Reid Spencer861d9d62006-11-28 07:29:44 +0000706 Type *Typ = OpaqueType::get();
707 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
708 return Typ;
Reid Spencera132e042006-12-03 05:46:11 +0000709 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000710
Reid Spencer93c40032007-03-19 18:40:50 +0000711// getExistingVal - Look up the value specified by the provided type and
Reid Spencer68a24bd2005-08-27 18:50:39 +0000712// the provided ValID. If the value exists and has already been defined, return
713// it. Otherwise return null.
714//
Reid Spencer93c40032007-03-19 18:40:50 +0000715static Value *getExistingVal(const Type *Ty, const ValID &D) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000716 if (isa<FunctionType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000717 GenerateError("Functions are not values and "
Reid Spencer68a24bd2005-08-27 18:50:39 +0000718 "must be referenced as pointers");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000719 return 0;
720 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000721
722 switch (D.Type) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000723 case ValID::LocalID: { // Is it a numbered definition?
Reid Spencer41dff5e2007-01-26 08:05:27 +0000724 // Check that the number is within bounds.
Eric Christopher2a5196f2008-09-24 04:55:49 +0000725 if (D.Num >= CurFun.Values.size())
Reid Spencer93c40032007-03-19 18:40:50 +0000726 return 0;
727 Value *Result = CurFun.Values[D.Num];
728 if (Ty != Result->getType()) {
729 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
Eric Christopher2a5196f2008-09-24 04:55:49 +0000730 Result->getType()->getDescription() + "' does not match "
Reid Spencer93c40032007-03-19 18:40:50 +0000731 "expected type, '" + Ty->getDescription() + "'");
732 return 0;
733 }
734 return Result;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000735 }
736 case ValID::GlobalID: { // Is it a numbered definition?
Eric Christopher2a5196f2008-09-24 04:55:49 +0000737 if (D.Num >= CurModule.Values.size())
Reid Spenceref9b9a72007-02-05 20:47:22 +0000738 return 0;
Reid Spencer93c40032007-03-19 18:40:50 +0000739 Value *Result = CurModule.Values[D.Num];
740 if (Ty != Result->getType()) {
741 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
Eric Christopher2a5196f2008-09-24 04:55:49 +0000742 Result->getType()->getDescription() + "' does not match "
Reid Spencer93c40032007-03-19 18:40:50 +0000743 "expected type, '" + Ty->getDescription() + "'");
Reid Spenceref9b9a72007-02-05 20:47:22 +0000744 return 0;
Reid Spencer93c40032007-03-19 18:40:50 +0000745 }
746 return Result;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000747 }
Eric Christopher2a5196f2008-09-24 04:55:49 +0000748
Reid Spencer41dff5e2007-01-26 08:05:27 +0000749 case ValID::LocalName: { // Is it a named definition?
Eric Christopher2a5196f2008-09-24 04:55:49 +0000750 if (!inFunctionScope())
Reid Spenceref9b9a72007-02-05 20:47:22 +0000751 return 0;
752 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000753 Value *N = SymTab.lookup(D.getName());
Eric Christopher2a5196f2008-09-24 04:55:49 +0000754 if (N == 0)
Reid Spenceref9b9a72007-02-05 20:47:22 +0000755 return 0;
756 if (N->getType() != Ty)
757 return 0;
Eric Christopher2a5196f2008-09-24 04:55:49 +0000758
Reid Spencer41dff5e2007-01-26 08:05:27 +0000759 D.destroy(); // Free old strdup'd memory...
760 return N;
761 }
762 case ValID::GlobalName: { // Is it a named definition?
Reid Spenceref9b9a72007-02-05 20:47:22 +0000763 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000764 Value *N = SymTab.lookup(D.getName());
Eric Christopher2a5196f2008-09-24 04:55:49 +0000765 if (N == 0)
Reid Spenceref9b9a72007-02-05 20:47:22 +0000766 return 0;
767 if (N->getType() != Ty)
768 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000769
770 D.destroy(); // Free old strdup'd memory...
771 return N;
772 }
773
774 // Check to make sure that "Ty" is an integral type, and that our
775 // value will fit into the specified type...
776 case ValID::ConstSIntVal: // Is it a constant pool reference??
Chris Lattner38905612008-02-19 04:36:25 +0000777 if (!isa<IntegerType>(Ty) ||
778 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000779 GenerateError("Signed integral constant '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000780 itostr(D.ConstPool64) + "' is invalid for type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +0000781 Ty->getDescription() + "'");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000782 return 0;
783 }
Reid Spencer49d273e2007-03-19 20:40:51 +0000784 return ConstantInt::get(Ty, D.ConstPool64, true);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000785
786 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
Chris Lattner38905612008-02-19 04:36:25 +0000787 if (isa<IntegerType>(Ty) &&
788 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
Reid Spencerb83eb642006-10-20 07:07:24 +0000789 return ConstantInt::get(Ty, D.UConstPool64);
Chris Lattner38905612008-02-19 04:36:25 +0000790
791 if (!isa<IntegerType>(Ty) ||
792 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
793 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
794 "' is invalid or out of range for type '" +
795 Ty->getDescription() + "'");
796 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000797 }
Chris Lattner38905612008-02-19 04:36:25 +0000798 // This is really a signed reference. Transmogrify.
799 return ConstantInt::get(Ty, D.ConstPool64, true);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000800
Chris Lattner1913b942008-07-11 00:30:39 +0000801 case ValID::ConstAPInt: // Is it an unsigned const pool reference?
802 if (!isa<IntegerType>(Ty)) {
803 GenerateError("Integral constant '" + D.getName() +
804 "' is invalid or out of range for type '" +
805 Ty->getDescription() + "'");
806 return 0;
807 }
Eric Christopher2a5196f2008-09-24 04:55:49 +0000808
Chris Lattner1913b942008-07-11 00:30:39 +0000809 {
810 APSInt Tmp = *D.ConstPoolInt;
Nuno Lopes19830332008-11-04 14:28:33 +0000811 D.destroy();
Chris Lattner1913b942008-07-11 00:30:39 +0000812 Tmp.extOrTrunc(Ty->getPrimitiveSizeInBits());
813 return ConstantInt::get(Tmp);
814 }
Eric Christopher2a5196f2008-09-24 04:55:49 +0000815
Reid Spencer68a24bd2005-08-27 18:50:39 +0000816 case ValID::ConstFPVal: // Is it a floating point const pool reference?
Chris Lattner38905612008-02-19 04:36:25 +0000817 if (!Ty->isFloatingPoint() ||
818 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000819 GenerateError("FP constant invalid for type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000820 return 0;
821 }
Eric Christopher2a5196f2008-09-24 04:55:49 +0000822 // Lexer has no type info, so builds all float and double FP constants
Dale Johannesenc72cd7e2007-09-11 18:33:39 +0000823 // as double. Fix this here. Long double does not need this.
824 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
Dale Johannesen236bbd42008-10-09 23:01:34 +0000825 Ty==Type::FloatTy) {
826 bool ignored;
827 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven,
828 &ignored);
829 }
Nuno Lopesaa386d02008-11-04 14:43:20 +0000830 {
831 ConstantFP *tmp = ConstantFP::get(*D.ConstPoolFP);
832 D.destroy();
833 return tmp;
834 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000835
836 case ValID::ConstNullVal: // Is it a null value?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000837 if (!isa<PointerType>(Ty)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000838 GenerateError("Cannot create a a non pointer null");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000839 return 0;
840 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000841 return ConstantPointerNull::get(cast<PointerType>(Ty));
842
843 case ValID::ConstUndefVal: // Is it an undef value?
844 return UndefValue::get(Ty);
845
Chris Lattner7aa61892005-12-21 17:53:23 +0000846 case ValID::ConstZeroVal: // Is it a zero value?
847 return Constant::getNullValue(Ty);
Eric Christopher2a5196f2008-09-24 04:55:49 +0000848
Reid Spencer68a24bd2005-08-27 18:50:39 +0000849 case ValID::ConstantVal: // Fully resolved constant?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000850 if (D.ConstantValue->getType() != Ty) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000851 GenerateError("Constant expression type different from required type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000852 return 0;
853 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000854 return D.ConstantValue;
855
Chris Lattner0e9c3762006-01-25 22:27:16 +0000856 case ValID::InlineAsmVal: { // Inline asm expression
857 const PointerType *PTy = dyn_cast<PointerType>(Ty);
858 const FunctionType *FTy =
859 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000860 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000861 GenerateError("Invalid type for asm constraint string");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000862 return 0;
863 }
Chris Lattner0e9c3762006-01-25 22:27:16 +0000864 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
865 D.IAD->HasSideEffects);
866 D.destroy(); // Free InlineAsmDescriptor.
867 return IA;
868 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000869 default:
Reid Spencera9720f52007-02-05 17:04:00 +0000870 assert(0 && "Unhandled case!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000871 return 0;
872 } // End of switch
873
Reid Spencera9720f52007-02-05 17:04:00 +0000874 assert(0 && "Unhandled case!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000875 return 0;
876}
877
Reid Spencer93c40032007-03-19 18:40:50 +0000878// getVal - This function is identical to getExistingVal, except that if a
Reid Spencer68a24bd2005-08-27 18:50:39 +0000879// value is not already defined, it "improvises" by creating a placeholder var
880// that looks and acts just like the requested variable. When the value is
881// defined later, all uses of the placeholder variable are replaced with the
882// real thing.
883//
884static Value *getVal(const Type *Ty, const ValID &ID) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000885 if (Ty == Type::LabelTy) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000886 GenerateError("Cannot use a basic block here");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000887 return 0;
888 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000889
890 // See if the value has already been defined.
Reid Spencer93c40032007-03-19 18:40:50 +0000891 Value *V = getExistingVal(Ty, ID);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000892 if (V) return V;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000893 if (TriggerError) return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000894
Reid Spencer5b7e7532006-09-28 19:28:24 +0000895 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
Dan Gohmane4977cf2008-05-23 01:55:30 +0000896 GenerateError("Invalid use of a non-first-class type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000897 return 0;
898 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000899
900 // If we reached here, we referenced either a symbol that we don't know about
901 // or an id number that hasn't been read yet. We may be referencing something
902 // forward, so just create an entry to be resolved later and get to it...
903 //
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000904 switch (ID.Type) {
905 case ValID::GlobalName:
Reid Spencer9c9b63a2007-04-28 16:07:31 +0000906 case ValID::GlobalID: {
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000907 const PointerType *PTy = dyn_cast<PointerType>(Ty);
908 if (!PTy) {
909 GenerateError("Invalid type for reference to global" );
910 return 0;
911 }
912 const Type* ElTy = PTy->getElementType();
913 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
Gabor Greife64d2482008-04-06 23:07:54 +0000914 V = Function::Create(FTy, GlobalValue::ExternalLinkage);
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000915 else
Christopher Lamba8ed9bf2007-12-11 09:02:08 +0000916 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
917 (Module*)0, false, PTy->getAddressSpace());
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000918 break;
Reid Spencer9c9b63a2007-04-28 16:07:31 +0000919 }
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000920 default:
921 V = new Argument(Ty);
922 }
Eric Christopher2a5196f2008-09-24 04:55:49 +0000923
Reid Spencer68a24bd2005-08-27 18:50:39 +0000924 // Remember where this forward reference came from. FIXME, shouldn't we try
925 // to recycle these things??
926 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
Duncan Sandsdc024672007-11-27 13:23:08 +0000927 LLLgetLineNo())));
Reid Spencer68a24bd2005-08-27 18:50:39 +0000928
929 if (inFunctionScope())
930 InsertValue(V, CurFun.LateResolveValues);
931 else
932 InsertValue(V, CurModule.LateResolveValues);
933 return V;
934}
935
Reid Spencer93c40032007-03-19 18:40:50 +0000936/// defineBBVal - This is a definition of a new basic block with the specified
937/// identifier which must be the same as CurFun.NextValNum, if its numeric.
Chris Lattnercc81d152008-05-04 17:18:47 +0000938static BasicBlock *defineBBVal(const ValID &ID) {
Reid Spencera9720f52007-02-05 17:04:00 +0000939 assert(inFunctionScope() && "Can't get basic block at global scope!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000940
Reid Spencer68a24bd2005-08-27 18:50:39 +0000941 BasicBlock *BB = 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000942
Reid Spencer93c40032007-03-19 18:40:50 +0000943 // First, see if this was forward referenced
Reid Spencer68a24bd2005-08-27 18:50:39 +0000944
Reid Spencer93c40032007-03-19 18:40:50 +0000945 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
946 if (BBI != CurFun.BBForwardRefs.end()) {
947 BB = BBI->second;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000948 // The forward declaration could have been inserted anywhere in the
949 // function: insert it into the correct place now.
950 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
951 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
Reid Spencer93c40032007-03-19 18:40:50 +0000952
Reid Spencer66728ef2007-03-20 01:13:36 +0000953 // We're about to erase the entry, save the key so we can clean it up.
954 ValID Tmp = BBI->first;
955
Reid Spencer93c40032007-03-19 18:40:50 +0000956 // Erase the forward ref from the map as its no longer "forward"
957 CurFun.BBForwardRefs.erase(ID);
958
Eric Christopher2a5196f2008-09-24 04:55:49 +0000959 // The key has been removed from the map but so we don't want to leave
Reid Spencer66728ef2007-03-20 01:13:36 +0000960 // strdup'd memory around so destroy it too.
961 Tmp.destroy();
962
Reid Spencer93c40032007-03-19 18:40:50 +0000963 // If its a numbered definition, bump the number and set the BB value.
964 if (ID.Type == ValID::LocalID) {
965 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
966 InsertValue(BB);
967 }
Eric Christopher2a5196f2008-09-24 04:55:49 +0000968 } else {
969 // We haven't seen this BB before and its first mention is a definition.
Devang Patel67909432008-03-03 18:58:47 +0000970 // Just create it and return it.
971 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
Gabor Greife64d2482008-04-06 23:07:54 +0000972 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Devang Patel67909432008-03-03 18:58:47 +0000973 if (ID.Type == ValID::LocalID) {
974 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
975 InsertValue(BB);
976 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000977 }
Reid Spencer93c40032007-03-19 18:40:50 +0000978
Devang Patel67909432008-03-03 18:58:47 +0000979 ID.destroy();
Reid Spencer93c40032007-03-19 18:40:50 +0000980 return BB;
981}
982
983/// getBBVal - get an existing BB value or create a forward reference for it.
Eric Christopher2a5196f2008-09-24 04:55:49 +0000984///
Reid Spencer93c40032007-03-19 18:40:50 +0000985static BasicBlock *getBBVal(const ValID &ID) {
986 assert(inFunctionScope() && "Can't get basic block at global scope!");
987
988 BasicBlock *BB = 0;
989
990 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
991 if (BBI != CurFun.BBForwardRefs.end()) {
992 BB = BBI->second;
993 } if (ID.Type == ValID::LocalName) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000994 std::string Name = ID.getName();
Reid Spencer93c40032007-03-19 18:40:50 +0000995 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
Anton Korobeynikovc70d7732008-02-20 12:10:37 +0000996 if (N) {
Reid Spencer93c40032007-03-19 18:40:50 +0000997 if (N->getType()->getTypeID() == Type::LabelTyID)
998 BB = cast<BasicBlock>(N);
999 else
1000 GenerateError("Reference to label '" + Name + "' is actually of type '"+
1001 N->getType()->getDescription() + "'");
Anton Korobeynikovc70d7732008-02-20 12:10:37 +00001002 }
Reid Spencer93c40032007-03-19 18:40:50 +00001003 } else if (ID.Type == ValID::LocalID) {
1004 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
1005 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
1006 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
1007 else
Eric Christopher2a5196f2008-09-24 04:55:49 +00001008 GenerateError("Reference to label '%" + utostr(ID.Num) +
1009 "' is actually of type '"+
Reid Spencer93c40032007-03-19 18:40:50 +00001010 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
1011 }
1012 } else {
1013 GenerateError("Illegal label reference " + ID.getName());
1014 return 0;
1015 }
1016
1017 // If its already been defined, return it now.
1018 if (BB) {
1019 ID.destroy(); // Free strdup'd memory.
1020 return BB;
1021 }
1022
1023 // Otherwise, this block has not been seen before, create it.
1024 std::string Name;
1025 if (ID.Type == ValID::LocalName)
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001026 Name = ID.getName();
Gabor Greife64d2482008-04-06 23:07:54 +00001027 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Reid Spencer93c40032007-03-19 18:40:50 +00001028
1029 // Insert it in the forward refs map.
1030 CurFun.BBForwardRefs[ID] = BB;
1031
Reid Spencer68a24bd2005-08-27 18:50:39 +00001032 return BB;
1033}
1034
1035
1036//===----------------------------------------------------------------------===//
1037// Code to handle forward references in instructions
1038//===----------------------------------------------------------------------===//
1039//
1040// This code handles the late binding needed with statements that reference
1041// values not defined yet... for example, a forward branch, or the PHI node for
1042// a loop body.
1043//
1044// This keeps a table (CurFun.LateResolveValues) of all such forward references
1045// and back patchs after we are done.
1046//
1047
1048// ResolveDefinitions - If we could not resolve some defs at parsing
1049// time (forward branches, phi functions for loops, etc...) resolve the
1050// defs now...
1051//
Eric Christopher2a5196f2008-09-24 04:55:49 +00001052static void
Reid Spencer93c40032007-03-19 18:40:50 +00001053ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001054 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
Reid Spencer93c40032007-03-19 18:40:50 +00001055 while (!LateResolvers.empty()) {
1056 Value *V = LateResolvers.back();
1057 LateResolvers.pop_back();
Reid Spencer68a24bd2005-08-27 18:50:39 +00001058
Reid Spencer93c40032007-03-19 18:40:50 +00001059 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1060 CurModule.PlaceHolderInfo.find(V);
1061 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001062
Reid Spencer93c40032007-03-19 18:40:50 +00001063 ValID &DID = PHI->second.first;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001064
Reid Spencer93c40032007-03-19 18:40:50 +00001065 Value *TheRealValue = getExistingVal(V->getType(), DID);
1066 if (TriggerError)
1067 return;
1068 if (TheRealValue) {
1069 V->replaceAllUsesWith(TheRealValue);
1070 delete V;
1071 CurModule.PlaceHolderInfo.erase(PHI);
1072 } else if (FutureLateResolvers) {
1073 // Functions have their unresolved items forwarded to the module late
1074 // resolver table
1075 InsertValue(V, *FutureLateResolvers);
1076 } else {
1077 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1078 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1079 "' of type '" + V->getType()->getDescription() + "'",
1080 PHI->second.second);
Reid Spencer5b7e7532006-09-28 19:28:24 +00001081 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001082 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00001083 GenerateError("Reference to an invalid definition: #" +
1084 itostr(DID.Num) + " of type '" +
1085 V->getType()->getDescription() + "'",
1086 PHI->second.second);
1087 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001088 }
1089 }
1090 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001091 LateResolvers.clear();
1092}
1093
1094// ResolveTypeTo - A brand new type was just declared. This means that (if
1095// name is not null) things referencing Name can be resolved. Otherwise, things
1096// refering to the number can be resolved. Do this now.
1097//
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001098static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001099 ValID D;
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001100 if (Name)
1101 D = ValID::createLocalName(*Name);
Eric Christopher2a5196f2008-09-24 04:55:49 +00001102 else
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001103 D = ValID::createLocalID(CurModule.Types.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00001104
Reid Spencer861d9d62006-11-28 07:29:44 +00001105 std::map<ValID, PATypeHolder>::iterator I =
Reid Spencer68a24bd2005-08-27 18:50:39 +00001106 CurModule.LateResolveTypes.find(D);
1107 if (I != CurModule.LateResolveTypes.end()) {
Reid Spencer861d9d62006-11-28 07:29:44 +00001108 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
Nuno Lopes6ec8a252008-10-15 11:11:12 +00001109 I->first.destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +00001110 CurModule.LateResolveTypes.erase(I);
1111 }
Nuno Lopes191dfb92008-10-03 15:52:39 +00001112 D.destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +00001113}
1114
1115// setValueName - Set the specified value to the name given. The name may be
1116// null potentially, in which case this is a noop. The string passed in is
1117// assumed to be a malloc'd string buffer, and is free'd by this function.
1118//
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001119static void setValueName(Value *V, std::string *NameStr) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00001120 if (!NameStr) return;
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001121 std::string Name(*NameStr); // Copy string
1122 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001123
Reid Spencer41dff5e2007-01-26 08:05:27 +00001124 if (V->getType() == Type::VoidTy) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001125 GenerateError("Can't assign name '" + Name+"' to value with void type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00001126 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001127 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00001128
Reid Spencera9720f52007-02-05 17:04:00 +00001129 assert(inFunctionScope() && "Must be in function scope!");
Reid Spenceref9b9a72007-02-05 20:47:22 +00001130 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1131 if (ST.lookup(Name)) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00001132 GenerateError("Redefinition of value '" + Name + "' of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00001133 V->getType()->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00001134 return;
1135 }
1136
1137 // Set the name.
1138 V->setName(Name);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001139}
1140
1141/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1142/// this is a declaration, otherwise it is a definition.
Chris Lattnerb475c422005-11-12 18:22:38 +00001143static GlobalVariable *
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001144ParseGlobalVariable(std::string *NameStr,
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001145 GlobalValue::LinkageTypes Linkage,
1146 GlobalValue::VisibilityTypes Visibility,
Chris Lattnerb475c422005-11-12 18:22:38 +00001147 bool isConstantGlobal, const Type *Ty,
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001148 Constant *Initializer, bool IsThreadLocal,
1149 unsigned AddressSpace = 0) {
Reid Spencer5b7e7532006-09-28 19:28:24 +00001150 if (isa<FunctionType>(Ty)) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001151 GenerateError("Cannot declare global vars of function type");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001152 return 0;
1153 }
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001154 if (Ty == Type::LabelTy) {
1155 GenerateError("Cannot declare global vars of label type");
1156 return 0;
1157 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001158
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001159 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001160
1161 std::string Name;
1162 if (NameStr) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001163 Name = *NameStr; // Copy string
1164 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001165 }
1166
1167 // See if this global value was forward referenced. If so, recycle the
1168 // object.
1169 ValID ID;
1170 if (!Name.empty()) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001171 ID = ValID::createGlobalName(Name);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001172 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00001173 ID = ValID::createGlobalID(CurModule.Values.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00001174 }
1175
1176 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1177 // Move the global to the end of the list, from whereever it was
1178 // previously inserted.
1179 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1180 CurModule.CurrentModule->getGlobalList().remove(GV);
1181 CurModule.CurrentModule->getGlobalList().push_back(GV);
1182 GV->setInitializer(Initializer);
1183 GV->setLinkage(Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001184 GV->setVisibility(Visibility);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001185 GV->setConstant(isConstantGlobal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00001186 GV->setThreadLocal(IsThreadLocal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001187 InsertValue(GV, CurModule.Values);
Nuno Lopes191dfb92008-10-03 15:52:39 +00001188 ID.destroy();
Chris Lattnerb475c422005-11-12 18:22:38 +00001189 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001190 }
1191
Nuno Lopes191dfb92008-10-03 15:52:39 +00001192 ID.destroy();
1193
Reid Spenceref9b9a72007-02-05 20:47:22 +00001194 // If this global has a name
Reid Spencer68a24bd2005-08-27 18:50:39 +00001195 if (!Name.empty()) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00001196 // if the global we're parsing has an initializer (is a definition) and
1197 // has external linkage.
1198 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1199 // If there is already a global with external linkage with this name
1200 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1201 // If we allow this GVar to get created, it will be renamed in the
1202 // symbol table because it conflicts with an existing GVar. We can't
1203 // allow redefinition of GVars whose linking indicates that their name
1204 // must stay the same. Issue the error.
1205 GenerateError("Redefinition of global variable named '" + Name +
1206 "' of type '" + Ty->getDescription() + "'");
1207 return 0;
1208 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001209 }
1210
1211 // Otherwise there is no existing GV to use, create one now.
1212 GlobalVariable *GV =
1213 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001214 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001215 GV->setVisibility(Visibility);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001216 InsertValue(GV, CurModule.Values);
Chris Lattnerb475c422005-11-12 18:22:38 +00001217 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001218}
1219
1220// setTypeName - Set the specified type to the name given. The name may be
1221// null potentially, in which case this is a noop. The string passed in is
1222// assumed to be a malloc'd string buffer, and is freed by this function.
1223//
1224// This function returns true if the type has already been defined, but is
1225// allowed to be redefined in the specified context. If the name is a new name
1226// for the type plane, it is inserted and false is returned.
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001227static bool setTypeName(const Type *T, std::string *NameStr) {
Reid Spencera9720f52007-02-05 17:04:00 +00001228 assert(!inFunctionScope() && "Can't give types function-local names!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001229 if (NameStr == 0) return false;
Eric Christopher2a5196f2008-09-24 04:55:49 +00001230
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001231 std::string Name(*NameStr); // Copy string
1232 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001233
1234 // We don't allow assigning names to void type
Reid Spencer5b7e7532006-09-28 19:28:24 +00001235 if (T == Type::VoidTy) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001236 GenerateError("Can't assign name '" + Name + "' to the void type");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001237 return false;
1238 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001239
1240 // Set the type name, checking for conflicts as we do so.
1241 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1242
1243 if (AlreadyExists) { // Inserting a name that is already defined???
1244 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
Reid Spencera9720f52007-02-05 17:04:00 +00001245 assert(Existing && "Conflict but no matching type?!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001246
1247 // There is only one case where this is allowed: when we are refining an
1248 // opaque type. In this case, Existing will be an opaque type.
1249 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1250 // We ARE replacing an opaque type!
1251 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1252 return true;
1253 }
1254
1255 // Otherwise, this is an attempt to redefine a type. That's okay if
1256 // the redefinition is identical to the original. This will be so if
1257 // Existing and T point to the same Type object. In this one case we
1258 // allow the equivalent redefinition.
1259 if (Existing == T) return true; // Yes, it's equal.
1260
1261 // Any other kind of (non-equivalent) redefinition is an error.
Reid Spencer63c34452007-01-05 21:51:07 +00001262 GenerateError("Redefinition of type named '" + Name + "' of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00001263 T->getDescription() + "'");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001264 }
1265
1266 return false;
1267}
1268
1269//===----------------------------------------------------------------------===//
1270// Code for handling upreferences in type names...
1271//
1272
1273// TypeContains - Returns true if Ty directly contains E in it.
1274//
1275static bool TypeContains(const Type *Ty, const Type *E) {
1276 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1277 E) != Ty->subtype_end();
1278}
1279
1280namespace {
1281 struct UpRefRecord {
1282 // NestingLevel - The number of nesting levels that need to be popped before
1283 // this type is resolved.
1284 unsigned NestingLevel;
1285
1286 // LastContainedTy - This is the type at the current binding level for the
1287 // type. Every time we reduce the nesting level, this gets updated.
1288 const Type *LastContainedTy;
1289
1290 // UpRefTy - This is the actual opaque type that the upreference is
1291 // represented with.
1292 OpaqueType *UpRefTy;
1293
1294 UpRefRecord(unsigned NL, OpaqueType *URTy)
1295 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1296 };
1297}
1298
1299// UpRefs - A list of the outstanding upreferences that need to be resolved.
1300static std::vector<UpRefRecord> UpRefs;
1301
1302/// HandleUpRefs - Every time we finish a new layer of types, this function is
1303/// called. It loops through the UpRefs vector, which is a list of the
1304/// currently active types. For each type, if the up reference is contained in
1305/// the newly completed type, we decrement the level count. When the level
1306/// count reaches zero, the upreferenced type is the type that is passed in:
1307/// thus we can complete the cycle.
1308///
1309static PATypeHolder HandleUpRefs(const Type *ty) {
Chris Lattner224f84f2006-08-18 17:34:45 +00001310 // If Ty isn't abstract, or if there are no up-references in it, then there is
1311 // nothing to resolve here.
1312 if (!ty->isAbstract() || UpRefs.empty()) return ty;
Eric Christopher2a5196f2008-09-24 04:55:49 +00001313
Reid Spencer68a24bd2005-08-27 18:50:39 +00001314 PATypeHolder Ty(ty);
1315 UR_OUT("Type '" << Ty->getDescription() <<
1316 "' newly formed. Resolving upreferences.\n" <<
1317 UpRefs.size() << " upreferences active!\n");
1318
1319 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1320 // to zero), we resolve them all together before we resolve them to Ty. At
1321 // the end of the loop, if there is anything to resolve to Ty, it will be in
1322 // this variable.
1323 OpaqueType *TypeToResolve = 0;
1324
1325 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1326 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1327 << UpRefs[i].second->getDescription() << ") = "
1328 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1329 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1330 // Decrement level of upreference
1331 unsigned Level = --UpRefs[i].NestingLevel;
1332 UpRefs[i].LastContainedTy = Ty;
1333 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1334 if (Level == 0) { // Upreference should be resolved!
1335 if (!TypeToResolve) {
1336 TypeToResolve = UpRefs[i].UpRefTy;
1337 } else {
1338 UR_OUT(" * Resolving upreference for "
1339 << UpRefs[i].second->getDescription() << "\n";
1340 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1341 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1342 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1343 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1344 }
1345 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1346 --i; // Do not skip the next element...
1347 }
1348 }
1349 }
1350
1351 if (TypeToResolve) {
1352 UR_OUT(" * Resolving upreference for "
1353 << UpRefs[i].second->getDescription() << "\n";
1354 std::string OldName = TypeToResolve->getDescription());
1355 TypeToResolve->refineAbstractTypeTo(Ty);
1356 }
1357
1358 return Ty;
1359}
1360
Reid Spencer68a24bd2005-08-27 18:50:39 +00001361//===----------------------------------------------------------------------===//
1362// RunVMAsmParser - Define an interface to this parser
1363//===----------------------------------------------------------------------===//
1364//
Reid Spencer14310612006-12-31 05:40:51 +00001365static Module* RunParser(Module * M);
1366
Duncan Sandsdc024672007-11-27 13:23:08 +00001367Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1368 InitLLLexer(MB);
1369 Module *M = RunParser(new Module(LLLgetFilename()));
1370 FreeLexer();
1371 return M;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001372}
1373
1374
Dan Gohmanf4423b12008-04-19 00:24:39 +00001375
1376/* Enabling traces. */
1377#ifndef YYDEBUG
1378# define YYDEBUG 0
1379#endif
1380
1381/* Enabling verbose error messages. */
1382#ifdef YYERROR_VERBOSE
1383# undef YYERROR_VERBOSE
1384# define YYERROR_VERBOSE 1
1385#else
1386# define YYERROR_VERBOSE 0
1387#endif
1388
1389/* Enabling the token table. */
1390#ifndef YYTOKEN_TABLE
1391# define YYTOKEN_TABLE 0
1392#endif
1393
1394#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1395typedef union YYSTYPE
Nick Lewycky02ff3082008-11-24 03:41:24 +00001396#line 986 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00001397{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001398 llvm::Module *ModuleVal;
1399 llvm::Function *FunctionVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001400 llvm::BasicBlock *BasicBlockVal;
1401 llvm::TerminatorInst *TermInstVal;
1402 llvm::Instruction *InstVal;
Reid Spencera132e042006-12-03 05:46:11 +00001403 llvm::Constant *ConstVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001404
Reid Spencera132e042006-12-03 05:46:11 +00001405 const llvm::Type *PrimType;
Reid Spencer14310612006-12-31 05:40:51 +00001406 std::list<llvm::PATypeHolder> *TypeList;
Reid Spencera132e042006-12-03 05:46:11 +00001407 llvm::PATypeHolder *TypeVal;
1408 llvm::Value *ValueVal;
Reid Spencera132e042006-12-03 05:46:11 +00001409 std::vector<llvm::Value*> *ValueList;
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001410 std::vector<unsigned> *ConstantList;
Reid Spencer14310612006-12-31 05:40:51 +00001411 llvm::ArgListType *ArgList;
1412 llvm::TypeWithAttrs TypeWithAttrs;
1413 llvm::TypeWithAttrsList *TypeWithAttrsList;
Dale Johanneseneb57ea72007-11-05 21:20:28 +00001414 llvm::ParamList *ParamList;
Reid Spencer14310612006-12-31 05:40:51 +00001415
Reid Spencer68a24bd2005-08-27 18:50:39 +00001416 // Represent the RHS of PHI node
Reid Spencera132e042006-12-03 05:46:11 +00001417 std::list<std::pair<llvm::Value*,
1418 llvm::BasicBlock*> > *PHIList;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001419 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
Reid Spencera132e042006-12-03 05:46:11 +00001420 std::vector<llvm::Constant*> *ConstVector;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001421
1422 llvm::GlobalValue::LinkageTypes Linkage;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001423 llvm::GlobalValue::VisibilityTypes Visibility;
Devang Patel05988662008-09-25 21:00:45 +00001424 llvm::Attributes Attributes;
Reid Spencer38c91a92007-02-28 02:24:54 +00001425 llvm::APInt *APIntVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001426 int64_t SInt64Val;
1427 uint64_t UInt64Val;
1428 int SIntVal;
1429 unsigned UIntVal;
Dale Johannesencdd509a2007-09-07 21:07:57 +00001430 llvm::APFloat *FPVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001431 bool BoolVal;
1432
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001433 std::string *StrVal; // This memory must be deleted
1434 llvm::ValID ValIDVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001435
Reid Spencera132e042006-12-03 05:46:11 +00001436 llvm::Instruction::BinaryOps BinaryOpVal;
1437 llvm::Instruction::TermOps TermOpVal;
1438 llvm::Instruction::MemoryOps MemOpVal;
1439 llvm::Instruction::CastOps CastOpVal;
1440 llvm::Instruction::OtherOps OtherOpVal;
Reid Spencera132e042006-12-03 05:46:11 +00001441 llvm::ICmpInst::Predicate IPredicate;
1442 llvm::FCmpInst::Predicate FPredicate;
Dan Gohmanf4423b12008-04-19 00:24:39 +00001443}
Nick Lewycky02ff3082008-11-24 03:41:24 +00001444/* Line 187 of yacc.c. */
Nick Lewyckyd802be32008-12-19 09:41:54 +00001445#line 1446 "llvmAsmParser.tab.c"
Dan Gohmanf4423b12008-04-19 00:24:39 +00001446 YYSTYPE;
1447# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1448# define YYSTYPE_IS_DECLARED 1
1449# define YYSTYPE_IS_TRIVIAL 1
Reid Spencer68a24bd2005-08-27 18:50:39 +00001450#endif
1451
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001452
Reid Spencer68a24bd2005-08-27 18:50:39 +00001453
Dan Gohmanf4423b12008-04-19 00:24:39 +00001454/* Copy the second part of user declarations. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001455
1456
Dan Gohmanf4423b12008-04-19 00:24:39 +00001457/* Line 216 of yacc.c. */
Nick Lewyckyd802be32008-12-19 09:41:54 +00001458#line 1459 "llvmAsmParser.tab.c"
Reid Spencerb8f85052007-07-31 03:50:36 +00001459
Dan Gohmanf4423b12008-04-19 00:24:39 +00001460#ifdef short
1461# undef short
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001462#endif
1463
Dan Gohmanf4423b12008-04-19 00:24:39 +00001464#ifdef YYTYPE_UINT8
1465typedef YYTYPE_UINT8 yytype_uint8;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001466#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00001467typedef unsigned char yytype_uint8;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001468#endif
1469
Dan Gohmanf4423b12008-04-19 00:24:39 +00001470#ifdef YYTYPE_INT8
1471typedef YYTYPE_INT8 yytype_int8;
1472#elif (defined __STDC__ || defined __C99__FUNC__ \
1473 || defined __cplusplus || defined _MSC_VER)
1474typedef signed char yytype_int8;
1475#else
1476typedef short int yytype_int8;
1477#endif
1478
1479#ifdef YYTYPE_UINT16
1480typedef YYTYPE_UINT16 yytype_uint16;
1481#else
1482typedef unsigned short int yytype_uint16;
1483#endif
1484
1485#ifdef YYTYPE_INT16
1486typedef YYTYPE_INT16 yytype_int16;
1487#else
1488typedef short int yytype_int16;
1489#endif
1490
1491#ifndef YYSIZE_T
1492# ifdef __SIZE_TYPE__
1493# define YYSIZE_T __SIZE_TYPE__
1494# elif defined size_t
1495# define YYSIZE_T size_t
1496# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1497 || defined __cplusplus || defined _MSC_VER)
1498# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1499# define YYSIZE_T size_t
1500# else
1501# define YYSIZE_T unsigned int
1502# endif
1503#endif
1504
1505#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1506
1507#ifndef YY_
Nick Lewycky02ff3082008-11-24 03:41:24 +00001508# if YYENABLE_NLS
Dan Gohmanf4423b12008-04-19 00:24:39 +00001509# if ENABLE_NLS
1510# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1511# define YY_(msgid) dgettext ("bison-runtime", msgid)
1512# endif
1513# endif
1514# ifndef YY_
1515# define YY_(msgid) msgid
1516# endif
1517#endif
1518
1519/* Suppress unused-variable warnings by "using" E. */
1520#if ! defined lint || defined __GNUC__
1521# define YYUSE(e) ((void) (e))
1522#else
1523# define YYUSE(e) /* empty */
1524#endif
1525
1526/* Identity function, used to suppress warnings about constant conditions. */
1527#ifndef lint
1528# define YYID(n) (n)
1529#else
1530#if (defined __STDC__ || defined __C99__FUNC__ \
1531 || defined __cplusplus || defined _MSC_VER)
1532static int
1533YYID (int i)
1534#else
1535static int
1536YYID (i)
1537 int i;
1538#endif
1539{
1540 return i;
1541}
1542#endif
1543
1544#if ! defined yyoverflow || YYERROR_VERBOSE
1545
1546/* The parser invokes alloca or malloc; define the necessary symbols. */
1547
1548# ifdef YYSTACK_USE_ALLOCA
1549# if YYSTACK_USE_ALLOCA
1550# ifdef __GNUC__
1551# define YYSTACK_ALLOC __builtin_alloca
1552# elif defined __BUILTIN_VA_ARG_INCR
1553# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1554# elif defined _AIX
1555# define YYSTACK_ALLOC __alloca
1556# elif defined _MSC_VER
1557# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1558# define alloca _alloca
1559# else
1560# define YYSTACK_ALLOC alloca
1561# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1562 || defined __cplusplus || defined _MSC_VER)
1563# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1564# ifndef _STDLIB_H
1565# define _STDLIB_H 1
1566# endif
1567# endif
1568# endif
1569# endif
1570# endif
1571
1572# ifdef YYSTACK_ALLOC
1573 /* Pacify GCC's `empty if-body' warning. */
1574# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1575# ifndef YYSTACK_ALLOC_MAXIMUM
1576 /* The OS might guarantee only one guard page at the bottom of the stack,
1577 and a page size can be as small as 4096 bytes. So we cannot safely
1578 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1579 to allow for a few compiler-allocated temporary stack slots. */
1580# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1581# endif
1582# else
1583# define YYSTACK_ALLOC YYMALLOC
1584# define YYSTACK_FREE YYFREE
1585# ifndef YYSTACK_ALLOC_MAXIMUM
1586# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1587# endif
1588# if (defined __cplusplus && ! defined _STDLIB_H \
1589 && ! ((defined YYMALLOC || defined malloc) \
1590 && (defined YYFREE || defined free)))
1591# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1592# ifndef _STDLIB_H
1593# define _STDLIB_H 1
1594# endif
1595# endif
1596# ifndef YYMALLOC
1597# define YYMALLOC malloc
1598# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1599 || defined __cplusplus || defined _MSC_VER)
1600void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1601# endif
1602# endif
1603# ifndef YYFREE
1604# define YYFREE free
1605# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1606 || defined __cplusplus || defined _MSC_VER)
1607void free (void *); /* INFRINGES ON USER NAME SPACE */
1608# endif
1609# endif
1610# endif
1611#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1612
1613
1614#if (! defined yyoverflow \
1615 && (! defined __cplusplus \
1616 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1617
1618/* A type that is properly aligned for any stack member. */
1619union yyalloc
1620{
1621 yytype_int16 yyss;
1622 YYSTYPE yyvs;
1623 };
1624
1625/* The size of the maximum gap between one aligned stack and the next. */
1626# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1627
1628/* The size of an array large to enough to hold all stacks, each with
1629 N elements. */
1630# define YYSTACK_BYTES(N) \
1631 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1632 + YYSTACK_GAP_MAXIMUM)
1633
1634/* Copy COUNT objects from FROM to TO. The source and destination do
1635 not overlap. */
1636# ifndef YYCOPY
1637# if defined __GNUC__ && 1 < __GNUC__
1638# define YYCOPY(To, From, Count) \
1639 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1640# else
1641# define YYCOPY(To, From, Count) \
1642 do \
1643 { \
1644 YYSIZE_T yyi; \
1645 for (yyi = 0; yyi < (Count); yyi++) \
1646 (To)[yyi] = (From)[yyi]; \
1647 } \
1648 while (YYID (0))
1649# endif
1650# endif
1651
1652/* Relocate STACK from its old location to the new one. The
1653 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1654 elements in the stack, and YYPTR gives the new location of the
1655 stack. Advance YYPTR to a properly aligned location for the next
1656 stack. */
1657# define YYSTACK_RELOCATE(Stack) \
1658 do \
1659 { \
1660 YYSIZE_T yynewbytes; \
1661 YYCOPY (&yyptr->Stack, Stack, yysize); \
1662 Stack = &yyptr->Stack; \
1663 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1664 yyptr += yynewbytes / sizeof (*yyptr); \
1665 } \
1666 while (YYID (0))
1667
1668#endif
1669
1670/* YYFINAL -- State number of the termination state. */
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001671#define YYFINAL 44
Dan Gohmanf4423b12008-04-19 00:24:39 +00001672/* YYLAST -- Last index in YYTABLE. */
Nick Lewyckyd802be32008-12-19 09:41:54 +00001673#define YYLAST 2372
Dan Gohmanf4423b12008-04-19 00:24:39 +00001674
1675/* YYNTOKENS -- Number of terminals. */
Nick Lewyckyd802be32008-12-19 09:41:54 +00001676#define YYNTOKENS 176
Dan Gohmanf4423b12008-04-19 00:24:39 +00001677/* YYNNTS -- Number of nonterminals. */
Chris Lattner740e7092008-10-15 06:16:57 +00001678#define YYNNTS 87
Dan Gohmanf4423b12008-04-19 00:24:39 +00001679/* YYNRULES -- Number of rules. */
Nick Lewyckyd802be32008-12-19 09:41:54 +00001680#define YYNRULES 352
Dan Gohmanf4423b12008-04-19 00:24:39 +00001681/* YYNRULES -- Number of states. */
Nick Lewyckyd802be32008-12-19 09:41:54 +00001682#define YYNSTATES 712
Dan Gohmanf4423b12008-04-19 00:24:39 +00001683
1684/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1685#define YYUNDEFTOK 2
Nick Lewyckyd802be32008-12-19 09:41:54 +00001686#define YYMAXUTOK 416
Dan Gohmanf4423b12008-04-19 00:24:39 +00001687
1688#define YYTRANSLATE(YYX) \
1689 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1690
1691/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1692static const yytype_uint8 yytranslate[] =
1693{
1694 0, 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,
Nick Lewyckyd802be32008-12-19 09:41:54 +00001698 162, 163, 166, 2, 165, 2, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001699 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Nick Lewyckyd802be32008-12-19 09:41:54 +00001700 171, 164, 172, 2, 2, 2, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001701 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1702 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Nick Lewyckyd802be32008-12-19 09:41:54 +00001703 2, 168, 167, 170, 2, 2, 2, 2, 2, 175,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001704 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1705 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Nick Lewyckyd802be32008-12-19 09:41:54 +00001706 169, 2, 2, 173, 2, 174, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001707 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1708 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1709 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1710 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1711 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1712 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1713 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1714 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1715 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1716 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1717 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1718 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1719 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1720 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1721 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1722 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1723 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1724 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1725 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1726 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1727 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1728 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1729 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1730 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1731 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1732 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1733 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001734 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
Nick Lewyckyd802be32008-12-19 09:41:54 +00001735 155, 156, 157, 158, 159, 160, 161
Dan Gohmanf4423b12008-04-19 00:24:39 +00001736};
1737
1738#if YYDEBUG
1739/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1740 YYRHS. */
1741static const yytype_uint16 yyprhs[] =
1742{
1743 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1744 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1745 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1746 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1747 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1748 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
Chris Lattner740e7092008-10-15 06:16:57 +00001749 118, 123, 124, 127, 128, 131, 133, 135, 137, 138,
1750 141, 143, 145, 147, 149, 151, 153, 155, 157, 159,
1751 160, 162, 164, 166, 167, 169, 171, 172, 174, 176,
1752 178, 180, 181, 183, 185, 186, 188, 190, 192, 194,
1753 196, 199, 201, 203, 205, 207, 209, 211, 213, 215,
Nick Lewyckyd802be32008-12-19 09:41:54 +00001754 217, 219, 222, 223, 226, 228, 230, 232, 234, 235,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00001755 238, 240, 242, 244, 246, 248, 250, 252, 254, 256,
Nick Lewyckyd802be32008-12-19 09:41:54 +00001756 258, 260, 262, 263, 266, 267, 270, 271, 274, 275,
1757 279, 282, 283, 285, 286, 290, 292, 295, 297, 299,
1758 301, 303, 305, 307, 309, 311, 313, 317, 319, 322,
1759 328, 334, 340, 346, 350, 353, 359, 364, 367, 369,
1760 371, 373, 377, 379, 383, 385, 386, 388, 392, 397,
1761 401, 405, 410, 415, 419, 426, 432, 435, 438, 441,
1762 444, 447, 450, 453, 456, 459, 462, 465, 468, 475,
1763 481, 490, 497, 504, 512, 520, 528, 536, 543, 552,
1764 561, 567, 575, 579, 581, 583, 585, 587, 588, 591,
1765 598, 600, 601, 603, 606, 607, 611, 612, 616, 620,
1766 624, 628, 629, 638, 639, 649, 650, 660, 666, 669,
1767 673, 675, 679, 683, 687, 691, 693, 694, 700, 704,
1768 706, 710, 712, 713, 725, 727, 729, 734, 736, 738,
1769 741, 745, 746, 748, 750, 752, 754, 756, 758, 760,
1770 762, 764, 766, 768, 772, 776, 779, 782, 786, 789,
1771 795, 800, 802, 808, 810, 812, 814, 816, 818, 820,
1772 823, 825, 829, 832, 835, 839, 843, 846, 847, 849,
1773 852, 855, 859, 869, 879, 888, 904, 906, 908, 915,
1774 921, 924, 927, 934, 942, 947, 952, 959, 966, 967,
1775 968, 972, 975, 979, 982, 984, 990, 996, 1003, 1010,
1776 1017, 1024, 1029, 1036, 1041, 1046, 1053, 1060, 1063, 1073,
1777 1075, 1077, 1078, 1082, 1089, 1093, 1100, 1103, 1109, 1117,
1778 1123, 1128, 1133
Dan Gohmanf4423b12008-04-19 00:24:39 +00001779};
1780
1781/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1782static const yytype_int16 yyrhs[] =
1783{
Nick Lewyckyd802be32008-12-19 09:41:54 +00001784 223, 0, -1, 75, -1, 76, -1, 77, -1, 78,
Dale Johannesendfe8c842008-09-26 19:32:34 +00001785 -1, 79, -1, 80, -1, 81, -1, 82, -1, 83,
1786 -1, 87, -1, 88, -1, 89, -1, 84, -1, 85,
1787 -1, 86, -1, 120, -1, 121, -1, 122, -1, 123,
1788 -1, 124, -1, 125, -1, 126, -1, 127, -1, 128,
1789 -1, 129, -1, 130, -1, 131, -1, 94, -1, 95,
1790 -1, 96, -1, 97, -1, 98, -1, 99, -1, 100,
1791 -1, 101, -1, 102, -1, 103, -1, 104, -1, 105,
1792 -1, 106, -1, 107, -1, 108, -1, 109, -1, 110,
1793 -1, 111, -1, 112, -1, 113, -1, 100, -1, 101,
Chris Lattner740e7092008-10-15 06:16:57 +00001794 -1, 102, -1, 103, -1, 26, -1, 27, -1, 19,
Nick Lewyckyd802be32008-12-19 09:41:54 +00001795 -1, 22, -1, 24, -1, 182, -1, -1, 55, 162,
1796 4, 163, -1, -1, 182, 164, -1, -1, 7, 164,
1797 -1, 20, -1, 23, -1, 189, -1, -1, 187, 164,
Chris Lattnerf9078f92008-10-15 06:03:48 +00001798 -1, 42, -1, 44, -1, 43, -1, 45, -1, 47,
1799 -1, 49, -1, 46, -1, 48, -1, 51, -1, -1,
Nick Lewyckyd802be32008-12-19 09:41:54 +00001800 159, -1, 160, -1, 161, -1, -1, 46, -1, 48,
Chris Lattnerf9078f92008-10-15 06:03:48 +00001801 -1, -1, 42, -1, 43, -1, 44, -1, 47, -1,
1802 -1, 44, -1, 42, -1, -1, 63, -1, 64, -1,
1803 65, -1, 66, -1, 67, -1, 62, 4, -1, 142,
1804 -1, 121, -1, 141, -1, 122, -1, 144, -1, 145,
Nick Lewyckyd802be32008-12-19 09:41:54 +00001805 -1, 147, -1, 148, -1, 149, -1, 158, -1, 54,
1806 4, -1, -1, 198, 197, -1, 144, -1, 142, -1,
1807 141, -1, 147, -1, -1, 200, 199, -1, 143, -1,
1808 146, -1, 144, -1, 142, -1, 141, -1, 150, -1,
1809 151, -1, 154, -1, 155, -1, 153, -1, 156, -1,
1810 157, -1, -1, 202, 201, -1, -1, 152, 22, -1,
1811 -1, 54, 4, -1, -1, 165, 54, 4, -1, 34,
1812 22, -1, -1, 206, -1, -1, 165, 209, 208, -1,
1813 206, -1, 54, 4, -1, 11, -1, 12, -1, 13,
1814 -1, 16, -1, 15, -1, 14, -1, 17, -1, 50,
1815 -1, 210, -1, 211, 184, 166, -1, 245, -1, 167,
1816 4, -1, 211, 162, 215, 163, 202, -1, 10, 162,
1817 215, 163, 202, -1, 168, 4, 169, 211, 170, -1,
1818 171, 4, 169, 211, 172, -1, 173, 216, 174, -1,
1819 173, 174, -1, 171, 173, 216, 174, 172, -1, 171,
1820 173, 174, 172, -1, 211, 198, -1, 211, -1, 10,
1821 -1, 212, -1, 214, 165, 212, -1, 214, -1, 214,
1822 165, 39, -1, 39, -1, -1, 211, -1, 216, 165,
1823 211, -1, 211, 168, 219, 170, -1, 211, 168, 170,
1824 -1, 211, 175, 22, -1, 211, 171, 219, 172, -1,
1825 211, 173, 219, 174, -1, 211, 173, 174, -1, 211,
1826 171, 173, 219, 174, 172, -1, 211, 171, 173, 174,
1827 172, -1, 211, 40, -1, 211, 41, -1, 211, 245,
1828 -1, 211, 218, -1, 211, 25, -1, 211, 3, -1,
1829 211, 5, -1, 211, 4, -1, 211, 6, -1, 211,
1830 26, -1, 211, 27, -1, 211, 9, -1, 179, 162,
1831 217, 38, 211, 163, -1, 119, 162, 217, 257, 163,
1832 -1, 133, 162, 217, 165, 217, 165, 217, 163, -1,
1833 177, 162, 217, 165, 217, 163, -1, 178, 162, 217,
1834 165, 217, 163, -1, 90, 180, 162, 217, 165, 217,
1835 163, -1, 91, 181, 162, 217, 165, 217, 163, -1,
1836 92, 180, 162, 217, 165, 217, 163, -1, 93, 181,
1837 162, 217, 165, 217, 163, -1, 135, 162, 217, 165,
1838 217, 163, -1, 136, 162, 217, 165, 217, 165, 217,
1839 163, -1, 137, 162, 217, 165, 217, 165, 217, 163,
1840 -1, 139, 162, 217, 258, 163, -1, 140, 162, 217,
1841 165, 217, 258, 163, -1, 219, 165, 217, -1, 217,
1842 -1, 32, -1, 33, -1, 37, -1, -1, 213, 245,
1843 -1, 125, 162, 222, 38, 211, 163, -1, 224, -1,
1844 -1, 225, -1, 224, 225, -1, -1, 31, 226, 241,
1845 -1, -1, 30, 227, 242, -1, 60, 59, 231, -1,
1846 185, 18, 211, -1, 185, 18, 10, -1, -1, 188,
1847 192, 221, 220, 217, 184, 228, 208, -1, -1, 188,
1848 190, 192, 221, 220, 217, 184, 229, 208, -1, -1,
1849 188, 191, 192, 221, 220, 211, 184, 230, 208, -1,
1850 188, 192, 35, 195, 222, -1, 52, 232, -1, 56,
1851 164, 233, -1, 22, -1, 53, 164, 22, -1, 68,
1852 164, 22, -1, 168, 234, 170, -1, 234, 165, 22,
1853 -1, 22, -1, -1, 235, 165, 211, 198, 183, -1,
1854 211, 198, 183, -1, 235, -1, 235, 165, 39, -1,
1855 39, -1, -1, 196, 200, 213, 187, 162, 236, 163,
1856 202, 207, 204, 203, -1, 28, -1, 173, -1, 194,
1857 192, 237, 238, -1, 29, -1, 174, -1, 249, 240,
1858 -1, 193, 192, 237, -1, -1, 61, -1, 3, -1,
1859 4, -1, 5, -1, 6, -1, 9, -1, 26, -1,
1860 27, -1, 40, -1, 41, -1, 25, -1, 171, 219,
1861 172, -1, 168, 219, 170, -1, 168, 170, -1, 175,
1862 22, -1, 173, 219, 174, -1, 173, 174, -1, 171,
1863 173, 219, 174, 172, -1, 171, 173, 174, 172, -1,
1864 218, -1, 59, 243, 22, 165, 22, -1, 7, -1,
1865 8, -1, 182, -1, 187, -1, 245, -1, 244, -1,
1866 211, 246, -1, 247, -1, 248, 165, 247, -1, 249,
1867 250, -1, 239, 250, -1, 251, 185, 252, -1, 251,
1868 186, 252, -1, 251, 254, -1, -1, 21, -1, 69,
1869 248, -1, 69, 10, -1, 70, 17, 246, -1, 70,
1870 11, 246, 165, 17, 246, 165, 17, 246, -1, 71,
1871 11, 246, 165, 17, 246, 168, 253, 170, -1, 71,
1872 11, 246, 165, 17, 246, 168, 170, -1, 72, 196,
1873 200, 213, 246, 162, 256, 163, 202, 38, 17, 246,
1874 73, 17, 246, -1, 73, -1, 74, -1, 253, 11,
1875 244, 165, 17, 246, -1, 11, 244, 165, 17, 246,
1876 -1, 185, 260, -1, 186, 260, -1, 211, 168, 246,
1877 165, 246, 170, -1, 255, 165, 168, 246, 165, 246,
1878 170, -1, 211, 198, 246, 198, -1, 17, 198, 246,
1879 198, -1, 256, 165, 211, 198, 246, 198, -1, 256,
1880 165, 17, 198, 246, 198, -1, -1, -1, 257, 165,
1881 247, -1, 165, 4, -1, 258, 165, 4, -1, 58,
1882 57, -1, 57, -1, 177, 211, 246, 165, 246, -1,
1883 178, 211, 246, 165, 246, -1, 90, 180, 211, 246,
1884 165, 246, -1, 91, 181, 211, 246, 165, 246, -1,
1885 92, 180, 211, 246, 165, 246, -1, 93, 181, 211,
1886 246, 165, 246, -1, 179, 247, 38, 211, -1, 133,
1887 247, 165, 247, 165, 247, -1, 134, 247, 165, 211,
1888 -1, 135, 247, 165, 247, -1, 136, 247, 165, 247,
1889 165, 247, -1, 137, 247, 165, 247, 165, 247, -1,
1890 132, 255, -1, 259, 196, 200, 213, 246, 162, 256,
1891 163, 202, -1, 262, -1, 36, -1, -1, 114, 211,
1892 205, -1, 114, 211, 165, 11, 246, 205, -1, 115,
1893 211, 205, -1, 115, 211, 165, 11, 246, 205, -1,
1894 116, 247, -1, 261, 117, 211, 246, 205, -1, 261,
1895 118, 247, 165, 211, 246, 205, -1, 138, 211, 246,
1896 165, 4, -1, 119, 211, 246, 257, -1, 139, 211,
1897 246, 258, -1, 140, 211, 246, 165, 211, 246, 258,
1898 -1
Dan Gohmanf4423b12008-04-19 00:24:39 +00001899};
1900
1901/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1902static const yytype_uint16 yyrline[] =
1903{
Nuno Lopesaa386d02008-11-04 14:43:20 +00001904 0, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152,
1905 1152, 1153, 1153, 1153, 1153, 1153, 1153, 1154, 1154, 1154,
1906 1154, 1154, 1154, 1155, 1155, 1155, 1155, 1155, 1155, 1158,
1907 1158, 1159, 1159, 1160, 1160, 1161, 1161, 1162, 1162, 1166,
1908 1166, 1167, 1167, 1168, 1168, 1169, 1169, 1170, 1170, 1171,
1909 1171, 1172, 1172, 1173, 1174, 1177, 1177, 1177, 1178, 1178,
1910 1180, 1181, 1185, 1189, 1194, 1200, 1200, 1202, 1203, 1208,
1911 1214, 1215, 1216, 1217, 1218, 1219, 1223, 1224, 1225, 1229,
1912 1230, 1231, 1232, 1236, 1237, 1238, 1242, 1243, 1244, 1245,
1913 1246, 1250, 1251, 1252, 1255, 1256, 1257, 1258, 1259, 1260,
1914 1261, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276,
Nick Lewyckyd802be32008-12-19 09:41:54 +00001915 1277, 1278, 1282, 1283, 1288, 1289, 1290, 1291, 1294, 1295,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00001916 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310,
Nick Lewyckyd802be32008-12-19 09:41:54 +00001917 1311, 1312, 1315, 1316, 1322, 1323, 1330, 1331, 1339, 1340,
1918 1351, 1359, 1360, 1365, 1366, 1367, 1372, 1387, 1387, 1387,
1919 1387, 1387, 1387, 1387, 1390, 1394, 1398, 1405, 1410, 1418,
1920 1453, 1484, 1489, 1499, 1509, 1513, 1523, 1530, 1539, 1546,
1921 1551, 1556, 1563, 1564, 1571, 1578, 1586, 1592, 1604, 1632,
1922 1648, 1675, 1703, 1729, 1749, 1775, 1795, 1807, 1814, 1880,
1923 1890, 1900, 1911, 1924, 1935, 1949, 1956, 1963, 1981, 1993,
1924 2014, 2022, 2028, 2039, 2044, 2049, 2054, 2059, 2065, 2071,
1925 2077, 2085, 2096, 2100, 2108, 2108, 2111, 2111, 2114, 2126,
1926 2147, 2152, 2160, 2161, 2165, 2165, 2169, 2169, 2172, 2175,
1927 2199, 2211, 2210, 2222, 2221, 2231, 2230, 2241, 2281, 2284,
1928 2290, 2300, 2304, 2309, 2311, 2316, 2321, 2330, 2340, 2351,
1929 2355, 2364, 2373, 2378, 2527, 2527, 2529, 2538, 2538, 2540,
1930 2545, 2557, 2561, 2566, 2570, 2574, 2579, 2584, 2588, 2592,
1931 2596, 2600, 2604, 2608, 2630, 2652, 2658, 2671, 2683, 2688,
1932 2700, 2706, 2710, 2720, 2724, 2728, 2733, 2740, 2740, 2746,
1933 2755, 2760, 2765, 2769, 2778, 2787, 2800, 2809, 2813, 2821,
1934 2841, 2845, 2850, 2861, 2880, 2889, 2993, 2997, 3004, 3015,
1935 3028, 3037, 3050, 3061, 3071, 3082, 3090, 3100, 3107, 3110,
1936 3111, 3119, 3125, 3134, 3138, 3143, 3159, 3176, 3188, 3200,
1937 3214, 3228, 3240, 3261, 3268, 3274, 3280, 3286, 3301, 3411,
1938 3416, 3420, 3427, 3434, 3444, 3451, 3461, 3469, 3483, 3500,
1939 3514, 3529, 3544
Dan Gohmanf4423b12008-04-19 00:24:39 +00001940};
1941#endif
1942
1943#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1944/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1945 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1946static const char *const yytname[] =
1947{
1948 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1949 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1950 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1951 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1952 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1953 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1954 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1955 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001956 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "COMMON", "OPAQUE",
Dan Gohmanf4423b12008-04-19 00:24:39 +00001957 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1958 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1959 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
Dale Johannesendfe8c842008-09-26 19:32:34 +00001960 "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE",
1961 "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM",
1962 "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "VICMP",
1963 "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1964 "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1965 "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1966 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1967 "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1968 "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
1969 "GETRESULT", "EXTRACTVALUE", "INSERTVALUE", "SIGNEXT", "ZEROEXT",
Nick Lewyckyd802be32008-12-19 09:41:54 +00001970 "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", "NOCAPTURE", "BYVAL",
Devang Patel652203f2008-09-29 20:49:50 +00001971 "READNONE", "READONLY", "GC", "OPTSIZE", "NOINLINE", "ALWAYSINLINE",
Nick Lewyckyd802be32008-12-19 09:41:54 +00001972 "SSP", "SSPREQ", "NEST", "DEFAULT", "HIDDEN", "PROTECTED", "'('", "')'",
1973 "'='", "','", "'*'", "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'", "'{'",
1974 "'}'", "'c'", "$accept", "ArithmeticOps", "LogicalOps", "CastOps",
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00001975 "IPredicates", "FPredicates", "LocalName", "OptLocalName",
1976 "OptAddrSpace", "OptLocalAssign", "LocalNumber", "GlobalName",
1977 "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
1978 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1979 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "Attribute",
1980 "OptAttributes", "RetAttr", "OptRetAttrs", "FuncAttr", "OptFuncAttrs",
1981 "OptGC", "OptAlign", "OptCAlign", "SectionString", "OptSection",
Devang Patel652203f2008-09-29 20:49:50 +00001982 "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types",
1983 "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", "TypeListI",
1984 "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "ThreadLocal",
1985 "AliaseeRef", "Module", "DefinitionList", "Definition", "@1", "@2", "@3",
1986 "@4", "@5", "AsmBlock", "TargetDefinition", "LibrariesDefinition",
1987 "LibList", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN",
1988 "FunctionHeader", "END", "Function", "FunctionProto", "OptSideEffect",
1989 "ConstValueRef", "SymbolicValueRef", "ValueRef", "ResolvedVal",
1990 "ReturnedVal", "BasicBlockList", "BasicBlock", "InstructionList",
1991 "BBTerminatorInst", "JumpTable", "Inst", "PHIList", "ParamList",
1992 "IndexList", "ConstantIndexList", "OptTailCall", "InstVal",
Chris Lattner15bd0952008-08-29 17:20:18 +00001993 "OptVolatile", "MemoryInst", 0
Dan Gohmanf4423b12008-04-19 00:24:39 +00001994};
1995#endif
1996
1997# ifdef YYPRINT
1998/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1999 token YYLEX-NUM. */
2000static const yytype_uint16 yytoknum[] =
2001{
2002 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
2003 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
2004 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
2005 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
2006 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
2007 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
2008 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
2009 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
2010 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
2011 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
2012 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
2013 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
2014 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
2015 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
2016 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002017 405, 406, 407, 408, 409, 410, 411, 412, 413, 414,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002018 415, 416, 40, 41, 61, 44, 42, 92, 91, 120,
2019 93, 60, 62, 123, 125, 99
Dan Gohmanf4423b12008-04-19 00:24:39 +00002020};
2021# endif
2022
2023/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002024static const yytype_uint16 yyr1[] =
Dan Gohmanf4423b12008-04-19 00:24:39 +00002025{
Nick Lewyckyd802be32008-12-19 09:41:54 +00002026 0, 176, 177, 177, 177, 177, 177, 177, 177, 177,
2027 177, 178, 178, 178, 178, 178, 178, 179, 179, 179,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002028 179, 179, 179, 179, 179, 179, 179, 179, 179, 180,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002029 180, 180, 180, 180, 180, 180, 180, 180, 180, 181,
2030 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
2031 181, 181, 181, 181, 181, 182, 182, 182, 183, 183,
2032 184, 184, 185, 185, 186, 187, 187, 188, 188, 189,
2033 190, 190, 190, 190, 190, 190, 191, 191, 191, 192,
2034 192, 192, 192, 193, 193, 193, 194, 194, 194, 194,
2035 194, 195, 195, 195, 196, 196, 196, 196, 196, 196,
2036 196, 197, 197, 197, 197, 197, 197, 197, 197, 197,
2037 197, 197, 198, 198, 199, 199, 199, 199, 200, 200,
2038 201, 201, 201, 201, 201, 201, 201, 201, 201, 201,
2039 201, 201, 202, 202, 203, 203, 204, 204, 205, 205,
2040 206, 207, 207, 208, 208, 209, 209, 210, 210, 210,
2041 210, 210, 210, 210, 211, 211, 211, 211, 211, 211,
2042 211, 211, 211, 211, 211, 211, 211, 212, 213, 213,
2043 214, 214, 215, 215, 215, 215, 216, 216, 217, 217,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002044 217, 217, 217, 217, 217, 217, 217, 217, 217, 217,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002045 217, 217, 217, 217, 217, 217, 217, 217, 218, 218,
2046 218, 218, 218, 218, 218, 218, 218, 218, 218, 218,
2047 218, 218, 219, 219, 220, 220, 221, 221, 222, 222,
2048 223, 223, 224, 224, 226, 225, 227, 225, 225, 225,
2049 225, 228, 225, 229, 225, 230, 225, 225, 225, 225,
2050 231, 232, 232, 233, 234, 234, 234, 235, 235, 236,
2051 236, 236, 236, 237, 238, 238, 239, 240, 240, 241,
2052 242, 243, 243, 244, 244, 244, 244, 244, 244, 244,
2053 244, 244, 244, 244, 244, 244, 244, 244, 244, 244,
2054 244, 244, 244, 245, 245, 245, 245, 246, 246, 247,
2055 248, 248, 249, 249, 250, 250, 251, 251, 251, 252,
2056 252, 252, 252, 252, 252, 252, 252, 252, 253, 253,
2057 254, 254, 255, 255, 256, 256, 256, 256, 256, 257,
2058 257, 258, 258, 259, 259, 260, 260, 260, 260, 260,
2059 260, 260, 260, 260, 260, 260, 260, 260, 260, 260,
2060 261, 261, 262, 262, 262, 262, 262, 262, 262, 262,
2061 262, 262, 262
Dan Gohmanf4423b12008-04-19 00:24:39 +00002062};
2063
2064/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
2065static const yytype_uint8 yyr2[] =
2066{
2067 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
2068 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2069 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2070 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2071 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Chris Lattner740e7092008-10-15 06:16:57 +00002072 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
2073 4, 0, 2, 0, 2, 1, 1, 1, 0, 2,
2074 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
2075 1, 1, 1, 0, 1, 1, 0, 1, 1, 1,
2076 1, 0, 1, 1, 0, 1, 1, 1, 1, 1,
2077 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002078 1, 2, 0, 2, 1, 1, 1, 1, 0, 2,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002079 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002080 1, 1, 0, 2, 0, 2, 0, 2, 0, 3,
2081 2, 0, 1, 0, 3, 1, 2, 1, 1, 1,
2082 1, 1, 1, 1, 1, 1, 3, 1, 2, 5,
2083 5, 5, 5, 3, 2, 5, 4, 2, 1, 1,
2084 1, 3, 1, 3, 1, 0, 1, 3, 4, 3,
2085 3, 4, 4, 3, 6, 5, 2, 2, 2, 2,
2086 2, 2, 2, 2, 2, 2, 2, 2, 6, 5,
2087 8, 6, 6, 7, 7, 7, 7, 6, 8, 8,
2088 5, 7, 3, 1, 1, 1, 1, 0, 2, 6,
2089 1, 0, 1, 2, 0, 3, 0, 3, 3, 3,
2090 3, 0, 8, 0, 9, 0, 9, 5, 2, 3,
2091 1, 3, 3, 3, 3, 1, 0, 5, 3, 1,
2092 3, 1, 0, 11, 1, 1, 4, 1, 1, 2,
2093 3, 0, 1, 1, 1, 1, 1, 1, 1, 1,
2094 1, 1, 1, 3, 3, 2, 2, 3, 2, 5,
2095 4, 1, 5, 1, 1, 1, 1, 1, 1, 2,
2096 1, 3, 2, 2, 3, 3, 2, 0, 1, 2,
2097 2, 3, 9, 9, 8, 15, 1, 1, 6, 5,
2098 2, 2, 6, 7, 4, 4, 6, 6, 0, 0,
2099 3, 2, 3, 2, 1, 5, 5, 6, 6, 6,
2100 6, 4, 6, 4, 4, 6, 6, 2, 9, 1,
2101 1, 0, 3, 6, 3, 6, 2, 5, 7, 5,
2102 4, 4, 7
Dan Gohmanf4423b12008-04-19 00:24:39 +00002103};
2104
2105/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2106 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2107 means the default is an error. */
2108static const yytype_uint16 yydefact[] =
2109{
Nick Lewyckyd802be32008-12-19 09:41:54 +00002110 68, 55, 65, 56, 66, 57, 226, 224, 0, 0,
2111 0, 0, 0, 0, 79, 67, 0, 68, 222, 83,
2112 86, 0, 0, 238, 0, 0, 62, 0, 69, 70,
Chris Lattner740e7092008-10-15 06:16:57 +00002113 72, 71, 73, 76, 74, 77, 75, 78, 80, 81,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002114 82, 79, 79, 217, 1, 223, 84, 85, 79, 227,
2115 87, 88, 89, 90, 79, 297, 225, 297, 0, 0,
2116 246, 239, 240, 228, 283, 284, 230, 147, 148, 149,
2117 152, 151, 150, 153, 154, 0, 0, 0, 0, 285,
2118 286, 155, 229, 157, 217, 217, 91, 216, 0, 94,
2119 94, 298, 293, 63, 257, 258, 259, 292, 241, 242,
2120 245, 0, 175, 158, 0, 0, 0, 0, 164, 176,
2121 0, 0, 175, 0, 0, 0, 93, 92, 0, 214,
2122 215, 0, 0, 95, 96, 97, 98, 99, 118, 260,
2123 0, 0, 341, 341, 296, 0, 243, 174, 112, 170,
2124 172, 0, 0, 0, 0, 0, 0, 163, 0, 0,
2125 156, 0, 0, 169, 0, 168, 0, 237, 61, 61,
2126 100, 0, 254, 255, 256, 64, 340, 324, 0, 0,
2127 0, 0, 94, 306, 307, 2, 3, 4, 5, 6,
Chris Lattner740e7092008-10-15 06:16:57 +00002128 7, 8, 9, 10, 14, 15, 16, 11, 12, 13,
2129 0, 0, 0, 0, 0, 0, 0, 0, 17, 18,
2130 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
Nate Begemanac80ade2008-05-12 19:01:56 +00002131 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002132 0, 0, 294, 94, 310, 0, 339, 295, 311, 244,
2133 167, 0, 132, 61, 61, 166, 0, 177, 0, 132,
2134 61, 61, 0, 218, 191, 193, 192, 194, 197, 190,
2135 195, 196, 186, 187, 0, 0, 0, 0, 0, 0,
Chris Lattner740e7092008-10-15 06:16:57 +00002136 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002137 0, 0, 189, 188, 231, 116, 115, 114, 117, 119,
2138 0, 323, 300, 61, 290, 299, 0, 0, 0, 118,
Nick Lewycky02ff3082008-11-24 03:41:24 +00002139 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
2140 0, 53, 54, 49, 50, 51, 52, 39, 40, 41,
2141 42, 43, 44, 45, 46, 47, 48, 0, 0, 0,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002142 138, 138, 346, 61, 61, 337, 0, 0, 0, 0,
2143 0, 61, 61, 61, 61, 61, 0, 118, 0, 0,
Nick Lewycky02ff3082008-11-24 03:41:24 +00002144 0, 102, 104, 103, 101, 105, 106, 107, 108, 109,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002145 110, 113, 173, 171, 160, 161, 162, 165, 60, 159,
2146 233, 235, 0, 0, 0, 0, 0, 0, 0, 0,
2147 0, 0, 0, 0, 179, 213, 0, 0, 0, 183,
2148 0, 180, 0, 0, 0, 143, 0, 263, 264, 265,
2149 266, 267, 272, 268, 269, 270, 271, 261, 0, 0,
2150 0, 0, 281, 288, 287, 289, 0, 0, 301, 0,
2151 0, 61, 61, 61, 61, 0, 342, 0, 344, 319,
Chris Lattner740e7092008-10-15 06:16:57 +00002152 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002153 0, 0, 0, 0, 61, 0, 111, 124, 123, 120,
2154 122, 121, 125, 126, 129, 127, 128, 130, 131, 133,
2155 143, 143, 0, 0, 0, 0, 0, 319, 0, 0,
2156 0, 0, 0, 0, 0, 178, 164, 176, 0, 181,
2157 182, 0, 0, 0, 0, 232, 252, 262, 0, 275,
2158 0, 0, 0, 278, 0, 276, 291, 0, 0, 0,
2159 0, 0, 0, 0, 0, 0, 0, 350, 0, 0,
2160 0, 333, 334, 0, 0, 0, 0, 351, 0, 0,
2161 0, 331, 0, 138, 0, 234, 236, 61, 0, 0,
2162 0, 0, 0, 0, 0, 0, 0, 0, 0, 212,
2163 185, 0, 0, 0, 0, 0, 0, 145, 143, 251,
2164 112, 249, 0, 0, 274, 164, 0, 273, 277, 0,
2165 0, 0, 0, 0, 0, 0, 138, 139, 138, 0,
2166 0, 0, 0, 0, 0, 349, 321, 0, 61, 325,
2167 326, 0, 0, 347, 61, 219, 0, 0, 0, 0,
2168 199, 0, 0, 0, 0, 210, 0, 184, 0, 0,
2169 61, 140, 146, 144, 59, 0, 132, 0, 280, 0,
2170 0, 0, 318, 327, 328, 329, 330, 343, 345, 320,
2171 0, 0, 332, 335, 336, 322, 0, 318, 138, 0,
2172 0, 0, 0, 0, 207, 0, 0, 0, 201, 202,
2173 198, 58, 248, 250, 112, 141, 282, 279, 0, 0,
2174 112, 112, 0, 312, 0, 352, 0, 348, 203, 204,
2175 205, 206, 0, 0, 0, 211, 59, 142, 136, 0,
2176 0, 304, 0, 0, 0, 132, 0, 313, 132, 200,
2177 208, 209, 247, 0, 134, 302, 0, 0, 303, 102,
2178 104, 112, 112, 0, 112, 112, 338, 137, 0, 253,
2179 0, 0, 315, 314, 0, 0, 0, 135, 0, 0,
2180 0, 112, 112, 309, 0, 0, 317, 316, 308, 0,
2181 0, 305
Dan Gohmanf4423b12008-04-19 00:24:39 +00002182};
2183
2184/* YYDEFGOTO[NTERM-NUM]. */
2185static const yytype_int16 yydefgoto[] =
2186{
Nick Lewyckyd802be32008-12-19 09:41:54 +00002187 -1, 269, 270, 271, 300, 317, 79, 632, 113, 12,
Chris Lattner740e7092008-10-15 06:16:57 +00002188 133, 80, 14, 15, 41, 42, 43, 48, 54, 118,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002189 128, 351, 230, 279, 161, 449, 354, 689, 674, 416,
2190 537, 658, 475, 538, 81, 158, 139, 156, 140, 141,
2191 110, 375, 402, 376, 121, 88, 157, 16, 17, 18,
2192 20, 19, 385, 450, 451, 63, 23, 61, 101, 541,
2193 542, 129, 164, 55, 96, 56, 49, 478, 403, 83,
2194 405, 284, 285, 57, 92, 93, 222, 662, 134, 325,
2195 642, 497, 507, 223, 224, 225, 226
Dan Gohmanf4423b12008-04-19 00:24:39 +00002196};
2197
2198/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2199 STATE-NUM. */
Nick Lewyckyd802be32008-12-19 09:41:54 +00002200#define YYPACT_NINF -611
Dan Gohmanf4423b12008-04-19 00:24:39 +00002201static const yytype_int16 yypact[] =
2202{
Nick Lewyckyd802be32008-12-19 09:41:54 +00002203 828, -611, -611, -611, -611, -611, -611, -611, -5, -90,
2204 68, -25, 113, -20, -9, -611, 153, 1107, -611, 173,
2205 15, 36, 48, -611, -3, 196, -611, 1950, -611, -611,
2206 -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,
2207 -611, 137, 137, 190, -611, -611, -611, -611, 137, -611,
2208 -611, -611, -611, -611, 137, 203, -611, 3, 212, 215,
2209 229, -611, -611, -611, -611, -611, 83, -611, -611, -611,
2210 -611, -611, -611, -611, -611, 252, 268, 7, 87, -611,
2211 -611, -611, 73, -611, 238, 238, 186, -611, 22, 200,
2212 200, -611, -611, 42, -611, -611, -611, -611, -611, -611,
2213 -611, 8, 1765, -611, 110, 121, 573, 83, -611, 73,
2214 -114, 138, 1765, 142, 22, 22, -611, -611, 1368, -611,
2215 -611, 1991, 298, -611, -611, -611, -611, -611, -611, -611,
2216 -16, 168, 2181, 2181, -611, 311, -611, -611, 73, -611,
2217 169, 174, 1991, 1991, 164, -95, 1991, -611, 334, 178,
2218 -611, 1991, 1991, 83, 182, 73, 287, -611, 1319, 293,
2219 -611, 1680, -611, -611, -611, -611, -611, -611, 295, 2032,
2220 119, 339, 200, -611, -611, -611, -611, -611, -611, -611,
2221 -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,
2222 465, 412, 465, 412, 1991, 1991, 1991, 1991, -611, -611,
2223 -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,
2224 1991, 1991, 1991, 1991, 1991, 1991, 1991, 1991, 1991, 1991,
2225 1991, 1991, -611, 200, -611, -33, -611, -611, -611, -611,
2226 271, 1818, -611, -8, -39, -611, 181, 73, 191, -611,
2227 293, -2, 1368, -611, -611, -611, -611, -611, -611, -611,
2228 -611, -611, -611, -611, 465, 412, 465, 412, 193, 195,
2229 199, 201, 202, 205, 206, 1721, 2061, 659, 336, 210,
2230 211, 213, -611, -611, -611, -611, -611, -611, -611, -611,
2231 187, -611, 83, 973, -611, 197, 1492, 1492, 1492, -611,
2232 -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,
2233 1991, -611, -611, -611, -611, -611, -611, -611, -611, -611,
2234 -611, -611, -611, -611, -611, -611, -611, 1991, 1991, 1991,
2235 1, 17, -611, 973, -30, 214, 216, 218, 220, 221,
2236 224, 973, 973, 973, 973, 973, 322, -611, 1991, 1991,
2237 361, -611, -611, -611, -611, -611, -611, -611, -611, -611,
2238 -611, -611, -611, -611, 657, -611, -611, -611, -611, 657,
2239 -611, 142, 338, 226, 228, 232, 233, 1991, 1991, 1991,
2240 1991, 1991, 1991, 1991, -611, -611, 41, 743, 32, -611,
2241 -83, -611, 1991, 1991, 1991, 236, 240, -611, -611, -611,
2242 -611, -611, -611, -611, -611, -611, -611, 313, 1859, 2117,
2243 1023, 355, -611, -611, -611, -611, 1991, 243, -611, 245,
2244 1680, 973, 973, 973, 973, 33, -611, 35, -611, -611,
2245 1492, 235, 1991, 1991, 1991, 1991, 1991, 256, 257, 258,
2246 265, 267, 1991, 1680, 973, 269, -611, -611, -611, -611,
2247 -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,
2248 236, 236, 1991, 1991, 1991, 1991, 1991, -611, 270, 272,
2249 275, 276, 257, 284, 1991, -611, 219, 1146, -69, -611,
2250 -611, 286, 288, 340, 11, -611, 1891, -611, 383, -611,
2251 44, 1195, 43, -611, -53, -611, -611, 400, 416, 1492,
2252 289, 291, 296, 297, 1492, 432, 1492, 301, 306, 1492,
2253 307, 73, -611, 308, 309, 448, 456, 312, 1991, 1492,
2254 1492, 73, 1492, 314, 1991, -611, -611, -14, 315, 316,
2255 319, 320, 78, 1991, 1991, 1991, 1991, 94, 1991, -611,
2256 -611, 304, 1991, 1991, 1991, 441, 474, -611, 236, -611,
2257 73, 321, 324, 329, -611, 325, -52, -611, -611, 1492,
2258 1492, 345, 1492, 1492, 1492, 1492, 314, -611, 314, 1991,
2259 1492, 331, 1991, 1991, 1991, -611, -611, 494, 973, -611,
2260 -611, 365, 447, -611, 973, -611, 1991, 1991, 1991, 1991,
2261 -611, 367, 371, 370, 375, -611, 257, -611, 378, 379,
2262 126, -611, -611, -611, 198, 1932, -611, 521, -611, 372,
2263 380, 381, 2158, -611, -611, -611, -611, -611, -611, -611,
2264 377, 1492, -611, -611, -611, -611, 257, 2158, 314, 385,
2265 387, 388, 389, 1991, -611, 1991, 1991, 122, -611, -611,
2266 -611, -611, -611, -611, 73, 127, -611, -611, 536, 2,
2267 74, 73, 136, -611, 401, 312, 140, -611, -611, -611,
2268 -611, -611, 407, 409, 410, -611, 198, -611, 523, 1492,
2269 1630, -611, 4, 816, 816, -611, 2199, -611, -611, -611,
2270 -611, -611, -611, 571, 430, -611, 437, 1630, -611, 442,
2271 443, -611, -611, 349, 74, 73, 657, -611, 584, -611,
2272 592, 449, 271, 271, 595, 816, 816, -611, 1492, 599,
2273 1492, -611, -611, -611, 1492, 544, 271, 271, -611, 601,
2274 1492, -611
Dan Gohmanf4423b12008-04-19 00:24:39 +00002275};
2276
2277/* YYPGOTO[NTERM-NUM]. */
2278static const yytype_int16 yypgoto[] =
2279{
Nick Lewyckyd802be32008-12-19 09:41:54 +00002280 -611, 183, 185, 189, -166, -110, 0, -36, -116, 528,
2281 -611, 6, -611, -611, -611, -611, 27, -611, -611, -611,
2282 -145, -611, -526, -611, -260, -611, -237, -611, -611, -314,
2283 -13, -611, -420, -611, -611, -26, 393, -157, -611, 514,
2284 522, 75, -153, -258, 209, 246, 390, -611, -611, 610,
2285 -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,
2286 -611, 539, -611, -611, -611, -611, -611, -611, -610, -85,
2287 223, -193, -611, -611, 574, -611, 497, -611, -611, -611,
2288 16, 184, -452, -611, 505, -611, -611
Dan Gohmanf4423b12008-04-19 00:24:39 +00002289};
2290
2291/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2292 positive, shift that token. If negative, reduce the rule which
2293 number is the opposite. If zero, do what YYDEFACT says.
2294 If YYTABLE_NINF, syntax error. */
Nick Lewyckyd802be32008-12-19 09:41:54 +00002295#define YYTABLE_NINF -222
Dan Gohmanf4423b12008-04-19 00:24:39 +00002296static const yytype_int16 yytable[] =
2297{
Nick Lewyckyd802be32008-12-19 09:41:54 +00002298 11, 82, 359, 322, 280, 272, 13, 418, 378, 380,
2299 527, 105, 162, 660, 594, 677, 111, 11, 326, 327,
2300 328, 329, 330, 13, 91, 111, 318, 289, 336, 410,
2301 515, 516, 94, 29, 30, 31, 32, 33, 34, 35,
2302 36, 111, 37, 274, 494, 535, 496, 111, 21, 131,
2303 676, 146, 109, 111, 119, 120, 111, 50, 51, 52,
2304 147, 1, 53, 22, 3, 536, 5, 691, 84, 85,
2305 146, 243, 111, 273, 24, 89, 138, 433, 337, 236,
2306 109, 90, 464, 319, 338, 339, 138, 495, 363, 495,
2307 365, 470, 155, 11, 64, 65, 464, 107, 67, 68,
2308 69, 70, 71, 72, 73, 531, 1, 2, 656, 3,
2309 4, 5, 464, 464, 663, 664, 233, 234, 593, 468,
2310 237, 548, 599, 112, 360, 361, 241, 25, 111, -153,
2311 286, 27, 112, 356, 627, 155, 287, 74, 420, 26,
2312 480, 482, 484, 283, 28, 364, 435, 366, 112, 575,
2313 38, 39, 40, 44, 112, 692, 693, 163, 695, 696,
2314 112, 535, 355, 112, 645, 60, 415, -61, 320, 321,
2315 283, 323, 661, 135, 678, 706, 707, 95, 136, 112,
2316 106, 111, 417, -61, 324, 283, 283, 283, 283, 283,
2317 331, 332, 333, 334, 335, 283, 159, 464, 404, 573,
2318 58, 404, 404, 404, 469, 138, 464, 2, 464, 464,
2319 4, 465, 59, 486, 544, 547, 155, 1, 62, 46,
2320 3, 47, 5, 546, 91, 86, 240, 87, 116, 500,
2321 117, 502, 503, 504, 98, 112, -153, 99, 404, -61,
2322 -153, 580, 607, 559, 608, 102, 404, 404, 404, 404,
2323 404, 100, 340, 489, 75, 76, 103, 585, 77, 567,
2324 78, 108, 122, 123, 124, 125, 126, 127, 437, 438,
2325 439, 440, 104, 441, 411, 87, 512, 442, 443, 142,
2326 444, 445, 446, 447, 448, 655, 386, 567, 112, 630,
2327 143, 412, 413, 414, 64, 65, 38, 39, 40, 665,
2328 148, 666, 160, 668, 647, 666, 1, 2, 150, 3,
2329 4, 5, 434, 283, 272, 219, 219, 220, 220, 341,
2330 342, 221, 221, 151, 152, 340, 404, 404, 404, 404,
2331 114, 115, 165, 229, 231, 404, 235, 232, 238, 343,
2332 344, 239, 345, 346, 242, 347, 348, 349, 111, 404,
2333 288, 467, 281, 357, 358, 367, 350, 368, 381, 635,
2334 432, 369, 406, 370, 371, 436, 609, 372, 373, 612,
2335 613, 614, 382, 383, 477, 384, 452, 485, 534, 421,
2336 283, 422, 273, 423, 155, 424, 425, 694, 453, 426,
2337 454, 530, 341, 342, 455, 456, 283, 501, 283, 283,
2338 283, 474, 476, 499, 404, 543, 511, 155, 487, 404,
2339 488, 404, 343, 344, 404, 345, 346, 549, 347, 348,
2340 349, 505, 506, 508, 404, 404, 517, 404, 683, 350,
2341 509, 686, 510, 550, 514, 523, 557, 524, 301, 302,
2342 525, 526, 457, 458, 459, 460, 461, 462, 463, 528,
2343 540, 532, 565, 533, 552, 467, 553, 471, 472, 473,
2344 566, 554, 555, 591, 404, 404, 559, 404, 404, 404,
2345 404, 560, 562, 563, 564, 404, 587, 567, 592, 572,
2346 576, 577, 568, 404, 578, 579, 595, 596, 574, 404,
2347 437, 438, 439, 440, 597, 441, 611, 598, 615, 442,
2348 443, 495, 444, 445, 446, 447, 448, 602, 590, 407,
2349 408, 409, 303, 304, 305, 306, 307, 308, 309, 310,
2350 311, 312, 313, 314, 315, 316, 404, 617, 518, 519,
2351 520, 521, 623, 283, 624, 625, 283, 283, 283, 529,
2352 626, 628, 629, 636, 637, 638, 419, 643, 648, 639,
2353 649, 650, 651, 659, 427, 428, 429, 430, 431, 290,
2354 291, 292, 293, 294, 295, 296, 297, 298, 299, 634,
2355 669, 667, 670, 671, 404, 687, 641, 673, 404, 404,
2356 64, 65, 688, 107, 67, 68, 69, 70, 71, 72,
2357 73, 641, 1, 2, 631, 3, 4, 5, 581, 582,
2358 583, 584, 690, 586, -18, -19, 697, 588, 589, 698,
2359 404, 404, 700, 404, 699, 404, 704, 709, 710, 404,
2360 672, 132, 657, 74, 353, 404, 149, 45, 145, 130,
2361 227, 97, 362, 646, 490, 491, 492, 493, 228, 0,
2362 685, 522, 0, 498, 0, 0, 0, 0, 0, 0,
2363 0, 619, 620, 621, 622, 0, 631, 513, 0, 0,
2364 0, 0, 0, 0, 0, 0, 64, 65, 0, 107,
2365 67, 68, 69, 70, 71, 72, 73, 0, 1, 2,
2366 0, 3, 4, 5, 0, 0, 0, 0, 0, 0,
2367 0, 0, 0, 0, 0, 0, 0, 0, 652, 0,
2368 653, 654, 0, 0, 0, 0, 0, 0, 0, 74,
2369 0, 0, 551, 0, 0, 0, 0, 556, 0, 558,
2370 0, 0, 561, 0, 0, 0, 0, 0, 0, 0,
2371 0, 0, 569, 570, 0, 571, 0, 0, 0, 0,
2372 75, 76, 0, 0, 77, 0, 78, 144, 0, 0,
2373 64, 65, 0, 107, 67, 68, 69, 70, 71, 72,
2374 73, 0, 1, 2, 0, 3, 4, 5, 0, 0,
2375 0, 0, 600, 601, 0, 603, 604, 605, 606, 0,
2376 0, 0, 0, 610, 0, 0, 0, 0, 0, 0,
2377 0, 616, 0, 74, 0, 0, 0, 618, 437, 438,
2378 439, 440, 0, 441, 0, 0, 0, 442, 443, 0,
2379 444, 445, 446, 447, 448, 0, 0, 0, 0, 387,
2380 388, 389, 390, 64, 65, 391, 75, 76, -221, 0,
2381 77, 0, 78, 379, 644, 1, 2, 0, 3, 4,
2382 5, 392, 393, 394, 0, 0, -63, 1, 2, 0,
2383 3, 4, 5, 0, 0, 0, 395, 396, 6, 7,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002384 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002385 340, 0, 0, 0, 0, 397, 0, 0, 0, 0,
2386 8, 0, 675, 0, 9, 0, 681, 682, 10, 0,
2387 0, 175, 176, 177, 178, 179, 180, 181, 182, 183,
2388 184, 185, 186, 187, 188, 189, 254, 255, 256, 257,
2389 75, 76, 0, 0, 77, 0, 78, 466, 701, 702,
2390 0, 703, 0, 705, 0, 0, 0, 708, 0, 0,
2391 0, 0, 0, 711, 0, 258, 198, 679, 680, 201,
2392 202, 203, 204, 205, 206, 207, 208, 209, 0, 259,
2393 0, 260, 261, 262, 0, 263, 264, 343, 344, 0,
2394 345, 346, 0, 347, 348, 349, 0, 0, 0, 0,
2395 0, 0, 0, 0, 350, 0, 387, 388, 389, 390,
2396 64, 65, 391, 0, 398, 0, 0, 399, 0, 400,
2397 0, 401, 1, 2, 0, 3, 4, 5, 392, 393,
2398 394, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2399 0, 0, 0, 395, 396, 0, 0, 0, 0, 0,
2400 0, 0, 0, 0, 0, 0, 0, 0, 111, 0,
2401 64, 65, 397, 107, 67, 68, 69, 70, 71, 72,
2402 73, 0, 1, 2, 0, 3, 4, 5, 175, 176,
2403 177, 178, 179, 180, 181, 182, 183, 184, 185, 186,
2404 187, 188, 189, 254, 255, 256, 257, 0, 0, 0,
2405 0, 0, 0, 74, 0, 0, 0, 0, 0, 0,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002406 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002407 0, 0, 258, 198, 199, 200, 201, 202, 203, 204,
2408 205, 206, 207, 208, 209, 0, 259, -220, 260, 261,
2409 262, 0, 263, 264, 0, 0, 0, 0, 0, 0,
2410 0, 0, 0, 0, 0, -63, 1, 2, 0, 3,
2411 4, 5, 0, 0, 0, 112, 0, 6, 7, 0,
2412 0, 398, 0, 0, 399, 0, 400, 0, 401, 244,
2413 245, 246, 247, 64, 65, 248, 0, 0, 0, 8,
2414 0, 0, 0, 9, 0, 1, 2, 10, 3, 4,
Nick Lewycky02ff3082008-11-24 03:41:24 +00002415 5, 249, 250, 251, 0, 0, 0, 0, 0, 0,
2416 0, 0, 0, 0, 0, 0, 252, 253, 0, 0,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002417 75, 76, 0, 0, 77, 0, 78, 483, 0, 0,
Nick Lewycky02ff3082008-11-24 03:41:24 +00002418 0, 111, 64, 65, 0, 107, 67, 68, 69, 70,
2419 71, 72, 73, 0, 1, 2, 0, 3, 4, 5,
2420 0, 175, 176, 177, 178, 179, 180, 181, 182, 183,
2421 184, 185, 186, 187, 188, 189, 254, 255, 256, 257,
2422 0, 0, 0, 0, 0, 74, 0, 0, 0, 0,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002423 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Nick Lewycky02ff3082008-11-24 03:41:24 +00002424 0, 0, 0, 0, 0, 258, 198, 199, 200, 201,
2425 202, 203, 204, 205, 206, 207, 208, 209, 0, 259,
2426 0, 260, 261, 262, 0, 263, 264, 0, 0, 0,
Dale Johannesendfe8c842008-09-26 19:32:34 +00002427 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002428 0, 0, 0, 0, 0, 0, 0, 0, 112, 0,
2429 0, 0, -61, 0, 265, 0, 0, 266, 0, 267,
2430 0, 268, 244, 245, 246, 247, 64, 65, 248, 0,
2431 0, 0, 0, 0, 0, 0, 0, 0, 1, 2,
2432 0, 3, 4, 5, 249, 250, 251, 0, 0, 0,
2433 0, 0, 0, 0, 0, 0, 0, 0, 0, 252,
2434 253, 0, 75, 76, 0, 0, 77, 0, 78, 545,
2435 0, 0, 0, 0, 111, 64, 65, 0, 153, 67,
2436 68, 69, 70, 71, 72, 73, 0, 1, 2, 0,
2437 3, 4, 5, 0, 175, 176, 177, 178, 179, 180,
2438 181, 182, 183, 184, 185, 186, 187, 188, 189, 254,
2439 255, 256, 257, 0, 0, 0, 0, 0, 74, 0,
Nick Lewycky02ff3082008-11-24 03:41:24 +00002440 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002441 0, 0, 0, 0, 0, 0, 0, 0, 258, 198,
2442 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,
2443 209, 0, 259, 0, 260, 261, 262, 0, 263, 264,
Nick Lewycky02ff3082008-11-24 03:41:24 +00002444 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Nick Lewycky02ff3082008-11-24 03:41:24 +00002445 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002446 0, 112, 0, 0, 0, 0, 0, 265, 0, 0,
2447 266, 0, 267, 154, 268, 387, 388, 389, 390, 64,
2448 65, 391, 0, 0, 0, 0, 0, 0, 0, 0,
2449 0, 1, 2, 0, 3, 4, 5, 392, 393, 394,
2450 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2451 0, 0, 395, 396, 0, 75, 76, 0, 0, 77,
2452 0, 78, 0, 0, 0, 0, 0, 0, 0, 0,
2453 0, 397, 0, 0, 0, 0, 0, 0, 0, 0,
2454 0, 0, 0, 0, 0, 0, 0, 175, 176, 177,
2455 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
2456 188, 189, 254, 255, 256, 257, 0, 0, 0, 0,
2457 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2458 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2459 0, 258, 198, 199, 200, 201, 202, 203, 204, 205,
2460 206, 207, 208, 209, 0, 259, 0, 260, 261, 262,
2461 0, 263, 264, 387, 388, 389, 390, 0, 0, 391,
2462 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2463 0, 0, 0, 0, 0, 392, 393, 394, 0, 0,
2464 398, 0, 0, 399, 0, 400, 0, 401, 0, 0,
2465 395, 396, 0, 0, 0, 0, 0, 0, 0, 0,
2466 0, 0, 0, 0, 0, 0, 0, 64, 65, 397,
2467 153, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2468 2, 0, 3, 4, 5, 175, 176, 177, 178, 179,
Nick Lewycky02ff3082008-11-24 03:41:24 +00002469 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002470 254, 255, 256, 257, 0, 0, 0, 0, 64, 65,
2471 74, 107, 67, 68, 69, 70, 71, 72, 73, 0,
2472 1, 2, 0, 3, 4, 5, 0, 0, 0, 258,
Nick Lewycky02ff3082008-11-24 03:41:24 +00002473 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
2474 208, 209, 0, 259, 0, 260, 261, 262, 0, 263,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002475 264, 74, 64, 65, 0, 107, 67, 68, 69, 70,
2476 71, 72, 73, 0, 1, 2, 0, 3, 4, 5,
2477 0, 0, 0, 0, 0, 0, 0, 0, 398, 0,
2478 0, 399, 0, 400, 137, 401, 0, 0, 0, 0,
2479 0, 0, 0, 0, 0, 74, 0, 0, 0, 0,
2480 0, 275, 276, 0, 277, 64, 65, 278, 107, 67,
Chris Lattner740e7092008-10-15 06:16:57 +00002481 68, 69, 70, 71, 72, 73, 0, 1, 2, 0,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002482 3, 4, 5, 0, 0, 0, 0, 75, 76, 0,
2483 0, 77, 0, 78, 0, 0, 0, 352, 0, 0,
Chris Lattner740e7092008-10-15 06:16:57 +00002484 0, 0, 0, 0, 0, 0, 64, 65, 74, 107,
2485 67, 68, 69, 70, 71, 72, 73, 0, 1, 2,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002486 0, 3, 4, 5, 0, 0, 0, 0, 75, 76,
2487 0, 374, 77, 0, 78, 0, 0, 0, 64, 65,
2488 0, 107, 67, 68, 69, 70, 71, 72, 73, 74,
Bill Wendling29bc4f02008-12-17 20:59:57 +00002489 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2490 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002491 539, 0, 75, 76, 0, 0, 77, 0, 78, 64,
2492 65, 74, 107, 67, 68, 69, 70, 71, 72, 73,
2493 0, 1, 2, 0, 3, 4, 5, 64, 65, 0,
2494 66, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2495 2, 633, 3, 4, 5, 0, 0, 0, 0, 0,
2496 0, 0, 74, 0, 0, 75, 76, 0, 0, 77,
2497 0, 78, 0, 0, 0, 0, 0, 0, 64, 65,
2498 74, 107, 67, 68, 69, 70, 71, 72, 73, 0,
2499 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2500 0, 0, 0, 0, 0, 0, 75, 76, 0, 479,
2501 77, 0, 78, 0, 0, 0, 0, 0, 0, 64,
2502 65, 74, 282, 67, 68, 69, 70, 71, 72, 73,
2503 0, 1, 2, 0, 3, 4, 5, 0, 75, 76,
2504 0, 0, 77, 0, 78, 0, 0, 0, 64, 65,
2505 0, 107, 67, 68, 69, 70, 71, 72, 73, 0,
2506 1, 2, 74, 3, 4, 5, 0, 0, 0, 0,
2507 0, 0, 0, 0, 0, 0, 0, 0, 0, 75,
2508 76, 0, 0, 77, 0, 78, 0, 0, 0, 0,
2509 0, 74, 0, 0, 0, 0, 0, 75, 76, 0,
2510 0, 77, 0, 78, 64, 65, 0, 107, 67, 68,
2511 69, 70, 71, 72, 73, 0, 1, 2, 0, 3,
2512 4, 5, 0, 0, 0, 0, 0, 0, 0, 0,
2513 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2514 0, 0, 77, 0, 78, 64, 65, 74, 107, 67,
2515 68, 69, 70, 71, 72, 640, 0, 1, 2, 0,
2516 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
2517 0, 0, 0, 0, 0, 0, 0, 0, 0, 75,
2518 76, 0, 0, 77, 0, 78, 64, 65, 74, 107,
2519 67, 68, 69, 70, 71, 72, 684, 166, 1, 2,
2520 0, 3, 4, 5, 0, 0, 0, 0, 75, 76,
2521 0, 0, 77, 0, 377, 0, 0, 0, 167, 168,
2522 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2523 169, 170, 171, 172, 173, 174, 175, 176, 177, 178,
2524 179, 180, 181, 182, 183, 184, 185, 186, 187, 188,
2525 189, 190, 191, 192, 193, 0, 0, 0, 0, 0,
2526 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2527 481, 0, 0, 0, 0, 194, 195, 196, 0, 0,
2528 197, 198, 199, 200, 201, 202, 203, 204, 205, 206,
2529 207, 208, 209, 210, 211, 212, 213, 214, 215, 216,
2530 217, 218, 0, 0, 0, 75, 76, 0, 0, 77,
2531 0, 78, 0, 0, 0, 0, 0, 0, 0, 0,
Bill Wendling29bc4f02008-12-17 20:59:57 +00002532 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2533 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002534 0, 0, 0, 0, 0, 0, 75, 76, 0, 0,
2535 77, 0, 78
Dan Gohmanf4423b12008-04-19 00:24:39 +00002536};
2537
2538static const yytype_int16 yycheck[] =
2539{
Nick Lewyckyd802be32008-12-19 09:41:54 +00002540 0, 27, 239, 196, 161, 158, 0, 321, 266, 267,
2541 462, 4, 28, 11, 540, 11, 55, 17, 211, 212,
2542 213, 214, 215, 17, 21, 55, 192, 172, 221, 289,
2543 450, 451, 29, 42, 43, 44, 45, 46, 47, 48,
2544 49, 55, 51, 159, 11, 34, 11, 55, 53, 7,
2545 660, 165, 78, 55, 32, 33, 55, 42, 43, 44,
2546 174, 19, 47, 68, 22, 54, 24, 677, 41, 42,
2547 165, 156, 55, 158, 164, 48, 102, 337, 223, 174,
2548 106, 54, 165, 193, 117, 118, 112, 54, 254, 54,
2549 256, 174, 118, 93, 7, 8, 165, 10, 11, 12,
2550 13, 14, 15, 16, 17, 174, 19, 20, 634, 22,
2551 23, 24, 165, 165, 640, 641, 142, 143, 538, 377,
2552 146, 174, 174, 162, 240, 241, 152, 59, 55, 55,
2553 11, 18, 162, 172, 586, 161, 17, 50, 168, 164,
2554 398, 399, 400, 169, 164, 255, 339, 257, 162, 163,
2555 159, 160, 161, 0, 162, 681, 682, 173, 684, 685,
2556 162, 34, 170, 162, 616, 168, 165, 166, 194, 195,
2557 196, 197, 170, 165, 170, 701, 702, 174, 170, 162,
2558 173, 55, 165, 166, 210, 211, 212, 213, 214, 215,
2559 216, 217, 218, 219, 220, 221, 121, 165, 283, 513,
2560 164, 286, 287, 288, 172, 231, 165, 20, 165, 165,
2561 23, 170, 164, 406, 170, 172, 242, 19, 22, 46,
2562 22, 48, 24, 481, 21, 35, 151, 37, 42, 422,
2563 44, 424, 425, 426, 22, 162, 162, 22, 323, 166,
2564 166, 163, 556, 165, 558, 162, 331, 332, 333, 334,
2565 335, 22, 54, 410, 167, 168, 4, 163, 171, 165,
2566 173, 174, 62, 63, 64, 65, 66, 67, 141, 142,
2567 143, 144, 4, 146, 300, 37, 433, 150, 151, 169,
2568 153, 154, 155, 156, 157, 163, 280, 165, 162, 163,
2569 169, 317, 318, 319, 7, 8, 159, 160, 161, 163,
2570 162, 165, 4, 163, 618, 165, 19, 20, 166, 22,
2571 23, 24, 338, 339, 467, 132, 133, 132, 133, 121,
2572 122, 132, 133, 114, 115, 54, 411, 412, 413, 414,
2573 84, 85, 164, 22, 165, 420, 172, 163, 4, 141,
2574 142, 163, 144, 145, 162, 147, 148, 149, 55, 434,
2575 11, 377, 57, 172, 163, 162, 158, 162, 22, 596,
2576 38, 162, 165, 162, 162, 4, 559, 162, 162, 562,
2577 563, 564, 162, 162, 61, 162, 38, 22, 38, 165,
2578 406, 165, 467, 165, 410, 165, 165, 38, 162, 165,
2579 162, 172, 121, 122, 162, 162, 422, 423, 424, 425,
2580 426, 165, 162, 168, 489, 22, 432, 433, 165, 494,
2581 165, 496, 141, 142, 499, 144, 145, 17, 147, 148,
2582 149, 165, 165, 165, 509, 510, 452, 512, 665, 158,
2583 165, 668, 165, 17, 165, 165, 4, 165, 26, 27,
2584 165, 165, 367, 368, 369, 370, 371, 372, 373, 165,
2585 476, 165, 4, 165, 165, 481, 165, 382, 383, 384,
2586 4, 165, 165, 22, 549, 550, 165, 552, 553, 554,
2587 555, 165, 165, 165, 165, 560, 172, 165, 4, 165,
2588 165, 165, 508, 568, 165, 165, 165, 163, 514, 574,
2589 141, 142, 143, 144, 165, 146, 165, 172, 4, 150,
2590 151, 54, 153, 154, 155, 156, 157, 162, 534, 286,
2591 287, 288, 100, 101, 102, 103, 104, 105, 106, 107,
2592 108, 109, 110, 111, 112, 113, 611, 162, 453, 454,
2593 455, 456, 165, 559, 163, 165, 562, 563, 564, 464,
2594 165, 163, 163, 22, 172, 165, 323, 170, 163, 168,
2595 163, 163, 163, 17, 331, 332, 333, 334, 335, 94,
2596 95, 96, 97, 98, 99, 100, 101, 102, 103, 595,
2597 163, 170, 163, 163, 659, 4, 602, 54, 663, 664,
2598 7, 8, 152, 10, 11, 12, 13, 14, 15, 16,
2599 17, 617, 19, 20, 594, 22, 23, 24, 523, 524,
2600 525, 526, 165, 528, 162, 162, 22, 532, 533, 17,
2601 695, 696, 17, 698, 165, 700, 17, 73, 17, 704,
2602 656, 93, 635, 50, 231, 710, 112, 17, 106, 90,
2603 133, 57, 242, 617, 411, 412, 413, 414, 133, -1,
2604 666, 457, -1, 420, -1, -1, -1, -1, -1, -1,
2605 -1, 576, 577, 578, 579, -1, 656, 434, -1, -1,
2606 -1, -1, -1, -1, -1, -1, 7, 8, -1, 10,
2607 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2608 -1, 22, 23, 24, -1, -1, -1, -1, -1, -1,
2609 -1, -1, -1, -1, -1, -1, -1, -1, 623, -1,
2610 625, 626, -1, -1, -1, -1, -1, -1, -1, 50,
2611 -1, -1, 489, -1, -1, -1, -1, 494, -1, 496,
2612 -1, -1, 499, -1, -1, -1, -1, -1, -1, -1,
2613 -1, -1, 509, 510, -1, 512, -1, -1, -1, -1,
2614 167, 168, -1, -1, 171, -1, 173, 174, -1, -1,
2615 7, 8, -1, 10, 11, 12, 13, 14, 15, 16,
2616 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
2617 -1, -1, 549, 550, -1, 552, 553, 554, 555, -1,
2618 -1, -1, -1, 560, -1, -1, -1, -1, -1, -1,
2619 -1, 568, -1, 50, -1, -1, -1, 574, 141, 142,
Nick Lewycky02ff3082008-11-24 03:41:24 +00002620 143, 144, -1, 146, -1, -1, -1, 150, 151, -1,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002621 153, 154, 155, 156, 157, -1, -1, -1, -1, 3,
2622 4, 5, 6, 7, 8, 9, 167, 168, 0, -1,
2623 171, -1, 173, 174, 611, 19, 20, -1, 22, 23,
2624 24, 25, 26, 27, -1, -1, 18, 19, 20, -1,
2625 22, 23, 24, -1, -1, -1, 40, 41, 30, 31,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002626 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002627 54, -1, -1, -1, -1, 59, -1, -1, -1, -1,
2628 52, -1, 659, -1, 56, -1, 663, 664, 60, -1,
2629 -1, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2630 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
2631 167, 168, -1, -1, 171, -1, 173, 174, 695, 696,
2632 -1, 698, -1, 700, -1, -1, -1, 704, -1, -1,
2633 -1, -1, -1, 710, -1, 119, 120, 121, 122, 123,
2634 124, 125, 126, 127, 128, 129, 130, 131, -1, 133,
2635 -1, 135, 136, 137, -1, 139, 140, 141, 142, -1,
2636 144, 145, -1, 147, 148, 149, -1, -1, -1, -1,
2637 -1, -1, -1, -1, 158, -1, 3, 4, 5, 6,
2638 7, 8, 9, -1, 168, -1, -1, 171, -1, 173,
2639 -1, 175, 19, 20, -1, 22, 23, 24, 25, 26,
2640 27, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2641 -1, -1, -1, 40, 41, -1, -1, -1, -1, -1,
2642 -1, -1, -1, -1, -1, -1, -1, -1, 55, -1,
2643 7, 8, 59, 10, 11, 12, 13, 14, 15, 16,
2644 17, -1, 19, 20, -1, 22, 23, 24, 75, 76,
2645 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2646 87, 88, 89, 90, 91, 92, 93, -1, -1, -1,
2647 -1, -1, -1, 50, -1, -1, -1, -1, -1, -1,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002648 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002649 -1, -1, 119, 120, 121, 122, 123, 124, 125, 126,
2650 127, 128, 129, 130, 131, -1, 133, 0, 135, 136,
2651 137, -1, 139, 140, -1, -1, -1, -1, -1, -1,
2652 -1, -1, -1, -1, -1, 18, 19, 20, -1, 22,
2653 23, 24, -1, -1, -1, 162, -1, 30, 31, -1,
2654 -1, 168, -1, -1, 171, -1, 173, -1, 175, 3,
2655 4, 5, 6, 7, 8, 9, -1, -1, -1, 52,
2656 -1, -1, -1, 56, -1, 19, 20, 60, 22, 23,
Nick Lewycky02ff3082008-11-24 03:41:24 +00002657 24, 25, 26, 27, -1, -1, -1, -1, -1, -1,
2658 -1, -1, -1, -1, -1, -1, 40, 41, -1, -1,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002659 167, 168, -1, -1, 171, -1, 173, 174, -1, -1,
Nick Lewycky02ff3082008-11-24 03:41:24 +00002660 -1, 55, 7, 8, -1, 10, 11, 12, 13, 14,
2661 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2662 -1, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2663 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
2664 -1, -1, -1, -1, -1, 50, -1, -1, -1, -1,
Chris Lattner740e7092008-10-15 06:16:57 +00002665 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Nick Lewycky02ff3082008-11-24 03:41:24 +00002666 -1, -1, -1, -1, -1, 119, 120, 121, 122, 123,
2667 124, 125, 126, 127, 128, 129, 130, 131, -1, 133,
2668 -1, 135, 136, 137, -1, 139, 140, -1, -1, -1,
Devang Patel652203f2008-09-29 20:49:50 +00002669 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002670 -1, -1, -1, -1, -1, -1, -1, -1, 162, -1,
2671 -1, -1, 166, -1, 168, -1, -1, 171, -1, 173,
2672 -1, 175, 3, 4, 5, 6, 7, 8, 9, -1,
2673 -1, -1, -1, -1, -1, -1, -1, -1, 19, 20,
2674 -1, 22, 23, 24, 25, 26, 27, -1, -1, -1,
2675 -1, -1, -1, -1, -1, -1, -1, -1, -1, 40,
2676 41, -1, 167, 168, -1, -1, 171, -1, 173, 174,
2677 -1, -1, -1, -1, 55, 7, 8, -1, 10, 11,
2678 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2679 22, 23, 24, -1, 75, 76, 77, 78, 79, 80,
2680 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2681 91, 92, 93, -1, -1, -1, -1, -1, 50, -1,
Nick Lewycky02ff3082008-11-24 03:41:24 +00002682 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002683 -1, -1, -1, -1, -1, -1, -1, -1, 119, 120,
2684 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
2685 131, -1, 133, -1, 135, 136, 137, -1, 139, 140,
Nick Lewycky02ff3082008-11-24 03:41:24 +00002686 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Nick Lewycky02ff3082008-11-24 03:41:24 +00002687 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002688 -1, 162, -1, -1, -1, -1, -1, 168, -1, -1,
2689 171, -1, 173, 125, 175, 3, 4, 5, 6, 7,
2690 8, 9, -1, -1, -1, -1, -1, -1, -1, -1,
2691 -1, 19, 20, -1, 22, 23, 24, 25, 26, 27,
2692 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2693 -1, -1, 40, 41, -1, 167, 168, -1, -1, 171,
2694 -1, 173, -1, -1, -1, -1, -1, -1, -1, -1,
2695 -1, 59, -1, -1, -1, -1, -1, -1, -1, -1,
2696 -1, -1, -1, -1, -1, -1, -1, 75, 76, 77,
2697 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2698 88, 89, 90, 91, 92, 93, -1, -1, -1, -1,
2699 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2700 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2701 -1, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2702 128, 129, 130, 131, -1, 133, -1, 135, 136, 137,
2703 -1, 139, 140, 3, 4, 5, 6, -1, -1, 9,
2704 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2705 -1, -1, -1, -1, -1, 25, 26, 27, -1, -1,
2706 168, -1, -1, 171, -1, 173, -1, 175, -1, -1,
2707 40, 41, -1, -1, -1, -1, -1, -1, -1, -1,
2708 -1, -1, -1, -1, -1, -1, -1, 7, 8, 59,
2709 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2710 20, -1, 22, 23, 24, 75, 76, 77, 78, 79,
Nick Lewycky02ff3082008-11-24 03:41:24 +00002711 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002712 90, 91, 92, 93, -1, -1, -1, -1, 7, 8,
2713 50, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2714 19, 20, -1, 22, 23, 24, -1, -1, -1, 119,
Nick Lewycky02ff3082008-11-24 03:41:24 +00002715 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
2716 130, 131, -1, 133, -1, 135, 136, 137, -1, 139,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002717 140, 50, 7, 8, -1, 10, 11, 12, 13, 14,
2718 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2719 -1, -1, -1, -1, -1, -1, -1, -1, 168, -1,
2720 -1, 171, -1, 173, 39, 175, -1, -1, -1, -1,
2721 -1, -1, -1, -1, -1, 50, -1, -1, -1, -1,
2722 -1, 141, 142, -1, 144, 7, 8, 147, 10, 11,
Bill Wendling29bc4f02008-12-17 20:59:57 +00002723 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002724 22, 23, 24, -1, -1, -1, -1, 167, 168, -1,
2725 -1, 171, -1, 173, -1, -1, -1, 39, -1, -1,
Bill Wendling29bc4f02008-12-17 20:59:57 +00002726 -1, -1, -1, -1, -1, -1, 7, 8, 50, 10,
2727 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002728 -1, 22, 23, 24, -1, -1, -1, -1, 167, 168,
2729 -1, 170, 171, -1, 173, -1, -1, -1, 7, 8,
2730 -1, 10, 11, 12, 13, 14, 15, 16, 17, 50,
Bill Wendling29bc4f02008-12-17 20:59:57 +00002731 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002732 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002733 39, -1, 167, 168, -1, -1, 171, -1, 173, 7,
2734 8, 50, 10, 11, 12, 13, 14, 15, 16, 17,
2735 -1, 19, 20, -1, 22, 23, 24, 7, 8, -1,
2736 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2737 20, 39, 22, 23, 24, -1, -1, -1, -1, -1,
2738 -1, -1, 50, -1, -1, 167, 168, -1, -1, 171,
2739 -1, 173, -1, -1, -1, -1, -1, -1, 7, 8,
2740 50, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2741 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
2742 -1, -1, -1, -1, -1, -1, 167, 168, -1, 170,
2743 171, -1, 173, -1, -1, -1, -1, -1, -1, 7,
2744 8, 50, 10, 11, 12, 13, 14, 15, 16, 17,
2745 -1, 19, 20, -1, 22, 23, 24, -1, 167, 168,
2746 -1, -1, 171, -1, 173, -1, -1, -1, 7, 8,
2747 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2748 19, 20, 50, 22, 23, 24, -1, -1, -1, -1,
2749 -1, -1, -1, -1, -1, -1, -1, -1, -1, 167,
2750 168, -1, -1, 171, -1, 173, -1, -1, -1, -1,
2751 -1, 50, -1, -1, -1, -1, -1, 167, 168, -1,
2752 -1, 171, -1, 173, 7, 8, -1, 10, 11, 12,
2753 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2754 23, 24, -1, -1, -1, -1, -1, -1, -1, -1,
2755 -1, -1, -1, -1, -1, -1, -1, -1, 167, 168,
2756 -1, -1, 171, -1, 173, 7, 8, 50, 10, 11,
2757 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2758 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
2759 -1, -1, -1, -1, -1, -1, -1, -1, -1, 167,
2760 168, -1, -1, 171, -1, 173, 7, 8, 50, 10,
2761 11, 12, 13, 14, 15, 16, 17, 36, 19, 20,
2762 -1, 22, 23, 24, -1, -1, -1, -1, 167, 168,
2763 -1, -1, 171, -1, 173, -1, -1, -1, 57, 58,
2764 -1, -1, -1, -1, -1, -1, -1, -1, -1, 50,
2765 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
2766 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2767 89, 90, 91, 92, 93, -1, -1, -1, -1, -1,
2768 -1, -1, -1, -1, 167, 168, -1, -1, 171, -1,
2769 173, -1, -1, -1, -1, 114, 115, 116, -1, -1,
2770 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
2771 129, 130, 131, 132, 133, 134, 135, 136, 137, 138,
2772 139, 140, -1, -1, -1, 167, 168, -1, -1, 171,
2773 -1, 173, -1, -1, -1, -1, -1, -1, -1, -1,
Bill Wendling29bc4f02008-12-17 20:59:57 +00002774 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2775 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002776 -1, -1, -1, -1, -1, -1, 167, 168, -1, -1,
2777 171, -1, 173
Dan Gohmanf4423b12008-04-19 00:24:39 +00002778};
2779
2780/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2781 symbol of state STATE-NUM. */
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002782static const yytype_uint16 yystos[] =
Dan Gohmanf4423b12008-04-19 00:24:39 +00002783{
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002784 0, 19, 20, 22, 23, 24, 30, 31, 52, 56,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002785 60, 182, 185, 187, 188, 189, 223, 224, 225, 227,
2786 226, 53, 68, 232, 164, 59, 164, 18, 164, 42,
2787 43, 44, 45, 46, 47, 48, 49, 51, 159, 160,
2788 161, 190, 191, 192, 0, 225, 46, 48, 193, 242,
2789 42, 43, 44, 47, 194, 239, 241, 249, 164, 164,
2790 168, 233, 22, 231, 7, 8, 10, 11, 12, 13,
2791 14, 15, 16, 17, 50, 167, 168, 171, 173, 182,
2792 187, 210, 211, 245, 192, 192, 35, 37, 221, 192,
2793 192, 21, 250, 251, 29, 174, 240, 250, 22, 22,
2794 22, 234, 162, 4, 4, 4, 173, 10, 174, 211,
2795 216, 55, 162, 184, 221, 221, 42, 44, 195, 32,
2796 33, 220, 62, 63, 64, 65, 66, 67, 196, 237,
2797 237, 7, 185, 186, 254, 165, 170, 39, 211, 212,
2798 214, 215, 169, 169, 174, 216, 165, 174, 162, 215,
2799 166, 220, 220, 10, 125, 211, 213, 222, 211, 217,
2800 4, 200, 28, 173, 238, 164, 36, 57, 58, 69,
Chris Lattner740e7092008-10-15 06:16:57 +00002801 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2802 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2803 90, 91, 92, 93, 114, 115, 116, 119, 120, 121,
2804 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002805 132, 133, 134, 135, 136, 137, 138, 139, 140, 177,
2806 178, 179, 252, 259, 260, 261, 262, 252, 260, 22,
2807 198, 165, 163, 211, 211, 172, 174, 211, 4, 163,
2808 217, 211, 162, 245, 3, 4, 5, 6, 9, 25,
Chris Lattner740e7092008-10-15 06:16:57 +00002809 26, 27, 40, 41, 90, 91, 92, 93, 119, 133,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002810 135, 136, 137, 139, 140, 168, 171, 173, 175, 177,
2811 178, 179, 218, 245, 184, 141, 142, 144, 147, 199,
2812 213, 57, 10, 211, 247, 248, 11, 17, 11, 196,
Nick Lewycky02ff3082008-11-24 03:41:24 +00002813 94, 95, 96, 97, 98, 99, 100, 101, 102, 103,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002814 180, 26, 27, 100, 101, 102, 103, 104, 105, 106,
2815 107, 108, 109, 110, 111, 112, 113, 181, 180, 181,
2816 211, 211, 247, 211, 211, 255, 247, 247, 247, 247,
2817 247, 211, 211, 211, 211, 211, 247, 196, 117, 118,
Nick Lewycky02ff3082008-11-24 03:41:24 +00002818 54, 121, 122, 141, 142, 144, 145, 147, 148, 149,
Nick Lewyckyd802be32008-12-19 09:41:54 +00002819 158, 197, 39, 212, 202, 170, 172, 172, 163, 202,
2820 184, 184, 222, 180, 181, 180, 181, 162, 162, 162,
2821 162, 162, 162, 162, 170, 217, 219, 173, 219, 174,
2822 219, 22, 162, 162, 162, 228, 187, 3, 4, 5,
2823 6, 9, 25, 26, 27, 40, 41, 59, 168, 171,
2824 173, 175, 218, 244, 245, 246, 165, 246, 246, 246,
2825 200, 211, 211, 211, 211, 165, 205, 165, 205, 246,
2826 168, 165, 165, 165, 165, 165, 165, 246, 246, 246,
2827 246, 246, 38, 200, 211, 247, 4, 141, 142, 143,
2828 144, 146, 150, 151, 153, 154, 155, 156, 157, 201,
2829 229, 230, 38, 162, 162, 162, 162, 217, 217, 217,
2830 217, 217, 217, 217, 165, 170, 174, 211, 219, 172,
2831 174, 217, 217, 217, 165, 208, 162, 61, 243, 170,
2832 219, 173, 219, 174, 219, 22, 247, 165, 165, 213,
2833 246, 246, 246, 246, 11, 54, 11, 257, 246, 168,
2834 247, 211, 247, 247, 247, 165, 165, 258, 165, 165,
2835 165, 211, 213, 246, 165, 208, 208, 211, 217, 217,
2836 217, 217, 257, 165, 165, 165, 165, 258, 165, 217,
2837 172, 174, 165, 165, 38, 34, 54, 206, 209, 39,
2838 211, 235, 236, 22, 170, 174, 219, 172, 174, 17,
2839 17, 246, 165, 165, 165, 165, 246, 4, 246, 165,
2840 165, 246, 165, 165, 165, 4, 4, 165, 211, 246,
2841 246, 246, 165, 205, 211, 163, 165, 165, 165, 165,
2842 163, 217, 217, 217, 217, 163, 217, 172, 217, 217,
2843 211, 22, 4, 208, 198, 165, 163, 165, 172, 174,
2844 246, 246, 162, 246, 246, 246, 246, 205, 205, 247,
2845 246, 165, 247, 247, 247, 4, 246, 162, 246, 217,
2846 217, 217, 217, 165, 163, 165, 165, 258, 163, 163,
2847 163, 182, 183, 39, 211, 202, 22, 172, 165, 168,
2848 17, 211, 256, 170, 246, 258, 256, 205, 163, 163,
2849 163, 163, 217, 217, 217, 163, 198, 206, 207, 17,
2850 11, 170, 253, 198, 198, 163, 165, 170, 163, 163,
2851 163, 163, 183, 54, 204, 246, 244, 11, 170, 121,
2852 122, 246, 246, 202, 17, 211, 202, 4, 152, 203,
2853 165, 244, 198, 198, 38, 198, 198, 22, 17, 165,
2854 17, 246, 246, 246, 17, 246, 198, 198, 246, 73,
2855 17, 246
Dan Gohmanf4423b12008-04-19 00:24:39 +00002856};
David Greene718fda32007-08-01 03:59:32 +00002857
Reid Spencer68a24bd2005-08-27 18:50:39 +00002858#define yyerrok (yyerrstatus = 0)
2859#define yyclearin (yychar = YYEMPTY)
Dan Gohmanf4423b12008-04-19 00:24:39 +00002860#define YYEMPTY (-2)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002861#define YYEOF 0
Dan Gohmanf4423b12008-04-19 00:24:39 +00002862
Reid Spencer68a24bd2005-08-27 18:50:39 +00002863#define YYACCEPT goto yyacceptlab
Dan Gohmanf4423b12008-04-19 00:24:39 +00002864#define YYABORT goto yyabortlab
2865#define YYERROR goto yyerrorlab
2866
2867
2868/* Like YYERROR except do call yyerror. This remains here temporarily
2869 to ease the transition to the new meaning of YYERROR, for GCC.
Reid Spencer68a24bd2005-08-27 18:50:39 +00002870 Once GCC version 2 has supplanted version 1, this can go. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00002871
Reid Spencer68a24bd2005-08-27 18:50:39 +00002872#define YYFAIL goto yyerrlab
Dan Gohmanf4423b12008-04-19 00:24:39 +00002873
Reid Spencer68a24bd2005-08-27 18:50:39 +00002874#define YYRECOVERING() (!!yyerrstatus)
Dan Gohmanf4423b12008-04-19 00:24:39 +00002875
2876#define YYBACKUP(Token, Value) \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002877do \
2878 if (yychar == YYEMPTY && yylen == 1) \
Dan Gohmanf4423b12008-04-19 00:24:39 +00002879 { \
2880 yychar = (Token); \
2881 yylval = (Value); \
2882 yytoken = YYTRANSLATE (yychar); \
2883 YYPOPSTACK (1); \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002884 goto yybackup; \
2885 } \
2886 else \
Dan Gohmanf4423b12008-04-19 00:24:39 +00002887 { \
2888 yyerror (YY_("syntax error: cannot back up")); \
2889 YYERROR; \
2890 } \
2891while (YYID (0))
2892
Anton Korobeynikov38e09802007-04-28 13:48:45 +00002893
Reid Spencer68a24bd2005-08-27 18:50:39 +00002894#define YYTERROR 1
2895#define YYERRCODE 256
2896
Dan Gohmanf4423b12008-04-19 00:24:39 +00002897
2898/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2899 If N is 0, then set CURRENT to the empty location which ends
2900 the previous symbol: RHS[0] (always defined). */
2901
2902#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2903#ifndef YYLLOC_DEFAULT
2904# define YYLLOC_DEFAULT(Current, Rhs, N) \
2905 do \
2906 if (YYID (N)) \
2907 { \
2908 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2909 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2910 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2911 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2912 } \
2913 else \
2914 { \
2915 (Current).first_line = (Current).last_line = \
2916 YYRHSLOC (Rhs, 0).last_line; \
2917 (Current).first_column = (Current).last_column = \
2918 YYRHSLOC (Rhs, 0).last_column; \
2919 } \
2920 while (YYID (0))
Reid Spencer68a24bd2005-08-27 18:50:39 +00002921#endif
2922
Dan Gohmanf4423b12008-04-19 00:24:39 +00002923
2924/* YY_LOCATION_PRINT -- Print the location on the stream.
2925 This macro was not mandated originally: define only if we know
2926 we won't break user code: when these are the locations we know. */
2927
2928#ifndef YY_LOCATION_PRINT
Nick Lewycky02ff3082008-11-24 03:41:24 +00002929# if YYLTYPE_IS_TRIVIAL
Dan Gohmanf4423b12008-04-19 00:24:39 +00002930# define YY_LOCATION_PRINT(File, Loc) \
2931 fprintf (File, "%d.%d-%d.%d", \
2932 (Loc).first_line, (Loc).first_column, \
2933 (Loc).last_line, (Loc).last_column)
2934# else
2935# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2936# endif
2937#endif
2938
2939
2940/* YYLEX -- calling `yylex' with the right arguments. */
2941
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00002942#ifdef YYLEX_PARAM
Dan Gohmanf4423b12008-04-19 00:24:39 +00002943# define YYLEX yylex (YYLEX_PARAM)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00002944#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00002945# define YYLEX yylex ()
Gabor Greife64d2482008-04-06 23:07:54 +00002946#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002947
2948/* Enable debugging if requested. */
2949#if YYDEBUG
2950
2951# ifndef YYFPRINTF
2952# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2953# define YYFPRINTF fprintf
2954# endif
2955
2956# define YYDPRINTF(Args) \
2957do { \
2958 if (yydebug) \
2959 YYFPRINTF Args; \
2960} while (YYID (0))
2961
2962# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2963do { \
2964 if (yydebug) \
2965 { \
2966 YYFPRINTF (stderr, "%s ", Title); \
2967 yy_symbol_print (stderr, \
2968 Type, Value); \
2969 YYFPRINTF (stderr, "\n"); \
2970 } \
2971} while (YYID (0))
2972
2973
2974/*--------------------------------.
2975| Print this symbol on YYOUTPUT. |
2976`--------------------------------*/
2977
2978/*ARGSUSED*/
2979#if (defined __STDC__ || defined __C99__FUNC__ \
2980 || defined __cplusplus || defined _MSC_VER)
2981static void
2982yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
Gabor Greife64d2482008-04-06 23:07:54 +00002983#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00002984static void
2985yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2986 FILE *yyoutput;
2987 int yytype;
2988 YYSTYPE const * const yyvaluep;
Gabor Greife64d2482008-04-06 23:07:54 +00002989#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002990{
2991 if (!yyvaluep)
2992 return;
2993# ifdef YYPRINT
2994 if (yytype < YYNTOKENS)
2995 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2996# else
2997 YYUSE (yyoutput);
2998# endif
2999 switch (yytype)
3000 {
3001 default:
3002 break;
3003 }
3004}
3005
3006
3007/*--------------------------------.
3008| Print this symbol on YYOUTPUT. |
3009`--------------------------------*/
3010
3011#if (defined __STDC__ || defined __C99__FUNC__ \
3012 || defined __cplusplus || defined _MSC_VER)
3013static void
3014yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
3015#else
3016static void
3017yy_symbol_print (yyoutput, yytype, yyvaluep)
3018 FILE *yyoutput;
3019 int yytype;
3020 YYSTYPE const * const yyvaluep;
Scott Michel15dcd8e2008-01-30 03:10:00 +00003021#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003022{
3023 if (yytype < YYNTOKENS)
3024 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
3025 else
3026 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
Chris Lattner38905612008-02-19 04:36:25 +00003027
Dan Gohmanf4423b12008-04-19 00:24:39 +00003028 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
3029 YYFPRINTF (yyoutput, ")");
3030}
Chris Lattner38905612008-02-19 04:36:25 +00003031
Dan Gohmanf4423b12008-04-19 00:24:39 +00003032/*------------------------------------------------------------------.
3033| yy_stack_print -- Print the state stack from its BOTTOM up to its |
3034| TOP (included). |
3035`------------------------------------------------------------------*/
Chris Lattner38905612008-02-19 04:36:25 +00003036
Dan Gohmanf4423b12008-04-19 00:24:39 +00003037#if (defined __STDC__ || defined __C99__FUNC__ \
3038 || defined __cplusplus || defined _MSC_VER)
3039static void
3040yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
3041#else
3042static void
3043yy_stack_print (bottom, top)
3044 yytype_int16 *bottom;
3045 yytype_int16 *top;
Scott Michel15dcd8e2008-01-30 03:10:00 +00003046#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003047{
3048 YYFPRINTF (stderr, "Stack now");
3049 for (; bottom <= top; ++bottom)
3050 YYFPRINTF (stderr, " %d", *bottom);
3051 YYFPRINTF (stderr, "\n");
3052}
Chris Lattner38905612008-02-19 04:36:25 +00003053
Dan Gohmanf4423b12008-04-19 00:24:39 +00003054# define YY_STACK_PRINT(Bottom, Top) \
3055do { \
3056 if (yydebug) \
3057 yy_stack_print ((Bottom), (Top)); \
3058} while (YYID (0))
Chris Lattner38905612008-02-19 04:36:25 +00003059
Dan Gohmanf4423b12008-04-19 00:24:39 +00003060
3061/*------------------------------------------------.
3062| Report that the YYRULE is going to be reduced. |
3063`------------------------------------------------*/
3064
3065#if (defined __STDC__ || defined __C99__FUNC__ \
3066 || defined __cplusplus || defined _MSC_VER)
3067static void
3068yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
3069#else
3070static void
3071yy_reduce_print (yyvsp, yyrule)
3072 YYSTYPE *yyvsp;
3073 int yyrule;
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00003074#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003075{
3076 int yynrhs = yyr2[yyrule];
3077 int yyi;
3078 unsigned long int yylno = yyrline[yyrule];
3079 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
3080 yyrule - 1, yylno);
3081 /* The symbols being reduced. */
3082 for (yyi = 0; yyi < yynrhs; yyi++)
3083 {
3084 fprintf (stderr, " $%d = ", yyi + 1);
3085 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
3086 &(yyvsp[(yyi + 1) - (yynrhs)])
3087 );
3088 fprintf (stderr, "\n");
3089 }
3090}
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003091
Dan Gohmanf4423b12008-04-19 00:24:39 +00003092# define YY_REDUCE_PRINT(Rule) \
3093do { \
3094 if (yydebug) \
3095 yy_reduce_print (yyvsp, Rule); \
3096} while (YYID (0))
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003097
Dan Gohmanf4423b12008-04-19 00:24:39 +00003098/* Nonzero means print parse trace. It is left uninitialized so that
3099 multiple parsers can coexist. */
3100int yydebug;
3101#else /* !YYDEBUG */
3102# define YYDPRINTF(Args)
3103# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
3104# define YY_STACK_PRINT(Bottom, Top)
3105# define YY_REDUCE_PRINT(Rule)
3106#endif /* !YYDEBUG */
3107
3108
3109/* YYINITDEPTH -- initial size of the parser's stacks. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003110#ifndef YYINITDEPTH
Dan Gohmanf4423b12008-04-19 00:24:39 +00003111# define YYINITDEPTH 200
Reid Spencer68a24bd2005-08-27 18:50:39 +00003112#endif
3113
Dan Gohmanf4423b12008-04-19 00:24:39 +00003114/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
3115 if the built-in stack extension method is used).
Reid Spencer68a24bd2005-08-27 18:50:39 +00003116
Dan Gohmanf4423b12008-04-19 00:24:39 +00003117 Do not make this value too large; the results are undefined if
3118 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
3119 evaluated with infinite-precision integer arithmetic. */
David Greene718fda32007-08-01 03:59:32 +00003120
Reid Spencer68a24bd2005-08-27 18:50:39 +00003121#ifndef YYMAXDEPTH
Dan Gohmanf4423b12008-04-19 00:24:39 +00003122# define YYMAXDEPTH 10000
Reid Spencer68a24bd2005-08-27 18:50:39 +00003123#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003124
Reid Spencer68a24bd2005-08-27 18:50:39 +00003125
3126
Dan Gohmanf4423b12008-04-19 00:24:39 +00003127#if YYERROR_VERBOSE
Reid Spencer68a24bd2005-08-27 18:50:39 +00003128
Dan Gohmanf4423b12008-04-19 00:24:39 +00003129# ifndef yystrlen
3130# if defined __GLIBC__ && defined _STRING_H
3131# define yystrlen strlen
3132# else
3133/* Return the length of YYSTR. */
3134#if (defined __STDC__ || defined __C99__FUNC__ \
3135 || defined __cplusplus || defined _MSC_VER)
3136static YYSIZE_T
3137yystrlen (const char *yystr)
Chris Lattner38905612008-02-19 04:36:25 +00003138#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00003139static YYSIZE_T
3140yystrlen (yystr)
3141 const char *yystr;
3142#endif
3143{
3144 YYSIZE_T yylen;
3145 for (yylen = 0; yystr[yylen]; yylen++)
3146 continue;
3147 return yylen;
3148}
3149# endif
3150# endif
3151
3152# ifndef yystpcpy
3153# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
3154# define yystpcpy stpcpy
3155# else
3156/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
3157 YYDEST. */
3158#if (defined __STDC__ || defined __C99__FUNC__ \
3159 || defined __cplusplus || defined _MSC_VER)
3160static char *
3161yystpcpy (char *yydest, const char *yysrc)
3162#else
3163static char *
3164yystpcpy (yydest, yysrc)
3165 char *yydest;
3166 const char *yysrc;
3167#endif
3168{
3169 char *yyd = yydest;
3170 const char *yys = yysrc;
3171
3172 while ((*yyd++ = *yys++) != '\0')
3173 continue;
3174
3175 return yyd - 1;
3176}
3177# endif
3178# endif
3179
3180# ifndef yytnamerr
3181/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3182 quotes and backslashes, so that it's suitable for yyerror. The
3183 heuristic is that double-quoting is unnecessary unless the string
3184 contains an apostrophe, a comma, or backslash (other than
3185 backslash-backslash). YYSTR is taken from yytname. If YYRES is
3186 null, do not copy; instead, return the length of what the result
3187 would have been. */
3188static YYSIZE_T
3189yytnamerr (char *yyres, const char *yystr)
3190{
3191 if (*yystr == '"')
3192 {
3193 YYSIZE_T yyn = 0;
3194 char const *yyp = yystr;
3195
3196 for (;;)
3197 switch (*++yyp)
3198 {
3199 case '\'':
3200 case ',':
3201 goto do_not_strip_quotes;
3202
3203 case '\\':
3204 if (*++yyp != '\\')
3205 goto do_not_strip_quotes;
3206 /* Fall through. */
3207 default:
3208 if (yyres)
3209 yyres[yyn] = *yyp;
3210 yyn++;
3211 break;
3212
3213 case '"':
3214 if (yyres)
3215 yyres[yyn] = '\0';
3216 return yyn;
3217 }
3218 do_not_strip_quotes: ;
3219 }
3220
3221 if (! yyres)
3222 return yystrlen (yystr);
3223
3224 return yystpcpy (yyres, yystr) - yyres;
3225}
3226# endif
3227
3228/* Copy into YYRESULT an error message about the unexpected token
3229 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3230 including the terminating null byte. If YYRESULT is null, do not
3231 copy anything; just return the number of bytes that would be
3232 copied. As a special case, return 0 if an ordinary "syntax error"
3233 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3234 size calculation. */
3235static YYSIZE_T
3236yysyntax_error (char *yyresult, int yystate, int yychar)
3237{
3238 int yyn = yypact[yystate];
3239
3240 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3241 return 0;
3242 else
3243 {
3244 int yytype = YYTRANSLATE (yychar);
3245 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3246 YYSIZE_T yysize = yysize0;
3247 YYSIZE_T yysize1;
3248 int yysize_overflow = 0;
3249 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3250 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3251 int yyx;
3252
3253# if 0
3254 /* This is so xgettext sees the translatable formats that are
3255 constructed on the fly. */
3256 YY_("syntax error, unexpected %s");
3257 YY_("syntax error, unexpected %s, expecting %s");
3258 YY_("syntax error, unexpected %s, expecting %s or %s");
3259 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3260 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3261# endif
3262 char *yyfmt;
3263 char const *yyf;
3264 static char const yyunexpected[] = "syntax error, unexpected %s";
3265 static char const yyexpecting[] = ", expecting %s";
3266 static char const yyor[] = " or %s";
3267 char yyformat[sizeof yyunexpected
3268 + sizeof yyexpecting - 1
3269 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3270 * (sizeof yyor - 1))];
3271 char const *yyprefix = yyexpecting;
3272
3273 /* Start YYX at -YYN if negative to avoid negative indexes in
3274 YYCHECK. */
3275 int yyxbegin = yyn < 0 ? -yyn : 0;
3276
3277 /* Stay within bounds of both yycheck and yytname. */
3278 int yychecklim = YYLAST - yyn + 1;
3279 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3280 int yycount = 1;
3281
3282 yyarg[0] = yytname[yytype];
3283 yyfmt = yystpcpy (yyformat, yyunexpected);
3284
3285 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3286 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3287 {
3288 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3289 {
3290 yycount = 1;
3291 yysize = yysize0;
3292 yyformat[sizeof yyunexpected - 1] = '\0';
3293 break;
3294 }
3295 yyarg[yycount++] = yytname[yyx];
3296 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3297 yysize_overflow |= (yysize1 < yysize);
3298 yysize = yysize1;
3299 yyfmt = yystpcpy (yyfmt, yyprefix);
3300 yyprefix = yyor;
3301 }
3302
3303 yyf = YY_(yyformat);
3304 yysize1 = yysize + yystrlen (yyf);
3305 yysize_overflow |= (yysize1 < yysize);
3306 yysize = yysize1;
3307
3308 if (yysize_overflow)
3309 return YYSIZE_MAXIMUM;
3310
3311 if (yyresult)
3312 {
3313 /* Avoid sprintf, as that infringes on the user's name space.
3314 Don't have undefined behavior even if the translation
3315 produced a string with the wrong number of "%s"s. */
3316 char *yyp = yyresult;
3317 int yyi = 0;
3318 while ((*yyp = *yyf) != '\0')
3319 {
3320 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3321 {
3322 yyp += yytnamerr (yyp, yyarg[yyi++]);
3323 yyf += 2;
3324 }
3325 else
3326 {
3327 yyp++;
3328 yyf++;
3329 }
3330 }
3331 }
3332 return yysize;
3333 }
3334}
3335#endif /* YYERROR_VERBOSE */
3336
3337
3338/*-----------------------------------------------.
3339| Release the memory associated to this symbol. |
3340`-----------------------------------------------*/
3341
3342/*ARGSUSED*/
3343#if (defined __STDC__ || defined __C99__FUNC__ \
3344 || defined __cplusplus || defined _MSC_VER)
3345static void
3346yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3347#else
3348static void
3349yydestruct (yymsg, yytype, yyvaluep)
3350 const char *yymsg;
3351 int yytype;
3352 YYSTYPE *yyvaluep;
3353#endif
3354{
3355 YYUSE (yyvaluep);
3356
3357 if (!yymsg)
3358 yymsg = "Deleting";
3359 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3360
3361 switch (yytype)
3362 {
3363
3364 default:
3365 break;
3366 }
3367}
3368
3369
3370/* Prevent warnings from -Wmissing-prototypes. */
3371
3372#ifdef YYPARSE_PARAM
3373#if defined __STDC__ || defined __cplusplus
3374int yyparse (void *YYPARSE_PARAM);
3375#else
3376int yyparse ();
3377#endif
3378#else /* ! YYPARSE_PARAM */
3379#if defined __STDC__ || defined __cplusplus
David Greene5fd22a82007-09-04 18:46:50 +00003380int yyparse (void);
Gabor Greife64d2482008-04-06 23:07:54 +00003381#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00003382int yyparse ();
Scott Michel15dcd8e2008-01-30 03:10:00 +00003383#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003384#endif /* ! YYPARSE_PARAM */
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003385
Chris Lattner38905612008-02-19 04:36:25 +00003386
Dan Gohmanf4423b12008-04-19 00:24:39 +00003387
3388/* The look-ahead symbol. */
3389int yychar;
3390
3391/* The semantic value of the look-ahead symbol. */
3392YYSTYPE yylval;
3393
3394/* Number of syntax errors so far. */
3395int yynerrs;
3396
3397
3398
3399/*----------.
3400| yyparse. |
3401`----------*/
3402
3403#ifdef YYPARSE_PARAM
3404#if (defined __STDC__ || defined __C99__FUNC__ \
3405 || defined __cplusplus || defined _MSC_VER)
3406int
3407yyparse (void *YYPARSE_PARAM)
3408#else
3409int
3410yyparse (YYPARSE_PARAM)
3411 void *YYPARSE_PARAM;
3412#endif
3413#else /* ! YYPARSE_PARAM */
3414#if (defined __STDC__ || defined __C99__FUNC__ \
3415 || defined __cplusplus || defined _MSC_VER)
3416int
3417yyparse (void)
3418#else
3419int
3420yyparse ()
3421
Gabor Greife64d2482008-04-06 23:07:54 +00003422#endif
3423#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003424{
3425
3426 int yystate;
3427 int yyn;
3428 int yyresult;
3429 /* Number of tokens to shift before error messages enabled. */
3430 int yyerrstatus;
3431 /* Look-ahead token as an internal (translated) token number. */
3432 int yytoken = 0;
3433#if YYERROR_VERBOSE
3434 /* Buffer for error messages, and its allocated size. */
3435 char yymsgbuf[128];
3436 char *yymsg = yymsgbuf;
3437 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
Gabor Greife64d2482008-04-06 23:07:54 +00003438#endif
Chris Lattner38905612008-02-19 04:36:25 +00003439
Dan Gohmanf4423b12008-04-19 00:24:39 +00003440 /* Three stacks and their tools:
3441 `yyss': related to states,
3442 `yyvs': related to semantic values,
3443 `yyls': related to locations.
3444
3445 Refer to the stacks thru separate pointers, to allow yyoverflow
3446 to reallocate them elsewhere. */
3447
3448 /* The state stack. */
3449 yytype_int16 yyssa[YYINITDEPTH];
3450 yytype_int16 *yyss = yyssa;
3451 yytype_int16 *yyssp;
3452
3453 /* The semantic value stack. */
3454 YYSTYPE yyvsa[YYINITDEPTH];
3455 YYSTYPE *yyvs = yyvsa;
3456 YYSTYPE *yyvsp;
3457
3458
3459
3460#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3461
3462 YYSIZE_T yystacksize = YYINITDEPTH;
3463
3464 /* The variables used to return semantic value and location from the
3465 action routines. */
3466 YYSTYPE yyval;
3467
3468
3469 /* The number of symbols on the RHS of the reduced rule.
3470 Keep to zero when no symbol should be popped. */
3471 int yylen = 0;
3472
3473 YYDPRINTF ((stderr, "Starting parse\n"));
3474
Reid Spencer68a24bd2005-08-27 18:50:39 +00003475 yystate = 0;
3476 yyerrstatus = 0;
3477 yynerrs = 0;
3478 yychar = YYEMPTY; /* Cause a token to be read. */
3479
3480 /* Initialize stack pointers.
3481 Waste one element of value and location stack
3482 so that they stay on the same level as the state stack.
3483 The wasted elements are never initialized. */
3484
Dan Gohmanf4423b12008-04-19 00:24:39 +00003485 yyssp = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003486 yyvsp = yyvs;
3487
Dan Gohmanf4423b12008-04-19 00:24:39 +00003488 goto yysetstate;
Jeff Cohen66c5fd62005-10-23 04:37:20 +00003489
Dan Gohmanf4423b12008-04-19 00:24:39 +00003490/*------------------------------------------------------------.
3491| yynewstate -- Push a new state, which is found in yystate. |
3492`------------------------------------------------------------*/
3493 yynewstate:
3494 /* In all cases, when you get here, the value and location stacks
3495 have just been pushed. So pushing a state here evens the stacks. */
3496 yyssp++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003497
Dan Gohmanf4423b12008-04-19 00:24:39 +00003498 yysetstate:
3499 *yyssp = yystate;
3500
3501 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003502 {
3503 /* Get the current used size of the three stacks, in elements. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003504 YYSIZE_T yysize = yyssp - yyss + 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003505
3506#ifdef yyoverflow
Dan Gohmanf4423b12008-04-19 00:24:39 +00003507 {
3508 /* Give user a chance to reallocate the stack. Use copies of
3509 these so that the &'s don't force the real ones into
3510 memory. */
3511 YYSTYPE *yyvs1 = yyvs;
3512 yytype_int16 *yyss1 = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003513
Dan Gohmanf4423b12008-04-19 00:24:39 +00003514
3515 /* Each stack pointer address is followed by the size of the
3516 data in use in that stack, in bytes. This used to be a
3517 conditional around just the two extra args, but that might
3518 be undefined if yyoverflow is a macro. */
3519 yyoverflow (YY_("memory exhausted"),
3520 &yyss1, yysize * sizeof (*yyssp),
3521 &yyvs1, yysize * sizeof (*yyvsp),
3522
3523 &yystacksize);
3524
3525 yyss = yyss1;
3526 yyvs = yyvs1;
3527 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00003528#else /* no yyoverflow */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003529# ifndef YYSTACK_RELOCATE
3530 goto yyexhaustedlab;
3531# else
Reid Spencer68a24bd2005-08-27 18:50:39 +00003532 /* Extend the stack our own way. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003533 if (YYMAXDEPTH <= yystacksize)
3534 goto yyexhaustedlab;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003535 yystacksize *= 2;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003536 if (YYMAXDEPTH < yystacksize)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003537 yystacksize = YYMAXDEPTH;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003538
3539 {
3540 yytype_int16 *yyss1 = yyss;
3541 union yyalloc *yyptr =
3542 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3543 if (! yyptr)
3544 goto yyexhaustedlab;
3545 YYSTACK_RELOCATE (yyss);
3546 YYSTACK_RELOCATE (yyvs);
3547
3548# undef YYSTACK_RELOCATE
3549 if (yyss1 != yyssa)
3550 YYSTACK_FREE (yyss1);
3551 }
3552# endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00003553#endif /* no yyoverflow */
3554
Dan Gohmanf4423b12008-04-19 00:24:39 +00003555 yyssp = yyss + yysize - 1;
3556 yyvsp = yyvs + yysize - 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003557
3558
Dan Gohmanf4423b12008-04-19 00:24:39 +00003559 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3560 (unsigned long int) yystacksize));
3561
3562 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003563 YYABORT;
3564 }
3565
Dan Gohmanf4423b12008-04-19 00:24:39 +00003566 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003567
3568 goto yybackup;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003569
Dan Gohmanf4423b12008-04-19 00:24:39 +00003570/*-----------.
3571| yybackup. |
3572`-----------*/
3573yybackup:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003574
Dan Gohmanf4423b12008-04-19 00:24:39 +00003575 /* Do appropriate processing given the current state. Read a
3576 look-ahead token if we need one and don't already have one. */
Reid Spencer7780acb2007-04-16 06:56:07 +00003577
Dan Gohmanf4423b12008-04-19 00:24:39 +00003578 /* First try to decide what to do without reference to look-ahead token. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003579 yyn = yypact[yystate];
Dan Gohmanf4423b12008-04-19 00:24:39 +00003580 if (yyn == YYPACT_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003581 goto yydefault;
3582
Dan Gohmanf4423b12008-04-19 00:24:39 +00003583 /* Not known => get a look-ahead token if don't already have one. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003584
Dan Gohmanf4423b12008-04-19 00:24:39 +00003585 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003586 if (yychar == YYEMPTY)
3587 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003588 YYDPRINTF ((stderr, "Reading a token: "));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003589 yychar = YYLEX;
3590 }
3591
Dan Gohmanf4423b12008-04-19 00:24:39 +00003592 if (yychar <= YYEOF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003593 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003594 yychar = yytoken = YYEOF;
3595 YYDPRINTF ((stderr, "Now at end of input.\n"));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003596 }
3597 else
3598 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003599 yytoken = YYTRANSLATE (yychar);
3600 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Reid Spencer68a24bd2005-08-27 18:50:39 +00003601 }
3602
Dan Gohmanf4423b12008-04-19 00:24:39 +00003603 /* If the proper action on seeing token YYTOKEN is to reduce or to
3604 detect an error, take that action. */
3605 yyn += yytoken;
3606 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003607 goto yydefault;
3608 yyn = yytable[yyn];
Dan Gohmanf4423b12008-04-19 00:24:39 +00003609 if (yyn <= 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003610 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003611 if (yyn == 0 || yyn == YYTABLE_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003612 goto yyerrlab;
3613 yyn = -yyn;
3614 goto yyreduce;
3615 }
3616
3617 if (yyn == YYFINAL)
3618 YYACCEPT;
3619
Dan Gohmanf4423b12008-04-19 00:24:39 +00003620 /* Count tokens shifted since error; after three, turn off error
3621 status. */
3622 if (yyerrstatus)
3623 yyerrstatus--;
Dale Johannesencdd509a2007-09-07 21:07:57 +00003624
Dan Gohmanf4423b12008-04-19 00:24:39 +00003625 /* Shift the look-ahead token. */
3626 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003627
Dan Gohmanf4423b12008-04-19 00:24:39 +00003628 /* Discard the shifted token unless it is eof. */
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003629 if (yychar != YYEOF)
3630 yychar = YYEMPTY;
3631
Gabor Greife64d2482008-04-06 23:07:54 +00003632 yystate = yyn;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003633 *++yyvsp = yylval;
3634
Reid Spencer68a24bd2005-08-27 18:50:39 +00003635 goto yynewstate;
3636
Gabor Greife64d2482008-04-06 23:07:54 +00003637
Dan Gohmanf4423b12008-04-19 00:24:39 +00003638/*-----------------------------------------------------------.
3639| yydefault -- do the default action for the current state. |
3640`-----------------------------------------------------------*/
3641yydefault:
Reid Spencer68a24bd2005-08-27 18:50:39 +00003642 yyn = yydefact[yystate];
3643 if (yyn == 0)
3644 goto yyerrlab;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003645 goto yyreduce;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003646
Dan Gohmanf4423b12008-04-19 00:24:39 +00003647
3648/*-----------------------------.
3649| yyreduce -- Do a reduction. |
3650`-----------------------------*/
Reid Spencer68a24bd2005-08-27 18:50:39 +00003651yyreduce:
Dan Gohmanf4423b12008-04-19 00:24:39 +00003652 /* yyn is the number of a rule to reduce with. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003653 yylen = yyr2[yyn];
3654
Dan Gohmanf4423b12008-04-19 00:24:39 +00003655 /* If YYLEN is nonzero, implement the default value of the action:
3656 `$$ = $1'.
3657
3658 Otherwise, the following line sets YYVAL to garbage.
3659 This behavior is undocumented and Bison
3660 users should not rely upon it. Assigning to YYVAL
3661 unconditionally makes the parser a bit smaller, and it avoids a
3662 GCC warning that YYVAL may be used uninitialized. */
3663 yyval = yyvsp[1-yylen];
3664
3665
3666 YY_REDUCE_PRINT (yyn);
3667 switch (yyn)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003668 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003669 case 29:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003670#line 1158 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003671 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3672 break;
Reid Spencer41dff5e2007-01-26 08:05:27 +00003673
Dan Gohmanf4423b12008-04-19 00:24:39 +00003674 case 30:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003675#line 1158 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003676 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3677 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003678
Dan Gohmanf4423b12008-04-19 00:24:39 +00003679 case 31:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003680#line 1159 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003681 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3682 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003683
Dan Gohmanf4423b12008-04-19 00:24:39 +00003684 case 32:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003685#line 1159 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003686 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3687 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003688
Dan Gohmanf4423b12008-04-19 00:24:39 +00003689 case 33:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003690#line 1160 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003691 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3692 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003693
Dan Gohmanf4423b12008-04-19 00:24:39 +00003694 case 34:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003695#line 1160 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003696 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3697 break;
3698
3699 case 35:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003700#line 1161 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003701 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3702 break;
3703
3704 case 36:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003705#line 1161 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003706 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3707 break;
3708
3709 case 37:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003710#line 1162 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003711 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3712 break;
3713
3714 case 38:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003715#line 1162 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003716 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3717 break;
3718
3719 case 39:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003720#line 1166 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003721 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3722 break;
3723
3724 case 40:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003725#line 1166 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003726 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3727 break;
3728
3729 case 41:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003730#line 1167 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003731 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3732 break;
3733
3734 case 42:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003735#line 1167 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003736 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3737 break;
3738
3739 case 43:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003740#line 1168 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003741 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3742 break;
3743
3744 case 44:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003745#line 1168 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003746 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3747 break;
3748
3749 case 45:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003750#line 1169 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003751 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3752 break;
3753
3754 case 46:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003755#line 1169 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003756 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3757 break;
3758
3759 case 47:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003760#line 1170 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003761 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3762 break;
3763
3764 case 48:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003765#line 1170 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003766 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3767 break;
3768
3769 case 49:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003770#line 1171 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003771 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3772 break;
3773
3774 case 50:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003775#line 1171 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003776 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3777 break;
3778
3779 case 51:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003780#line 1172 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003781 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3782 break;
3783
3784 case 52:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003785#line 1172 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003786 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3787 break;
3788
3789 case 53:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003790#line 1173 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003791 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3792 break;
3793
3794 case 54:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003795#line 1174 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003796 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3797 break;
3798
Chris Lattner740e7092008-10-15 06:16:57 +00003799 case 59:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003800#line 1178 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003801 { (yyval.StrVal) = 0; ;}
3802 break;
3803
Chris Lattner740e7092008-10-15 06:16:57 +00003804 case 60:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003805#line 1180 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003806 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3807 break;
3808
Chris Lattner740e7092008-10-15 06:16:57 +00003809 case 61:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003810#line 1181 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003811 { (yyval.UIntVal)=0; ;}
3812 break;
3813
Chris Lattner740e7092008-10-15 06:16:57 +00003814 case 62:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003815#line 1185 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003816 {
3817 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003818 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003819 ;}
3820 break;
3821
Chris Lattner740e7092008-10-15 06:16:57 +00003822 case 63:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003823#line 1189 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003824 {
3825 (yyval.StrVal) = 0;
3826 CHECK_FOR_ERROR
3827 ;}
3828 break;
3829
3830 case 64:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003831#line 1194 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003832 {
3833 (yyval.UIntVal) = (yyvsp[(1) - (2)].UIntVal);
3834 CHECK_FOR_ERROR
3835;}
3836 break;
3837
Chris Lattnerf9078f92008-10-15 06:03:48 +00003838 case 68:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003839#line 1203 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003840 {
3841 (yyval.StrVal) = 0;
Christopher Lambbf3348d2007-12-12 08:45:45 +00003842 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003843 ;}
3844 break;
3845
Chris Lattnerf9078f92008-10-15 06:03:48 +00003846 case 69:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003847#line 1208 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003848 {
3849 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00003850 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003851 ;}
3852 break;
3853
Chris Lattner740e7092008-10-15 06:16:57 +00003854 case 70:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003855#line 1214 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003856 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3857 break;
3858
Chris Lattner740e7092008-10-15 06:16:57 +00003859 case 71:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003860#line 1215 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003861 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3862 break;
3863
Chris Lattner740e7092008-10-15 06:16:57 +00003864 case 72:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003865#line 1216 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003866 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3867 break;
3868
Chris Lattner740e7092008-10-15 06:16:57 +00003869 case 73:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003870#line 1217 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003871 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3872 break;
3873
Chris Lattner740e7092008-10-15 06:16:57 +00003874 case 74:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003875#line 1218 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003876 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3877 break;
3878
Chris Lattner740e7092008-10-15 06:16:57 +00003879 case 75:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003880#line 1219 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003881 { (yyval.Linkage) = GlobalValue::CommonLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003882 break;
3883
Chris Lattner740e7092008-10-15 06:16:57 +00003884 case 76:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003885#line 1223 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003886 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003887 break;
3888
Chris Lattner740e7092008-10-15 06:16:57 +00003889 case 77:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003890#line 1224 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003891 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003892 break;
3893
Chris Lattner740e7092008-10-15 06:16:57 +00003894 case 78:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003895#line 1225 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003896 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3897 break;
3898
3899 case 79:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003900#line 1229 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes8a5f3472008-10-15 12:05:02 +00003901 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3902 break;
3903
Nuno Lopes19830332008-11-04 14:28:33 +00003904 case 80:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003905#line 1230 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes19830332008-11-04 14:28:33 +00003906 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3907 break;
3908
3909 case 81:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003910#line 1231 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003911 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3912 break;
3913
3914 case 82:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003915#line 1232 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003916 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
3917 break;
3918
3919 case 83:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003920#line 1236 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003921 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003922 break;
3923
Chris Lattnerf9078f92008-10-15 06:03:48 +00003924 case 84:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003925#line 1237 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003926 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003927 break;
3928
Chris Lattner740e7092008-10-15 06:16:57 +00003929 case 85:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003930#line 1238 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003931 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003932 break;
3933
Chris Lattner740e7092008-10-15 06:16:57 +00003934 case 86:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003935#line 1242 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003936 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3937 break;
3938
3939 case 87:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003940#line 1243 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003941 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3942 break;
3943
3944 case 88:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003945#line 1244 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003946 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3947 break;
3948
3949 case 89:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003950#line 1245 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003951 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3952 break;
3953
3954 case 90:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003955#line 1246 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003956 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3957 break;
3958
3959 case 91:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003960#line 1250 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003961 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3962 break;
3963
Chris Lattnerf9078f92008-10-15 06:03:48 +00003964 case 92:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003965#line 1251 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003966 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
Chris Lattnerf9078f92008-10-15 06:03:48 +00003967 break;
3968
Chris Lattner15bd0952008-08-29 17:20:18 +00003969 case 93:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003970#line 1252 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003971 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003972 break;
3973
Chris Lattner740e7092008-10-15 06:16:57 +00003974 case 94:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003975#line 1255 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes8a5f3472008-10-15 12:05:02 +00003976 { (yyval.UIntVal) = CallingConv::C; ;}
3977 break;
3978
Nuno Lopes19830332008-11-04 14:28:33 +00003979 case 95:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003980#line 1256 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes19830332008-11-04 14:28:33 +00003981 { (yyval.UIntVal) = CallingConv::C; ;}
3982 break;
3983
3984 case 96:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003985#line 1257 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003986 { (yyval.UIntVal) = CallingConv::Fast; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003987 break;
3988
Chris Lattner740e7092008-10-15 06:16:57 +00003989 case 97:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003990#line 1258 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003991 { (yyval.UIntVal) = CallingConv::Cold; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003992 break;
3993
Chris Lattner740e7092008-10-15 06:16:57 +00003994 case 98:
Nick Lewycky02ff3082008-11-24 03:41:24 +00003995#line 1259 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003996 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003997 break;
3998
Chris Lattner740e7092008-10-15 06:16:57 +00003999 case 99:
Nick Lewycky02ff3082008-11-24 03:41:24 +00004000#line 1260 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004001 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004002 break;
4003
Chris Lattner740e7092008-10-15 06:16:57 +00004004 case 100:
Nick Lewycky02ff3082008-11-24 03:41:24 +00004005#line 1261 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004006 {
4007 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004008 GEN_ERROR("Calling conv too large");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004009 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004010 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004011 ;}
4012 break;
4013
Chris Lattner740e7092008-10-15 06:16:57 +00004014 case 101:
Nick Lewycky02ff3082008-11-24 03:41:24 +00004015#line 1268 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes8a5f3472008-10-15 12:05:02 +00004016 { (yyval.Attributes) = Attribute::ZExt; ;}
Chris Lattner740e7092008-10-15 06:16:57 +00004017 break;
4018
Nuno Lopes19830332008-11-04 14:28:33 +00004019 case 102:
Nick Lewycky02ff3082008-11-24 03:41:24 +00004020#line 1269 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes19830332008-11-04 14:28:33 +00004021 { (yyval.Attributes) = Attribute::ZExt; ;}
Chris Lattner740e7092008-10-15 06:16:57 +00004022 break;
4023
Nuno Lopes19830332008-11-04 14:28:33 +00004024 case 103:
Nick Lewycky02ff3082008-11-24 03:41:24 +00004025#line 1270 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes8a5f3472008-10-15 12:05:02 +00004026 { (yyval.Attributes) = Attribute::SExt; ;}
4027 break;
4028
Nuno Lopes19830332008-11-04 14:28:33 +00004029 case 104:
Nick Lewycky02ff3082008-11-24 03:41:24 +00004030#line 1271 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes19830332008-11-04 14:28:33 +00004031 { (yyval.Attributes) = Attribute::SExt; ;}
4032 break;
4033
4034 case 105:
Nick Lewycky02ff3082008-11-24 03:41:24 +00004035#line 1272 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004036 { (yyval.Attributes) = Attribute::InReg; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004037 break;
4038
Chris Lattner740e7092008-10-15 06:16:57 +00004039 case 106:
Nick Lewycky02ff3082008-11-24 03:41:24 +00004040#line 1273 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004041 { (yyval.Attributes) = Attribute::StructRet; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004042 break;
4043
Chris Lattner740e7092008-10-15 06:16:57 +00004044 case 107:
Nick Lewycky02ff3082008-11-24 03:41:24 +00004045#line 1274 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004046 { (yyval.Attributes) = Attribute::NoAlias; ;}
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004047 break;
4048
Chris Lattner740e7092008-10-15 06:16:57 +00004049 case 108:
Nick Lewycky02ff3082008-11-24 03:41:24 +00004050#line 1275 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewyckyd802be32008-12-19 09:41:54 +00004051 { (yyval.Attributes) = Attribute::NoCapture; ;}
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004052 break;
4053
Chris Lattner740e7092008-10-15 06:16:57 +00004054 case 109:
Nick Lewycky02ff3082008-11-24 03:41:24 +00004055#line 1276 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewyckyd802be32008-12-19 09:41:54 +00004056 { (yyval.Attributes) = Attribute::ByVal; ;}
Chris Lattner15bd0952008-08-29 17:20:18 +00004057 break;
4058
Chris Lattner740e7092008-10-15 06:16:57 +00004059 case 110:
Nick Lewycky02ff3082008-11-24 03:41:24 +00004060#line 1277 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewyckyd802be32008-12-19 09:41:54 +00004061 { (yyval.Attributes) = Attribute::Nest; ;}
4062 break;
4063
4064 case 111:
4065#line 1278 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004066 { (yyval.Attributes) =
4067 Attribute::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004068 break;
4069
Nick Lewyckyd802be32008-12-19 09:41:54 +00004070 case 112:
4071#line 1282 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004072 { (yyval.Attributes) = Attribute::None; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004073 break;
4074
Nick Lewyckyd802be32008-12-19 09:41:54 +00004075 case 113:
4076#line 1283 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dale Johannesendfe8c842008-09-26 19:32:34 +00004077 {
4078 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
4079 ;}
4080 break;
4081
Chris Lattner740e7092008-10-15 06:16:57 +00004082 case 114:
Nick Lewycky02ff3082008-11-24 03:41:24 +00004083#line 1288 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewyckyd802be32008-12-19 09:41:54 +00004084 { (yyval.Attributes) = Attribute::InReg; ;}
Chris Lattner15bd0952008-08-29 17:20:18 +00004085 break;
4086
Chris Lattner740e7092008-10-15 06:16:57 +00004087 case 115:
Nick Lewycky02ff3082008-11-24 03:41:24 +00004088#line 1289 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewyckyd802be32008-12-19 09:41:54 +00004089 { (yyval.Attributes) = Attribute::ZExt; ;}
Chris Lattner15bd0952008-08-29 17:20:18 +00004090 break;
4091
Chris Lattner740e7092008-10-15 06:16:57 +00004092 case 116:
Nick Lewycky02ff3082008-11-24 03:41:24 +00004093#line 1290 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewyckyd802be32008-12-19 09:41:54 +00004094 { (yyval.Attributes) = Attribute::SExt; ;}
Chris Lattnerccef6b52008-09-23 21:18:31 +00004095 break;
4096
Chris Lattner740e7092008-10-15 06:16:57 +00004097 case 117:
Nick Lewyckyd802be32008-12-19 09:41:54 +00004098#line 1291 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
4099 { (yyval.Attributes) = Attribute::NoAlias; ;}
Nick Lewycky02ff3082008-11-24 03:41:24 +00004100 break;
4101
4102 case 118:
4103#line 1294 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewyckyd802be32008-12-19 09:41:54 +00004104 { (yyval.Attributes) = Attribute::None; ;}
4105 break;
4106
4107 case 119:
4108#line 1295 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00004109 {
4110 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
4111 ;}
4112 break;
4113
Nick Lewycky02ff3082008-11-24 03:41:24 +00004114 case 120:
4115#line 1301 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewyckyd802be32008-12-19 09:41:54 +00004116 { (yyval.Attributes) = Attribute::NoReturn; ;}
Devang Patel652203f2008-09-29 20:49:50 +00004117 break;
4118
Nick Lewycky02ff3082008-11-24 03:41:24 +00004119 case 121:
4120#line 1302 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewyckyd802be32008-12-19 09:41:54 +00004121 { (yyval.Attributes) = Attribute::NoUnwind; ;}
Devang Patel652203f2008-09-29 20:49:50 +00004122 break;
4123
Nick Lewycky02ff3082008-11-24 03:41:24 +00004124 case 122:
4125#line 1303 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewyckyd802be32008-12-19 09:41:54 +00004126 { (yyval.Attributes) = Attribute::InReg; ;}
Devang Patel652203f2008-09-29 20:49:50 +00004127 break;
4128
Nick Lewycky02ff3082008-11-24 03:41:24 +00004129 case 123:
4130#line 1304 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewyckyd802be32008-12-19 09:41:54 +00004131 { (yyval.Attributes) = Attribute::ZExt; ;}
Devang Patel652203f2008-09-29 20:49:50 +00004132 break;
4133
Nick Lewycky02ff3082008-11-24 03:41:24 +00004134 case 124:
4135#line 1305 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewyckyd802be32008-12-19 09:41:54 +00004136 { (yyval.Attributes) = Attribute::SExt; ;}
Devang Patel652203f2008-09-29 20:49:50 +00004137 break;
4138
Nick Lewycky02ff3082008-11-24 03:41:24 +00004139 case 125:
4140#line 1306 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewyckyd802be32008-12-19 09:41:54 +00004141 { (yyval.Attributes) = Attribute::ReadNone; ;}
Devang Patel652203f2008-09-29 20:49:50 +00004142 break;
4143
Nick Lewycky02ff3082008-11-24 03:41:24 +00004144 case 126:
4145#line 1307 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewyckyd802be32008-12-19 09:41:54 +00004146 { (yyval.Attributes) = Attribute::ReadOnly; ;}
Devang Patel652203f2008-09-29 20:49:50 +00004147 break;
4148
Nick Lewycky02ff3082008-11-24 03:41:24 +00004149 case 127:
4150#line 1308 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewyckyd802be32008-12-19 09:41:54 +00004151 { (yyval.Attributes) = Attribute::NoInline; ;}
Devang Patel652203f2008-09-29 20:49:50 +00004152 break;
4153
Nick Lewycky02ff3082008-11-24 03:41:24 +00004154 case 128:
4155#line 1309 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewyckyd802be32008-12-19 09:41:54 +00004156 { (yyval.Attributes) = Attribute::AlwaysInline; ;}
Devang Patel652203f2008-09-29 20:49:50 +00004157 break;
4158
Nick Lewycky02ff3082008-11-24 03:41:24 +00004159 case 129:
4160#line 1310 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewyckyd802be32008-12-19 09:41:54 +00004161 { (yyval.Attributes) = Attribute::OptimizeForSize; ;}
Devang Patel652203f2008-09-29 20:49:50 +00004162 break;
4163
Nick Lewycky02ff3082008-11-24 03:41:24 +00004164 case 130:
4165#line 1311 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewyckyd802be32008-12-19 09:41:54 +00004166 { (yyval.Attributes) = Attribute::StackProtect; ;}
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004167 break;
4168
Nick Lewycky02ff3082008-11-24 03:41:24 +00004169 case 131:
Nick Lewyckyd802be32008-12-19 09:41:54 +00004170#line 1312 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
4171 { (yyval.Attributes) = Attribute::StackProtectReq; ;}
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004172 break;
4173
Nick Lewycky02ff3082008-11-24 03:41:24 +00004174 case 132:
4175#line 1315 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewyckyd802be32008-12-19 09:41:54 +00004176 { (yyval.Attributes) = Attribute::None; ;}
4177 break;
4178
4179 case 133:
4180#line 1316 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004181 {
Devang Patel05988662008-09-25 21:00:45 +00004182 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
Chris Lattner15bd0952008-08-29 17:20:18 +00004183 ;}
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004184 break;
4185
Nick Lewyckyd802be32008-12-19 09:41:54 +00004186 case 134:
4187#line 1322 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Devang Pateld4980812008-09-02 20:52:40 +00004188 { (yyval.StrVal) = 0; ;}
4189 break;
4190
Nick Lewyckyd802be32008-12-19 09:41:54 +00004191 case 135:
4192#line 1323 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004193 {
4194 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
4195 ;}
4196 break;
4197
Nick Lewyckyd802be32008-12-19 09:41:54 +00004198 case 136:
4199#line 1330 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004200 { (yyval.UIntVal) = 0; ;}
4201 break;
4202
Nick Lewyckyd802be32008-12-19 09:41:54 +00004203 case 137:
4204#line 1331 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004205 {
4206 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
4207 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004208 GEN_ERROR("Alignment must be a power of two");
Nick Lewyckyd802be32008-12-19 09:41:54 +00004209 if ((yyval.UIntVal) > 0x40000000)
4210 GEN_ERROR("Alignment too large");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004211 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004212;}
4213 break;
4214
Nick Lewyckyd802be32008-12-19 09:41:54 +00004215 case 138:
4216#line 1339 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004217 { (yyval.UIntVal) = 0; ;}
4218 break;
4219
Nick Lewyckyd802be32008-12-19 09:41:54 +00004220 case 139:
4221#line 1340 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004222 {
4223 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
4224 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Christopher Lambbf3348d2007-12-12 08:45:45 +00004225 GEN_ERROR("Alignment must be a power of two");
Nick Lewyckyd802be32008-12-19 09:41:54 +00004226 if ((yyval.UIntVal) > 0x40000000)
4227 GEN_ERROR("Alignment too large");
Christopher Lambbf3348d2007-12-12 08:45:45 +00004228 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004229;}
4230 break;
4231
Nick Lewyckyd802be32008-12-19 09:41:54 +00004232 case 140:
4233#line 1351 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004234 {
4235 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
4236 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004237 GEN_ERROR("Invalid character in section name");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004238 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004239 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004240;}
4241 break;
4242
Bill Wendling29bc4f02008-12-17 20:59:57 +00004243 case 141:
Nick Lewyckyd802be32008-12-19 09:41:54 +00004244#line 1359 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
4245 { (yyval.StrVal) = 0; ;}
Bill Wendling29bc4f02008-12-17 20:59:57 +00004246 break;
4247
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004248 case 142:
Nick Lewycky02ff3082008-11-24 03:41:24 +00004249#line 1360 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewyckyd802be32008-12-19 09:41:54 +00004250 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004251 break;
4252
4253 case 143:
Nick Lewyckyd802be32008-12-19 09:41:54 +00004254#line 1365 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewycky02ff3082008-11-24 03:41:24 +00004255 {;}
4256 break;
4257
4258 case 144:
Nick Lewyckyd802be32008-12-19 09:41:54 +00004259#line 1366 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
4260 {;}
4261 break;
4262
4263 case 145:
4264#line 1367 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004265 {
4266 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
4267 delete (yyvsp[(1) - (1)].StrVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004268 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004269 ;}
4270 break;
4271
Nick Lewyckyd802be32008-12-19 09:41:54 +00004272 case 146:
4273#line 1372 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004274 {
4275 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004276 GEN_ERROR("Alignment must be a power of two");
Nick Lewyckyd802be32008-12-19 09:41:54 +00004277 if ((yyvsp[(2) - (2)].UInt64Val) > 0x40000000)
4278 GEN_ERROR("Alignment too large");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004279 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004280 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004281 ;}
4282 break;
4283
Nick Lewyckyd802be32008-12-19 09:41:54 +00004284 case 154:
4285#line 1390 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004286 {
4287 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004288 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004289 ;}
4290 break;
4291
Nick Lewyckyd802be32008-12-19 09:41:54 +00004292 case 155:
4293#line 1394 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004294 {
4295 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004296 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004297 ;}
4298 break;
4299
Nick Lewyckyd802be32008-12-19 09:41:54 +00004300 case 156:
4301#line 1398 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004302 { // Pointer type?
4303 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
Christopher Lambbf3348d2007-12-12 08:45:45 +00004304 GEN_ERROR("Cannot form a pointer to a basic block");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004305 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4306 delete (yyvsp[(1) - (3)].TypeVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00004307 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004308 ;}
4309 break;
4310
Nick Lewyckyd802be32008-12-19 09:41:54 +00004311 case 157:
4312#line 1405 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004313 { // Named types are also simple types...
4314 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00004315 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004316 (yyval.TypeVal) = new PATypeHolder(tmp);
4317 ;}
4318 break;
4319
Nick Lewyckyd802be32008-12-19 09:41:54 +00004320 case 158:
4321#line 1410 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004322 { // Type UpReference
4323 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004324 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Dan Gohmanf4423b12008-04-19 00:24:39 +00004325 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4326 (yyval.TypeVal) = new PATypeHolder(OT);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004327 UR_OUT("New Upreference!\n");
4328 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004329 ;}
4330 break;
4331
Nick Lewyckyd802be32008-12-19 09:41:54 +00004332 case 159:
4333#line 1418 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004334 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004335 // Allow but ignore attributes on function types; this permits auto-upgrade.
4336 // FIXME: remove in LLVM 3.0.
Chris Lattnera925a142008-04-23 05:37:08 +00004337 const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal);
4338 if (!FunctionType::isValidReturnType(RetTy))
4339 GEN_ERROR("Invalid result type for LLVM function");
Eric Christopher2a5196f2008-09-24 04:55:49 +00004340
Reid Spencer41dff5e2007-01-26 08:05:27 +00004341 std::vector<const Type*> Params;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004342 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00004343 for (; I != E; ++I ) {
Reid Spencer66728ef2007-03-20 01:13:36 +00004344 const Type *Ty = I->Ty->get();
Reid Spencer66728ef2007-03-20 01:13:36 +00004345 Params.push_back(Ty);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004346 }
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004347
Reid Spencer41dff5e2007-01-26 08:05:27 +00004348 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4349 if (isVarArg) Params.pop_back();
4350
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004351 for (unsigned i = 0; i != Params.size(); ++i)
4352 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4353 GEN_ERROR("Function arguments must be value types!");
4354
4355 CHECK_FOR_ERROR
4356
Anton Korobeynikovc36284e2007-12-03 19:17:47 +00004357 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004358 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
Eric Christopher2a5196f2008-09-24 04:55:49 +00004359 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Nuno Lopes8a88a372008-10-05 16:49:34 +00004360
4361 // Delete the argument list
4362 for (I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin() ; I != E; ++I ) {
4363 delete I->Ty;
4364 }
4365 delete (yyvsp[(3) - (5)].TypeWithAttrsList);
4366
Reid Spencere4d87aa2006-12-23 06:05:41 +00004367 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004368 ;}
4369 break;
4370
Nick Lewyckyd802be32008-12-19 09:41:54 +00004371 case 160:
4372#line 1453 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004373 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004374 // Allow but ignore attributes on function types; this permits auto-upgrade.
4375 // FIXME: remove in LLVM 3.0.
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004376 std::vector<const Type*> Params;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004377 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00004378 for ( ; I != E; ++I ) {
Reid Spencer66728ef2007-03-20 01:13:36 +00004379 const Type* Ty = I->Ty->get();
Reid Spencer66728ef2007-03-20 01:13:36 +00004380 Params.push_back(Ty);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004381 }
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004382
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004383 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4384 if (isVarArg) Params.pop_back();
4385
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004386 for (unsigned i = 0; i != Params.size(); ++i)
4387 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4388 GEN_ERROR("Function arguments must be value types!");
4389
4390 CHECK_FOR_ERROR
4391
Dan Gohmanf4423b12008-04-19 00:24:39 +00004392 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
Eric Christopher2a5196f2008-09-24 04:55:49 +00004393 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Nuno Lopes8a88a372008-10-05 16:49:34 +00004394
4395 // Delete the argument list
4396 for (I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin() ; I != E; ++I ) {
4397 delete I->Ty;
4398 }
4399 delete (yyvsp[(3) - (5)].TypeWithAttrsList);
4400
Reid Spencer41dff5e2007-01-26 08:05:27 +00004401 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004402 ;}
4403 break;
4404
Nick Lewyckyd802be32008-12-19 09:41:54 +00004405 case 161:
4406#line 1484 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004407 { // Sized array type?
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004408 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (yyvsp[(2) - (5)].UInt64Val))));
Dan Gohmanf4423b12008-04-19 00:24:39 +00004409 delete (yyvsp[(4) - (5)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004410 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004411 ;}
4412 break;
4413
Nick Lewyckyd802be32008-12-19 09:41:54 +00004414 case 162:
4415#line 1489 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004416 { // Vector type?
4417 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4418 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004419 GEN_ERROR("Unsigned result not equal to signed result");
4420 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4421 GEN_ERROR("Element type of a VectorType must be primitive");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004422 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4423 delete (yyvsp[(4) - (5)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004424 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004425 ;}
4426 break;
4427
Nick Lewyckyd802be32008-12-19 09:41:54 +00004428 case 163:
4429#line 1499 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004430 { // Structure type?
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004431 std::vector<const Type*> Elements;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004432 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4433 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004434 Elements.push_back(*I);
4435
Dan Gohmanf4423b12008-04-19 00:24:39 +00004436 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4437 delete (yyvsp[(2) - (3)].TypeList);
Reid Spencer14310612006-12-31 05:40:51 +00004438 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004439 ;}
4440 break;
4441
Nick Lewyckyd802be32008-12-19 09:41:54 +00004442 case 164:
4443#line 1509 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004444 { // Empty structure type?
4445 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Reid Spencer14310612006-12-31 05:40:51 +00004446 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004447 ;}
4448 break;
4449
Nick Lewyckyd802be32008-12-19 09:41:54 +00004450 case 165:
4451#line 1513 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004452 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004453 std::vector<const Type*> Elements;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004454 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4455 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004456 Elements.push_back(*I);
4457
Dan Gohmanf4423b12008-04-19 00:24:39 +00004458 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4459 delete (yyvsp[(3) - (5)].TypeList);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004460 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004461 ;}
4462 break;
4463
Nick Lewyckyd802be32008-12-19 09:41:54 +00004464 case 166:
4465#line 1523 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004466 { // Empty structure type?
4467 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004468 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004469 ;}
4470 break;
4471
Nick Lewyckyd802be32008-12-19 09:41:54 +00004472 case 167:
4473#line 1530 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004474 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004475 // Allow but ignore attributes on function types; this permits auto-upgrade.
4476 // FIXME: remove in LLVM 3.0.
Eric Christopher2a5196f2008-09-24 04:55:49 +00004477 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
Devang Patel05988662008-09-25 21:00:45 +00004478 (yyval.TypeWithAttrs).Attrs = Attribute::None;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004479 ;}
4480 break;
4481
Nick Lewyckyd802be32008-12-19 09:41:54 +00004482 case 168:
4483#line 1539 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004484 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004485 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004486 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4487 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004488 GEN_ERROR("LLVM functions cannot return aggregate types");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004489 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4490 ;}
4491 break;
4492
Nick Lewyckyd802be32008-12-19 09:41:54 +00004493 case 169:
4494#line 1546 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004495 {
4496 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4497 ;}
4498 break;
4499
Nick Lewyckyd802be32008-12-19 09:41:54 +00004500 case 170:
4501#line 1551 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004502 {
4503 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4504 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
Reid Spencer3da59db2006-11-27 01:05:10 +00004505 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004506 ;}
4507 break;
4508
Nick Lewyckyd802be32008-12-19 09:41:54 +00004509 case 171:
4510#line 1556 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004511 {
4512 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004513 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004514 ;}
4515 break;
4516
Nick Lewycky02ff3082008-11-24 03:41:24 +00004517 case 173:
4518#line 1564 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004519 {
Nick Lewyckyd802be32008-12-19 09:41:54 +00004520 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
Devang Patel05988662008-09-25 21:00:45 +00004521 TypeWithAttrs TWA; TWA.Attrs = Attribute::None;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004522 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004523 (yyval.TypeWithAttrsList)->push_back(TWA);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004524 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004525 ;}
4526 break;
4527
Nick Lewycky02ff3082008-11-24 03:41:24 +00004528 case 174:
4529#line 1571 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004530 {
Nick Lewyckyd802be32008-12-19 09:41:54 +00004531 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
4532 TypeWithAttrs TWA; TWA.Attrs = Attribute::None;
4533 TWA.Ty = new PATypeHolder(Type::VoidTy);
4534 (yyval.TypeWithAttrsList)->push_back(TWA);
Nick Lewyckyfd7eb722008-12-15 07:31:07 +00004535 CHECK_FOR_ERROR
4536 ;}
4537 break;
4538
Bill Wendling29bc4f02008-12-17 20:59:57 +00004539 case 175:
Nick Lewyckyd802be32008-12-19 09:41:54 +00004540#line 1578 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
4541 {
4542 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4543 CHECK_FOR_ERROR
4544 ;}
4545 break;
4546
4547 case 176:
4548#line 1586 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004549 {
4550 (yyval.TypeList) = new std::list<PATypeHolder>();
Eric Christopher2a5196f2008-09-24 04:55:49 +00004551 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
Dan Gohmanf4423b12008-04-19 00:24:39 +00004552 delete (yyvsp[(1) - (1)].TypeVal);
Reid Spencer3da59db2006-11-27 01:05:10 +00004553 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004554 ;}
4555 break;
4556
Nick Lewyckyd802be32008-12-19 09:41:54 +00004557 case 177:
4558#line 1592 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004559 {
Eric Christopher2a5196f2008-09-24 04:55:49 +00004560 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
Dan Gohmanf4423b12008-04-19 00:24:39 +00004561 delete (yyvsp[(3) - (3)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004562 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004563 ;}
4564 break;
4565
Nick Lewyckyd802be32008-12-19 09:41:54 +00004566 case 178:
4567#line 1604 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004568 { // Nonempty unsized arr
Reid Spencer14310612006-12-31 05:40:51 +00004569 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004570 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4571 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004572 if (ATy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004573 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004574 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004575 const Type *ETy = ATy->getElementType();
Dan Gohman180c1692008-06-23 18:43:26 +00004576 uint64_t NumElements = ATy->getNumElements();
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004577
4578 // Verify that we have the correct size...
Mon P Wang28873102008-06-25 08:15:39 +00004579 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (4)].ConstVector)->size())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004580 GEN_ERROR("Type mismatch: constant sized array initialized with " +
Eric Christopher2a5196f2008-09-24 04:55:49 +00004581 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Mon P Wang28873102008-06-25 08:15:39 +00004582 utostr(NumElements) + "");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004583
4584 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004585 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4586 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Eric Christopher2a5196f2008-09-24 04:55:49 +00004587 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004588 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohmanf4423b12008-04-19 00:24:39 +00004589 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004590 }
4591
Dan Gohmanf4423b12008-04-19 00:24:39 +00004592 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4593 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004594 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004595 ;}
4596 break;
4597
Nick Lewyckyd802be32008-12-19 09:41:54 +00004598 case 179:
4599#line 1632 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004600 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004601 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004602 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4603 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004604 if (ATy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004605 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004606 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004607
Dan Gohman180c1692008-06-23 18:43:26 +00004608 uint64_t NumElements = ATy->getNumElements();
Eric Christopher2a5196f2008-09-24 04:55:49 +00004609 if (NumElements != uint64_t(-1) && NumElements != 0)
Andrew Lenharth6353e052006-12-08 18:07:09 +00004610 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
Mon P Wang28873102008-06-25 08:15:39 +00004611 " arguments, but has size of " + utostr(NumElements) +"");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004612 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4613 delete (yyvsp[(1) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00004614 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004615 ;}
4616 break;
4617
Nick Lewyckyd802be32008-12-19 09:41:54 +00004618 case 180:
4619#line 1648 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004620 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004621 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004622 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4623 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004624 if (ATy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004625 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004626 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004627
Dan Gohman180c1692008-06-23 18:43:26 +00004628 uint64_t NumElements = ATy->getNumElements();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004629 const Type *ETy = ATy->getElementType();
Mon P Wang28873102008-06-25 08:15:39 +00004630 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (3)].StrVal)->length())
Eric Christopher2a5196f2008-09-24 04:55:49 +00004631 GEN_ERROR("Can't build string constant of size " +
Mon P Wang28873102008-06-25 08:15:39 +00004632 utostr((yyvsp[(3) - (3)].StrVal)->length()) +
4633 " when array has size " + utostr(NumElements) + "");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004634 std::vector<Constant*> Vals;
4635 if (ETy == Type::Int8Ty) {
Mon P Wang28873102008-06-25 08:15:39 +00004636 for (uint64_t i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
Dan Gohmanf4423b12008-04-19 00:24:39 +00004637 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004638 } else {
Dan Gohmanf4423b12008-04-19 00:24:39 +00004639 delete (yyvsp[(3) - (3)].StrVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004640 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4641 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004642 delete (yyvsp[(3) - (3)].StrVal);
4643 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4644 delete (yyvsp[(1) - (3)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004645 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004646 ;}
4647 break;
4648
Nick Lewyckyd802be32008-12-19 09:41:54 +00004649 case 181:
4650#line 1675 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004651 { // Nonempty unsized arr
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004652 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004653 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4654 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004655 if (PTy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004656 GEN_ERROR("Cannot make packed constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004657 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004658 const Type *ETy = PTy->getElementType();
Dan Gohman180c1692008-06-23 18:43:26 +00004659 unsigned NumElements = PTy->getNumElements();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004660
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004661 // Verify that we have the correct size...
Mon P Wang28873102008-06-25 08:15:39 +00004662 if (NumElements != unsigned(-1) && NumElements != (unsigned)(yyvsp[(3) - (4)].ConstVector)->size())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004663 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
Eric Christopher2a5196f2008-09-24 04:55:49 +00004664 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Mon P Wang28873102008-06-25 08:15:39 +00004665 utostr(NumElements) + "");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004666
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004667 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004668 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4669 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Eric Christopher2a5196f2008-09-24 04:55:49 +00004670 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004671 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohmanf4423b12008-04-19 00:24:39 +00004672 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004673 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00004674
Dan Gohmanf4423b12008-04-19 00:24:39 +00004675 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4676 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004677 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004678 ;}
4679 break;
4680
Nick Lewyckyd802be32008-12-19 09:41:54 +00004681 case 182:
4682#line 1703 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004683 {
4684 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004685 if (STy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004686 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004687 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004688
Dan Gohmanf4423b12008-04-19 00:24:39 +00004689 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004690 GEN_ERROR("Illegal number of initializers for structure type");
4691
4692 // Check to ensure that constants are compatible with the type initializer!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004693 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4694 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004695 GEN_ERROR("Expected type '" +
4696 STy->getElementType(i)->getDescription() +
4697 "' for element #" + utostr(i) +
4698 " of structure initializer");
4699
4700 // Check to ensure that Type is not packed
4701 if (STy->isPacked())
4702 GEN_ERROR("Unpacked Initializer to vector type '" +
4703 STy->getDescription() + "'");
4704
Dan Gohmanf4423b12008-04-19 00:24:39 +00004705 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4706 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004707 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004708 ;}
4709 break;
4710
Nick Lewyckyd802be32008-12-19 09:41:54 +00004711 case 183:
4712#line 1729 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004713 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004714 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004715 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4716 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004717 if (STy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004718 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004719 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004720
4721 if (STy->getNumContainedTypes() != 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00004722 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004723
4724 // Check to ensure that Type is not packed
4725 if (STy->isPacked())
Chris Lattner6cdc6822007-04-26 05:31:05 +00004726 GEN_ERROR("Unpacked Initializer to vector type '" +
4727 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004728
Dan Gohmanf4423b12008-04-19 00:24:39 +00004729 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4730 delete (yyvsp[(1) - (3)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004731 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004732 ;}
4733 break;
4734
Nick Lewyckyd802be32008-12-19 09:41:54 +00004735 case 184:
4736#line 1749 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004737 {
4738 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004739 if (STy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004740 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004741 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004742
Dan Gohmanf4423b12008-04-19 00:24:39 +00004743 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
Reid Spencerb5334b02007-02-05 10:18:06 +00004744 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004745
4746 // Check to ensure that constants are compatible with the type initializer!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004747 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4748 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
Reid Spencer41dff5e2007-01-26 08:05:27 +00004749 GEN_ERROR("Expected type '" +
4750 STy->getElementType(i)->getDescription() +
4751 "' for element #" + utostr(i) +
Reid Spencerb5334b02007-02-05 10:18:06 +00004752 " of structure initializer");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004753
4754 // Check to ensure that Type is packed
4755 if (!STy->isPacked())
Eric Christopher2a5196f2008-09-24 04:55:49 +00004756 GEN_ERROR("Vector initializer to non-vector type '" +
Chris Lattner32980692007-02-19 07:44:24 +00004757 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004758
Dan Gohmanf4423b12008-04-19 00:24:39 +00004759 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4760 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004761 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004762 ;}
4763 break;
4764
Nick Lewyckyd802be32008-12-19 09:41:54 +00004765 case 185:
4766#line 1775 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004767 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004768 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004769 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4770 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004771 if (STy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004772 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004773 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004774
4775 if (STy->getNumContainedTypes() != 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00004776 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004777
4778 // Check to ensure that Type is packed
4779 if (!STy->isPacked())
Eric Christopher2a5196f2008-09-24 04:55:49 +00004780 GEN_ERROR("Vector initializer to non-vector type '" +
Chris Lattner32980692007-02-19 07:44:24 +00004781 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004782
Dan Gohmanf4423b12008-04-19 00:24:39 +00004783 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4784 delete (yyvsp[(1) - (5)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004785 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004786 ;}
4787 break;
4788
Nick Lewyckyd802be32008-12-19 09:41:54 +00004789 case 186:
4790#line 1795 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004791 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004792 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004793 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4794 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004795 if (PTy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004796 GEN_ERROR("Cannot make null pointer constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004797 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004798
Dan Gohmanf4423b12008-04-19 00:24:39 +00004799 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4800 delete (yyvsp[(1) - (2)].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004801 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004802 ;}
4803 break;
4804
Nick Lewyckyd802be32008-12-19 09:41:54 +00004805 case 187:
4806#line 1807 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004807 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004808 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004809 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4810 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4811 delete (yyvsp[(1) - (2)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004812 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004813 ;}
4814 break;
4815
Nick Lewyckyd802be32008-12-19 09:41:54 +00004816 case 188:
4817#line 1814 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004818 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004819 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004820 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4821 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004822 if (Ty == 0)
Dan Gohmanf4423b12008-04-19 00:24:39 +00004823 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004824
4825 // ConstExprs can exist in the body of a function, thus creating
4826 // GlobalValues whenever they refer to a variable. Because we are in
Reid Spencer93c40032007-03-19 18:40:50 +00004827 // the context of a function, getExistingVal will search the functions
Reid Spencer68a24bd2005-08-27 18:50:39 +00004828 // symbol table instead of the module symbol table for the global symbol,
4829 // which throws things all off. To get around this, we just tell
Reid Spencer93c40032007-03-19 18:40:50 +00004830 // getExistingVal that we are at global scope here.
Reid Spencer68a24bd2005-08-27 18:50:39 +00004831 //
4832 Function *SavedCurFn = CurFun.CurrentFunction;
4833 CurFun.CurrentFunction = 0;
4834
Dan Gohmanf4423b12008-04-19 00:24:39 +00004835 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00004836 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00004837
4838 CurFun.CurrentFunction = SavedCurFn;
4839
4840 // If this is an initializer for a constant pointer, which is referencing a
4841 // (currently) undefined variable, create a stub now that shall be replaced
4842 // in the future with the right type of variable.
4843 //
4844 if (V == 0) {
Reid Spencera9720f52007-02-05 17:04:00 +00004845 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004846 const PointerType *PT = cast<PointerType>(Ty);
4847
4848 // First check to see if the forward references value is already created!
4849 PerModuleInfo::GlobalRefsType::iterator I =
Dan Gohmanf4423b12008-04-19 00:24:39 +00004850 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
Eric Christopher2a5196f2008-09-24 04:55:49 +00004851
Reid Spencer68a24bd2005-08-27 18:50:39 +00004852 if (I != CurModule.GlobalRefs.end()) {
4853 V = I->second; // Placeholder already exists, use it...
Dan Gohmanf4423b12008-04-19 00:24:39 +00004854 (yyvsp[(2) - (2)].ValIDVal).destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +00004855 } else {
4856 std::string Name;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004857 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4858 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4859 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
Reid Spencer41dff5e2007-01-26 08:05:27 +00004860 GEN_ERROR("Invalid reference to global");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004861
4862 // Create the forward referenced global.
4863 GlobalValue *GV;
Eric Christopher2a5196f2008-09-24 04:55:49 +00004864 if (const FunctionType *FTy =
Reid Spencer68a24bd2005-08-27 18:50:39 +00004865 dyn_cast<FunctionType>(PT->getElementType())) {
Gabor Greife64d2482008-04-06 23:07:54 +00004866 GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
4867 CurModule.CurrentModule);
Reid Spencer68a24bd2005-08-27 18:50:39 +00004868 } else {
4869 GV = new GlobalVariable(PT->getElementType(), false,
Chris Lattner6cdc6822007-04-26 05:31:05 +00004870 GlobalValue::ExternalWeakLinkage, 0,
Reid Spencer68a24bd2005-08-27 18:50:39 +00004871 Name, CurModule.CurrentModule);
4872 }
4873
4874 // Keep track of the fact that we have a forward ref to recycle it
Dan Gohmanf4423b12008-04-19 00:24:39 +00004875 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004876 V = GV;
4877 }
4878 }
4879
Dan Gohmanf4423b12008-04-19 00:24:39 +00004880 (yyval.ConstVal) = cast<GlobalValue>(V);
4881 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
Reid Spencer61c83e02006-08-18 08:43:06 +00004882 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004883 ;}
4884 break;
4885
Nick Lewyckyd802be32008-12-19 09:41:54 +00004886 case 189:
4887#line 1880 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004888 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004889 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004890 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4891 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
Eric Christopher2a5196f2008-09-24 04:55:49 +00004892 GEN_ERROR("Mismatched types for constant expression: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004893 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4894 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4895 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004896 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004897 ;}
4898 break;
4899
Nick Lewyckyd802be32008-12-19 09:41:54 +00004900 case 190:
4901#line 1890 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004902 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004903 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004904 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4905 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004906 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4907 GEN_ERROR("Cannot create a null initialized value of this type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004908 (yyval.ConstVal) = Constant::getNullValue(Ty);
4909 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004910 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004911 ;}
4912 break;
4913
Nick Lewyckyd802be32008-12-19 09:41:54 +00004914 case 191:
4915#line 1900 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004916 { // integral constants
Chris Lattner740e7092008-10-15 06:16:57 +00004917 if (IntegerType *IT = dyn_cast<IntegerType>((yyvsp[(1) - (2)].TypeVal)->get())) {
4918 if (!ConstantInt::isValueValidForType(IT, (yyvsp[(2) - (2)].SInt64Val)))
4919 GEN_ERROR("Constant value doesn't fit in type");
4920 (yyval.ConstVal) = ConstantInt::get(IT, (yyvsp[(2) - (2)].SInt64Val), true);
4921 } else {
4922 GEN_ERROR("integer constant must have integer type");
4923 }
4924 delete (yyvsp[(1) - (2)].TypeVal);
4925 CHECK_FOR_ERROR
4926 ;}
4927 break;
4928
Nick Lewyckyd802be32008-12-19 09:41:54 +00004929 case 192:
4930#line 1911 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00004931 { // arbitrary precision integer constants
4932 if (IntegerType *IT = dyn_cast<IntegerType>((yyvsp[(1) - (2)].TypeVal)->get())) {
4933 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > IT->getBitWidth())
4934 GEN_ERROR("Constant value does not fit in type");
4935 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(IT->getBitWidth());
4936 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4937 } else {
4938 GEN_ERROR("integer constant must have integer type");
4939 }
4940 delete (yyvsp[(1) - (2)].TypeVal);
4941 delete (yyvsp[(2) - (2)].APIntVal);
4942 CHECK_FOR_ERROR
4943 ;}
4944 break;
4945
Nick Lewyckyd802be32008-12-19 09:41:54 +00004946 case 193:
4947#line 1924 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00004948 { // integral constants
4949 if (IntegerType *IT = dyn_cast<IntegerType>((yyvsp[(1) - (2)].TypeVal)->get())) {
4950 if (!ConstantInt::isValueValidForType(IT, (yyvsp[(2) - (2)].UInt64Val)))
4951 GEN_ERROR("Constant value doesn't fit in type");
4952 (yyval.ConstVal) = ConstantInt::get(IT, (yyvsp[(2) - (2)].UInt64Val), false);
4953 } else {
4954 GEN_ERROR("integer constant must have integer type");
4955 }
4956 delete (yyvsp[(1) - (2)].TypeVal);
4957 CHECK_FOR_ERROR
4958 ;}
4959 break;
4960
Nick Lewyckyd802be32008-12-19 09:41:54 +00004961 case 194:
4962#line 1935 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00004963 { // arbitrary precision integer constants
4964 if (IntegerType *IT = dyn_cast<IntegerType>((yyvsp[(1) - (2)].TypeVal)->get())) {
4965 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > IT->getBitWidth())
4966 GEN_ERROR("Constant value does not fit in type");
4967 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(IT->getBitWidth());
4968 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4969 } else {
4970 GEN_ERROR("integer constant must have integer type");
4971 }
4972
4973 delete (yyvsp[(2) - (2)].APIntVal);
4974 delete (yyvsp[(1) - (2)].TypeVal);
4975 CHECK_FOR_ERROR
4976 ;}
4977 break;
4978
Nick Lewyckyd802be32008-12-19 09:41:54 +00004979 case 195:
4980#line 1949 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00004981 { // Boolean constants
4982 if ((yyvsp[(1) - (2)].TypeVal)->get() != Type::Int1Ty)
4983 GEN_ERROR("Constant true must have type i1");
4984 (yyval.ConstVal) = ConstantInt::getTrue();
4985 delete (yyvsp[(1) - (2)].TypeVal);
4986 CHECK_FOR_ERROR
4987 ;}
4988 break;
4989
Nick Lewyckyd802be32008-12-19 09:41:54 +00004990 case 196:
4991#line 1956 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00004992 { // Boolean constants
4993 if ((yyvsp[(1) - (2)].TypeVal)->get() != Type::Int1Ty)
4994 GEN_ERROR("Constant false must have type i1");
4995 (yyval.ConstVal) = ConstantInt::getFalse();
4996 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer38c91a92007-02-28 02:24:54 +00004997 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004998 ;}
4999 break;
5000
Nick Lewyckyd802be32008-12-19 09:41:54 +00005001 case 197:
5002#line 1963 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005003 { // Floating point constants
Chris Lattner740e7092008-10-15 06:16:57 +00005004 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].TypeVal)->get(), *(yyvsp[(2) - (2)].FPVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005005 GEN_ERROR("Floating point constant invalid for type");
Chris Lattner740e7092008-10-15 06:16:57 +00005006
Eric Christopher2a5196f2008-09-24 04:55:49 +00005007 // Lexer has no type info, so builds all float and double FP constants
Dale Johannesenc72cd7e2007-09-11 18:33:39 +00005008 // as double. Fix this here. Long double is done right.
Chris Lattner740e7092008-10-15 06:16:57 +00005009 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].TypeVal)->get()==Type::FloatTy) {
Dale Johannesen236bbd42008-10-09 23:01:34 +00005010 bool ignored;
5011 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven,
5012 &ignored);
5013 }
Chris Lattnerd8eb63f2008-04-20 00:41:19 +00005014 (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal));
Chris Lattner740e7092008-10-15 06:16:57 +00005015 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005016 delete (yyvsp[(2) - (2)].FPVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005017 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005018 ;}
5019 break;
5020
Nick Lewyckyd802be32008-12-19 09:41:54 +00005021 case 198:
5022#line 1981 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005023 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005024 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005025 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
5026 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
5027 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
5028 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005029 GEN_ERROR("invalid cast opcode for cast from '" +
5030 Val->getType()->getDescription() + "' to '" +
Eric Christopher2a5196f2008-09-24 04:55:49 +00005031 DestTy->getDescription() + "'");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005032 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
5033 delete (yyvsp[(5) - (6)].TypeVal);
5034 ;}
5035 break;
5036
Nick Lewyckyd802be32008-12-19 09:41:54 +00005037 case 199:
5038#line 1993 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005039 {
5040 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
Reid Spencerb5334b02007-02-05 10:18:06 +00005041 GEN_ERROR("GetElementPtr requires a pointer operand");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005042
5043 const Type *IdxTy =
Dan Gohman041e2eb2008-05-15 19:50:34 +00005044 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005045 if (!IdxTy)
Reid Spencerb5334b02007-02-05 10:18:06 +00005046 GEN_ERROR("Index list invalid for constant getelementptr");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005047
Chris Lattnerf7469af2007-01-31 04:44:08 +00005048 SmallVector<Constant*, 8> IdxVec;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005049 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
5050 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005051 IdxVec.push_back(C);
5052 else
Reid Spencerb5334b02007-02-05 10:18:06 +00005053 GEN_ERROR("Indices to constant getelementptr must be constants");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005054
Dan Gohmanf4423b12008-04-19 00:24:39 +00005055 delete (yyvsp[(4) - (5)].ValueList);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005056
Dan Gohmanf4423b12008-04-19 00:24:39 +00005057 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
Andrew Lenharth6353e052006-12-08 18:07:09 +00005058 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005059 ;}
5060 break;
5061
Nick Lewyckyd802be32008-12-19 09:41:54 +00005062 case 200:
5063#line 2014 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005064 {
5065 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005066 GEN_ERROR("Select condition must be of boolean type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005067 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005068 GEN_ERROR("Select operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005069 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005070 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005071 ;}
5072 break;
5073
Nick Lewyckyd802be32008-12-19 09:41:54 +00005074 case 201:
5075#line 2022 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005076 {
5077 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005078 GEN_ERROR("Binary operator types must match");
5079 CHECK_FOR_ERROR;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005080 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
5081 ;}
5082 break;
5083
Nick Lewyckyd802be32008-12-19 09:41:54 +00005084 case 202:
5085#line 2028 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005086 {
5087 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005088 GEN_ERROR("Logical operator types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005089 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
Eric Christopher2a5196f2008-09-24 04:55:49 +00005090 if (!isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
Dan Gohmanf4423b12008-04-19 00:24:39 +00005091 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005092 GEN_ERROR("Logical operator requires integral operands");
5093 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00005094 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005095 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005096 ;}
5097 break;
5098
Nick Lewyckyd802be32008-12-19 09:41:54 +00005099 case 203:
5100#line 2039 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005101 {
5102 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005103 GEN_ERROR("icmp operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005104 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5105 ;}
5106 break;
5107
Nick Lewyckyd802be32008-12-19 09:41:54 +00005108 case 204:
5109#line 2044 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005110 {
5111 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005112 GEN_ERROR("fcmp operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005113 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5114 ;}
5115 break;
5116
Nick Lewyckyd802be32008-12-19 09:41:54 +00005117 case 205:
5118#line 2049 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00005119 {
5120 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5121 GEN_ERROR("vicmp operand types must match");
5122 (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5123 ;}
5124 break;
5125
Nick Lewyckyd802be32008-12-19 09:41:54 +00005126 case 206:
5127#line 2054 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00005128 {
5129 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5130 GEN_ERROR("vfcmp operand types must match");
5131 (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5132 ;}
5133 break;
5134
Nick Lewyckyd802be32008-12-19 09:41:54 +00005135 case 207:
5136#line 2059 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005137 {
5138 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005139 GEN_ERROR("Invalid extractelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005140 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00005141 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005142 ;}
5143 break;
5144
Nick Lewyckyd802be32008-12-19 09:41:54 +00005145 case 208:
5146#line 2065 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005147 {
5148 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005149 GEN_ERROR("Invalid insertelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005150 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00005151 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005152 ;}
5153 break;
5154
Nick Lewyckyd802be32008-12-19 09:41:54 +00005155 case 209:
5156#line 2071 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005157 {
5158 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005159 GEN_ERROR("Invalid shufflevector operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005160 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00005161 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005162 ;}
5163 break;
5164
Nick Lewyckyd802be32008-12-19 09:41:54 +00005165 case 210:
5166#line 2077 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005167 {
5168 if (!isa<StructType>((yyvsp[(3) - (5)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (5)].ConstVal)->getType()))
5169 GEN_ERROR("ExtractValue requires an aggregate operand");
5170
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005171 (yyval.ConstVal) = ConstantExpr::getExtractValue((yyvsp[(3) - (5)].ConstVal), &(*(yyvsp[(4) - (5)].ConstantList))[0], (yyvsp[(4) - (5)].ConstantList)->size());
5172 delete (yyvsp[(4) - (5)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00005173 CHECK_FOR_ERROR
5174 ;}
5175 break;
5176
Nick Lewyckyd802be32008-12-19 09:41:54 +00005177 case 211:
5178#line 2085 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005179 {
5180 if (!isa<StructType>((yyvsp[(3) - (7)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (7)].ConstVal)->getType()))
5181 GEN_ERROR("InsertValue requires an aggregate operand");
5182
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005183 (yyval.ConstVal) = ConstantExpr::getInsertValue((yyvsp[(3) - (7)].ConstVal), (yyvsp[(5) - (7)].ConstVal), &(*(yyvsp[(6) - (7)].ConstantList))[0], (yyvsp[(6) - (7)].ConstantList)->size());
5184 delete (yyvsp[(6) - (7)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00005185 CHECK_FOR_ERROR
5186 ;}
5187 break;
5188
Nick Lewyckyd802be32008-12-19 09:41:54 +00005189 case 212:
5190#line 2096 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005191 {
5192 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005193 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005194 ;}
5195 break;
5196
Nick Lewyckyd802be32008-12-19 09:41:54 +00005197 case 213:
5198#line 2100 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005199 {
5200 (yyval.ConstVector) = new std::vector<Constant*>();
5201 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005202 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005203 ;}
5204 break;
5205
Nick Lewyckyd802be32008-12-19 09:41:54 +00005206 case 214:
5207#line 2108 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005208 { (yyval.BoolVal) = false; ;}
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005209 break;
5210
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005211 case 215:
Nick Lewyckyd802be32008-12-19 09:41:54 +00005212#line 2108 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewycky02ff3082008-11-24 03:41:24 +00005213 { (yyval.BoolVal) = true; ;}
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005214 break;
5215
5216 case 216:
Nick Lewyckyd802be32008-12-19 09:41:54 +00005217#line 2111 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
5218 { (yyval.BoolVal) = true; ;}
Nick Lewyckyfd7eb722008-12-15 07:31:07 +00005219 break;
5220
Bill Wendling29bc4f02008-12-17 20:59:57 +00005221 case 217:
Nick Lewyckyd802be32008-12-19 09:41:54 +00005222#line 2111 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
5223 { (yyval.BoolVal) = false; ;}
5224 break;
5225
5226 case 218:
5227#line 2114 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005228 {
5229 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
5230 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
Chris Lattner0275cff2007-08-06 21:00:46 +00005231 CHECK_FOR_ERROR
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005232 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
5233 if (!Aliasee)
5234 GEN_ERROR("Aliases can be created only to global values");
5235
Dan Gohmanf4423b12008-04-19 00:24:39 +00005236 (yyval.ConstVal) = Aliasee;
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005237 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005238 delete (yyvsp[(1) - (2)].TypeVal);
5239 ;}
5240 break;
5241
Nick Lewyckyd802be32008-12-19 09:41:54 +00005242 case 219:
5243#line 2126 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005244 {
5245 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
5246 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
5247 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005248 GEN_ERROR("invalid cast opcode for cast from '" +
5249 Val->getType()->getDescription() + "' to '" +
5250 DestTy->getDescription() + "'");
Eric Christopher2a5196f2008-09-24 04:55:49 +00005251
Dan Gohmanf4423b12008-04-19 00:24:39 +00005252 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005253 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005254 delete (yyvsp[(5) - (6)].TypeVal);
5255 ;}
5256 break;
5257
Nick Lewycky02ff3082008-11-24 03:41:24 +00005258 case 220:
Nick Lewyckyd802be32008-12-19 09:41:54 +00005259#line 2147 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewycky02ff3082008-11-24 03:41:24 +00005260 {
5261 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5262 CurModule.ModuleDone();
5263 CHECK_FOR_ERROR;
5264 ;}
Devang Patel652203f2008-09-29 20:49:50 +00005265 break;
5266
Nick Lewyckyd802be32008-12-19 09:41:54 +00005267 case 221:
5268#line 2152 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
5269 {
5270 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5271 CurModule.ModuleDone();
5272 CHECK_FOR_ERROR;
5273 ;}
Nick Lewyckyfd7eb722008-12-15 07:31:07 +00005274 break;
5275
Bill Wendling29bc4f02008-12-17 20:59:57 +00005276 case 224:
Nick Lewyckyd802be32008-12-19 09:41:54 +00005277#line 2165 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
5278 { CurFun.isDeclare = false; ;}
5279 break;
5280
5281 case 225:
5282#line 2165 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005283 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005284 CurFun.FunctionDone();
5285 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005286 ;}
5287 break;
5288
Nick Lewyckyd802be32008-12-19 09:41:54 +00005289 case 226:
5290#line 2169 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005291 { CurFun.isDeclare = true; ;}
5292 break;
5293
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005294 case 227:
Nick Lewyckyd802be32008-12-19 09:41:54 +00005295#line 2169 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewycky02ff3082008-11-24 03:41:24 +00005296 {
5297 CHECK_FOR_ERROR
5298 ;}
5299 break;
5300
5301 case 228:
Nick Lewyckyd802be32008-12-19 09:41:54 +00005302#line 2172 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
5303 {
5304 CHECK_FOR_ERROR
5305 ;}
5306 break;
5307
5308 case 229:
5309#line 2175 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005310 {
Reid Spencer14310612006-12-31 05:40:51 +00005311 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005312 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005313 // Eagerly resolve types. This is not an optimization, this is a
5314 // requirement that is due to the fact that we could have this:
5315 //
5316 // %list = type { %list * }
5317 // %list = type { %list * } ; repeated type decl
5318 //
5319 // If types are not resolved eagerly, then the two types will not be
5320 // determined to be the same type!
5321 //
Dan Gohmanf4423b12008-04-19 00:24:39 +00005322 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005323
Dan Gohmanf4423b12008-04-19 00:24:39 +00005324 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Reid Spencer5b7e7532006-09-28 19:28:24 +00005325 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005326 // If this is a named type that is not a redefinition, add it to the slot
5327 // table.
Dan Gohmanf4423b12008-04-19 00:24:39 +00005328 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005329 }
Reid Spencera132e042006-12-03 05:46:11 +00005330
Dan Gohmanf4423b12008-04-19 00:24:39 +00005331 delete (yyvsp[(3) - (3)].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005332 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005333 ;}
5334 break;
Reid Spencerb8f85052007-07-31 03:50:36 +00005335
Nick Lewyckyd802be32008-12-19 09:41:54 +00005336 case 230:
5337#line 2199 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005338 {
5339 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
5340
5341 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005342 CHECK_FOR_ERROR
5343 // If this is a named type that is not a redefinition, add it to the slot
5344 // table.
Dan Gohmanf4423b12008-04-19 00:24:39 +00005345 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005346 }
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005347 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005348 ;}
5349 break;
5350
Nick Lewyckyd802be32008-12-19 09:41:54 +00005351 case 231:
5352#line 2211 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Eric Christopher2a5196f2008-09-24 04:55:49 +00005353 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005354 /* "Externally Visible" Linkage */
Eric Christopher2a5196f2008-09-24 04:55:49 +00005355 if ((yyvsp[(5) - (6)].ConstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005356 GEN_ERROR("Global value initializer is not a constant");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005357 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5358 (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 +00005359 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005360 ;}
5361 break;
5362
Nick Lewyckyd802be32008-12-19 09:41:54 +00005363 case 232:
5364#line 2218 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005365 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005366 CurGV = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005367 ;}
5368 break;
5369
Nick Lewyckyd802be32008-12-19 09:41:54 +00005370 case 233:
5371#line 2222 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005372 {
Eric Christopher2a5196f2008-09-24 04:55:49 +00005373 if ((yyvsp[(6) - (7)].ConstVal) == 0)
Christopher Lambbf3348d2007-12-12 08:45:45 +00005374 GEN_ERROR("Global value initializer is not a constant");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005375 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 +00005376 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005377 ;}
5378 break;
5379
Nick Lewyckyd802be32008-12-19 09:41:54 +00005380 case 234:
5381#line 2227 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005382 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005383 CurGV = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005384 ;}
5385 break;
5386
Nick Lewyckyd802be32008-12-19 09:41:54 +00005387 case 235:
5388#line 2231 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005389 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005390 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005391 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5392 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 +00005393 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005394 delete (yyvsp[(6) - (7)].TypeVal);
5395 ;}
5396 break;
5397
Nick Lewyckyd802be32008-12-19 09:41:54 +00005398 case 236:
5399#line 2237 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005400 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005401 CurGV = 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +00005402 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005403 ;}
5404 break;
5405
Nick Lewyckyd802be32008-12-19 09:41:54 +00005406 case 237:
5407#line 2241 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005408 {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005409 std::string Name;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005410 if ((yyvsp[(1) - (5)].StrVal)) {
5411 Name = *(yyvsp[(1) - (5)].StrVal);
5412 delete (yyvsp[(1) - (5)].StrVal);
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005413 }
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005414 if (Name.empty())
5415 GEN_ERROR("Alias name cannot be empty");
Eric Christopher2a5196f2008-09-24 04:55:49 +00005416
Dan Gohmanf4423b12008-04-19 00:24:39 +00005417 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005418 if (Aliasee == 0)
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005419 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005420
Dan Gohmanf4423b12008-04-19 00:24:39 +00005421 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005422 CurModule.CurrentModule);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005423 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005424 InsertValue(GA, CurModule.Values);
Eric Christopher2a5196f2008-09-24 04:55:49 +00005425
5426
Chris Lattner569f7372007-09-10 23:24:14 +00005427 // If there was a forward reference of this alias, resolve it now.
Eric Christopher2a5196f2008-09-24 04:55:49 +00005428
Chris Lattner569f7372007-09-10 23:24:14 +00005429 ValID ID;
5430 if (!Name.empty())
5431 ID = ValID::createGlobalName(Name);
5432 else
5433 ID = ValID::createGlobalID(CurModule.Values.size()-1);
Eric Christopher2a5196f2008-09-24 04:55:49 +00005434
Chris Lattner569f7372007-09-10 23:24:14 +00005435 if (GlobalValue *FWGV =
5436 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5437 // Replace uses of the fwdref with the actual alias.
5438 FWGV->replaceAllUsesWith(GA);
5439 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5440 GV->eraseFromParent();
5441 else
5442 cast<Function>(FWGV)->eraseFromParent();
5443 }
5444 ID.destroy();
Eric Christopher2a5196f2008-09-24 04:55:49 +00005445
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005446 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005447 ;}
5448 break;
5449
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005450 case 238:
Nick Lewyckyd802be32008-12-19 09:41:54 +00005451#line 2281 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nick Lewycky02ff3082008-11-24 03:41:24 +00005452 {
5453 CHECK_FOR_ERROR
5454 ;}
5455 break;
5456
5457 case 239:
Nick Lewyckyd802be32008-12-19 09:41:54 +00005458#line 2284 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
5459 {
5460 CHECK_FOR_ERROR
5461 ;}
5462 break;
5463
5464 case 240:
5465#line 2290 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005466 {
Chris Lattner66316012006-01-24 04:14:29 +00005467 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
Chris Lattner66316012006-01-24 04:14:29 +00005468 if (AsmSoFar.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005469 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
Chris Lattner66316012006-01-24 04:14:29 +00005470 else
Dan Gohmanf4423b12008-04-19 00:24:39 +00005471 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5472 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00005473 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005474;}
5475 break;
5476
Nick Lewyckyd802be32008-12-19 09:41:54 +00005477 case 241:
5478#line 2300 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005479 {
5480 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5481 delete (yyvsp[(3) - (3)].StrVal);
5482 ;}
5483 break;
5484
Nick Lewyckyd802be32008-12-19 09:41:54 +00005485 case 242:
5486#line 2304 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005487 {
5488 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5489 delete (yyvsp[(3) - (3)].StrVal);
5490 ;}
5491 break;
5492
Nick Lewyckyd802be32008-12-19 09:41:54 +00005493 case 244:
5494#line 2311 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005495 {
5496 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5497 delete (yyvsp[(3) - (3)].StrVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00005498 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005499 ;}
5500 break;
5501
Nick Lewyckyd802be32008-12-19 09:41:54 +00005502 case 245:
5503#line 2316 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005504 {
5505 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5506 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer1013b4d2007-07-31 14:41:17 +00005507 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005508 ;}
5509 break;
5510
Nick Lewyckyd802be32008-12-19 09:41:54 +00005511 case 246:
5512#line 2321 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005513 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005514 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005515 ;}
5516 break;
5517
Nick Lewyckyd802be32008-12-19 09:41:54 +00005518 case 247:
5519#line 2330 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005520 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005521 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005522 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005523 if (!(*(yyvsp[(3) - (5)].TypeVal))->isFirstClassType())
5524 GEN_ERROR("Argument types must be first-class");
Devang Patel05988662008-09-25 21:00:45 +00005525 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 +00005526 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5527 (yyvsp[(1) - (5)].ArgList)->push_back(E);
Reid Spencer6f407902007-01-13 05:00:46 +00005528 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005529 ;}
5530 break;
5531
Nick Lewyckyd802be32008-12-19 09:41:54 +00005532 case 248:
5533#line 2340 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005534 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005535 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005536 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005537 if (!(*(yyvsp[(1) - (3)].TypeVal))->isFirstClassType())
5538 GEN_ERROR("Argument types must be first-class");
Devang Patel05988662008-09-25 21:00:45 +00005539 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 +00005540 (yyval.ArgList) = new ArgListType;
5541 (yyval.ArgList)->push_back(E);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005542 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005543 ;}
5544 break;
5545
Nick Lewyckyd802be32008-12-19 09:41:54 +00005546 case 249:
5547#line 2351 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005548 {
5549 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005550 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005551 ;}
5552 break;
5553
Nick Lewyckyd802be32008-12-19 09:41:54 +00005554 case 250:
5555#line 2355 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005556 {
5557 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005558 struct ArgListEntry E;
5559 E.Ty = new PATypeHolder(Type::VoidTy);
5560 E.Name = 0;
Devang Patel05988662008-09-25 21:00:45 +00005561 E.Attrs = Attribute::None;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005562 (yyval.ArgList)->push_back(E);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005563 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005564 ;}
5565 break;
5566
Nick Lewyckyd802be32008-12-19 09:41:54 +00005567 case 251:
5568#line 2364 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005569 {
5570 (yyval.ArgList) = new ArgListType;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005571 struct ArgListEntry E;
5572 E.Ty = new PATypeHolder(Type::VoidTy);
5573 E.Name = 0;
Devang Patel05988662008-09-25 21:00:45 +00005574 E.Attrs = Attribute::None;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005575 (yyval.ArgList)->push_back(E);
Reid Spencer61c83e02006-08-18 08:43:06 +00005576 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005577 ;}
5578 break;
5579
Nick Lewyckyd802be32008-12-19 09:41:54 +00005580 case 252:
5581#line 2373 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005582 {
5583 (yyval.ArgList) = 0;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005584 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005585 ;}
5586 break;
5587
Nick Lewyckyd802be32008-12-19 09:41:54 +00005588 case 253:
5589#line 2379 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005590 {
Devang Patel652203f2008-09-29 20:49:50 +00005591 std::string FunctionName(*(yyvsp[(4) - (11)].StrVal));
5592 delete (yyvsp[(4) - (11)].StrVal); // Free strdup'd memory!
Eric Christopher2a5196f2008-09-24 04:55:49 +00005593
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005594 // Check the function result for abstractness if this is a define. We should
5595 // have no abstract types at this point
Devang Patel652203f2008-09-29 20:49:50 +00005596 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(3) - (11)].TypeVal)))
5597 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(3) - (11)].TypeVal)->get()->getDescription());
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005598
Devang Patel652203f2008-09-29 20:49:50 +00005599 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (11)].TypeVal)))
Chris Lattnera925a142008-04-23 05:37:08 +00005600 GEN_ERROR("Invalid result type for LLVM function");
Eric Christopher2a5196f2008-09-24 04:55:49 +00005601
Reid Spencer68a24bd2005-08-27 18:50:39 +00005602 std::vector<const Type*> ParamTypeList;
Devang Patel05988662008-09-25 21:00:45 +00005603 SmallVector<AttributeWithIndex, 8> Attrs;
Dale Johannesene7261862008-09-26 23:46:20 +00005604 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
5605 //attributes.
Devang Patel652203f2008-09-29 20:49:50 +00005606 Attributes RetAttrs = (yyvsp[(2) - (11)].Attributes);
5607 if ((yyvsp[(8) - (11)].Attributes) != Attribute::None) {
5608 if ((yyvsp[(8) - (11)].Attributes) & Attribute::ZExt) {
Dale Johannesene7261862008-09-26 23:46:20 +00005609 RetAttrs = RetAttrs | Attribute::ZExt;
Devang Patel652203f2008-09-29 20:49:50 +00005610 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::ZExt;
Dale Johannesene7261862008-09-26 23:46:20 +00005611 }
Devang Patel652203f2008-09-29 20:49:50 +00005612 if ((yyvsp[(8) - (11)].Attributes) & Attribute::SExt) {
Dale Johannesene7261862008-09-26 23:46:20 +00005613 RetAttrs = RetAttrs | Attribute::SExt;
Devang Patel652203f2008-09-29 20:49:50 +00005614 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::SExt;
Dale Johannesene7261862008-09-26 23:46:20 +00005615 }
Devang Patel652203f2008-09-29 20:49:50 +00005616 if ((yyvsp[(8) - (11)].Attributes) & Attribute::InReg) {
Dale Johannesene7261862008-09-26 23:46:20 +00005617 RetAttrs = RetAttrs | Attribute::InReg;
Devang Patel652203f2008-09-29 20:49:50 +00005618 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::InReg;
Dale Johannesene7261862008-09-26 23:46:20 +00005619 }
Dale Johannesene7261862008-09-26 23:46:20 +00005620 }
Devang Patel652203f2008-09-29 20:49:50 +00005621 if (RetAttrs != Attribute::None)
5622 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
5623 if ((yyvsp[(6) - (11)].ArgList)) { // If there are arguments...
Reid Spencer7b5d4662007-04-09 06:16:21 +00005624 unsigned index = 1;
Devang Patel652203f2008-09-29 20:49:50 +00005625 for (ArgListType::iterator I = (yyvsp[(6) - (11)].ArgList)->begin(); I != (yyvsp[(6) - (11)].ArgList)->end(); ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00005626 const Type* Ty = I->Ty->get();
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005627 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5628 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
Reid Spencer14310612006-12-31 05:40:51 +00005629 ParamTypeList.push_back(Ty);
Devang Patel05988662008-09-25 21:00:45 +00005630 if (Ty != Type::VoidTy && I->Attrs != Attribute::None)
5631 Attrs.push_back(AttributeWithIndex::get(index, I->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00005632 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005633 }
Devang Patel652203f2008-09-29 20:49:50 +00005634 if ((yyvsp[(8) - (11)].Attributes) != Attribute::None)
5635 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(8) - (11)].Attributes)));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005636
5637 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5638 if (isVarArg) ParamTypeList.pop_back();
5639
Devang Patel05988662008-09-25 21:00:45 +00005640 AttrListPtr PAL;
Christopher Lamb5c104242007-04-22 20:09:11 +00005641 if (!Attrs.empty())
Devang Patel05988662008-09-25 21:00:45 +00005642 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
Reid Spencer7b5d4662007-04-09 06:16:21 +00005643
Devang Patel652203f2008-09-29 20:49:50 +00005644 FunctionType *FT = FunctionType::get(*(yyvsp[(3) - (11)].TypeVal), ParamTypeList, isVarArg);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00005645 const PointerType *PFT = PointerType::getUnqual(FT);
Devang Patel652203f2008-09-29 20:49:50 +00005646 delete (yyvsp[(3) - (11)].TypeVal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005647
5648 ValID ID;
5649 if (!FunctionName.empty()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005650 ID = ValID::createGlobalName((char*)FunctionName.c_str());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005651 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00005652 ID = ValID::createGlobalID(CurModule.Values.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005653 }
5654
5655 Function *Fn = 0;
5656 // See if this function was forward referenced. If so, recycle the object.
5657 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
Eric Christopher2a5196f2008-09-24 04:55:49 +00005658 // Move the function to the end of the list, from whereever it was
Reid Spencer68a24bd2005-08-27 18:50:39 +00005659 // previously inserted.
5660 Fn = cast<Function>(FWRef);
Devang Patel05988662008-09-25 21:00:45 +00005661 assert(Fn->getAttributes().isEmpty() &&
Chris Lattner58d74912008-03-12 17:45:29 +00005662 "Forward reference has parameter attributes!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005663 CurModule.CurrentModule->getFunctionList().remove(Fn);
5664 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5665 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
Reid Spenceref9b9a72007-02-05 20:47:22 +00005666 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
Duncan Sandsdc024672007-11-27 13:23:08 +00005667 if (Fn->getFunctionType() != FT ) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00005668 // The existing function doesn't have the same type. This is an overload
5669 // error.
5670 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Devang Patel05988662008-09-25 21:00:45 +00005671 } else if (Fn->getAttributes() != PAL) {
Duncan Sandsdc024672007-11-27 13:23:08 +00005672 // The existing function doesn't have the same parameter attributes.
5673 // This is an overload error.
5674 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Reid Spenceref9b9a72007-02-05 20:47:22 +00005675 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
Chris Lattner6cdc6822007-04-26 05:31:05 +00005676 // Neither the existing or the current function is a declaration and they
5677 // have the same name and same type. Clearly this is a redefinition.
5678 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
Duncan Sandsdc024672007-11-27 13:23:08 +00005679 } else if (Fn->isDeclaration()) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00005680 // Make sure to strip off any argument names so we can't get conflicts.
Reid Spencer68a24bd2005-08-27 18:50:39 +00005681 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5682 AI != AE; ++AI)
5683 AI->setName("");
Reid Spenceref9b9a72007-02-05 20:47:22 +00005684 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005685 } else { // Not already defined?
Gabor Greife64d2482008-04-06 23:07:54 +00005686 Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5687 CurModule.CurrentModule);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005688 InsertValue(Fn, CurModule.Values);
5689 }
5690
Nuno Lopes9e9631d2008-10-03 15:45:58 +00005691 ID.destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +00005692 CurFun.FunctionStart(Fn);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00005693
5694 if (CurFun.isDeclare) {
5695 // If we have declaration, always overwrite linkage. This will allow us to
5696 // correctly handle cases, when pointer to function is passed as argument to
5697 // another function.
5698 Fn->setLinkage(CurFun.Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005699 Fn->setVisibility(CurFun.Visibility);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00005700 }
Devang Pateld4980812008-09-02 20:52:40 +00005701 Fn->setCallingConv((yyvsp[(1) - (11)].UIntVal));
Devang Patel05988662008-09-25 21:00:45 +00005702 Fn->setAttributes(PAL);
Devang Patel652203f2008-09-29 20:49:50 +00005703 Fn->setAlignment((yyvsp[(10) - (11)].UIntVal));
5704 if ((yyvsp[(9) - (11)].StrVal)) {
5705 Fn->setSection(*(yyvsp[(9) - (11)].StrVal));
5706 delete (yyvsp[(9) - (11)].StrVal);
Gordon Henriksen80a75bf2007-12-10 03:18:06 +00005707 }
Devang Patel652203f2008-09-29 20:49:50 +00005708 if ((yyvsp[(11) - (11)].StrVal)) {
5709 Fn->setGC((yyvsp[(11) - (11)].StrVal)->c_str());
5710 delete (yyvsp[(11) - (11)].StrVal);
Chris Lattnere869eef2005-11-12 00:11:49 +00005711 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005712
5713 // Add all of the arguments we parsed to the function...
Devang Patel652203f2008-09-29 20:49:50 +00005714 if ((yyvsp[(6) - (11)].ArgList)) { // Is null if empty...
Reid Spencer68a24bd2005-08-27 18:50:39 +00005715 if (isVarArg) { // Nuke the last entry
Devang Patel652203f2008-09-29 20:49:50 +00005716 assert((yyvsp[(6) - (11)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(6) - (11)].ArgList)->back().Name == 0 &&
Reid Spencera9720f52007-02-05 17:04:00 +00005717 "Not a varargs marker!");
Devang Patel652203f2008-09-29 20:49:50 +00005718 delete (yyvsp[(6) - (11)].ArgList)->back().Ty;
5719 (yyvsp[(6) - (11)].ArgList)->pop_back(); // Delete the last entry
Reid Spencer68a24bd2005-08-27 18:50:39 +00005720 }
5721 Function::arg_iterator ArgIt = Fn->arg_begin();
Reid Spenceref9b9a72007-02-05 20:47:22 +00005722 Function::arg_iterator ArgEnd = Fn->arg_end();
Reid Spencer14310612006-12-31 05:40:51 +00005723 unsigned Idx = 1;
Devang Patel652203f2008-09-29 20:49:50 +00005724 for (ArgListType::iterator I = (yyvsp[(6) - (11)].ArgList)->begin();
5725 I != (yyvsp[(6) - (11)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
Reid Spencer14310612006-12-31 05:40:51 +00005726 delete I->Ty; // Delete the typeholder...
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005727 setValueName(ArgIt, I->Name); // Insert arg into symtab...
Reid Spencer5b7e7532006-09-28 19:28:24 +00005728 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005729 InsertValue(ArgIt);
Reid Spencer14310612006-12-31 05:40:51 +00005730 Idx++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005731 }
Reid Spencera132e042006-12-03 05:46:11 +00005732
Devang Patel652203f2008-09-29 20:49:50 +00005733 delete (yyvsp[(6) - (11)].ArgList); // We're now done with the argument list
Reid Spencer68a24bd2005-08-27 18:50:39 +00005734 }
Reid Spencer61c83e02006-08-18 08:43:06 +00005735 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005736;}
5737 break;
5738
Nick Lewyckyd802be32008-12-19 09:41:54 +00005739 case 256:
5740#line 2529 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005741 {
5742 (yyval.FunctionVal) = CurFun.CurrentFunction;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005743
5744 // Make sure that we keep track of the linkage type even if there was a
5745 // previous "declare".
Dan Gohmanf4423b12008-04-19 00:24:39 +00005746 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5747 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5748;}
5749 break;
5750
Nick Lewyckyd802be32008-12-19 09:41:54 +00005751 case 259:
5752#line 2540 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005753 {
5754 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005755 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005756;}
5757 break;
5758
Nick Lewyckyd802be32008-12-19 09:41:54 +00005759 case 260:
5760#line 2545 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005761 {
5762 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5763 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5764 (yyval.FunctionVal) = CurFun.CurrentFunction;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005765 CurFun.FunctionDone();
Reid Spencer41dff5e2007-01-26 08:05:27 +00005766 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005767 ;}
5768 break;
5769
Nick Lewyckyd802be32008-12-19 09:41:54 +00005770 case 261:
5771#line 2557 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005772 {
5773 (yyval.BoolVal) = false;
Reid Spencer61c83e02006-08-18 08:43:06 +00005774 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005775 ;}
5776 break;
5777
Nick Lewyckyd802be32008-12-19 09:41:54 +00005778 case 262:
5779#line 2561 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005780 {
5781 (yyval.BoolVal) = true;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005782 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005783 ;}
5784 break;
5785
Nick Lewyckyd802be32008-12-19 09:41:54 +00005786 case 263:
5787#line 2566 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005788 { // A reference to a direct constant
5789 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005790 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005791 ;}
5792 break;
5793
Nick Lewyckyd802be32008-12-19 09:41:54 +00005794 case 264:
5795#line 2570 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005796 {
5797 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005798 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005799 ;}
5800 break;
5801
Nick Lewyckyd802be32008-12-19 09:41:54 +00005802 case 265:
5803#line 2574 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner1913b942008-07-11 00:30:39 +00005804 { // arbitrary precision integer constants
5805 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), true);
5806 delete (yyvsp[(1) - (1)].APIntVal);
5807 CHECK_FOR_ERROR
5808 ;}
5809 break;
5810
Nick Lewyckyd802be32008-12-19 09:41:54 +00005811 case 266:
5812#line 2579 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner1913b942008-07-11 00:30:39 +00005813 { // arbitrary precision integer constants
5814 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), false);
5815 delete (yyvsp[(1) - (1)].APIntVal);
5816 CHECK_FOR_ERROR
5817 ;}
5818 break;
5819
Nick Lewyckyd802be32008-12-19 09:41:54 +00005820 case 267:
5821#line 2584 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005822 { // Perhaps it's an FP constant?
5823 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00005824 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005825 ;}
5826 break;
5827
Nick Lewyckyd802be32008-12-19 09:41:54 +00005828 case 268:
5829#line 2588 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005830 {
5831 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
Reid Spencere4d87aa2006-12-23 06:05:41 +00005832 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005833 ;}
5834 break;
5835
Nick Lewyckyd802be32008-12-19 09:41:54 +00005836 case 269:
5837#line 2592 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005838 {
5839 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00005840 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005841 ;}
5842 break;
5843
Nick Lewyckyd802be32008-12-19 09:41:54 +00005844 case 270:
5845#line 2596 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005846 {
5847 (yyval.ValIDVal) = ValID::createNull();
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00005848 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005849 ;}
5850 break;
5851
Nick Lewyckyd802be32008-12-19 09:41:54 +00005852 case 271:
5853#line 2600 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005854 {
5855 (yyval.ValIDVal) = ValID::createUndef();
Reid Spencer61c83e02006-08-18 08:43:06 +00005856 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005857 ;}
5858 break;
5859
Nick Lewyckyd802be32008-12-19 09:41:54 +00005860 case 272:
5861#line 2604 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005862 { // A vector zero constant.
5863 (yyval.ValIDVal) = ValID::createZeroInit();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005864 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005865 ;}
5866 break;
5867
Nick Lewyckyd802be32008-12-19 09:41:54 +00005868 case 273:
5869#line 2608 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005870 { // Nonempty unsized packed vector
5871 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
Eric Christopher2a5196f2008-09-24 04:55:49 +00005872 unsigned NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005873
5874 if (!ETy->isInteger() && !ETy->isFloatingPoint())
5875 GEN_ERROR("Invalid vector element type: " + ETy->getDescription());
Eric Christopher2a5196f2008-09-24 04:55:49 +00005876
Reid Spencer9d6565a2007-02-15 02:26:10 +00005877 VectorType* pt = VectorType::get(ETy, NumElements);
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005878 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(pt));
Eric Christopher2a5196f2008-09-24 04:55:49 +00005879
Reid Spencer68a24bd2005-08-27 18:50:39 +00005880 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00005881 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5882 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Eric Christopher2a5196f2008-09-24 04:55:49 +00005883 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +00005884 ETy->getDescription() +"' as required!\nIt is of type '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00005885 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005886 }
5887
Dan Gohmanf4423b12008-04-19 00:24:39 +00005888 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5889 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
Reid Spencer832254e2007-02-02 02:16:23 +00005890 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005891 ;}
5892 break;
5893
Nick Lewyckyd802be32008-12-19 09:41:54 +00005894 case 274:
5895#line 2630 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005896 { // Nonempty unsized arr
5897 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
Eric Christopher2a5196f2008-09-24 04:55:49 +00005898 uint64_t NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005899
5900 if (!ETy->isFirstClassType())
5901 GEN_ERROR("Invalid array element type: " + ETy->getDescription());
5902
5903 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5904 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(ATy));
5905
5906 // Verify all elements are correct type!
5907 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5908 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Eric Christopher2a5196f2008-09-24 04:55:49 +00005909 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005910 ETy->getDescription() +"' as required!\nIt is of type '"+
5911 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5912 }
5913
5914 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, *(yyvsp[(2) - (3)].ConstVector)));
5915 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5916 CHECK_FOR_ERROR
5917 ;}
5918 break;
5919
Nick Lewyckyd802be32008-12-19 09:41:54 +00005920 case 275:
5921#line 2652 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005922 {
Dan Gohman180c1692008-06-23 18:43:26 +00005923 // Use undef instead of an array because it's inconvenient to determine
5924 // the element type at this point, there being no elements to examine.
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005925 (yyval.ValIDVal) = ValID::createUndef();
5926 CHECK_FOR_ERROR
5927 ;}
5928 break;
5929
Nick Lewyckyd802be32008-12-19 09:41:54 +00005930 case 276:
5931#line 2658 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005932 {
Dan Gohman180c1692008-06-23 18:43:26 +00005933 uint64_t NumElements = (yyvsp[(2) - (2)].StrVal)->length();
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005934 const Type *ETy = Type::Int8Ty;
5935
5936 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5937
5938 std::vector<Constant*> Vals;
5939 for (unsigned i = 0; i < (yyvsp[(2) - (2)].StrVal)->length(); ++i)
5940 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(2) - (2)].StrVal))[i]));
5941 delete (yyvsp[(2) - (2)].StrVal);
5942 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, Vals));
5943 CHECK_FOR_ERROR
5944 ;}
5945 break;
5946
Nick Lewyckyd802be32008-12-19 09:41:54 +00005947 case 277:
5948#line 2671 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005949 {
5950 std::vector<const Type*> Elements((yyvsp[(2) - (3)].ConstVector)->size());
5951 for (unsigned i = 0, e = (yyvsp[(2) - (3)].ConstVector)->size(); i != e; ++i)
5952 Elements[i] = (*(yyvsp[(2) - (3)].ConstVector))[i]->getType();
5953
5954 const StructType *STy = StructType::get(Elements);
5955 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5956
5957 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(2) - (3)].ConstVector)));
5958 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5959 CHECK_FOR_ERROR
5960 ;}
5961 break;
5962
Nick Lewyckyd802be32008-12-19 09:41:54 +00005963 case 278:
5964#line 2683 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005965 {
5966 const StructType *STy = StructType::get(std::vector<const Type*>());
5967 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5968 CHECK_FOR_ERROR
5969 ;}
5970 break;
5971
Nick Lewyckyd802be32008-12-19 09:41:54 +00005972 case 279:
5973#line 2688 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005974 {
5975 std::vector<const Type*> Elements((yyvsp[(3) - (5)].ConstVector)->size());
5976 for (unsigned i = 0, e = (yyvsp[(3) - (5)].ConstVector)->size(); i != e; ++i)
5977 Elements[i] = (*(yyvsp[(3) - (5)].ConstVector))[i]->getType();
5978
5979 const StructType *STy = StructType::get(Elements, /*isPacked=*/true);
5980 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5981
5982 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(3) - (5)].ConstVector)));
5983 delete PTy; delete (yyvsp[(3) - (5)].ConstVector);
5984 CHECK_FOR_ERROR
5985 ;}
5986 break;
5987
Nick Lewyckyd802be32008-12-19 09:41:54 +00005988 case 280:
5989#line 2700 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005990 {
5991 const StructType *STy = StructType::get(std::vector<const Type*>(),
5992 /*isPacked=*/true);
5993 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5994 CHECK_FOR_ERROR
5995 ;}
5996 break;
5997
Nick Lewyckyd802be32008-12-19 09:41:54 +00005998 case 281:
5999#line 2706 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006000 {
6001 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
Reid Spencer832254e2007-02-02 02:16:23 +00006002 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006003 ;}
6004 break;
6005
Nick Lewyckyd802be32008-12-19 09:41:54 +00006006 case 282:
6007#line 2710 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006008 {
6009 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
6010 delete (yyvsp[(3) - (5)].StrVal);
6011 delete (yyvsp[(5) - (5)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00006012 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006013 ;}
6014 break;
6015
Nick Lewyckyd802be32008-12-19 09:41:54 +00006016 case 283:
6017#line 2720 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006018 { // Is it an integer reference...?
6019 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006020 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006021 ;}
6022 break;
6023
Nick Lewyckyd802be32008-12-19 09:41:54 +00006024 case 284:
6025#line 2724 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006026 {
6027 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
Reid Spencer832254e2007-02-02 02:16:23 +00006028 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006029 ;}
6030 break;
6031
Nick Lewyckyd802be32008-12-19 09:41:54 +00006032 case 285:
6033#line 2728 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006034 { // Is it a named reference...?
6035 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
6036 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00006037 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006038 ;}
6039 break;
6040
Nick Lewyckyd802be32008-12-19 09:41:54 +00006041 case 286:
6042#line 2733 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006043 { // Is it a named reference...?
6044 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
6045 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00006046 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006047 ;}
6048 break;
6049
Nick Lewyckyd802be32008-12-19 09:41:54 +00006050 case 289:
6051#line 2746 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006052 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006053 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006054 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Eric Christopher2a5196f2008-09-24 04:55:49 +00006055 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
Dan Gohmanf4423b12008-04-19 00:24:39 +00006056 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer832254e2007-02-02 02:16:23 +00006057 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006058 ;}
6059 break;
6060
Nick Lewyckyd802be32008-12-19 09:41:54 +00006061 case 290:
6062#line 2755 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006063 {
6064 (yyval.ValueList) = new std::vector<Value *>();
Eric Christopher2a5196f2008-09-24 04:55:49 +00006065 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
Devang Patel7990dc72008-02-20 22:40:23 +00006066 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006067 ;}
6068 break;
6069
Nick Lewyckyd802be32008-12-19 09:41:54 +00006070 case 291:
6071#line 2760 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006072 {
Eric Christopher2a5196f2008-09-24 04:55:49 +00006073 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
Devang Patel7990dc72008-02-20 22:40:23 +00006074 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006075 ;}
6076 break;
6077
Nick Lewyckyd802be32008-12-19 09:41:54 +00006078 case 292:
6079#line 2765 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006080 {
6081 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006082 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006083 ;}
6084 break;
6085
Nick Lewyckyd802be32008-12-19 09:41:54 +00006086 case 293:
6087#line 2769 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Eric Christopher2a5196f2008-09-24 04:55:49 +00006088 { // Do not allow functions with 0 basic blocks
Dan Gohmanf4423b12008-04-19 00:24:39 +00006089 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006090 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006091 ;}
6092 break;
6093
Nick Lewyckyd802be32008-12-19 09:41:54 +00006094 case 294:
6095#line 2778 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006096 {
6097 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006098 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006099 InsertValue((yyvsp[(3) - (3)].TermInstVal));
6100 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
6101 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006102 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006103 ;}
6104 break;
6105
Nick Lewyckyd802be32008-12-19 09:41:54 +00006106 case 295:
6107#line 2787 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00006108 {
6109 CHECK_FOR_ERROR
6110 int ValNum = InsertValue((yyvsp[(3) - (3)].TermInstVal));
6111 if (ValNum != (int)(yyvsp[(2) - (3)].UIntVal))
6112 GEN_ERROR("Result value number %" + utostr((yyvsp[(2) - (3)].UIntVal)) +
6113 " is incorrect, expected %" + utostr((unsigned)ValNum));
Eric Christopher2a5196f2008-09-24 04:55:49 +00006114
Chris Lattner15bd0952008-08-29 17:20:18 +00006115 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
6116 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
6117 CHECK_FOR_ERROR
6118;}
6119 break;
6120
Nick Lewyckyd802be32008-12-19 09:41:54 +00006121 case 296:
6122#line 2800 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006123 {
6124 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006125 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
6126 if (CI2->getParent() == 0)
Dan Gohmanf4423b12008-04-19 00:24:39 +00006127 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
6128 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
6129 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
Anton Korobeynikov38e09802007-04-28 13:48:45 +00006130 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006131 ;}
6132 break;
Chris Lattner38905612008-02-19 04:36:25 +00006133
Nick Lewyckyd802be32008-12-19 09:41:54 +00006134 case 297:
6135#line 2809 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006136 { // Empty space between instruction lists
Chris Lattnercc81d152008-05-04 17:18:47 +00006137 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
Dan Gohmanf4423b12008-04-19 00:24:39 +00006138 CHECK_FOR_ERROR
6139 ;}
6140 break;
6141
Nick Lewyckyd802be32008-12-19 09:41:54 +00006142 case 298:
6143#line 2813 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattnercc81d152008-05-04 17:18:47 +00006144 { // Labelled (named) basic block
6145 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
6146 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006147 CHECK_FOR_ERROR
Chris Lattnercc81d152008-05-04 17:18:47 +00006148
Dan Gohmanf4423b12008-04-19 00:24:39 +00006149 ;}
6150 break;
6151
Nick Lewyckyd802be32008-12-19 09:41:54 +00006152 case 299:
6153#line 2821 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006154 { // Return with a result...
6155 ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
6156 assert(!VL.empty() && "Invalid ret operands!");
Dan Gohman1a570242008-07-23 00:54:54 +00006157 const Type *ReturnType = CurFun.CurrentFunction->getReturnType();
6158 if (VL.size() > 1 ||
6159 (isa<StructType>(ReturnType) &&
6160 (VL.empty() || VL[0]->getType() != ReturnType))) {
6161 Value *RV = UndefValue::get(ReturnType);
6162 for (unsigned i = 0, e = VL.size(); i != e; ++i) {
6163 Instruction *I = InsertValueInst::Create(RV, VL[i], i, "mrv");
6164 ((yyvsp[(-1) - (2)].BasicBlockVal))->getInstList().push_back(I);
6165 RV = I;
6166 }
6167 (yyval.TermInstVal) = ReturnInst::Create(RV);
6168 } else {
6169 (yyval.TermInstVal) = ReturnInst::Create(VL[0]);
6170 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006171 delete (yyvsp[(2) - (2)].ValueList);
6172 CHECK_FOR_ERROR
6173 ;}
6174 break;
6175
Nick Lewyckyd802be32008-12-19 09:41:54 +00006176 case 300:
6177#line 2841 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006178 { // Return with no result...
6179 (yyval.TermInstVal) = ReturnInst::Create();
6180 CHECK_FOR_ERROR
6181 ;}
6182 break;
6183
Nick Lewyckyd802be32008-12-19 09:41:54 +00006184 case 301:
6185#line 2845 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006186 { // Unconditional Branch...
6187 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
6188 CHECK_FOR_ERROR
6189 (yyval.TermInstVal) = BranchInst::Create(tmpBB);
6190 ;}
6191 break;
6192
Nick Lewyckyd802be32008-12-19 09:41:54 +00006193 case 302:
6194#line 2850 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Eric Christopher2a5196f2008-09-24 04:55:49 +00006195 {
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006196 if (cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() != 1)
6197 GEN_ERROR("Branch condition must have type i1");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006198 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6199 CHECK_FOR_ERROR
6200 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
6201 CHECK_FOR_ERROR
6202 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
6203 CHECK_FOR_ERROR
6204 (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal);
6205 ;}
6206 break;
6207
Nick Lewyckyd802be32008-12-19 09:41:54 +00006208 case 303:
6209#line 2861 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006210 {
6211 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
6212 CHECK_FOR_ERROR
6213 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6214 CHECK_FOR_ERROR
6215 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
6216 (yyval.TermInstVal) = S;
6217
6218 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
6219 E = (yyvsp[(8) - (9)].JumpTable)->end();
Reid Spencer68a24bd2005-08-27 18:50:39 +00006220 for (; I != E; ++I) {
6221 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
6222 S->addCase(CI, I->second);
6223 else
Reid Spencerb5334b02007-02-05 10:18:06 +00006224 GEN_ERROR("Switch case is constant, but not a simple integer");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006225 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006226 delete (yyvsp[(8) - (9)].JumpTable);
Reid Spencer61c83e02006-08-18 08:43:06 +00006227 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006228 ;}
6229 break;
6230
Nick Lewyckyd802be32008-12-19 09:41:54 +00006231 case 304:
6232#line 2880 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006233 {
6234 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006235 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006236 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006237 CHECK_FOR_ERROR
Gabor Greife64d2482008-04-06 23:07:54 +00006238 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006239 (yyval.TermInstVal) = S;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006240 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006241 ;}
6242 break;
6243
Nick Lewyckyd802be32008-12-19 09:41:54 +00006244 case 305:
6245#line 2890 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006246 {
Reid Spencer3822ff52006-11-08 06:47:33 +00006247
Reid Spencer14310612006-12-31 05:40:51 +00006248 // Handle the short syntax
6249 const PointerType *PFTy = 0;
6250 const FunctionType *Ty = 0;
Devang Patel652203f2008-09-29 20:49:50 +00006251 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(4) - (15)].TypeVal)->get())) ||
Reid Spencer68a24bd2005-08-27 18:50:39 +00006252 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6253 // Pull out the types of all of the arguments...
6254 std::vector<const Type*> ParamTypes;
Devang Patel652203f2008-09-29 20:49:50 +00006255 ParamList::iterator I = (yyvsp[(7) - (15)].ParamList)->begin(), E = (yyvsp[(7) - (15)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006256 for (; I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00006257 const Type *Ty = I->Val->getType();
6258 if (Ty == Type::VoidTy)
6259 GEN_ERROR("Short call syntax cannot be used with varargs");
6260 ParamTypes.push_back(Ty);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006261 }
Eric Christopher2a5196f2008-09-24 04:55:49 +00006262
Devang Patel652203f2008-09-29 20:49:50 +00006263 if (!FunctionType::isValidReturnType(*(yyvsp[(4) - (15)].TypeVal)))
Chris Lattnera925a142008-04-23 05:37:08 +00006264 GEN_ERROR("Invalid result type for LLVM function");
6265
Devang Patel652203f2008-09-29 20:49:50 +00006266 Ty = FunctionType::get((yyvsp[(4) - (15)].TypeVal)->get(), ParamTypes, false);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00006267 PFTy = PointerType::getUnqual(Ty);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006268 }
6269
Devang Patel652203f2008-09-29 20:49:50 +00006270 delete (yyvsp[(4) - (15)].TypeVal);
Reid Spencer66728ef2007-03-20 01:13:36 +00006271
Devang Patel652203f2008-09-29 20:49:50 +00006272 Value *V = getVal(PFTy, (yyvsp[(5) - (15)].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00006273 CHECK_FOR_ERROR
Devang Patel652203f2008-09-29 20:49:50 +00006274 BasicBlock *Normal = getBBVal((yyvsp[(12) - (15)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006275 CHECK_FOR_ERROR
Devang Patel652203f2008-09-29 20:49:50 +00006276 BasicBlock *Except = getBBVal((yyvsp[(15) - (15)].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00006277 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00006278
Devang Patel05988662008-09-25 21:00:45 +00006279 SmallVector<AttributeWithIndex, 8> Attrs;
Dale Johannesene7261862008-09-26 23:46:20 +00006280 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
6281 //attributes.
Devang Patel652203f2008-09-29 20:49:50 +00006282 Attributes RetAttrs = (yyvsp[(3) - (15)].Attributes);
6283 if ((yyvsp[(9) - (15)].Attributes) != Attribute::None) {
6284 if ((yyvsp[(9) - (15)].Attributes) & Attribute::ZExt) {
Dale Johannesene7261862008-09-26 23:46:20 +00006285 RetAttrs = RetAttrs | Attribute::ZExt;
Devang Patel652203f2008-09-29 20:49:50 +00006286 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::ZExt;
Dale Johannesene7261862008-09-26 23:46:20 +00006287 }
Devang Patel652203f2008-09-29 20:49:50 +00006288 if ((yyvsp[(9) - (15)].Attributes) & Attribute::SExt) {
Dale Johannesene7261862008-09-26 23:46:20 +00006289 RetAttrs = RetAttrs | Attribute::SExt;
Devang Patel652203f2008-09-29 20:49:50 +00006290 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::SExt;
Dale Johannesene7261862008-09-26 23:46:20 +00006291 }
Devang Patel652203f2008-09-29 20:49:50 +00006292 if ((yyvsp[(9) - (15)].Attributes) & Attribute::InReg) {
Dale Johannesene7261862008-09-26 23:46:20 +00006293 RetAttrs = RetAttrs | Attribute::InReg;
Devang Patel652203f2008-09-29 20:49:50 +00006294 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::InReg;
Dale Johannesene7261862008-09-26 23:46:20 +00006295 }
Dale Johannesene7261862008-09-26 23:46:20 +00006296 }
Devang Patel652203f2008-09-29 20:49:50 +00006297 if (RetAttrs != Attribute::None)
6298 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
Dale Johannesene7261862008-09-26 23:46:20 +00006299
Reid Spencer14310612006-12-31 05:40:51 +00006300 // Check the arguments
6301 ValueList Args;
Devang Patel652203f2008-09-29 20:49:50 +00006302 if ((yyvsp[(7) - (15)].ParamList)->empty()) { // Has no arguments?
Reid Spencer14310612006-12-31 05:40:51 +00006303 // Make sure no arguments is a good thing!
6304 if (Ty->getNumParams() != 0)
6305 GEN_ERROR("No arguments passed to a function that "
Reid Spencerb5334b02007-02-05 10:18:06 +00006306 "expects arguments");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006307 } else { // Has arguments?
6308 // Loop through FunctionType's arguments and ensure they are specified
6309 // correctly!
Reid Spencer68a24bd2005-08-27 18:50:39 +00006310 FunctionType::param_iterator I = Ty->param_begin();
6311 FunctionType::param_iterator E = Ty->param_end();
Devang Patel652203f2008-09-29 20:49:50 +00006312 ParamList::iterator ArgI = (yyvsp[(7) - (15)].ParamList)->begin(), ArgE = (yyvsp[(7) - (15)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006313 unsigned index = 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00006314
Duncan Sandsdc024672007-11-27 13:23:08 +00006315 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006316 if (ArgI->Val->getType() != *I)
6317 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00006318 (*I)->getDescription() + "'");
Reid Spencer14310612006-12-31 05:40:51 +00006319 Args.push_back(ArgI->Val);
Devang Patel05988662008-09-25 21:00:45 +00006320 if (ArgI->Attrs != Attribute::None)
6321 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00006322 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00006323
Reid Spencer14310612006-12-31 05:40:51 +00006324 if (Ty->isVarArg()) {
6325 if (I == E)
Chris Lattner38905612008-02-19 04:36:25 +00006326 for (; ArgI != ArgE; ++ArgI, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006327 Args.push_back(ArgI->Val); // push the remaining varargs
Devang Patel05988662008-09-25 21:00:45 +00006328 if (ArgI->Attrs != Attribute::None)
6329 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Chris Lattner38905612008-02-19 04:36:25 +00006330 }
Reid Spencer14310612006-12-31 05:40:51 +00006331 } else if (I != E || ArgI != ArgE)
Reid Spencerb5334b02007-02-05 10:18:06 +00006332 GEN_ERROR("Invalid number of parameters detected");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006333 }
Devang Patel652203f2008-09-29 20:49:50 +00006334 if ((yyvsp[(9) - (15)].Attributes) != Attribute::None)
6335 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(9) - (15)].Attributes)));
Devang Patel05988662008-09-25 21:00:45 +00006336 AttrListPtr PAL;
Duncan Sandsdc024672007-11-27 13:23:08 +00006337 if (!Attrs.empty())
Devang Patel05988662008-09-25 21:00:45 +00006338 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsdc024672007-11-27 13:23:08 +00006339
Reid Spencer14310612006-12-31 05:40:51 +00006340 // Create the InvokeInst
Dan Gohman041e2eb2008-05-15 19:50:34 +00006341 InvokeInst *II = InvokeInst::Create(V, Normal, Except,
6342 Args.begin(), Args.end());
Devang Patel652203f2008-09-29 20:49:50 +00006343 II->setCallingConv((yyvsp[(2) - (15)].UIntVal));
Devang Patel05988662008-09-25 21:00:45 +00006344 II->setAttributes(PAL);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006345 (yyval.TermInstVal) = II;
Devang Patel652203f2008-09-29 20:49:50 +00006346 delete (yyvsp[(7) - (15)].ParamList);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006347 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006348 ;}
6349 break;
6350
Nick Lewyckyd802be32008-12-19 09:41:54 +00006351 case 306:
6352#line 2993 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006353 {
6354 (yyval.TermInstVal) = new UnwindInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00006355 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006356 ;}
6357 break;
6358
Nick Lewyckyd802be32008-12-19 09:41:54 +00006359 case 307:
6360#line 2997 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006361 {
6362 (yyval.TermInstVal) = new UnreachableInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00006363 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006364 ;}
6365 break;
6366
Nick Lewyckyd802be32008-12-19 09:41:54 +00006367 case 308:
6368#line 3004 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006369 {
6370 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
6371 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006372 CHECK_FOR_ERROR
6373 if (V == 0)
6374 GEN_ERROR("May only switch on a constant pool value");
6375
Dan Gohmanf4423b12008-04-19 00:24:39 +00006376 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006377 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006378 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
6379 ;}
6380 break;
6381
Nick Lewyckyd802be32008-12-19 09:41:54 +00006382 case 309:
6383#line 3015 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006384 {
6385 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
6386 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006387 CHECK_FOR_ERROR
6388
6389 if (V == 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00006390 GEN_ERROR("May only switch on a constant pool value");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006391
Dan Gohmanf4423b12008-04-19 00:24:39 +00006392 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006393 CHECK_FOR_ERROR
Eric Christopher2a5196f2008-09-24 04:55:49 +00006394 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
Dan Gohmanf4423b12008-04-19 00:24:39 +00006395 ;}
6396 break;
6397
Nick Lewyckyd802be32008-12-19 09:41:54 +00006398 case 310:
6399#line 3028 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006400 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006401 // Is this definition named?? if so, assign the name...
Dan Gohmanf4423b12008-04-19 00:24:39 +00006402 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006403 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006404 InsertValue((yyvsp[(2) - (2)].InstVal));
6405 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006406 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006407 ;}
6408 break;
6409
Nick Lewyckyd802be32008-12-19 09:41:54 +00006410 case 311:
6411#line 3037 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00006412 {
6413 CHECK_FOR_ERROR
6414 int ValNum = InsertValue((yyvsp[(2) - (2)].InstVal));
Eric Christopher2a5196f2008-09-24 04:55:49 +00006415
Chris Lattner15bd0952008-08-29 17:20:18 +00006416 if (ValNum != (int)(yyvsp[(1) - (2)].UIntVal))
6417 GEN_ERROR("Result value number %" + utostr((yyvsp[(1) - (2)].UIntVal)) +
6418 " is incorrect, expected %" + utostr((unsigned)ValNum));
6419
6420 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
6421 CHECK_FOR_ERROR
6422 ;}
6423 break;
6424
Nick Lewyckyd802be32008-12-19 09:41:54 +00006425 case 312:
6426#line 3050 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006427 { // Used for PHI nodes
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006428 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006429 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
6430 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
6431 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
Reid Spencer6f407902007-01-13 05:00:46 +00006432 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006433 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006434 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006435 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6436 delete (yyvsp[(1) - (6)].TypeVal);
6437 ;}
6438 break;
6439
Nick Lewyckyd802be32008-12-19 09:41:54 +00006440 case 313:
6441#line 3061 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006442 {
6443 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
6444 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006445 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006446 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006447 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006448 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6449 ;}
6450 break;
6451
Nick Lewyckyd802be32008-12-19 09:41:54 +00006452 case 314:
6453#line 3071 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006454 {
Devang Patel05988662008-09-25 21:00:45 +00006455 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006456 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006457 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006458 // Used for call and invoke instructions
Dan Gohmanf4423b12008-04-19 00:24:39 +00006459 (yyval.ParamList) = new ParamList();
Devang Patel05988662008-09-25 21:00:45 +00006460 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 +00006461 (yyval.ParamList)->push_back(E);
6462 delete (yyvsp[(1) - (4)].TypeVal);
Duncan Sandsdc024672007-11-27 13:23:08 +00006463 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006464 ;}
6465 break;
6466
Nick Lewyckyd802be32008-12-19 09:41:54 +00006467 case 315:
6468#line 3082 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006469 {
Devang Patel05988662008-09-25 21:00:45 +00006470 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Dale Johanneseneb57ea72007-11-05 21:20:28 +00006471 // Labels are only valid in ASMs
Dan Gohmanf4423b12008-04-19 00:24:39 +00006472 (yyval.ParamList) = new ParamList();
Devang Patel05988662008-09-25 21:00:45 +00006473 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 +00006474 (yyval.ParamList)->push_back(E);
Duncan Sandsdc024672007-11-27 13:23:08 +00006475 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006476 ;}
6477 break;
6478
Nick Lewyckyd802be32008-12-19 09:41:54 +00006479 case 316:
6480#line 3090 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006481 {
Devang Patel05988662008-09-25 21:00:45 +00006482 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006483 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006484 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6485 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
Devang Patel05988662008-09-25 21:00:45 +00006486 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 +00006487 (yyval.ParamList)->push_back(E);
6488 delete (yyvsp[(3) - (6)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006489 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006490 ;}
6491 break;
6492
Nick Lewyckyd802be32008-12-19 09:41:54 +00006493 case 317:
6494#line 3100 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006495 {
Devang Patel05988662008-09-25 21:00:45 +00006496 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf4423b12008-04-19 00:24:39 +00006497 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
Devang Patel05988662008-09-25 21:00:45 +00006498 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 +00006499 (yyval.ParamList)->push_back(E);
Dale Johanneseneb57ea72007-11-05 21:20:28 +00006500 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006501 ;}
6502 break;
6503
Nick Lewyckyd802be32008-12-19 09:41:54 +00006504 case 318:
6505#line 3107 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006506 { (yyval.ParamList) = new ParamList(); ;}
6507 break;
6508
Nick Lewyckyd802be32008-12-19 09:41:54 +00006509 case 319:
6510#line 3110 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006511 { (yyval.ValueList) = new std::vector<Value*>(); ;}
6512 break;
6513
Nick Lewyckyd802be32008-12-19 09:41:54 +00006514 case 320:
6515#line 3111 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006516 {
6517 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
6518 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00006519 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006520 ;}
6521 break;
6522
Nick Lewyckyd802be32008-12-19 09:41:54 +00006523 case 321:
6524#line 3119 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006525 {
6526 (yyval.ConstantList) = new std::vector<unsigned>();
6527 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
6528 GEN_ERROR("Index " + utostr((yyvsp[(2) - (2)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6529 (yyval.ConstantList)->push_back((yyvsp[(2) - (2)].UInt64Val));
6530 ;}
6531 break;
6532
Nick Lewyckyd802be32008-12-19 09:41:54 +00006533 case 322:
6534#line 3125 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006535 {
6536 (yyval.ConstantList) = (yyvsp[(1) - (3)].ConstantList);
6537 if ((unsigned)(yyvsp[(3) - (3)].UInt64Val) != (yyvsp[(3) - (3)].UInt64Val))
6538 GEN_ERROR("Index " + utostr((yyvsp[(3) - (3)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6539 (yyval.ConstantList)->push_back((yyvsp[(3) - (3)].UInt64Val));
6540 CHECK_FOR_ERROR
6541 ;}
6542 break;
6543
Nick Lewyckyd802be32008-12-19 09:41:54 +00006544 case 323:
6545#line 3134 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006546 {
6547 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00006548 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006549 ;}
6550 break;
6551
Nick Lewyckyd802be32008-12-19 09:41:54 +00006552 case 324:
6553#line 3138 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006554 {
6555 (yyval.BoolVal) = false;
Andrew Lenharth6353e052006-12-08 18:07:09 +00006556 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006557 ;}
6558 break;
6559
Nick Lewyckyd802be32008-12-19 09:41:54 +00006560 case 325:
6561#line 3143 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006562 {
Reid Spencer14310612006-12-31 05:40:51 +00006563 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006564 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
Eric Christopher2a5196f2008-09-24 04:55:49 +00006565 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
Dan Gohmanf4423b12008-04-19 00:24:39 +00006566 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006567 GEN_ERROR(
6568 "Arithmetic operator requires integer, FP, or packed operands");
Eric Christopher2a5196f2008-09-24 04:55:49 +00006569 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006570 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006571 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006572 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006573 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006574 if ((yyval.InstVal) == 0)
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006575 GEN_ERROR("binary operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006576 delete (yyvsp[(2) - (5)].TypeVal);
6577 ;}
6578 break;
6579
Nick Lewyckyd802be32008-12-19 09:41:54 +00006580 case 326:
6581#line 3159 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006582 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006583 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006584 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6585 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006586 if (!isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
Dan Gohmanf4423b12008-04-19 00:24:39 +00006587 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006588 GEN_ERROR("Logical operator requires integral operands");
6589 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006590 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006591 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006592 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006593 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006594 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006595 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006596 GEN_ERROR("binary operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006597 delete (yyvsp[(2) - (5)].TypeVal);
6598 ;}
6599 break;
6600
Nick Lewyckyd802be32008-12-19 09:41:54 +00006601 case 327:
6602#line 3176 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006603 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006604 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006605 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
Dan Gohmanf4423b12008-04-19 00:24:39 +00006606 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006607 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006608 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006609 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006610 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006611 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006612 GEN_ERROR("icmp operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006613 delete (yyvsp[(3) - (6)].TypeVal);
6614 ;}
6615 break;
6616
Nick Lewyckyd802be32008-12-19 09:41:54 +00006617 case 328:
6618#line 3188 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006619 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006620 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006621 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
Dan Gohmanf4423b12008-04-19 00:24:39 +00006622 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006623 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006624 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006625 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006626 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006627 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006628 GEN_ERROR("fcmp operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006629 delete (yyvsp[(3) - (6)].TypeVal);
6630 ;}
6631 break;
6632
Nick Lewyckyd802be32008-12-19 09:41:54 +00006633 case 329:
6634#line 3200 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00006635 {
6636 if (!UpRefs.empty())
6637 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6638 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6639 GEN_ERROR("Scalar types not supported by vicmp instruction");
6640 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6641 CHECK_FOR_ERROR
6642 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6643 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006644 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Nate Begemanac80ade2008-05-12 19:01:56 +00006645 if ((yyval.InstVal) == 0)
Dan Gohmand8ee59b2008-09-09 01:13:24 +00006646 GEN_ERROR("vicmp operator returned null");
Nate Begemanac80ade2008-05-12 19:01:56 +00006647 delete (yyvsp[(3) - (6)].TypeVal);
6648 ;}
6649 break;
6650
Nick Lewyckyd802be32008-12-19 09:41:54 +00006651 case 330:
6652#line 3214 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00006653 {
6654 if (!UpRefs.empty())
6655 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6656 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6657 GEN_ERROR("Scalar types not supported by vfcmp instruction");
6658 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6659 CHECK_FOR_ERROR
6660 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6661 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006662 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Nate Begemanac80ade2008-05-12 19:01:56 +00006663 if ((yyval.InstVal) == 0)
Dan Gohmand8ee59b2008-09-09 01:13:24 +00006664 GEN_ERROR("vfcmp operator returned null");
Nate Begemanac80ade2008-05-12 19:01:56 +00006665 delete (yyvsp[(3) - (6)].TypeVal);
6666 ;}
6667 break;
6668
Nick Lewyckyd802be32008-12-19 09:41:54 +00006669 case 331:
6670#line 3228 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006671 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006672 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006673 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6674 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6675 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6676 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006677 GEN_ERROR("invalid cast opcode for cast from '" +
6678 Val->getType()->getDescription() + "' to '" +
Eric Christopher2a5196f2008-09-24 04:55:49 +00006679 DestTy->getDescription() + "'");
Dan Gohmane4977cf2008-05-23 01:55:30 +00006680 (yyval.InstVal) = CastInst::Create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006681 delete (yyvsp[(4) - (4)].TypeVal);
6682 ;}
6683 break;
6684
Nick Lewyckyd802be32008-12-19 09:41:54 +00006685 case 332:
6686#line 3240 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006687 {
Dan Gohmand8ee59b2008-09-09 01:13:24 +00006688 if (isa<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType())) {
6689 // vector select
6690 if (!isa<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType())
6691 || !isa<VectorType>((yyvsp[(6) - (6)].ValueVal)->getType()) )
6692 GEN_ERROR("vector select value types must be vector types");
6693 const VectorType* cond_type = cast<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType());
6694 const VectorType* select_type = cast<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType());
6695 if (cond_type->getElementType() != Type::Int1Ty)
6696 GEN_ERROR("vector select condition element type must be boolean");
6697 if (cond_type->getNumElements() != select_type->getNumElements())
6698 GEN_ERROR("vector select number of elements must be the same");
6699 } else {
6700 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
6701 GEN_ERROR("select condition must be boolean");
6702 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006703 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
Dan Gohmand8ee59b2008-09-09 01:13:24 +00006704 GEN_ERROR("select value types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006705 (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006706 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006707 ;}
6708 break;
6709
Nick Lewyckyd802be32008-12-19 09:41:54 +00006710 case 333:
6711#line 3261 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006712 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006713 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006714 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6715 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6716 delete (yyvsp[(4) - (4)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006717 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006718 ;}
6719 break;
6720
Nick Lewyckyd802be32008-12-19 09:41:54 +00006721 case 334:
6722#line 3268 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006723 {
6724 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006725 GEN_ERROR("Invalid extractelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006726 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006727 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006728 ;}
6729 break;
6730
Nick Lewyckyd802be32008-12-19 09:41:54 +00006731 case 335:
6732#line 3274 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006733 {
6734 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006735 GEN_ERROR("Invalid insertelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006736 (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006737 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006738 ;}
6739 break;
6740
Nick Lewyckyd802be32008-12-19 09:41:54 +00006741 case 336:
6742#line 3280 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006743 {
6744 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006745 GEN_ERROR("Invalid shufflevector operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006746 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006747 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006748 ;}
6749 break;
6750
Nick Lewyckyd802be32008-12-19 09:41:54 +00006751 case 337:
6752#line 3286 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006753 {
6754 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006755 if (!Ty->isFirstClassType())
6756 GEN_ERROR("PHI node operands must be of first class type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006757 (yyval.InstVal) = PHINode::Create(Ty);
6758 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6759 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
Eric Christopher2a5196f2008-09-24 04:55:49 +00006760 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006761 GEN_ERROR("All elements of a PHI node must be of the same type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006762 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6763 (yyvsp[(2) - (2)].PHIList)->pop_front();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006764 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006765 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006766 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006767 ;}
6768 break;
6769
Nick Lewyckyd802be32008-12-19 09:41:54 +00006770 case 338:
6771#line 3302 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006772 {
Reid Spencer14310612006-12-31 05:40:51 +00006773
6774 // Handle the short syntax
Andrew Lenharth6353e052006-12-08 18:07:09 +00006775 const PointerType *PFTy = 0;
6776 const FunctionType *Ty = 0;
Devang Patel652203f2008-09-29 20:49:50 +00006777 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(4) - (9)].TypeVal)->get())) ||
Andrew Lenharth6353e052006-12-08 18:07:09 +00006778 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6779 // Pull out the types of all of the arguments...
6780 std::vector<const Type*> ParamTypes;
Devang Patel652203f2008-09-29 20:49:50 +00006781 ParamList::iterator I = (yyvsp[(7) - (9)].ParamList)->begin(), E = (yyvsp[(7) - (9)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006782 for (; I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00006783 const Type *Ty = I->Val->getType();
6784 if (Ty == Type::VoidTy)
6785 GEN_ERROR("Short call syntax cannot be used with varargs");
6786 ParamTypes.push_back(Ty);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006787 }
Chris Lattnera925a142008-04-23 05:37:08 +00006788
Devang Patel652203f2008-09-29 20:49:50 +00006789 if (!FunctionType::isValidReturnType(*(yyvsp[(4) - (9)].TypeVal)))
Chris Lattnera925a142008-04-23 05:37:08 +00006790 GEN_ERROR("Invalid result type for LLVM function");
6791
Devang Patel652203f2008-09-29 20:49:50 +00006792 Ty = FunctionType::get((yyvsp[(4) - (9)].TypeVal)->get(), ParamTypes, false);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00006793 PFTy = PointerType::getUnqual(Ty);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006794 }
Chris Lattner6cdc6822007-04-26 05:31:05 +00006795
Devang Patel652203f2008-09-29 20:49:50 +00006796 Value *V = getVal(PFTy, (yyvsp[(5) - (9)].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00006797 CHECK_FOR_ERROR
Chris Lattner6cdc6822007-04-26 05:31:05 +00006798
Reid Spencer7780acb2007-04-16 06:56:07 +00006799 // Check for call to invalid intrinsic to avoid crashing later.
6800 if (Function *theF = dyn_cast<Function>(V)) {
Reid Spencered48de22007-04-16 22:02:23 +00006801 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
Reid Spencer36fdde12007-04-16 20:35:38 +00006802 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6803 !theF->getIntrinsicID(true))
Reid Spencer7780acb2007-04-16 06:56:07 +00006804 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6805 theF->getName() + "'");
6806 }
6807
Devang Patel05988662008-09-25 21:00:45 +00006808 // Set up the Attributes for the function
6809 SmallVector<AttributeWithIndex, 8> Attrs;
Dale Johannesene7261862008-09-26 23:46:20 +00006810 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
6811 //attributes.
Devang Patel652203f2008-09-29 20:49:50 +00006812 Attributes RetAttrs = (yyvsp[(3) - (9)].Attributes);
6813 if ((yyvsp[(9) - (9)].Attributes) != Attribute::None) {
6814 if ((yyvsp[(9) - (9)].Attributes) & Attribute::ZExt) {
Dale Johannesene7261862008-09-26 23:46:20 +00006815 RetAttrs = RetAttrs | Attribute::ZExt;
Devang Patel652203f2008-09-29 20:49:50 +00006816 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::ZExt;
Dale Johannesene7261862008-09-26 23:46:20 +00006817 }
Devang Patel652203f2008-09-29 20:49:50 +00006818 if ((yyvsp[(9) - (9)].Attributes) & Attribute::SExt) {
Dale Johannesene7261862008-09-26 23:46:20 +00006819 RetAttrs = RetAttrs | Attribute::SExt;
Devang Patel652203f2008-09-29 20:49:50 +00006820 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::SExt;
Dale Johannesene7261862008-09-26 23:46:20 +00006821 }
Devang Patel652203f2008-09-29 20:49:50 +00006822 if ((yyvsp[(9) - (9)].Attributes) & Attribute::InReg) {
Dale Johannesene7261862008-09-26 23:46:20 +00006823 RetAttrs = RetAttrs | Attribute::InReg;
Devang Patel652203f2008-09-29 20:49:50 +00006824 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::InReg;
Dale Johannesene7261862008-09-26 23:46:20 +00006825 }
Dale Johannesene7261862008-09-26 23:46:20 +00006826 }
Devang Patel652203f2008-09-29 20:49:50 +00006827 if (RetAttrs != Attribute::None)
6828 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
Dale Johannesene7261862008-09-26 23:46:20 +00006829
Eric Christopher2a5196f2008-09-24 04:55:49 +00006830 // Check the arguments
Reid Spencer14310612006-12-31 05:40:51 +00006831 ValueList Args;
Devang Patel652203f2008-09-29 20:49:50 +00006832 if ((yyvsp[(7) - (9)].ParamList)->empty()) { // Has no arguments?
Andrew Lenharth6353e052006-12-08 18:07:09 +00006833 // Make sure no arguments is a good thing!
6834 if (Ty->getNumParams() != 0)
6835 GEN_ERROR("No arguments passed to a function that "
Reid Spencerb5334b02007-02-05 10:18:06 +00006836 "expects arguments");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006837 } else { // Has arguments?
6838 // Loop through FunctionType's arguments and ensure they are specified
Duncan Sandsdc024672007-11-27 13:23:08 +00006839 // correctly. Also, gather any parameter attributes.
Andrew Lenharth6353e052006-12-08 18:07:09 +00006840 FunctionType::param_iterator I = Ty->param_begin();
6841 FunctionType::param_iterator E = Ty->param_end();
Devang Patel652203f2008-09-29 20:49:50 +00006842 ParamList::iterator ArgI = (yyvsp[(7) - (9)].ParamList)->begin(), ArgE = (yyvsp[(7) - (9)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006843 unsigned index = 1;
Andrew Lenharth6353e052006-12-08 18:07:09 +00006844
Duncan Sandsdc024672007-11-27 13:23:08 +00006845 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006846 if (ArgI->Val->getType() != *I)
6847 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00006848 (*I)->getDescription() + "'");
Reid Spencer14310612006-12-31 05:40:51 +00006849 Args.push_back(ArgI->Val);
Devang Patel05988662008-09-25 21:00:45 +00006850 if (ArgI->Attrs != Attribute::None)
6851 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00006852 }
6853 if (Ty->isVarArg()) {
6854 if (I == E)
Chris Lattner38905612008-02-19 04:36:25 +00006855 for (; ArgI != ArgE; ++ArgI, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006856 Args.push_back(ArgI->Val); // push the remaining varargs
Devang Patel05988662008-09-25 21:00:45 +00006857 if (ArgI->Attrs != Attribute::None)
6858 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Chris Lattner38905612008-02-19 04:36:25 +00006859 }
Reid Spencer14310612006-12-31 05:40:51 +00006860 } else if (I != E || ArgI != ArgE)
Reid Spencerb5334b02007-02-05 10:18:06 +00006861 GEN_ERROR("Invalid number of parameters detected");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006862 }
Devang Patel652203f2008-09-29 20:49:50 +00006863 if ((yyvsp[(9) - (9)].Attributes) != Attribute::None)
6864 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(9) - (9)].Attributes)));
Duncan Sandsdc024672007-11-27 13:23:08 +00006865
Devang Patel05988662008-09-25 21:00:45 +00006866 // Finish off the Attributes and check them
6867 AttrListPtr PAL;
Duncan Sandsdc024672007-11-27 13:23:08 +00006868 if (!Attrs.empty())
Devang Patel05988662008-09-25 21:00:45 +00006869 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsdc024672007-11-27 13:23:08 +00006870
Reid Spencer14310612006-12-31 05:40:51 +00006871 // Create the call node
Gabor Greife64d2482008-04-06 23:07:54 +00006872 CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
Devang Patel652203f2008-09-29 20:49:50 +00006873 CI->setTailCall((yyvsp[(1) - (9)].BoolVal));
6874 CI->setCallingConv((yyvsp[(2) - (9)].UIntVal));
Devang Patel05988662008-09-25 21:00:45 +00006875 CI->setAttributes(PAL);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006876 (yyval.InstVal) = CI;
Devang Patel652203f2008-09-29 20:49:50 +00006877 delete (yyvsp[(7) - (9)].ParamList);
6878 delete (yyvsp[(4) - (9)].TypeVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00006879 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006880 ;}
6881 break;
6882
Nick Lewyckyd802be32008-12-19 09:41:54 +00006883 case 339:
6884#line 3411 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006885 {
6886 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00006887 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006888 ;}
6889 break;
6890
Nick Lewyckyd802be32008-12-19 09:41:54 +00006891 case 340:
6892#line 3416 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006893 {
6894 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00006895 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006896 ;}
6897 break;
6898
Nick Lewyckyd802be32008-12-19 09:41:54 +00006899 case 341:
6900#line 3420 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006901 {
6902 (yyval.BoolVal) = false;
Reid Spencer61c83e02006-08-18 08:43:06 +00006903 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006904 ;}
6905 break;
6906
Nick Lewyckyd802be32008-12-19 09:41:54 +00006907 case 342:
6908#line 3427 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006909 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006910 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006911 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6912 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6913 delete (yyvsp[(2) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006914 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006915 ;}
6916 break;
6917
Nick Lewyckyd802be32008-12-19 09:41:54 +00006918 case 343:
6919#line 3434 "/home/nicholas/llvm-commit/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[(2) - (6)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006923 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6924 GEN_ERROR("Malloc array size is not a 32-bit integer!");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006925 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00006926 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006927 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6928 delete (yyvsp[(2) - (6)].TypeVal);
6929 ;}
6930 break;
6931
Nick Lewyckyd802be32008-12-19 09:41:54 +00006932 case 344:
6933#line 3444 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006934 {
Reid Spencer14310612006-12-31 05:40:51 +00006935 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006936 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6937 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6938 delete (yyvsp[(2) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006939 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006940 ;}
6941 break;
6942
Nick Lewyckyd802be32008-12-19 09:41:54 +00006943 case 345:
6944#line 3451 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006945 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006946 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006947 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006948 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6949 GEN_ERROR("Alloca array size is not a 32-bit integer!");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006950 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006951 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006952 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6953 delete (yyvsp[(2) - (6)].TypeVal);
6954 ;}
6955 break;
6956
Nick Lewyckyd802be32008-12-19 09:41:54 +00006957 case 346:
6958#line 3461 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006959 {
6960 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
Eric Christopher2a5196f2008-09-24 04:55:49 +00006961 GEN_ERROR("Trying to free nonpointer type " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006962 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6963 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006964 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006965 ;}
6966 break;
6967
Nick Lewyckyd802be32008-12-19 09:41:54 +00006968 case 347:
6969#line 3469 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006970 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006971 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006972 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6973 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006974 GEN_ERROR("Can't load from nonpointer type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006975 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6976 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006977 GEN_ERROR("Can't load from pointer of non-first-class type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006978 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6979 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006980 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006981 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6982 delete (yyvsp[(3) - (5)].TypeVal);
6983 ;}
6984 break;
6985
Nick Lewyckyd802be32008-12-19 09:41:54 +00006986 case 348:
6987#line 3483 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006988 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006989 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006990 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6991 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006992 if (!PT)
6993 GEN_ERROR("Can't store to a nonpointer type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006994 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006995 const Type *ElTy = PT->getElementType();
Dan Gohmanf4423b12008-04-19 00:24:39 +00006996 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6997 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006998 "' into space of type '" + ElTy->getDescription() + "'");
6999
Dan Gohmanf4423b12008-04-19 00:24:39 +00007000 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00007001 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00007002 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
7003 delete (yyvsp[(5) - (7)].TypeVal);
7004 ;}
7005 break;
7006
Nick Lewyckyd802be32008-12-19 09:41:54 +00007007 case 349:
7008#line 3500 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00007009 {
Dan Gohman1a570242008-07-23 00:54:54 +00007010 if (!UpRefs.empty())
7011 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
7012 if (!isa<StructType>((yyvsp[(2) - (5)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (5)].TypeVal)->get()))
7013 GEN_ERROR("getresult insn requires an aggregate operand");
7014 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].UInt64Val)))
7015 GEN_ERROR("Invalid getresult index for type '" +
7016 (*(yyvsp[(2) - (5)].TypeVal))->getDescription()+ "'");
7017
7018 Value *tmpVal = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Devang Patel5a970972008-02-19 22:27:01 +00007019 CHECK_FOR_ERROR
Dan Gohman1a570242008-07-23 00:54:54 +00007020 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(5) - (5)].UInt64Val));
7021 delete (yyvsp[(2) - (5)].TypeVal);
Dan Gohmanf4423b12008-04-19 00:24:39 +00007022 ;}
7023 break;
7024
Nick Lewyckyd802be32008-12-19 09:41:54 +00007025 case 350:
7026#line 3514 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00007027 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00007028 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00007029 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
7030 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
Reid Spencerb5334b02007-02-05 10:18:06 +00007031 GEN_ERROR("getelementptr insn requires pointer operand");
Reid Spencer68a24bd2005-08-27 18:50:39 +00007032
Dan Gohman041e2eb2008-05-15 19:50:34 +00007033 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()))
Reid Spencer61c83e02006-08-18 08:43:06 +00007034 GEN_ERROR("Invalid getelementptr indices for type '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00007035 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
7036 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00007037 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00007038 (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
Eric Christopher2a5196f2008-09-24 04:55:49 +00007039 delete (yyvsp[(2) - (4)].TypeVal);
Dan Gohmanf4423b12008-04-19 00:24:39 +00007040 delete (yyvsp[(4) - (4)].ValueList);
7041 ;}
7042 break;
Reid Spencer7780acb2007-04-16 06:56:07 +00007043
Nick Lewyckyd802be32008-12-19 09:41:54 +00007044 case 351:
7045#line 3529 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00007046 {
7047 if (!UpRefs.empty())
7048 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
7049 if (!isa<StructType>((yyvsp[(2) - (4)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (4)].TypeVal)->get()))
7050 GEN_ERROR("extractvalue insn requires an aggregate operand");
7051
Dan Gohman81a0c0b2008-05-31 00:58:22 +00007052 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end()))
Dan Gohmane4977cf2008-05-23 01:55:30 +00007053 GEN_ERROR("Invalid extractvalue indices for type '" +
7054 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
7055 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
7056 CHECK_FOR_ERROR
Dan Gohman81a0c0b2008-05-31 00:58:22 +00007057 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end());
Eric Christopher2a5196f2008-09-24 04:55:49 +00007058 delete (yyvsp[(2) - (4)].TypeVal);
Dan Gohman81a0c0b2008-05-31 00:58:22 +00007059 delete (yyvsp[(4) - (4)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00007060 ;}
7061 break;
7062
Nick Lewyckyd802be32008-12-19 09:41:54 +00007063 case 352:
7064#line 3544 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00007065 {
7066 if (!UpRefs.empty())
7067 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription());
7068 if (!isa<StructType>((yyvsp[(2) - (7)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (7)].TypeVal)->get()))
7069 GEN_ERROR("extractvalue insn requires an aggregate operand");
7070
Dan Gohman81a0c0b2008-05-31 00:58:22 +00007071 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 +00007072 GEN_ERROR("Invalid insertvalue indices for type '" +
7073 (*(yyvsp[(2) - (7)].TypeVal))->getDescription()+ "'");
7074 Value* aggVal = getVal(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(3) - (7)].ValIDVal));
7075 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
7076 CHECK_FOR_ERROR
Dan Gohman81a0c0b2008-05-31 00:58:22 +00007077 (yyval.InstVal) = InsertValueInst::Create(aggVal, tmpVal, (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end());
Eric Christopher2a5196f2008-09-24 04:55:49 +00007078 delete (yyvsp[(2) - (7)].TypeVal);
Dan Gohmane4977cf2008-05-23 01:55:30 +00007079 delete (yyvsp[(5) - (7)].TypeVal);
Dan Gohman81a0c0b2008-05-31 00:58:22 +00007080 delete (yyvsp[(7) - (7)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00007081 ;}
7082 break;
7083
Dan Gohmanf4423b12008-04-19 00:24:39 +00007084
7085/* Line 1267 of yacc.c. */
Nick Lewyckyd802be32008-12-19 09:41:54 +00007086#line 7087 "llvmAsmParser.tab.c"
Dan Gohmanf4423b12008-04-19 00:24:39 +00007087 default: break;
Dale Johannesencdd509a2007-09-07 21:07:57 +00007088 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00007089 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
7090
7091 YYPOPSTACK (yylen);
7092 yylen = 0;
7093 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00007094
7095 *++yyvsp = yyval;
7096
7097
Dan Gohmanf4423b12008-04-19 00:24:39 +00007098 /* Now `shift' the result of the reduction. Determine what state
7099 that goes to, based on the state we popped back to and the rule
7100 number reduced by. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00007101
7102 yyn = yyr1[yyn];
7103
Dan Gohmanf4423b12008-04-19 00:24:39 +00007104 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
7105 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00007106 yystate = yytable[yystate];
7107 else
Dan Gohmanf4423b12008-04-19 00:24:39 +00007108 yystate = yydefgoto[yyn - YYNTOKENS];
Reid Spencer68a24bd2005-08-27 18:50:39 +00007109
7110 goto yynewstate;
7111
7112
Dan Gohmanf4423b12008-04-19 00:24:39 +00007113/*------------------------------------.
7114| yyerrlab -- here on detecting error |
7115`------------------------------------*/
7116yyerrlab:
7117 /* If not already recovering from an error, report this error. */
7118 if (!yyerrstatus)
Reid Spencer68a24bd2005-08-27 18:50:39 +00007119 {
7120 ++yynerrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00007121#if ! YYERROR_VERBOSE
7122 yyerror (YY_("syntax error"));
7123#else
7124 {
7125 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
7126 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
7127 {
7128 YYSIZE_T yyalloc = 2 * yysize;
7129 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
7130 yyalloc = YYSTACK_ALLOC_MAXIMUM;
7131 if (yymsg != yymsgbuf)
7132 YYSTACK_FREE (yymsg);
7133 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
7134 if (yymsg)
7135 yymsg_alloc = yyalloc;
7136 else
7137 {
7138 yymsg = yymsgbuf;
7139 yymsg_alloc = sizeof yymsgbuf;
7140 }
7141 }
Dale Johannesencdd509a2007-09-07 21:07:57 +00007142
Dan Gohmanf4423b12008-04-19 00:24:39 +00007143 if (0 < yysize && yysize <= yymsg_alloc)
7144 {
7145 (void) yysyntax_error (yymsg, yystate, yychar);
7146 yyerror (yymsg);
7147 }
7148 else
7149 {
7150 yyerror (YY_("syntax error"));
7151 if (yysize != 0)
7152 goto yyexhaustedlab;
7153 }
7154 }
7155#endif
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00007156 }
7157
Dan Gohmanf4423b12008-04-19 00:24:39 +00007158
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00007159
7160 if (yyerrstatus == 3)
7161 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00007162 /* If just tried and failed to reuse look-ahead token after an
7163 error, discard it. */
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00007164
Dan Gohmanf4423b12008-04-19 00:24:39 +00007165 if (yychar <= YYEOF)
7166 {
7167 /* Return failure if at end of input. */
7168 if (yychar == YYEOF)
7169 YYABORT;
7170 }
7171 else
7172 {
7173 yydestruct ("Error: discarding",
7174 yytoken, &yylval);
7175 yychar = YYEMPTY;
7176 }
7177 }
7178
7179 /* Else will try to reuse look-ahead token after shifting the error
7180 token. */
7181 goto yyerrlab1;
7182
7183
7184/*---------------------------------------------------.
7185| yyerrorlab -- error raised explicitly by YYERROR. |
7186`---------------------------------------------------*/
7187yyerrorlab:
7188
7189 /* Pacify compilers like GCC when the user code never invokes
7190 YYERROR and the label yyerrorlab therefore never appears in user
7191 code. */
7192 if (/*CONSTCOND*/ 0)
7193 goto yyerrorlab;
7194
7195 /* Do not reclaim the symbols of the rule which action triggered
7196 this YYERROR. */
7197 YYPOPSTACK (yylen);
7198 yylen = 0;
7199 YY_STACK_PRINT (yyss, yyssp);
7200 yystate = *yyssp;
7201 goto yyerrlab1;
7202
7203
7204/*-------------------------------------------------------------.
7205| yyerrlab1 -- common code for both syntax error and YYERROR. |
7206`-------------------------------------------------------------*/
7207yyerrlab1:
7208 yyerrstatus = 3; /* Each real token shifted decrements this. */
7209
7210 for (;;)
7211 {
7212 yyn = yypact[yystate];
7213 if (yyn != YYPACT_NINF)
7214 {
7215 yyn += YYTERROR;
7216 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
7217 {
7218 yyn = yytable[yyn];
7219 if (0 < yyn)
7220 break;
7221 }
7222 }
7223
7224 /* Pop the current state because it cannot handle the error token. */
7225 if (yyssp == yyss)
Reid Spencer68a24bd2005-08-27 18:50:39 +00007226 YYABORT;
7227
Dale Johannesencdd509a2007-09-07 21:07:57 +00007228
Dan Gohmanf4423b12008-04-19 00:24:39 +00007229 yydestruct ("Error: popping",
7230 yystos[yystate], yyvsp);
7231 YYPOPSTACK (1);
7232 yystate = *yyssp;
7233 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00007234 }
7235
7236 if (yyn == YYFINAL)
7237 YYACCEPT;
7238
Reid Spencer68a24bd2005-08-27 18:50:39 +00007239 *++yyvsp = yylval;
Dan Gohmanf4423b12008-04-19 00:24:39 +00007240
7241
7242 /* Shift the error token. */
7243 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spencerb8f85052007-07-31 03:50:36 +00007244
Reid Spencer68a24bd2005-08-27 18:50:39 +00007245 yystate = yyn;
7246 goto yynewstate;
7247
Gabor Greife64d2482008-04-06 23:07:54 +00007248
Dan Gohmanf4423b12008-04-19 00:24:39 +00007249/*-------------------------------------.
7250| yyacceptlab -- YYACCEPT comes here. |
7251`-------------------------------------*/
7252yyacceptlab:
7253 yyresult = 0;
7254 goto yyreturn;
7255
7256/*-----------------------------------.
7257| yyabortlab -- YYABORT comes here. |
7258`-----------------------------------*/
7259yyabortlab:
7260 yyresult = 1;
7261 goto yyreturn;
7262
7263#ifndef yyoverflow
7264/*-------------------------------------------------.
7265| yyexhaustedlab -- memory exhaustion comes here. |
7266`-------------------------------------------------*/
7267yyexhaustedlab:
7268 yyerror (YY_("memory exhausted"));
7269 yyresult = 2;
7270 /* Fall through. */
Chris Lattner38905612008-02-19 04:36:25 +00007271#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00007272
7273yyreturn:
7274 if (yychar != YYEOF && yychar != YYEMPTY)
7275 yydestruct ("Cleanup: discarding lookahead",
7276 yytoken, &yylval);
7277 /* Do not reclaim the symbols of the rule which action triggered
7278 this YYABORT or YYACCEPT. */
7279 YYPOPSTACK (yylen);
7280 YY_STACK_PRINT (yyss, yyssp);
7281 while (yyssp != yyss)
7282 {
7283 yydestruct ("Cleanup: popping",
7284 yystos[*yyssp], yyvsp);
7285 YYPOPSTACK (1);
Gabor Greife64d2482008-04-06 23:07:54 +00007286 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00007287#ifndef yyoverflow
7288 if (yyss != yyssa)
7289 YYSTACK_FREE (yyss);
7290#endif
7291#if YYERROR_VERBOSE
7292 if (yymsg != yymsgbuf)
7293 YYSTACK_FREE (yymsg);
7294#endif
7295 /* Make sure YYID is used. */
7296 return YYID (yyresult);
Reid Spencer68a24bd2005-08-27 18:50:39 +00007297}
Dan Gohmanf4423b12008-04-19 00:24:39 +00007298
7299
Nick Lewyckyd802be32008-12-19 09:41:54 +00007300#line 3563 "/home/nicholas/llvm-commit/lib/AsmParser/llvmAsmParser.y"
Reid Spencer61c83e02006-08-18 08:43:06 +00007301
7302
Reid Spencer14310612006-12-31 05:40:51 +00007303// common code from the two 'RunVMAsmParser' functions
7304static Module* RunParser(Module * M) {
Reid Spencer14310612006-12-31 05:40:51 +00007305 CurModule.CurrentModule = M;
Reid Spencer14310612006-12-31 05:40:51 +00007306 // Check to make sure the parser succeeded
7307 if (yyparse()) {
7308 if (ParserResult)
7309 delete ParserResult;
7310 return 0;
7311 }
7312
Reid Spencer0d60b5a2007-03-30 01:37:39 +00007313 // Emit an error if there are any unresolved types left.
7314 if (!CurModule.LateResolveTypes.empty()) {
7315 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
7316 if (DID.Type == ValID::LocalName) {
7317 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
7318 } else {
7319 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
7320 }
7321 if (ParserResult)
7322 delete ParserResult;
7323 return 0;
7324 }
7325
7326 // Emit an error if there are any unresolved values left.
7327 if (!CurModule.LateResolveValues.empty()) {
7328 Value *V = CurModule.LateResolveValues.back();
7329 std::map<Value*, std::pair<ValID, int> >::iterator I =
7330 CurModule.PlaceHolderInfo.find(V);
7331
7332 if (I != CurModule.PlaceHolderInfo.end()) {
7333 ValID &DID = I->second.first;
7334 if (DID.Type == ValID::LocalName) {
7335 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
7336 } else {
7337 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
7338 }
7339 if (ParserResult)
7340 delete ParserResult;
7341 return 0;
7342 }
7343 }
7344
Reid Spencer14310612006-12-31 05:40:51 +00007345 // Check to make sure that parsing produced a result
7346 if (!ParserResult)
7347 return 0;
7348
7349 // Reset ParserResult variable while saving its value for the result.
7350 Module *Result = ParserResult;
7351 ParserResult = 0;
7352
7353 return Result;
7354}
7355
Reid Spencer61c83e02006-08-18 08:43:06 +00007356void llvm::GenerateError(const std::string &message, int LineNo) {
Duncan Sandsdc024672007-11-27 13:23:08 +00007357 if (LineNo == -1) LineNo = LLLgetLineNo();
Reid Spencer61c83e02006-08-18 08:43:06 +00007358 // TODO: column number in exception
7359 if (TheParseError)
Duncan Sandsdc024672007-11-27 13:23:08 +00007360 TheParseError->setError(LLLgetFilename(), message, LineNo);
Reid Spencer61c83e02006-08-18 08:43:06 +00007361 TriggerError = 1;
7362}
Reid Spencer68a24bd2005-08-27 18:50:39 +00007363
7364int yyerror(const char *ErrorMsg) {
Duncan Sandsdc024672007-11-27 13:23:08 +00007365 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
Reid Spenceref9b9a72007-02-05 20:47:22 +00007366 std::string errMsg = where + "error: " + std::string(ErrorMsg);
Duncan Sandsdc024672007-11-27 13:23:08 +00007367 if (yychar != YYEMPTY && yychar != 0) {
7368 errMsg += " while reading token: '";
Eric Christopher2a5196f2008-09-24 04:55:49 +00007369 errMsg += std::string(LLLgetTokenStart(),
Duncan Sandsdc024672007-11-27 13:23:08 +00007370 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
7371 }
Reid Spencer61c83e02006-08-18 08:43:06 +00007372 GenerateError(errMsg);
Reid Spencer68a24bd2005-08-27 18:50:39 +00007373 return 0;
7374}
Dan Gohmanf4423b12008-04-19 00:24:39 +00007375