blob: 523d9cf6fd321214c8d2c20f261ec311369c725d [file] [log] [blame]
Dan Gohmanf4423b12008-04-19 00:24:39 +00001/* A Bison parser, made by GNU Bison 2.3. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002
Dan Gohmanf4423b12008-04-19 00:24:39 +00003/* Skeleton implementation for Bison's Yacc-like parsers in C
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004
Dan Gohmanf4423b12008-04-19 00:24:39 +00005 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
Anton Korobeynikov178a3522007-01-12 19:22:51 +00007
Dan Gohmanf4423b12008-04-19 00:24:39 +00008 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
22
23/* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
32
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
35
36/* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
38
39/* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
45
46/* Identify Bison output. */
47#define YYBISON 1
48
49/* Bison version. */
50#define YYBISON_VERSION "2.3"
51
52/* Skeleton name. */
53#define YYSKELETON_NAME "yacc.c"
54
55/* Pure parsers. */
56#define YYPURE 0
57
58/* Using locations. */
59#define YYLSP_NEEDED 0
60
61/* Substitute the variable and function names. */
Reid Spencer68a24bd2005-08-27 18:50:39 +000062#define yyparse llvmAsmparse
Dan Gohmanf4423b12008-04-19 00:24:39 +000063#define yylex llvmAsmlex
Reid Spencer68a24bd2005-08-27 18:50:39 +000064#define yyerror llvmAsmerror
Dan Gohmanf4423b12008-04-19 00:24:39 +000065#define yylval llvmAsmlval
66#define yychar llvmAsmchar
Reid Spencer68a24bd2005-08-27 18:50:39 +000067#define yydebug llvmAsmdebug
68#define yynerrs llvmAsmnerrs
69
Dan Gohmanf4423b12008-04-19 00:24:39 +000070
71/* Tokens. */
72#ifndef YYTOKENTYPE
73# define YYTOKENTYPE
74 /* Put the tokens into the symbol table, so that GDB and other debuggers
75 know about them. */
76 enum yytokentype {
77 ESINT64VAL = 258,
78 EUINT64VAL = 259,
79 ESAPINTVAL = 260,
80 EUAPINTVAL = 261,
81 LOCALVAL_ID = 262,
82 GLOBALVAL_ID = 263,
83 FPVAL = 264,
84 VOID = 265,
85 INTTYPE = 266,
86 FLOAT = 267,
87 DOUBLE = 268,
88 X86_FP80 = 269,
89 FP128 = 270,
90 PPC_FP128 = 271,
91 LABEL = 272,
92 TYPE = 273,
93 LOCALVAR = 274,
94 GLOBALVAR = 275,
95 LABELSTR = 276,
96 STRINGCONSTANT = 277,
97 ATSTRINGCONSTANT = 278,
98 PCTSTRINGCONSTANT = 279,
99 ZEROINITIALIZER = 280,
100 TRUETOK = 281,
101 FALSETOK = 282,
102 BEGINTOK = 283,
103 ENDTOK = 284,
104 DECLARE = 285,
105 DEFINE = 286,
106 GLOBAL = 287,
107 CONSTANT = 288,
108 SECTION = 289,
109 ALIAS = 290,
110 VOLATILE = 291,
111 THREAD_LOCAL = 292,
112 TO = 293,
113 DOTDOTDOT = 294,
114 NULL_TOK = 295,
115 UNDEF = 296,
116 INTERNAL = 297,
117 LINKONCE = 298,
118 WEAK = 299,
119 APPENDING = 300,
120 DLLIMPORT = 301,
121 DLLEXPORT = 302,
122 EXTERN_WEAK = 303,
Dale Johannesenc7071cc2008-05-14 20:13:36 +0000123 COMMON = 304,
124 OPAQUE = 305,
125 EXTERNAL = 306,
126 TARGET = 307,
127 TRIPLE = 308,
128 ALIGN = 309,
129 ADDRSPACE = 310,
130 DEPLIBS = 311,
131 CALL = 312,
132 TAIL = 313,
133 ASM_TOK = 314,
134 MODULE = 315,
135 SIDEEFFECT = 316,
136 CC_TOK = 317,
137 CCC_TOK = 318,
138 FASTCC_TOK = 319,
139 COLDCC_TOK = 320,
140 X86_STDCALLCC_TOK = 321,
141 X86_FASTCALLCC_TOK = 322,
Dale Johannesendfe8c842008-09-26 19:32:34 +0000142 DATALAYOUT = 323,
143 RET = 324,
144 BR = 325,
145 SWITCH = 326,
146 INVOKE = 327,
147 UNWIND = 328,
148 UNREACHABLE = 329,
149 ADD = 330,
150 SUB = 331,
151 MUL = 332,
152 UDIV = 333,
153 SDIV = 334,
154 FDIV = 335,
155 UREM = 336,
156 SREM = 337,
157 FREM = 338,
158 AND = 339,
159 OR = 340,
160 XOR = 341,
161 SHL = 342,
162 LSHR = 343,
163 ASHR = 344,
164 ICMP = 345,
165 FCMP = 346,
166 VICMP = 347,
167 VFCMP = 348,
168 EQ = 349,
169 NE = 350,
170 SLT = 351,
171 SGT = 352,
172 SLE = 353,
173 SGE = 354,
174 ULT = 355,
175 UGT = 356,
176 ULE = 357,
177 UGE = 358,
178 OEQ = 359,
179 ONE = 360,
180 OLT = 361,
181 OGT = 362,
182 OLE = 363,
183 OGE = 364,
184 ORD = 365,
185 UNO = 366,
186 UEQ = 367,
187 UNE = 368,
188 MALLOC = 369,
189 ALLOCA = 370,
190 FREE = 371,
191 LOAD = 372,
192 STORE = 373,
193 GETELEMENTPTR = 374,
194 TRUNC = 375,
195 ZEXT = 376,
196 SEXT = 377,
197 FPTRUNC = 378,
198 FPEXT = 379,
199 BITCAST = 380,
200 UITOFP = 381,
201 SITOFP = 382,
202 FPTOUI = 383,
203 FPTOSI = 384,
204 INTTOPTR = 385,
205 PTRTOINT = 386,
206 PHI_TOK = 387,
207 SELECT = 388,
208 VAARG = 389,
209 EXTRACTELEMENT = 390,
210 INSERTELEMENT = 391,
211 SHUFFLEVECTOR = 392,
212 GETRESULT = 393,
213 EXTRACTVALUE = 394,
214 INSERTVALUE = 395,
215 SIGNEXT = 396,
216 ZEROEXT = 397,
217 NORETURN = 398,
218 INREG = 399,
219 SRET = 400,
220 NOUNWIND = 401,
221 NOALIAS = 402,
222 BYVAL = 403,
223 NEST = 404,
224 READNONE = 405,
225 READONLY = 406,
226 GC = 407,
Devang Patel652203f2008-09-29 20:49:50 +0000227 OPTSIZE = 408,
228 NOINLINE = 409,
229 ALWAYSINLINE = 410,
230 DEFAULT = 411,
231 HIDDEN = 412,
232 PROTECTED = 413
Dan Gohmanf4423b12008-04-19 00:24:39 +0000233 };
234#endif
235/* Tokens. */
236#define ESINT64VAL 258
237#define EUINT64VAL 259
238#define ESAPINTVAL 260
239#define EUAPINTVAL 261
240#define LOCALVAL_ID 262
241#define GLOBALVAL_ID 263
242#define FPVAL 264
243#define VOID 265
244#define INTTYPE 266
245#define FLOAT 267
246#define DOUBLE 268
247#define X86_FP80 269
248#define FP128 270
249#define PPC_FP128 271
250#define LABEL 272
251#define TYPE 273
252#define LOCALVAR 274
253#define GLOBALVAR 275
254#define LABELSTR 276
255#define STRINGCONSTANT 277
256#define ATSTRINGCONSTANT 278
257#define PCTSTRINGCONSTANT 279
258#define ZEROINITIALIZER 280
259#define TRUETOK 281
260#define FALSETOK 282
261#define BEGINTOK 283
262#define ENDTOK 284
263#define DECLARE 285
264#define DEFINE 286
265#define GLOBAL 287
266#define CONSTANT 288
267#define SECTION 289
268#define ALIAS 290
269#define VOLATILE 291
270#define THREAD_LOCAL 292
271#define TO 293
272#define DOTDOTDOT 294
273#define NULL_TOK 295
274#define UNDEF 296
275#define INTERNAL 297
276#define LINKONCE 298
277#define WEAK 299
278#define APPENDING 300
279#define DLLIMPORT 301
280#define DLLEXPORT 302
281#define EXTERN_WEAK 303
Dale Johannesenc7071cc2008-05-14 20:13:36 +0000282#define COMMON 304
283#define OPAQUE 305
284#define EXTERNAL 306
285#define TARGET 307
286#define TRIPLE 308
287#define ALIGN 309
288#define ADDRSPACE 310
289#define DEPLIBS 311
290#define CALL 312
291#define TAIL 313
292#define ASM_TOK 314
293#define MODULE 315
294#define SIDEEFFECT 316
295#define CC_TOK 317
296#define CCC_TOK 318
297#define FASTCC_TOK 319
298#define COLDCC_TOK 320
299#define X86_STDCALLCC_TOK 321
300#define X86_FASTCALLCC_TOK 322
Dale Johannesendfe8c842008-09-26 19:32:34 +0000301#define DATALAYOUT 323
302#define RET 324
303#define BR 325
304#define SWITCH 326
305#define INVOKE 327
306#define UNWIND 328
307#define UNREACHABLE 329
308#define ADD 330
309#define SUB 331
310#define MUL 332
311#define UDIV 333
312#define SDIV 334
313#define FDIV 335
314#define UREM 336
315#define SREM 337
316#define FREM 338
317#define AND 339
318#define OR 340
319#define XOR 341
320#define SHL 342
321#define LSHR 343
322#define ASHR 344
323#define ICMP 345
324#define FCMP 346
325#define VICMP 347
326#define VFCMP 348
327#define EQ 349
328#define NE 350
329#define SLT 351
330#define SGT 352
331#define SLE 353
332#define SGE 354
333#define ULT 355
334#define UGT 356
335#define ULE 357
336#define UGE 358
337#define OEQ 359
338#define ONE 360
339#define OLT 361
340#define OGT 362
341#define OLE 363
342#define OGE 364
343#define ORD 365
344#define UNO 366
345#define UEQ 367
346#define UNE 368
347#define MALLOC 369
348#define ALLOCA 370
349#define FREE 371
350#define LOAD 372
351#define STORE 373
352#define GETELEMENTPTR 374
353#define TRUNC 375
354#define ZEXT 376
355#define SEXT 377
356#define FPTRUNC 378
357#define FPEXT 379
358#define BITCAST 380
359#define UITOFP 381
360#define SITOFP 382
361#define FPTOUI 383
362#define FPTOSI 384
363#define INTTOPTR 385
364#define PTRTOINT 386
365#define PHI_TOK 387
366#define SELECT 388
367#define VAARG 389
368#define EXTRACTELEMENT 390
369#define INSERTELEMENT 391
370#define SHUFFLEVECTOR 392
371#define GETRESULT 393
372#define EXTRACTVALUE 394
373#define INSERTVALUE 395
374#define SIGNEXT 396
375#define ZEROEXT 397
376#define NORETURN 398
377#define INREG 399
378#define SRET 400
379#define NOUNWIND 401
380#define NOALIAS 402
381#define BYVAL 403
382#define NEST 404
383#define READNONE 405
384#define READONLY 406
385#define GC 407
Devang Patel652203f2008-09-29 20:49:50 +0000386#define OPTSIZE 408
387#define NOINLINE 409
388#define ALWAYSINLINE 410
389#define DEFAULT 411
390#define HIDDEN 412
391#define PROTECTED 413
Dan Gohmanf4423b12008-04-19 00:24:39 +0000392
393
394
395
396/* Copy the first part of user declarations. */
Nuno Lopes6ec8a252008-10-15 11:11:12 +0000397#line 14 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000398
399#include "ParserInternals.h"
400#include "llvm/CallingConv.h"
Chris Lattner0e9c3762006-01-25 22:27:16 +0000401#include "llvm/InlineAsm.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000402#include "llvm/Instructions.h"
403#include "llvm/Module.h"
Reid Spenceref9b9a72007-02-05 20:47:22 +0000404#include "llvm/ValueSymbolTable.h"
Chandler Carruth02202192007-08-04 01:56:21 +0000405#include "llvm/AutoUpgrade.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000406#include "llvm/Support/GetElementPtrTypeIterator.h"
Reid Spencer14310612006-12-31 05:40:51 +0000407#include "llvm/Support/CommandLine.h"
Chris Lattnerf7469af2007-01-31 04:44:08 +0000408#include "llvm/ADT/SmallVector.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000409#include "llvm/ADT/STLExtras.h"
Chris Lattner0019bbe2005-11-06 06:46:53 +0000410#include "llvm/Support/MathExtras.h"
Reid Spencer481169e2006-12-01 00:33:46 +0000411#include "llvm/Support/Streams.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000412#include <algorithm>
Reid Spencer68a24bd2005-08-27 18:50:39 +0000413#include <list>
Chris Lattner8adde282007-02-11 21:40:10 +0000414#include <map>
Reid Spencer68a24bd2005-08-27 18:50:39 +0000415#include <utility>
416
Reid Spencere4f47592006-08-18 17:32:55 +0000417// The following is a gross hack. In order to rid the libAsmParser library of
418// exceptions, we have to have a way of getting the yyparse function to go into
419// an error situation. So, whenever we want an error to occur, the GenerateError
Eric Christopher2a5196f2008-09-24 04:55:49 +0000420// function (see bottom of file) sets TriggerError. Then, at the end of each
421// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
422// (a goto) to put YACC in error state. Furthermore, several calls to
Reid Spencere4f47592006-08-18 17:32:55 +0000423// GenerateError are made from inside productions and they must simulate the
424// previous exception behavior by exiting the production immediately. We have
425// replaced these with the GEN_ERROR macro which calls GeneratError and then
Eric Christopher2a5196f2008-09-24 04:55:49 +0000426// immediately invokes YYERROR. This would be so much cleaner if it was a
Reid Spencere4f47592006-08-18 17:32:55 +0000427// recursive descent parser.
Reid Spencer61c83e02006-08-18 08:43:06 +0000428static bool TriggerError = false;
Reid Spencerf63697d2006-10-09 17:36:59 +0000429#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
Reid Spencer61c83e02006-08-18 08:43:06 +0000430#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
431
Reid Spencer68a24bd2005-08-27 18:50:39 +0000432int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
433int yylex(); // declaration" of xxx warnings.
434int yyparse();
Reid Spencer68a24bd2005-08-27 18:50:39 +0000435using namespace llvm;
436
437static Module *ParserResult;
438
439// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
440// relating to upreferences in the input stream.
441//
442//#define DEBUG_UPREFS 1
443#ifdef DEBUG_UPREFS
Bill Wendlinge8156192006-12-07 01:30:32 +0000444#define UR_OUT(X) cerr << X
Reid Spencer68a24bd2005-08-27 18:50:39 +0000445#else
446#define UR_OUT(X)
447#endif
448
449#define YYERROR_VERBOSE 1
450
Chris Lattnerb475c422005-11-12 18:22:38 +0000451static GlobalVariable *CurGV;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000452
453
454// This contains info used when building the body of a function. It is
455// destroyed when the function is completed.
456//
457typedef std::vector<Value *> ValueList; // Numbered defs
Reid Spencer14310612006-12-31 05:40:51 +0000458
Eric Christopher2a5196f2008-09-24 04:55:49 +0000459static void
Reid Spencer93c40032007-03-19 18:40:50 +0000460ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000461
462static struct PerModuleInfo {
463 Module *CurrentModule;
Reid Spencer93c40032007-03-19 18:40:50 +0000464 ValueList Values; // Module level numbered definitions
465 ValueList LateResolveValues;
Reid Spencer861d9d62006-11-28 07:29:44 +0000466 std::vector<PATypeHolder> Types;
467 std::map<ValID, PATypeHolder> LateResolveTypes;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000468
469 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
Chris Lattner0ad19702006-06-21 16:53:00 +0000470 /// how they were referenced and on which line of the input they came from so
Reid Spencer68a24bd2005-08-27 18:50:39 +0000471 /// that we can resolve them later and print error messages as appropriate.
472 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
473
474 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
475 // references to global values. Global values may be referenced before they
476 // are defined, and if so, the temporary object that they represent is held
477 // here. This is used for forward references of GlobalValues.
478 //
479 typedef std::map<std::pair<const PointerType *,
480 ValID>, GlobalValue*> GlobalRefsType;
481 GlobalRefsType GlobalRefs;
482
483 void ModuleDone() {
484 // If we could not resolve some functions at function compilation time
485 // (calls to functions before they are defined), resolve them now... Types
486 // are resolved when the constant pool has been completely parsed.
487 //
488 ResolveDefinitions(LateResolveValues);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000489 if (TriggerError)
490 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000491
492 // Check to make sure that all global value forward references have been
493 // resolved!
494 //
495 if (!GlobalRefs.empty()) {
496 std::string UndefinedReferences = "Unresolved global references exist:\n";
497
498 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
499 I != E; ++I) {
500 UndefinedReferences += " " + I->first.first->getDescription() + " " +
501 I->first.second.getName() + "\n";
502 }
Reid Spencer61c83e02006-08-18 08:43:06 +0000503 GenerateError(UndefinedReferences);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000504 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000505 }
506
Chandler Carruth02202192007-08-04 01:56:21 +0000507 // Look for intrinsic functions and CallInst that need to be upgraded
508 for (Module::iterator FI = CurrentModule->begin(),
509 FE = CurrentModule->end(); FI != FE; )
510 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
511
Reid Spencer68a24bd2005-08-27 18:50:39 +0000512 Values.clear(); // Clear out function local definitions
513 Types.clear();
514 CurrentModule = 0;
515 }
516
Reid Spencer68a24bd2005-08-27 18:50:39 +0000517 // GetForwardRefForGlobal - Check to see if there is a forward reference
518 // for this global. If so, remove it from the GlobalRefs map and return it.
519 // If not, just return null.
520 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
521 // Check to see if there is a forward reference to this global variable...
522 // if there is, eliminate it and patch the reference to use the new def'n.
523 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
524 GlobalValue *Ret = 0;
525 if (I != GlobalRefs.end()) {
526 Ret = I->second;
Nuno Lopes8a5f3472008-10-15 12:05:02 +0000527 I->first.second.destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +0000528 GlobalRefs.erase(I);
529 }
530 return Ret;
531 }
Reid Spencer8c8a2dc2007-01-02 21:54:12 +0000532
533 bool TypeIsUnresolved(PATypeHolder* PATy) {
534 // If it isn't abstract, its resolved
535 const Type* Ty = PATy->get();
536 if (!Ty->isAbstract())
537 return false;
538 // Traverse the type looking for abstract types. If it isn't abstract then
Eric Christopher2a5196f2008-09-24 04:55:49 +0000539 // we don't need to traverse that leg of the type.
Reid Spencer8c8a2dc2007-01-02 21:54:12 +0000540 std::vector<const Type*> WorkList, SeenList;
541 WorkList.push_back(Ty);
542 while (!WorkList.empty()) {
543 const Type* Ty = WorkList.back();
544 SeenList.push_back(Ty);
545 WorkList.pop_back();
546 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
547 // Check to see if this is an unresolved type
548 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
549 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
550 for ( ; I != E; ++I) {
551 if (I->second.get() == OpTy)
552 return true;
553 }
554 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
555 const Type* TheTy = SeqTy->getElementType();
556 if (TheTy->isAbstract() && TheTy != Ty) {
Eric Christopher2a5196f2008-09-24 04:55:49 +0000557 std::vector<const Type*>::iterator I = SeenList.begin(),
Reid Spencer8c8a2dc2007-01-02 21:54:12 +0000558 E = SeenList.end();
559 for ( ; I != E; ++I)
560 if (*I == TheTy)
561 break;
562 if (I == E)
563 WorkList.push_back(TheTy);
564 }
565 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
566 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
567 const Type* TheTy = StrTy->getElementType(i);
568 if (TheTy->isAbstract() && TheTy != Ty) {
Eric Christopher2a5196f2008-09-24 04:55:49 +0000569 std::vector<const Type*>::iterator I = SeenList.begin(),
Reid Spencer8c8a2dc2007-01-02 21:54:12 +0000570 E = SeenList.end();
571 for ( ; I != E; ++I)
572 if (*I == TheTy)
573 break;
574 if (I == E)
575 WorkList.push_back(TheTy);
576 }
577 }
578 }
579 }
580 return false;
581 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000582} CurModule;
583
584static struct PerFunctionInfo {
585 Function *CurrentFunction; // Pointer to current function being created
586
Reid Spencer93c40032007-03-19 18:40:50 +0000587 ValueList Values; // Keep track of #'d definitions
588 unsigned NextValNum;
589 ValueList LateResolveValues;
Reid Spenceref9b9a72007-02-05 20:47:22 +0000590 bool isDeclare; // Is this function a forward declararation?
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000591 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000592 GlobalValue::VisibilityTypes Visibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000593
594 /// BBForwardRefs - When we see forward references to basic blocks, keep
595 /// track of them here.
Reid Spencer93c40032007-03-19 18:40:50 +0000596 std::map<ValID, BasicBlock*> BBForwardRefs;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000597
598 inline PerFunctionInfo() {
599 CurrentFunction = 0;
600 isDeclare = false;
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000601 Linkage = GlobalValue::ExternalLinkage;
602 Visibility = GlobalValue::DefaultVisibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000603 }
604
605 inline void FunctionStart(Function *M) {
606 CurrentFunction = M;
Reid Spencer93c40032007-03-19 18:40:50 +0000607 NextValNum = 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000608 }
609
610 void FunctionDone() {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000611 // Any forward referenced blocks left?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000612 if (!BBForwardRefs.empty()) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000613 GenerateError("Undefined reference to label " +
Reid Spencer93c40032007-03-19 18:40:50 +0000614 BBForwardRefs.begin()->second->getName());
Reid Spencer5b7e7532006-09-28 19:28:24 +0000615 return;
616 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000617
618 // Resolve all forward references now.
619 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
620
621 Values.clear(); // Clear out function local definitions
Reid Spencer93c40032007-03-19 18:40:50 +0000622 BBForwardRefs.clear();
Reid Spencer68a24bd2005-08-27 18:50:39 +0000623 CurrentFunction = 0;
624 isDeclare = false;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000625 Linkage = GlobalValue::ExternalLinkage;
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000626 Visibility = GlobalValue::DefaultVisibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000627 }
628} CurFun; // Info for the current function...
629
630static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
631
632
633//===----------------------------------------------------------------------===//
634// Code to handle definitions of all the types
635//===----------------------------------------------------------------------===//
636
Chris Lattner15bd0952008-08-29 17:20:18 +0000637/// InsertValue - Insert a value into the value table. If it is named, this
638/// returns -1, otherwise it returns the slot number for the value.
639static int InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
Reid Spencer93c40032007-03-19 18:40:50 +0000640 // Things that have names or are void typed don't get slot numbers
641 if (V->hasName() || (V->getType() == Type::VoidTy))
Chris Lattner15bd0952008-08-29 17:20:18 +0000642 return -1;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000643
Reid Spencer93c40032007-03-19 18:40:50 +0000644 // In the case of function values, we have to allow for the forward reference
645 // of basic blocks, which are included in the numbering. Consequently, we keep
Eric Christopher2a5196f2008-09-24 04:55:49 +0000646 // track of the next insertion location with NextValNum. When a BB gets
Reid Spencer93c40032007-03-19 18:40:50 +0000647 // inserted, it could change the size of the CurFun.Values vector.
648 if (&ValueTab == &CurFun.Values) {
649 if (ValueTab.size() <= CurFun.NextValNum)
650 ValueTab.resize(CurFun.NextValNum+1);
651 ValueTab[CurFun.NextValNum++] = V;
Chris Lattner15bd0952008-08-29 17:20:18 +0000652 return CurFun.NextValNum-1;
Eric Christopher2a5196f2008-09-24 04:55:49 +0000653 }
Reid Spencer93c40032007-03-19 18:40:50 +0000654 // For all other lists, its okay to just tack it on the back of the vector.
655 ValueTab.push_back(V);
Chris Lattner15bd0952008-08-29 17:20:18 +0000656 return ValueTab.size()-1;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000657}
658
659static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
660 switch (D.Type) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000661 case ValID::LocalID: // Is it a numbered definition?
Reid Spencer68a24bd2005-08-27 18:50:39 +0000662 // Module constants occupy the lowest numbered slots...
Reid Spencer41dff5e2007-01-26 08:05:27 +0000663 if (D.Num < CurModule.Types.size())
664 return CurModule.Types[D.Num];
Reid Spencer68a24bd2005-08-27 18:50:39 +0000665 break;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000666 case ValID::LocalName: // Is it a named definition?
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000667 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000668 D.destroy(); // Free old strdup'd memory...
669 return N;
670 }
671 break;
672 default:
Reid Spencerb5334b02007-02-05 10:18:06 +0000673 GenerateError("Internal parser error: Invalid symbol type reference");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000674 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000675 }
676
677 // If we reached here, we referenced either a symbol that we don't know about
678 // or an id number that hasn't been read yet. We may be referencing something
679 // forward, so just create an entry to be resolved later and get to it...
680 //
681 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
682
683
684 if (inFunctionScope()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000685 if (D.Type == ValID::LocalName) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000686 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000687 return 0;
688 } else {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000689 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
Reid Spencer5b7e7532006-09-28 19:28:24 +0000690 return 0;
691 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000692 }
693
Reid Spencer861d9d62006-11-28 07:29:44 +0000694 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
Nuno Lopesf05ff662008-10-15 11:20:21 +0000695 if (I != CurModule.LateResolveTypes.end()) {
696 D.destroy();
Reid Spencer861d9d62006-11-28 07:29:44 +0000697 return I->second;
Nuno Lopesf05ff662008-10-15 11:20:21 +0000698 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000699
Reid Spencer861d9d62006-11-28 07:29:44 +0000700 Type *Typ = OpaqueType::get();
701 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
702 return Typ;
Reid Spencera132e042006-12-03 05:46:11 +0000703 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000704
Reid Spencer93c40032007-03-19 18:40:50 +0000705// getExistingVal - Look up the value specified by the provided type and
Reid Spencer68a24bd2005-08-27 18:50:39 +0000706// the provided ValID. If the value exists and has already been defined, return
707// it. Otherwise return null.
708//
Reid Spencer93c40032007-03-19 18:40:50 +0000709static Value *getExistingVal(const Type *Ty, const ValID &D) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000710 if (isa<FunctionType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000711 GenerateError("Functions are not values and "
Reid Spencer68a24bd2005-08-27 18:50:39 +0000712 "must be referenced as pointers");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000713 return 0;
714 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000715
716 switch (D.Type) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000717 case ValID::LocalID: { // Is it a numbered definition?
Reid Spencer41dff5e2007-01-26 08:05:27 +0000718 // Check that the number is within bounds.
Eric Christopher2a5196f2008-09-24 04:55:49 +0000719 if (D.Num >= CurFun.Values.size())
Reid Spencer93c40032007-03-19 18:40:50 +0000720 return 0;
721 Value *Result = CurFun.Values[D.Num];
722 if (Ty != Result->getType()) {
723 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
Eric Christopher2a5196f2008-09-24 04:55:49 +0000724 Result->getType()->getDescription() + "' does not match "
Reid Spencer93c40032007-03-19 18:40:50 +0000725 "expected type, '" + Ty->getDescription() + "'");
726 return 0;
727 }
728 return Result;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000729 }
730 case ValID::GlobalID: { // Is it a numbered definition?
Eric Christopher2a5196f2008-09-24 04:55:49 +0000731 if (D.Num >= CurModule.Values.size())
Reid Spenceref9b9a72007-02-05 20:47:22 +0000732 return 0;
Reid Spencer93c40032007-03-19 18:40:50 +0000733 Value *Result = CurModule.Values[D.Num];
734 if (Ty != Result->getType()) {
735 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
Eric Christopher2a5196f2008-09-24 04:55:49 +0000736 Result->getType()->getDescription() + "' does not match "
Reid Spencer93c40032007-03-19 18:40:50 +0000737 "expected type, '" + Ty->getDescription() + "'");
Reid Spenceref9b9a72007-02-05 20:47:22 +0000738 return 0;
Reid Spencer93c40032007-03-19 18:40:50 +0000739 }
740 return Result;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000741 }
Eric Christopher2a5196f2008-09-24 04:55:49 +0000742
Reid Spencer41dff5e2007-01-26 08:05:27 +0000743 case ValID::LocalName: { // Is it a named definition?
Eric Christopher2a5196f2008-09-24 04:55:49 +0000744 if (!inFunctionScope())
Reid Spenceref9b9a72007-02-05 20:47:22 +0000745 return 0;
746 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000747 Value *N = SymTab.lookup(D.getName());
Eric Christopher2a5196f2008-09-24 04:55:49 +0000748 if (N == 0)
Reid Spenceref9b9a72007-02-05 20:47:22 +0000749 return 0;
750 if (N->getType() != Ty)
751 return 0;
Eric Christopher2a5196f2008-09-24 04:55:49 +0000752
Reid Spencer41dff5e2007-01-26 08:05:27 +0000753 D.destroy(); // Free old strdup'd memory...
754 return N;
755 }
756 case ValID::GlobalName: { // Is it a named definition?
Reid Spenceref9b9a72007-02-05 20:47:22 +0000757 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000758 Value *N = SymTab.lookup(D.getName());
Eric Christopher2a5196f2008-09-24 04:55:49 +0000759 if (N == 0)
Reid Spenceref9b9a72007-02-05 20:47:22 +0000760 return 0;
761 if (N->getType() != Ty)
762 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000763
764 D.destroy(); // Free old strdup'd memory...
765 return N;
766 }
767
768 // Check to make sure that "Ty" is an integral type, and that our
769 // value will fit into the specified type...
770 case ValID::ConstSIntVal: // Is it a constant pool reference??
Chris Lattner38905612008-02-19 04:36:25 +0000771 if (!isa<IntegerType>(Ty) ||
772 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000773 GenerateError("Signed integral constant '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000774 itostr(D.ConstPool64) + "' is invalid for type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +0000775 Ty->getDescription() + "'");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000776 return 0;
777 }
Reid Spencer49d273e2007-03-19 20:40:51 +0000778 return ConstantInt::get(Ty, D.ConstPool64, true);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000779
780 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
Chris Lattner38905612008-02-19 04:36:25 +0000781 if (isa<IntegerType>(Ty) &&
782 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
Reid Spencerb83eb642006-10-20 07:07:24 +0000783 return ConstantInt::get(Ty, D.UConstPool64);
Chris Lattner38905612008-02-19 04:36:25 +0000784
785 if (!isa<IntegerType>(Ty) ||
786 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
787 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
788 "' is invalid or out of range for type '" +
789 Ty->getDescription() + "'");
790 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000791 }
Chris Lattner38905612008-02-19 04:36:25 +0000792 // This is really a signed reference. Transmogrify.
793 return ConstantInt::get(Ty, D.ConstPool64, true);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000794
Chris Lattner1913b942008-07-11 00:30:39 +0000795 case ValID::ConstAPInt: // Is it an unsigned const pool reference?
796 if (!isa<IntegerType>(Ty)) {
797 GenerateError("Integral constant '" + D.getName() +
798 "' is invalid or out of range for type '" +
799 Ty->getDescription() + "'");
800 return 0;
801 }
Eric Christopher2a5196f2008-09-24 04:55:49 +0000802
Chris Lattner1913b942008-07-11 00:30:39 +0000803 {
804 APSInt Tmp = *D.ConstPoolInt;
Nuno Lopes19830332008-11-04 14:28:33 +0000805 D.destroy();
Chris Lattner1913b942008-07-11 00:30:39 +0000806 Tmp.extOrTrunc(Ty->getPrimitiveSizeInBits());
807 return ConstantInt::get(Tmp);
808 }
Eric Christopher2a5196f2008-09-24 04:55:49 +0000809
Reid Spencer68a24bd2005-08-27 18:50:39 +0000810 case ValID::ConstFPVal: // Is it a floating point const pool reference?
Chris Lattner38905612008-02-19 04:36:25 +0000811 if (!Ty->isFloatingPoint() ||
812 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000813 GenerateError("FP constant invalid for type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000814 return 0;
815 }
Eric Christopher2a5196f2008-09-24 04:55:49 +0000816 // Lexer has no type info, so builds all float and double FP constants
Dale Johannesenc72cd7e2007-09-11 18:33:39 +0000817 // as double. Fix this here. Long double does not need this.
818 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
Dale Johannesen236bbd42008-10-09 23:01:34 +0000819 Ty==Type::FloatTy) {
820 bool ignored;
821 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven,
822 &ignored);
823 }
Chris Lattnerd8eb63f2008-04-20 00:41:19 +0000824 return ConstantFP::get(*D.ConstPoolFP);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000825
826 case ValID::ConstNullVal: // Is it a null value?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000827 if (!isa<PointerType>(Ty)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000828 GenerateError("Cannot create a a non pointer null");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000829 return 0;
830 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000831 return ConstantPointerNull::get(cast<PointerType>(Ty));
832
833 case ValID::ConstUndefVal: // Is it an undef value?
834 return UndefValue::get(Ty);
835
Chris Lattner7aa61892005-12-21 17:53:23 +0000836 case ValID::ConstZeroVal: // Is it a zero value?
837 return Constant::getNullValue(Ty);
Eric Christopher2a5196f2008-09-24 04:55:49 +0000838
Reid Spencer68a24bd2005-08-27 18:50:39 +0000839 case ValID::ConstantVal: // Fully resolved constant?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000840 if (D.ConstantValue->getType() != Ty) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000841 GenerateError("Constant expression type different from required type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000842 return 0;
843 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000844 return D.ConstantValue;
845
Chris Lattner0e9c3762006-01-25 22:27:16 +0000846 case ValID::InlineAsmVal: { // Inline asm expression
847 const PointerType *PTy = dyn_cast<PointerType>(Ty);
848 const FunctionType *FTy =
849 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000850 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000851 GenerateError("Invalid type for asm constraint string");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000852 return 0;
853 }
Chris Lattner0e9c3762006-01-25 22:27:16 +0000854 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
855 D.IAD->HasSideEffects);
856 D.destroy(); // Free InlineAsmDescriptor.
857 return IA;
858 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000859 default:
Reid Spencera9720f52007-02-05 17:04:00 +0000860 assert(0 && "Unhandled case!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000861 return 0;
862 } // End of switch
863
Reid Spencera9720f52007-02-05 17:04:00 +0000864 assert(0 && "Unhandled case!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000865 return 0;
866}
867
Reid Spencer93c40032007-03-19 18:40:50 +0000868// getVal - This function is identical to getExistingVal, except that if a
Reid Spencer68a24bd2005-08-27 18:50:39 +0000869// value is not already defined, it "improvises" by creating a placeholder var
870// that looks and acts just like the requested variable. When the value is
871// defined later, all uses of the placeholder variable are replaced with the
872// real thing.
873//
874static Value *getVal(const Type *Ty, const ValID &ID) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000875 if (Ty == Type::LabelTy) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000876 GenerateError("Cannot use a basic block here");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000877 return 0;
878 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000879
880 // See if the value has already been defined.
Reid Spencer93c40032007-03-19 18:40:50 +0000881 Value *V = getExistingVal(Ty, ID);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000882 if (V) return V;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000883 if (TriggerError) return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000884
Reid Spencer5b7e7532006-09-28 19:28:24 +0000885 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
Dan Gohmane4977cf2008-05-23 01:55:30 +0000886 GenerateError("Invalid use of a non-first-class type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000887 return 0;
888 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000889
890 // If we reached here, we referenced either a symbol that we don't know about
891 // or an id number that hasn't been read yet. We may be referencing something
892 // forward, so just create an entry to be resolved later and get to it...
893 //
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000894 switch (ID.Type) {
895 case ValID::GlobalName:
Reid Spencer9c9b63a2007-04-28 16:07:31 +0000896 case ValID::GlobalID: {
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000897 const PointerType *PTy = dyn_cast<PointerType>(Ty);
898 if (!PTy) {
899 GenerateError("Invalid type for reference to global" );
900 return 0;
901 }
902 const Type* ElTy = PTy->getElementType();
903 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
Gabor Greife64d2482008-04-06 23:07:54 +0000904 V = Function::Create(FTy, GlobalValue::ExternalLinkage);
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000905 else
Christopher Lamba8ed9bf2007-12-11 09:02:08 +0000906 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
907 (Module*)0, false, PTy->getAddressSpace());
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000908 break;
Reid Spencer9c9b63a2007-04-28 16:07:31 +0000909 }
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000910 default:
911 V = new Argument(Ty);
912 }
Eric Christopher2a5196f2008-09-24 04:55:49 +0000913
Reid Spencer68a24bd2005-08-27 18:50:39 +0000914 // Remember where this forward reference came from. FIXME, shouldn't we try
915 // to recycle these things??
916 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
Duncan Sandsdc024672007-11-27 13:23:08 +0000917 LLLgetLineNo())));
Reid Spencer68a24bd2005-08-27 18:50:39 +0000918
919 if (inFunctionScope())
920 InsertValue(V, CurFun.LateResolveValues);
921 else
922 InsertValue(V, CurModule.LateResolveValues);
923 return V;
924}
925
Reid Spencer93c40032007-03-19 18:40:50 +0000926/// defineBBVal - This is a definition of a new basic block with the specified
927/// identifier which must be the same as CurFun.NextValNum, if its numeric.
Chris Lattnercc81d152008-05-04 17:18:47 +0000928static BasicBlock *defineBBVal(const ValID &ID) {
Reid Spencera9720f52007-02-05 17:04:00 +0000929 assert(inFunctionScope() && "Can't get basic block at global scope!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000930
Reid Spencer68a24bd2005-08-27 18:50:39 +0000931 BasicBlock *BB = 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000932
Reid Spencer93c40032007-03-19 18:40:50 +0000933 // First, see if this was forward referenced
Reid Spencer68a24bd2005-08-27 18:50:39 +0000934
Reid Spencer93c40032007-03-19 18:40:50 +0000935 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
936 if (BBI != CurFun.BBForwardRefs.end()) {
937 BB = BBI->second;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000938 // The forward declaration could have been inserted anywhere in the
939 // function: insert it into the correct place now.
940 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
941 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
Reid Spencer93c40032007-03-19 18:40:50 +0000942
Reid Spencer66728ef2007-03-20 01:13:36 +0000943 // We're about to erase the entry, save the key so we can clean it up.
944 ValID Tmp = BBI->first;
945
Reid Spencer93c40032007-03-19 18:40:50 +0000946 // Erase the forward ref from the map as its no longer "forward"
947 CurFun.BBForwardRefs.erase(ID);
948
Eric Christopher2a5196f2008-09-24 04:55:49 +0000949 // The key has been removed from the map but so we don't want to leave
Reid Spencer66728ef2007-03-20 01:13:36 +0000950 // strdup'd memory around so destroy it too.
951 Tmp.destroy();
952
Reid Spencer93c40032007-03-19 18:40:50 +0000953 // If its a numbered definition, bump the number and set the BB value.
954 if (ID.Type == ValID::LocalID) {
955 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
956 InsertValue(BB);
957 }
Eric Christopher2a5196f2008-09-24 04:55:49 +0000958 } else {
959 // We haven't seen this BB before and its first mention is a definition.
Devang Patel67909432008-03-03 18:58:47 +0000960 // Just create it and return it.
961 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
Gabor Greife64d2482008-04-06 23:07:54 +0000962 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Devang Patel67909432008-03-03 18:58:47 +0000963 if (ID.Type == ValID::LocalID) {
964 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
965 InsertValue(BB);
966 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000967 }
Reid Spencer93c40032007-03-19 18:40:50 +0000968
Devang Patel67909432008-03-03 18:58:47 +0000969 ID.destroy();
Reid Spencer93c40032007-03-19 18:40:50 +0000970 return BB;
971}
972
973/// getBBVal - get an existing BB value or create a forward reference for it.
Eric Christopher2a5196f2008-09-24 04:55:49 +0000974///
Reid Spencer93c40032007-03-19 18:40:50 +0000975static BasicBlock *getBBVal(const ValID &ID) {
976 assert(inFunctionScope() && "Can't get basic block at global scope!");
977
978 BasicBlock *BB = 0;
979
980 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
981 if (BBI != CurFun.BBForwardRefs.end()) {
982 BB = BBI->second;
983 } if (ID.Type == ValID::LocalName) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000984 std::string Name = ID.getName();
Reid Spencer93c40032007-03-19 18:40:50 +0000985 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
Anton Korobeynikovc70d7732008-02-20 12:10:37 +0000986 if (N) {
Reid Spencer93c40032007-03-19 18:40:50 +0000987 if (N->getType()->getTypeID() == Type::LabelTyID)
988 BB = cast<BasicBlock>(N);
989 else
990 GenerateError("Reference to label '" + Name + "' is actually of type '"+
991 N->getType()->getDescription() + "'");
Anton Korobeynikovc70d7732008-02-20 12:10:37 +0000992 }
Reid Spencer93c40032007-03-19 18:40:50 +0000993 } else if (ID.Type == ValID::LocalID) {
994 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
995 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
996 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
997 else
Eric Christopher2a5196f2008-09-24 04:55:49 +0000998 GenerateError("Reference to label '%" + utostr(ID.Num) +
999 "' is actually of type '"+
Reid Spencer93c40032007-03-19 18:40:50 +00001000 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
1001 }
1002 } else {
1003 GenerateError("Illegal label reference " + ID.getName());
1004 return 0;
1005 }
1006
1007 // If its already been defined, return it now.
1008 if (BB) {
1009 ID.destroy(); // Free strdup'd memory.
1010 return BB;
1011 }
1012
1013 // Otherwise, this block has not been seen before, create it.
1014 std::string Name;
1015 if (ID.Type == ValID::LocalName)
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001016 Name = ID.getName();
Gabor Greife64d2482008-04-06 23:07:54 +00001017 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Reid Spencer93c40032007-03-19 18:40:50 +00001018
1019 // Insert it in the forward refs map.
1020 CurFun.BBForwardRefs[ID] = BB;
1021
Reid Spencer68a24bd2005-08-27 18:50:39 +00001022 return BB;
1023}
1024
1025
1026//===----------------------------------------------------------------------===//
1027// Code to handle forward references in instructions
1028//===----------------------------------------------------------------------===//
1029//
1030// This code handles the late binding needed with statements that reference
1031// values not defined yet... for example, a forward branch, or the PHI node for
1032// a loop body.
1033//
1034// This keeps a table (CurFun.LateResolveValues) of all such forward references
1035// and back patchs after we are done.
1036//
1037
1038// ResolveDefinitions - If we could not resolve some defs at parsing
1039// time (forward branches, phi functions for loops, etc...) resolve the
1040// defs now...
1041//
Eric Christopher2a5196f2008-09-24 04:55:49 +00001042static void
Reid Spencer93c40032007-03-19 18:40:50 +00001043ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001044 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
Reid Spencer93c40032007-03-19 18:40:50 +00001045 while (!LateResolvers.empty()) {
1046 Value *V = LateResolvers.back();
1047 LateResolvers.pop_back();
Reid Spencer68a24bd2005-08-27 18:50:39 +00001048
Reid Spencer93c40032007-03-19 18:40:50 +00001049 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1050 CurModule.PlaceHolderInfo.find(V);
1051 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001052
Reid Spencer93c40032007-03-19 18:40:50 +00001053 ValID &DID = PHI->second.first;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001054
Reid Spencer93c40032007-03-19 18:40:50 +00001055 Value *TheRealValue = getExistingVal(V->getType(), DID);
1056 if (TriggerError)
1057 return;
1058 if (TheRealValue) {
1059 V->replaceAllUsesWith(TheRealValue);
1060 delete V;
1061 CurModule.PlaceHolderInfo.erase(PHI);
1062 } else if (FutureLateResolvers) {
1063 // Functions have their unresolved items forwarded to the module late
1064 // resolver table
1065 InsertValue(V, *FutureLateResolvers);
1066 } else {
1067 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1068 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1069 "' of type '" + V->getType()->getDescription() + "'",
1070 PHI->second.second);
Reid Spencer5b7e7532006-09-28 19:28:24 +00001071 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001072 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00001073 GenerateError("Reference to an invalid definition: #" +
1074 itostr(DID.Num) + " of type '" +
1075 V->getType()->getDescription() + "'",
1076 PHI->second.second);
1077 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001078 }
1079 }
1080 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001081 LateResolvers.clear();
1082}
1083
1084// ResolveTypeTo - A brand new type was just declared. This means that (if
1085// name is not null) things referencing Name can be resolved. Otherwise, things
1086// refering to the number can be resolved. Do this now.
1087//
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001088static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001089 ValID D;
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001090 if (Name)
1091 D = ValID::createLocalName(*Name);
Eric Christopher2a5196f2008-09-24 04:55:49 +00001092 else
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001093 D = ValID::createLocalID(CurModule.Types.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00001094
Reid Spencer861d9d62006-11-28 07:29:44 +00001095 std::map<ValID, PATypeHolder>::iterator I =
Reid Spencer68a24bd2005-08-27 18:50:39 +00001096 CurModule.LateResolveTypes.find(D);
1097 if (I != CurModule.LateResolveTypes.end()) {
Reid Spencer861d9d62006-11-28 07:29:44 +00001098 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
Nuno Lopes6ec8a252008-10-15 11:11:12 +00001099 I->first.destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +00001100 CurModule.LateResolveTypes.erase(I);
1101 }
Nuno Lopes191dfb92008-10-03 15:52:39 +00001102 D.destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +00001103}
1104
1105// setValueName - Set the specified value to the name given. The name may be
1106// null potentially, in which case this is a noop. The string passed in is
1107// assumed to be a malloc'd string buffer, and is free'd by this function.
1108//
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001109static void setValueName(Value *V, std::string *NameStr) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00001110 if (!NameStr) return;
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001111 std::string Name(*NameStr); // Copy string
1112 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001113
Reid Spencer41dff5e2007-01-26 08:05:27 +00001114 if (V->getType() == Type::VoidTy) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001115 GenerateError("Can't assign name '" + Name+"' to value with void type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00001116 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001117 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00001118
Reid Spencera9720f52007-02-05 17:04:00 +00001119 assert(inFunctionScope() && "Must be in function scope!");
Reid Spenceref9b9a72007-02-05 20:47:22 +00001120 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1121 if (ST.lookup(Name)) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00001122 GenerateError("Redefinition of value '" + Name + "' of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00001123 V->getType()->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00001124 return;
1125 }
1126
1127 // Set the name.
1128 V->setName(Name);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001129}
1130
1131/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1132/// this is a declaration, otherwise it is a definition.
Chris Lattnerb475c422005-11-12 18:22:38 +00001133static GlobalVariable *
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001134ParseGlobalVariable(std::string *NameStr,
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001135 GlobalValue::LinkageTypes Linkage,
1136 GlobalValue::VisibilityTypes Visibility,
Chris Lattnerb475c422005-11-12 18:22:38 +00001137 bool isConstantGlobal, const Type *Ty,
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001138 Constant *Initializer, bool IsThreadLocal,
1139 unsigned AddressSpace = 0) {
Reid Spencer5b7e7532006-09-28 19:28:24 +00001140 if (isa<FunctionType>(Ty)) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001141 GenerateError("Cannot declare global vars of function type");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001142 return 0;
1143 }
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001144 if (Ty == Type::LabelTy) {
1145 GenerateError("Cannot declare global vars of label type");
1146 return 0;
1147 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001148
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001149 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001150
1151 std::string Name;
1152 if (NameStr) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001153 Name = *NameStr; // Copy string
1154 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001155 }
1156
1157 // See if this global value was forward referenced. If so, recycle the
1158 // object.
1159 ValID ID;
1160 if (!Name.empty()) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001161 ID = ValID::createGlobalName(Name);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001162 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00001163 ID = ValID::createGlobalID(CurModule.Values.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00001164 }
1165
1166 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1167 // Move the global to the end of the list, from whereever it was
1168 // previously inserted.
1169 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1170 CurModule.CurrentModule->getGlobalList().remove(GV);
1171 CurModule.CurrentModule->getGlobalList().push_back(GV);
1172 GV->setInitializer(Initializer);
1173 GV->setLinkage(Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001174 GV->setVisibility(Visibility);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001175 GV->setConstant(isConstantGlobal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00001176 GV->setThreadLocal(IsThreadLocal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001177 InsertValue(GV, CurModule.Values);
Nuno Lopes191dfb92008-10-03 15:52:39 +00001178 ID.destroy();
Chris Lattnerb475c422005-11-12 18:22:38 +00001179 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001180 }
1181
Nuno Lopes191dfb92008-10-03 15:52:39 +00001182 ID.destroy();
1183
Reid Spenceref9b9a72007-02-05 20:47:22 +00001184 // If this global has a name
Reid Spencer68a24bd2005-08-27 18:50:39 +00001185 if (!Name.empty()) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00001186 // if the global we're parsing has an initializer (is a definition) and
1187 // has external linkage.
1188 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1189 // If there is already a global with external linkage with this name
1190 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1191 // If we allow this GVar to get created, it will be renamed in the
1192 // symbol table because it conflicts with an existing GVar. We can't
1193 // allow redefinition of GVars whose linking indicates that their name
1194 // must stay the same. Issue the error.
1195 GenerateError("Redefinition of global variable named '" + Name +
1196 "' of type '" + Ty->getDescription() + "'");
1197 return 0;
1198 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001199 }
1200
1201 // Otherwise there is no existing GV to use, create one now.
1202 GlobalVariable *GV =
1203 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001204 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001205 GV->setVisibility(Visibility);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001206 InsertValue(GV, CurModule.Values);
Chris Lattnerb475c422005-11-12 18:22:38 +00001207 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001208}
1209
1210// setTypeName - Set the specified type to the name given. The name may be
1211// null potentially, in which case this is a noop. The string passed in is
1212// assumed to be a malloc'd string buffer, and is freed by this function.
1213//
1214// This function returns true if the type has already been defined, but is
1215// allowed to be redefined in the specified context. If the name is a new name
1216// for the type plane, it is inserted and false is returned.
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001217static bool setTypeName(const Type *T, std::string *NameStr) {
Reid Spencera9720f52007-02-05 17:04:00 +00001218 assert(!inFunctionScope() && "Can't give types function-local names!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001219 if (NameStr == 0) return false;
Eric Christopher2a5196f2008-09-24 04:55:49 +00001220
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001221 std::string Name(*NameStr); // Copy string
1222 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001223
1224 // We don't allow assigning names to void type
Reid Spencer5b7e7532006-09-28 19:28:24 +00001225 if (T == Type::VoidTy) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001226 GenerateError("Can't assign name '" + Name + "' to the void type");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001227 return false;
1228 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001229
1230 // Set the type name, checking for conflicts as we do so.
1231 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1232
1233 if (AlreadyExists) { // Inserting a name that is already defined???
1234 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
Reid Spencera9720f52007-02-05 17:04:00 +00001235 assert(Existing && "Conflict but no matching type?!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001236
1237 // There is only one case where this is allowed: when we are refining an
1238 // opaque type. In this case, Existing will be an opaque type.
1239 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1240 // We ARE replacing an opaque type!
1241 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1242 return true;
1243 }
1244
1245 // Otherwise, this is an attempt to redefine a type. That's okay if
1246 // the redefinition is identical to the original. This will be so if
1247 // Existing and T point to the same Type object. In this one case we
1248 // allow the equivalent redefinition.
1249 if (Existing == T) return true; // Yes, it's equal.
1250
1251 // Any other kind of (non-equivalent) redefinition is an error.
Reid Spencer63c34452007-01-05 21:51:07 +00001252 GenerateError("Redefinition of type named '" + Name + "' of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00001253 T->getDescription() + "'");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001254 }
1255
1256 return false;
1257}
1258
1259//===----------------------------------------------------------------------===//
1260// Code for handling upreferences in type names...
1261//
1262
1263// TypeContains - Returns true if Ty directly contains E in it.
1264//
1265static bool TypeContains(const Type *Ty, const Type *E) {
1266 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1267 E) != Ty->subtype_end();
1268}
1269
1270namespace {
1271 struct UpRefRecord {
1272 // NestingLevel - The number of nesting levels that need to be popped before
1273 // this type is resolved.
1274 unsigned NestingLevel;
1275
1276 // LastContainedTy - This is the type at the current binding level for the
1277 // type. Every time we reduce the nesting level, this gets updated.
1278 const Type *LastContainedTy;
1279
1280 // UpRefTy - This is the actual opaque type that the upreference is
1281 // represented with.
1282 OpaqueType *UpRefTy;
1283
1284 UpRefRecord(unsigned NL, OpaqueType *URTy)
1285 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1286 };
1287}
1288
1289// UpRefs - A list of the outstanding upreferences that need to be resolved.
1290static std::vector<UpRefRecord> UpRefs;
1291
1292/// HandleUpRefs - Every time we finish a new layer of types, this function is
1293/// called. It loops through the UpRefs vector, which is a list of the
1294/// currently active types. For each type, if the up reference is contained in
1295/// the newly completed type, we decrement the level count. When the level
1296/// count reaches zero, the upreferenced type is the type that is passed in:
1297/// thus we can complete the cycle.
1298///
1299static PATypeHolder HandleUpRefs(const Type *ty) {
Chris Lattner224f84f2006-08-18 17:34:45 +00001300 // If Ty isn't abstract, or if there are no up-references in it, then there is
1301 // nothing to resolve here.
1302 if (!ty->isAbstract() || UpRefs.empty()) return ty;
Eric Christopher2a5196f2008-09-24 04:55:49 +00001303
Reid Spencer68a24bd2005-08-27 18:50:39 +00001304 PATypeHolder Ty(ty);
1305 UR_OUT("Type '" << Ty->getDescription() <<
1306 "' newly formed. Resolving upreferences.\n" <<
1307 UpRefs.size() << " upreferences active!\n");
1308
1309 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1310 // to zero), we resolve them all together before we resolve them to Ty. At
1311 // the end of the loop, if there is anything to resolve to Ty, it will be in
1312 // this variable.
1313 OpaqueType *TypeToResolve = 0;
1314
1315 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1316 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1317 << UpRefs[i].second->getDescription() << ") = "
1318 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1319 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1320 // Decrement level of upreference
1321 unsigned Level = --UpRefs[i].NestingLevel;
1322 UpRefs[i].LastContainedTy = Ty;
1323 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1324 if (Level == 0) { // Upreference should be resolved!
1325 if (!TypeToResolve) {
1326 TypeToResolve = UpRefs[i].UpRefTy;
1327 } else {
1328 UR_OUT(" * Resolving upreference for "
1329 << UpRefs[i].second->getDescription() << "\n";
1330 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1331 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1332 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1333 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1334 }
1335 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1336 --i; // Do not skip the next element...
1337 }
1338 }
1339 }
1340
1341 if (TypeToResolve) {
1342 UR_OUT(" * Resolving upreference for "
1343 << UpRefs[i].second->getDescription() << "\n";
1344 std::string OldName = TypeToResolve->getDescription());
1345 TypeToResolve->refineAbstractTypeTo(Ty);
1346 }
1347
1348 return Ty;
1349}
1350
Reid Spencer68a24bd2005-08-27 18:50:39 +00001351//===----------------------------------------------------------------------===//
1352// RunVMAsmParser - Define an interface to this parser
1353//===----------------------------------------------------------------------===//
1354//
Reid Spencer14310612006-12-31 05:40:51 +00001355static Module* RunParser(Module * M);
1356
Duncan Sandsdc024672007-11-27 13:23:08 +00001357Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1358 InitLLLexer(MB);
1359 Module *M = RunParser(new Module(LLLgetFilename()));
1360 FreeLexer();
1361 return M;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001362}
1363
1364
Dan Gohmanf4423b12008-04-19 00:24:39 +00001365
1366/* Enabling traces. */
1367#ifndef YYDEBUG
1368# define YYDEBUG 0
1369#endif
1370
1371/* Enabling verbose error messages. */
1372#ifdef YYERROR_VERBOSE
1373# undef YYERROR_VERBOSE
1374# define YYERROR_VERBOSE 1
1375#else
1376# define YYERROR_VERBOSE 0
1377#endif
1378
1379/* Enabling the token table. */
1380#ifndef YYTOKEN_TABLE
1381# define YYTOKEN_TABLE 0
1382#endif
1383
1384#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1385typedef union YYSTYPE
Nuno Lopes19830332008-11-04 14:28:33 +00001386#line 982 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00001387{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001388 llvm::Module *ModuleVal;
1389 llvm::Function *FunctionVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001390 llvm::BasicBlock *BasicBlockVal;
1391 llvm::TerminatorInst *TermInstVal;
1392 llvm::Instruction *InstVal;
Reid Spencera132e042006-12-03 05:46:11 +00001393 llvm::Constant *ConstVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001394
Reid Spencera132e042006-12-03 05:46:11 +00001395 const llvm::Type *PrimType;
Reid Spencer14310612006-12-31 05:40:51 +00001396 std::list<llvm::PATypeHolder> *TypeList;
Reid Spencera132e042006-12-03 05:46:11 +00001397 llvm::PATypeHolder *TypeVal;
1398 llvm::Value *ValueVal;
Reid Spencera132e042006-12-03 05:46:11 +00001399 std::vector<llvm::Value*> *ValueList;
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001400 std::vector<unsigned> *ConstantList;
Reid Spencer14310612006-12-31 05:40:51 +00001401 llvm::ArgListType *ArgList;
1402 llvm::TypeWithAttrs TypeWithAttrs;
1403 llvm::TypeWithAttrsList *TypeWithAttrsList;
Dale Johanneseneb57ea72007-11-05 21:20:28 +00001404 llvm::ParamList *ParamList;
Reid Spencer14310612006-12-31 05:40:51 +00001405
Reid Spencer68a24bd2005-08-27 18:50:39 +00001406 // Represent the RHS of PHI node
Reid Spencera132e042006-12-03 05:46:11 +00001407 std::list<std::pair<llvm::Value*,
1408 llvm::BasicBlock*> > *PHIList;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001409 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
Reid Spencera132e042006-12-03 05:46:11 +00001410 std::vector<llvm::Constant*> *ConstVector;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001411
1412 llvm::GlobalValue::LinkageTypes Linkage;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001413 llvm::GlobalValue::VisibilityTypes Visibility;
Devang Patel05988662008-09-25 21:00:45 +00001414 llvm::Attributes Attributes;
Reid Spencer38c91a92007-02-28 02:24:54 +00001415 llvm::APInt *APIntVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001416 int64_t SInt64Val;
1417 uint64_t UInt64Val;
1418 int SIntVal;
1419 unsigned UIntVal;
Dale Johannesencdd509a2007-09-07 21:07:57 +00001420 llvm::APFloat *FPVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001421 bool BoolVal;
1422
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001423 std::string *StrVal; // This memory must be deleted
1424 llvm::ValID ValIDVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001425
Reid Spencera132e042006-12-03 05:46:11 +00001426 llvm::Instruction::BinaryOps BinaryOpVal;
1427 llvm::Instruction::TermOps TermOpVal;
1428 llvm::Instruction::MemoryOps MemOpVal;
1429 llvm::Instruction::CastOps CastOpVal;
1430 llvm::Instruction::OtherOps OtherOpVal;
Reid Spencera132e042006-12-03 05:46:11 +00001431 llvm::ICmpInst::Predicate IPredicate;
1432 llvm::FCmpInst::Predicate FPredicate;
Dan Gohmanf4423b12008-04-19 00:24:39 +00001433}
Nuno Lopes6ec8a252008-10-15 11:11:12 +00001434/* Line 187 of yacc.c. */
Nuno Lopes19830332008-11-04 14:28:33 +00001435#line 1436 "llvmAsmParser.tab.c"
Dan Gohmanf4423b12008-04-19 00:24:39 +00001436 YYSTYPE;
1437# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1438# define YYSTYPE_IS_DECLARED 1
1439# define YYSTYPE_IS_TRIVIAL 1
Reid Spencer68a24bd2005-08-27 18:50:39 +00001440#endif
1441
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001442
Reid Spencer68a24bd2005-08-27 18:50:39 +00001443
Dan Gohmanf4423b12008-04-19 00:24:39 +00001444/* Copy the second part of user declarations. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001445
1446
Dan Gohmanf4423b12008-04-19 00:24:39 +00001447/* Line 216 of yacc.c. */
Nuno Lopes19830332008-11-04 14:28:33 +00001448#line 1449 "llvmAsmParser.tab.c"
Reid Spencerb8f85052007-07-31 03:50:36 +00001449
Dan Gohmanf4423b12008-04-19 00:24:39 +00001450#ifdef short
1451# undef short
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001452#endif
1453
Dan Gohmanf4423b12008-04-19 00:24:39 +00001454#ifdef YYTYPE_UINT8
1455typedef YYTYPE_UINT8 yytype_uint8;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001456#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00001457typedef unsigned char yytype_uint8;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001458#endif
1459
Dan Gohmanf4423b12008-04-19 00:24:39 +00001460#ifdef YYTYPE_INT8
1461typedef YYTYPE_INT8 yytype_int8;
1462#elif (defined __STDC__ || defined __C99__FUNC__ \
1463 || defined __cplusplus || defined _MSC_VER)
1464typedef signed char yytype_int8;
1465#else
1466typedef short int yytype_int8;
1467#endif
1468
1469#ifdef YYTYPE_UINT16
1470typedef YYTYPE_UINT16 yytype_uint16;
1471#else
1472typedef unsigned short int yytype_uint16;
1473#endif
1474
1475#ifdef YYTYPE_INT16
1476typedef YYTYPE_INT16 yytype_int16;
1477#else
1478typedef short int yytype_int16;
1479#endif
1480
1481#ifndef YYSIZE_T
1482# ifdef __SIZE_TYPE__
1483# define YYSIZE_T __SIZE_TYPE__
1484# elif defined size_t
1485# define YYSIZE_T size_t
1486# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1487 || defined __cplusplus || defined _MSC_VER)
1488# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1489# define YYSIZE_T size_t
1490# else
1491# define YYSIZE_T unsigned int
1492# endif
1493#endif
1494
1495#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1496
1497#ifndef YY_
Nuno Lopes6ec8a252008-10-15 11:11:12 +00001498# if YYENABLE_NLS
Dan Gohmanf4423b12008-04-19 00:24:39 +00001499# if ENABLE_NLS
1500# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1501# define YY_(msgid) dgettext ("bison-runtime", msgid)
1502# endif
1503# endif
1504# ifndef YY_
1505# define YY_(msgid) msgid
1506# endif
1507#endif
1508
1509/* Suppress unused-variable warnings by "using" E. */
1510#if ! defined lint || defined __GNUC__
1511# define YYUSE(e) ((void) (e))
1512#else
1513# define YYUSE(e) /* empty */
1514#endif
1515
1516/* Identity function, used to suppress warnings about constant conditions. */
1517#ifndef lint
1518# define YYID(n) (n)
1519#else
1520#if (defined __STDC__ || defined __C99__FUNC__ \
1521 || defined __cplusplus || defined _MSC_VER)
1522static int
1523YYID (int i)
1524#else
1525static int
1526YYID (i)
1527 int i;
1528#endif
1529{
1530 return i;
1531}
1532#endif
1533
1534#if ! defined yyoverflow || YYERROR_VERBOSE
1535
1536/* The parser invokes alloca or malloc; define the necessary symbols. */
1537
1538# ifdef YYSTACK_USE_ALLOCA
1539# if YYSTACK_USE_ALLOCA
1540# ifdef __GNUC__
1541# define YYSTACK_ALLOC __builtin_alloca
1542# elif defined __BUILTIN_VA_ARG_INCR
1543# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1544# elif defined _AIX
1545# define YYSTACK_ALLOC __alloca
1546# elif defined _MSC_VER
1547# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1548# define alloca _alloca
1549# else
1550# define YYSTACK_ALLOC alloca
1551# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1552 || defined __cplusplus || defined _MSC_VER)
1553# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1554# ifndef _STDLIB_H
1555# define _STDLIB_H 1
1556# endif
1557# endif
1558# endif
1559# endif
1560# endif
1561
1562# ifdef YYSTACK_ALLOC
1563 /* Pacify GCC's `empty if-body' warning. */
1564# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1565# ifndef YYSTACK_ALLOC_MAXIMUM
1566 /* The OS might guarantee only one guard page at the bottom of the stack,
1567 and a page size can be as small as 4096 bytes. So we cannot safely
1568 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1569 to allow for a few compiler-allocated temporary stack slots. */
1570# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1571# endif
1572# else
1573# define YYSTACK_ALLOC YYMALLOC
1574# define YYSTACK_FREE YYFREE
1575# ifndef YYSTACK_ALLOC_MAXIMUM
1576# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1577# endif
1578# if (defined __cplusplus && ! defined _STDLIB_H \
1579 && ! ((defined YYMALLOC || defined malloc) \
1580 && (defined YYFREE || defined free)))
1581# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1582# ifndef _STDLIB_H
1583# define _STDLIB_H 1
1584# endif
1585# endif
1586# ifndef YYMALLOC
1587# define YYMALLOC malloc
1588# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1589 || defined __cplusplus || defined _MSC_VER)
1590void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1591# endif
1592# endif
1593# ifndef YYFREE
1594# define YYFREE free
1595# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1596 || defined __cplusplus || defined _MSC_VER)
1597void free (void *); /* INFRINGES ON USER NAME SPACE */
1598# endif
1599# endif
1600# endif
1601#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1602
1603
1604#if (! defined yyoverflow \
1605 && (! defined __cplusplus \
1606 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1607
1608/* A type that is properly aligned for any stack member. */
1609union yyalloc
1610{
1611 yytype_int16 yyss;
1612 YYSTYPE yyvs;
1613 };
1614
1615/* The size of the maximum gap between one aligned stack and the next. */
1616# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1617
1618/* The size of an array large to enough to hold all stacks, each with
1619 N elements. */
1620# define YYSTACK_BYTES(N) \
1621 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1622 + YYSTACK_GAP_MAXIMUM)
1623
1624/* Copy COUNT objects from FROM to TO. The source and destination do
1625 not overlap. */
1626# ifndef YYCOPY
1627# if defined __GNUC__ && 1 < __GNUC__
1628# define YYCOPY(To, From, Count) \
1629 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1630# else
1631# define YYCOPY(To, From, Count) \
1632 do \
1633 { \
1634 YYSIZE_T yyi; \
1635 for (yyi = 0; yyi < (Count); yyi++) \
1636 (To)[yyi] = (From)[yyi]; \
1637 } \
1638 while (YYID (0))
1639# endif
1640# endif
1641
1642/* Relocate STACK from its old location to the new one. The
1643 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1644 elements in the stack, and YYPTR gives the new location of the
1645 stack. Advance YYPTR to a properly aligned location for the next
1646 stack. */
1647# define YYSTACK_RELOCATE(Stack) \
1648 do \
1649 { \
1650 YYSIZE_T yynewbytes; \
1651 YYCOPY (&yyptr->Stack, Stack, yysize); \
1652 Stack = &yyptr->Stack; \
1653 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1654 yyptr += yynewbytes / sizeof (*yyptr); \
1655 } \
1656 while (YYID (0))
1657
1658#endif
1659
1660/* YYFINAL -- State number of the termination state. */
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001661#define YYFINAL 44
Dan Gohmanf4423b12008-04-19 00:24:39 +00001662/* YYLAST -- Last index in YYTABLE. */
Chris Lattner740e7092008-10-15 06:16:57 +00001663#define YYLAST 2377
Dan Gohmanf4423b12008-04-19 00:24:39 +00001664
1665/* YYNTOKENS -- Number of terminals. */
Devang Patel652203f2008-09-29 20:49:50 +00001666#define YYNTOKENS 173
Dan Gohmanf4423b12008-04-19 00:24:39 +00001667/* YYNNTS -- Number of nonterminals. */
Chris Lattner740e7092008-10-15 06:16:57 +00001668#define YYNNTS 87
Dan Gohmanf4423b12008-04-19 00:24:39 +00001669/* YYNRULES -- Number of rules. */
Chris Lattner740e7092008-10-15 06:16:57 +00001670#define YYNRULES 348
Dan Gohmanf4423b12008-04-19 00:24:39 +00001671/* YYNRULES -- Number of states. */
Chris Lattner740e7092008-10-15 06:16:57 +00001672#define YYNSTATES 708
Dan Gohmanf4423b12008-04-19 00:24:39 +00001673
1674/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1675#define YYUNDEFTOK 2
Devang Patel652203f2008-09-29 20:49:50 +00001676#define YYMAXUTOK 413
Dan Gohmanf4423b12008-04-19 00:24:39 +00001677
1678#define YYTRANSLATE(YYX) \
1679 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1680
1681/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1682static const yytype_uint8 yytranslate[] =
1683{
1684 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1685 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1686 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1687 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patel652203f2008-09-29 20:49:50 +00001688 159, 160, 163, 2, 162, 2, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001689 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patel652203f2008-09-29 20:49:50 +00001690 168, 161, 169, 2, 2, 2, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001691 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1692 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patel652203f2008-09-29 20:49:50 +00001693 2, 165, 164, 167, 2, 2, 2, 2, 2, 172,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001694 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1695 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patel652203f2008-09-29 20:49:50 +00001696 166, 2, 2, 170, 2, 171, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001697 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1698 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1699 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1700 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1701 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1702 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1703 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1704 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1705 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1706 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1707 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, 1, 2, 3, 4,
1710 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1711 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1712 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1713 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1714 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1715 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1716 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1717 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1718 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1719 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1720 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1721 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1722 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1723 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001724 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
Devang Patel652203f2008-09-29 20:49:50 +00001725 155, 156, 157, 158
Dan Gohmanf4423b12008-04-19 00:24:39 +00001726};
1727
1728#if YYDEBUG
1729/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1730 YYRHS. */
1731static const yytype_uint16 yyprhs[] =
1732{
1733 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1734 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1735 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1736 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1737 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1738 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
Chris Lattner740e7092008-10-15 06:16:57 +00001739 118, 123, 124, 127, 128, 131, 133, 135, 137, 138,
1740 141, 143, 145, 147, 149, 151, 153, 155, 157, 159,
1741 160, 162, 164, 166, 167, 169, 171, 172, 174, 176,
1742 178, 180, 181, 183, 185, 186, 188, 190, 192, 194,
1743 196, 199, 201, 203, 205, 207, 209, 211, 213, 215,
1744 217, 220, 221, 224, 226, 228, 230, 231, 234, 236,
1745 238, 240, 242, 244, 246, 248, 250, 252, 254, 255,
1746 258, 259, 262, 263, 266, 267, 271, 274, 275, 277,
1747 278, 282, 284, 287, 289, 291, 293, 295, 297, 299,
1748 301, 303, 305, 309, 311, 314, 320, 326, 332, 338,
1749 342, 345, 351, 356, 359, 361, 363, 365, 369, 371,
1750 375, 377, 378, 380, 384, 389, 393, 397, 402, 407,
1751 411, 418, 424, 427, 430, 433, 436, 439, 442, 445,
1752 448, 451, 454, 457, 460, 467, 473, 482, 489, 496,
1753 504, 512, 520, 528, 535, 544, 553, 559, 567, 571,
1754 573, 575, 577, 579, 580, 583, 590, 592, 593, 595,
1755 598, 599, 603, 604, 608, 612, 616, 620, 621, 630,
1756 631, 641, 642, 652, 658, 661, 665, 667, 671, 675,
1757 679, 683, 685, 686, 692, 696, 698, 702, 704, 705,
1758 717, 719, 721, 726, 728, 730, 733, 737, 738, 740,
1759 742, 744, 746, 748, 750, 752, 754, 756, 758, 760,
1760 764, 768, 771, 774, 778, 781, 787, 792, 794, 800,
1761 802, 804, 806, 808, 810, 812, 815, 817, 821, 824,
1762 827, 831, 835, 838, 839, 841, 844, 847, 851, 861,
1763 871, 880, 896, 898, 900, 907, 913, 916, 919, 926,
1764 934, 939, 944, 951, 958, 959, 960, 964, 967, 971,
1765 974, 976, 982, 988, 995, 1002, 1009, 1016, 1021, 1028,
1766 1033, 1038, 1045, 1052, 1055, 1065, 1067, 1069, 1070, 1074,
1767 1081, 1085, 1092, 1095, 1101, 1109, 1115, 1120, 1125
Dan Gohmanf4423b12008-04-19 00:24:39 +00001768};
1769
1770/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1771static const yytype_int16 yyrhs[] =
1772{
Chris Lattner740e7092008-10-15 06:16:57 +00001773 220, 0, -1, 75, -1, 76, -1, 77, -1, 78,
Dale Johannesendfe8c842008-09-26 19:32:34 +00001774 -1, 79, -1, 80, -1, 81, -1, 82, -1, 83,
1775 -1, 87, -1, 88, -1, 89, -1, 84, -1, 85,
1776 -1, 86, -1, 120, -1, 121, -1, 122, -1, 123,
1777 -1, 124, -1, 125, -1, 126, -1, 127, -1, 128,
1778 -1, 129, -1, 130, -1, 131, -1, 94, -1, 95,
1779 -1, 96, -1, 97, -1, 98, -1, 99, -1, 100,
1780 -1, 101, -1, 102, -1, 103, -1, 104, -1, 105,
1781 -1, 106, -1, 107, -1, 108, -1, 109, -1, 110,
1782 -1, 111, -1, 112, -1, 113, -1, 100, -1, 101,
Chris Lattner740e7092008-10-15 06:16:57 +00001783 -1, 102, -1, 103, -1, 26, -1, 27, -1, 19,
1784 -1, 22, -1, 24, -1, 179, -1, -1, 55, 159,
1785 4, 160, -1, -1, 179, 161, -1, -1, 7, 161,
1786 -1, 20, -1, 23, -1, 186, -1, -1, 184, 161,
Chris Lattnerf9078f92008-10-15 06:03:48 +00001787 -1, 42, -1, 44, -1, 43, -1, 45, -1, 47,
1788 -1, 49, -1, 46, -1, 48, -1, 51, -1, -1,
1789 156, -1, 157, -1, 158, -1, -1, 46, -1, 48,
1790 -1, -1, 42, -1, 43, -1, 44, -1, 47, -1,
1791 -1, 44, -1, 42, -1, -1, 63, -1, 64, -1,
1792 65, -1, 66, -1, 67, -1, 62, 4, -1, 142,
1793 -1, 121, -1, 141, -1, 122, -1, 144, -1, 145,
1794 -1, 147, -1, 148, -1, 149, -1, 54, 4, -1,
Chris Lattner740e7092008-10-15 06:16:57 +00001795 -1, 195, 194, -1, 144, -1, 142, -1, 141, -1,
1796 -1, 197, 196, -1, 143, -1, 146, -1, 144, -1,
Chris Lattnerf9078f92008-10-15 06:03:48 +00001797 142, -1, 141, -1, 150, -1, 151, -1, 154, -1,
Chris Lattner740e7092008-10-15 06:16:57 +00001798 155, -1, 153, -1, -1, 199, 198, -1, -1, 152,
Chris Lattnerf9078f92008-10-15 06:03:48 +00001799 22, -1, -1, 54, 4, -1, -1, 162, 54, 4,
Chris Lattner740e7092008-10-15 06:16:57 +00001800 -1, 34, 22, -1, -1, 203, -1, -1, 162, 206,
1801 205, -1, 203, -1, 54, 4, -1, 11, -1, 12,
Chris Lattnerf9078f92008-10-15 06:03:48 +00001802 -1, 13, -1, 16, -1, 15, -1, 14, -1, 17,
Chris Lattner740e7092008-10-15 06:16:57 +00001803 -1, 50, -1, 207, -1, 208, 181, 163, -1, 242,
1804 -1, 164, 4, -1, 208, 159, 212, 160, 199, -1,
1805 10, 159, 212, 160, 199, -1, 165, 4, 166, 208,
1806 167, -1, 168, 4, 166, 208, 169, -1, 170, 213,
1807 171, -1, 170, 171, -1, 168, 170, 213, 171, 169,
1808 -1, 168, 170, 171, 169, -1, 208, 195, -1, 208,
1809 -1, 10, -1, 209, -1, 211, 162, 209, -1, 211,
1810 -1, 211, 162, 39, -1, 39, -1, -1, 208, -1,
1811 213, 162, 208, -1, 208, 165, 216, 167, -1, 208,
1812 165, 167, -1, 208, 172, 22, -1, 208, 168, 216,
1813 169, -1, 208, 170, 216, 171, -1, 208, 170, 171,
1814 -1, 208, 168, 170, 216, 171, 169, -1, 208, 168,
1815 170, 171, 169, -1, 208, 40, -1, 208, 41, -1,
1816 208, 242, -1, 208, 215, -1, 208, 25, -1, 208,
1817 3, -1, 208, 5, -1, 208, 4, -1, 208, 6,
1818 -1, 208, 26, -1, 208, 27, -1, 208, 9, -1,
1819 176, 159, 214, 38, 208, 160, -1, 119, 159, 214,
1820 254, 160, -1, 133, 159, 214, 162, 214, 162, 214,
1821 160, -1, 174, 159, 214, 162, 214, 160, -1, 175,
1822 159, 214, 162, 214, 160, -1, 90, 177, 159, 214,
1823 162, 214, 160, -1, 91, 178, 159, 214, 162, 214,
1824 160, -1, 92, 177, 159, 214, 162, 214, 160, -1,
1825 93, 178, 159, 214, 162, 214, 160, -1, 135, 159,
1826 214, 162, 214, 160, -1, 136, 159, 214, 162, 214,
1827 162, 214, 160, -1, 137, 159, 214, 162, 214, 162,
1828 214, 160, -1, 139, 159, 214, 255, 160, -1, 140,
1829 159, 214, 162, 214, 255, 160, -1, 216, 162, 214,
1830 -1, 214, -1, 32, -1, 33, -1, 37, -1, -1,
1831 210, 242, -1, 125, 159, 219, 38, 208, 160, -1,
1832 221, -1, -1, 222, -1, 221, 222, -1, -1, 31,
1833 223, 238, -1, -1, 30, 224, 239, -1, 60, 59,
1834 228, -1, 182, 18, 208, -1, 182, 18, 10, -1,
1835 -1, 185, 189, 218, 217, 214, 181, 225, 205, -1,
1836 -1, 185, 187, 189, 218, 217, 214, 181, 226, 205,
1837 -1, -1, 185, 188, 189, 218, 217, 208, 181, 227,
1838 205, -1, 185, 189, 35, 192, 219, -1, 52, 229,
1839 -1, 56, 161, 230, -1, 22, -1, 53, 161, 22,
1840 -1, 68, 161, 22, -1, 165, 231, 167, -1, 231,
1841 162, 22, -1, 22, -1, -1, 232, 162, 208, 195,
1842 180, -1, 208, 195, 180, -1, 232, -1, 232, 162,
1843 39, -1, 39, -1, -1, 193, 197, 210, 184, 159,
1844 233, 160, 199, 204, 201, 200, -1, 28, -1, 170,
1845 -1, 191, 189, 234, 235, -1, 29, -1, 171, -1,
1846 246, 237, -1, 190, 189, 234, -1, -1, 61, -1,
Chris Lattnerf9078f92008-10-15 06:03:48 +00001847 3, -1, 4, -1, 5, -1, 6, -1, 9, -1,
1848 26, -1, 27, -1, 40, -1, 41, -1, 25, -1,
Chris Lattner740e7092008-10-15 06:16:57 +00001849 168, 216, 169, -1, 165, 216, 167, -1, 165, 167,
1850 -1, 172, 22, -1, 170, 216, 171, -1, 170, 171,
1851 -1, 168, 170, 216, 171, 169, -1, 168, 170, 171,
1852 169, -1, 215, -1, 59, 240, 22, 162, 22, -1,
1853 7, -1, 8, -1, 179, -1, 184, -1, 242, -1,
1854 241, -1, 208, 243, -1, 244, -1, 245, 162, 244,
1855 -1, 246, 247, -1, 236, 247, -1, 248, 182, 249,
1856 -1, 248, 183, 249, -1, 248, 251, -1, -1, 21,
1857 -1, 69, 245, -1, 69, 10, -1, 70, 17, 243,
1858 -1, 70, 11, 243, 162, 17, 243, 162, 17, 243,
1859 -1, 71, 11, 243, 162, 17, 243, 165, 250, 167,
1860 -1, 71, 11, 243, 162, 17, 243, 165, 167, -1,
1861 72, 193, 197, 210, 243, 159, 253, 160, 199, 38,
1862 17, 243, 73, 17, 243, -1, 73, -1, 74, -1,
1863 250, 11, 241, 162, 17, 243, -1, 11, 241, 162,
1864 17, 243, -1, 182, 257, -1, 183, 257, -1, 208,
1865 165, 243, 162, 243, 167, -1, 252, 162, 165, 243,
1866 162, 243, 167, -1, 208, 195, 243, 195, -1, 17,
1867 195, 243, 195, -1, 253, 162, 208, 195, 243, 195,
1868 -1, 253, 162, 17, 195, 243, 195, -1, -1, -1,
1869 254, 162, 244, -1, 162, 4, -1, 255, 162, 4,
1870 -1, 58, 57, -1, 57, -1, 174, 208, 243, 162,
1871 243, -1, 175, 208, 243, 162, 243, -1, 90, 177,
1872 208, 243, 162, 243, -1, 91, 178, 208, 243, 162,
1873 243, -1, 92, 177, 208, 243, 162, 243, -1, 93,
1874 178, 208, 243, 162, 243, -1, 176, 244, 38, 208,
1875 -1, 133, 244, 162, 244, 162, 244, -1, 134, 244,
1876 162, 208, -1, 135, 244, 162, 244, -1, 136, 244,
1877 162, 244, 162, 244, -1, 137, 244, 162, 244, 162,
1878 244, -1, 132, 252, -1, 256, 193, 197, 210, 243,
1879 159, 253, 160, 199, -1, 259, -1, 36, -1, -1,
1880 114, 208, 202, -1, 114, 208, 162, 11, 243, 202,
1881 -1, 115, 208, 202, -1, 115, 208, 162, 11, 243,
1882 202, -1, 116, 244, -1, 258, 117, 208, 243, 202,
1883 -1, 258, 118, 244, 162, 208, 243, 202, -1, 138,
1884 208, 243, 162, 4, -1, 119, 208, 243, 254, -1,
1885 139, 208, 243, 255, -1, 140, 208, 243, 162, 208,
1886 243, 255, -1
Dan Gohmanf4423b12008-04-19 00:24:39 +00001887};
1888
1889/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1890static const yytype_uint16 yyrline[] =
1891{
Nuno Lopes19830332008-11-04 14:28:33 +00001892 0, 1148, 1148, 1148, 1148, 1148, 1148, 1148, 1148, 1148,
1893 1148, 1149, 1149, 1149, 1149, 1149, 1149, 1150, 1150, 1150,
1894 1150, 1150, 1150, 1151, 1151, 1151, 1151, 1151, 1151, 1154,
1895 1154, 1155, 1155, 1156, 1156, 1157, 1157, 1158, 1158, 1162,
1896 1162, 1163, 1163, 1164, 1164, 1165, 1165, 1166, 1166, 1167,
1897 1167, 1168, 1168, 1169, 1170, 1173, 1173, 1173, 1174, 1174,
1898 1176, 1177, 1181, 1185, 1190, 1196, 1196, 1198, 1199, 1204,
1899 1210, 1211, 1212, 1213, 1214, 1215, 1219, 1220, 1221, 1225,
1900 1226, 1227, 1228, 1232, 1233, 1234, 1238, 1239, 1240, 1241,
1901 1242, 1246, 1247, 1248, 1251, 1252, 1253, 1254, 1255, 1256,
1902 1257, 1264, 1265, 1266, 1267, 1268, 1269, 1270, 1271, 1272,
1903 1273, 1277, 1278, 1283, 1284, 1285, 1288, 1289, 1295, 1296,
1904 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1307, 1308,
1905 1314, 1315, 1322, 1323, 1329, 1330, 1339, 1347, 1348, 1353,
1906 1354, 1355, 1360, 1373, 1373, 1373, 1373, 1373, 1373, 1373,
1907 1376, 1380, 1384, 1391, 1396, 1404, 1439, 1470, 1475, 1485,
1908 1495, 1499, 1509, 1516, 1525, 1532, 1537, 1542, 1549, 1550,
1909 1557, 1564, 1572, 1578, 1590, 1618, 1634, 1661, 1689, 1715,
1910 1735, 1761, 1781, 1793, 1800, 1866, 1876, 1886, 1897, 1910,
1911 1921, 1935, 1942, 1949, 1967, 1979, 2000, 2008, 2014, 2025,
1912 2030, 2035, 2040, 2045, 2051, 2057, 2063, 2071, 2082, 2086,
1913 2094, 2094, 2097, 2097, 2100, 2112, 2133, 2138, 2146, 2147,
1914 2151, 2151, 2155, 2155, 2158, 2161, 2185, 2197, 2196, 2208,
1915 2207, 2217, 2216, 2227, 2267, 2270, 2276, 2286, 2290, 2295,
1916 2297, 2302, 2307, 2316, 2326, 2337, 2341, 2350, 2359, 2364,
1917 2513, 2513, 2515, 2524, 2524, 2526, 2531, 2543, 2547, 2552,
1918 2556, 2560, 2565, 2570, 2574, 2578, 2582, 2586, 2590, 2594,
1919 2616, 2638, 2644, 2657, 2669, 2674, 2686, 2692, 2696, 2706,
1920 2710, 2714, 2719, 2726, 2726, 2732, 2741, 2746, 2751, 2755,
1921 2764, 2773, 2786, 2795, 2799, 2807, 2827, 2831, 2836, 2847,
1922 2866, 2875, 2979, 2983, 2990, 3001, 3014, 3023, 3036, 3047,
1923 3057, 3068, 3076, 3086, 3093, 3096, 3097, 3105, 3111, 3120,
1924 3124, 3129, 3145, 3162, 3174, 3186, 3200, 3214, 3226, 3247,
1925 3254, 3260, 3266, 3272, 3287, 3397, 3402, 3406, 3413, 3420,
1926 3430, 3437, 3447, 3455, 3469, 3486, 3500, 3515, 3530
Dan Gohmanf4423b12008-04-19 00:24:39 +00001927};
1928#endif
1929
1930#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1931/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1932 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1933static const char *const yytname[] =
1934{
1935 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1936 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1937 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1938 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1939 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1940 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1941 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1942 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001943 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "COMMON", "OPAQUE",
Dan Gohmanf4423b12008-04-19 00:24:39 +00001944 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1945 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1946 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
Dale Johannesendfe8c842008-09-26 19:32:34 +00001947 "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE",
1948 "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM",
1949 "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "VICMP",
1950 "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1951 "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1952 "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1953 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1954 "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1955 "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
1956 "GETRESULT", "EXTRACTVALUE", "INSERTVALUE", "SIGNEXT", "ZEROEXT",
1957 "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL", "NEST",
Devang Patel652203f2008-09-29 20:49:50 +00001958 "READNONE", "READONLY", "GC", "OPTSIZE", "NOINLINE", "ALWAYSINLINE",
1959 "DEFAULT", "HIDDEN", "PROTECTED", "'('", "')'", "'='", "','", "'*'",
1960 "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'c'",
1961 "$accept", "ArithmeticOps", "LogicalOps", "CastOps", "IPredicates",
Chris Lattner740e7092008-10-15 06:16:57 +00001962 "FPredicates", "LocalName", "OptLocalName", "OptAddrSpace",
Chris Lattnerf9078f92008-10-15 06:03:48 +00001963 "OptLocalAssign", "LocalNumber", "GlobalName", "OptGlobalAssign",
1964 "GlobalAssign", "GVInternalLinkage", "GVExternalLinkage",
1965 "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage",
1966 "AliasLinkage", "OptCallingConv", "Attribute", "OptAttributes",
1967 "RetAttr", "OptRetAttrs", "FuncAttr", "OptFuncAttrs", "OptGC",
1968 "OptAlign", "OptCAlign", "SectionString", "OptSection",
Devang Patel652203f2008-09-29 20:49:50 +00001969 "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types",
1970 "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", "TypeListI",
1971 "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "ThreadLocal",
1972 "AliaseeRef", "Module", "DefinitionList", "Definition", "@1", "@2", "@3",
1973 "@4", "@5", "AsmBlock", "TargetDefinition", "LibrariesDefinition",
1974 "LibList", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN",
1975 "FunctionHeader", "END", "Function", "FunctionProto", "OptSideEffect",
1976 "ConstValueRef", "SymbolicValueRef", "ValueRef", "ResolvedVal",
1977 "ReturnedVal", "BasicBlockList", "BasicBlock", "InstructionList",
1978 "BBTerminatorInst", "JumpTable", "Inst", "PHIList", "ParamList",
1979 "IndexList", "ConstantIndexList", "OptTailCall", "InstVal",
Chris Lattner15bd0952008-08-29 17:20:18 +00001980 "OptVolatile", "MemoryInst", 0
Dan Gohmanf4423b12008-04-19 00:24:39 +00001981};
1982#endif
1983
1984# ifdef YYPRINT
1985/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1986 token YYLEX-NUM. */
1987static const yytype_uint16 yytoknum[] =
1988{
1989 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1990 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1991 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1992 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1993 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1994 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1995 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1996 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1997 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1998 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1999 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
2000 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
2001 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
2002 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
2003 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
Devang Patel652203f2008-09-29 20:49:50 +00002004 405, 406, 407, 408, 409, 410, 411, 412, 413, 40,
2005 41, 61, 44, 42, 92, 91, 120, 93, 60, 62,
2006 123, 125, 99
Dan Gohmanf4423b12008-04-19 00:24:39 +00002007};
2008# endif
2009
2010/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002011static const yytype_uint16 yyr1[] =
Dan Gohmanf4423b12008-04-19 00:24:39 +00002012{
Devang Patel652203f2008-09-29 20:49:50 +00002013 0, 173, 174, 174, 174, 174, 174, 174, 174, 174,
2014 174, 175, 175, 175, 175, 175, 175, 176, 176, 176,
2015 176, 176, 176, 176, 176, 176, 176, 176, 176, 177,
2016 177, 177, 177, 177, 177, 177, 177, 177, 177, 178,
2017 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
Chris Lattner740e7092008-10-15 06:16:57 +00002018 178, 178, 178, 178, 178, 179, 179, 179, 180, 180,
2019 181, 181, 182, 182, 183, 184, 184, 185, 185, 186,
2020 187, 187, 187, 187, 187, 187, 188, 188, 188, 189,
2021 189, 189, 189, 190, 190, 190, 191, 191, 191, 191,
2022 191, 192, 192, 192, 193, 193, 193, 193, 193, 193,
2023 193, 194, 194, 194, 194, 194, 194, 194, 194, 194,
2024 194, 195, 195, 196, 196, 196, 197, 197, 198, 198,
2025 198, 198, 198, 198, 198, 198, 198, 198, 199, 199,
2026 200, 200, 201, 201, 202, 202, 203, 204, 204, 205,
2027 205, 206, 206, 207, 207, 207, 207, 207, 207, 207,
2028 208, 208, 208, 208, 208, 208, 208, 208, 208, 208,
2029 208, 208, 208, 209, 210, 210, 211, 211, 212, 212,
2030 212, 212, 213, 213, 214, 214, 214, 214, 214, 214,
2031 214, 214, 214, 214, 214, 214, 214, 214, 214, 214,
2032 214, 214, 214, 214, 215, 215, 215, 215, 215, 215,
2033 215, 215, 215, 215, 215, 215, 215, 215, 216, 216,
2034 217, 217, 218, 218, 219, 219, 220, 220, 221, 221,
2035 223, 222, 224, 222, 222, 222, 222, 225, 222, 226,
2036 222, 227, 222, 222, 222, 222, 228, 229, 229, 230,
2037 231, 231, 231, 232, 232, 233, 233, 233, 233, 234,
2038 235, 235, 236, 237, 237, 238, 239, 240, 240, 241,
2039 241, 241, 241, 241, 241, 241, 241, 241, 241, 241,
2040 241, 241, 241, 241, 241, 241, 241, 241, 241, 242,
2041 242, 242, 242, 243, 243, 244, 245, 245, 246, 246,
2042 247, 247, 248, 248, 248, 249, 249, 249, 249, 249,
2043 249, 249, 249, 249, 250, 250, 251, 251, 252, 252,
2044 253, 253, 253, 253, 253, 254, 254, 255, 255, 256,
2045 256, 257, 257, 257, 257, 257, 257, 257, 257, 257,
2046 257, 257, 257, 257, 257, 257, 258, 258, 259, 259,
2047 259, 259, 259, 259, 259, 259, 259, 259, 259
Dan Gohmanf4423b12008-04-19 00:24:39 +00002048};
2049
2050/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
2051static const yytype_uint8 yyr2[] =
2052{
2053 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
2054 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2055 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2056 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2057 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Chris Lattner740e7092008-10-15 06:16:57 +00002058 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
2059 4, 0, 2, 0, 2, 1, 1, 1, 0, 2,
2060 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
2061 1, 1, 1, 0, 1, 1, 0, 1, 1, 1,
2062 1, 0, 1, 1, 0, 1, 1, 1, 1, 1,
2063 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2064 2, 0, 2, 1, 1, 1, 0, 2, 1, 1,
2065 1, 1, 1, 1, 1, 1, 1, 1, 0, 2,
2066 0, 2, 0, 2, 0, 3, 2, 0, 1, 0,
2067 3, 1, 2, 1, 1, 1, 1, 1, 1, 1,
2068 1, 1, 3, 1, 2, 5, 5, 5, 5, 3,
2069 2, 5, 4, 2, 1, 1, 1, 3, 1, 3,
2070 1, 0, 1, 3, 4, 3, 3, 4, 4, 3,
2071 6, 5, 2, 2, 2, 2, 2, 2, 2, 2,
2072 2, 2, 2, 2, 6, 5, 8, 6, 6, 7,
2073 7, 7, 7, 6, 8, 8, 5, 7, 3, 1,
2074 1, 1, 1, 0, 2, 6, 1, 0, 1, 2,
2075 0, 3, 0, 3, 3, 3, 3, 0, 8, 0,
2076 9, 0, 9, 5, 2, 3, 1, 3, 3, 3,
2077 3, 1, 0, 5, 3, 1, 3, 1, 0, 11,
2078 1, 1, 4, 1, 1, 2, 3, 0, 1, 1,
2079 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
2080 3, 2, 2, 3, 2, 5, 4, 1, 5, 1,
2081 1, 1, 1, 1, 1, 2, 1, 3, 2, 2,
2082 3, 3, 2, 0, 1, 2, 2, 3, 9, 9,
2083 8, 15, 1, 1, 6, 5, 2, 2, 6, 7,
2084 4, 4, 6, 6, 0, 0, 3, 2, 3, 2,
2085 1, 5, 5, 6, 6, 6, 6, 4, 6, 4,
2086 4, 6, 6, 2, 9, 1, 1, 0, 3, 6,
2087 3, 6, 2, 5, 7, 5, 4, 4, 7
Dan Gohmanf4423b12008-04-19 00:24:39 +00002088};
2089
2090/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2091 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2092 means the default is an error. */
2093static const yytype_uint16 yydefact[] =
2094{
Chris Lattner740e7092008-10-15 06:16:57 +00002095 68, 55, 65, 56, 66, 57, 222, 220, 0, 0,
2096 0, 0, 0, 0, 79, 67, 0, 68, 218, 83,
2097 86, 0, 0, 234, 0, 0, 62, 0, 69, 70,
2098 72, 71, 73, 76, 74, 77, 75, 78, 80, 81,
2099 82, 79, 79, 213, 1, 219, 84, 85, 79, 223,
2100 87, 88, 89, 90, 79, 293, 221, 293, 0, 0,
2101 242, 235, 236, 224, 279, 280, 226, 143, 144, 145,
2102 148, 147, 146, 149, 150, 0, 0, 0, 0, 281,
2103 282, 151, 225, 153, 213, 213, 91, 212, 0, 94,
2104 94, 294, 289, 63, 253, 254, 255, 288, 237, 238,
2105 241, 0, 171, 154, 0, 0, 0, 0, 160, 172,
2106 0, 0, 171, 0, 0, 0, 93, 92, 0, 210,
2107 211, 0, 0, 95, 96, 97, 98, 99, 116, 256,
2108 0, 0, 337, 337, 292, 0, 239, 170, 111, 166,
2109 168, 0, 0, 0, 0, 0, 0, 159, 0, 0,
2110 152, 0, 0, 165, 0, 164, 0, 233, 61, 61,
2111 100, 0, 250, 251, 252, 64, 336, 320, 0, 0,
2112 0, 0, 94, 302, 303, 2, 3, 4, 5, 6,
2113 7, 8, 9, 10, 14, 15, 16, 11, 12, 13,
2114 0, 0, 0, 0, 0, 0, 0, 0, 17, 18,
2115 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
Nate Begemanac80ade2008-05-12 19:01:56 +00002116 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner740e7092008-10-15 06:16:57 +00002117 0, 0, 290, 94, 306, 0, 335, 291, 307, 240,
2118 163, 0, 128, 61, 61, 162, 0, 173, 0, 128,
2119 61, 61, 0, 214, 187, 189, 188, 190, 193, 186,
2120 191, 192, 182, 183, 0, 0, 0, 0, 0, 0,
2121 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2122 0, 0, 185, 184, 227, 115, 114, 113, 117, 0,
2123 319, 296, 61, 286, 295, 0, 0, 0, 116, 29,
2124 30, 31, 32, 33, 34, 35, 36, 37, 38, 0,
2125 53, 54, 49, 50, 51, 52, 39, 40, 41, 42,
2126 43, 44, 45, 46, 47, 48, 0, 0, 0, 134,
2127 134, 342, 61, 61, 333, 0, 0, 0, 0, 0,
2128 61, 61, 61, 61, 61, 0, 116, 0, 0, 0,
2129 102, 104, 103, 101, 105, 106, 107, 108, 109, 112,
2130 169, 167, 156, 157, 158, 161, 60, 155, 229, 231,
2131 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2132 0, 0, 175, 209, 0, 0, 0, 179, 0, 176,
2133 0, 0, 0, 139, 0, 259, 260, 261, 262, 263,
2134 268, 264, 265, 266, 267, 257, 0, 0, 0, 0,
2135 277, 284, 283, 285, 0, 0, 297, 0, 0, 61,
2136 61, 61, 61, 0, 338, 0, 340, 315, 0, 0,
2137 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2138 0, 0, 61, 0, 110, 122, 121, 118, 120, 119,
2139 123, 124, 127, 125, 126, 129, 139, 139, 0, 0,
2140 0, 0, 0, 315, 0, 0, 0, 0, 0, 0,
2141 0, 174, 160, 172, 0, 177, 178, 0, 0, 0,
2142 0, 228, 248, 258, 0, 271, 0, 0, 0, 274,
2143 0, 272, 287, 0, 0, 0, 0, 0, 0, 0,
2144 0, 0, 0, 346, 0, 0, 0, 329, 330, 0,
2145 0, 0, 0, 347, 0, 0, 0, 327, 0, 134,
2146 0, 230, 232, 61, 0, 0, 0, 0, 0, 0,
2147 0, 0, 0, 0, 0, 208, 181, 0, 0, 0,
2148 0, 0, 0, 141, 139, 247, 111, 245, 0, 0,
2149 270, 160, 0, 269, 273, 0, 0, 0, 0, 0,
2150 0, 0, 134, 135, 134, 0, 0, 0, 0, 0,
2151 0, 345, 317, 0, 61, 321, 322, 0, 0, 343,
2152 61, 215, 0, 0, 0, 0, 195, 0, 0, 0,
2153 0, 206, 0, 180, 0, 0, 61, 136, 142, 140,
2154 59, 0, 128, 0, 276, 0, 0, 0, 314, 323,
2155 324, 325, 326, 339, 341, 316, 0, 0, 328, 331,
2156 332, 318, 0, 314, 134, 0, 0, 0, 0, 0,
2157 203, 0, 0, 0, 197, 198, 194, 58, 244, 246,
2158 111, 137, 278, 275, 0, 0, 111, 111, 0, 308,
2159 0, 348, 0, 344, 199, 200, 201, 202, 0, 0,
2160 0, 207, 59, 138, 132, 0, 0, 300, 0, 0,
2161 0, 128, 0, 309, 128, 196, 204, 205, 243, 0,
2162 130, 298, 0, 0, 299, 102, 104, 111, 111, 0,
2163 111, 111, 334, 133, 0, 249, 0, 0, 311, 310,
2164 0, 0, 0, 131, 0, 0, 0, 111, 111, 305,
2165 0, 0, 313, 312, 304, 0, 0, 301
Dan Gohmanf4423b12008-04-19 00:24:39 +00002166};
2167
2168/* YYDEFGOTO[NTERM-NUM]. */
2169static const yytype_int16 yydefgoto[] =
2170{
Chris Lattner740e7092008-10-15 06:16:57 +00002171 -1, 269, 270, 271, 299, 316, 79, 628, 113, 12,
2172 133, 80, 14, 15, 41, 42, 43, 48, 54, 118,
2173 128, 349, 230, 278, 161, 445, 352, 685, 670, 414,
2174 533, 654, 471, 534, 81, 158, 139, 156, 140, 141,
2175 110, 373, 400, 374, 121, 88, 157, 16, 17, 18,
2176 20, 19, 383, 446, 447, 63, 23, 61, 101, 537,
2177 538, 129, 164, 55, 96, 56, 49, 474, 401, 83,
2178 403, 283, 284, 57, 92, 93, 222, 658, 134, 324,
2179 638, 493, 503, 223, 224, 225, 226
Dan Gohmanf4423b12008-04-19 00:24:39 +00002180};
2181
2182/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2183 STATE-NUM. */
Chris Lattner740e7092008-10-15 06:16:57 +00002184#define YYPACT_NINF -624
Dan Gohmanf4423b12008-04-19 00:24:39 +00002185static const yytype_int16 yypact[] =
2186{
Chris Lattner740e7092008-10-15 06:16:57 +00002187 815, -624, -624, -624, -624, -624, -624, -624, 14, -114,
2188 16, -73, 78, -31, 299, -624, 163, 2187, -624, 164,
2189 80, 19, 22, -624, 2, 179, -624, 1912, -624, -624,
2190 -624, -624, -624, -624, -624, -624, -624, -624, -624, -624,
2191 -624, 68, 68, 201, -624, -624, -624, -624, 68, -624,
2192 -624, -624, -624, -624, 68, 200, -624, 5, 215, 222,
2193 225, -624, -624, -624, -624, -624, 117, -624, -624, -624,
2194 -624, -624, -624, -624, -624, 264, 277, 7, 49, -624,
2195 -624, -624, -12, -624, 252, 252, 198, -624, 79, 231,
2196 231, -624, -624, 83, -624, -624, -624, -624, -624, -624,
2197 -624, -21, 649, -624, 138, 149, 627, 117, -624, -12,
2198 -120, 159, 649, 158, 79, 79, -624, -624, 1557, -624,
2199 -624, 2012, 320, -624, -624, -624, -624, -624, -624, -624,
2200 -13, 173, 2237, 2237, -624, 313, -624, -624, -12, -624,
2201 174, 177, 2012, 2012, 169, -118, 2012, -624, 336, 191,
2202 -624, 2012, 2012, 117, 193, -12, 226, -624, 1296, 308,
2203 -624, 1516, -624, -624, -624, -624, -624, -624, 307, 2031,
2204 108, 357, 231, -624, -624, -624, -624, -624, -624, -624,
2205 -624, -624, -624, -624, -624, -624, -624, -624, -624, -624,
2206 454, 958, 454, 958, 2012, 2012, 2012, 2012, -624, -624,
2207 -624, -624, -624, -624, -624, -624, -624, -624, -624, -624,
2208 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012,
2209 2012, 2012, -624, 231, -624, 55, -624, -624, -624, -624,
2210 161, 1748, -624, -23, -41, -624, 203, -12, 214, -624,
2211 308, -20, 1557, -624, -624, -624, -624, -624, -624, -624,
2212 -624, -624, -624, -624, 454, 958, 454, 958, 216, 217,
2213 218, 220, 221, 224, 227, 1789, 2076, 732, 351, 228,
2214 229, 230, -624, -624, -624, -624, -624, -624, -624, 109,
2215 -624, 117, 956, -624, 219, 1466, 1466, 1466, -624, -624,
2216 -624, -624, -624, -624, -624, -624, -624, -624, -624, 2012,
2217 -624, -624, -624, -624, -624, -624, -624, -624, -624, -624,
2218 -624, -624, -624, -624, -624, -624, 2012, 2012, 2012, -10,
2219 3, -624, 956, -17, 223, 237, 238, 239, 240, 241,
2220 956, 956, 956, 956, 956, 352, -624, 2012, 2012, 387,
2221 -624, -624, -624, -624, -624, -624, -624, -624, -624, -624,
2222 -624, -624, 539, -624, -624, -624, -624, 539, -624, 158,
2223 354, 234, 248, 249, 250, 2012, 2012, 2012, 2012, 2012,
2224 2012, 2012, -624, -624, 42, 1006, -121, -624, -116, -624,
2225 2012, 2012, 2012, 253, 251, -624, -624, -624, -624, -624,
2226 -624, -624, -624, -624, -624, 353, 1807, 2094, 1175, 390,
2227 -624, -624, -624, -624, 2012, 255, -624, 256, 1516, 956,
2228 956, 956, 956, 20, -624, 29, -624, -624, 1466, 254,
2229 2012, 2012, 2012, 2012, 2012, 258, 259, 261, 262, 263,
2230 2012, 1516, 956, 266, -624, -624, -624, -624, -624, -624,
2231 -624, -624, -624, -624, -624, -624, 253, 253, 2012, 2012,
2232 2012, 2012, 2012, -624, 269, 270, 272, 273, 259, 274,
2233 2012, -624, 268, 1126, -84, -624, -624, 280, 281, 406,
2234 -5, -624, 1830, -624, 423, -624, 61, 1345, -56, -624,
2235 -77, -624, -624, 430, 431, 1466, 288, 290, 291, 292,
2236 1466, 455, 1466, 296, 298, 1466, 300, -12, -624, 301,
2237 302, 457, 461, 306, 2012, 1466, 1466, -12, 1466, 311,
2238 2012, -624, -624, -1, 312, 314, 317, 319, 101, 2012,
2239 2012, 2012, 2012, 112, 2012, -624, -624, 318, 2012, 2012,
2240 2012, 453, 478, -624, 253, -624, -12, 321, 326, 327,
2241 -624, 323, -67, -624, -624, 1466, 1466, 329, 1466, 1466,
2242 1466, 1466, 311, -624, 311, 2012, 1466, 328, 2012, 2012,
2243 2012, -624, -624, 489, 956, -624, -624, 335, 441, -624,
2244 956, -624, 2012, 2012, 2012, 2012, -624, 334, 337, 339,
2245 340, -624, 259, -624, 343, 345, 15, -624, -624, -624,
2246 178, 1848, -624, 484, -624, 338, 350, 349, 2117, -624,
2247 -624, -624, -624, -624, -624, -624, 348, 1466, -624, -624,
2248 -624, -624, 259, 2117, 311, 356, 359, 360, 361, 2012,
2249 -624, 2012, 2012, 115, -624, -624, -624, -624, -624, -624,
2250 -12, 116, -624, -624, 505, -7, 59, -12, 118, -624,
2251 358, 306, 124, -624, -624, -624, -624, -624, 363, 364,
2252 366, -624, 178, -624, 473, 1466, 1614, -624, -6, 802,
2253 802, -624, 2135, -624, -624, -624, -624, -624, -624, 526,
2254 379, -624, 374, 1614, -624, 378, 380, -624, -624, 442,
2255 59, -12, 539, -624, 516, -624, 523, 396, 161, 161,
2256 524, 802, 802, -624, 1466, 525, 1466, -624, -624, -624,
2257 1466, 486, 161, 161, -624, 543, 1466, -624
Dan Gohmanf4423b12008-04-19 00:24:39 +00002258};
2259
2260/* YYPGOTO[NTERM-NUM]. */
2261static const yytype_int16 yypgoto[] =
2262{
Chris Lattner740e7092008-10-15 06:16:57 +00002263 -624, 132, 155, 181, -165, -154, 0, -86, -143, 474,
2264 -624, 6, -624, -624, -624, -624, 67, -624, -624, -624,
2265 -142, -624, -499, -624, -252, -624, -231, -624, -624, -313,
2266 -63, -624, -434, -624, -624, -26, 342, -152, -624, 458,
2267 463, -11, -156, -242, 202, 244, 332, -624, -624, 554,
2268 -624, -624, -624, -624, -624, -624, -624, -624, -624, -624,
2269 -624, 485, -624, -624, -624, -624, -624, -624, -623, -79,
2270 213, -193, -624, -624, 520, -624, 445, -624, -624, -624,
2271 -34, 129, -448, -624, 456, -624, -624
Dan Gohmanf4423b12008-04-19 00:24:39 +00002272};
2273
2274/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2275 positive, shift that token. If negative, reduce the rule which
2276 number is the opposite. If zero, do what YYDEFACT says.
2277 If YYTABLE_NINF, syntax error. */
Chris Lattner740e7092008-10-15 06:16:57 +00002278#define YYTABLE_NINF -218
Dan Gohmanf4423b12008-04-19 00:24:39 +00002279static const yytype_int16 yytable[] =
2280{
Chris Lattner740e7092008-10-15 06:16:57 +00002281 11, 82, 272, 321, 656, 673, 13, 416, 357, 279,
2282 523, 105, 511, 512, 111, 162, 274, 11, 325, 326,
2283 327, 328, 329, 13, 376, 378, 91, 317, 335, 531,
2284 288, 490, 111, 672, 94, 111, 408, 590, 111, 318,
2285 492, 460, 146, 111, 146, 111, 460, 24, 465, 532,
2286 687, 147, 109, 236, 111, 466, 64, 65, 111, 107,
2287 67, 68, 69, 70, 71, 72, 73, 21, 1, 2,
2288 111, 3, 4, 5, 491, 25, 138, 243, 460, 273,
2289 109, 336, 22, 491, 431, 460, 138, 527, 26, 361,
2290 131, 363, 155, 11, 544, 460, 27, 358, 359, 74,
2291 589, 362, 1, 364, 595, 3, 460, 5, 84, 85,
2292 159, 119, 120, 543, -149, 89, 233, 234, 112, 285,
2293 237, 90, 50, 51, 52, 286, 241, 53, 354, 2,
2294 28, 652, 4, 464, 623, 155, 112, 659, 660, 112,
2295 240, 135, 112, 282, 353, 433, 136, 112, 418, 112,
2296 531, -61, 413, -61, 476, 478, 480, 163, 112, 571,
2297 657, 674, 112, 44, 641, 415, -61, 60, 319, 320,
2298 282, 322, 337, 338, 112, 626, 95, 106, 688, 689,
2299 58, 691, 692, 59, 323, 282, 282, 282, 282, 282,
2300 330, 331, 332, 333, 334, 282, 569, 1, 702, 703,
2301 3, 62, 5, 402, 460, 138, 402, 402, 402, 461,
2302 46, 482, 47, 75, 76, 339, 155, 77, -149, 78,
2303 108, 91, -149, 460, 38, 39, 40, 496, 540, 498,
2304 499, 500, 339, 64, 65, 542, 86, 98, 87, 603,
2305 116, 604, 117, 402, 99, 1, 2, 100, 3, 4,
2306 5, 402, 402, 402, 402, 402, 485, 435, 436, 437,
2307 438, 576, 439, 555, 219, 219, 440, 441, 103, 442,
2308 443, 444, 581, 409, 563, 651, 102, 563, 661, 508,
2309 662, 104, 340, 341, 664, 384, 662, 220, 220, 87,
2310 410, 411, 412, 122, 123, 124, 125, 126, 127, 340,
2311 341, 643, 342, 343, 142, 344, 345, 272, 346, 347,
2312 348, 432, 282, 221, 221, 143, 151, 152, 148, 342,
2313 343, 150, 344, 345, 160, 346, 347, 348, 114, 115,
2314 402, 402, 402, 402, 165, 229, 231, 232, 235, 402,
2315 238, 29, 30, 31, 32, 33, 34, 35, 36, 463,
2316 37, 239, 242, 402, 453, 454, 455, 456, 457, 458,
2317 459, 631, 605, 111, 280, 608, 609, 610, 287, 467,
2318 468, 469, 355, 379, 356, 365, 366, 367, 282, 368,
2319 369, 404, 155, 370, 273, 419, 371, 380, 381, 382,
2320 430, 434, 448, 449, 282, 497, 282, 282, 282, 420,
2321 421, 422, 423, 424, 507, 155, 402, 450, 451, 452,
2322 472, 402, 481, 402, 473, 470, 402, 483, 484, 495,
2323 501, 502, 513, 504, 505, 506, 402, 402, 510, 402,
2324 679, 519, 520, 682, 521, 522, 524, 526, 514, 515,
2325 516, 517, 528, 529, 530, 539, 536, 545, 546, 525,
2326 548, 463, 549, 550, 551, 38, 39, 40, 555, 553,
2327 556, 561, 558, 559, 560, 562, 402, 402, 563, 402,
2328 402, 402, 402, 568, 572, 587, 573, 402, 564, 574,
2329 690, 575, 588, 591, 570, 402, 592, 583, 598, 593,
2330 607, 402, 594, 611, 613, 491, 619, 620, 405, 406,
2331 407, 621, 622, 624, 586, 625, 632, 633, 577, 578,
2332 579, 580, 634, 582, 635, 639, 644, 584, 585, 645,
2333 646, 647, 655, 665, 666, 663, 667, 669, 402, 282,
2334 683, 684, 282, 282, 282, 417, 686, -18, 693, -19,
2335 694, 696, 700, 425, 426, 427, 428, 429, 289, 290,
2336 291, 292, 293, 294, 295, 296, 297, 298, 695, 705,
2337 706, 615, 616, 617, 618, 630, 668, 132, 653, 145,
2338 149, 45, 637, 351, 360, 130, 402, 97, 227, 642,
2339 402, 402, 518, 435, 436, 437, 438, 637, 439, 228,
2340 627, 0, 440, 441, 0, 442, 443, 444, 0, 0,
2341 0, 0, 0, 0, 0, 0, 0, 0, 648, 0,
2342 649, 650, 402, 402, 0, 402, 0, 402, 0, 0,
2343 0, 402, 486, 487, 488, 489, 0, 402, 0, 0,
2344 0, 494, 0, 0, 64, 65, 681, 107, 67, 68,
2345 69, 70, 71, 72, 73, 509, 1, 2, 0, 3,
2346 4, 5, 627, 0, 0, 0, 64, 65, 0, 107,
2347 67, 68, 69, 70, 71, 72, 73, 0, 1, 2,
2348 0, 3, 4, 5, 0, 0, 0, 74, 0, 0,
2349 435, 436, 437, 438, 0, 439, 0, 0, 137, 440,
2350 441, 0, 442, 443, 444, 0, 0, 0, 547, 74,
2351 0, 0, 0, 552, 0, 554, 0, 0, 557, 0,
2352 0, 0, 0, 0, 0, 0, 0, 0, 565, 566,
2353 0, 567, 0, 0, 0, 0, 0, 0, 0, 0,
2354 0, 0, 0, 0, 0, 0, 0, 0, 0, 64,
2355 65, 0, 107, 67, 68, 69, 70, 71, 72, 73,
2356 0, 1, 2, 0, 3, 4, 5, 0, 596, 597,
2357 0, 599, 600, 601, 602, 0, 0, 0, 0, 606,
2358 0, 0, 0, 0, 0, 0, 0, 612, 0, 0,
2359 0, 0, 74, 614, 0, 0, 0, 0, 0, 0,
2360 0, 75, 76, 0, 0, 77, 0, 78, 144, 0,
2361 0, 0, 0, 0, 0, 385, 386, 387, 388, 64,
2362 65, 389, 0, 75, 76, -217, 0, 77, 0, 78,
2363 640, 1, 2, 0, 3, 4, 5, 390, 391, 392,
2364 0, 0, 0, -63, 1, 2, 0, 3, 4, 5,
2365 0, 0, 393, 394, 0, 6, 7, 0, 0, 0,
2366 0, 0, 0, 0, 0, 0, 339, 0, 0, 0,
2367 0, 395, 0, 0, 0, 0, 0, 8, 671, 0,
2368 0, 9, 677, 678, 0, 10, 0, 175, 176, 177,
2369 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
2370 188, 189, 254, 255, 256, 257, 75, 76, 0, 0,
2371 77, 0, 78, 377, 697, 698, 0, 699, 0, 701,
2372 0, 0, 0, 704, 0, 0, 0, 0, 0, 707,
2373 0, 258, 198, 675, 676, 201, 202, 203, 204, 205,
2374 206, 207, 208, 209, 0, 259, 0, 260, 261, 262,
2375 0, 263, 264, 342, 343, 0, 344, 345, 0, 346,
2376 347, 348, 0, 0, 0, 0, 0, 0, 0, 385,
2377 386, 387, 388, 64, 65, 389, 0, 396, 0, 0,
2378 397, 0, 398, 0, 399, 1, 2, 0, 3, 4,
2379 5, 390, 391, 392, 300, 301, 0, 0, 0, 0,
2380 0, 0, 0, 0, 0, 0, 393, 394, 0, 0,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002381 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner740e7092008-10-15 06:16:57 +00002382 0, 111, 0, 64, 65, 395, 107, 67, 68, 69,
Chris Lattnerf9078f92008-10-15 06:03:48 +00002383 70, 71, 72, 73, 0, 1, 2, 0, 3, 4,
Chris Lattner740e7092008-10-15 06:16:57 +00002384 5, 175, 176, 177, 178, 179, 180, 181, 182, 183,
2385 184, 185, 186, 187, 188, 189, 254, 255, 256, 257,
2386 0, 0, 0, 0, 0, 0, 74, 0, 302, 303,
2387 304, 305, 306, 307, 308, 309, 310, 311, 312, 313,
2388 314, 315, 0, 0, 0, 258, 198, 199, 200, 201,
2389 202, 203, 204, 205, 206, 207, 208, 209, 0, 259,
2390 0, 260, 261, 262, 0, 263, 264, 0, 0, 0,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002391 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner740e7092008-10-15 06:16:57 +00002392 0, 0, 0, 0, 0, 112, 0, 0, 0, 0,
2393 0, 396, 0, 0, 397, 0, 398, 0, 399, 244,
2394 245, 246, 247, 64, 65, 248, 0, 0, 0, 0,
2395 0, 0, 0, 0, 0, 1, 2, 0, 3, 4,
2396 5, 249, 250, 251, 0, 0, 0, 0, 0, 0,
2397 0, 0, 0, 0, 0, 0, 252, 253, 0, 0,
2398 75, 76, 0, 0, 77, 0, 78, 462, 0, 0,
2399 0, 111, 64, 65, 0, 107, 67, 68, 69, 70,
2400 71, 72, 73, 0, 1, 2, 0, 3, 4, 5,
2401 0, 175, 176, 177, 178, 179, 180, 181, 182, 183,
2402 184, 185, 186, 187, 188, 189, 254, 255, 256, 257,
2403 0, 0, 0, 0, 0, 74, 0, 0, 0, 0,
Dale Johannesendfe8c842008-09-26 19:32:34 +00002404 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner740e7092008-10-15 06:16:57 +00002405 0, 0, 0, 0, 0, 258, 198, 199, 200, 201,
2406 202, 203, 204, 205, 206, 207, 208, 209, 0, 259,
2407 0, 260, 261, 262, 0, 263, 264, 0, 0, 0,
Devang Patel652203f2008-09-29 20:49:50 +00002408 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner740e7092008-10-15 06:16:57 +00002409 0, 0, 0, 0, 0, 112, 0, 0, 0, -61,
2410 0, 265, 0, 0, 266, 0, 267, 0, 268, 244,
2411 245, 246, 247, 64, 65, 248, 0, 0, 0, 0,
2412 0, 0, 0, 0, 0, 1, 2, 0, 3, 4,
2413 5, 249, 250, 251, 0, 0, 0, 0, 0, 0,
2414 0, 0, 0, 0, 0, 0, 252, 253, 0, 75,
2415 76, 0, 0, 77, 0, 78, 479, 0, 0, 0,
2416 0, 111, 64, 65, 0, 107, 67, 68, 69, 70,
2417 71, 72, 73, 0, 1, 2, 0, 3, 4, 5,
2418 0, 175, 176, 177, 178, 179, 180, 181, 182, 183,
2419 184, 185, 186, 187, 188, 189, 254, 255, 256, 257,
2420 0, 0, 0, 0, 0, 74, 0, 0, 0, 0,
Devang Patel652203f2008-09-29 20:49:50 +00002421 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner740e7092008-10-15 06:16:57 +00002422 0, 0, 0, 0, 0, 258, 198, 199, 200, 201,
2423 202, 203, 204, 205, 206, 207, 208, 209, 0, 259,
2424 0, 260, 261, 262, 0, 263, 264, 0, 0, 0,
2425 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2426 0, 0, 0, 0, 0, 112, 0, 0, 0, 0,
2427 0, 265, 0, 0, 266, 0, 267, 0, 268, 385,
2428 386, 387, 388, 64, 65, 389, 0, 0, 0, 0,
2429 0, 0, 0, 0, 0, 1, 2, 0, 3, 4,
2430 5, 390, 391, 392, 0, 0, 0, 0, 0, 0,
2431 0, 0, 0, 0, 0, 0, 393, 394, 0, 75,
2432 76, 0, 0, 77, 0, 78, 541, 0, 0, 0,
2433 0, 0, 0, 64, 65, 395, 153, 67, 68, 69,
2434 70, 71, 72, 73, 0, 1, 2, 0, 3, 4,
2435 5, 175, 176, 177, 178, 179, 180, 181, 182, 183,
2436 184, 185, 186, 187, 188, 189, 254, 255, 256, 257,
2437 0, 0, 0, 0, 64, 65, 74, 153, 67, 68,
Chris Lattnerf9078f92008-10-15 06:03:48 +00002438 69, 70, 71, 72, 73, 0, 1, 2, 0, 3,
Chris Lattner740e7092008-10-15 06:16:57 +00002439 4, 5, 0, 0, 0, 258, 198, 199, 200, 201,
2440 202, 203, 204, 205, 206, 207, 208, 209, 0, 259,
2441 0, 260, 261, 262, 0, 263, 264, 74, 0, 0,
2442 0, 0, 0, 0, 0, 0, 0, 385, 386, 387,
2443 388, 0, 0, 389, 0, 0, 0, 0, 0, 0,
2444 0, 396, 0, 0, 397, 0, 398, 0, 399, 390,
2445 391, 392, 0, 0, 0, 0, 0, 0, 0, 0,
2446 0, 0, 0, 0, 393, 394, 0, 275, 276, 0,
2447 277, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2448 0, 0, 0, 395, 0, 0, 0, 0, 0, 0,
2449 75, 76, 154, 0, 77, 0, 78, 0, 0, 175,
2450 176, 177, 178, 179, 180, 181, 182, 183, 184, 185,
2451 186, 187, 188, 189, 254, 255, 256, 257, 0, 0,
Devang Patel652203f2008-09-29 20:49:50 +00002452 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerf9078f92008-10-15 06:03:48 +00002453 0, 75, 76, 0, 0, 77, 0, 78, 0, 0,
Chris Lattner740e7092008-10-15 06:16:57 +00002454 0, 0, 0, 258, 198, 199, 200, 201, 202, 203,
2455 204, 205, 206, 207, 208, 209, 0, 259, 0, 260,
2456 261, 262, 0, 263, 264, 64, 65, 0, 107, 67,
2457 68, 69, 70, 71, 72, 73, 0, 1, 2, 0,
2458 3, 4, 5, 0, 0, 0, 0, 0, 0, 396,
2459 0, 0, 397, 0, 398, 0, 399, 350, 0, 0,
2460 0, 0, 0, 0, 0, 0, 64, 65, 74, 107,
2461 67, 68, 69, 70, 71, 72, 73, 0, 1, 2,
2462 0, 3, 4, 5, 64, 65, 0, 107, 67, 68,
2463 69, 70, 71, 72, 73, 0, 1, 2, 0, 3,
2464 4, 5, 0, 0, 0, 0, 0, 64, 65, 74,
2465 107, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2466 2, 0, 3, 4, 5, 64, 65, 74, 107, 67,
2467 68, 69, 70, 71, 72, 73, 0, 1, 2, 535,
2468 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
2469 74, 0, 0, 0, 0, 0, 0, 629, 0, 0,
2470 0, 0, 0, 0, 0, 0, 0, 0, 74, 0,
Dale Johannesendfe8c842008-09-26 19:32:34 +00002471 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner740e7092008-10-15 06:16:57 +00002472 0, 0, 75, 76, 0, 0, 77, 0, 78, 64,
2473 65, 0, 66, 67, 68, 69, 70, 71, 72, 73,
2474 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2475 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2476 0, 0, 0, 75, 76, 0, 372, 77, 0, 78,
2477 0, 0, 74, 0, 0, 0, 0, 0, 0, 0,
2478 0, 75, 76, 0, 475, 77, 0, 78, 0, 0,
2479 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2480 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2481 78, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2482 0, 0, 75, 76, 0, 0, 77, 0, 78, 64,
2483 65, 0, 107, 67, 68, 69, 70, 71, 72, 73,
2484 0, 1, 2, 0, 3, 4, 5, 0, 64, 65,
2485 0, 281, 67, 68, 69, 70, 71, 72, 73, 0,
2486 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2487 0, 0, 74, 0, 0, 0, 0, 0, 0, 0,
2488 0, 0, 0, 0, 0, 0, 75, 76, 0, 0,
2489 77, 74, 78, 64, 65, 0, 107, 67, 68, 69,
2490 70, 71, 72, 73, 0, 1, 2, 0, 3, 4,
2491 5, 64, 65, 0, 107, 67, 68, 69, 70, 71,
2492 72, 73, 0, 1, 2, 0, 3, 4, 5, 0,
2493 0, 0, 0, 0, 64, 65, 74, 107, 67, 68,
2494 69, 70, 71, 72, 636, 0, 1, 2, 0, 3,
2495 4, 5, 64, 65, 74, 107, 67, 68, 69, 70,
2496 71, 72, 680, 0, 1, 2, 0, 3, 4, 5,
2497 0, 0, 0, 0, 0, 0, 0, 74, 0, 0,
2498 0, 0, 0, 0, 0, 0, 75, 76, 0, 0,
2499 77, 0, 78, 0, 0, 74, 0, -216, 0, 0,
2500 0, 0, 0, 0, 0, 75, 76, 0, 0, 77,
2501 0, 78, 0, 0, 0, -63, 1, 2, 0, 3,
2502 4, 5, 0, 0, 0, 0, 0, 6, 7, 0,
2503 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2504 0, 0, 0, 0, 0, 0, 0, 0, 0, 8,
2505 75, 76, 0, 9, 77, 0, 375, 10, 0, 0,
2506 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2507 0, 0, 77, 0, 477, 0, 0, 0, 0, 0,
2508 0, 0, 0, 166, 0, 0, 0, 0, 0, 0,
2509 0, 75, 76, 0, 0, 77, 0, 78, 0, 0,
2510 0, 0, 0, 0, 167, 168, 0, 0, 0, 75,
2511 76, 0, 0, 77, 0, 78, 169, 170, 171, 172,
2512 173, 174, 175, 176, 177, 178, 179, 180, 181, 182,
Chris Lattnerf9078f92008-10-15 06:03:48 +00002513 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
Chris Lattner740e7092008-10-15 06:16:57 +00002514 193, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2515 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2516 0, 194, 195, 196, 0, 0, 197, 198, 199, 200,
2517 201, 202, 203, 204, 205, 206, 207, 208, 209, 210,
2518 211, 212, 213, 214, 215, 216, 217, 218
Dan Gohmanf4423b12008-04-19 00:24:39 +00002519};
2520
2521static const yytype_int16 yycheck[] =
2522{
Chris Lattner740e7092008-10-15 06:16:57 +00002523 0, 27, 158, 196, 11, 11, 0, 320, 239, 161,
2524 458, 4, 446, 447, 55, 28, 159, 17, 211, 212,
2525 213, 214, 215, 17, 266, 267, 21, 192, 221, 34,
2526 172, 11, 55, 656, 29, 55, 288, 536, 55, 193,
2527 11, 162, 162, 55, 162, 55, 162, 161, 169, 54,
2528 673, 171, 78, 171, 55, 171, 7, 8, 55, 10,
2529 11, 12, 13, 14, 15, 16, 17, 53, 19, 20,
2530 55, 22, 23, 24, 54, 59, 102, 156, 162, 158,
2531 106, 223, 68, 54, 336, 162, 112, 171, 161, 254,
2532 7, 256, 118, 93, 171, 162, 18, 240, 241, 50,
2533 534, 255, 19, 257, 171, 22, 162, 24, 41, 42,
2534 121, 32, 33, 169, 55, 48, 142, 143, 159, 11,
2535 146, 54, 42, 43, 44, 17, 152, 47, 169, 20,
2536 161, 630, 23, 375, 582, 161, 159, 636, 637, 159,
2537 151, 162, 159, 169, 167, 338, 167, 159, 165, 159,
2538 34, 163, 162, 163, 396, 397, 398, 170, 159, 160,
2539 167, 167, 159, 0, 612, 162, 163, 165, 194, 195,
2540 196, 197, 117, 118, 159, 160, 171, 170, 677, 678,
2541 161, 680, 681, 161, 210, 211, 212, 213, 214, 215,
2542 216, 217, 218, 219, 220, 221, 509, 19, 697, 698,
2543 22, 22, 24, 282, 162, 231, 285, 286, 287, 167,
2544 46, 404, 48, 164, 165, 54, 242, 168, 159, 170,
2545 171, 21, 163, 162, 156, 157, 158, 420, 167, 422,
2546 423, 424, 54, 7, 8, 477, 35, 22, 37, 552,
2547 42, 554, 44, 322, 22, 19, 20, 22, 22, 23,
2548 24, 330, 331, 332, 333, 334, 408, 141, 142, 143,
2549 144, 160, 146, 162, 132, 133, 150, 151, 4, 153,
2550 154, 155, 160, 299, 162, 160, 159, 162, 160, 431,
2551 162, 4, 121, 122, 160, 279, 162, 132, 133, 37,
2552 316, 317, 318, 62, 63, 64, 65, 66, 67, 121,
2553 122, 614, 141, 142, 166, 144, 145, 463, 147, 148,
2554 149, 337, 338, 132, 133, 166, 114, 115, 159, 141,
2555 142, 163, 144, 145, 4, 147, 148, 149, 84, 85,
2556 409, 410, 411, 412, 161, 22, 162, 160, 169, 418,
2557 4, 42, 43, 44, 45, 46, 47, 48, 49, 375,
2558 51, 160, 159, 432, 365, 366, 367, 368, 369, 370,
2559 371, 592, 555, 55, 57, 558, 559, 560, 11, 380,
2560 381, 382, 169, 22, 160, 159, 159, 159, 404, 159,
2561 159, 162, 408, 159, 463, 162, 159, 159, 159, 159,
2562 38, 4, 38, 159, 420, 421, 422, 423, 424, 162,
2563 162, 162, 162, 162, 430, 431, 485, 159, 159, 159,
2564 159, 490, 22, 492, 61, 162, 495, 162, 162, 165,
2565 162, 162, 448, 162, 162, 162, 505, 506, 162, 508,
2566 661, 162, 162, 664, 162, 162, 162, 169, 449, 450,
2567 451, 452, 162, 162, 38, 22, 472, 17, 17, 460,
2568 162, 477, 162, 162, 162, 156, 157, 158, 162, 4,
2569 162, 4, 162, 162, 162, 4, 545, 546, 162, 548,
2570 549, 550, 551, 162, 162, 22, 162, 556, 504, 162,
2571 38, 162, 4, 162, 510, 564, 160, 169, 159, 162,
2572 162, 570, 169, 4, 159, 54, 162, 160, 285, 286,
2573 287, 162, 162, 160, 530, 160, 22, 169, 519, 520,
2574 521, 522, 162, 524, 165, 167, 160, 528, 529, 160,
2575 160, 160, 17, 160, 160, 167, 160, 54, 607, 555,
2576 4, 152, 558, 559, 560, 322, 162, 159, 22, 159,
2577 17, 17, 17, 330, 331, 332, 333, 334, 94, 95,
2578 96, 97, 98, 99, 100, 101, 102, 103, 162, 73,
2579 17, 572, 573, 574, 575, 591, 652, 93, 631, 106,
2580 112, 17, 598, 231, 242, 90, 655, 57, 133, 613,
2581 659, 660, 453, 141, 142, 143, 144, 613, 146, 133,
2582 590, -1, 150, 151, -1, 153, 154, 155, -1, -1,
2583 -1, -1, -1, -1, -1, -1, -1, -1, 619, -1,
2584 621, 622, 691, 692, -1, 694, -1, 696, -1, -1,
2585 -1, 700, 409, 410, 411, 412, -1, 706, -1, -1,
2586 -1, 418, -1, -1, 7, 8, 662, 10, 11, 12,
2587 13, 14, 15, 16, 17, 432, 19, 20, -1, 22,
2588 23, 24, 652, -1, -1, -1, 7, 8, -1, 10,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002589 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
Chris Lattner740e7092008-10-15 06:16:57 +00002590 -1, 22, 23, 24, -1, -1, -1, 50, -1, -1,
2591 141, 142, 143, 144, -1, 146, -1, -1, 39, 150,
2592 151, -1, 153, 154, 155, -1, -1, -1, 485, 50,
2593 -1, -1, -1, 490, -1, 492, -1, -1, 495, -1,
2594 -1, -1, -1, -1, -1, -1, -1, -1, 505, 506,
2595 -1, 508, -1, -1, -1, -1, -1, -1, -1, -1,
2596 -1, -1, -1, -1, -1, -1, -1, -1, -1, 7,
Devang Patel652203f2008-09-29 20:49:50 +00002597 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
Chris Lattner740e7092008-10-15 06:16:57 +00002598 -1, 19, 20, -1, 22, 23, 24, -1, 545, 546,
2599 -1, 548, 549, 550, 551, -1, -1, -1, -1, 556,
2600 -1, -1, -1, -1, -1, -1, -1, 564, -1, -1,
2601 -1, -1, 50, 570, -1, -1, -1, -1, -1, -1,
2602 -1, 164, 165, -1, -1, 168, -1, 170, 171, -1,
2603 -1, -1, -1, -1, -1, 3, 4, 5, 6, 7,
2604 8, 9, -1, 164, 165, 0, -1, 168, -1, 170,
2605 607, 19, 20, -1, 22, 23, 24, 25, 26, 27,
2606 -1, -1, -1, 18, 19, 20, -1, 22, 23, 24,
2607 -1, -1, 40, 41, -1, 30, 31, -1, -1, -1,
2608 -1, -1, -1, -1, -1, -1, 54, -1, -1, -1,
2609 -1, 59, -1, -1, -1, -1, -1, 52, 655, -1,
2610 -1, 56, 659, 660, -1, 60, -1, 75, 76, 77,
2611 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2612 88, 89, 90, 91, 92, 93, 164, 165, -1, -1,
2613 168, -1, 170, 171, 691, 692, -1, 694, -1, 696,
2614 -1, -1, -1, 700, -1, -1, -1, -1, -1, 706,
2615 -1, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2616 128, 129, 130, 131, -1, 133, -1, 135, 136, 137,
2617 -1, 139, 140, 141, 142, -1, 144, 145, -1, 147,
2618 148, 149, -1, -1, -1, -1, -1, -1, -1, 3,
2619 4, 5, 6, 7, 8, 9, -1, 165, -1, -1,
2620 168, -1, 170, -1, 172, 19, 20, -1, 22, 23,
2621 24, 25, 26, 27, 26, 27, -1, -1, -1, -1,
2622 -1, -1, -1, -1, -1, -1, 40, 41, -1, -1,
Dale Johannesendfe8c842008-09-26 19:32:34 +00002623 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattner740e7092008-10-15 06:16:57 +00002624 -1, 55, -1, 7, 8, 59, 10, 11, 12, 13,
2625 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2626 24, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2627 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
2628 -1, -1, -1, -1, -1, -1, 50, -1, 100, 101,
2629 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
2630 112, 113, -1, -1, -1, 119, 120, 121, 122, 123,
2631 124, 125, 126, 127, 128, 129, 130, 131, -1, 133,
2632 -1, 135, 136, 137, -1, 139, 140, -1, -1, -1,
2633 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2634 -1, -1, -1, -1, -1, 159, -1, -1, -1, -1,
2635 -1, 165, -1, -1, 168, -1, 170, -1, 172, 3,
2636 4, 5, 6, 7, 8, 9, -1, -1, -1, -1,
2637 -1, -1, -1, -1, -1, 19, 20, -1, 22, 23,
2638 24, 25, 26, 27, -1, -1, -1, -1, -1, -1,
2639 -1, -1, -1, -1, -1, -1, 40, 41, -1, -1,
2640 164, 165, -1, -1, 168, -1, 170, 171, -1, -1,
2641 -1, 55, 7, 8, -1, 10, 11, 12, 13, 14,
Dale Johannesendfe8c842008-09-26 19:32:34 +00002642 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
Chris Lattner740e7092008-10-15 06:16:57 +00002643 -1, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2644 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
2645 -1, -1, -1, -1, -1, 50, -1, -1, -1, -1,
Devang Patel652203f2008-09-29 20:49:50 +00002646 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattner740e7092008-10-15 06:16:57 +00002647 -1, -1, -1, -1, -1, 119, 120, 121, 122, 123,
2648 124, 125, 126, 127, 128, 129, 130, 131, -1, 133,
2649 -1, 135, 136, 137, -1, 139, 140, -1, -1, -1,
Chris Lattnerf9078f92008-10-15 06:03:48 +00002650 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattner740e7092008-10-15 06:16:57 +00002651 -1, -1, -1, -1, -1, 159, -1, -1, -1, 163,
2652 -1, 165, -1, -1, 168, -1, 170, -1, 172, 3,
2653 4, 5, 6, 7, 8, 9, -1, -1, -1, -1,
2654 -1, -1, -1, -1, -1, 19, 20, -1, 22, 23,
2655 24, 25, 26, 27, -1, -1, -1, -1, -1, -1,
2656 -1, -1, -1, -1, -1, -1, 40, 41, -1, 164,
2657 165, -1, -1, 168, -1, 170, 171, -1, -1, -1,
2658 -1, 55, 7, 8, -1, 10, 11, 12, 13, 14,
2659 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2660 -1, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2661 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
2662 -1, -1, -1, -1, -1, 50, -1, -1, -1, -1,
Chris Lattner15bd0952008-08-29 17:20:18 +00002663 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattner740e7092008-10-15 06:16:57 +00002664 -1, -1, -1, -1, -1, 119, 120, 121, 122, 123,
2665 124, 125, 126, 127, 128, 129, 130, 131, -1, 133,
2666 -1, 135, 136, 137, -1, 139, 140, -1, -1, -1,
2667 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2668 -1, -1, -1, -1, -1, 159, -1, -1, -1, -1,
2669 -1, 165, -1, -1, 168, -1, 170, -1, 172, 3,
2670 4, 5, 6, 7, 8, 9, -1, -1, -1, -1,
2671 -1, -1, -1, -1, -1, 19, 20, -1, 22, 23,
2672 24, 25, 26, 27, -1, -1, -1, -1, -1, -1,
2673 -1, -1, -1, -1, -1, -1, 40, 41, -1, 164,
2674 165, -1, -1, 168, -1, 170, 171, -1, -1, -1,
2675 -1, -1, -1, 7, 8, 59, 10, 11, 12, 13,
2676 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2677 24, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2678 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
2679 -1, -1, -1, -1, 7, 8, 50, 10, 11, 12,
2680 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2681 23, 24, -1, -1, -1, 119, 120, 121, 122, 123,
2682 124, 125, 126, 127, 128, 129, 130, 131, -1, 133,
2683 -1, 135, 136, 137, -1, 139, 140, 50, -1, -1,
2684 -1, -1, -1, -1, -1, -1, -1, 3, 4, 5,
2685 6, -1, -1, 9, -1, -1, -1, -1, -1, -1,
2686 -1, 165, -1, -1, 168, -1, 170, -1, 172, 25,
2687 26, 27, -1, -1, -1, -1, -1, -1, -1, -1,
2688 -1, -1, -1, -1, 40, 41, -1, 141, 142, -1,
2689 144, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2690 -1, -1, -1, 59, -1, -1, -1, -1, -1, -1,
2691 164, 165, 125, -1, 168, -1, 170, -1, -1, 75,
Chris Lattnerf9078f92008-10-15 06:03:48 +00002692 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2693 86, 87, 88, 89, 90, 91, 92, 93, -1, -1,
Chris Lattner740e7092008-10-15 06:16:57 +00002694 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2695 -1, 164, 165, -1, -1, 168, -1, 170, -1, -1,
2696 -1, -1, -1, 119, 120, 121, 122, 123, 124, 125,
2697 126, 127, 128, 129, 130, 131, -1, 133, -1, 135,
2698 136, 137, -1, 139, 140, 7, 8, -1, 10, 11,
2699 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2700 22, 23, 24, -1, -1, -1, -1, -1, -1, 165,
2701 -1, -1, 168, -1, 170, -1, 172, 39, -1, -1,
2702 -1, -1, -1, -1, -1, -1, 7, 8, 50, 10,
2703 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2704 -1, 22, 23, 24, 7, 8, -1, 10, 11, 12,
2705 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2706 23, 24, -1, -1, -1, -1, -1, 7, 8, 50,
2707 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2708 20, -1, 22, 23, 24, 7, 8, 50, 10, 11,
2709 12, 13, 14, 15, 16, 17, -1, 19, 20, 39,
2710 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
2711 50, -1, -1, -1, -1, -1, -1, 39, -1, -1,
2712 -1, -1, -1, -1, -1, -1, -1, -1, 50, -1,
2713 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2714 -1, -1, 164, 165, -1, -1, 168, -1, 170, 7,
2715 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2716 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2717 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2718 -1, -1, -1, 164, 165, -1, 167, 168, -1, 170,
2719 -1, -1, 50, -1, -1, -1, -1, -1, -1, -1,
2720 -1, 164, 165, -1, 167, 168, -1, 170, -1, -1,
2721 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2722 -1, -1, -1, -1, 164, 165, -1, -1, 168, -1,
2723 170, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2724 -1, -1, 164, 165, -1, -1, 168, -1, 170, 7,
2725 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2726 -1, 19, 20, -1, 22, 23, 24, -1, 7, 8,
2727 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2728 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
2729 -1, -1, 50, -1, -1, -1, -1, -1, -1, -1,
2730 -1, -1, -1, -1, -1, -1, 164, 165, -1, -1,
2731 168, 50, 170, 7, 8, -1, 10, 11, 12, 13,
2732 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2733 24, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2734 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2735 -1, -1, -1, -1, 7, 8, 50, 10, 11, 12,
2736 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2737 23, 24, 7, 8, 50, 10, 11, 12, 13, 14,
2738 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2739 -1, -1, -1, -1, -1, -1, -1, 50, -1, -1,
2740 -1, -1, -1, -1, -1, -1, 164, 165, -1, -1,
2741 168, -1, 170, -1, -1, 50, -1, 0, -1, -1,
2742 -1, -1, -1, -1, -1, 164, 165, -1, -1, 168,
2743 -1, 170, -1, -1, -1, 18, 19, 20, -1, 22,
2744 23, 24, -1, -1, -1, -1, -1, 30, 31, -1,
2745 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2746 -1, -1, -1, -1, -1, -1, -1, -1, -1, 52,
2747 164, 165, -1, 56, 168, -1, 170, 60, -1, -1,
2748 -1, -1, -1, -1, -1, -1, -1, -1, 164, 165,
2749 -1, -1, 168, -1, 170, -1, -1, -1, -1, -1,
2750 -1, -1, -1, 36, -1, -1, -1, -1, -1, -1,
2751 -1, 164, 165, -1, -1, 168, -1, 170, -1, -1,
2752 -1, -1, -1, -1, 57, 58, -1, -1, -1, 164,
2753 165, -1, -1, 168, -1, 170, 69, 70, 71, 72,
2754 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
2755 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
2756 93, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2757 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2758 -1, 114, 115, 116, -1, -1, 119, 120, 121, 122,
2759 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
2760 133, 134, 135, 136, 137, 138, 139, 140
Dan Gohmanf4423b12008-04-19 00:24:39 +00002761};
2762
2763/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2764 symbol of state STATE-NUM. */
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002765static const yytype_uint16 yystos[] =
Dan Gohmanf4423b12008-04-19 00:24:39 +00002766{
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002767 0, 19, 20, 22, 23, 24, 30, 31, 52, 56,
Chris Lattner740e7092008-10-15 06:16:57 +00002768 60, 179, 182, 184, 185, 186, 220, 221, 222, 224,
2769 223, 53, 68, 229, 161, 59, 161, 18, 161, 42,
Devang Patel652203f2008-09-29 20:49:50 +00002770 43, 44, 45, 46, 47, 48, 49, 51, 156, 157,
Chris Lattner740e7092008-10-15 06:16:57 +00002771 158, 187, 188, 189, 0, 222, 46, 48, 190, 239,
2772 42, 43, 44, 47, 191, 236, 238, 246, 161, 161,
2773 165, 230, 22, 228, 7, 8, 10, 11, 12, 13,
2774 14, 15, 16, 17, 50, 164, 165, 168, 170, 179,
2775 184, 207, 208, 242, 189, 189, 35, 37, 218, 189,
2776 189, 21, 247, 248, 29, 171, 237, 247, 22, 22,
2777 22, 231, 159, 4, 4, 4, 170, 10, 171, 208,
2778 213, 55, 159, 181, 218, 218, 42, 44, 192, 32,
2779 33, 217, 62, 63, 64, 65, 66, 67, 193, 234,
2780 234, 7, 182, 183, 251, 162, 167, 39, 208, 209,
2781 211, 212, 166, 166, 171, 213, 162, 171, 159, 212,
2782 163, 217, 217, 10, 125, 208, 210, 219, 208, 214,
2783 4, 197, 28, 170, 235, 161, 36, 57, 58, 69,
2784 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2785 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2786 90, 91, 92, 93, 114, 115, 116, 119, 120, 121,
2787 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
2788 132, 133, 134, 135, 136, 137, 138, 139, 140, 174,
2789 175, 176, 249, 256, 257, 258, 259, 249, 257, 22,
2790 195, 162, 160, 208, 208, 169, 171, 208, 4, 160,
2791 214, 208, 159, 242, 3, 4, 5, 6, 9, 25,
2792 26, 27, 40, 41, 90, 91, 92, 93, 119, 133,
2793 135, 136, 137, 139, 140, 165, 168, 170, 172, 174,
2794 175, 176, 215, 242, 181, 141, 142, 144, 196, 210,
2795 57, 10, 208, 244, 245, 11, 17, 11, 193, 94,
2796 95, 96, 97, 98, 99, 100, 101, 102, 103, 177,
2797 26, 27, 100, 101, 102, 103, 104, 105, 106, 107,
2798 108, 109, 110, 111, 112, 113, 178, 177, 178, 208,
2799 208, 244, 208, 208, 252, 244, 244, 244, 244, 244,
2800 208, 208, 208, 208, 208, 244, 193, 117, 118, 54,
2801 121, 122, 141, 142, 144, 145, 147, 148, 149, 194,
2802 39, 209, 199, 167, 169, 169, 160, 199, 181, 181,
2803 219, 177, 178, 177, 178, 159, 159, 159, 159, 159,
2804 159, 159, 167, 214, 216, 170, 216, 171, 216, 22,
2805 159, 159, 159, 225, 184, 3, 4, 5, 6, 9,
2806 25, 26, 27, 40, 41, 59, 165, 168, 170, 172,
2807 215, 241, 242, 243, 162, 243, 243, 243, 197, 208,
2808 208, 208, 208, 162, 202, 162, 202, 243, 165, 162,
2809 162, 162, 162, 162, 162, 243, 243, 243, 243, 243,
2810 38, 197, 208, 244, 4, 141, 142, 143, 144, 146,
2811 150, 151, 153, 154, 155, 198, 226, 227, 38, 159,
2812 159, 159, 159, 214, 214, 214, 214, 214, 214, 214,
2813 162, 167, 171, 208, 216, 169, 171, 214, 214, 214,
2814 162, 205, 159, 61, 240, 167, 216, 170, 216, 171,
2815 216, 22, 244, 162, 162, 210, 243, 243, 243, 243,
2816 11, 54, 11, 254, 243, 165, 244, 208, 244, 244,
2817 244, 162, 162, 255, 162, 162, 162, 208, 210, 243,
2818 162, 205, 205, 208, 214, 214, 214, 214, 254, 162,
2819 162, 162, 162, 255, 162, 214, 169, 171, 162, 162,
2820 38, 34, 54, 203, 206, 39, 208, 232, 233, 22,
2821 167, 171, 216, 169, 171, 17, 17, 243, 162, 162,
2822 162, 162, 243, 4, 243, 162, 162, 243, 162, 162,
2823 162, 4, 4, 162, 208, 243, 243, 243, 162, 202,
2824 208, 160, 162, 162, 162, 162, 160, 214, 214, 214,
2825 214, 160, 214, 169, 214, 214, 208, 22, 4, 205,
2826 195, 162, 160, 162, 169, 171, 243, 243, 159, 243,
2827 243, 243, 243, 202, 202, 244, 243, 162, 244, 244,
2828 244, 4, 243, 159, 243, 214, 214, 214, 214, 162,
2829 160, 162, 162, 255, 160, 160, 160, 179, 180, 39,
2830 208, 199, 22, 169, 162, 165, 17, 208, 253, 167,
2831 243, 255, 253, 202, 160, 160, 160, 160, 214, 214,
2832 214, 160, 195, 203, 204, 17, 11, 167, 250, 195,
2833 195, 160, 162, 167, 160, 160, 160, 160, 180, 54,
2834 201, 243, 241, 11, 167, 121, 122, 243, 243, 199,
2835 17, 208, 199, 4, 152, 200, 162, 241, 195, 195,
2836 38, 195, 195, 22, 17, 162, 17, 243, 243, 243,
2837 17, 243, 195, 195, 243, 73, 17, 243
Dan Gohmanf4423b12008-04-19 00:24:39 +00002838};
David Greene718fda32007-08-01 03:59:32 +00002839
Reid Spencer68a24bd2005-08-27 18:50:39 +00002840#define yyerrok (yyerrstatus = 0)
2841#define yyclearin (yychar = YYEMPTY)
Dan Gohmanf4423b12008-04-19 00:24:39 +00002842#define YYEMPTY (-2)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002843#define YYEOF 0
Dan Gohmanf4423b12008-04-19 00:24:39 +00002844
Reid Spencer68a24bd2005-08-27 18:50:39 +00002845#define YYACCEPT goto yyacceptlab
Dan Gohmanf4423b12008-04-19 00:24:39 +00002846#define YYABORT goto yyabortlab
2847#define YYERROR goto yyerrorlab
2848
2849
2850/* Like YYERROR except do call yyerror. This remains here temporarily
2851 to ease the transition to the new meaning of YYERROR, for GCC.
Reid Spencer68a24bd2005-08-27 18:50:39 +00002852 Once GCC version 2 has supplanted version 1, this can go. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00002853
Reid Spencer68a24bd2005-08-27 18:50:39 +00002854#define YYFAIL goto yyerrlab
Dan Gohmanf4423b12008-04-19 00:24:39 +00002855
Reid Spencer68a24bd2005-08-27 18:50:39 +00002856#define YYRECOVERING() (!!yyerrstatus)
Dan Gohmanf4423b12008-04-19 00:24:39 +00002857
2858#define YYBACKUP(Token, Value) \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002859do \
2860 if (yychar == YYEMPTY && yylen == 1) \
Dan Gohmanf4423b12008-04-19 00:24:39 +00002861 { \
2862 yychar = (Token); \
2863 yylval = (Value); \
2864 yytoken = YYTRANSLATE (yychar); \
2865 YYPOPSTACK (1); \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002866 goto yybackup; \
2867 } \
2868 else \
Dan Gohmanf4423b12008-04-19 00:24:39 +00002869 { \
2870 yyerror (YY_("syntax error: cannot back up")); \
2871 YYERROR; \
2872 } \
2873while (YYID (0))
2874
Anton Korobeynikov38e09802007-04-28 13:48:45 +00002875
Reid Spencer68a24bd2005-08-27 18:50:39 +00002876#define YYTERROR 1
2877#define YYERRCODE 256
2878
Dan Gohmanf4423b12008-04-19 00:24:39 +00002879
2880/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2881 If N is 0, then set CURRENT to the empty location which ends
2882 the previous symbol: RHS[0] (always defined). */
2883
2884#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2885#ifndef YYLLOC_DEFAULT
2886# define YYLLOC_DEFAULT(Current, Rhs, N) \
2887 do \
2888 if (YYID (N)) \
2889 { \
2890 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2891 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2892 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2893 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2894 } \
2895 else \
2896 { \
2897 (Current).first_line = (Current).last_line = \
2898 YYRHSLOC (Rhs, 0).last_line; \
2899 (Current).first_column = (Current).last_column = \
2900 YYRHSLOC (Rhs, 0).last_column; \
2901 } \
2902 while (YYID (0))
Reid Spencer68a24bd2005-08-27 18:50:39 +00002903#endif
2904
Dan Gohmanf4423b12008-04-19 00:24:39 +00002905
2906/* YY_LOCATION_PRINT -- Print the location on the stream.
2907 This macro was not mandated originally: define only if we know
2908 we won't break user code: when these are the locations we know. */
2909
2910#ifndef YY_LOCATION_PRINT
Nuno Lopes6ec8a252008-10-15 11:11:12 +00002911# if YYLTYPE_IS_TRIVIAL
Dan Gohmanf4423b12008-04-19 00:24:39 +00002912# define YY_LOCATION_PRINT(File, Loc) \
2913 fprintf (File, "%d.%d-%d.%d", \
2914 (Loc).first_line, (Loc).first_column, \
2915 (Loc).last_line, (Loc).last_column)
2916# else
2917# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2918# endif
2919#endif
2920
2921
2922/* YYLEX -- calling `yylex' with the right arguments. */
2923
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00002924#ifdef YYLEX_PARAM
Dan Gohmanf4423b12008-04-19 00:24:39 +00002925# define YYLEX yylex (YYLEX_PARAM)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00002926#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00002927# define YYLEX yylex ()
Gabor Greife64d2482008-04-06 23:07:54 +00002928#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002929
2930/* Enable debugging if requested. */
2931#if YYDEBUG
2932
2933# ifndef YYFPRINTF
2934# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2935# define YYFPRINTF fprintf
2936# endif
2937
2938# define YYDPRINTF(Args) \
2939do { \
2940 if (yydebug) \
2941 YYFPRINTF Args; \
2942} while (YYID (0))
2943
2944# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2945do { \
2946 if (yydebug) \
2947 { \
2948 YYFPRINTF (stderr, "%s ", Title); \
2949 yy_symbol_print (stderr, \
2950 Type, Value); \
2951 YYFPRINTF (stderr, "\n"); \
2952 } \
2953} while (YYID (0))
2954
2955
2956/*--------------------------------.
2957| Print this symbol on YYOUTPUT. |
2958`--------------------------------*/
2959
2960/*ARGSUSED*/
2961#if (defined __STDC__ || defined __C99__FUNC__ \
2962 || defined __cplusplus || defined _MSC_VER)
2963static void
2964yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
Gabor Greife64d2482008-04-06 23:07:54 +00002965#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00002966static void
2967yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2968 FILE *yyoutput;
2969 int yytype;
2970 YYSTYPE const * const yyvaluep;
Gabor Greife64d2482008-04-06 23:07:54 +00002971#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002972{
2973 if (!yyvaluep)
2974 return;
2975# ifdef YYPRINT
2976 if (yytype < YYNTOKENS)
2977 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2978# else
2979 YYUSE (yyoutput);
2980# endif
2981 switch (yytype)
2982 {
2983 default:
2984 break;
2985 }
2986}
2987
2988
2989/*--------------------------------.
2990| Print this symbol on YYOUTPUT. |
2991`--------------------------------*/
2992
2993#if (defined __STDC__ || defined __C99__FUNC__ \
2994 || defined __cplusplus || defined _MSC_VER)
2995static void
2996yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2997#else
2998static void
2999yy_symbol_print (yyoutput, yytype, yyvaluep)
3000 FILE *yyoutput;
3001 int yytype;
3002 YYSTYPE const * const yyvaluep;
Scott Michel15dcd8e2008-01-30 03:10:00 +00003003#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003004{
3005 if (yytype < YYNTOKENS)
3006 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
3007 else
3008 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
Chris Lattner38905612008-02-19 04:36:25 +00003009
Dan Gohmanf4423b12008-04-19 00:24:39 +00003010 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
3011 YYFPRINTF (yyoutput, ")");
3012}
Chris Lattner38905612008-02-19 04:36:25 +00003013
Dan Gohmanf4423b12008-04-19 00:24:39 +00003014/*------------------------------------------------------------------.
3015| yy_stack_print -- Print the state stack from its BOTTOM up to its |
3016| TOP (included). |
3017`------------------------------------------------------------------*/
Chris Lattner38905612008-02-19 04:36:25 +00003018
Dan Gohmanf4423b12008-04-19 00:24:39 +00003019#if (defined __STDC__ || defined __C99__FUNC__ \
3020 || defined __cplusplus || defined _MSC_VER)
3021static void
3022yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
3023#else
3024static void
3025yy_stack_print (bottom, top)
3026 yytype_int16 *bottom;
3027 yytype_int16 *top;
Scott Michel15dcd8e2008-01-30 03:10:00 +00003028#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003029{
3030 YYFPRINTF (stderr, "Stack now");
3031 for (; bottom <= top; ++bottom)
3032 YYFPRINTF (stderr, " %d", *bottom);
3033 YYFPRINTF (stderr, "\n");
3034}
Chris Lattner38905612008-02-19 04:36:25 +00003035
Dan Gohmanf4423b12008-04-19 00:24:39 +00003036# define YY_STACK_PRINT(Bottom, Top) \
3037do { \
3038 if (yydebug) \
3039 yy_stack_print ((Bottom), (Top)); \
3040} while (YYID (0))
Chris Lattner38905612008-02-19 04:36:25 +00003041
Dan Gohmanf4423b12008-04-19 00:24:39 +00003042
3043/*------------------------------------------------.
3044| Report that the YYRULE is going to be reduced. |
3045`------------------------------------------------*/
3046
3047#if (defined __STDC__ || defined __C99__FUNC__ \
3048 || defined __cplusplus || defined _MSC_VER)
3049static void
3050yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
3051#else
3052static void
3053yy_reduce_print (yyvsp, yyrule)
3054 YYSTYPE *yyvsp;
3055 int yyrule;
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00003056#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003057{
3058 int yynrhs = yyr2[yyrule];
3059 int yyi;
3060 unsigned long int yylno = yyrline[yyrule];
3061 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
3062 yyrule - 1, yylno);
3063 /* The symbols being reduced. */
3064 for (yyi = 0; yyi < yynrhs; yyi++)
3065 {
3066 fprintf (stderr, " $%d = ", yyi + 1);
3067 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
3068 &(yyvsp[(yyi + 1) - (yynrhs)])
3069 );
3070 fprintf (stderr, "\n");
3071 }
3072}
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003073
Dan Gohmanf4423b12008-04-19 00:24:39 +00003074# define YY_REDUCE_PRINT(Rule) \
3075do { \
3076 if (yydebug) \
3077 yy_reduce_print (yyvsp, Rule); \
3078} while (YYID (0))
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003079
Dan Gohmanf4423b12008-04-19 00:24:39 +00003080/* Nonzero means print parse trace. It is left uninitialized so that
3081 multiple parsers can coexist. */
3082int yydebug;
3083#else /* !YYDEBUG */
3084# define YYDPRINTF(Args)
3085# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
3086# define YY_STACK_PRINT(Bottom, Top)
3087# define YY_REDUCE_PRINT(Rule)
3088#endif /* !YYDEBUG */
3089
3090
3091/* YYINITDEPTH -- initial size of the parser's stacks. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003092#ifndef YYINITDEPTH
Dan Gohmanf4423b12008-04-19 00:24:39 +00003093# define YYINITDEPTH 200
Reid Spencer68a24bd2005-08-27 18:50:39 +00003094#endif
3095
Dan Gohmanf4423b12008-04-19 00:24:39 +00003096/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
3097 if the built-in stack extension method is used).
Reid Spencer68a24bd2005-08-27 18:50:39 +00003098
Dan Gohmanf4423b12008-04-19 00:24:39 +00003099 Do not make this value too large; the results are undefined if
3100 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
3101 evaluated with infinite-precision integer arithmetic. */
David Greene718fda32007-08-01 03:59:32 +00003102
Reid Spencer68a24bd2005-08-27 18:50:39 +00003103#ifndef YYMAXDEPTH
Dan Gohmanf4423b12008-04-19 00:24:39 +00003104# define YYMAXDEPTH 10000
Reid Spencer68a24bd2005-08-27 18:50:39 +00003105#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003106
Reid Spencer68a24bd2005-08-27 18:50:39 +00003107
3108
Dan Gohmanf4423b12008-04-19 00:24:39 +00003109#if YYERROR_VERBOSE
Reid Spencer68a24bd2005-08-27 18:50:39 +00003110
Dan Gohmanf4423b12008-04-19 00:24:39 +00003111# ifndef yystrlen
3112# if defined __GLIBC__ && defined _STRING_H
3113# define yystrlen strlen
3114# else
3115/* Return the length of YYSTR. */
3116#if (defined __STDC__ || defined __C99__FUNC__ \
3117 || defined __cplusplus || defined _MSC_VER)
3118static YYSIZE_T
3119yystrlen (const char *yystr)
Chris Lattner38905612008-02-19 04:36:25 +00003120#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00003121static YYSIZE_T
3122yystrlen (yystr)
3123 const char *yystr;
3124#endif
3125{
3126 YYSIZE_T yylen;
3127 for (yylen = 0; yystr[yylen]; yylen++)
3128 continue;
3129 return yylen;
3130}
3131# endif
3132# endif
3133
3134# ifndef yystpcpy
3135# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
3136# define yystpcpy stpcpy
3137# else
3138/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
3139 YYDEST. */
3140#if (defined __STDC__ || defined __C99__FUNC__ \
3141 || defined __cplusplus || defined _MSC_VER)
3142static char *
3143yystpcpy (char *yydest, const char *yysrc)
3144#else
3145static char *
3146yystpcpy (yydest, yysrc)
3147 char *yydest;
3148 const char *yysrc;
3149#endif
3150{
3151 char *yyd = yydest;
3152 const char *yys = yysrc;
3153
3154 while ((*yyd++ = *yys++) != '\0')
3155 continue;
3156
3157 return yyd - 1;
3158}
3159# endif
3160# endif
3161
3162# ifndef yytnamerr
3163/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3164 quotes and backslashes, so that it's suitable for yyerror. The
3165 heuristic is that double-quoting is unnecessary unless the string
3166 contains an apostrophe, a comma, or backslash (other than
3167 backslash-backslash). YYSTR is taken from yytname. If YYRES is
3168 null, do not copy; instead, return the length of what the result
3169 would have been. */
3170static YYSIZE_T
3171yytnamerr (char *yyres, const char *yystr)
3172{
3173 if (*yystr == '"')
3174 {
3175 YYSIZE_T yyn = 0;
3176 char const *yyp = yystr;
3177
3178 for (;;)
3179 switch (*++yyp)
3180 {
3181 case '\'':
3182 case ',':
3183 goto do_not_strip_quotes;
3184
3185 case '\\':
3186 if (*++yyp != '\\')
3187 goto do_not_strip_quotes;
3188 /* Fall through. */
3189 default:
3190 if (yyres)
3191 yyres[yyn] = *yyp;
3192 yyn++;
3193 break;
3194
3195 case '"':
3196 if (yyres)
3197 yyres[yyn] = '\0';
3198 return yyn;
3199 }
3200 do_not_strip_quotes: ;
3201 }
3202
3203 if (! yyres)
3204 return yystrlen (yystr);
3205
3206 return yystpcpy (yyres, yystr) - yyres;
3207}
3208# endif
3209
3210/* Copy into YYRESULT an error message about the unexpected token
3211 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3212 including the terminating null byte. If YYRESULT is null, do not
3213 copy anything; just return the number of bytes that would be
3214 copied. As a special case, return 0 if an ordinary "syntax error"
3215 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3216 size calculation. */
3217static YYSIZE_T
3218yysyntax_error (char *yyresult, int yystate, int yychar)
3219{
3220 int yyn = yypact[yystate];
3221
3222 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3223 return 0;
3224 else
3225 {
3226 int yytype = YYTRANSLATE (yychar);
3227 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3228 YYSIZE_T yysize = yysize0;
3229 YYSIZE_T yysize1;
3230 int yysize_overflow = 0;
3231 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3232 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3233 int yyx;
3234
3235# if 0
3236 /* This is so xgettext sees the translatable formats that are
3237 constructed on the fly. */
3238 YY_("syntax error, unexpected %s");
3239 YY_("syntax error, unexpected %s, expecting %s");
3240 YY_("syntax error, unexpected %s, expecting %s or %s");
3241 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3242 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3243# endif
3244 char *yyfmt;
3245 char const *yyf;
3246 static char const yyunexpected[] = "syntax error, unexpected %s";
3247 static char const yyexpecting[] = ", expecting %s";
3248 static char const yyor[] = " or %s";
3249 char yyformat[sizeof yyunexpected
3250 + sizeof yyexpecting - 1
3251 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3252 * (sizeof yyor - 1))];
3253 char const *yyprefix = yyexpecting;
3254
3255 /* Start YYX at -YYN if negative to avoid negative indexes in
3256 YYCHECK. */
3257 int yyxbegin = yyn < 0 ? -yyn : 0;
3258
3259 /* Stay within bounds of both yycheck and yytname. */
3260 int yychecklim = YYLAST - yyn + 1;
3261 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3262 int yycount = 1;
3263
3264 yyarg[0] = yytname[yytype];
3265 yyfmt = yystpcpy (yyformat, yyunexpected);
3266
3267 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3268 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3269 {
3270 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3271 {
3272 yycount = 1;
3273 yysize = yysize0;
3274 yyformat[sizeof yyunexpected - 1] = '\0';
3275 break;
3276 }
3277 yyarg[yycount++] = yytname[yyx];
3278 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3279 yysize_overflow |= (yysize1 < yysize);
3280 yysize = yysize1;
3281 yyfmt = yystpcpy (yyfmt, yyprefix);
3282 yyprefix = yyor;
3283 }
3284
3285 yyf = YY_(yyformat);
3286 yysize1 = yysize + yystrlen (yyf);
3287 yysize_overflow |= (yysize1 < yysize);
3288 yysize = yysize1;
3289
3290 if (yysize_overflow)
3291 return YYSIZE_MAXIMUM;
3292
3293 if (yyresult)
3294 {
3295 /* Avoid sprintf, as that infringes on the user's name space.
3296 Don't have undefined behavior even if the translation
3297 produced a string with the wrong number of "%s"s. */
3298 char *yyp = yyresult;
3299 int yyi = 0;
3300 while ((*yyp = *yyf) != '\0')
3301 {
3302 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3303 {
3304 yyp += yytnamerr (yyp, yyarg[yyi++]);
3305 yyf += 2;
3306 }
3307 else
3308 {
3309 yyp++;
3310 yyf++;
3311 }
3312 }
3313 }
3314 return yysize;
3315 }
3316}
3317#endif /* YYERROR_VERBOSE */
3318
3319
3320/*-----------------------------------------------.
3321| Release the memory associated to this symbol. |
3322`-----------------------------------------------*/
3323
3324/*ARGSUSED*/
3325#if (defined __STDC__ || defined __C99__FUNC__ \
3326 || defined __cplusplus || defined _MSC_VER)
3327static void
3328yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3329#else
3330static void
3331yydestruct (yymsg, yytype, yyvaluep)
3332 const char *yymsg;
3333 int yytype;
3334 YYSTYPE *yyvaluep;
3335#endif
3336{
3337 YYUSE (yyvaluep);
3338
3339 if (!yymsg)
3340 yymsg = "Deleting";
3341 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3342
3343 switch (yytype)
3344 {
3345
3346 default:
3347 break;
3348 }
3349}
3350
3351
3352/* Prevent warnings from -Wmissing-prototypes. */
3353
3354#ifdef YYPARSE_PARAM
3355#if defined __STDC__ || defined __cplusplus
3356int yyparse (void *YYPARSE_PARAM);
3357#else
3358int yyparse ();
3359#endif
3360#else /* ! YYPARSE_PARAM */
3361#if defined __STDC__ || defined __cplusplus
David Greene5fd22a82007-09-04 18:46:50 +00003362int yyparse (void);
Gabor Greife64d2482008-04-06 23:07:54 +00003363#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00003364int yyparse ();
Scott Michel15dcd8e2008-01-30 03:10:00 +00003365#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003366#endif /* ! YYPARSE_PARAM */
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003367
Chris Lattner38905612008-02-19 04:36:25 +00003368
Dan Gohmanf4423b12008-04-19 00:24:39 +00003369
3370/* The look-ahead symbol. */
3371int yychar;
3372
3373/* The semantic value of the look-ahead symbol. */
3374YYSTYPE yylval;
3375
3376/* Number of syntax errors so far. */
3377int yynerrs;
3378
3379
3380
3381/*----------.
3382| yyparse. |
3383`----------*/
3384
3385#ifdef YYPARSE_PARAM
3386#if (defined __STDC__ || defined __C99__FUNC__ \
3387 || defined __cplusplus || defined _MSC_VER)
3388int
3389yyparse (void *YYPARSE_PARAM)
3390#else
3391int
3392yyparse (YYPARSE_PARAM)
3393 void *YYPARSE_PARAM;
3394#endif
3395#else /* ! YYPARSE_PARAM */
3396#if (defined __STDC__ || defined __C99__FUNC__ \
3397 || defined __cplusplus || defined _MSC_VER)
3398int
3399yyparse (void)
3400#else
3401int
3402yyparse ()
3403
Gabor Greife64d2482008-04-06 23:07:54 +00003404#endif
3405#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003406{
3407
3408 int yystate;
3409 int yyn;
3410 int yyresult;
3411 /* Number of tokens to shift before error messages enabled. */
3412 int yyerrstatus;
3413 /* Look-ahead token as an internal (translated) token number. */
3414 int yytoken = 0;
3415#if YYERROR_VERBOSE
3416 /* Buffer for error messages, and its allocated size. */
3417 char yymsgbuf[128];
3418 char *yymsg = yymsgbuf;
3419 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
Gabor Greife64d2482008-04-06 23:07:54 +00003420#endif
Chris Lattner38905612008-02-19 04:36:25 +00003421
Dan Gohmanf4423b12008-04-19 00:24:39 +00003422 /* Three stacks and their tools:
3423 `yyss': related to states,
3424 `yyvs': related to semantic values,
3425 `yyls': related to locations.
3426
3427 Refer to the stacks thru separate pointers, to allow yyoverflow
3428 to reallocate them elsewhere. */
3429
3430 /* The state stack. */
3431 yytype_int16 yyssa[YYINITDEPTH];
3432 yytype_int16 *yyss = yyssa;
3433 yytype_int16 *yyssp;
3434
3435 /* The semantic value stack. */
3436 YYSTYPE yyvsa[YYINITDEPTH];
3437 YYSTYPE *yyvs = yyvsa;
3438 YYSTYPE *yyvsp;
3439
3440
3441
3442#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3443
3444 YYSIZE_T yystacksize = YYINITDEPTH;
3445
3446 /* The variables used to return semantic value and location from the
3447 action routines. */
3448 YYSTYPE yyval;
3449
3450
3451 /* The number of symbols on the RHS of the reduced rule.
3452 Keep to zero when no symbol should be popped. */
3453 int yylen = 0;
3454
3455 YYDPRINTF ((stderr, "Starting parse\n"));
3456
Reid Spencer68a24bd2005-08-27 18:50:39 +00003457 yystate = 0;
3458 yyerrstatus = 0;
3459 yynerrs = 0;
3460 yychar = YYEMPTY; /* Cause a token to be read. */
3461
3462 /* Initialize stack pointers.
3463 Waste one element of value and location stack
3464 so that they stay on the same level as the state stack.
3465 The wasted elements are never initialized. */
3466
Dan Gohmanf4423b12008-04-19 00:24:39 +00003467 yyssp = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003468 yyvsp = yyvs;
3469
Dan Gohmanf4423b12008-04-19 00:24:39 +00003470 goto yysetstate;
Jeff Cohen66c5fd62005-10-23 04:37:20 +00003471
Dan Gohmanf4423b12008-04-19 00:24:39 +00003472/*------------------------------------------------------------.
3473| yynewstate -- Push a new state, which is found in yystate. |
3474`------------------------------------------------------------*/
3475 yynewstate:
3476 /* In all cases, when you get here, the value and location stacks
3477 have just been pushed. So pushing a state here evens the stacks. */
3478 yyssp++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003479
Dan Gohmanf4423b12008-04-19 00:24:39 +00003480 yysetstate:
3481 *yyssp = yystate;
3482
3483 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003484 {
3485 /* Get the current used size of the three stacks, in elements. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003486 YYSIZE_T yysize = yyssp - yyss + 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003487
3488#ifdef yyoverflow
Dan Gohmanf4423b12008-04-19 00:24:39 +00003489 {
3490 /* Give user a chance to reallocate the stack. Use copies of
3491 these so that the &'s don't force the real ones into
3492 memory. */
3493 YYSTYPE *yyvs1 = yyvs;
3494 yytype_int16 *yyss1 = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003495
Dan Gohmanf4423b12008-04-19 00:24:39 +00003496
3497 /* Each stack pointer address is followed by the size of the
3498 data in use in that stack, in bytes. This used to be a
3499 conditional around just the two extra args, but that might
3500 be undefined if yyoverflow is a macro. */
3501 yyoverflow (YY_("memory exhausted"),
3502 &yyss1, yysize * sizeof (*yyssp),
3503 &yyvs1, yysize * sizeof (*yyvsp),
3504
3505 &yystacksize);
3506
3507 yyss = yyss1;
3508 yyvs = yyvs1;
3509 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00003510#else /* no yyoverflow */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003511# ifndef YYSTACK_RELOCATE
3512 goto yyexhaustedlab;
3513# else
Reid Spencer68a24bd2005-08-27 18:50:39 +00003514 /* Extend the stack our own way. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003515 if (YYMAXDEPTH <= yystacksize)
3516 goto yyexhaustedlab;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003517 yystacksize *= 2;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003518 if (YYMAXDEPTH < yystacksize)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003519 yystacksize = YYMAXDEPTH;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003520
3521 {
3522 yytype_int16 *yyss1 = yyss;
3523 union yyalloc *yyptr =
3524 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3525 if (! yyptr)
3526 goto yyexhaustedlab;
3527 YYSTACK_RELOCATE (yyss);
3528 YYSTACK_RELOCATE (yyvs);
3529
3530# undef YYSTACK_RELOCATE
3531 if (yyss1 != yyssa)
3532 YYSTACK_FREE (yyss1);
3533 }
3534# endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00003535#endif /* no yyoverflow */
3536
Dan Gohmanf4423b12008-04-19 00:24:39 +00003537 yyssp = yyss + yysize - 1;
3538 yyvsp = yyvs + yysize - 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003539
3540
Dan Gohmanf4423b12008-04-19 00:24:39 +00003541 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3542 (unsigned long int) yystacksize));
3543
3544 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003545 YYABORT;
3546 }
3547
Dan Gohmanf4423b12008-04-19 00:24:39 +00003548 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003549
3550 goto yybackup;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003551
Dan Gohmanf4423b12008-04-19 00:24:39 +00003552/*-----------.
3553| yybackup. |
3554`-----------*/
3555yybackup:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003556
Dan Gohmanf4423b12008-04-19 00:24:39 +00003557 /* Do appropriate processing given the current state. Read a
3558 look-ahead token if we need one and don't already have one. */
Reid Spencer7780acb2007-04-16 06:56:07 +00003559
Dan Gohmanf4423b12008-04-19 00:24:39 +00003560 /* First try to decide what to do without reference to look-ahead token. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003561 yyn = yypact[yystate];
Dan Gohmanf4423b12008-04-19 00:24:39 +00003562 if (yyn == YYPACT_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003563 goto yydefault;
3564
Dan Gohmanf4423b12008-04-19 00:24:39 +00003565 /* Not known => get a look-ahead token if don't already have one. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003566
Dan Gohmanf4423b12008-04-19 00:24:39 +00003567 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003568 if (yychar == YYEMPTY)
3569 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003570 YYDPRINTF ((stderr, "Reading a token: "));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003571 yychar = YYLEX;
3572 }
3573
Dan Gohmanf4423b12008-04-19 00:24:39 +00003574 if (yychar <= YYEOF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003575 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003576 yychar = yytoken = YYEOF;
3577 YYDPRINTF ((stderr, "Now at end of input.\n"));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003578 }
3579 else
3580 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003581 yytoken = YYTRANSLATE (yychar);
3582 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Reid Spencer68a24bd2005-08-27 18:50:39 +00003583 }
3584
Dan Gohmanf4423b12008-04-19 00:24:39 +00003585 /* If the proper action on seeing token YYTOKEN is to reduce or to
3586 detect an error, take that action. */
3587 yyn += yytoken;
3588 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003589 goto yydefault;
3590 yyn = yytable[yyn];
Dan Gohmanf4423b12008-04-19 00:24:39 +00003591 if (yyn <= 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003592 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003593 if (yyn == 0 || yyn == YYTABLE_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003594 goto yyerrlab;
3595 yyn = -yyn;
3596 goto yyreduce;
3597 }
3598
3599 if (yyn == YYFINAL)
3600 YYACCEPT;
3601
Dan Gohmanf4423b12008-04-19 00:24:39 +00003602 /* Count tokens shifted since error; after three, turn off error
3603 status. */
3604 if (yyerrstatus)
3605 yyerrstatus--;
Dale Johannesencdd509a2007-09-07 21:07:57 +00003606
Dan Gohmanf4423b12008-04-19 00:24:39 +00003607 /* Shift the look-ahead token. */
3608 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003609
Dan Gohmanf4423b12008-04-19 00:24:39 +00003610 /* Discard the shifted token unless it is eof. */
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003611 if (yychar != YYEOF)
3612 yychar = YYEMPTY;
3613
Gabor Greife64d2482008-04-06 23:07:54 +00003614 yystate = yyn;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003615 *++yyvsp = yylval;
3616
Reid Spencer68a24bd2005-08-27 18:50:39 +00003617 goto yynewstate;
3618
Gabor Greife64d2482008-04-06 23:07:54 +00003619
Dan Gohmanf4423b12008-04-19 00:24:39 +00003620/*-----------------------------------------------------------.
3621| yydefault -- do the default action for the current state. |
3622`-----------------------------------------------------------*/
3623yydefault:
Reid Spencer68a24bd2005-08-27 18:50:39 +00003624 yyn = yydefact[yystate];
3625 if (yyn == 0)
3626 goto yyerrlab;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003627 goto yyreduce;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003628
Dan Gohmanf4423b12008-04-19 00:24:39 +00003629
3630/*-----------------------------.
3631| yyreduce -- Do a reduction. |
3632`-----------------------------*/
Reid Spencer68a24bd2005-08-27 18:50:39 +00003633yyreduce:
Dan Gohmanf4423b12008-04-19 00:24:39 +00003634 /* yyn is the number of a rule to reduce with. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003635 yylen = yyr2[yyn];
3636
Dan Gohmanf4423b12008-04-19 00:24:39 +00003637 /* If YYLEN is nonzero, implement the default value of the action:
3638 `$$ = $1'.
3639
3640 Otherwise, the following line sets YYVAL to garbage.
3641 This behavior is undocumented and Bison
3642 users should not rely upon it. Assigning to YYVAL
3643 unconditionally makes the parser a bit smaller, and it avoids a
3644 GCC warning that YYVAL may be used uninitialized. */
3645 yyval = yyvsp[1-yylen];
3646
3647
3648 YY_REDUCE_PRINT (yyn);
3649 switch (yyn)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003650 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003651 case 29:
Nuno Lopes19830332008-11-04 14:28:33 +00003652#line 1154 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003653 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3654 break;
Reid Spencer41dff5e2007-01-26 08:05:27 +00003655
Dan Gohmanf4423b12008-04-19 00:24:39 +00003656 case 30:
Nuno Lopes19830332008-11-04 14:28:33 +00003657#line 1154 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003658 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3659 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003660
Dan Gohmanf4423b12008-04-19 00:24:39 +00003661 case 31:
Nuno Lopes19830332008-11-04 14:28:33 +00003662#line 1155 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003663 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3664 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003665
Dan Gohmanf4423b12008-04-19 00:24:39 +00003666 case 32:
Nuno Lopes19830332008-11-04 14:28:33 +00003667#line 1155 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003668 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3669 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003670
Dan Gohmanf4423b12008-04-19 00:24:39 +00003671 case 33:
Nuno Lopes19830332008-11-04 14:28:33 +00003672#line 1156 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003673 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3674 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003675
Dan Gohmanf4423b12008-04-19 00:24:39 +00003676 case 34:
Nuno Lopes19830332008-11-04 14:28:33 +00003677#line 1156 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003678 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3679 break;
3680
3681 case 35:
Nuno Lopes19830332008-11-04 14:28:33 +00003682#line 1157 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003683 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3684 break;
3685
3686 case 36:
Nuno Lopes19830332008-11-04 14:28:33 +00003687#line 1157 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003688 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3689 break;
3690
3691 case 37:
Nuno Lopes19830332008-11-04 14:28:33 +00003692#line 1158 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003693 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3694 break;
3695
3696 case 38:
Nuno Lopes19830332008-11-04 14:28:33 +00003697#line 1158 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003698 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3699 break;
3700
3701 case 39:
Nuno Lopes19830332008-11-04 14:28:33 +00003702#line 1162 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003703 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3704 break;
3705
3706 case 40:
Nuno Lopes19830332008-11-04 14:28:33 +00003707#line 1162 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003708 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3709 break;
3710
3711 case 41:
Nuno Lopes19830332008-11-04 14:28:33 +00003712#line 1163 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003713 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3714 break;
3715
3716 case 42:
Nuno Lopes19830332008-11-04 14:28:33 +00003717#line 1163 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003718 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3719 break;
3720
3721 case 43:
Nuno Lopes19830332008-11-04 14:28:33 +00003722#line 1164 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003723 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3724 break;
3725
3726 case 44:
Nuno Lopes19830332008-11-04 14:28:33 +00003727#line 1164 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003728 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3729 break;
3730
3731 case 45:
Nuno Lopes19830332008-11-04 14:28:33 +00003732#line 1165 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003733 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3734 break;
3735
3736 case 46:
Nuno Lopes19830332008-11-04 14:28:33 +00003737#line 1165 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003738 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3739 break;
3740
3741 case 47:
Nuno Lopes19830332008-11-04 14:28:33 +00003742#line 1166 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003743 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3744 break;
3745
3746 case 48:
Nuno Lopes19830332008-11-04 14:28:33 +00003747#line 1166 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003748 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3749 break;
3750
3751 case 49:
Nuno Lopes19830332008-11-04 14:28:33 +00003752#line 1167 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003753 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3754 break;
3755
3756 case 50:
Nuno Lopes19830332008-11-04 14:28:33 +00003757#line 1167 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003758 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3759 break;
3760
3761 case 51:
Nuno Lopes19830332008-11-04 14:28:33 +00003762#line 1168 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003763 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3764 break;
3765
3766 case 52:
Nuno Lopes19830332008-11-04 14:28:33 +00003767#line 1168 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003768 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3769 break;
3770
3771 case 53:
Nuno Lopes19830332008-11-04 14:28:33 +00003772#line 1169 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003773 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3774 break;
3775
3776 case 54:
Nuno Lopes19830332008-11-04 14:28:33 +00003777#line 1170 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003778 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3779 break;
3780
Chris Lattner740e7092008-10-15 06:16:57 +00003781 case 59:
Nuno Lopes19830332008-11-04 14:28:33 +00003782#line 1174 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003783 { (yyval.StrVal) = 0; ;}
3784 break;
3785
Chris Lattner740e7092008-10-15 06:16:57 +00003786 case 60:
Nuno Lopes19830332008-11-04 14:28:33 +00003787#line 1176 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003788 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3789 break;
3790
Chris Lattner740e7092008-10-15 06:16:57 +00003791 case 61:
Nuno Lopes19830332008-11-04 14:28:33 +00003792#line 1177 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003793 { (yyval.UIntVal)=0; ;}
3794 break;
3795
Chris Lattner740e7092008-10-15 06:16:57 +00003796 case 62:
Nuno Lopes19830332008-11-04 14:28:33 +00003797#line 1181 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003798 {
3799 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003800 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003801 ;}
3802 break;
3803
Chris Lattner740e7092008-10-15 06:16:57 +00003804 case 63:
Nuno Lopes19830332008-11-04 14:28:33 +00003805#line 1185 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003806 {
3807 (yyval.StrVal) = 0;
3808 CHECK_FOR_ERROR
3809 ;}
3810 break;
3811
3812 case 64:
Nuno Lopes19830332008-11-04 14:28:33 +00003813#line 1190 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003814 {
3815 (yyval.UIntVal) = (yyvsp[(1) - (2)].UIntVal);
3816 CHECK_FOR_ERROR
3817;}
3818 break;
3819
Chris Lattnerf9078f92008-10-15 06:03:48 +00003820 case 68:
Nuno Lopes19830332008-11-04 14:28:33 +00003821#line 1199 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003822 {
3823 (yyval.StrVal) = 0;
Christopher Lambbf3348d2007-12-12 08:45:45 +00003824 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003825 ;}
3826 break;
3827
Chris Lattnerf9078f92008-10-15 06:03:48 +00003828 case 69:
Nuno Lopes19830332008-11-04 14:28:33 +00003829#line 1204 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003830 {
3831 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00003832 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003833 ;}
3834 break;
3835
Chris Lattner740e7092008-10-15 06:16:57 +00003836 case 70:
Nuno Lopes19830332008-11-04 14:28:33 +00003837#line 1210 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003838 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3839 break;
3840
Chris Lattner740e7092008-10-15 06:16:57 +00003841 case 71:
Nuno Lopes19830332008-11-04 14:28:33 +00003842#line 1211 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003843 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3844 break;
3845
Chris Lattner740e7092008-10-15 06:16:57 +00003846 case 72:
Nuno Lopes19830332008-11-04 14:28:33 +00003847#line 1212 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003848 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3849 break;
3850
Chris Lattner740e7092008-10-15 06:16:57 +00003851 case 73:
Nuno Lopes19830332008-11-04 14:28:33 +00003852#line 1213 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003853 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3854 break;
3855
Chris Lattner740e7092008-10-15 06:16:57 +00003856 case 74:
Nuno Lopes19830332008-11-04 14:28:33 +00003857#line 1214 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003858 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3859 break;
3860
Chris Lattner740e7092008-10-15 06:16:57 +00003861 case 75:
Nuno Lopes19830332008-11-04 14:28:33 +00003862#line 1215 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003863 { (yyval.Linkage) = GlobalValue::CommonLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003864 break;
3865
Chris Lattner740e7092008-10-15 06:16:57 +00003866 case 76:
Nuno Lopes19830332008-11-04 14:28:33 +00003867#line 1219 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003868 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003869 break;
3870
Chris Lattner740e7092008-10-15 06:16:57 +00003871 case 77:
Nuno Lopes19830332008-11-04 14:28:33 +00003872#line 1220 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003873 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003874 break;
3875
Chris Lattner740e7092008-10-15 06:16:57 +00003876 case 78:
Nuno Lopes19830332008-11-04 14:28:33 +00003877#line 1221 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003878 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3879 break;
3880
3881 case 79:
Nuno Lopesf05ff662008-10-15 11:20:21 +00003882#line 1225 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes8a5f3472008-10-15 12:05:02 +00003883 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3884 break;
3885
Nuno Lopes19830332008-11-04 14:28:33 +00003886 case 80:
Nuno Lopes8a5f3472008-10-15 12:05:02 +00003887#line 1226 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes19830332008-11-04 14:28:33 +00003888 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3889 break;
3890
3891 case 81:
3892#line 1227 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003893 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3894 break;
3895
3896 case 82:
Nuno Lopes19830332008-11-04 14:28:33 +00003897#line 1228 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003898 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
3899 break;
3900
3901 case 83:
Nuno Lopes19830332008-11-04 14:28:33 +00003902#line 1232 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003903 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003904 break;
3905
Chris Lattnerf9078f92008-10-15 06:03:48 +00003906 case 84:
Nuno Lopes19830332008-11-04 14:28:33 +00003907#line 1233 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003908 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003909 break;
3910
Chris Lattner740e7092008-10-15 06:16:57 +00003911 case 85:
Nuno Lopes19830332008-11-04 14:28:33 +00003912#line 1234 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003913 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003914 break;
3915
Chris Lattner740e7092008-10-15 06:16:57 +00003916 case 86:
Nuno Lopes19830332008-11-04 14:28:33 +00003917#line 1238 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003918 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3919 break;
3920
3921 case 87:
Nuno Lopes19830332008-11-04 14:28:33 +00003922#line 1239 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003923 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3924 break;
3925
3926 case 88:
Nuno Lopes19830332008-11-04 14:28:33 +00003927#line 1240 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003928 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3929 break;
3930
3931 case 89:
Nuno Lopes19830332008-11-04 14:28:33 +00003932#line 1241 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003933 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3934 break;
3935
3936 case 90:
Nuno Lopes19830332008-11-04 14:28:33 +00003937#line 1242 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003938 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3939 break;
3940
3941 case 91:
Nuno Lopes19830332008-11-04 14:28:33 +00003942#line 1246 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003943 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3944 break;
3945
Chris Lattnerf9078f92008-10-15 06:03:48 +00003946 case 92:
Nuno Lopes19830332008-11-04 14:28:33 +00003947#line 1247 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003948 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
Chris Lattnerf9078f92008-10-15 06:03:48 +00003949 break;
3950
Chris Lattner15bd0952008-08-29 17:20:18 +00003951 case 93:
Nuno Lopes19830332008-11-04 14:28:33 +00003952#line 1248 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003953 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003954 break;
3955
Chris Lattner740e7092008-10-15 06:16:57 +00003956 case 94:
Nuno Lopesf05ff662008-10-15 11:20:21 +00003957#line 1251 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes8a5f3472008-10-15 12:05:02 +00003958 { (yyval.UIntVal) = CallingConv::C; ;}
3959 break;
3960
Nuno Lopes19830332008-11-04 14:28:33 +00003961 case 95:
Nuno Lopes8a5f3472008-10-15 12:05:02 +00003962#line 1252 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes19830332008-11-04 14:28:33 +00003963 { (yyval.UIntVal) = CallingConv::C; ;}
3964 break;
3965
3966 case 96:
3967#line 1253 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003968 { (yyval.UIntVal) = CallingConv::Fast; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003969 break;
3970
Chris Lattner740e7092008-10-15 06:16:57 +00003971 case 97:
Nuno Lopes19830332008-11-04 14:28:33 +00003972#line 1254 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003973 { (yyval.UIntVal) = CallingConv::Cold; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003974 break;
3975
Chris Lattner740e7092008-10-15 06:16:57 +00003976 case 98:
Nuno Lopes19830332008-11-04 14:28:33 +00003977#line 1255 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003978 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003979 break;
3980
Chris Lattner740e7092008-10-15 06:16:57 +00003981 case 99:
Nuno Lopes19830332008-11-04 14:28:33 +00003982#line 1256 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003983 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003984 break;
3985
Chris Lattner740e7092008-10-15 06:16:57 +00003986 case 100:
Nuno Lopes19830332008-11-04 14:28:33 +00003987#line 1257 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003988 {
3989 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003990 GEN_ERROR("Calling conv too large");
Dan Gohmanf4423b12008-04-19 00:24:39 +00003991 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003992 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003993 ;}
3994 break;
3995
Chris Lattner740e7092008-10-15 06:16:57 +00003996 case 101:
Nuno Lopesf05ff662008-10-15 11:20:21 +00003997#line 1264 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes8a5f3472008-10-15 12:05:02 +00003998 { (yyval.Attributes) = Attribute::ZExt; ;}
Chris Lattner740e7092008-10-15 06:16:57 +00003999 break;
4000
Nuno Lopes19830332008-11-04 14:28:33 +00004001 case 102:
Nuno Lopesf05ff662008-10-15 11:20:21 +00004002#line 1265 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes19830332008-11-04 14:28:33 +00004003 { (yyval.Attributes) = Attribute::ZExt; ;}
Chris Lattner740e7092008-10-15 06:16:57 +00004004 break;
4005
Nuno Lopes19830332008-11-04 14:28:33 +00004006 case 103:
Nuno Lopesf05ff662008-10-15 11:20:21 +00004007#line 1266 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes8a5f3472008-10-15 12:05:02 +00004008 { (yyval.Attributes) = Attribute::SExt; ;}
4009 break;
4010
Nuno Lopes19830332008-11-04 14:28:33 +00004011 case 104:
Nuno Lopes8a5f3472008-10-15 12:05:02 +00004012#line 1267 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes19830332008-11-04 14:28:33 +00004013 { (yyval.Attributes) = Attribute::SExt; ;}
4014 break;
4015
4016 case 105:
4017#line 1268 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004018 { (yyval.Attributes) = Attribute::InReg; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004019 break;
4020
Chris Lattner740e7092008-10-15 06:16:57 +00004021 case 106:
Nuno Lopes19830332008-11-04 14:28:33 +00004022#line 1269 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004023 { (yyval.Attributes) = Attribute::StructRet; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004024 break;
4025
Chris Lattner740e7092008-10-15 06:16:57 +00004026 case 107:
Nuno Lopes19830332008-11-04 14:28:33 +00004027#line 1270 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004028 { (yyval.Attributes) = Attribute::NoAlias; ;}
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004029 break;
4030
Chris Lattner740e7092008-10-15 06:16:57 +00004031 case 108:
Nuno Lopes19830332008-11-04 14:28:33 +00004032#line 1271 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004033 { (yyval.Attributes) = Attribute::ByVal; ;}
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004034 break;
4035
Chris Lattner740e7092008-10-15 06:16:57 +00004036 case 109:
Nuno Lopes19830332008-11-04 14:28:33 +00004037#line 1272 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004038 { (yyval.Attributes) = Attribute::Nest; ;}
Chris Lattner15bd0952008-08-29 17:20:18 +00004039 break;
4040
Chris Lattner740e7092008-10-15 06:16:57 +00004041 case 110:
Nuno Lopes19830332008-11-04 14:28:33 +00004042#line 1273 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004043 { (yyval.Attributes) =
4044 Attribute::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004045 break;
4046
Chris Lattner740e7092008-10-15 06:16:57 +00004047 case 111:
Nuno Lopes19830332008-11-04 14:28:33 +00004048#line 1277 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004049 { (yyval.Attributes) = Attribute::None; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004050 break;
4051
Chris Lattner740e7092008-10-15 06:16:57 +00004052 case 112:
Nuno Lopes19830332008-11-04 14:28:33 +00004053#line 1278 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesendfe8c842008-09-26 19:32:34 +00004054 {
4055 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
4056 ;}
4057 break;
4058
Chris Lattner740e7092008-10-15 06:16:57 +00004059 case 113:
Nuno Lopes19830332008-11-04 14:28:33 +00004060#line 1283 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004061 { (yyval.Attributes) = Attribute::InReg; ;}
Chris Lattner15bd0952008-08-29 17:20:18 +00004062 break;
4063
Chris Lattner740e7092008-10-15 06:16:57 +00004064 case 114:
Nuno Lopes19830332008-11-04 14:28:33 +00004065#line 1284 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004066 { (yyval.Attributes) = Attribute::ZExt; ;}
Chris Lattner15bd0952008-08-29 17:20:18 +00004067 break;
4068
Chris Lattner740e7092008-10-15 06:16:57 +00004069 case 115:
Nuno Lopes19830332008-11-04 14:28:33 +00004070#line 1285 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004071 { (yyval.Attributes) = Attribute::SExt; ;}
Chris Lattner15bd0952008-08-29 17:20:18 +00004072 break;
4073
Chris Lattner740e7092008-10-15 06:16:57 +00004074 case 116:
Nuno Lopes19830332008-11-04 14:28:33 +00004075#line 1288 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004076 { (yyval.Attributes) = Attribute::None; ;}
Chris Lattnerccef6b52008-09-23 21:18:31 +00004077 break;
4078
Chris Lattner740e7092008-10-15 06:16:57 +00004079 case 117:
Nuno Lopes19830332008-11-04 14:28:33 +00004080#line 1289 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00004081 {
4082 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
4083 ;}
4084 break;
4085
Chris Lattner740e7092008-10-15 06:16:57 +00004086 case 118:
Nuno Lopes19830332008-11-04 14:28:33 +00004087#line 1295 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00004088 { (yyval.Attributes) = Attribute::NoReturn; ;}
4089 break;
4090
Chris Lattner740e7092008-10-15 06:16:57 +00004091 case 119:
Nuno Lopes19830332008-11-04 14:28:33 +00004092#line 1296 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00004093 { (yyval.Attributes) = Attribute::NoUnwind; ;}
4094 break;
4095
Chris Lattner740e7092008-10-15 06:16:57 +00004096 case 120:
Nuno Lopes19830332008-11-04 14:28:33 +00004097#line 1297 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00004098 { (yyval.Attributes) = Attribute::InReg; ;}
4099 break;
4100
Chris Lattner740e7092008-10-15 06:16:57 +00004101 case 121:
Nuno Lopes19830332008-11-04 14:28:33 +00004102#line 1298 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00004103 { (yyval.Attributes) = Attribute::ZExt; ;}
4104 break;
4105
Chris Lattner740e7092008-10-15 06:16:57 +00004106 case 122:
Nuno Lopes19830332008-11-04 14:28:33 +00004107#line 1299 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00004108 { (yyval.Attributes) = Attribute::SExt; ;}
4109 break;
4110
Chris Lattner740e7092008-10-15 06:16:57 +00004111 case 123:
Nuno Lopes19830332008-11-04 14:28:33 +00004112#line 1300 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00004113 { (yyval.Attributes) = Attribute::ReadNone; ;}
4114 break;
4115
Chris Lattner740e7092008-10-15 06:16:57 +00004116 case 124:
Nuno Lopes19830332008-11-04 14:28:33 +00004117#line 1301 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00004118 { (yyval.Attributes) = Attribute::ReadOnly; ;}
4119 break;
4120
Chris Lattner740e7092008-10-15 06:16:57 +00004121 case 125:
Nuno Lopes19830332008-11-04 14:28:33 +00004122#line 1302 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner9fc4da42008-10-08 06:44:45 +00004123 { (yyval.Attributes) = Attribute::NoInline; ;}
Devang Patel652203f2008-09-29 20:49:50 +00004124 break;
4125
Chris Lattner740e7092008-10-15 06:16:57 +00004126 case 126:
Nuno Lopes19830332008-11-04 14:28:33 +00004127#line 1303 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner9fc4da42008-10-08 06:44:45 +00004128 { (yyval.Attributes) = Attribute::AlwaysInline; ;}
Devang Patel652203f2008-09-29 20:49:50 +00004129 break;
4130
Chris Lattner740e7092008-10-15 06:16:57 +00004131 case 127:
Nuno Lopes19830332008-11-04 14:28:33 +00004132#line 1304 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner9fc4da42008-10-08 06:44:45 +00004133 { (yyval.Attributes) = Attribute::OptimizeForSize; ;}
Devang Patel652203f2008-09-29 20:49:50 +00004134 break;
4135
Chris Lattner740e7092008-10-15 06:16:57 +00004136 case 128:
Nuno Lopes19830332008-11-04 14:28:33 +00004137#line 1307 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00004138 { (yyval.Attributes) = Attribute::None; ;}
4139 break;
4140
Chris Lattner740e7092008-10-15 06:16:57 +00004141 case 129:
Nuno Lopes19830332008-11-04 14:28:33 +00004142#line 1308 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004143 {
Devang Patel05988662008-09-25 21:00:45 +00004144 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
Chris Lattner15bd0952008-08-29 17:20:18 +00004145 ;}
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004146 break;
4147
Chris Lattner740e7092008-10-15 06:16:57 +00004148 case 130:
Nuno Lopes19830332008-11-04 14:28:33 +00004149#line 1314 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld4980812008-09-02 20:52:40 +00004150 { (yyval.StrVal) = 0; ;}
4151 break;
4152
Chris Lattner740e7092008-10-15 06:16:57 +00004153 case 131:
Nuno Lopes19830332008-11-04 14:28:33 +00004154#line 1315 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004155 {
4156 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
4157 ;}
4158 break;
4159
Chris Lattner740e7092008-10-15 06:16:57 +00004160 case 132:
Nuno Lopes19830332008-11-04 14:28:33 +00004161#line 1322 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004162 { (yyval.UIntVal) = 0; ;}
4163 break;
4164
Chris Lattner740e7092008-10-15 06:16:57 +00004165 case 133:
Nuno Lopes19830332008-11-04 14:28:33 +00004166#line 1323 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004167 {
4168 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
4169 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004170 GEN_ERROR("Alignment must be a power of two");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004171 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004172;}
4173 break;
4174
Chris Lattner740e7092008-10-15 06:16:57 +00004175 case 134:
Nuno Lopes19830332008-11-04 14:28:33 +00004176#line 1329 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004177 { (yyval.UIntVal) = 0; ;}
4178 break;
4179
Chris Lattner740e7092008-10-15 06:16:57 +00004180 case 135:
Nuno Lopes19830332008-11-04 14:28:33 +00004181#line 1330 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004182 {
4183 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
4184 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Christopher Lambbf3348d2007-12-12 08:45:45 +00004185 GEN_ERROR("Alignment must be a power of two");
4186 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004187;}
4188 break;
4189
Chris Lattner740e7092008-10-15 06:16:57 +00004190 case 136:
Nuno Lopes19830332008-11-04 14:28:33 +00004191#line 1339 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004192 {
4193 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
4194 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004195 GEN_ERROR("Invalid character in section name");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004196 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004197 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004198;}
4199 break;
4200
Chris Lattner740e7092008-10-15 06:16:57 +00004201 case 137:
Nuno Lopes19830332008-11-04 14:28:33 +00004202#line 1347 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004203 { (yyval.StrVal) = 0; ;}
4204 break;
4205
Chris Lattner740e7092008-10-15 06:16:57 +00004206 case 138:
Nuno Lopes19830332008-11-04 14:28:33 +00004207#line 1348 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004208 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
4209 break;
4210
Chris Lattner740e7092008-10-15 06:16:57 +00004211 case 139:
Nuno Lopesf05ff662008-10-15 11:20:21 +00004212#line 1353 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes8a5f3472008-10-15 12:05:02 +00004213 {;}
4214 break;
4215
Nuno Lopes19830332008-11-04 14:28:33 +00004216 case 140:
Nuno Lopes8a5f3472008-10-15 12:05:02 +00004217#line 1354 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes19830332008-11-04 14:28:33 +00004218 {;}
4219 break;
4220
4221 case 141:
4222#line 1355 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004223 {
4224 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
4225 delete (yyvsp[(1) - (1)].StrVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004226 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004227 ;}
4228 break;
4229
Chris Lattner740e7092008-10-15 06:16:57 +00004230 case 142:
Nuno Lopes19830332008-11-04 14:28:33 +00004231#line 1360 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004232 {
4233 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004234 GEN_ERROR("Alignment must be a power of two");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004235 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004236 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004237 ;}
4238 break;
4239
Chris Lattner740e7092008-10-15 06:16:57 +00004240 case 150:
Nuno Lopes19830332008-11-04 14:28:33 +00004241#line 1376 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004242 {
4243 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004244 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004245 ;}
4246 break;
4247
Chris Lattner740e7092008-10-15 06:16:57 +00004248 case 151:
Nuno Lopes19830332008-11-04 14:28:33 +00004249#line 1380 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004250 {
4251 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004252 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004253 ;}
4254 break;
4255
Chris Lattner740e7092008-10-15 06:16:57 +00004256 case 152:
Nuno Lopes19830332008-11-04 14:28:33 +00004257#line 1384 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004258 { // Pointer type?
4259 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
Christopher Lambbf3348d2007-12-12 08:45:45 +00004260 GEN_ERROR("Cannot form a pointer to a basic block");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004261 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4262 delete (yyvsp[(1) - (3)].TypeVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00004263 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004264 ;}
4265 break;
4266
Chris Lattner740e7092008-10-15 06:16:57 +00004267 case 153:
Nuno Lopes19830332008-11-04 14:28:33 +00004268#line 1391 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004269 { // Named types are also simple types...
4270 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00004271 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004272 (yyval.TypeVal) = new PATypeHolder(tmp);
4273 ;}
4274 break;
4275
Chris Lattner740e7092008-10-15 06:16:57 +00004276 case 154:
Nuno Lopes19830332008-11-04 14:28:33 +00004277#line 1396 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004278 { // Type UpReference
4279 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004280 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Dan Gohmanf4423b12008-04-19 00:24:39 +00004281 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4282 (yyval.TypeVal) = new PATypeHolder(OT);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004283 UR_OUT("New Upreference!\n");
4284 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004285 ;}
4286 break;
4287
Chris Lattner740e7092008-10-15 06:16:57 +00004288 case 155:
Nuno Lopes19830332008-11-04 14:28:33 +00004289#line 1404 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004290 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004291 // Allow but ignore attributes on function types; this permits auto-upgrade.
4292 // FIXME: remove in LLVM 3.0.
Chris Lattnera925a142008-04-23 05:37:08 +00004293 const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal);
4294 if (!FunctionType::isValidReturnType(RetTy))
4295 GEN_ERROR("Invalid result type for LLVM function");
Eric Christopher2a5196f2008-09-24 04:55:49 +00004296
Reid Spencer41dff5e2007-01-26 08:05:27 +00004297 std::vector<const Type*> Params;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004298 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00004299 for (; I != E; ++I ) {
Reid Spencer66728ef2007-03-20 01:13:36 +00004300 const Type *Ty = I->Ty->get();
Reid Spencer66728ef2007-03-20 01:13:36 +00004301 Params.push_back(Ty);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004302 }
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004303
Reid Spencer41dff5e2007-01-26 08:05:27 +00004304 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4305 if (isVarArg) Params.pop_back();
4306
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004307 for (unsigned i = 0; i != Params.size(); ++i)
4308 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4309 GEN_ERROR("Function arguments must be value types!");
4310
4311 CHECK_FOR_ERROR
4312
Anton Korobeynikovc36284e2007-12-03 19:17:47 +00004313 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004314 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
Eric Christopher2a5196f2008-09-24 04:55:49 +00004315 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Nuno Lopes8a88a372008-10-05 16:49:34 +00004316
4317 // Delete the argument list
4318 for (I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin() ; I != E; ++I ) {
4319 delete I->Ty;
4320 }
4321 delete (yyvsp[(3) - (5)].TypeWithAttrsList);
4322
Reid Spencere4d87aa2006-12-23 06:05:41 +00004323 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004324 ;}
4325 break;
4326
Chris Lattner740e7092008-10-15 06:16:57 +00004327 case 156:
Nuno Lopes19830332008-11-04 14:28:33 +00004328#line 1439 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004329 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004330 // Allow but ignore attributes on function types; this permits auto-upgrade.
4331 // FIXME: remove in LLVM 3.0.
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004332 std::vector<const Type*> Params;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004333 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00004334 for ( ; I != E; ++I ) {
Reid Spencer66728ef2007-03-20 01:13:36 +00004335 const Type* Ty = I->Ty->get();
Reid Spencer66728ef2007-03-20 01:13:36 +00004336 Params.push_back(Ty);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004337 }
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004338
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004339 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4340 if (isVarArg) Params.pop_back();
4341
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004342 for (unsigned i = 0; i != Params.size(); ++i)
4343 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4344 GEN_ERROR("Function arguments must be value types!");
4345
4346 CHECK_FOR_ERROR
4347
Dan Gohmanf4423b12008-04-19 00:24:39 +00004348 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
Eric Christopher2a5196f2008-09-24 04:55:49 +00004349 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Nuno Lopes8a88a372008-10-05 16:49:34 +00004350
4351 // Delete the argument list
4352 for (I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin() ; I != E; ++I ) {
4353 delete I->Ty;
4354 }
4355 delete (yyvsp[(3) - (5)].TypeWithAttrsList);
4356
Reid Spencer41dff5e2007-01-26 08:05:27 +00004357 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004358 ;}
4359 break;
4360
Chris Lattner740e7092008-10-15 06:16:57 +00004361 case 157:
Nuno Lopes19830332008-11-04 14:28:33 +00004362#line 1470 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004363 { // Sized array type?
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004364 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (yyvsp[(2) - (5)].UInt64Val))));
Dan Gohmanf4423b12008-04-19 00:24:39 +00004365 delete (yyvsp[(4) - (5)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004366 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004367 ;}
4368 break;
4369
Chris Lattner740e7092008-10-15 06:16:57 +00004370 case 158:
Nuno Lopes19830332008-11-04 14:28:33 +00004371#line 1475 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004372 { // Vector type?
4373 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4374 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004375 GEN_ERROR("Unsigned result not equal to signed result");
4376 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4377 GEN_ERROR("Element type of a VectorType must be primitive");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004378 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4379 delete (yyvsp[(4) - (5)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004380 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004381 ;}
4382 break;
4383
Chris Lattner740e7092008-10-15 06:16:57 +00004384 case 159:
Nuno Lopes19830332008-11-04 14:28:33 +00004385#line 1485 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004386 { // Structure type?
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004387 std::vector<const Type*> Elements;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004388 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4389 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004390 Elements.push_back(*I);
4391
Dan Gohmanf4423b12008-04-19 00:24:39 +00004392 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4393 delete (yyvsp[(2) - (3)].TypeList);
Reid Spencer14310612006-12-31 05:40:51 +00004394 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004395 ;}
4396 break;
4397
Chris Lattner740e7092008-10-15 06:16:57 +00004398 case 160:
Nuno Lopes19830332008-11-04 14:28:33 +00004399#line 1495 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004400 { // Empty structure type?
4401 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Reid Spencer14310612006-12-31 05:40:51 +00004402 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004403 ;}
4404 break;
4405
Chris Lattner740e7092008-10-15 06:16:57 +00004406 case 161:
Nuno Lopes19830332008-11-04 14:28:33 +00004407#line 1499 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004408 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004409 std::vector<const Type*> Elements;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004410 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4411 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004412 Elements.push_back(*I);
4413
Dan Gohmanf4423b12008-04-19 00:24:39 +00004414 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4415 delete (yyvsp[(3) - (5)].TypeList);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004416 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004417 ;}
4418 break;
4419
Chris Lattner740e7092008-10-15 06:16:57 +00004420 case 162:
Nuno Lopes19830332008-11-04 14:28:33 +00004421#line 1509 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004422 { // Empty structure type?
4423 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004424 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004425 ;}
4426 break;
4427
Chris Lattner740e7092008-10-15 06:16:57 +00004428 case 163:
Nuno Lopes19830332008-11-04 14:28:33 +00004429#line 1516 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004430 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004431 // Allow but ignore attributes on function types; this permits auto-upgrade.
4432 // FIXME: remove in LLVM 3.0.
Eric Christopher2a5196f2008-09-24 04:55:49 +00004433 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
Devang Patel05988662008-09-25 21:00:45 +00004434 (yyval.TypeWithAttrs).Attrs = Attribute::None;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004435 ;}
4436 break;
4437
Chris Lattner740e7092008-10-15 06:16:57 +00004438 case 164:
Nuno Lopes19830332008-11-04 14:28:33 +00004439#line 1525 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004440 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004441 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004442 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4443 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004444 GEN_ERROR("LLVM functions cannot return aggregate types");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004445 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4446 ;}
4447 break;
4448
Chris Lattner740e7092008-10-15 06:16:57 +00004449 case 165:
Nuno Lopes19830332008-11-04 14:28:33 +00004450#line 1532 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004451 {
4452 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4453 ;}
4454 break;
4455
Chris Lattner740e7092008-10-15 06:16:57 +00004456 case 166:
Nuno Lopes19830332008-11-04 14:28:33 +00004457#line 1537 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004458 {
4459 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4460 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
Reid Spencer3da59db2006-11-27 01:05:10 +00004461 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004462 ;}
4463 break;
4464
Chris Lattner740e7092008-10-15 06:16:57 +00004465 case 167:
Nuno Lopes19830332008-11-04 14:28:33 +00004466#line 1542 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004467 {
4468 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004469 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004470 ;}
4471 break;
4472
Chris Lattner740e7092008-10-15 06:16:57 +00004473 case 169:
Nuno Lopes19830332008-11-04 14:28:33 +00004474#line 1550 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004475 {
4476 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
Devang Patel05988662008-09-25 21:00:45 +00004477 TypeWithAttrs TWA; TWA.Attrs = Attribute::None;
Reid Spencer41dff5e2007-01-26 08:05:27 +00004478 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004479 (yyval.TypeWithAttrsList)->push_back(TWA);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004480 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004481 ;}
4482 break;
4483
Chris Lattner740e7092008-10-15 06:16:57 +00004484 case 170:
Nuno Lopes19830332008-11-04 14:28:33 +00004485#line 1557 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004486 {
4487 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
Devang Patel05988662008-09-25 21:00:45 +00004488 TypeWithAttrs TWA; TWA.Attrs = Attribute::None;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004489 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004490 (yyval.TypeWithAttrsList)->push_back(TWA);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004491 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004492 ;}
4493 break;
4494
Chris Lattner740e7092008-10-15 06:16:57 +00004495 case 171:
Nuno Lopes19830332008-11-04 14:28:33 +00004496#line 1564 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004497 {
4498 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004499 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004500 ;}
4501 break;
4502
Chris Lattner740e7092008-10-15 06:16:57 +00004503 case 172:
Nuno Lopes19830332008-11-04 14:28:33 +00004504#line 1572 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004505 {
4506 (yyval.TypeList) = new std::list<PATypeHolder>();
Eric Christopher2a5196f2008-09-24 04:55:49 +00004507 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
Dan Gohmanf4423b12008-04-19 00:24:39 +00004508 delete (yyvsp[(1) - (1)].TypeVal);
Reid Spencer3da59db2006-11-27 01:05:10 +00004509 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004510 ;}
4511 break;
4512
Chris Lattner740e7092008-10-15 06:16:57 +00004513 case 173:
Nuno Lopes19830332008-11-04 14:28:33 +00004514#line 1578 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004515 {
Eric Christopher2a5196f2008-09-24 04:55:49 +00004516 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
Dan Gohmanf4423b12008-04-19 00:24:39 +00004517 delete (yyvsp[(3) - (3)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004518 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004519 ;}
4520 break;
4521
Chris Lattner740e7092008-10-15 06:16:57 +00004522 case 174:
Nuno Lopes19830332008-11-04 14:28:33 +00004523#line 1590 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004524 { // Nonempty unsized arr
Reid Spencer14310612006-12-31 05:40:51 +00004525 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004526 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4527 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004528 if (ATy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004529 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004530 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004531 const Type *ETy = ATy->getElementType();
Dan Gohman180c1692008-06-23 18:43:26 +00004532 uint64_t NumElements = ATy->getNumElements();
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004533
4534 // Verify that we have the correct size...
Mon P Wang28873102008-06-25 08:15:39 +00004535 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (4)].ConstVector)->size())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004536 GEN_ERROR("Type mismatch: constant sized array initialized with " +
Eric Christopher2a5196f2008-09-24 04:55:49 +00004537 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Mon P Wang28873102008-06-25 08:15:39 +00004538 utostr(NumElements) + "");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004539
4540 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004541 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4542 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Eric Christopher2a5196f2008-09-24 04:55:49 +00004543 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004544 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohmanf4423b12008-04-19 00:24:39 +00004545 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004546 }
4547
Dan Gohmanf4423b12008-04-19 00:24:39 +00004548 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4549 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004550 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004551 ;}
4552 break;
4553
Chris Lattner740e7092008-10-15 06:16:57 +00004554 case 175:
Nuno Lopes19830332008-11-04 14:28:33 +00004555#line 1618 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004556 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004557 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004558 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4559 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004560 if (ATy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004561 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004562 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004563
Dan Gohman180c1692008-06-23 18:43:26 +00004564 uint64_t NumElements = ATy->getNumElements();
Eric Christopher2a5196f2008-09-24 04:55:49 +00004565 if (NumElements != uint64_t(-1) && NumElements != 0)
Andrew Lenharth6353e052006-12-08 18:07:09 +00004566 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
Mon P Wang28873102008-06-25 08:15:39 +00004567 " arguments, but has size of " + utostr(NumElements) +"");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004568 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4569 delete (yyvsp[(1) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00004570 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004571 ;}
4572 break;
4573
Chris Lattner740e7092008-10-15 06:16:57 +00004574 case 176:
Nuno Lopes19830332008-11-04 14:28:33 +00004575#line 1634 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004576 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004577 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004578 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4579 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004580 if (ATy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004581 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004582 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004583
Dan Gohman180c1692008-06-23 18:43:26 +00004584 uint64_t NumElements = ATy->getNumElements();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004585 const Type *ETy = ATy->getElementType();
Mon P Wang28873102008-06-25 08:15:39 +00004586 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (3)].StrVal)->length())
Eric Christopher2a5196f2008-09-24 04:55:49 +00004587 GEN_ERROR("Can't build string constant of size " +
Mon P Wang28873102008-06-25 08:15:39 +00004588 utostr((yyvsp[(3) - (3)].StrVal)->length()) +
4589 " when array has size " + utostr(NumElements) + "");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004590 std::vector<Constant*> Vals;
4591 if (ETy == Type::Int8Ty) {
Mon P Wang28873102008-06-25 08:15:39 +00004592 for (uint64_t i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
Dan Gohmanf4423b12008-04-19 00:24:39 +00004593 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004594 } else {
Dan Gohmanf4423b12008-04-19 00:24:39 +00004595 delete (yyvsp[(3) - (3)].StrVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004596 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4597 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004598 delete (yyvsp[(3) - (3)].StrVal);
4599 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4600 delete (yyvsp[(1) - (3)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004601 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004602 ;}
4603 break;
4604
Chris Lattner740e7092008-10-15 06:16:57 +00004605 case 177:
Nuno Lopes19830332008-11-04 14:28:33 +00004606#line 1661 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004607 { // Nonempty unsized arr
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004608 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004609 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4610 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004611 if (PTy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004612 GEN_ERROR("Cannot make packed constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004613 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004614 const Type *ETy = PTy->getElementType();
Dan Gohman180c1692008-06-23 18:43:26 +00004615 unsigned NumElements = PTy->getNumElements();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004616
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004617 // Verify that we have the correct size...
Mon P Wang28873102008-06-25 08:15:39 +00004618 if (NumElements != unsigned(-1) && NumElements != (unsigned)(yyvsp[(3) - (4)].ConstVector)->size())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004619 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
Eric Christopher2a5196f2008-09-24 04:55:49 +00004620 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Mon P Wang28873102008-06-25 08:15:39 +00004621 utostr(NumElements) + "");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004622
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004623 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004624 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4625 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Eric Christopher2a5196f2008-09-24 04:55:49 +00004626 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004627 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohmanf4423b12008-04-19 00:24:39 +00004628 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004629 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00004630
Dan Gohmanf4423b12008-04-19 00:24:39 +00004631 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4632 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004633 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004634 ;}
4635 break;
4636
Chris Lattner740e7092008-10-15 06:16:57 +00004637 case 178:
Nuno Lopes19830332008-11-04 14:28:33 +00004638#line 1689 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004639 {
4640 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004641 if (STy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004642 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004643 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004644
Dan Gohmanf4423b12008-04-19 00:24:39 +00004645 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004646 GEN_ERROR("Illegal number of initializers for structure type");
4647
4648 // Check to ensure that constants are compatible with the type initializer!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004649 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4650 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004651 GEN_ERROR("Expected type '" +
4652 STy->getElementType(i)->getDescription() +
4653 "' for element #" + utostr(i) +
4654 " of structure initializer");
4655
4656 // Check to ensure that Type is not packed
4657 if (STy->isPacked())
4658 GEN_ERROR("Unpacked Initializer to vector type '" +
4659 STy->getDescription() + "'");
4660
Dan Gohmanf4423b12008-04-19 00:24:39 +00004661 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4662 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004663 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004664 ;}
4665 break;
4666
Chris Lattner740e7092008-10-15 06:16:57 +00004667 case 179:
Nuno Lopes19830332008-11-04 14:28:33 +00004668#line 1715 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004669 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004670 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004671 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4672 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004673 if (STy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004674 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004675 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004676
4677 if (STy->getNumContainedTypes() != 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00004678 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004679
4680 // Check to ensure that Type is not packed
4681 if (STy->isPacked())
Chris Lattner6cdc6822007-04-26 05:31:05 +00004682 GEN_ERROR("Unpacked Initializer to vector type '" +
4683 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004684
Dan Gohmanf4423b12008-04-19 00:24:39 +00004685 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4686 delete (yyvsp[(1) - (3)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004687 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004688 ;}
4689 break;
4690
Chris Lattner740e7092008-10-15 06:16:57 +00004691 case 180:
Nuno Lopes19830332008-11-04 14:28:33 +00004692#line 1735 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004693 {
4694 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004695 if (STy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004696 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004697 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004698
Dan Gohmanf4423b12008-04-19 00:24:39 +00004699 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
Reid Spencerb5334b02007-02-05 10:18:06 +00004700 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004701
4702 // Check to ensure that constants are compatible with the type initializer!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004703 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4704 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
Reid Spencer41dff5e2007-01-26 08:05:27 +00004705 GEN_ERROR("Expected type '" +
4706 STy->getElementType(i)->getDescription() +
4707 "' for element #" + utostr(i) +
Reid Spencerb5334b02007-02-05 10:18:06 +00004708 " of structure initializer");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004709
4710 // Check to ensure that Type is packed
4711 if (!STy->isPacked())
Eric Christopher2a5196f2008-09-24 04:55:49 +00004712 GEN_ERROR("Vector initializer to non-vector type '" +
Chris Lattner32980692007-02-19 07:44:24 +00004713 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004714
Dan Gohmanf4423b12008-04-19 00:24:39 +00004715 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4716 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004717 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004718 ;}
4719 break;
4720
Chris Lattner740e7092008-10-15 06:16:57 +00004721 case 181:
Nuno Lopes19830332008-11-04 14:28:33 +00004722#line 1761 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004723 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004724 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004725 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4726 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004727 if (STy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004728 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004729 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004730
4731 if (STy->getNumContainedTypes() != 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00004732 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004733
4734 // Check to ensure that Type is packed
4735 if (!STy->isPacked())
Eric Christopher2a5196f2008-09-24 04:55:49 +00004736 GEN_ERROR("Vector initializer to non-vector type '" +
Chris Lattner32980692007-02-19 07:44:24 +00004737 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004738
Dan Gohmanf4423b12008-04-19 00:24:39 +00004739 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4740 delete (yyvsp[(1) - (5)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004741 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004742 ;}
4743 break;
4744
Chris Lattner740e7092008-10-15 06:16:57 +00004745 case 182:
Nuno Lopes19830332008-11-04 14:28:33 +00004746#line 1781 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004747 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004748 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004749 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4750 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004751 if (PTy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004752 GEN_ERROR("Cannot make null pointer constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004753 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004754
Dan Gohmanf4423b12008-04-19 00:24:39 +00004755 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4756 delete (yyvsp[(1) - (2)].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004757 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004758 ;}
4759 break;
4760
Chris Lattner740e7092008-10-15 06:16:57 +00004761 case 183:
Nuno Lopes19830332008-11-04 14:28:33 +00004762#line 1793 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004763 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004764 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004765 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4766 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4767 delete (yyvsp[(1) - (2)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004768 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004769 ;}
4770 break;
4771
Chris Lattner740e7092008-10-15 06:16:57 +00004772 case 184:
Nuno Lopes19830332008-11-04 14:28:33 +00004773#line 1800 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004774 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004775 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004776 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4777 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004778 if (Ty == 0)
Dan Gohmanf4423b12008-04-19 00:24:39 +00004779 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004780
4781 // ConstExprs can exist in the body of a function, thus creating
4782 // GlobalValues whenever they refer to a variable. Because we are in
Reid Spencer93c40032007-03-19 18:40:50 +00004783 // the context of a function, getExistingVal will search the functions
Reid Spencer68a24bd2005-08-27 18:50:39 +00004784 // symbol table instead of the module symbol table for the global symbol,
4785 // which throws things all off. To get around this, we just tell
Reid Spencer93c40032007-03-19 18:40:50 +00004786 // getExistingVal that we are at global scope here.
Reid Spencer68a24bd2005-08-27 18:50:39 +00004787 //
4788 Function *SavedCurFn = CurFun.CurrentFunction;
4789 CurFun.CurrentFunction = 0;
4790
Dan Gohmanf4423b12008-04-19 00:24:39 +00004791 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00004792 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00004793
4794 CurFun.CurrentFunction = SavedCurFn;
4795
4796 // If this is an initializer for a constant pointer, which is referencing a
4797 // (currently) undefined variable, create a stub now that shall be replaced
4798 // in the future with the right type of variable.
4799 //
4800 if (V == 0) {
Reid Spencera9720f52007-02-05 17:04:00 +00004801 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004802 const PointerType *PT = cast<PointerType>(Ty);
4803
4804 // First check to see if the forward references value is already created!
4805 PerModuleInfo::GlobalRefsType::iterator I =
Dan Gohmanf4423b12008-04-19 00:24:39 +00004806 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
Eric Christopher2a5196f2008-09-24 04:55:49 +00004807
Reid Spencer68a24bd2005-08-27 18:50:39 +00004808 if (I != CurModule.GlobalRefs.end()) {
4809 V = I->second; // Placeholder already exists, use it...
Dan Gohmanf4423b12008-04-19 00:24:39 +00004810 (yyvsp[(2) - (2)].ValIDVal).destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +00004811 } else {
4812 std::string Name;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004813 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4814 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4815 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
Reid Spencer41dff5e2007-01-26 08:05:27 +00004816 GEN_ERROR("Invalid reference to global");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004817
4818 // Create the forward referenced global.
4819 GlobalValue *GV;
Eric Christopher2a5196f2008-09-24 04:55:49 +00004820 if (const FunctionType *FTy =
Reid Spencer68a24bd2005-08-27 18:50:39 +00004821 dyn_cast<FunctionType>(PT->getElementType())) {
Gabor Greife64d2482008-04-06 23:07:54 +00004822 GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
4823 CurModule.CurrentModule);
Reid Spencer68a24bd2005-08-27 18:50:39 +00004824 } else {
4825 GV = new GlobalVariable(PT->getElementType(), false,
Chris Lattner6cdc6822007-04-26 05:31:05 +00004826 GlobalValue::ExternalWeakLinkage, 0,
Reid Spencer68a24bd2005-08-27 18:50:39 +00004827 Name, CurModule.CurrentModule);
4828 }
4829
4830 // Keep track of the fact that we have a forward ref to recycle it
Dan Gohmanf4423b12008-04-19 00:24:39 +00004831 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004832 V = GV;
4833 }
4834 }
4835
Dan Gohmanf4423b12008-04-19 00:24:39 +00004836 (yyval.ConstVal) = cast<GlobalValue>(V);
4837 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
Reid Spencer61c83e02006-08-18 08:43:06 +00004838 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004839 ;}
4840 break;
4841
Chris Lattner740e7092008-10-15 06:16:57 +00004842 case 185:
Nuno Lopes19830332008-11-04 14:28:33 +00004843#line 1866 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004844 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004845 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004846 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4847 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
Eric Christopher2a5196f2008-09-24 04:55:49 +00004848 GEN_ERROR("Mismatched types for constant expression: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004849 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4850 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4851 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004852 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004853 ;}
4854 break;
4855
Chris Lattner740e7092008-10-15 06:16:57 +00004856 case 186:
Nuno Lopes19830332008-11-04 14:28:33 +00004857#line 1876 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004858 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004859 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004860 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4861 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004862 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4863 GEN_ERROR("Cannot create a null initialized value of this type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004864 (yyval.ConstVal) = Constant::getNullValue(Ty);
4865 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004866 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004867 ;}
4868 break;
4869
Chris Lattner740e7092008-10-15 06:16:57 +00004870 case 187:
Nuno Lopes19830332008-11-04 14:28:33 +00004871#line 1886 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004872 { // integral constants
Chris Lattner740e7092008-10-15 06:16:57 +00004873 if (IntegerType *IT = dyn_cast<IntegerType>((yyvsp[(1) - (2)].TypeVal)->get())) {
4874 if (!ConstantInt::isValueValidForType(IT, (yyvsp[(2) - (2)].SInt64Val)))
4875 GEN_ERROR("Constant value doesn't fit in type");
4876 (yyval.ConstVal) = ConstantInt::get(IT, (yyvsp[(2) - (2)].SInt64Val), true);
4877 } else {
4878 GEN_ERROR("integer constant must have integer type");
4879 }
4880 delete (yyvsp[(1) - (2)].TypeVal);
4881 CHECK_FOR_ERROR
4882 ;}
4883 break;
4884
4885 case 188:
Nuno Lopes19830332008-11-04 14:28:33 +00004886#line 1897 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00004887 { // arbitrary precision integer constants
4888 if (IntegerType *IT = dyn_cast<IntegerType>((yyvsp[(1) - (2)].TypeVal)->get())) {
4889 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > IT->getBitWidth())
4890 GEN_ERROR("Constant value does not fit in type");
4891 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(IT->getBitWidth());
4892 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4893 } else {
4894 GEN_ERROR("integer constant must have integer type");
4895 }
4896 delete (yyvsp[(1) - (2)].TypeVal);
4897 delete (yyvsp[(2) - (2)].APIntVal);
4898 CHECK_FOR_ERROR
4899 ;}
4900 break;
4901
4902 case 189:
Nuno Lopes19830332008-11-04 14:28:33 +00004903#line 1910 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00004904 { // integral constants
4905 if (IntegerType *IT = dyn_cast<IntegerType>((yyvsp[(1) - (2)].TypeVal)->get())) {
4906 if (!ConstantInt::isValueValidForType(IT, (yyvsp[(2) - (2)].UInt64Val)))
4907 GEN_ERROR("Constant value doesn't fit in type");
4908 (yyval.ConstVal) = ConstantInt::get(IT, (yyvsp[(2) - (2)].UInt64Val), false);
4909 } else {
4910 GEN_ERROR("integer constant must have integer type");
4911 }
4912 delete (yyvsp[(1) - (2)].TypeVal);
4913 CHECK_FOR_ERROR
4914 ;}
4915 break;
4916
4917 case 190:
Nuno Lopes19830332008-11-04 14:28:33 +00004918#line 1921 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00004919 { // arbitrary precision integer constants
4920 if (IntegerType *IT = dyn_cast<IntegerType>((yyvsp[(1) - (2)].TypeVal)->get())) {
4921 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > IT->getBitWidth())
4922 GEN_ERROR("Constant value does not fit in type");
4923 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(IT->getBitWidth());
4924 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4925 } else {
4926 GEN_ERROR("integer constant must have integer type");
4927 }
4928
4929 delete (yyvsp[(2) - (2)].APIntVal);
4930 delete (yyvsp[(1) - (2)].TypeVal);
4931 CHECK_FOR_ERROR
4932 ;}
4933 break;
4934
4935 case 191:
Nuno Lopes19830332008-11-04 14:28:33 +00004936#line 1935 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00004937 { // Boolean constants
4938 if ((yyvsp[(1) - (2)].TypeVal)->get() != Type::Int1Ty)
4939 GEN_ERROR("Constant true must have type i1");
4940 (yyval.ConstVal) = ConstantInt::getTrue();
4941 delete (yyvsp[(1) - (2)].TypeVal);
4942 CHECK_FOR_ERROR
4943 ;}
4944 break;
4945
4946 case 192:
Nuno Lopes19830332008-11-04 14:28:33 +00004947#line 1942 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00004948 { // Boolean constants
4949 if ((yyvsp[(1) - (2)].TypeVal)->get() != Type::Int1Ty)
4950 GEN_ERROR("Constant false must have type i1");
4951 (yyval.ConstVal) = ConstantInt::getFalse();
4952 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer38c91a92007-02-28 02:24:54 +00004953 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004954 ;}
4955 break;
4956
Chris Lattnerf9078f92008-10-15 06:03:48 +00004957 case 193:
Nuno Lopes19830332008-11-04 14:28:33 +00004958#line 1949 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004959 { // Floating point constants
Chris Lattner740e7092008-10-15 06:16:57 +00004960 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].TypeVal)->get(), *(yyvsp[(2) - (2)].FPVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004961 GEN_ERROR("Floating point constant invalid for type");
Chris Lattner740e7092008-10-15 06:16:57 +00004962
Eric Christopher2a5196f2008-09-24 04:55:49 +00004963 // Lexer has no type info, so builds all float and double FP constants
Dale Johannesenc72cd7e2007-09-11 18:33:39 +00004964 // as double. Fix this here. Long double is done right.
Chris Lattner740e7092008-10-15 06:16:57 +00004965 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].TypeVal)->get()==Type::FloatTy) {
Dale Johannesen236bbd42008-10-09 23:01:34 +00004966 bool ignored;
4967 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven,
4968 &ignored);
4969 }
Chris Lattnerd8eb63f2008-04-20 00:41:19 +00004970 (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal));
Chris Lattner740e7092008-10-15 06:16:57 +00004971 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004972 delete (yyvsp[(2) - (2)].FPVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004973 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004974 ;}
4975 break;
4976
Chris Lattner740e7092008-10-15 06:16:57 +00004977 case 194:
Nuno Lopes19830332008-11-04 14:28:33 +00004978#line 1967 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004979 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004980 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004981 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4982 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4983 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4984 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004985 GEN_ERROR("invalid cast opcode for cast from '" +
4986 Val->getType()->getDescription() + "' to '" +
Eric Christopher2a5196f2008-09-24 04:55:49 +00004987 DestTy->getDescription() + "'");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004988 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4989 delete (yyvsp[(5) - (6)].TypeVal);
4990 ;}
4991 break;
4992
Chris Lattner740e7092008-10-15 06:16:57 +00004993 case 195:
Nuno Lopes19830332008-11-04 14:28:33 +00004994#line 1979 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004995 {
4996 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
Reid Spencerb5334b02007-02-05 10:18:06 +00004997 GEN_ERROR("GetElementPtr requires a pointer operand");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004998
4999 const Type *IdxTy =
Dan Gohman041e2eb2008-05-15 19:50:34 +00005000 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005001 if (!IdxTy)
Reid Spencerb5334b02007-02-05 10:18:06 +00005002 GEN_ERROR("Index list invalid for constant getelementptr");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005003
Chris Lattnerf7469af2007-01-31 04:44:08 +00005004 SmallVector<Constant*, 8> IdxVec;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005005 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
5006 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005007 IdxVec.push_back(C);
5008 else
Reid Spencerb5334b02007-02-05 10:18:06 +00005009 GEN_ERROR("Indices to constant getelementptr must be constants");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005010
Dan Gohmanf4423b12008-04-19 00:24:39 +00005011 delete (yyvsp[(4) - (5)].ValueList);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005012
Dan Gohmanf4423b12008-04-19 00:24:39 +00005013 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
Andrew Lenharth6353e052006-12-08 18:07:09 +00005014 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005015 ;}
5016 break;
5017
Chris Lattner740e7092008-10-15 06:16:57 +00005018 case 196:
Nuno Lopes19830332008-11-04 14:28:33 +00005019#line 2000 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005020 {
5021 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005022 GEN_ERROR("Select condition must be of boolean type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005023 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005024 GEN_ERROR("Select operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005025 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005026 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005027 ;}
5028 break;
5029
Chris Lattner740e7092008-10-15 06:16:57 +00005030 case 197:
Nuno Lopes19830332008-11-04 14:28:33 +00005031#line 2008 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005032 {
5033 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005034 GEN_ERROR("Binary operator types must match");
5035 CHECK_FOR_ERROR;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005036 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
5037 ;}
5038 break;
5039
Chris Lattner740e7092008-10-15 06:16:57 +00005040 case 198:
Nuno Lopes19830332008-11-04 14:28:33 +00005041#line 2014 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005042 {
5043 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005044 GEN_ERROR("Logical operator types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005045 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
Eric Christopher2a5196f2008-09-24 04:55:49 +00005046 if (!isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
Dan Gohmanf4423b12008-04-19 00:24:39 +00005047 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005048 GEN_ERROR("Logical operator requires integral operands");
5049 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00005050 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005051 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005052 ;}
5053 break;
5054
Chris Lattner740e7092008-10-15 06:16:57 +00005055 case 199:
Nuno Lopes19830332008-11-04 14:28:33 +00005056#line 2025 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005057 {
5058 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005059 GEN_ERROR("icmp operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005060 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5061 ;}
5062 break;
5063
Chris Lattner740e7092008-10-15 06:16:57 +00005064 case 200:
Nuno Lopes19830332008-11-04 14:28:33 +00005065#line 2030 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005066 {
5067 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005068 GEN_ERROR("fcmp operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005069 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5070 ;}
5071 break;
5072
Chris Lattner740e7092008-10-15 06:16:57 +00005073 case 201:
Nuno Lopes19830332008-11-04 14:28:33 +00005074#line 2035 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00005075 {
5076 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5077 GEN_ERROR("vicmp operand types must match");
5078 (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5079 ;}
5080 break;
5081
Chris Lattner740e7092008-10-15 06:16:57 +00005082 case 202:
Nuno Lopes19830332008-11-04 14:28:33 +00005083#line 2040 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00005084 {
5085 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5086 GEN_ERROR("vfcmp operand types must match");
5087 (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5088 ;}
5089 break;
5090
Chris Lattner740e7092008-10-15 06:16:57 +00005091 case 203:
Nuno Lopes19830332008-11-04 14:28:33 +00005092#line 2045 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005093 {
5094 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005095 GEN_ERROR("Invalid extractelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005096 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00005097 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005098 ;}
5099 break;
5100
Chris Lattner740e7092008-10-15 06:16:57 +00005101 case 204:
Nuno Lopes19830332008-11-04 14:28:33 +00005102#line 2051 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005103 {
5104 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005105 GEN_ERROR("Invalid insertelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005106 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00005107 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005108 ;}
5109 break;
5110
Chris Lattner740e7092008-10-15 06:16:57 +00005111 case 205:
Nuno Lopes19830332008-11-04 14:28:33 +00005112#line 2057 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005113 {
5114 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005115 GEN_ERROR("Invalid shufflevector operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005116 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00005117 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005118 ;}
5119 break;
5120
Chris Lattner740e7092008-10-15 06:16:57 +00005121 case 206:
Nuno Lopes19830332008-11-04 14:28:33 +00005122#line 2063 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005123 {
5124 if (!isa<StructType>((yyvsp[(3) - (5)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (5)].ConstVal)->getType()))
5125 GEN_ERROR("ExtractValue requires an aggregate operand");
5126
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005127 (yyval.ConstVal) = ConstantExpr::getExtractValue((yyvsp[(3) - (5)].ConstVal), &(*(yyvsp[(4) - (5)].ConstantList))[0], (yyvsp[(4) - (5)].ConstantList)->size());
5128 delete (yyvsp[(4) - (5)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00005129 CHECK_FOR_ERROR
5130 ;}
5131 break;
5132
Chris Lattner740e7092008-10-15 06:16:57 +00005133 case 207:
Nuno Lopes19830332008-11-04 14:28:33 +00005134#line 2071 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005135 {
5136 if (!isa<StructType>((yyvsp[(3) - (7)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (7)].ConstVal)->getType()))
5137 GEN_ERROR("InsertValue requires an aggregate operand");
5138
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005139 (yyval.ConstVal) = ConstantExpr::getInsertValue((yyvsp[(3) - (7)].ConstVal), (yyvsp[(5) - (7)].ConstVal), &(*(yyvsp[(6) - (7)].ConstantList))[0], (yyvsp[(6) - (7)].ConstantList)->size());
5140 delete (yyvsp[(6) - (7)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00005141 CHECK_FOR_ERROR
5142 ;}
5143 break;
5144
Chris Lattner740e7092008-10-15 06:16:57 +00005145 case 208:
Nuno Lopes19830332008-11-04 14:28:33 +00005146#line 2082 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005147 {
5148 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005149 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005150 ;}
5151 break;
5152
Chris Lattner740e7092008-10-15 06:16:57 +00005153 case 209:
Nuno Lopes19830332008-11-04 14:28:33 +00005154#line 2086 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005155 {
5156 (yyval.ConstVector) = new std::vector<Constant*>();
5157 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005158 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005159 ;}
5160 break;
5161
Chris Lattner740e7092008-10-15 06:16:57 +00005162 case 210:
Nuno Lopes19830332008-11-04 14:28:33 +00005163#line 2094 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005164 { (yyval.BoolVal) = false; ;}
Nate Begemanac80ade2008-05-12 19:01:56 +00005165 break;
5166
Chris Lattner740e7092008-10-15 06:16:57 +00005167 case 211:
Nuno Lopes19830332008-11-04 14:28:33 +00005168#line 2094 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerf9078f92008-10-15 06:03:48 +00005169 { (yyval.BoolVal) = true; ;}
5170 break;
5171
Chris Lattner740e7092008-10-15 06:16:57 +00005172 case 212:
Nuno Lopes19830332008-11-04 14:28:33 +00005173#line 2097 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00005174 { (yyval.BoolVal) = true; ;}
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005175 break;
5176
Chris Lattner740e7092008-10-15 06:16:57 +00005177 case 213:
Nuno Lopes19830332008-11-04 14:28:33 +00005178#line 2097 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00005179 { (yyval.BoolVal) = false; ;}
5180 break;
5181
Chris Lattner740e7092008-10-15 06:16:57 +00005182 case 214:
Nuno Lopes19830332008-11-04 14:28:33 +00005183#line 2100 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005184 {
5185 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
5186 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
Chris Lattner0275cff2007-08-06 21:00:46 +00005187 CHECK_FOR_ERROR
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005188 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
5189 if (!Aliasee)
5190 GEN_ERROR("Aliases can be created only to global values");
5191
Dan Gohmanf4423b12008-04-19 00:24:39 +00005192 (yyval.ConstVal) = Aliasee;
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005193 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005194 delete (yyvsp[(1) - (2)].TypeVal);
5195 ;}
5196 break;
5197
Chris Lattner740e7092008-10-15 06:16:57 +00005198 case 215:
Nuno Lopes19830332008-11-04 14:28:33 +00005199#line 2112 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005200 {
5201 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
5202 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
5203 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005204 GEN_ERROR("invalid cast opcode for cast from '" +
5205 Val->getType()->getDescription() + "' to '" +
5206 DestTy->getDescription() + "'");
Eric Christopher2a5196f2008-09-24 04:55:49 +00005207
Dan Gohmanf4423b12008-04-19 00:24:39 +00005208 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005209 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005210 delete (yyvsp[(5) - (6)].TypeVal);
5211 ;}
5212 break;
5213
Chris Lattner740e7092008-10-15 06:16:57 +00005214 case 216:
Nuno Lopes19830332008-11-04 14:28:33 +00005215#line 2133 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerf9078f92008-10-15 06:03:48 +00005216 {
5217 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5218 CurModule.ModuleDone();
5219 CHECK_FOR_ERROR;
5220 ;}
5221 break;
5222
Chris Lattner740e7092008-10-15 06:16:57 +00005223 case 217:
Nuno Lopes19830332008-11-04 14:28:33 +00005224#line 2138 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00005225 {
5226 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5227 CurModule.ModuleDone();
5228 CHECK_FOR_ERROR;
5229 ;}
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005230 break;
5231
Chris Lattner740e7092008-10-15 06:16:57 +00005232 case 220:
Nuno Lopes19830332008-11-04 14:28:33 +00005233#line 2151 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00005234 { CurFun.isDeclare = false; ;}
5235 break;
5236
Chris Lattner740e7092008-10-15 06:16:57 +00005237 case 221:
Nuno Lopes19830332008-11-04 14:28:33 +00005238#line 2151 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005239 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005240 CurFun.FunctionDone();
5241 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005242 ;}
5243 break;
5244
Chris Lattner740e7092008-10-15 06:16:57 +00005245 case 222:
Nuno Lopes19830332008-11-04 14:28:33 +00005246#line 2155 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005247 { CurFun.isDeclare = true; ;}
5248 break;
5249
Chris Lattner740e7092008-10-15 06:16:57 +00005250 case 223:
Nuno Lopes19830332008-11-04 14:28:33 +00005251#line 2155 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerf9078f92008-10-15 06:03:48 +00005252 {
5253 CHECK_FOR_ERROR
5254 ;}
5255 break;
5256
Chris Lattner740e7092008-10-15 06:16:57 +00005257 case 224:
Nuno Lopes19830332008-11-04 14:28:33 +00005258#line 2158 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00005259 {
5260 CHECK_FOR_ERROR
5261 ;}
5262 break;
5263
Chris Lattner740e7092008-10-15 06:16:57 +00005264 case 225:
Nuno Lopes19830332008-11-04 14:28:33 +00005265#line 2161 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005266 {
Reid Spencer14310612006-12-31 05:40:51 +00005267 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005268 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005269 // Eagerly resolve types. This is not an optimization, this is a
5270 // requirement that is due to the fact that we could have this:
5271 //
5272 // %list = type { %list * }
5273 // %list = type { %list * } ; repeated type decl
5274 //
5275 // If types are not resolved eagerly, then the two types will not be
5276 // determined to be the same type!
5277 //
Dan Gohmanf4423b12008-04-19 00:24:39 +00005278 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005279
Dan Gohmanf4423b12008-04-19 00:24:39 +00005280 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Reid Spencer5b7e7532006-09-28 19:28:24 +00005281 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005282 // If this is a named type that is not a redefinition, add it to the slot
5283 // table.
Dan Gohmanf4423b12008-04-19 00:24:39 +00005284 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005285 }
Reid Spencera132e042006-12-03 05:46:11 +00005286
Dan Gohmanf4423b12008-04-19 00:24:39 +00005287 delete (yyvsp[(3) - (3)].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005288 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005289 ;}
5290 break;
Reid Spencerb8f85052007-07-31 03:50:36 +00005291
Chris Lattner740e7092008-10-15 06:16:57 +00005292 case 226:
Nuno Lopes19830332008-11-04 14:28:33 +00005293#line 2185 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005294 {
5295 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
5296
5297 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005298 CHECK_FOR_ERROR
5299 // If this is a named type that is not a redefinition, add it to the slot
5300 // table.
Dan Gohmanf4423b12008-04-19 00:24:39 +00005301 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005302 }
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005303 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005304 ;}
5305 break;
5306
Chris Lattner740e7092008-10-15 06:16:57 +00005307 case 227:
Nuno Lopes19830332008-11-04 14:28:33 +00005308#line 2197 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Eric Christopher2a5196f2008-09-24 04:55:49 +00005309 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005310 /* "Externally Visible" Linkage */
Eric Christopher2a5196f2008-09-24 04:55:49 +00005311 if ((yyvsp[(5) - (6)].ConstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005312 GEN_ERROR("Global value initializer is not a constant");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005313 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5314 (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 +00005315 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005316 ;}
5317 break;
5318
Chris Lattner740e7092008-10-15 06:16:57 +00005319 case 228:
Nuno Lopes19830332008-11-04 14:28:33 +00005320#line 2204 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005321 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005322 CurGV = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005323 ;}
5324 break;
5325
Chris Lattner740e7092008-10-15 06:16:57 +00005326 case 229:
Nuno Lopes19830332008-11-04 14:28:33 +00005327#line 2208 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005328 {
Eric Christopher2a5196f2008-09-24 04:55:49 +00005329 if ((yyvsp[(6) - (7)].ConstVal) == 0)
Christopher Lambbf3348d2007-12-12 08:45:45 +00005330 GEN_ERROR("Global value initializer is not a constant");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005331 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 +00005332 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005333 ;}
5334 break;
5335
Chris Lattner740e7092008-10-15 06:16:57 +00005336 case 230:
Nuno Lopes19830332008-11-04 14:28:33 +00005337#line 2213 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005338 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005339 CurGV = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005340 ;}
5341 break;
5342
Chris Lattner740e7092008-10-15 06:16:57 +00005343 case 231:
Nuno Lopes19830332008-11-04 14:28:33 +00005344#line 2217 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005345 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005346 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005347 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5348 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 +00005349 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005350 delete (yyvsp[(6) - (7)].TypeVal);
5351 ;}
5352 break;
5353
Chris Lattner740e7092008-10-15 06:16:57 +00005354 case 232:
Nuno Lopes19830332008-11-04 14:28:33 +00005355#line 2223 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005356 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005357 CurGV = 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +00005358 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005359 ;}
5360 break;
5361
Chris Lattner740e7092008-10-15 06:16:57 +00005362 case 233:
Nuno Lopes19830332008-11-04 14:28:33 +00005363#line 2227 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005364 {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005365 std::string Name;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005366 if ((yyvsp[(1) - (5)].StrVal)) {
5367 Name = *(yyvsp[(1) - (5)].StrVal);
5368 delete (yyvsp[(1) - (5)].StrVal);
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005369 }
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005370 if (Name.empty())
5371 GEN_ERROR("Alias name cannot be empty");
Eric Christopher2a5196f2008-09-24 04:55:49 +00005372
Dan Gohmanf4423b12008-04-19 00:24:39 +00005373 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005374 if (Aliasee == 0)
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005375 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005376
Dan Gohmanf4423b12008-04-19 00:24:39 +00005377 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005378 CurModule.CurrentModule);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005379 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005380 InsertValue(GA, CurModule.Values);
Eric Christopher2a5196f2008-09-24 04:55:49 +00005381
5382
Chris Lattner569f7372007-09-10 23:24:14 +00005383 // If there was a forward reference of this alias, resolve it now.
Eric Christopher2a5196f2008-09-24 04:55:49 +00005384
Chris Lattner569f7372007-09-10 23:24:14 +00005385 ValID ID;
5386 if (!Name.empty())
5387 ID = ValID::createGlobalName(Name);
5388 else
5389 ID = ValID::createGlobalID(CurModule.Values.size()-1);
Eric Christopher2a5196f2008-09-24 04:55:49 +00005390
Chris Lattner569f7372007-09-10 23:24:14 +00005391 if (GlobalValue *FWGV =
5392 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5393 // Replace uses of the fwdref with the actual alias.
5394 FWGV->replaceAllUsesWith(GA);
5395 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5396 GV->eraseFromParent();
5397 else
5398 cast<Function>(FWGV)->eraseFromParent();
5399 }
5400 ID.destroy();
Eric Christopher2a5196f2008-09-24 04:55:49 +00005401
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005402 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005403 ;}
5404 break;
5405
Chris Lattner740e7092008-10-15 06:16:57 +00005406 case 234:
Nuno Lopes19830332008-11-04 14:28:33 +00005407#line 2267 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerf9078f92008-10-15 06:03:48 +00005408 {
5409 CHECK_FOR_ERROR
5410 ;}
5411 break;
5412
Chris Lattner740e7092008-10-15 06:16:57 +00005413 case 235:
Nuno Lopes19830332008-11-04 14:28:33 +00005414#line 2270 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Eric Christopher2a5196f2008-09-24 04:55:49 +00005415 {
Anton Korobeynikov77d0f972007-04-25 14:29:12 +00005416 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005417 ;}
5418 break;
5419
Chris Lattner740e7092008-10-15 06:16:57 +00005420 case 236:
Nuno Lopes19830332008-11-04 14:28:33 +00005421#line 2276 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005422 {
Chris Lattner66316012006-01-24 04:14:29 +00005423 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
Chris Lattner66316012006-01-24 04:14:29 +00005424 if (AsmSoFar.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005425 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
Chris Lattner66316012006-01-24 04:14:29 +00005426 else
Dan Gohmanf4423b12008-04-19 00:24:39 +00005427 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5428 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00005429 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005430;}
5431 break;
5432
Chris Lattner740e7092008-10-15 06:16:57 +00005433 case 237:
Nuno Lopes19830332008-11-04 14:28:33 +00005434#line 2286 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005435 {
5436 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5437 delete (yyvsp[(3) - (3)].StrVal);
5438 ;}
5439 break;
5440
Chris Lattner740e7092008-10-15 06:16:57 +00005441 case 238:
Nuno Lopes19830332008-11-04 14:28:33 +00005442#line 2290 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005443 {
5444 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5445 delete (yyvsp[(3) - (3)].StrVal);
5446 ;}
5447 break;
5448
Chris Lattner740e7092008-10-15 06:16:57 +00005449 case 240:
Nuno Lopes19830332008-11-04 14:28:33 +00005450#line 2297 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005451 {
5452 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5453 delete (yyvsp[(3) - (3)].StrVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00005454 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005455 ;}
5456 break;
5457
Chris Lattner740e7092008-10-15 06:16:57 +00005458 case 241:
Nuno Lopes19830332008-11-04 14:28:33 +00005459#line 2302 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005460 {
5461 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5462 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer1013b4d2007-07-31 14:41:17 +00005463 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005464 ;}
5465 break;
5466
Chris Lattner740e7092008-10-15 06:16:57 +00005467 case 242:
Nuno Lopes19830332008-11-04 14:28:33 +00005468#line 2307 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005469 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005470 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005471 ;}
5472 break;
5473
Chris Lattner740e7092008-10-15 06:16:57 +00005474 case 243:
Nuno Lopes19830332008-11-04 14:28:33 +00005475#line 2316 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005476 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005477 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005478 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005479 if (!(*(yyvsp[(3) - (5)].TypeVal))->isFirstClassType())
5480 GEN_ERROR("Argument types must be first-class");
Devang Patel05988662008-09-25 21:00:45 +00005481 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 +00005482 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5483 (yyvsp[(1) - (5)].ArgList)->push_back(E);
Reid Spencer6f407902007-01-13 05:00:46 +00005484 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005485 ;}
5486 break;
5487
Chris Lattner740e7092008-10-15 06:16:57 +00005488 case 244:
Nuno Lopes19830332008-11-04 14:28:33 +00005489#line 2326 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005490 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005491 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005492 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005493 if (!(*(yyvsp[(1) - (3)].TypeVal))->isFirstClassType())
5494 GEN_ERROR("Argument types must be first-class");
Devang Patel05988662008-09-25 21:00:45 +00005495 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 +00005496 (yyval.ArgList) = new ArgListType;
5497 (yyval.ArgList)->push_back(E);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005498 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005499 ;}
5500 break;
5501
Chris Lattner740e7092008-10-15 06:16:57 +00005502 case 245:
Nuno Lopes19830332008-11-04 14:28:33 +00005503#line 2337 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005504 {
5505 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005506 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005507 ;}
5508 break;
5509
Chris Lattner740e7092008-10-15 06:16:57 +00005510 case 246:
Nuno Lopes19830332008-11-04 14:28:33 +00005511#line 2341 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005512 {
5513 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005514 struct ArgListEntry E;
5515 E.Ty = new PATypeHolder(Type::VoidTy);
5516 E.Name = 0;
Devang Patel05988662008-09-25 21:00:45 +00005517 E.Attrs = Attribute::None;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005518 (yyval.ArgList)->push_back(E);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005519 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005520 ;}
5521 break;
5522
Chris Lattner740e7092008-10-15 06:16:57 +00005523 case 247:
Nuno Lopes19830332008-11-04 14:28:33 +00005524#line 2350 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005525 {
5526 (yyval.ArgList) = new ArgListType;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005527 struct ArgListEntry E;
5528 E.Ty = new PATypeHolder(Type::VoidTy);
5529 E.Name = 0;
Devang Patel05988662008-09-25 21:00:45 +00005530 E.Attrs = Attribute::None;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005531 (yyval.ArgList)->push_back(E);
Reid Spencer61c83e02006-08-18 08:43:06 +00005532 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005533 ;}
5534 break;
5535
Chris Lattner740e7092008-10-15 06:16:57 +00005536 case 248:
Nuno Lopes19830332008-11-04 14:28:33 +00005537#line 2359 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005538 {
5539 (yyval.ArgList) = 0;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005540 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005541 ;}
5542 break;
5543
Chris Lattner740e7092008-10-15 06:16:57 +00005544 case 249:
Nuno Lopes19830332008-11-04 14:28:33 +00005545#line 2365 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005546 {
Devang Patel652203f2008-09-29 20:49:50 +00005547 std::string FunctionName(*(yyvsp[(4) - (11)].StrVal));
5548 delete (yyvsp[(4) - (11)].StrVal); // Free strdup'd memory!
Eric Christopher2a5196f2008-09-24 04:55:49 +00005549
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005550 // Check the function result for abstractness if this is a define. We should
5551 // have no abstract types at this point
Devang Patel652203f2008-09-29 20:49:50 +00005552 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(3) - (11)].TypeVal)))
5553 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(3) - (11)].TypeVal)->get()->getDescription());
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005554
Devang Patel652203f2008-09-29 20:49:50 +00005555 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (11)].TypeVal)))
Chris Lattnera925a142008-04-23 05:37:08 +00005556 GEN_ERROR("Invalid result type for LLVM function");
Eric Christopher2a5196f2008-09-24 04:55:49 +00005557
Reid Spencer68a24bd2005-08-27 18:50:39 +00005558 std::vector<const Type*> ParamTypeList;
Devang Patel05988662008-09-25 21:00:45 +00005559 SmallVector<AttributeWithIndex, 8> Attrs;
Dale Johannesene7261862008-09-26 23:46:20 +00005560 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
5561 //attributes.
Devang Patel652203f2008-09-29 20:49:50 +00005562 Attributes RetAttrs = (yyvsp[(2) - (11)].Attributes);
5563 if ((yyvsp[(8) - (11)].Attributes) != Attribute::None) {
5564 if ((yyvsp[(8) - (11)].Attributes) & Attribute::ZExt) {
Dale Johannesene7261862008-09-26 23:46:20 +00005565 RetAttrs = RetAttrs | Attribute::ZExt;
Devang Patel652203f2008-09-29 20:49:50 +00005566 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::ZExt;
Dale Johannesene7261862008-09-26 23:46:20 +00005567 }
Devang Patel652203f2008-09-29 20:49:50 +00005568 if ((yyvsp[(8) - (11)].Attributes) & Attribute::SExt) {
Dale Johannesene7261862008-09-26 23:46:20 +00005569 RetAttrs = RetAttrs | Attribute::SExt;
Devang Patel652203f2008-09-29 20:49:50 +00005570 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::SExt;
Dale Johannesene7261862008-09-26 23:46:20 +00005571 }
Devang Patel652203f2008-09-29 20:49:50 +00005572 if ((yyvsp[(8) - (11)].Attributes) & Attribute::InReg) {
Dale Johannesene7261862008-09-26 23:46:20 +00005573 RetAttrs = RetAttrs | Attribute::InReg;
Devang Patel652203f2008-09-29 20:49:50 +00005574 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::InReg;
Dale Johannesene7261862008-09-26 23:46:20 +00005575 }
Dale Johannesene7261862008-09-26 23:46:20 +00005576 }
Devang Patel652203f2008-09-29 20:49:50 +00005577 if (RetAttrs != Attribute::None)
5578 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
5579 if ((yyvsp[(6) - (11)].ArgList)) { // If there are arguments...
Reid Spencer7b5d4662007-04-09 06:16:21 +00005580 unsigned index = 1;
Devang Patel652203f2008-09-29 20:49:50 +00005581 for (ArgListType::iterator I = (yyvsp[(6) - (11)].ArgList)->begin(); I != (yyvsp[(6) - (11)].ArgList)->end(); ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00005582 const Type* Ty = I->Ty->get();
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005583 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5584 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
Reid Spencer14310612006-12-31 05:40:51 +00005585 ParamTypeList.push_back(Ty);
Devang Patel05988662008-09-25 21:00:45 +00005586 if (Ty != Type::VoidTy && I->Attrs != Attribute::None)
5587 Attrs.push_back(AttributeWithIndex::get(index, I->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00005588 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005589 }
Devang Patel652203f2008-09-29 20:49:50 +00005590 if ((yyvsp[(8) - (11)].Attributes) != Attribute::None)
5591 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(8) - (11)].Attributes)));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005592
5593 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5594 if (isVarArg) ParamTypeList.pop_back();
5595
Devang Patel05988662008-09-25 21:00:45 +00005596 AttrListPtr PAL;
Christopher Lamb5c104242007-04-22 20:09:11 +00005597 if (!Attrs.empty())
Devang Patel05988662008-09-25 21:00:45 +00005598 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
Reid Spencer7b5d4662007-04-09 06:16:21 +00005599
Devang Patel652203f2008-09-29 20:49:50 +00005600 FunctionType *FT = FunctionType::get(*(yyvsp[(3) - (11)].TypeVal), ParamTypeList, isVarArg);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00005601 const PointerType *PFT = PointerType::getUnqual(FT);
Devang Patel652203f2008-09-29 20:49:50 +00005602 delete (yyvsp[(3) - (11)].TypeVal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005603
5604 ValID ID;
5605 if (!FunctionName.empty()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005606 ID = ValID::createGlobalName((char*)FunctionName.c_str());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005607 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00005608 ID = ValID::createGlobalID(CurModule.Values.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005609 }
5610
5611 Function *Fn = 0;
5612 // See if this function was forward referenced. If so, recycle the object.
5613 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
Eric Christopher2a5196f2008-09-24 04:55:49 +00005614 // Move the function to the end of the list, from whereever it was
Reid Spencer68a24bd2005-08-27 18:50:39 +00005615 // previously inserted.
5616 Fn = cast<Function>(FWRef);
Devang Patel05988662008-09-25 21:00:45 +00005617 assert(Fn->getAttributes().isEmpty() &&
Chris Lattner58d74912008-03-12 17:45:29 +00005618 "Forward reference has parameter attributes!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005619 CurModule.CurrentModule->getFunctionList().remove(Fn);
5620 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5621 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
Reid Spenceref9b9a72007-02-05 20:47:22 +00005622 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
Duncan Sandsdc024672007-11-27 13:23:08 +00005623 if (Fn->getFunctionType() != FT ) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00005624 // The existing function doesn't have the same type. This is an overload
5625 // error.
5626 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Devang Patel05988662008-09-25 21:00:45 +00005627 } else if (Fn->getAttributes() != PAL) {
Duncan Sandsdc024672007-11-27 13:23:08 +00005628 // The existing function doesn't have the same parameter attributes.
5629 // This is an overload error.
5630 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Reid Spenceref9b9a72007-02-05 20:47:22 +00005631 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
Chris Lattner6cdc6822007-04-26 05:31:05 +00005632 // Neither the existing or the current function is a declaration and they
5633 // have the same name and same type. Clearly this is a redefinition.
5634 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
Duncan Sandsdc024672007-11-27 13:23:08 +00005635 } else if (Fn->isDeclaration()) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00005636 // Make sure to strip off any argument names so we can't get conflicts.
Reid Spencer68a24bd2005-08-27 18:50:39 +00005637 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5638 AI != AE; ++AI)
5639 AI->setName("");
Reid Spenceref9b9a72007-02-05 20:47:22 +00005640 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005641 } else { // Not already defined?
Gabor Greife64d2482008-04-06 23:07:54 +00005642 Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5643 CurModule.CurrentModule);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005644 InsertValue(Fn, CurModule.Values);
5645 }
5646
Nuno Lopes9e9631d2008-10-03 15:45:58 +00005647 ID.destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +00005648 CurFun.FunctionStart(Fn);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00005649
5650 if (CurFun.isDeclare) {
5651 // If we have declaration, always overwrite linkage. This will allow us to
5652 // correctly handle cases, when pointer to function is passed as argument to
5653 // another function.
5654 Fn->setLinkage(CurFun.Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005655 Fn->setVisibility(CurFun.Visibility);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00005656 }
Devang Pateld4980812008-09-02 20:52:40 +00005657 Fn->setCallingConv((yyvsp[(1) - (11)].UIntVal));
Devang Patel05988662008-09-25 21:00:45 +00005658 Fn->setAttributes(PAL);
Devang Patel652203f2008-09-29 20:49:50 +00005659 Fn->setAlignment((yyvsp[(10) - (11)].UIntVal));
5660 if ((yyvsp[(9) - (11)].StrVal)) {
5661 Fn->setSection(*(yyvsp[(9) - (11)].StrVal));
5662 delete (yyvsp[(9) - (11)].StrVal);
Gordon Henriksen80a75bf2007-12-10 03:18:06 +00005663 }
Devang Patel652203f2008-09-29 20:49:50 +00005664 if ((yyvsp[(11) - (11)].StrVal)) {
5665 Fn->setGC((yyvsp[(11) - (11)].StrVal)->c_str());
5666 delete (yyvsp[(11) - (11)].StrVal);
Chris Lattnere869eef2005-11-12 00:11:49 +00005667 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005668
5669 // Add all of the arguments we parsed to the function...
Devang Patel652203f2008-09-29 20:49:50 +00005670 if ((yyvsp[(6) - (11)].ArgList)) { // Is null if empty...
Reid Spencer68a24bd2005-08-27 18:50:39 +00005671 if (isVarArg) { // Nuke the last entry
Devang Patel652203f2008-09-29 20:49:50 +00005672 assert((yyvsp[(6) - (11)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(6) - (11)].ArgList)->back().Name == 0 &&
Reid Spencera9720f52007-02-05 17:04:00 +00005673 "Not a varargs marker!");
Devang Patel652203f2008-09-29 20:49:50 +00005674 delete (yyvsp[(6) - (11)].ArgList)->back().Ty;
5675 (yyvsp[(6) - (11)].ArgList)->pop_back(); // Delete the last entry
Reid Spencer68a24bd2005-08-27 18:50:39 +00005676 }
5677 Function::arg_iterator ArgIt = Fn->arg_begin();
Reid Spenceref9b9a72007-02-05 20:47:22 +00005678 Function::arg_iterator ArgEnd = Fn->arg_end();
Reid Spencer14310612006-12-31 05:40:51 +00005679 unsigned Idx = 1;
Devang Patel652203f2008-09-29 20:49:50 +00005680 for (ArgListType::iterator I = (yyvsp[(6) - (11)].ArgList)->begin();
5681 I != (yyvsp[(6) - (11)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
Reid Spencer14310612006-12-31 05:40:51 +00005682 delete I->Ty; // Delete the typeholder...
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005683 setValueName(ArgIt, I->Name); // Insert arg into symtab...
Reid Spencer5b7e7532006-09-28 19:28:24 +00005684 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005685 InsertValue(ArgIt);
Reid Spencer14310612006-12-31 05:40:51 +00005686 Idx++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005687 }
Reid Spencera132e042006-12-03 05:46:11 +00005688
Devang Patel652203f2008-09-29 20:49:50 +00005689 delete (yyvsp[(6) - (11)].ArgList); // We're now done with the argument list
Reid Spencer68a24bd2005-08-27 18:50:39 +00005690 }
Reid Spencer61c83e02006-08-18 08:43:06 +00005691 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005692;}
5693 break;
5694
Chris Lattner740e7092008-10-15 06:16:57 +00005695 case 252:
Nuno Lopes19830332008-11-04 14:28:33 +00005696#line 2515 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005697 {
5698 (yyval.FunctionVal) = CurFun.CurrentFunction;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005699
5700 // Make sure that we keep track of the linkage type even if there was a
5701 // previous "declare".
Dan Gohmanf4423b12008-04-19 00:24:39 +00005702 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5703 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5704;}
5705 break;
5706
Chris Lattner740e7092008-10-15 06:16:57 +00005707 case 255:
Nuno Lopes19830332008-11-04 14:28:33 +00005708#line 2526 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005709 {
5710 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005711 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005712;}
5713 break;
5714
Chris Lattner740e7092008-10-15 06:16:57 +00005715 case 256:
Nuno Lopes19830332008-11-04 14:28:33 +00005716#line 2531 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005717 {
5718 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5719 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5720 (yyval.FunctionVal) = CurFun.CurrentFunction;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005721 CurFun.FunctionDone();
Reid Spencer41dff5e2007-01-26 08:05:27 +00005722 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005723 ;}
5724 break;
5725
Chris Lattner740e7092008-10-15 06:16:57 +00005726 case 257:
Nuno Lopes19830332008-11-04 14:28:33 +00005727#line 2543 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005728 {
5729 (yyval.BoolVal) = false;
Reid Spencer61c83e02006-08-18 08:43:06 +00005730 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005731 ;}
5732 break;
5733
Chris Lattner740e7092008-10-15 06:16:57 +00005734 case 258:
Nuno Lopes19830332008-11-04 14:28:33 +00005735#line 2547 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005736 {
5737 (yyval.BoolVal) = true;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005738 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005739 ;}
5740 break;
5741
Chris Lattner740e7092008-10-15 06:16:57 +00005742 case 259:
Nuno Lopes19830332008-11-04 14:28:33 +00005743#line 2552 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005744 { // A reference to a direct constant
5745 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005746 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005747 ;}
5748 break;
5749
Chris Lattner740e7092008-10-15 06:16:57 +00005750 case 260:
Nuno Lopes19830332008-11-04 14:28:33 +00005751#line 2556 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005752 {
5753 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005754 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005755 ;}
5756 break;
5757
Chris Lattner740e7092008-10-15 06:16:57 +00005758 case 261:
Nuno Lopes19830332008-11-04 14:28:33 +00005759#line 2560 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner1913b942008-07-11 00:30:39 +00005760 { // arbitrary precision integer constants
5761 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), true);
5762 delete (yyvsp[(1) - (1)].APIntVal);
5763 CHECK_FOR_ERROR
5764 ;}
5765 break;
5766
Chris Lattner740e7092008-10-15 06:16:57 +00005767 case 262:
Nuno Lopes19830332008-11-04 14:28:33 +00005768#line 2565 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner1913b942008-07-11 00:30:39 +00005769 { // arbitrary precision integer constants
5770 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), false);
5771 delete (yyvsp[(1) - (1)].APIntVal);
5772 CHECK_FOR_ERROR
5773 ;}
5774 break;
5775
Chris Lattner740e7092008-10-15 06:16:57 +00005776 case 263:
Nuno Lopes19830332008-11-04 14:28:33 +00005777#line 2570 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005778 { // Perhaps it's an FP constant?
5779 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00005780 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005781 ;}
5782 break;
5783
Chris Lattner740e7092008-10-15 06:16:57 +00005784 case 264:
Nuno Lopes19830332008-11-04 14:28:33 +00005785#line 2574 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005786 {
5787 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
Reid Spencere4d87aa2006-12-23 06:05:41 +00005788 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005789 ;}
5790 break;
5791
Chris Lattner740e7092008-10-15 06:16:57 +00005792 case 265:
Nuno Lopes19830332008-11-04 14:28:33 +00005793#line 2578 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005794 {
5795 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00005796 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005797 ;}
5798 break;
5799
Chris Lattner740e7092008-10-15 06:16:57 +00005800 case 266:
Nuno Lopes19830332008-11-04 14:28:33 +00005801#line 2582 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005802 {
5803 (yyval.ValIDVal) = ValID::createNull();
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00005804 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005805 ;}
5806 break;
5807
Chris Lattner740e7092008-10-15 06:16:57 +00005808 case 267:
Nuno Lopes19830332008-11-04 14:28:33 +00005809#line 2586 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005810 {
5811 (yyval.ValIDVal) = ValID::createUndef();
Reid Spencer61c83e02006-08-18 08:43:06 +00005812 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005813 ;}
5814 break;
5815
Chris Lattner740e7092008-10-15 06:16:57 +00005816 case 268:
Nuno Lopes19830332008-11-04 14:28:33 +00005817#line 2590 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005818 { // A vector zero constant.
5819 (yyval.ValIDVal) = ValID::createZeroInit();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005820 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005821 ;}
5822 break;
5823
Chris Lattner740e7092008-10-15 06:16:57 +00005824 case 269:
Nuno Lopes19830332008-11-04 14:28:33 +00005825#line 2594 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005826 { // Nonempty unsized packed vector
5827 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
Eric Christopher2a5196f2008-09-24 04:55:49 +00005828 unsigned NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005829
5830 if (!ETy->isInteger() && !ETy->isFloatingPoint())
5831 GEN_ERROR("Invalid vector element type: " + ETy->getDescription());
Eric Christopher2a5196f2008-09-24 04:55:49 +00005832
Reid Spencer9d6565a2007-02-15 02:26:10 +00005833 VectorType* pt = VectorType::get(ETy, NumElements);
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005834 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(pt));
Eric Christopher2a5196f2008-09-24 04:55:49 +00005835
Reid Spencer68a24bd2005-08-27 18:50:39 +00005836 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00005837 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5838 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Eric Christopher2a5196f2008-09-24 04:55:49 +00005839 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +00005840 ETy->getDescription() +"' as required!\nIt is of type '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00005841 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005842 }
5843
Dan Gohmanf4423b12008-04-19 00:24:39 +00005844 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5845 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
Reid Spencer832254e2007-02-02 02:16:23 +00005846 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005847 ;}
5848 break;
5849
Chris Lattner740e7092008-10-15 06:16:57 +00005850 case 270:
Nuno Lopes19830332008-11-04 14:28:33 +00005851#line 2616 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005852 { // Nonempty unsized arr
5853 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
Eric Christopher2a5196f2008-09-24 04:55:49 +00005854 uint64_t NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005855
5856 if (!ETy->isFirstClassType())
5857 GEN_ERROR("Invalid array element type: " + ETy->getDescription());
5858
5859 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5860 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(ATy));
5861
5862 // Verify all elements are correct type!
5863 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5864 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Eric Christopher2a5196f2008-09-24 04:55:49 +00005865 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005866 ETy->getDescription() +"' as required!\nIt is of type '"+
5867 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5868 }
5869
5870 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, *(yyvsp[(2) - (3)].ConstVector)));
5871 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5872 CHECK_FOR_ERROR
5873 ;}
5874 break;
5875
Chris Lattner740e7092008-10-15 06:16:57 +00005876 case 271:
Nuno Lopes19830332008-11-04 14:28:33 +00005877#line 2638 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005878 {
Dan Gohman180c1692008-06-23 18:43:26 +00005879 // Use undef instead of an array because it's inconvenient to determine
5880 // the element type at this point, there being no elements to examine.
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005881 (yyval.ValIDVal) = ValID::createUndef();
5882 CHECK_FOR_ERROR
5883 ;}
5884 break;
5885
Chris Lattner740e7092008-10-15 06:16:57 +00005886 case 272:
Nuno Lopes19830332008-11-04 14:28:33 +00005887#line 2644 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005888 {
Dan Gohman180c1692008-06-23 18:43:26 +00005889 uint64_t NumElements = (yyvsp[(2) - (2)].StrVal)->length();
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005890 const Type *ETy = Type::Int8Ty;
5891
5892 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5893
5894 std::vector<Constant*> Vals;
5895 for (unsigned i = 0; i < (yyvsp[(2) - (2)].StrVal)->length(); ++i)
5896 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(2) - (2)].StrVal))[i]));
5897 delete (yyvsp[(2) - (2)].StrVal);
5898 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, Vals));
5899 CHECK_FOR_ERROR
5900 ;}
5901 break;
5902
Chris Lattner740e7092008-10-15 06:16:57 +00005903 case 273:
Nuno Lopes19830332008-11-04 14:28:33 +00005904#line 2657 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005905 {
5906 std::vector<const Type*> Elements((yyvsp[(2) - (3)].ConstVector)->size());
5907 for (unsigned i = 0, e = (yyvsp[(2) - (3)].ConstVector)->size(); i != e; ++i)
5908 Elements[i] = (*(yyvsp[(2) - (3)].ConstVector))[i]->getType();
5909
5910 const StructType *STy = StructType::get(Elements);
5911 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5912
5913 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(2) - (3)].ConstVector)));
5914 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5915 CHECK_FOR_ERROR
5916 ;}
5917 break;
5918
Chris Lattner740e7092008-10-15 06:16:57 +00005919 case 274:
Nuno Lopes19830332008-11-04 14:28:33 +00005920#line 2669 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005921 {
5922 const StructType *STy = StructType::get(std::vector<const Type*>());
5923 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5924 CHECK_FOR_ERROR
5925 ;}
5926 break;
5927
Chris Lattner740e7092008-10-15 06:16:57 +00005928 case 275:
Nuno Lopes19830332008-11-04 14:28:33 +00005929#line 2674 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005930 {
5931 std::vector<const Type*> Elements((yyvsp[(3) - (5)].ConstVector)->size());
5932 for (unsigned i = 0, e = (yyvsp[(3) - (5)].ConstVector)->size(); i != e; ++i)
5933 Elements[i] = (*(yyvsp[(3) - (5)].ConstVector))[i]->getType();
5934
5935 const StructType *STy = StructType::get(Elements, /*isPacked=*/true);
5936 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5937
5938 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(3) - (5)].ConstVector)));
5939 delete PTy; delete (yyvsp[(3) - (5)].ConstVector);
5940 CHECK_FOR_ERROR
5941 ;}
5942 break;
5943
Chris Lattner740e7092008-10-15 06:16:57 +00005944 case 276:
Nuno Lopes19830332008-11-04 14:28:33 +00005945#line 2686 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005946 {
5947 const StructType *STy = StructType::get(std::vector<const Type*>(),
5948 /*isPacked=*/true);
5949 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5950 CHECK_FOR_ERROR
5951 ;}
5952 break;
5953
Chris Lattner740e7092008-10-15 06:16:57 +00005954 case 277:
Nuno Lopes19830332008-11-04 14:28:33 +00005955#line 2692 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005956 {
5957 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
Reid Spencer832254e2007-02-02 02:16:23 +00005958 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005959 ;}
5960 break;
5961
Chris Lattner740e7092008-10-15 06:16:57 +00005962 case 278:
Nuno Lopes19830332008-11-04 14:28:33 +00005963#line 2696 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005964 {
5965 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5966 delete (yyvsp[(3) - (5)].StrVal);
5967 delete (yyvsp[(5) - (5)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005968 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005969 ;}
5970 break;
5971
Chris Lattner740e7092008-10-15 06:16:57 +00005972 case 279:
Nuno Lopes19830332008-11-04 14:28:33 +00005973#line 2706 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005974 { // Is it an integer reference...?
5975 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005976 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005977 ;}
5978 break;
5979
Chris Lattner740e7092008-10-15 06:16:57 +00005980 case 280:
Nuno Lopes19830332008-11-04 14:28:33 +00005981#line 2710 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005982 {
5983 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
Reid Spencer832254e2007-02-02 02:16:23 +00005984 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005985 ;}
5986 break;
5987
Chris Lattner740e7092008-10-15 06:16:57 +00005988 case 281:
Nuno Lopes19830332008-11-04 14:28:33 +00005989#line 2714 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005990 { // Is it a named reference...?
5991 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5992 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005993 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005994 ;}
5995 break;
5996
Chris Lattner740e7092008-10-15 06:16:57 +00005997 case 282:
Nuno Lopes19830332008-11-04 14:28:33 +00005998#line 2719 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005999 { // Is it a named reference...?
6000 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
6001 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00006002 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006003 ;}
6004 break;
6005
Chris Lattner740e7092008-10-15 06:16:57 +00006006 case 285:
Nuno Lopes19830332008-11-04 14:28:33 +00006007#line 2732 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006008 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006009 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006010 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Eric Christopher2a5196f2008-09-24 04:55:49 +00006011 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
Dan Gohmanf4423b12008-04-19 00:24:39 +00006012 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer832254e2007-02-02 02:16:23 +00006013 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006014 ;}
6015 break;
6016
Chris Lattner740e7092008-10-15 06:16:57 +00006017 case 286:
Nuno Lopes19830332008-11-04 14:28:33 +00006018#line 2741 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006019 {
6020 (yyval.ValueList) = new std::vector<Value *>();
Eric Christopher2a5196f2008-09-24 04:55:49 +00006021 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
Devang Patel7990dc72008-02-20 22:40:23 +00006022 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006023 ;}
6024 break;
6025
Chris Lattner740e7092008-10-15 06:16:57 +00006026 case 287:
Nuno Lopes19830332008-11-04 14:28:33 +00006027#line 2746 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006028 {
Eric Christopher2a5196f2008-09-24 04:55:49 +00006029 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
Devang Patel7990dc72008-02-20 22:40:23 +00006030 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006031 ;}
6032 break;
6033
Chris Lattner740e7092008-10-15 06:16:57 +00006034 case 288:
Nuno Lopes19830332008-11-04 14:28:33 +00006035#line 2751 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006036 {
6037 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006038 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006039 ;}
6040 break;
6041
Chris Lattner740e7092008-10-15 06:16:57 +00006042 case 289:
Nuno Lopes19830332008-11-04 14:28:33 +00006043#line 2755 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Eric Christopher2a5196f2008-09-24 04:55:49 +00006044 { // Do not allow functions with 0 basic blocks
Dan Gohmanf4423b12008-04-19 00:24:39 +00006045 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006046 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006047 ;}
6048 break;
6049
Chris Lattner740e7092008-10-15 06:16:57 +00006050 case 290:
Nuno Lopes19830332008-11-04 14:28:33 +00006051#line 2764 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006052 {
6053 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006054 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006055 InsertValue((yyvsp[(3) - (3)].TermInstVal));
6056 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
6057 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006058 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006059 ;}
6060 break;
6061
Chris Lattner740e7092008-10-15 06:16:57 +00006062 case 291:
Nuno Lopes19830332008-11-04 14:28:33 +00006063#line 2773 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00006064 {
6065 CHECK_FOR_ERROR
6066 int ValNum = InsertValue((yyvsp[(3) - (3)].TermInstVal));
6067 if (ValNum != (int)(yyvsp[(2) - (3)].UIntVal))
6068 GEN_ERROR("Result value number %" + utostr((yyvsp[(2) - (3)].UIntVal)) +
6069 " is incorrect, expected %" + utostr((unsigned)ValNum));
Eric Christopher2a5196f2008-09-24 04:55:49 +00006070
Chris Lattner15bd0952008-08-29 17:20:18 +00006071 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
6072 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
6073 CHECK_FOR_ERROR
6074;}
6075 break;
6076
Chris Lattner740e7092008-10-15 06:16:57 +00006077 case 292:
Nuno Lopes19830332008-11-04 14:28:33 +00006078#line 2786 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006079 {
6080 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006081 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
6082 if (CI2->getParent() == 0)
Dan Gohmanf4423b12008-04-19 00:24:39 +00006083 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
6084 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
6085 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
Anton Korobeynikov38e09802007-04-28 13:48:45 +00006086 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006087 ;}
6088 break;
Chris Lattner38905612008-02-19 04:36:25 +00006089
Chris Lattner740e7092008-10-15 06:16:57 +00006090 case 293:
Nuno Lopes19830332008-11-04 14:28:33 +00006091#line 2795 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006092 { // Empty space between instruction lists
Chris Lattnercc81d152008-05-04 17:18:47 +00006093 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
Dan Gohmanf4423b12008-04-19 00:24:39 +00006094 CHECK_FOR_ERROR
6095 ;}
6096 break;
6097
Chris Lattner740e7092008-10-15 06:16:57 +00006098 case 294:
Nuno Lopes19830332008-11-04 14:28:33 +00006099#line 2799 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnercc81d152008-05-04 17:18:47 +00006100 { // Labelled (named) basic block
6101 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
6102 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006103 CHECK_FOR_ERROR
Chris Lattnercc81d152008-05-04 17:18:47 +00006104
Dan Gohmanf4423b12008-04-19 00:24:39 +00006105 ;}
6106 break;
6107
Chris Lattner740e7092008-10-15 06:16:57 +00006108 case 295:
Nuno Lopes19830332008-11-04 14:28:33 +00006109#line 2807 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006110 { // Return with a result...
6111 ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
6112 assert(!VL.empty() && "Invalid ret operands!");
Dan Gohman1a570242008-07-23 00:54:54 +00006113 const Type *ReturnType = CurFun.CurrentFunction->getReturnType();
6114 if (VL.size() > 1 ||
6115 (isa<StructType>(ReturnType) &&
6116 (VL.empty() || VL[0]->getType() != ReturnType))) {
6117 Value *RV = UndefValue::get(ReturnType);
6118 for (unsigned i = 0, e = VL.size(); i != e; ++i) {
6119 Instruction *I = InsertValueInst::Create(RV, VL[i], i, "mrv");
6120 ((yyvsp[(-1) - (2)].BasicBlockVal))->getInstList().push_back(I);
6121 RV = I;
6122 }
6123 (yyval.TermInstVal) = ReturnInst::Create(RV);
6124 } else {
6125 (yyval.TermInstVal) = ReturnInst::Create(VL[0]);
6126 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006127 delete (yyvsp[(2) - (2)].ValueList);
6128 CHECK_FOR_ERROR
6129 ;}
6130 break;
6131
Chris Lattner740e7092008-10-15 06:16:57 +00006132 case 296:
Nuno Lopes19830332008-11-04 14:28:33 +00006133#line 2827 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006134 { // Return with no result...
6135 (yyval.TermInstVal) = ReturnInst::Create();
6136 CHECK_FOR_ERROR
6137 ;}
6138 break;
6139
Chris Lattner740e7092008-10-15 06:16:57 +00006140 case 297:
Nuno Lopes19830332008-11-04 14:28:33 +00006141#line 2831 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006142 { // Unconditional Branch...
6143 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
6144 CHECK_FOR_ERROR
6145 (yyval.TermInstVal) = BranchInst::Create(tmpBB);
6146 ;}
6147 break;
6148
Chris Lattner740e7092008-10-15 06:16:57 +00006149 case 298:
Nuno Lopes19830332008-11-04 14:28:33 +00006150#line 2836 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Eric Christopher2a5196f2008-09-24 04:55:49 +00006151 {
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006152 if (cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() != 1)
6153 GEN_ERROR("Branch condition must have type i1");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006154 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6155 CHECK_FOR_ERROR
6156 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
6157 CHECK_FOR_ERROR
6158 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
6159 CHECK_FOR_ERROR
6160 (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal);
6161 ;}
6162 break;
6163
Chris Lattner740e7092008-10-15 06:16:57 +00006164 case 299:
Nuno Lopes19830332008-11-04 14:28:33 +00006165#line 2847 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006166 {
6167 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
6168 CHECK_FOR_ERROR
6169 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6170 CHECK_FOR_ERROR
6171 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
6172 (yyval.TermInstVal) = S;
6173
6174 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
6175 E = (yyvsp[(8) - (9)].JumpTable)->end();
Reid Spencer68a24bd2005-08-27 18:50:39 +00006176 for (; I != E; ++I) {
6177 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
6178 S->addCase(CI, I->second);
6179 else
Reid Spencerb5334b02007-02-05 10:18:06 +00006180 GEN_ERROR("Switch case is constant, but not a simple integer");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006181 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006182 delete (yyvsp[(8) - (9)].JumpTable);
Reid Spencer61c83e02006-08-18 08:43:06 +00006183 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006184 ;}
6185 break;
6186
Chris Lattner740e7092008-10-15 06:16:57 +00006187 case 300:
Nuno Lopes19830332008-11-04 14:28:33 +00006188#line 2866 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006189 {
6190 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006191 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006192 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006193 CHECK_FOR_ERROR
Gabor Greife64d2482008-04-06 23:07:54 +00006194 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006195 (yyval.TermInstVal) = S;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006196 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006197 ;}
6198 break;
6199
Chris Lattner740e7092008-10-15 06:16:57 +00006200 case 301:
Nuno Lopes19830332008-11-04 14:28:33 +00006201#line 2876 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006202 {
Reid Spencer3822ff52006-11-08 06:47:33 +00006203
Reid Spencer14310612006-12-31 05:40:51 +00006204 // Handle the short syntax
6205 const PointerType *PFTy = 0;
6206 const FunctionType *Ty = 0;
Devang Patel652203f2008-09-29 20:49:50 +00006207 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(4) - (15)].TypeVal)->get())) ||
Reid Spencer68a24bd2005-08-27 18:50:39 +00006208 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6209 // Pull out the types of all of the arguments...
6210 std::vector<const Type*> ParamTypes;
Devang Patel652203f2008-09-29 20:49:50 +00006211 ParamList::iterator I = (yyvsp[(7) - (15)].ParamList)->begin(), E = (yyvsp[(7) - (15)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006212 for (; I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00006213 const Type *Ty = I->Val->getType();
6214 if (Ty == Type::VoidTy)
6215 GEN_ERROR("Short call syntax cannot be used with varargs");
6216 ParamTypes.push_back(Ty);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006217 }
Eric Christopher2a5196f2008-09-24 04:55:49 +00006218
Devang Patel652203f2008-09-29 20:49:50 +00006219 if (!FunctionType::isValidReturnType(*(yyvsp[(4) - (15)].TypeVal)))
Chris Lattnera925a142008-04-23 05:37:08 +00006220 GEN_ERROR("Invalid result type for LLVM function");
6221
Devang Patel652203f2008-09-29 20:49:50 +00006222 Ty = FunctionType::get((yyvsp[(4) - (15)].TypeVal)->get(), ParamTypes, false);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00006223 PFTy = PointerType::getUnqual(Ty);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006224 }
6225
Devang Patel652203f2008-09-29 20:49:50 +00006226 delete (yyvsp[(4) - (15)].TypeVal);
Reid Spencer66728ef2007-03-20 01:13:36 +00006227
Devang Patel652203f2008-09-29 20:49:50 +00006228 Value *V = getVal(PFTy, (yyvsp[(5) - (15)].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00006229 CHECK_FOR_ERROR
Devang Patel652203f2008-09-29 20:49:50 +00006230 BasicBlock *Normal = getBBVal((yyvsp[(12) - (15)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006231 CHECK_FOR_ERROR
Devang Patel652203f2008-09-29 20:49:50 +00006232 BasicBlock *Except = getBBVal((yyvsp[(15) - (15)].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00006233 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00006234
Devang Patel05988662008-09-25 21:00:45 +00006235 SmallVector<AttributeWithIndex, 8> Attrs;
Dale Johannesene7261862008-09-26 23:46:20 +00006236 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
6237 //attributes.
Devang Patel652203f2008-09-29 20:49:50 +00006238 Attributes RetAttrs = (yyvsp[(3) - (15)].Attributes);
6239 if ((yyvsp[(9) - (15)].Attributes) != Attribute::None) {
6240 if ((yyvsp[(9) - (15)].Attributes) & Attribute::ZExt) {
Dale Johannesene7261862008-09-26 23:46:20 +00006241 RetAttrs = RetAttrs | Attribute::ZExt;
Devang Patel652203f2008-09-29 20:49:50 +00006242 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::ZExt;
Dale Johannesene7261862008-09-26 23:46:20 +00006243 }
Devang Patel652203f2008-09-29 20:49:50 +00006244 if ((yyvsp[(9) - (15)].Attributes) & Attribute::SExt) {
Dale Johannesene7261862008-09-26 23:46:20 +00006245 RetAttrs = RetAttrs | Attribute::SExt;
Devang Patel652203f2008-09-29 20:49:50 +00006246 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::SExt;
Dale Johannesene7261862008-09-26 23:46:20 +00006247 }
Devang Patel652203f2008-09-29 20:49:50 +00006248 if ((yyvsp[(9) - (15)].Attributes) & Attribute::InReg) {
Dale Johannesene7261862008-09-26 23:46:20 +00006249 RetAttrs = RetAttrs | Attribute::InReg;
Devang Patel652203f2008-09-29 20:49:50 +00006250 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::InReg;
Dale Johannesene7261862008-09-26 23:46:20 +00006251 }
Dale Johannesene7261862008-09-26 23:46:20 +00006252 }
Devang Patel652203f2008-09-29 20:49:50 +00006253 if (RetAttrs != Attribute::None)
6254 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
Dale Johannesene7261862008-09-26 23:46:20 +00006255
Reid Spencer14310612006-12-31 05:40:51 +00006256 // Check the arguments
6257 ValueList Args;
Devang Patel652203f2008-09-29 20:49:50 +00006258 if ((yyvsp[(7) - (15)].ParamList)->empty()) { // Has no arguments?
Reid Spencer14310612006-12-31 05:40:51 +00006259 // Make sure no arguments is a good thing!
6260 if (Ty->getNumParams() != 0)
6261 GEN_ERROR("No arguments passed to a function that "
Reid Spencerb5334b02007-02-05 10:18:06 +00006262 "expects arguments");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006263 } else { // Has arguments?
6264 // Loop through FunctionType's arguments and ensure they are specified
6265 // correctly!
Reid Spencer68a24bd2005-08-27 18:50:39 +00006266 FunctionType::param_iterator I = Ty->param_begin();
6267 FunctionType::param_iterator E = Ty->param_end();
Devang Patel652203f2008-09-29 20:49:50 +00006268 ParamList::iterator ArgI = (yyvsp[(7) - (15)].ParamList)->begin(), ArgE = (yyvsp[(7) - (15)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006269 unsigned index = 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00006270
Duncan Sandsdc024672007-11-27 13:23:08 +00006271 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006272 if (ArgI->Val->getType() != *I)
6273 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00006274 (*I)->getDescription() + "'");
Reid Spencer14310612006-12-31 05:40:51 +00006275 Args.push_back(ArgI->Val);
Devang Patel05988662008-09-25 21:00:45 +00006276 if (ArgI->Attrs != Attribute::None)
6277 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00006278 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00006279
Reid Spencer14310612006-12-31 05:40:51 +00006280 if (Ty->isVarArg()) {
6281 if (I == E)
Chris Lattner38905612008-02-19 04:36:25 +00006282 for (; ArgI != ArgE; ++ArgI, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006283 Args.push_back(ArgI->Val); // push the remaining varargs
Devang Patel05988662008-09-25 21:00:45 +00006284 if (ArgI->Attrs != Attribute::None)
6285 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Chris Lattner38905612008-02-19 04:36:25 +00006286 }
Reid Spencer14310612006-12-31 05:40:51 +00006287 } else if (I != E || ArgI != ArgE)
Reid Spencerb5334b02007-02-05 10:18:06 +00006288 GEN_ERROR("Invalid number of parameters detected");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006289 }
Devang Patel652203f2008-09-29 20:49:50 +00006290 if ((yyvsp[(9) - (15)].Attributes) != Attribute::None)
6291 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(9) - (15)].Attributes)));
Devang Patel05988662008-09-25 21:00:45 +00006292 AttrListPtr PAL;
Duncan Sandsdc024672007-11-27 13:23:08 +00006293 if (!Attrs.empty())
Devang Patel05988662008-09-25 21:00:45 +00006294 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsdc024672007-11-27 13:23:08 +00006295
Reid Spencer14310612006-12-31 05:40:51 +00006296 // Create the InvokeInst
Dan Gohman041e2eb2008-05-15 19:50:34 +00006297 InvokeInst *II = InvokeInst::Create(V, Normal, Except,
6298 Args.begin(), Args.end());
Devang Patel652203f2008-09-29 20:49:50 +00006299 II->setCallingConv((yyvsp[(2) - (15)].UIntVal));
Devang Patel05988662008-09-25 21:00:45 +00006300 II->setAttributes(PAL);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006301 (yyval.TermInstVal) = II;
Devang Patel652203f2008-09-29 20:49:50 +00006302 delete (yyvsp[(7) - (15)].ParamList);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006303 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006304 ;}
6305 break;
6306
Chris Lattner740e7092008-10-15 06:16:57 +00006307 case 302:
Nuno Lopes19830332008-11-04 14:28:33 +00006308#line 2979 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006309 {
6310 (yyval.TermInstVal) = new UnwindInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00006311 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006312 ;}
6313 break;
6314
Chris Lattner740e7092008-10-15 06:16:57 +00006315 case 303:
Nuno Lopes19830332008-11-04 14:28:33 +00006316#line 2983 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006317 {
6318 (yyval.TermInstVal) = new UnreachableInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00006319 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006320 ;}
6321 break;
6322
Chris Lattner740e7092008-10-15 06:16:57 +00006323 case 304:
Nuno Lopes19830332008-11-04 14:28:33 +00006324#line 2990 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006325 {
6326 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
6327 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006328 CHECK_FOR_ERROR
6329 if (V == 0)
6330 GEN_ERROR("May only switch on a constant pool value");
6331
Dan Gohmanf4423b12008-04-19 00:24:39 +00006332 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006333 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006334 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
6335 ;}
6336 break;
6337
Chris Lattner740e7092008-10-15 06:16:57 +00006338 case 305:
Nuno Lopes19830332008-11-04 14:28:33 +00006339#line 3001 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006340 {
6341 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
6342 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006343 CHECK_FOR_ERROR
6344
6345 if (V == 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00006346 GEN_ERROR("May only switch on a constant pool value");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006347
Dan Gohmanf4423b12008-04-19 00:24:39 +00006348 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006349 CHECK_FOR_ERROR
Eric Christopher2a5196f2008-09-24 04:55:49 +00006350 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
Dan Gohmanf4423b12008-04-19 00:24:39 +00006351 ;}
6352 break;
6353
Chris Lattner740e7092008-10-15 06:16:57 +00006354 case 306:
Nuno Lopes19830332008-11-04 14:28:33 +00006355#line 3014 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006356 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006357 // Is this definition named?? if so, assign the name...
Dan Gohmanf4423b12008-04-19 00:24:39 +00006358 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006359 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006360 InsertValue((yyvsp[(2) - (2)].InstVal));
6361 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006362 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006363 ;}
6364 break;
6365
Chris Lattner740e7092008-10-15 06:16:57 +00006366 case 307:
Nuno Lopes19830332008-11-04 14:28:33 +00006367#line 3023 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00006368 {
6369 CHECK_FOR_ERROR
6370 int ValNum = InsertValue((yyvsp[(2) - (2)].InstVal));
Eric Christopher2a5196f2008-09-24 04:55:49 +00006371
Chris Lattner15bd0952008-08-29 17:20:18 +00006372 if (ValNum != (int)(yyvsp[(1) - (2)].UIntVal))
6373 GEN_ERROR("Result value number %" + utostr((yyvsp[(1) - (2)].UIntVal)) +
6374 " is incorrect, expected %" + utostr((unsigned)ValNum));
6375
6376 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
6377 CHECK_FOR_ERROR
6378 ;}
6379 break;
6380
Chris Lattner740e7092008-10-15 06:16:57 +00006381 case 308:
Nuno Lopes19830332008-11-04 14:28:33 +00006382#line 3036 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006383 { // Used for PHI nodes
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006384 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006385 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
6386 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
6387 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
Reid Spencer6f407902007-01-13 05:00:46 +00006388 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006389 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006390 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006391 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6392 delete (yyvsp[(1) - (6)].TypeVal);
6393 ;}
6394 break;
6395
Chris Lattner740e7092008-10-15 06:16:57 +00006396 case 309:
Nuno Lopes19830332008-11-04 14:28:33 +00006397#line 3047 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006398 {
6399 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
6400 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006401 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006402 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006403 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006404 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6405 ;}
6406 break;
6407
Chris Lattner740e7092008-10-15 06:16:57 +00006408 case 310:
Nuno Lopes19830332008-11-04 14:28:33 +00006409#line 3057 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006410 {
Devang Patel05988662008-09-25 21:00:45 +00006411 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006412 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006413 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006414 // Used for call and invoke instructions
Dan Gohmanf4423b12008-04-19 00:24:39 +00006415 (yyval.ParamList) = new ParamList();
Devang Patel05988662008-09-25 21:00:45 +00006416 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 +00006417 (yyval.ParamList)->push_back(E);
6418 delete (yyvsp[(1) - (4)].TypeVal);
Duncan Sandsdc024672007-11-27 13:23:08 +00006419 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006420 ;}
6421 break;
6422
Chris Lattner740e7092008-10-15 06:16:57 +00006423 case 311:
Nuno Lopes19830332008-11-04 14:28:33 +00006424#line 3068 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006425 {
Devang Patel05988662008-09-25 21:00:45 +00006426 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Dale Johanneseneb57ea72007-11-05 21:20:28 +00006427 // Labels are only valid in ASMs
Dan Gohmanf4423b12008-04-19 00:24:39 +00006428 (yyval.ParamList) = new ParamList();
Devang Patel05988662008-09-25 21:00:45 +00006429 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 +00006430 (yyval.ParamList)->push_back(E);
Duncan Sandsdc024672007-11-27 13:23:08 +00006431 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006432 ;}
6433 break;
6434
Chris Lattner740e7092008-10-15 06:16:57 +00006435 case 312:
Nuno Lopes19830332008-11-04 14:28:33 +00006436#line 3076 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006437 {
Devang Patel05988662008-09-25 21:00:45 +00006438 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006439 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006440 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6441 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
Devang Patel05988662008-09-25 21:00:45 +00006442 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 +00006443 (yyval.ParamList)->push_back(E);
6444 delete (yyvsp[(3) - (6)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006445 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006446 ;}
6447 break;
6448
Chris Lattner740e7092008-10-15 06:16:57 +00006449 case 313:
Nuno Lopes19830332008-11-04 14:28:33 +00006450#line 3086 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006451 {
Devang Patel05988662008-09-25 21:00:45 +00006452 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf4423b12008-04-19 00:24:39 +00006453 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
Devang Patel05988662008-09-25 21:00:45 +00006454 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 +00006455 (yyval.ParamList)->push_back(E);
Dale Johanneseneb57ea72007-11-05 21:20:28 +00006456 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006457 ;}
6458 break;
6459
Chris Lattner740e7092008-10-15 06:16:57 +00006460 case 314:
Nuno Lopes19830332008-11-04 14:28:33 +00006461#line 3093 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006462 { (yyval.ParamList) = new ParamList(); ;}
6463 break;
6464
Chris Lattner740e7092008-10-15 06:16:57 +00006465 case 315:
Nuno Lopes19830332008-11-04 14:28:33 +00006466#line 3096 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006467 { (yyval.ValueList) = new std::vector<Value*>(); ;}
6468 break;
6469
Chris Lattner740e7092008-10-15 06:16:57 +00006470 case 316:
Nuno Lopes19830332008-11-04 14:28:33 +00006471#line 3097 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006472 {
6473 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
6474 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00006475 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006476 ;}
6477 break;
6478
Chris Lattner740e7092008-10-15 06:16:57 +00006479 case 317:
Nuno Lopes19830332008-11-04 14:28:33 +00006480#line 3105 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006481 {
6482 (yyval.ConstantList) = new std::vector<unsigned>();
6483 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
6484 GEN_ERROR("Index " + utostr((yyvsp[(2) - (2)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6485 (yyval.ConstantList)->push_back((yyvsp[(2) - (2)].UInt64Val));
6486 ;}
6487 break;
6488
Chris Lattner740e7092008-10-15 06:16:57 +00006489 case 318:
Nuno Lopes19830332008-11-04 14:28:33 +00006490#line 3111 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006491 {
6492 (yyval.ConstantList) = (yyvsp[(1) - (3)].ConstantList);
6493 if ((unsigned)(yyvsp[(3) - (3)].UInt64Val) != (yyvsp[(3) - (3)].UInt64Val))
6494 GEN_ERROR("Index " + utostr((yyvsp[(3) - (3)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6495 (yyval.ConstantList)->push_back((yyvsp[(3) - (3)].UInt64Val));
6496 CHECK_FOR_ERROR
6497 ;}
6498 break;
6499
Chris Lattner740e7092008-10-15 06:16:57 +00006500 case 319:
Nuno Lopes19830332008-11-04 14:28:33 +00006501#line 3120 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006502 {
6503 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00006504 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006505 ;}
6506 break;
6507
Chris Lattner740e7092008-10-15 06:16:57 +00006508 case 320:
Nuno Lopes19830332008-11-04 14:28:33 +00006509#line 3124 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006510 {
6511 (yyval.BoolVal) = false;
Andrew Lenharth6353e052006-12-08 18:07:09 +00006512 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006513 ;}
6514 break;
6515
Chris Lattner740e7092008-10-15 06:16:57 +00006516 case 321:
Nuno Lopes19830332008-11-04 14:28:33 +00006517#line 3129 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006518 {
Reid Spencer14310612006-12-31 05:40:51 +00006519 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006520 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
Eric Christopher2a5196f2008-09-24 04:55:49 +00006521 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
Dan Gohmanf4423b12008-04-19 00:24:39 +00006522 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006523 GEN_ERROR(
6524 "Arithmetic operator requires integer, FP, or packed operands");
Eric Christopher2a5196f2008-09-24 04:55:49 +00006525 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006526 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006527 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006528 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006529 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006530 if ((yyval.InstVal) == 0)
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006531 GEN_ERROR("binary operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006532 delete (yyvsp[(2) - (5)].TypeVal);
6533 ;}
6534 break;
6535
Chris Lattner740e7092008-10-15 06:16:57 +00006536 case 322:
Nuno Lopes19830332008-11-04 14:28:33 +00006537#line 3145 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006538 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006539 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006540 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6541 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006542 if (!isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
Dan Gohmanf4423b12008-04-19 00:24:39 +00006543 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006544 GEN_ERROR("Logical operator requires integral operands");
6545 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006546 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006547 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006548 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006549 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006550 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006551 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006552 GEN_ERROR("binary operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006553 delete (yyvsp[(2) - (5)].TypeVal);
6554 ;}
6555 break;
6556
Chris Lattner740e7092008-10-15 06:16:57 +00006557 case 323:
Nuno Lopes19830332008-11-04 14:28:33 +00006558#line 3162 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006559 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006560 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006561 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
Dan Gohmanf4423b12008-04-19 00:24:39 +00006562 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006563 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006564 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006565 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006566 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006567 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006568 GEN_ERROR("icmp operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006569 delete (yyvsp[(3) - (6)].TypeVal);
6570 ;}
6571 break;
6572
Chris Lattner740e7092008-10-15 06:16:57 +00006573 case 324:
Nuno Lopes19830332008-11-04 14:28:33 +00006574#line 3174 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006575 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006576 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006577 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
Dan Gohmanf4423b12008-04-19 00:24:39 +00006578 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006579 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006580 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006581 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006582 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006583 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006584 GEN_ERROR("fcmp operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006585 delete (yyvsp[(3) - (6)].TypeVal);
6586 ;}
6587 break;
6588
Chris Lattner740e7092008-10-15 06:16:57 +00006589 case 325:
Nuno Lopes19830332008-11-04 14:28:33 +00006590#line 3186 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00006591 {
6592 if (!UpRefs.empty())
6593 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6594 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6595 GEN_ERROR("Scalar types not supported by vicmp instruction");
6596 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6597 CHECK_FOR_ERROR
6598 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6599 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006600 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Nate Begemanac80ade2008-05-12 19:01:56 +00006601 if ((yyval.InstVal) == 0)
Dan Gohmand8ee59b2008-09-09 01:13:24 +00006602 GEN_ERROR("vicmp operator returned null");
Nate Begemanac80ade2008-05-12 19:01:56 +00006603 delete (yyvsp[(3) - (6)].TypeVal);
6604 ;}
6605 break;
6606
Chris Lattner740e7092008-10-15 06:16:57 +00006607 case 326:
Nuno Lopes19830332008-11-04 14:28:33 +00006608#line 3200 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00006609 {
6610 if (!UpRefs.empty())
6611 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6612 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6613 GEN_ERROR("Scalar types not supported by vfcmp instruction");
6614 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6615 CHECK_FOR_ERROR
6616 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6617 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006618 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Nate Begemanac80ade2008-05-12 19:01:56 +00006619 if ((yyval.InstVal) == 0)
Dan Gohmand8ee59b2008-09-09 01:13:24 +00006620 GEN_ERROR("vfcmp operator returned null");
Nate Begemanac80ade2008-05-12 19:01:56 +00006621 delete (yyvsp[(3) - (6)].TypeVal);
6622 ;}
6623 break;
6624
Chris Lattner740e7092008-10-15 06:16:57 +00006625 case 327:
Nuno Lopes19830332008-11-04 14:28:33 +00006626#line 3214 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006627 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006628 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006629 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6630 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6631 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6632 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006633 GEN_ERROR("invalid cast opcode for cast from '" +
6634 Val->getType()->getDescription() + "' to '" +
Eric Christopher2a5196f2008-09-24 04:55:49 +00006635 DestTy->getDescription() + "'");
Dan Gohmane4977cf2008-05-23 01:55:30 +00006636 (yyval.InstVal) = CastInst::Create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006637 delete (yyvsp[(4) - (4)].TypeVal);
6638 ;}
6639 break;
6640
Chris Lattner740e7092008-10-15 06:16:57 +00006641 case 328:
Nuno Lopes19830332008-11-04 14:28:33 +00006642#line 3226 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006643 {
Dan Gohmand8ee59b2008-09-09 01:13:24 +00006644 if (isa<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType())) {
6645 // vector select
6646 if (!isa<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType())
6647 || !isa<VectorType>((yyvsp[(6) - (6)].ValueVal)->getType()) )
6648 GEN_ERROR("vector select value types must be vector types");
6649 const VectorType* cond_type = cast<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType());
6650 const VectorType* select_type = cast<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType());
6651 if (cond_type->getElementType() != Type::Int1Ty)
6652 GEN_ERROR("vector select condition element type must be boolean");
6653 if (cond_type->getNumElements() != select_type->getNumElements())
6654 GEN_ERROR("vector select number of elements must be the same");
6655 } else {
6656 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
6657 GEN_ERROR("select condition must be boolean");
6658 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006659 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
Dan Gohmand8ee59b2008-09-09 01:13:24 +00006660 GEN_ERROR("select value types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006661 (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006662 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006663 ;}
6664 break;
6665
Chris Lattner740e7092008-10-15 06:16:57 +00006666 case 329:
Nuno Lopes19830332008-11-04 14:28:33 +00006667#line 3247 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006668 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006669 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006670 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6671 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6672 delete (yyvsp[(4) - (4)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006673 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006674 ;}
6675 break;
6676
Chris Lattner740e7092008-10-15 06:16:57 +00006677 case 330:
Nuno Lopes19830332008-11-04 14:28:33 +00006678#line 3254 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006679 {
6680 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006681 GEN_ERROR("Invalid extractelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006682 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006683 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006684 ;}
6685 break;
6686
Chris Lattner740e7092008-10-15 06:16:57 +00006687 case 331:
Nuno Lopes19830332008-11-04 14:28:33 +00006688#line 3260 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006689 {
6690 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006691 GEN_ERROR("Invalid insertelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006692 (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006693 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006694 ;}
6695 break;
6696
Chris Lattner740e7092008-10-15 06:16:57 +00006697 case 332:
Nuno Lopes19830332008-11-04 14:28:33 +00006698#line 3266 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006699 {
6700 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006701 GEN_ERROR("Invalid shufflevector operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006702 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006703 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006704 ;}
6705 break;
6706
Chris Lattner740e7092008-10-15 06:16:57 +00006707 case 333:
Nuno Lopes19830332008-11-04 14:28:33 +00006708#line 3272 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006709 {
6710 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006711 if (!Ty->isFirstClassType())
6712 GEN_ERROR("PHI node operands must be of first class type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006713 (yyval.InstVal) = PHINode::Create(Ty);
6714 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6715 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
Eric Christopher2a5196f2008-09-24 04:55:49 +00006716 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006717 GEN_ERROR("All elements of a PHI node must be of the same type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006718 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6719 (yyvsp[(2) - (2)].PHIList)->pop_front();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006720 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006721 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006722 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006723 ;}
6724 break;
6725
Chris Lattner740e7092008-10-15 06:16:57 +00006726 case 334:
Nuno Lopes19830332008-11-04 14:28:33 +00006727#line 3288 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006728 {
Reid Spencer14310612006-12-31 05:40:51 +00006729
6730 // Handle the short syntax
Andrew Lenharth6353e052006-12-08 18:07:09 +00006731 const PointerType *PFTy = 0;
6732 const FunctionType *Ty = 0;
Devang Patel652203f2008-09-29 20:49:50 +00006733 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(4) - (9)].TypeVal)->get())) ||
Andrew Lenharth6353e052006-12-08 18:07:09 +00006734 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6735 // Pull out the types of all of the arguments...
6736 std::vector<const Type*> ParamTypes;
Devang Patel652203f2008-09-29 20:49:50 +00006737 ParamList::iterator I = (yyvsp[(7) - (9)].ParamList)->begin(), E = (yyvsp[(7) - (9)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006738 for (; I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00006739 const Type *Ty = I->Val->getType();
6740 if (Ty == Type::VoidTy)
6741 GEN_ERROR("Short call syntax cannot be used with varargs");
6742 ParamTypes.push_back(Ty);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006743 }
Chris Lattnera925a142008-04-23 05:37:08 +00006744
Devang Patel652203f2008-09-29 20:49:50 +00006745 if (!FunctionType::isValidReturnType(*(yyvsp[(4) - (9)].TypeVal)))
Chris Lattnera925a142008-04-23 05:37:08 +00006746 GEN_ERROR("Invalid result type for LLVM function");
6747
Devang Patel652203f2008-09-29 20:49:50 +00006748 Ty = FunctionType::get((yyvsp[(4) - (9)].TypeVal)->get(), ParamTypes, false);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00006749 PFTy = PointerType::getUnqual(Ty);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006750 }
Chris Lattner6cdc6822007-04-26 05:31:05 +00006751
Devang Patel652203f2008-09-29 20:49:50 +00006752 Value *V = getVal(PFTy, (yyvsp[(5) - (9)].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00006753 CHECK_FOR_ERROR
Chris Lattner6cdc6822007-04-26 05:31:05 +00006754
Reid Spencer7780acb2007-04-16 06:56:07 +00006755 // Check for call to invalid intrinsic to avoid crashing later.
6756 if (Function *theF = dyn_cast<Function>(V)) {
Reid Spencered48de22007-04-16 22:02:23 +00006757 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
Reid Spencer36fdde12007-04-16 20:35:38 +00006758 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6759 !theF->getIntrinsicID(true))
Reid Spencer7780acb2007-04-16 06:56:07 +00006760 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6761 theF->getName() + "'");
6762 }
6763
Devang Patel05988662008-09-25 21:00:45 +00006764 // Set up the Attributes for the function
6765 SmallVector<AttributeWithIndex, 8> Attrs;
Dale Johannesene7261862008-09-26 23:46:20 +00006766 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
6767 //attributes.
Devang Patel652203f2008-09-29 20:49:50 +00006768 Attributes RetAttrs = (yyvsp[(3) - (9)].Attributes);
6769 if ((yyvsp[(9) - (9)].Attributes) != Attribute::None) {
6770 if ((yyvsp[(9) - (9)].Attributes) & Attribute::ZExt) {
Dale Johannesene7261862008-09-26 23:46:20 +00006771 RetAttrs = RetAttrs | Attribute::ZExt;
Devang Patel652203f2008-09-29 20:49:50 +00006772 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::ZExt;
Dale Johannesene7261862008-09-26 23:46:20 +00006773 }
Devang Patel652203f2008-09-29 20:49:50 +00006774 if ((yyvsp[(9) - (9)].Attributes) & Attribute::SExt) {
Dale Johannesene7261862008-09-26 23:46:20 +00006775 RetAttrs = RetAttrs | Attribute::SExt;
Devang Patel652203f2008-09-29 20:49:50 +00006776 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::SExt;
Dale Johannesene7261862008-09-26 23:46:20 +00006777 }
Devang Patel652203f2008-09-29 20:49:50 +00006778 if ((yyvsp[(9) - (9)].Attributes) & Attribute::InReg) {
Dale Johannesene7261862008-09-26 23:46:20 +00006779 RetAttrs = RetAttrs | Attribute::InReg;
Devang Patel652203f2008-09-29 20:49:50 +00006780 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::InReg;
Dale Johannesene7261862008-09-26 23:46:20 +00006781 }
Dale Johannesene7261862008-09-26 23:46:20 +00006782 }
Devang Patel652203f2008-09-29 20:49:50 +00006783 if (RetAttrs != Attribute::None)
6784 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
Dale Johannesene7261862008-09-26 23:46:20 +00006785
Eric Christopher2a5196f2008-09-24 04:55:49 +00006786 // Check the arguments
Reid Spencer14310612006-12-31 05:40:51 +00006787 ValueList Args;
Devang Patel652203f2008-09-29 20:49:50 +00006788 if ((yyvsp[(7) - (9)].ParamList)->empty()) { // Has no arguments?
Andrew Lenharth6353e052006-12-08 18:07:09 +00006789 // Make sure no arguments is a good thing!
6790 if (Ty->getNumParams() != 0)
6791 GEN_ERROR("No arguments passed to a function that "
Reid Spencerb5334b02007-02-05 10:18:06 +00006792 "expects arguments");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006793 } else { // Has arguments?
6794 // Loop through FunctionType's arguments and ensure they are specified
Duncan Sandsdc024672007-11-27 13:23:08 +00006795 // correctly. Also, gather any parameter attributes.
Andrew Lenharth6353e052006-12-08 18:07:09 +00006796 FunctionType::param_iterator I = Ty->param_begin();
6797 FunctionType::param_iterator E = Ty->param_end();
Devang Patel652203f2008-09-29 20:49:50 +00006798 ParamList::iterator ArgI = (yyvsp[(7) - (9)].ParamList)->begin(), ArgE = (yyvsp[(7) - (9)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006799 unsigned index = 1;
Andrew Lenharth6353e052006-12-08 18:07:09 +00006800
Duncan Sandsdc024672007-11-27 13:23:08 +00006801 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006802 if (ArgI->Val->getType() != *I)
6803 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00006804 (*I)->getDescription() + "'");
Reid Spencer14310612006-12-31 05:40:51 +00006805 Args.push_back(ArgI->Val);
Devang Patel05988662008-09-25 21:00:45 +00006806 if (ArgI->Attrs != Attribute::None)
6807 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00006808 }
6809 if (Ty->isVarArg()) {
6810 if (I == E)
Chris Lattner38905612008-02-19 04:36:25 +00006811 for (; ArgI != ArgE; ++ArgI, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006812 Args.push_back(ArgI->Val); // push the remaining varargs
Devang Patel05988662008-09-25 21:00:45 +00006813 if (ArgI->Attrs != Attribute::None)
6814 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Chris Lattner38905612008-02-19 04:36:25 +00006815 }
Reid Spencer14310612006-12-31 05:40:51 +00006816 } else if (I != E || ArgI != ArgE)
Reid Spencerb5334b02007-02-05 10:18:06 +00006817 GEN_ERROR("Invalid number of parameters detected");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006818 }
Devang Patel652203f2008-09-29 20:49:50 +00006819 if ((yyvsp[(9) - (9)].Attributes) != Attribute::None)
6820 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(9) - (9)].Attributes)));
Duncan Sandsdc024672007-11-27 13:23:08 +00006821
Devang Patel05988662008-09-25 21:00:45 +00006822 // Finish off the Attributes and check them
6823 AttrListPtr PAL;
Duncan Sandsdc024672007-11-27 13:23:08 +00006824 if (!Attrs.empty())
Devang Patel05988662008-09-25 21:00:45 +00006825 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsdc024672007-11-27 13:23:08 +00006826
Reid Spencer14310612006-12-31 05:40:51 +00006827 // Create the call node
Gabor Greife64d2482008-04-06 23:07:54 +00006828 CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
Devang Patel652203f2008-09-29 20:49:50 +00006829 CI->setTailCall((yyvsp[(1) - (9)].BoolVal));
6830 CI->setCallingConv((yyvsp[(2) - (9)].UIntVal));
Devang Patel05988662008-09-25 21:00:45 +00006831 CI->setAttributes(PAL);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006832 (yyval.InstVal) = CI;
Devang Patel652203f2008-09-29 20:49:50 +00006833 delete (yyvsp[(7) - (9)].ParamList);
6834 delete (yyvsp[(4) - (9)].TypeVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00006835 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006836 ;}
6837 break;
6838
Chris Lattner740e7092008-10-15 06:16:57 +00006839 case 335:
Nuno Lopes19830332008-11-04 14:28:33 +00006840#line 3397 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006841 {
6842 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00006843 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006844 ;}
6845 break;
6846
Chris Lattner740e7092008-10-15 06:16:57 +00006847 case 336:
Nuno Lopes19830332008-11-04 14:28:33 +00006848#line 3402 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006849 {
6850 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00006851 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006852 ;}
6853 break;
6854
Chris Lattner740e7092008-10-15 06:16:57 +00006855 case 337:
Nuno Lopes19830332008-11-04 14:28:33 +00006856#line 3406 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006857 {
6858 (yyval.BoolVal) = false;
Reid Spencer61c83e02006-08-18 08:43:06 +00006859 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006860 ;}
6861 break;
6862
Chris Lattner740e7092008-10-15 06:16:57 +00006863 case 338:
Nuno Lopes19830332008-11-04 14:28:33 +00006864#line 3413 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006865 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006866 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006867 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6868 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6869 delete (yyvsp[(2) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006870 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006871 ;}
6872 break;
6873
Chris Lattner740e7092008-10-15 06:16:57 +00006874 case 339:
Nuno Lopes19830332008-11-04 14:28:33 +00006875#line 3420 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006876 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006877 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006878 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006879 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6880 GEN_ERROR("Malloc array size is not a 32-bit integer!");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006881 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00006882 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006883 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6884 delete (yyvsp[(2) - (6)].TypeVal);
6885 ;}
6886 break;
6887
Chris Lattner740e7092008-10-15 06:16:57 +00006888 case 340:
Nuno Lopes19830332008-11-04 14:28:33 +00006889#line 3430 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006890 {
Reid Spencer14310612006-12-31 05:40:51 +00006891 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006892 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6893 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6894 delete (yyvsp[(2) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006895 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006896 ;}
6897 break;
6898
Chris Lattner740e7092008-10-15 06:16:57 +00006899 case 341:
Nuno Lopes19830332008-11-04 14:28:33 +00006900#line 3437 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006901 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006902 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006903 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006904 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6905 GEN_ERROR("Alloca array size is not a 32-bit integer!");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006906 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006907 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006908 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6909 delete (yyvsp[(2) - (6)].TypeVal);
6910 ;}
6911 break;
6912
Chris Lattner740e7092008-10-15 06:16:57 +00006913 case 342:
Nuno Lopes19830332008-11-04 14:28:33 +00006914#line 3447 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006915 {
6916 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
Eric Christopher2a5196f2008-09-24 04:55:49 +00006917 GEN_ERROR("Trying to free nonpointer type " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006918 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6919 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006920 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006921 ;}
6922 break;
6923
Chris Lattner740e7092008-10-15 06:16:57 +00006924 case 343:
Nuno Lopes19830332008-11-04 14:28:33 +00006925#line 3455 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006926 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006927 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006928 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6929 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006930 GEN_ERROR("Can't load from nonpointer type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006931 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6932 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006933 GEN_ERROR("Can't load from pointer of non-first-class type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006934 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6935 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006936 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006937 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6938 delete (yyvsp[(3) - (5)].TypeVal);
6939 ;}
6940 break;
6941
Chris Lattner740e7092008-10-15 06:16:57 +00006942 case 344:
Nuno Lopes19830332008-11-04 14:28:33 +00006943#line 3469 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006944 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006945 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006946 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6947 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006948 if (!PT)
6949 GEN_ERROR("Can't store to a nonpointer type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006950 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006951 const Type *ElTy = PT->getElementType();
Dan Gohmanf4423b12008-04-19 00:24:39 +00006952 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6953 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006954 "' into space of type '" + ElTy->getDescription() + "'");
6955
Dan Gohmanf4423b12008-04-19 00:24:39 +00006956 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006957 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006958 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6959 delete (yyvsp[(5) - (7)].TypeVal);
6960 ;}
6961 break;
6962
Chris Lattner740e7092008-10-15 06:16:57 +00006963 case 345:
Nuno Lopes19830332008-11-04 14:28:33 +00006964#line 3486 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006965 {
Dan Gohman1a570242008-07-23 00:54:54 +00006966 if (!UpRefs.empty())
6967 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6968 if (!isa<StructType>((yyvsp[(2) - (5)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (5)].TypeVal)->get()))
6969 GEN_ERROR("getresult insn requires an aggregate operand");
6970 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].UInt64Val)))
6971 GEN_ERROR("Invalid getresult index for type '" +
6972 (*(yyvsp[(2) - (5)].TypeVal))->getDescription()+ "'");
6973
6974 Value *tmpVal = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Devang Patel5a970972008-02-19 22:27:01 +00006975 CHECK_FOR_ERROR
Dan Gohman1a570242008-07-23 00:54:54 +00006976 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(5) - (5)].UInt64Val));
6977 delete (yyvsp[(2) - (5)].TypeVal);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006978 ;}
6979 break;
6980
Chris Lattner740e7092008-10-15 06:16:57 +00006981 case 346:
Nuno Lopes19830332008-11-04 14:28:33 +00006982#line 3500 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006983 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006984 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006985 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6986 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
Reid Spencerb5334b02007-02-05 10:18:06 +00006987 GEN_ERROR("getelementptr insn requires pointer operand");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006988
Dan Gohman041e2eb2008-05-15 19:50:34 +00006989 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()))
Reid Spencer61c83e02006-08-18 08:43:06 +00006990 GEN_ERROR("Invalid getelementptr indices for type '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006991 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6992 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00006993 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006994 (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
Eric Christopher2a5196f2008-09-24 04:55:49 +00006995 delete (yyvsp[(2) - (4)].TypeVal);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006996 delete (yyvsp[(4) - (4)].ValueList);
6997 ;}
6998 break;
Reid Spencer7780acb2007-04-16 06:56:07 +00006999
Chris Lattner740e7092008-10-15 06:16:57 +00007000 case 347:
Nuno Lopes19830332008-11-04 14:28:33 +00007001#line 3515 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00007002 {
7003 if (!UpRefs.empty())
7004 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
7005 if (!isa<StructType>((yyvsp[(2) - (4)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (4)].TypeVal)->get()))
7006 GEN_ERROR("extractvalue insn requires an aggregate operand");
7007
Dan Gohman81a0c0b2008-05-31 00:58:22 +00007008 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end()))
Dan Gohmane4977cf2008-05-23 01:55:30 +00007009 GEN_ERROR("Invalid extractvalue indices for type '" +
7010 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
7011 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
7012 CHECK_FOR_ERROR
Dan Gohman81a0c0b2008-05-31 00:58:22 +00007013 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end());
Eric Christopher2a5196f2008-09-24 04:55:49 +00007014 delete (yyvsp[(2) - (4)].TypeVal);
Dan Gohman81a0c0b2008-05-31 00:58:22 +00007015 delete (yyvsp[(4) - (4)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00007016 ;}
7017 break;
7018
Chris Lattner740e7092008-10-15 06:16:57 +00007019 case 348:
Nuno Lopes19830332008-11-04 14:28:33 +00007020#line 3530 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00007021 {
7022 if (!UpRefs.empty())
7023 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription());
7024 if (!isa<StructType>((yyvsp[(2) - (7)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (7)].TypeVal)->get()))
7025 GEN_ERROR("extractvalue insn requires an aggregate operand");
7026
Dan Gohman81a0c0b2008-05-31 00:58:22 +00007027 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 +00007028 GEN_ERROR("Invalid insertvalue indices for type '" +
7029 (*(yyvsp[(2) - (7)].TypeVal))->getDescription()+ "'");
7030 Value* aggVal = getVal(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(3) - (7)].ValIDVal));
7031 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
7032 CHECK_FOR_ERROR
Dan Gohman81a0c0b2008-05-31 00:58:22 +00007033 (yyval.InstVal) = InsertValueInst::Create(aggVal, tmpVal, (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end());
Eric Christopher2a5196f2008-09-24 04:55:49 +00007034 delete (yyvsp[(2) - (7)].TypeVal);
Dan Gohmane4977cf2008-05-23 01:55:30 +00007035 delete (yyvsp[(5) - (7)].TypeVal);
Dan Gohman81a0c0b2008-05-31 00:58:22 +00007036 delete (yyvsp[(7) - (7)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00007037 ;}
7038 break;
7039
Dan Gohmanf4423b12008-04-19 00:24:39 +00007040
7041/* Line 1267 of yacc.c. */
Nuno Lopes19830332008-11-04 14:28:33 +00007042#line 7043 "llvmAsmParser.tab.c"
Dan Gohmanf4423b12008-04-19 00:24:39 +00007043 default: break;
Dale Johannesencdd509a2007-09-07 21:07:57 +00007044 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00007045 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
7046
7047 YYPOPSTACK (yylen);
7048 yylen = 0;
7049 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00007050
7051 *++yyvsp = yyval;
7052
7053
Dan Gohmanf4423b12008-04-19 00:24:39 +00007054 /* Now `shift' the result of the reduction. Determine what state
7055 that goes to, based on the state we popped back to and the rule
7056 number reduced by. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00007057
7058 yyn = yyr1[yyn];
7059
Dan Gohmanf4423b12008-04-19 00:24:39 +00007060 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
7061 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00007062 yystate = yytable[yystate];
7063 else
Dan Gohmanf4423b12008-04-19 00:24:39 +00007064 yystate = yydefgoto[yyn - YYNTOKENS];
Reid Spencer68a24bd2005-08-27 18:50:39 +00007065
7066 goto yynewstate;
7067
7068
Dan Gohmanf4423b12008-04-19 00:24:39 +00007069/*------------------------------------.
7070| yyerrlab -- here on detecting error |
7071`------------------------------------*/
7072yyerrlab:
7073 /* If not already recovering from an error, report this error. */
7074 if (!yyerrstatus)
Reid Spencer68a24bd2005-08-27 18:50:39 +00007075 {
7076 ++yynerrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00007077#if ! YYERROR_VERBOSE
7078 yyerror (YY_("syntax error"));
7079#else
7080 {
7081 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
7082 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
7083 {
7084 YYSIZE_T yyalloc = 2 * yysize;
7085 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
7086 yyalloc = YYSTACK_ALLOC_MAXIMUM;
7087 if (yymsg != yymsgbuf)
7088 YYSTACK_FREE (yymsg);
7089 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
7090 if (yymsg)
7091 yymsg_alloc = yyalloc;
7092 else
7093 {
7094 yymsg = yymsgbuf;
7095 yymsg_alloc = sizeof yymsgbuf;
7096 }
7097 }
Dale Johannesencdd509a2007-09-07 21:07:57 +00007098
Dan Gohmanf4423b12008-04-19 00:24:39 +00007099 if (0 < yysize && yysize <= yymsg_alloc)
7100 {
7101 (void) yysyntax_error (yymsg, yystate, yychar);
7102 yyerror (yymsg);
7103 }
7104 else
7105 {
7106 yyerror (YY_("syntax error"));
7107 if (yysize != 0)
7108 goto yyexhaustedlab;
7109 }
7110 }
7111#endif
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00007112 }
7113
Dan Gohmanf4423b12008-04-19 00:24:39 +00007114
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00007115
7116 if (yyerrstatus == 3)
7117 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00007118 /* If just tried and failed to reuse look-ahead token after an
7119 error, discard it. */
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00007120
Dan Gohmanf4423b12008-04-19 00:24:39 +00007121 if (yychar <= YYEOF)
7122 {
7123 /* Return failure if at end of input. */
7124 if (yychar == YYEOF)
7125 YYABORT;
7126 }
7127 else
7128 {
7129 yydestruct ("Error: discarding",
7130 yytoken, &yylval);
7131 yychar = YYEMPTY;
7132 }
7133 }
7134
7135 /* Else will try to reuse look-ahead token after shifting the error
7136 token. */
7137 goto yyerrlab1;
7138
7139
7140/*---------------------------------------------------.
7141| yyerrorlab -- error raised explicitly by YYERROR. |
7142`---------------------------------------------------*/
7143yyerrorlab:
7144
7145 /* Pacify compilers like GCC when the user code never invokes
7146 YYERROR and the label yyerrorlab therefore never appears in user
7147 code. */
7148 if (/*CONSTCOND*/ 0)
7149 goto yyerrorlab;
7150
7151 /* Do not reclaim the symbols of the rule which action triggered
7152 this YYERROR. */
7153 YYPOPSTACK (yylen);
7154 yylen = 0;
7155 YY_STACK_PRINT (yyss, yyssp);
7156 yystate = *yyssp;
7157 goto yyerrlab1;
7158
7159
7160/*-------------------------------------------------------------.
7161| yyerrlab1 -- common code for both syntax error and YYERROR. |
7162`-------------------------------------------------------------*/
7163yyerrlab1:
7164 yyerrstatus = 3; /* Each real token shifted decrements this. */
7165
7166 for (;;)
7167 {
7168 yyn = yypact[yystate];
7169 if (yyn != YYPACT_NINF)
7170 {
7171 yyn += YYTERROR;
7172 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
7173 {
7174 yyn = yytable[yyn];
7175 if (0 < yyn)
7176 break;
7177 }
7178 }
7179
7180 /* Pop the current state because it cannot handle the error token. */
7181 if (yyssp == yyss)
Reid Spencer68a24bd2005-08-27 18:50:39 +00007182 YYABORT;
7183
Dale Johannesencdd509a2007-09-07 21:07:57 +00007184
Dan Gohmanf4423b12008-04-19 00:24:39 +00007185 yydestruct ("Error: popping",
7186 yystos[yystate], yyvsp);
7187 YYPOPSTACK (1);
7188 yystate = *yyssp;
7189 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00007190 }
7191
7192 if (yyn == YYFINAL)
7193 YYACCEPT;
7194
Reid Spencer68a24bd2005-08-27 18:50:39 +00007195 *++yyvsp = yylval;
Dan Gohmanf4423b12008-04-19 00:24:39 +00007196
7197
7198 /* Shift the error token. */
7199 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spencerb8f85052007-07-31 03:50:36 +00007200
Reid Spencer68a24bd2005-08-27 18:50:39 +00007201 yystate = yyn;
7202 goto yynewstate;
7203
Gabor Greife64d2482008-04-06 23:07:54 +00007204
Dan Gohmanf4423b12008-04-19 00:24:39 +00007205/*-------------------------------------.
7206| yyacceptlab -- YYACCEPT comes here. |
7207`-------------------------------------*/
7208yyacceptlab:
7209 yyresult = 0;
7210 goto yyreturn;
7211
7212/*-----------------------------------.
7213| yyabortlab -- YYABORT comes here. |
7214`-----------------------------------*/
7215yyabortlab:
7216 yyresult = 1;
7217 goto yyreturn;
7218
7219#ifndef yyoverflow
7220/*-------------------------------------------------.
7221| yyexhaustedlab -- memory exhaustion comes here. |
7222`-------------------------------------------------*/
7223yyexhaustedlab:
7224 yyerror (YY_("memory exhausted"));
7225 yyresult = 2;
7226 /* Fall through. */
Chris Lattner38905612008-02-19 04:36:25 +00007227#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00007228
7229yyreturn:
7230 if (yychar != YYEOF && yychar != YYEMPTY)
7231 yydestruct ("Cleanup: discarding lookahead",
7232 yytoken, &yylval);
7233 /* Do not reclaim the symbols of the rule which action triggered
7234 this YYABORT or YYACCEPT. */
7235 YYPOPSTACK (yylen);
7236 YY_STACK_PRINT (yyss, yyssp);
7237 while (yyssp != yyss)
7238 {
7239 yydestruct ("Cleanup: popping",
7240 yystos[*yyssp], yyvsp);
7241 YYPOPSTACK (1);
Gabor Greife64d2482008-04-06 23:07:54 +00007242 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00007243#ifndef yyoverflow
7244 if (yyss != yyssa)
7245 YYSTACK_FREE (yyss);
7246#endif
7247#if YYERROR_VERBOSE
7248 if (yymsg != yymsgbuf)
7249 YYSTACK_FREE (yymsg);
7250#endif
7251 /* Make sure YYID is used. */
7252 return YYID (yyresult);
Reid Spencer68a24bd2005-08-27 18:50:39 +00007253}
Dan Gohmanf4423b12008-04-19 00:24:39 +00007254
7255
Nuno Lopes19830332008-11-04 14:28:33 +00007256#line 3549 "/cvs/llvm/lib/AsmParser/llvmAsmParser.y"
Reid Spencer61c83e02006-08-18 08:43:06 +00007257
7258
Reid Spencer14310612006-12-31 05:40:51 +00007259// common code from the two 'RunVMAsmParser' functions
7260static Module* RunParser(Module * M) {
Reid Spencer14310612006-12-31 05:40:51 +00007261 CurModule.CurrentModule = M;
Reid Spencer14310612006-12-31 05:40:51 +00007262 // Check to make sure the parser succeeded
7263 if (yyparse()) {
7264 if (ParserResult)
7265 delete ParserResult;
7266 return 0;
7267 }
7268
Reid Spencer0d60b5a2007-03-30 01:37:39 +00007269 // Emit an error if there are any unresolved types left.
7270 if (!CurModule.LateResolveTypes.empty()) {
7271 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
7272 if (DID.Type == ValID::LocalName) {
7273 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
7274 } else {
7275 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
7276 }
7277 if (ParserResult)
7278 delete ParserResult;
7279 return 0;
7280 }
7281
7282 // Emit an error if there are any unresolved values left.
7283 if (!CurModule.LateResolveValues.empty()) {
7284 Value *V = CurModule.LateResolveValues.back();
7285 std::map<Value*, std::pair<ValID, int> >::iterator I =
7286 CurModule.PlaceHolderInfo.find(V);
7287
7288 if (I != CurModule.PlaceHolderInfo.end()) {
7289 ValID &DID = I->second.first;
7290 if (DID.Type == ValID::LocalName) {
7291 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
7292 } else {
7293 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
7294 }
7295 if (ParserResult)
7296 delete ParserResult;
7297 return 0;
7298 }
7299 }
7300
Reid Spencer14310612006-12-31 05:40:51 +00007301 // Check to make sure that parsing produced a result
7302 if (!ParserResult)
7303 return 0;
7304
7305 // Reset ParserResult variable while saving its value for the result.
7306 Module *Result = ParserResult;
7307 ParserResult = 0;
7308
7309 return Result;
7310}
7311
Reid Spencer61c83e02006-08-18 08:43:06 +00007312void llvm::GenerateError(const std::string &message, int LineNo) {
Duncan Sandsdc024672007-11-27 13:23:08 +00007313 if (LineNo == -1) LineNo = LLLgetLineNo();
Reid Spencer61c83e02006-08-18 08:43:06 +00007314 // TODO: column number in exception
7315 if (TheParseError)
Duncan Sandsdc024672007-11-27 13:23:08 +00007316 TheParseError->setError(LLLgetFilename(), message, LineNo);
Reid Spencer61c83e02006-08-18 08:43:06 +00007317 TriggerError = 1;
7318}
Reid Spencer68a24bd2005-08-27 18:50:39 +00007319
7320int yyerror(const char *ErrorMsg) {
Duncan Sandsdc024672007-11-27 13:23:08 +00007321 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
Reid Spenceref9b9a72007-02-05 20:47:22 +00007322 std::string errMsg = where + "error: " + std::string(ErrorMsg);
Duncan Sandsdc024672007-11-27 13:23:08 +00007323 if (yychar != YYEMPTY && yychar != 0) {
7324 errMsg += " while reading token: '";
Eric Christopher2a5196f2008-09-24 04:55:49 +00007325 errMsg += std::string(LLLgetTokenStart(),
Duncan Sandsdc024672007-11-27 13:23:08 +00007326 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
7327 }
Reid Spencer61c83e02006-08-18 08:43:06 +00007328 GenerateError(errMsg);
Reid Spencer68a24bd2005-08-27 18:50:39 +00007329 return 0;
7330}
Dan Gohmanf4423b12008-04-19 00:24:39 +00007331