blob: c9ff29a451a606b9d43da9c0327eefbf818664f7 [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,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +0000230 SSP = 411,
231 SSPREQ = 412,
232 DEFAULT = 413,
233 HIDDEN = 414,
234 PROTECTED = 415
Dan Gohmanf4423b12008-04-19 00:24:39 +0000235 };
236#endif
237/* Tokens. */
238#define ESINT64VAL 258
239#define EUINT64VAL 259
240#define ESAPINTVAL 260
241#define EUAPINTVAL 261
242#define LOCALVAL_ID 262
243#define GLOBALVAL_ID 263
244#define FPVAL 264
245#define VOID 265
246#define INTTYPE 266
247#define FLOAT 267
248#define DOUBLE 268
249#define X86_FP80 269
250#define FP128 270
251#define PPC_FP128 271
252#define LABEL 272
253#define TYPE 273
254#define LOCALVAR 274
255#define GLOBALVAR 275
256#define LABELSTR 276
257#define STRINGCONSTANT 277
258#define ATSTRINGCONSTANT 278
259#define PCTSTRINGCONSTANT 279
260#define ZEROINITIALIZER 280
261#define TRUETOK 281
262#define FALSETOK 282
263#define BEGINTOK 283
264#define ENDTOK 284
265#define DECLARE 285
266#define DEFINE 286
267#define GLOBAL 287
268#define CONSTANT 288
269#define SECTION 289
270#define ALIAS 290
271#define VOLATILE 291
272#define THREAD_LOCAL 292
273#define TO 293
274#define DOTDOTDOT 294
275#define NULL_TOK 295
276#define UNDEF 296
277#define INTERNAL 297
278#define LINKONCE 298
279#define WEAK 299
280#define APPENDING 300
281#define DLLIMPORT 301
282#define DLLEXPORT 302
283#define EXTERN_WEAK 303
Dale Johannesenc7071cc2008-05-14 20:13:36 +0000284#define COMMON 304
285#define OPAQUE 305
286#define EXTERNAL 306
287#define TARGET 307
288#define TRIPLE 308
289#define ALIGN 309
290#define ADDRSPACE 310
291#define DEPLIBS 311
292#define CALL 312
293#define TAIL 313
294#define ASM_TOK 314
295#define MODULE 315
296#define SIDEEFFECT 316
297#define CC_TOK 317
298#define CCC_TOK 318
299#define FASTCC_TOK 319
300#define COLDCC_TOK 320
301#define X86_STDCALLCC_TOK 321
302#define X86_FASTCALLCC_TOK 322
Dale Johannesendfe8c842008-09-26 19:32:34 +0000303#define DATALAYOUT 323
304#define RET 324
305#define BR 325
306#define SWITCH 326
307#define INVOKE 327
308#define UNWIND 328
309#define UNREACHABLE 329
310#define ADD 330
311#define SUB 331
312#define MUL 332
313#define UDIV 333
314#define SDIV 334
315#define FDIV 335
316#define UREM 336
317#define SREM 337
318#define FREM 338
319#define AND 339
320#define OR 340
321#define XOR 341
322#define SHL 342
323#define LSHR 343
324#define ASHR 344
325#define ICMP 345
326#define FCMP 346
327#define VICMP 347
328#define VFCMP 348
329#define EQ 349
330#define NE 350
331#define SLT 351
332#define SGT 352
333#define SLE 353
334#define SGE 354
335#define ULT 355
336#define UGT 356
337#define ULE 357
338#define UGE 358
339#define OEQ 359
340#define ONE 360
341#define OLT 361
342#define OGT 362
343#define OLE 363
344#define OGE 364
345#define ORD 365
346#define UNO 366
347#define UEQ 367
348#define UNE 368
349#define MALLOC 369
350#define ALLOCA 370
351#define FREE 371
352#define LOAD 372
353#define STORE 373
354#define GETELEMENTPTR 374
355#define TRUNC 375
356#define ZEXT 376
357#define SEXT 377
358#define FPTRUNC 378
359#define FPEXT 379
360#define BITCAST 380
361#define UITOFP 381
362#define SITOFP 382
363#define FPTOUI 383
364#define FPTOSI 384
365#define INTTOPTR 385
366#define PTRTOINT 386
367#define PHI_TOK 387
368#define SELECT 388
369#define VAARG 389
370#define EXTRACTELEMENT 390
371#define INSERTELEMENT 391
372#define SHUFFLEVECTOR 392
373#define GETRESULT 393
374#define EXTRACTVALUE 394
375#define INSERTVALUE 395
376#define SIGNEXT 396
377#define ZEROEXT 397
378#define NORETURN 398
379#define INREG 399
380#define SRET 400
381#define NOUNWIND 401
382#define NOALIAS 402
383#define BYVAL 403
384#define NEST 404
385#define READNONE 405
386#define READONLY 406
387#define GC 407
Devang Patel652203f2008-09-29 20:49:50 +0000388#define OPTSIZE 408
389#define NOINLINE 409
390#define ALWAYSINLINE 410
Bill Wendling6ff4bfe2008-11-13 01:03:00 +0000391#define SSP 411
392#define SSPREQ 412
393#define DEFAULT 413
394#define HIDDEN 414
395#define PROTECTED 415
Dan Gohmanf4423b12008-04-19 00:24:39 +0000396
397
398
399
400/* Copy the first part of user declarations. */
Bill Wendling6ff4bfe2008-11-13 01:03:00 +0000401#line 14 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000402
403#include "ParserInternals.h"
404#include "llvm/CallingConv.h"
Chris Lattner0e9c3762006-01-25 22:27:16 +0000405#include "llvm/InlineAsm.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000406#include "llvm/Instructions.h"
407#include "llvm/Module.h"
Reid Spenceref9b9a72007-02-05 20:47:22 +0000408#include "llvm/ValueSymbolTable.h"
Chandler Carruth02202192007-08-04 01:56:21 +0000409#include "llvm/AutoUpgrade.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000410#include "llvm/Support/GetElementPtrTypeIterator.h"
Reid Spencer14310612006-12-31 05:40:51 +0000411#include "llvm/Support/CommandLine.h"
Chris Lattnerf7469af2007-01-31 04:44:08 +0000412#include "llvm/ADT/SmallVector.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000413#include "llvm/ADT/STLExtras.h"
Chris Lattner0019bbe2005-11-06 06:46:53 +0000414#include "llvm/Support/MathExtras.h"
Reid Spencer481169e2006-12-01 00:33:46 +0000415#include "llvm/Support/Streams.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000416#include <algorithm>
Reid Spencer68a24bd2005-08-27 18:50:39 +0000417#include <list>
Chris Lattner8adde282007-02-11 21:40:10 +0000418#include <map>
Reid Spencer68a24bd2005-08-27 18:50:39 +0000419#include <utility>
420
Reid Spencere4f47592006-08-18 17:32:55 +0000421// The following is a gross hack. In order to rid the libAsmParser library of
422// exceptions, we have to have a way of getting the yyparse function to go into
423// an error situation. So, whenever we want an error to occur, the GenerateError
Eric Christopher2a5196f2008-09-24 04:55:49 +0000424// function (see bottom of file) sets TriggerError. Then, at the end of each
425// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
426// (a goto) to put YACC in error state. Furthermore, several calls to
Reid Spencere4f47592006-08-18 17:32:55 +0000427// GenerateError are made from inside productions and they must simulate the
428// previous exception behavior by exiting the production immediately. We have
429// replaced these with the GEN_ERROR macro which calls GeneratError and then
Eric Christopher2a5196f2008-09-24 04:55:49 +0000430// immediately invokes YYERROR. This would be so much cleaner if it was a
Reid Spencere4f47592006-08-18 17:32:55 +0000431// recursive descent parser.
Reid Spencer61c83e02006-08-18 08:43:06 +0000432static bool TriggerError = false;
Reid Spencerf63697d2006-10-09 17:36:59 +0000433#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
Reid Spencer61c83e02006-08-18 08:43:06 +0000434#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
435
Reid Spencer68a24bd2005-08-27 18:50:39 +0000436int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
437int yylex(); // declaration" of xxx warnings.
438int yyparse();
Reid Spencer68a24bd2005-08-27 18:50:39 +0000439using namespace llvm;
440
441static Module *ParserResult;
442
443// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
444// relating to upreferences in the input stream.
445//
446//#define DEBUG_UPREFS 1
447#ifdef DEBUG_UPREFS
Bill Wendlinge8156192006-12-07 01:30:32 +0000448#define UR_OUT(X) cerr << X
Reid Spencer68a24bd2005-08-27 18:50:39 +0000449#else
450#define UR_OUT(X)
451#endif
452
453#define YYERROR_VERBOSE 1
454
Chris Lattnerb475c422005-11-12 18:22:38 +0000455static GlobalVariable *CurGV;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000456
457
458// This contains info used when building the body of a function. It is
459// destroyed when the function is completed.
460//
461typedef std::vector<Value *> ValueList; // Numbered defs
Reid Spencer14310612006-12-31 05:40:51 +0000462
Eric Christopher2a5196f2008-09-24 04:55:49 +0000463static void
Reid Spencer93c40032007-03-19 18:40:50 +0000464ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000465
466static struct PerModuleInfo {
467 Module *CurrentModule;
Reid Spencer93c40032007-03-19 18:40:50 +0000468 ValueList Values; // Module level numbered definitions
469 ValueList LateResolveValues;
Reid Spencer861d9d62006-11-28 07:29:44 +0000470 std::vector<PATypeHolder> Types;
471 std::map<ValID, PATypeHolder> LateResolveTypes;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000472
473 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
Chris Lattner0ad19702006-06-21 16:53:00 +0000474 /// how they were referenced and on which line of the input they came from so
Reid Spencer68a24bd2005-08-27 18:50:39 +0000475 /// that we can resolve them later and print error messages as appropriate.
476 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
477
478 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
479 // references to global values. Global values may be referenced before they
480 // are defined, and if so, the temporary object that they represent is held
481 // here. This is used for forward references of GlobalValues.
482 //
483 typedef std::map<std::pair<const PointerType *,
484 ValID>, GlobalValue*> GlobalRefsType;
485 GlobalRefsType GlobalRefs;
486
487 void ModuleDone() {
488 // If we could not resolve some functions at function compilation time
489 // (calls to functions before they are defined), resolve them now... Types
490 // are resolved when the constant pool has been completely parsed.
491 //
492 ResolveDefinitions(LateResolveValues);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000493 if (TriggerError)
494 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000495
496 // Check to make sure that all global value forward references have been
497 // resolved!
498 //
499 if (!GlobalRefs.empty()) {
500 std::string UndefinedReferences = "Unresolved global references exist:\n";
501
502 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
503 I != E; ++I) {
504 UndefinedReferences += " " + I->first.first->getDescription() + " " +
505 I->first.second.getName() + "\n";
506 }
Reid Spencer61c83e02006-08-18 08:43:06 +0000507 GenerateError(UndefinedReferences);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000508 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000509 }
510
Chandler Carruth02202192007-08-04 01:56:21 +0000511 // Look for intrinsic functions and CallInst that need to be upgraded
512 for (Module::iterator FI = CurrentModule->begin(),
513 FE = CurrentModule->end(); FI != FE; )
514 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
515
Reid Spencer68a24bd2005-08-27 18:50:39 +0000516 Values.clear(); // Clear out function local definitions
517 Types.clear();
518 CurrentModule = 0;
519 }
520
Reid Spencer68a24bd2005-08-27 18:50:39 +0000521 // GetForwardRefForGlobal - Check to see if there is a forward reference
522 // for this global. If so, remove it from the GlobalRefs map and return it.
523 // If not, just return null.
524 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
525 // Check to see if there is a forward reference to this global variable...
526 // if there is, eliminate it and patch the reference to use the new def'n.
527 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
528 GlobalValue *Ret = 0;
529 if (I != GlobalRefs.end()) {
530 Ret = I->second;
Nuno Lopes8a5f3472008-10-15 12:05:02 +0000531 I->first.second.destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +0000532 GlobalRefs.erase(I);
533 }
534 return Ret;
535 }
Reid Spencer8c8a2dc2007-01-02 21:54:12 +0000536
537 bool TypeIsUnresolved(PATypeHolder* PATy) {
538 // If it isn't abstract, its resolved
539 const Type* Ty = PATy->get();
540 if (!Ty->isAbstract())
541 return false;
542 // Traverse the type looking for abstract types. If it isn't abstract then
Eric Christopher2a5196f2008-09-24 04:55:49 +0000543 // we don't need to traverse that leg of the type.
Reid Spencer8c8a2dc2007-01-02 21:54:12 +0000544 std::vector<const Type*> WorkList, SeenList;
545 WorkList.push_back(Ty);
546 while (!WorkList.empty()) {
547 const Type* Ty = WorkList.back();
548 SeenList.push_back(Ty);
549 WorkList.pop_back();
550 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
551 // Check to see if this is an unresolved type
552 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
553 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
554 for ( ; I != E; ++I) {
555 if (I->second.get() == OpTy)
556 return true;
557 }
558 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
559 const Type* TheTy = SeqTy->getElementType();
560 if (TheTy->isAbstract() && TheTy != Ty) {
Eric Christopher2a5196f2008-09-24 04:55:49 +0000561 std::vector<const Type*>::iterator I = SeenList.begin(),
Reid Spencer8c8a2dc2007-01-02 21:54:12 +0000562 E = SeenList.end();
563 for ( ; I != E; ++I)
564 if (*I == TheTy)
565 break;
566 if (I == E)
567 WorkList.push_back(TheTy);
568 }
569 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
570 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
571 const Type* TheTy = StrTy->getElementType(i);
572 if (TheTy->isAbstract() && TheTy != Ty) {
Eric Christopher2a5196f2008-09-24 04:55:49 +0000573 std::vector<const Type*>::iterator I = SeenList.begin(),
Reid Spencer8c8a2dc2007-01-02 21:54:12 +0000574 E = SeenList.end();
575 for ( ; I != E; ++I)
576 if (*I == TheTy)
577 break;
578 if (I == E)
579 WorkList.push_back(TheTy);
580 }
581 }
582 }
583 }
584 return false;
585 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000586} CurModule;
587
588static struct PerFunctionInfo {
589 Function *CurrentFunction; // Pointer to current function being created
590
Reid Spencer93c40032007-03-19 18:40:50 +0000591 ValueList Values; // Keep track of #'d definitions
592 unsigned NextValNum;
593 ValueList LateResolveValues;
Reid Spenceref9b9a72007-02-05 20:47:22 +0000594 bool isDeclare; // Is this function a forward declararation?
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000595 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000596 GlobalValue::VisibilityTypes Visibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000597
598 /// BBForwardRefs - When we see forward references to basic blocks, keep
599 /// track of them here.
Reid Spencer93c40032007-03-19 18:40:50 +0000600 std::map<ValID, BasicBlock*> BBForwardRefs;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000601
602 inline PerFunctionInfo() {
603 CurrentFunction = 0;
604 isDeclare = false;
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000605 Linkage = GlobalValue::ExternalLinkage;
606 Visibility = GlobalValue::DefaultVisibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000607 }
608
609 inline void FunctionStart(Function *M) {
610 CurrentFunction = M;
Reid Spencer93c40032007-03-19 18:40:50 +0000611 NextValNum = 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000612 }
613
614 void FunctionDone() {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000615 // Any forward referenced blocks left?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000616 if (!BBForwardRefs.empty()) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000617 GenerateError("Undefined reference to label " +
Reid Spencer93c40032007-03-19 18:40:50 +0000618 BBForwardRefs.begin()->second->getName());
Reid Spencer5b7e7532006-09-28 19:28:24 +0000619 return;
620 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000621
622 // Resolve all forward references now.
623 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
624
625 Values.clear(); // Clear out function local definitions
Reid Spencer93c40032007-03-19 18:40:50 +0000626 BBForwardRefs.clear();
Reid Spencer68a24bd2005-08-27 18:50:39 +0000627 CurrentFunction = 0;
628 isDeclare = false;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000629 Linkage = GlobalValue::ExternalLinkage;
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000630 Visibility = GlobalValue::DefaultVisibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000631 }
632} CurFun; // Info for the current function...
633
634static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
635
636
637//===----------------------------------------------------------------------===//
638// Code to handle definitions of all the types
639//===----------------------------------------------------------------------===//
640
Chris Lattner15bd0952008-08-29 17:20:18 +0000641/// InsertValue - Insert a value into the value table. If it is named, this
642/// returns -1, otherwise it returns the slot number for the value.
643static int InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
Reid Spencer93c40032007-03-19 18:40:50 +0000644 // Things that have names or are void typed don't get slot numbers
645 if (V->hasName() || (V->getType() == Type::VoidTy))
Chris Lattner15bd0952008-08-29 17:20:18 +0000646 return -1;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000647
Reid Spencer93c40032007-03-19 18:40:50 +0000648 // In the case of function values, we have to allow for the forward reference
649 // of basic blocks, which are included in the numbering. Consequently, we keep
Eric Christopher2a5196f2008-09-24 04:55:49 +0000650 // track of the next insertion location with NextValNum. When a BB gets
Reid Spencer93c40032007-03-19 18:40:50 +0000651 // inserted, it could change the size of the CurFun.Values vector.
652 if (&ValueTab == &CurFun.Values) {
653 if (ValueTab.size() <= CurFun.NextValNum)
654 ValueTab.resize(CurFun.NextValNum+1);
655 ValueTab[CurFun.NextValNum++] = V;
Chris Lattner15bd0952008-08-29 17:20:18 +0000656 return CurFun.NextValNum-1;
Eric Christopher2a5196f2008-09-24 04:55:49 +0000657 }
Reid Spencer93c40032007-03-19 18:40:50 +0000658 // For all other lists, its okay to just tack it on the back of the vector.
659 ValueTab.push_back(V);
Chris Lattner15bd0952008-08-29 17:20:18 +0000660 return ValueTab.size()-1;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000661}
662
663static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
664 switch (D.Type) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000665 case ValID::LocalID: // Is it a numbered definition?
Reid Spencer68a24bd2005-08-27 18:50:39 +0000666 // Module constants occupy the lowest numbered slots...
Reid Spencer41dff5e2007-01-26 08:05:27 +0000667 if (D.Num < CurModule.Types.size())
668 return CurModule.Types[D.Num];
Reid Spencer68a24bd2005-08-27 18:50:39 +0000669 break;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000670 case ValID::LocalName: // Is it a named definition?
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000671 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000672 D.destroy(); // Free old strdup'd memory...
673 return N;
674 }
675 break;
676 default:
Reid Spencerb5334b02007-02-05 10:18:06 +0000677 GenerateError("Internal parser error: Invalid symbol type reference");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000678 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000679 }
680
681 // If we reached here, we referenced either a symbol that we don't know about
682 // or an id number that hasn't been read yet. We may be referencing something
683 // forward, so just create an entry to be resolved later and get to it...
684 //
685 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
686
687
688 if (inFunctionScope()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000689 if (D.Type == ValID::LocalName) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000690 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000691 return 0;
692 } else {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000693 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
Reid Spencer5b7e7532006-09-28 19:28:24 +0000694 return 0;
695 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000696 }
697
Reid Spencer861d9d62006-11-28 07:29:44 +0000698 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
Nuno Lopesf05ff662008-10-15 11:20:21 +0000699 if (I != CurModule.LateResolveTypes.end()) {
700 D.destroy();
Reid Spencer861d9d62006-11-28 07:29:44 +0000701 return I->second;
Nuno Lopesf05ff662008-10-15 11:20:21 +0000702 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000703
Reid Spencer861d9d62006-11-28 07:29:44 +0000704 Type *Typ = OpaqueType::get();
705 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
706 return Typ;
Reid Spencera132e042006-12-03 05:46:11 +0000707 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000708
Reid Spencer93c40032007-03-19 18:40:50 +0000709// getExistingVal - Look up the value specified by the provided type and
Reid Spencer68a24bd2005-08-27 18:50:39 +0000710// the provided ValID. If the value exists and has already been defined, return
711// it. Otherwise return null.
712//
Reid Spencer93c40032007-03-19 18:40:50 +0000713static Value *getExistingVal(const Type *Ty, const ValID &D) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000714 if (isa<FunctionType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000715 GenerateError("Functions are not values and "
Reid Spencer68a24bd2005-08-27 18:50:39 +0000716 "must be referenced as pointers");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000717 return 0;
718 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000719
720 switch (D.Type) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000721 case ValID::LocalID: { // Is it a numbered definition?
Reid Spencer41dff5e2007-01-26 08:05:27 +0000722 // Check that the number is within bounds.
Eric Christopher2a5196f2008-09-24 04:55:49 +0000723 if (D.Num >= CurFun.Values.size())
Reid Spencer93c40032007-03-19 18:40:50 +0000724 return 0;
725 Value *Result = CurFun.Values[D.Num];
726 if (Ty != Result->getType()) {
727 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
Eric Christopher2a5196f2008-09-24 04:55:49 +0000728 Result->getType()->getDescription() + "' does not match "
Reid Spencer93c40032007-03-19 18:40:50 +0000729 "expected type, '" + Ty->getDescription() + "'");
730 return 0;
731 }
732 return Result;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000733 }
734 case ValID::GlobalID: { // Is it a numbered definition?
Eric Christopher2a5196f2008-09-24 04:55:49 +0000735 if (D.Num >= CurModule.Values.size())
Reid Spenceref9b9a72007-02-05 20:47:22 +0000736 return 0;
Reid Spencer93c40032007-03-19 18:40:50 +0000737 Value *Result = CurModule.Values[D.Num];
738 if (Ty != Result->getType()) {
739 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
Eric Christopher2a5196f2008-09-24 04:55:49 +0000740 Result->getType()->getDescription() + "' does not match "
Reid Spencer93c40032007-03-19 18:40:50 +0000741 "expected type, '" + Ty->getDescription() + "'");
Reid Spenceref9b9a72007-02-05 20:47:22 +0000742 return 0;
Reid Spencer93c40032007-03-19 18:40:50 +0000743 }
744 return Result;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000745 }
Eric Christopher2a5196f2008-09-24 04:55:49 +0000746
Reid Spencer41dff5e2007-01-26 08:05:27 +0000747 case ValID::LocalName: { // Is it a named definition?
Eric Christopher2a5196f2008-09-24 04:55:49 +0000748 if (!inFunctionScope())
Reid Spenceref9b9a72007-02-05 20:47:22 +0000749 return 0;
750 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000751 Value *N = SymTab.lookup(D.getName());
Eric Christopher2a5196f2008-09-24 04:55:49 +0000752 if (N == 0)
Reid Spenceref9b9a72007-02-05 20:47:22 +0000753 return 0;
754 if (N->getType() != Ty)
755 return 0;
Eric Christopher2a5196f2008-09-24 04:55:49 +0000756
Reid Spencer41dff5e2007-01-26 08:05:27 +0000757 D.destroy(); // Free old strdup'd memory...
758 return N;
759 }
760 case ValID::GlobalName: { // Is it a named definition?
Reid Spenceref9b9a72007-02-05 20:47:22 +0000761 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000762 Value *N = SymTab.lookup(D.getName());
Eric Christopher2a5196f2008-09-24 04:55:49 +0000763 if (N == 0)
Reid Spenceref9b9a72007-02-05 20:47:22 +0000764 return 0;
765 if (N->getType() != Ty)
766 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000767
768 D.destroy(); // Free old strdup'd memory...
769 return N;
770 }
771
772 // Check to make sure that "Ty" is an integral type, and that our
773 // value will fit into the specified type...
774 case ValID::ConstSIntVal: // Is it a constant pool reference??
Chris Lattner38905612008-02-19 04:36:25 +0000775 if (!isa<IntegerType>(Ty) ||
776 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000777 GenerateError("Signed integral constant '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000778 itostr(D.ConstPool64) + "' is invalid for type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +0000779 Ty->getDescription() + "'");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000780 return 0;
781 }
Reid Spencer49d273e2007-03-19 20:40:51 +0000782 return ConstantInt::get(Ty, D.ConstPool64, true);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000783
784 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
Chris Lattner38905612008-02-19 04:36:25 +0000785 if (isa<IntegerType>(Ty) &&
786 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
Reid Spencerb83eb642006-10-20 07:07:24 +0000787 return ConstantInt::get(Ty, D.UConstPool64);
Chris Lattner38905612008-02-19 04:36:25 +0000788
789 if (!isa<IntegerType>(Ty) ||
790 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
791 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
792 "' is invalid or out of range for type '" +
793 Ty->getDescription() + "'");
794 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000795 }
Chris Lattner38905612008-02-19 04:36:25 +0000796 // This is really a signed reference. Transmogrify.
797 return ConstantInt::get(Ty, D.ConstPool64, true);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000798
Chris Lattner1913b942008-07-11 00:30:39 +0000799 case ValID::ConstAPInt: // Is it an unsigned const pool reference?
800 if (!isa<IntegerType>(Ty)) {
801 GenerateError("Integral constant '" + D.getName() +
802 "' is invalid or out of range for type '" +
803 Ty->getDescription() + "'");
804 return 0;
805 }
Eric Christopher2a5196f2008-09-24 04:55:49 +0000806
Chris Lattner1913b942008-07-11 00:30:39 +0000807 {
808 APSInt Tmp = *D.ConstPoolInt;
Nuno Lopes19830332008-11-04 14:28:33 +0000809 D.destroy();
Chris Lattner1913b942008-07-11 00:30:39 +0000810 Tmp.extOrTrunc(Ty->getPrimitiveSizeInBits());
811 return ConstantInt::get(Tmp);
812 }
Eric Christopher2a5196f2008-09-24 04:55:49 +0000813
Reid Spencer68a24bd2005-08-27 18:50:39 +0000814 case ValID::ConstFPVal: // Is it a floating point const pool reference?
Chris Lattner38905612008-02-19 04:36:25 +0000815 if (!Ty->isFloatingPoint() ||
816 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000817 GenerateError("FP constant invalid for type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000818 return 0;
819 }
Eric Christopher2a5196f2008-09-24 04:55:49 +0000820 // Lexer has no type info, so builds all float and double FP constants
Dale Johannesenc72cd7e2007-09-11 18:33:39 +0000821 // as double. Fix this here. Long double does not need this.
822 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
Dale Johannesen236bbd42008-10-09 23:01:34 +0000823 Ty==Type::FloatTy) {
824 bool ignored;
825 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven,
826 &ignored);
827 }
Nuno Lopesaa386d02008-11-04 14:43:20 +0000828 {
829 ConstantFP *tmp = ConstantFP::get(*D.ConstPoolFP);
830 D.destroy();
831 return tmp;
832 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000833
834 case ValID::ConstNullVal: // Is it a null value?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000835 if (!isa<PointerType>(Ty)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000836 GenerateError("Cannot create a a non pointer null");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000837 return 0;
838 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000839 return ConstantPointerNull::get(cast<PointerType>(Ty));
840
841 case ValID::ConstUndefVal: // Is it an undef value?
842 return UndefValue::get(Ty);
843
Chris Lattner7aa61892005-12-21 17:53:23 +0000844 case ValID::ConstZeroVal: // Is it a zero value?
845 return Constant::getNullValue(Ty);
Eric Christopher2a5196f2008-09-24 04:55:49 +0000846
Reid Spencer68a24bd2005-08-27 18:50:39 +0000847 case ValID::ConstantVal: // Fully resolved constant?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000848 if (D.ConstantValue->getType() != Ty) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000849 GenerateError("Constant expression type different from required type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000850 return 0;
851 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000852 return D.ConstantValue;
853
Chris Lattner0e9c3762006-01-25 22:27:16 +0000854 case ValID::InlineAsmVal: { // Inline asm expression
855 const PointerType *PTy = dyn_cast<PointerType>(Ty);
856 const FunctionType *FTy =
857 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000858 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000859 GenerateError("Invalid type for asm constraint string");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000860 return 0;
861 }
Chris Lattner0e9c3762006-01-25 22:27:16 +0000862 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
863 D.IAD->HasSideEffects);
864 D.destroy(); // Free InlineAsmDescriptor.
865 return IA;
866 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000867 default:
Reid Spencera9720f52007-02-05 17:04:00 +0000868 assert(0 && "Unhandled case!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000869 return 0;
870 } // End of switch
871
Reid Spencera9720f52007-02-05 17:04:00 +0000872 assert(0 && "Unhandled case!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000873 return 0;
874}
875
Reid Spencer93c40032007-03-19 18:40:50 +0000876// getVal - This function is identical to getExistingVal, except that if a
Reid Spencer68a24bd2005-08-27 18:50:39 +0000877// value is not already defined, it "improvises" by creating a placeholder var
878// that looks and acts just like the requested variable. When the value is
879// defined later, all uses of the placeholder variable are replaced with the
880// real thing.
881//
882static Value *getVal(const Type *Ty, const ValID &ID) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000883 if (Ty == Type::LabelTy) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000884 GenerateError("Cannot use a basic block here");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000885 return 0;
886 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000887
888 // See if the value has already been defined.
Reid Spencer93c40032007-03-19 18:40:50 +0000889 Value *V = getExistingVal(Ty, ID);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000890 if (V) return V;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000891 if (TriggerError) return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000892
Reid Spencer5b7e7532006-09-28 19:28:24 +0000893 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
Dan Gohmane4977cf2008-05-23 01:55:30 +0000894 GenerateError("Invalid use of a non-first-class type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000895 return 0;
896 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000897
898 // If we reached here, we referenced either a symbol that we don't know about
899 // or an id number that hasn't been read yet. We may be referencing something
900 // forward, so just create an entry to be resolved later and get to it...
901 //
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000902 switch (ID.Type) {
903 case ValID::GlobalName:
Reid Spencer9c9b63a2007-04-28 16:07:31 +0000904 case ValID::GlobalID: {
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000905 const PointerType *PTy = dyn_cast<PointerType>(Ty);
906 if (!PTy) {
907 GenerateError("Invalid type for reference to global" );
908 return 0;
909 }
910 const Type* ElTy = PTy->getElementType();
911 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
Gabor Greife64d2482008-04-06 23:07:54 +0000912 V = Function::Create(FTy, GlobalValue::ExternalLinkage);
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000913 else
Christopher Lamba8ed9bf2007-12-11 09:02:08 +0000914 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
915 (Module*)0, false, PTy->getAddressSpace());
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000916 break;
Reid Spencer9c9b63a2007-04-28 16:07:31 +0000917 }
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000918 default:
919 V = new Argument(Ty);
920 }
Eric Christopher2a5196f2008-09-24 04:55:49 +0000921
Reid Spencer68a24bd2005-08-27 18:50:39 +0000922 // Remember where this forward reference came from. FIXME, shouldn't we try
923 // to recycle these things??
924 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
Duncan Sandsdc024672007-11-27 13:23:08 +0000925 LLLgetLineNo())));
Reid Spencer68a24bd2005-08-27 18:50:39 +0000926
927 if (inFunctionScope())
928 InsertValue(V, CurFun.LateResolveValues);
929 else
930 InsertValue(V, CurModule.LateResolveValues);
931 return V;
932}
933
Reid Spencer93c40032007-03-19 18:40:50 +0000934/// defineBBVal - This is a definition of a new basic block with the specified
935/// identifier which must be the same as CurFun.NextValNum, if its numeric.
Chris Lattnercc81d152008-05-04 17:18:47 +0000936static BasicBlock *defineBBVal(const ValID &ID) {
Reid Spencera9720f52007-02-05 17:04:00 +0000937 assert(inFunctionScope() && "Can't get basic block at global scope!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000938
Reid Spencer68a24bd2005-08-27 18:50:39 +0000939 BasicBlock *BB = 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000940
Reid Spencer93c40032007-03-19 18:40:50 +0000941 // First, see if this was forward referenced
Reid Spencer68a24bd2005-08-27 18:50:39 +0000942
Reid Spencer93c40032007-03-19 18:40:50 +0000943 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
944 if (BBI != CurFun.BBForwardRefs.end()) {
945 BB = BBI->second;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000946 // The forward declaration could have been inserted anywhere in the
947 // function: insert it into the correct place now.
948 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
949 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
Reid Spencer93c40032007-03-19 18:40:50 +0000950
Reid Spencer66728ef2007-03-20 01:13:36 +0000951 // We're about to erase the entry, save the key so we can clean it up.
952 ValID Tmp = BBI->first;
953
Reid Spencer93c40032007-03-19 18:40:50 +0000954 // Erase the forward ref from the map as its no longer "forward"
955 CurFun.BBForwardRefs.erase(ID);
956
Eric Christopher2a5196f2008-09-24 04:55:49 +0000957 // The key has been removed from the map but so we don't want to leave
Reid Spencer66728ef2007-03-20 01:13:36 +0000958 // strdup'd memory around so destroy it too.
959 Tmp.destroy();
960
Reid Spencer93c40032007-03-19 18:40:50 +0000961 // If its a numbered definition, bump the number and set the BB value.
962 if (ID.Type == ValID::LocalID) {
963 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
964 InsertValue(BB);
965 }
Eric Christopher2a5196f2008-09-24 04:55:49 +0000966 } else {
967 // We haven't seen this BB before and its first mention is a definition.
Devang Patel67909432008-03-03 18:58:47 +0000968 // Just create it and return it.
969 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
Gabor Greife64d2482008-04-06 23:07:54 +0000970 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Devang Patel67909432008-03-03 18:58:47 +0000971 if (ID.Type == ValID::LocalID) {
972 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
973 InsertValue(BB);
974 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000975 }
Reid Spencer93c40032007-03-19 18:40:50 +0000976
Devang Patel67909432008-03-03 18:58:47 +0000977 ID.destroy();
Reid Spencer93c40032007-03-19 18:40:50 +0000978 return BB;
979}
980
981/// getBBVal - get an existing BB value or create a forward reference for it.
Eric Christopher2a5196f2008-09-24 04:55:49 +0000982///
Reid Spencer93c40032007-03-19 18:40:50 +0000983static BasicBlock *getBBVal(const ValID &ID) {
984 assert(inFunctionScope() && "Can't get basic block at global scope!");
985
986 BasicBlock *BB = 0;
987
988 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
989 if (BBI != CurFun.BBForwardRefs.end()) {
990 BB = BBI->second;
991 } if (ID.Type == ValID::LocalName) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000992 std::string Name = ID.getName();
Reid Spencer93c40032007-03-19 18:40:50 +0000993 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
Anton Korobeynikovc70d7732008-02-20 12:10:37 +0000994 if (N) {
Reid Spencer93c40032007-03-19 18:40:50 +0000995 if (N->getType()->getTypeID() == Type::LabelTyID)
996 BB = cast<BasicBlock>(N);
997 else
998 GenerateError("Reference to label '" + Name + "' is actually of type '"+
999 N->getType()->getDescription() + "'");
Anton Korobeynikovc70d7732008-02-20 12:10:37 +00001000 }
Reid Spencer93c40032007-03-19 18:40:50 +00001001 } else if (ID.Type == ValID::LocalID) {
1002 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
1003 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
1004 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
1005 else
Eric Christopher2a5196f2008-09-24 04:55:49 +00001006 GenerateError("Reference to label '%" + utostr(ID.Num) +
1007 "' is actually of type '"+
Reid Spencer93c40032007-03-19 18:40:50 +00001008 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
1009 }
1010 } else {
1011 GenerateError("Illegal label reference " + ID.getName());
1012 return 0;
1013 }
1014
1015 // If its already been defined, return it now.
1016 if (BB) {
1017 ID.destroy(); // Free strdup'd memory.
1018 return BB;
1019 }
1020
1021 // Otherwise, this block has not been seen before, create it.
1022 std::string Name;
1023 if (ID.Type == ValID::LocalName)
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001024 Name = ID.getName();
Gabor Greife64d2482008-04-06 23:07:54 +00001025 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Reid Spencer93c40032007-03-19 18:40:50 +00001026
1027 // Insert it in the forward refs map.
1028 CurFun.BBForwardRefs[ID] = BB;
1029
Reid Spencer68a24bd2005-08-27 18:50:39 +00001030 return BB;
1031}
1032
1033
1034//===----------------------------------------------------------------------===//
1035// Code to handle forward references in instructions
1036//===----------------------------------------------------------------------===//
1037//
1038// This code handles the late binding needed with statements that reference
1039// values not defined yet... for example, a forward branch, or the PHI node for
1040// a loop body.
1041//
1042// This keeps a table (CurFun.LateResolveValues) of all such forward references
1043// and back patchs after we are done.
1044//
1045
1046// ResolveDefinitions - If we could not resolve some defs at parsing
1047// time (forward branches, phi functions for loops, etc...) resolve the
1048// defs now...
1049//
Eric Christopher2a5196f2008-09-24 04:55:49 +00001050static void
Reid Spencer93c40032007-03-19 18:40:50 +00001051ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001052 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
Reid Spencer93c40032007-03-19 18:40:50 +00001053 while (!LateResolvers.empty()) {
1054 Value *V = LateResolvers.back();
1055 LateResolvers.pop_back();
Reid Spencer68a24bd2005-08-27 18:50:39 +00001056
Reid Spencer93c40032007-03-19 18:40:50 +00001057 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1058 CurModule.PlaceHolderInfo.find(V);
1059 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001060
Reid Spencer93c40032007-03-19 18:40:50 +00001061 ValID &DID = PHI->second.first;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001062
Reid Spencer93c40032007-03-19 18:40:50 +00001063 Value *TheRealValue = getExistingVal(V->getType(), DID);
1064 if (TriggerError)
1065 return;
1066 if (TheRealValue) {
1067 V->replaceAllUsesWith(TheRealValue);
1068 delete V;
1069 CurModule.PlaceHolderInfo.erase(PHI);
1070 } else if (FutureLateResolvers) {
1071 // Functions have their unresolved items forwarded to the module late
1072 // resolver table
1073 InsertValue(V, *FutureLateResolvers);
1074 } else {
1075 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1076 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1077 "' of type '" + V->getType()->getDescription() + "'",
1078 PHI->second.second);
Reid Spencer5b7e7532006-09-28 19:28:24 +00001079 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001080 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00001081 GenerateError("Reference to an invalid definition: #" +
1082 itostr(DID.Num) + " of type '" +
1083 V->getType()->getDescription() + "'",
1084 PHI->second.second);
1085 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001086 }
1087 }
1088 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001089 LateResolvers.clear();
1090}
1091
1092// ResolveTypeTo - A brand new type was just declared. This means that (if
1093// name is not null) things referencing Name can be resolved. Otherwise, things
1094// refering to the number can be resolved. Do this now.
1095//
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001096static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001097 ValID D;
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001098 if (Name)
1099 D = ValID::createLocalName(*Name);
Eric Christopher2a5196f2008-09-24 04:55:49 +00001100 else
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001101 D = ValID::createLocalID(CurModule.Types.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00001102
Reid Spencer861d9d62006-11-28 07:29:44 +00001103 std::map<ValID, PATypeHolder>::iterator I =
Reid Spencer68a24bd2005-08-27 18:50:39 +00001104 CurModule.LateResolveTypes.find(D);
1105 if (I != CurModule.LateResolveTypes.end()) {
Reid Spencer861d9d62006-11-28 07:29:44 +00001106 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
Nuno Lopes6ec8a252008-10-15 11:11:12 +00001107 I->first.destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +00001108 CurModule.LateResolveTypes.erase(I);
1109 }
Nuno Lopes191dfb92008-10-03 15:52:39 +00001110 D.destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +00001111}
1112
1113// setValueName - Set the specified value to the name given. The name may be
1114// null potentially, in which case this is a noop. The string passed in is
1115// assumed to be a malloc'd string buffer, and is free'd by this function.
1116//
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001117static void setValueName(Value *V, std::string *NameStr) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00001118 if (!NameStr) return;
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001119 std::string Name(*NameStr); // Copy string
1120 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001121
Reid Spencer41dff5e2007-01-26 08:05:27 +00001122 if (V->getType() == Type::VoidTy) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001123 GenerateError("Can't assign name '" + Name+"' to value with void type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00001124 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001125 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00001126
Reid Spencera9720f52007-02-05 17:04:00 +00001127 assert(inFunctionScope() && "Must be in function scope!");
Reid Spenceref9b9a72007-02-05 20:47:22 +00001128 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1129 if (ST.lookup(Name)) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00001130 GenerateError("Redefinition of value '" + Name + "' of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00001131 V->getType()->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00001132 return;
1133 }
1134
1135 // Set the name.
1136 V->setName(Name);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001137}
1138
1139/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1140/// this is a declaration, otherwise it is a definition.
Chris Lattnerb475c422005-11-12 18:22:38 +00001141static GlobalVariable *
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001142ParseGlobalVariable(std::string *NameStr,
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001143 GlobalValue::LinkageTypes Linkage,
1144 GlobalValue::VisibilityTypes Visibility,
Chris Lattnerb475c422005-11-12 18:22:38 +00001145 bool isConstantGlobal, const Type *Ty,
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001146 Constant *Initializer, bool IsThreadLocal,
1147 unsigned AddressSpace = 0) {
Reid Spencer5b7e7532006-09-28 19:28:24 +00001148 if (isa<FunctionType>(Ty)) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001149 GenerateError("Cannot declare global vars of function type");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001150 return 0;
1151 }
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001152 if (Ty == Type::LabelTy) {
1153 GenerateError("Cannot declare global vars of label type");
1154 return 0;
1155 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001156
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001157 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001158
1159 std::string Name;
1160 if (NameStr) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001161 Name = *NameStr; // Copy string
1162 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001163 }
1164
1165 // See if this global value was forward referenced. If so, recycle the
1166 // object.
1167 ValID ID;
1168 if (!Name.empty()) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001169 ID = ValID::createGlobalName(Name);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001170 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00001171 ID = ValID::createGlobalID(CurModule.Values.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00001172 }
1173
1174 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1175 // Move the global to the end of the list, from whereever it was
1176 // previously inserted.
1177 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1178 CurModule.CurrentModule->getGlobalList().remove(GV);
1179 CurModule.CurrentModule->getGlobalList().push_back(GV);
1180 GV->setInitializer(Initializer);
1181 GV->setLinkage(Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001182 GV->setVisibility(Visibility);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001183 GV->setConstant(isConstantGlobal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00001184 GV->setThreadLocal(IsThreadLocal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001185 InsertValue(GV, CurModule.Values);
Nuno Lopes191dfb92008-10-03 15:52:39 +00001186 ID.destroy();
Chris Lattnerb475c422005-11-12 18:22:38 +00001187 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001188 }
1189
Nuno Lopes191dfb92008-10-03 15:52:39 +00001190 ID.destroy();
1191
Reid Spenceref9b9a72007-02-05 20:47:22 +00001192 // If this global has a name
Reid Spencer68a24bd2005-08-27 18:50:39 +00001193 if (!Name.empty()) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00001194 // if the global we're parsing has an initializer (is a definition) and
1195 // has external linkage.
1196 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1197 // If there is already a global with external linkage with this name
1198 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1199 // If we allow this GVar to get created, it will be renamed in the
1200 // symbol table because it conflicts with an existing GVar. We can't
1201 // allow redefinition of GVars whose linking indicates that their name
1202 // must stay the same. Issue the error.
1203 GenerateError("Redefinition of global variable named '" + Name +
1204 "' of type '" + Ty->getDescription() + "'");
1205 return 0;
1206 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001207 }
1208
1209 // Otherwise there is no existing GV to use, create one now.
1210 GlobalVariable *GV =
1211 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001212 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001213 GV->setVisibility(Visibility);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001214 InsertValue(GV, CurModule.Values);
Chris Lattnerb475c422005-11-12 18:22:38 +00001215 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001216}
1217
1218// setTypeName - Set the specified type to the name given. The name may be
1219// null potentially, in which case this is a noop. The string passed in is
1220// assumed to be a malloc'd string buffer, and is freed by this function.
1221//
1222// This function returns true if the type has already been defined, but is
1223// allowed to be redefined in the specified context. If the name is a new name
1224// for the type plane, it is inserted and false is returned.
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001225static bool setTypeName(const Type *T, std::string *NameStr) {
Reid Spencera9720f52007-02-05 17:04:00 +00001226 assert(!inFunctionScope() && "Can't give types function-local names!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001227 if (NameStr == 0) return false;
Eric Christopher2a5196f2008-09-24 04:55:49 +00001228
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001229 std::string Name(*NameStr); // Copy string
1230 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001231
1232 // We don't allow assigning names to void type
Reid Spencer5b7e7532006-09-28 19:28:24 +00001233 if (T == Type::VoidTy) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001234 GenerateError("Can't assign name '" + Name + "' to the void type");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001235 return false;
1236 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001237
1238 // Set the type name, checking for conflicts as we do so.
1239 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1240
1241 if (AlreadyExists) { // Inserting a name that is already defined???
1242 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
Reid Spencera9720f52007-02-05 17:04:00 +00001243 assert(Existing && "Conflict but no matching type?!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001244
1245 // There is only one case where this is allowed: when we are refining an
1246 // opaque type. In this case, Existing will be an opaque type.
1247 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1248 // We ARE replacing an opaque type!
1249 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1250 return true;
1251 }
1252
1253 // Otherwise, this is an attempt to redefine a type. That's okay if
1254 // the redefinition is identical to the original. This will be so if
1255 // Existing and T point to the same Type object. In this one case we
1256 // allow the equivalent redefinition.
1257 if (Existing == T) return true; // Yes, it's equal.
1258
1259 // Any other kind of (non-equivalent) redefinition is an error.
Reid Spencer63c34452007-01-05 21:51:07 +00001260 GenerateError("Redefinition of type named '" + Name + "' of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00001261 T->getDescription() + "'");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001262 }
1263
1264 return false;
1265}
1266
1267//===----------------------------------------------------------------------===//
1268// Code for handling upreferences in type names...
1269//
1270
1271// TypeContains - Returns true if Ty directly contains E in it.
1272//
1273static bool TypeContains(const Type *Ty, const Type *E) {
1274 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1275 E) != Ty->subtype_end();
1276}
1277
1278namespace {
1279 struct UpRefRecord {
1280 // NestingLevel - The number of nesting levels that need to be popped before
1281 // this type is resolved.
1282 unsigned NestingLevel;
1283
1284 // LastContainedTy - This is the type at the current binding level for the
1285 // type. Every time we reduce the nesting level, this gets updated.
1286 const Type *LastContainedTy;
1287
1288 // UpRefTy - This is the actual opaque type that the upreference is
1289 // represented with.
1290 OpaqueType *UpRefTy;
1291
1292 UpRefRecord(unsigned NL, OpaqueType *URTy)
1293 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1294 };
1295}
1296
1297// UpRefs - A list of the outstanding upreferences that need to be resolved.
1298static std::vector<UpRefRecord> UpRefs;
1299
1300/// HandleUpRefs - Every time we finish a new layer of types, this function is
1301/// called. It loops through the UpRefs vector, which is a list of the
1302/// currently active types. For each type, if the up reference is contained in
1303/// the newly completed type, we decrement the level count. When the level
1304/// count reaches zero, the upreferenced type is the type that is passed in:
1305/// thus we can complete the cycle.
1306///
1307static PATypeHolder HandleUpRefs(const Type *ty) {
Chris Lattner224f84f2006-08-18 17:34:45 +00001308 // If Ty isn't abstract, or if there are no up-references in it, then there is
1309 // nothing to resolve here.
1310 if (!ty->isAbstract() || UpRefs.empty()) return ty;
Eric Christopher2a5196f2008-09-24 04:55:49 +00001311
Reid Spencer68a24bd2005-08-27 18:50:39 +00001312 PATypeHolder Ty(ty);
1313 UR_OUT("Type '" << Ty->getDescription() <<
1314 "' newly formed. Resolving upreferences.\n" <<
1315 UpRefs.size() << " upreferences active!\n");
1316
1317 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1318 // to zero), we resolve them all together before we resolve them to Ty. At
1319 // the end of the loop, if there is anything to resolve to Ty, it will be in
1320 // this variable.
1321 OpaqueType *TypeToResolve = 0;
1322
1323 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1324 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1325 << UpRefs[i].second->getDescription() << ") = "
1326 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1327 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1328 // Decrement level of upreference
1329 unsigned Level = --UpRefs[i].NestingLevel;
1330 UpRefs[i].LastContainedTy = Ty;
1331 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1332 if (Level == 0) { // Upreference should be resolved!
1333 if (!TypeToResolve) {
1334 TypeToResolve = UpRefs[i].UpRefTy;
1335 } else {
1336 UR_OUT(" * Resolving upreference for "
1337 << UpRefs[i].second->getDescription() << "\n";
1338 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1339 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1340 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1341 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1342 }
1343 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1344 --i; // Do not skip the next element...
1345 }
1346 }
1347 }
1348
1349 if (TypeToResolve) {
1350 UR_OUT(" * Resolving upreference for "
1351 << UpRefs[i].second->getDescription() << "\n";
1352 std::string OldName = TypeToResolve->getDescription());
1353 TypeToResolve->refineAbstractTypeTo(Ty);
1354 }
1355
1356 return Ty;
1357}
1358
Reid Spencer68a24bd2005-08-27 18:50:39 +00001359//===----------------------------------------------------------------------===//
1360// RunVMAsmParser - Define an interface to this parser
1361//===----------------------------------------------------------------------===//
1362//
Reid Spencer14310612006-12-31 05:40:51 +00001363static Module* RunParser(Module * M);
1364
Duncan Sandsdc024672007-11-27 13:23:08 +00001365Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1366 InitLLLexer(MB);
1367 Module *M = RunParser(new Module(LLLgetFilename()));
1368 FreeLexer();
1369 return M;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001370}
1371
1372
Dan Gohmanf4423b12008-04-19 00:24:39 +00001373
1374/* Enabling traces. */
1375#ifndef YYDEBUG
1376# define YYDEBUG 0
1377#endif
1378
1379/* Enabling verbose error messages. */
1380#ifdef YYERROR_VERBOSE
1381# undef YYERROR_VERBOSE
1382# define YYERROR_VERBOSE 1
1383#else
1384# define YYERROR_VERBOSE 0
1385#endif
1386
1387/* Enabling the token table. */
1388#ifndef YYTOKEN_TABLE
1389# define YYTOKEN_TABLE 0
1390#endif
1391
1392#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1393typedef union YYSTYPE
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00001394#line 986 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00001395{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001396 llvm::Module *ModuleVal;
1397 llvm::Function *FunctionVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001398 llvm::BasicBlock *BasicBlockVal;
1399 llvm::TerminatorInst *TermInstVal;
1400 llvm::Instruction *InstVal;
Reid Spencera132e042006-12-03 05:46:11 +00001401 llvm::Constant *ConstVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001402
Reid Spencera132e042006-12-03 05:46:11 +00001403 const llvm::Type *PrimType;
Reid Spencer14310612006-12-31 05:40:51 +00001404 std::list<llvm::PATypeHolder> *TypeList;
Reid Spencera132e042006-12-03 05:46:11 +00001405 llvm::PATypeHolder *TypeVal;
1406 llvm::Value *ValueVal;
Reid Spencera132e042006-12-03 05:46:11 +00001407 std::vector<llvm::Value*> *ValueList;
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001408 std::vector<unsigned> *ConstantList;
Reid Spencer14310612006-12-31 05:40:51 +00001409 llvm::ArgListType *ArgList;
1410 llvm::TypeWithAttrs TypeWithAttrs;
1411 llvm::TypeWithAttrsList *TypeWithAttrsList;
Dale Johanneseneb57ea72007-11-05 21:20:28 +00001412 llvm::ParamList *ParamList;
Reid Spencer14310612006-12-31 05:40:51 +00001413
Reid Spencer68a24bd2005-08-27 18:50:39 +00001414 // Represent the RHS of PHI node
Reid Spencera132e042006-12-03 05:46:11 +00001415 std::list<std::pair<llvm::Value*,
1416 llvm::BasicBlock*> > *PHIList;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001417 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
Reid Spencera132e042006-12-03 05:46:11 +00001418 std::vector<llvm::Constant*> *ConstVector;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001419
1420 llvm::GlobalValue::LinkageTypes Linkage;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001421 llvm::GlobalValue::VisibilityTypes Visibility;
Devang Patel05988662008-09-25 21:00:45 +00001422 llvm::Attributes Attributes;
Reid Spencer38c91a92007-02-28 02:24:54 +00001423 llvm::APInt *APIntVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001424 int64_t SInt64Val;
1425 uint64_t UInt64Val;
1426 int SIntVal;
1427 unsigned UIntVal;
Dale Johannesencdd509a2007-09-07 21:07:57 +00001428 llvm::APFloat *FPVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001429 bool BoolVal;
1430
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001431 std::string *StrVal; // This memory must be deleted
1432 llvm::ValID ValIDVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001433
Reid Spencera132e042006-12-03 05:46:11 +00001434 llvm::Instruction::BinaryOps BinaryOpVal;
1435 llvm::Instruction::TermOps TermOpVal;
1436 llvm::Instruction::MemoryOps MemOpVal;
1437 llvm::Instruction::CastOps CastOpVal;
1438 llvm::Instruction::OtherOps OtherOpVal;
Reid Spencera132e042006-12-03 05:46:11 +00001439 llvm::ICmpInst::Predicate IPredicate;
1440 llvm::FCmpInst::Predicate FPredicate;
Dan Gohmanf4423b12008-04-19 00:24:39 +00001441}
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00001442/* Line 193 of yacc.c. */
1443#line 1444 "llvmAsmParser.tab.c"
Dan Gohmanf4423b12008-04-19 00:24:39 +00001444 YYSTYPE;
1445# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1446# define YYSTYPE_IS_DECLARED 1
1447# define YYSTYPE_IS_TRIVIAL 1
Reid Spencer68a24bd2005-08-27 18:50:39 +00001448#endif
1449
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001450
Reid Spencer68a24bd2005-08-27 18:50:39 +00001451
Dan Gohmanf4423b12008-04-19 00:24:39 +00001452/* Copy the second part of user declarations. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001453
1454
Dan Gohmanf4423b12008-04-19 00:24:39 +00001455/* Line 216 of yacc.c. */
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00001456#line 1457 "llvmAsmParser.tab.c"
Reid Spencerb8f85052007-07-31 03:50:36 +00001457
Dan Gohmanf4423b12008-04-19 00:24:39 +00001458#ifdef short
1459# undef short
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001460#endif
1461
Dan Gohmanf4423b12008-04-19 00:24:39 +00001462#ifdef YYTYPE_UINT8
1463typedef YYTYPE_UINT8 yytype_uint8;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001464#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00001465typedef unsigned char yytype_uint8;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001466#endif
1467
Dan Gohmanf4423b12008-04-19 00:24:39 +00001468#ifdef YYTYPE_INT8
1469typedef YYTYPE_INT8 yytype_int8;
1470#elif (defined __STDC__ || defined __C99__FUNC__ \
1471 || defined __cplusplus || defined _MSC_VER)
1472typedef signed char yytype_int8;
1473#else
1474typedef short int yytype_int8;
1475#endif
1476
1477#ifdef YYTYPE_UINT16
1478typedef YYTYPE_UINT16 yytype_uint16;
1479#else
1480typedef unsigned short int yytype_uint16;
1481#endif
1482
1483#ifdef YYTYPE_INT16
1484typedef YYTYPE_INT16 yytype_int16;
1485#else
1486typedef short int yytype_int16;
1487#endif
1488
1489#ifndef YYSIZE_T
1490# ifdef __SIZE_TYPE__
1491# define YYSIZE_T __SIZE_TYPE__
1492# elif defined size_t
1493# define YYSIZE_T size_t
1494# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1495 || defined __cplusplus || defined _MSC_VER)
1496# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1497# define YYSIZE_T size_t
1498# else
1499# define YYSIZE_T unsigned int
1500# endif
1501#endif
1502
1503#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1504
1505#ifndef YY_
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00001506# if defined YYENABLE_NLS && YYENABLE_NLS
Dan Gohmanf4423b12008-04-19 00:24:39 +00001507# if ENABLE_NLS
1508# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1509# define YY_(msgid) dgettext ("bison-runtime", msgid)
1510# endif
1511# endif
1512# ifndef YY_
1513# define YY_(msgid) msgid
1514# endif
1515#endif
1516
1517/* Suppress unused-variable warnings by "using" E. */
1518#if ! defined lint || defined __GNUC__
1519# define YYUSE(e) ((void) (e))
1520#else
1521# define YYUSE(e) /* empty */
1522#endif
1523
1524/* Identity function, used to suppress warnings about constant conditions. */
1525#ifndef lint
1526# define YYID(n) (n)
1527#else
1528#if (defined __STDC__ || defined __C99__FUNC__ \
1529 || defined __cplusplus || defined _MSC_VER)
1530static int
1531YYID (int i)
1532#else
1533static int
1534YYID (i)
1535 int i;
1536#endif
1537{
1538 return i;
1539}
1540#endif
1541
1542#if ! defined yyoverflow || YYERROR_VERBOSE
1543
1544/* The parser invokes alloca or malloc; define the necessary symbols. */
1545
1546# ifdef YYSTACK_USE_ALLOCA
1547# if YYSTACK_USE_ALLOCA
1548# ifdef __GNUC__
1549# define YYSTACK_ALLOC __builtin_alloca
1550# elif defined __BUILTIN_VA_ARG_INCR
1551# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1552# elif defined _AIX
1553# define YYSTACK_ALLOC __alloca
1554# elif defined _MSC_VER
1555# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1556# define alloca _alloca
1557# else
1558# define YYSTACK_ALLOC alloca
1559# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1560 || defined __cplusplus || defined _MSC_VER)
1561# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1562# ifndef _STDLIB_H
1563# define _STDLIB_H 1
1564# endif
1565# endif
1566# endif
1567# endif
1568# endif
1569
1570# ifdef YYSTACK_ALLOC
1571 /* Pacify GCC's `empty if-body' warning. */
1572# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1573# ifndef YYSTACK_ALLOC_MAXIMUM
1574 /* The OS might guarantee only one guard page at the bottom of the stack,
1575 and a page size can be as small as 4096 bytes. So we cannot safely
1576 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1577 to allow for a few compiler-allocated temporary stack slots. */
1578# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1579# endif
1580# else
1581# define YYSTACK_ALLOC YYMALLOC
1582# define YYSTACK_FREE YYFREE
1583# ifndef YYSTACK_ALLOC_MAXIMUM
1584# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1585# endif
1586# if (defined __cplusplus && ! defined _STDLIB_H \
1587 && ! ((defined YYMALLOC || defined malloc) \
1588 && (defined YYFREE || defined free)))
1589# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1590# ifndef _STDLIB_H
1591# define _STDLIB_H 1
1592# endif
1593# endif
1594# ifndef YYMALLOC
1595# define YYMALLOC malloc
1596# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1597 || defined __cplusplus || defined _MSC_VER)
1598void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1599# endif
1600# endif
1601# ifndef YYFREE
1602# define YYFREE free
1603# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1604 || defined __cplusplus || defined _MSC_VER)
1605void free (void *); /* INFRINGES ON USER NAME SPACE */
1606# endif
1607# endif
1608# endif
1609#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1610
1611
1612#if (! defined yyoverflow \
1613 && (! defined __cplusplus \
1614 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1615
1616/* A type that is properly aligned for any stack member. */
1617union yyalloc
1618{
1619 yytype_int16 yyss;
1620 YYSTYPE yyvs;
1621 };
1622
1623/* The size of the maximum gap between one aligned stack and the next. */
1624# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1625
1626/* The size of an array large to enough to hold all stacks, each with
1627 N elements. */
1628# define YYSTACK_BYTES(N) \
1629 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1630 + YYSTACK_GAP_MAXIMUM)
1631
1632/* Copy COUNT objects from FROM to TO. The source and destination do
1633 not overlap. */
1634# ifndef YYCOPY
1635# if defined __GNUC__ && 1 < __GNUC__
1636# define YYCOPY(To, From, Count) \
1637 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1638# else
1639# define YYCOPY(To, From, Count) \
1640 do \
1641 { \
1642 YYSIZE_T yyi; \
1643 for (yyi = 0; yyi < (Count); yyi++) \
1644 (To)[yyi] = (From)[yyi]; \
1645 } \
1646 while (YYID (0))
1647# endif
1648# endif
1649
1650/* Relocate STACK from its old location to the new one. The
1651 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1652 elements in the stack, and YYPTR gives the new location of the
1653 stack. Advance YYPTR to a properly aligned location for the next
1654 stack. */
1655# define YYSTACK_RELOCATE(Stack) \
1656 do \
1657 { \
1658 YYSIZE_T yynewbytes; \
1659 YYCOPY (&yyptr->Stack, Stack, yysize); \
1660 Stack = &yyptr->Stack; \
1661 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1662 yyptr += yynewbytes / sizeof (*yyptr); \
1663 } \
1664 while (YYID (0))
1665
1666#endif
1667
1668/* YYFINAL -- State number of the termination state. */
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001669#define YYFINAL 44
Dan Gohmanf4423b12008-04-19 00:24:39 +00001670/* YYLAST -- Last index in YYTABLE. */
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00001671#define YYLAST 2433
Dan Gohmanf4423b12008-04-19 00:24:39 +00001672
1673/* YYNTOKENS -- Number of terminals. */
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00001674#define YYNTOKENS 175
Dan Gohmanf4423b12008-04-19 00:24:39 +00001675/* YYNNTS -- Number of nonterminals. */
Chris Lattner740e7092008-10-15 06:16:57 +00001676#define YYNNTS 87
Dan Gohmanf4423b12008-04-19 00:24:39 +00001677/* YYNRULES -- Number of rules. */
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00001678#define YYNRULES 350
Dan Gohmanf4423b12008-04-19 00:24:39 +00001679/* YYNRULES -- Number of states. */
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00001680#define YYNSTATES 710
Dan Gohmanf4423b12008-04-19 00:24:39 +00001681
1682/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1683#define YYUNDEFTOK 2
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00001684#define YYMAXUTOK 415
Dan Gohmanf4423b12008-04-19 00:24:39 +00001685
1686#define YYTRANSLATE(YYX) \
1687 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1688
1689/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1690static const yytype_uint8 yytranslate[] =
1691{
1692 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1693 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1694 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1695 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00001696 161, 162, 165, 2, 164, 2, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001697 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00001698 170, 163, 171, 2, 2, 2, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001699 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1700 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00001701 2, 167, 166, 169, 2, 2, 2, 2, 2, 174,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001702 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1703 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00001704 168, 2, 2, 172, 2, 173, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001705 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, 2, 2, 2, 2,
1710 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1711 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1712 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1713 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1714 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1715 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1716 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1717 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1718 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1719 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1720 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1721 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1722 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1723 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1724 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1725 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1726 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1727 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1728 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1729 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1730 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1731 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001732 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00001733 155, 156, 157, 158, 159, 160
Dan Gohmanf4423b12008-04-19 00:24:39 +00001734};
1735
1736#if YYDEBUG
1737/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1738 YYRHS. */
1739static const yytype_uint16 yyprhs[] =
1740{
1741 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1742 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1743 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1744 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1745 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1746 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
Chris Lattner740e7092008-10-15 06:16:57 +00001747 118, 123, 124, 127, 128, 131, 133, 135, 137, 138,
1748 141, 143, 145, 147, 149, 151, 153, 155, 157, 159,
1749 160, 162, 164, 166, 167, 169, 171, 172, 174, 176,
1750 178, 180, 181, 183, 185, 186, 188, 190, 192, 194,
1751 196, 199, 201, 203, 205, 207, 209, 211, 213, 215,
1752 217, 220, 221, 224, 226, 228, 230, 231, 234, 236,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00001753 238, 240, 242, 244, 246, 248, 250, 252, 254, 256,
1754 258, 259, 262, 263, 266, 267, 270, 271, 275, 278,
1755 279, 281, 282, 286, 288, 291, 293, 295, 297, 299,
1756 301, 303, 305, 307, 309, 313, 315, 318, 324, 330,
1757 336, 342, 346, 349, 355, 360, 363, 365, 367, 369,
1758 373, 375, 379, 381, 382, 384, 388, 393, 397, 401,
1759 406, 411, 415, 422, 428, 431, 434, 437, 440, 443,
1760 446, 449, 452, 455, 458, 461, 464, 471, 477, 486,
1761 493, 500, 508, 516, 524, 532, 539, 548, 557, 563,
1762 571, 575, 577, 579, 581, 583, 584, 587, 594, 596,
1763 597, 599, 602, 603, 607, 608, 612, 616, 620, 624,
1764 625, 634, 635, 645, 646, 656, 662, 665, 669, 671,
1765 675, 679, 683, 687, 689, 690, 696, 700, 702, 706,
1766 708, 709, 721, 723, 725, 730, 732, 734, 737, 741,
Chris Lattner740e7092008-10-15 06:16:57 +00001767 742, 744, 746, 748, 750, 752, 754, 756, 758, 760,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00001768 762, 764, 768, 772, 775, 778, 782, 785, 791, 796,
1769 798, 804, 806, 808, 810, 812, 814, 816, 819, 821,
1770 825, 828, 831, 835, 839, 842, 843, 845, 848, 851,
1771 855, 865, 875, 884, 900, 902, 904, 911, 917, 920,
1772 923, 930, 938, 943, 948, 955, 962, 963, 964, 968,
1773 971, 975, 978, 980, 986, 992, 999, 1006, 1013, 1020,
1774 1025, 1032, 1037, 1042, 1049, 1056, 1059, 1069, 1071, 1073,
1775 1074, 1078, 1085, 1089, 1096, 1099, 1105, 1113, 1119, 1124,
1776 1129
Dan Gohmanf4423b12008-04-19 00:24:39 +00001777};
1778
1779/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1780static const yytype_int16 yyrhs[] =
1781{
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00001782 222, 0, -1, 75, -1, 76, -1, 77, -1, 78,
Dale Johannesendfe8c842008-09-26 19:32:34 +00001783 -1, 79, -1, 80, -1, 81, -1, 82, -1, 83,
1784 -1, 87, -1, 88, -1, 89, -1, 84, -1, 85,
1785 -1, 86, -1, 120, -1, 121, -1, 122, -1, 123,
1786 -1, 124, -1, 125, -1, 126, -1, 127, -1, 128,
1787 -1, 129, -1, 130, -1, 131, -1, 94, -1, 95,
1788 -1, 96, -1, 97, -1, 98, -1, 99, -1, 100,
1789 -1, 101, -1, 102, -1, 103, -1, 104, -1, 105,
1790 -1, 106, -1, 107, -1, 108, -1, 109, -1, 110,
1791 -1, 111, -1, 112, -1, 113, -1, 100, -1, 101,
Chris Lattner740e7092008-10-15 06:16:57 +00001792 -1, 102, -1, 103, -1, 26, -1, 27, -1, 19,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00001793 -1, 22, -1, 24, -1, 181, -1, -1, 55, 161,
1794 4, 162, -1, -1, 181, 163, -1, -1, 7, 163,
1795 -1, 20, -1, 23, -1, 188, -1, -1, 186, 163,
Chris Lattnerf9078f92008-10-15 06:03:48 +00001796 -1, 42, -1, 44, -1, 43, -1, 45, -1, 47,
1797 -1, 49, -1, 46, -1, 48, -1, 51, -1, -1,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00001798 158, -1, 159, -1, 160, -1, -1, 46, -1, 48,
Chris Lattnerf9078f92008-10-15 06:03:48 +00001799 -1, -1, 42, -1, 43, -1, 44, -1, 47, -1,
1800 -1, 44, -1, 42, -1, -1, 63, -1, 64, -1,
1801 65, -1, 66, -1, 67, -1, 62, 4, -1, 142,
1802 -1, 121, -1, 141, -1, 122, -1, 144, -1, 145,
1803 -1, 147, -1, 148, -1, 149, -1, 54, 4, -1,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00001804 -1, 197, 196, -1, 144, -1, 142, -1, 141, -1,
1805 -1, 199, 198, -1, 143, -1, 146, -1, 144, -1,
Chris Lattnerf9078f92008-10-15 06:03:48 +00001806 142, -1, 141, -1, 150, -1, 151, -1, 154, -1,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00001807 155, -1, 153, -1, 156, -1, 157, -1, -1, 201,
1808 200, -1, -1, 152, 22, -1, -1, 54, 4, -1,
1809 -1, 164, 54, 4, -1, 34, 22, -1, -1, 205,
1810 -1, -1, 164, 208, 207, -1, 205, -1, 54, 4,
1811 -1, 11, -1, 12, -1, 13, -1, 16, -1, 15,
1812 -1, 14, -1, 17, -1, 50, -1, 209, -1, 210,
1813 183, 165, -1, 244, -1, 166, 4, -1, 210, 161,
1814 214, 162, 201, -1, 10, 161, 214, 162, 201, -1,
1815 167, 4, 168, 210, 169, -1, 170, 4, 168, 210,
1816 171, -1, 172, 215, 173, -1, 172, 173, -1, 170,
1817 172, 215, 173, 171, -1, 170, 172, 173, 171, -1,
1818 210, 197, -1, 210, -1, 10, -1, 211, -1, 213,
1819 164, 211, -1, 213, -1, 213, 164, 39, -1, 39,
1820 -1, -1, 210, -1, 215, 164, 210, -1, 210, 167,
1821 218, 169, -1, 210, 167, 169, -1, 210, 174, 22,
1822 -1, 210, 170, 218, 171, -1, 210, 172, 218, 173,
1823 -1, 210, 172, 173, -1, 210, 170, 172, 218, 173,
1824 171, -1, 210, 170, 172, 173, 171, -1, 210, 40,
1825 -1, 210, 41, -1, 210, 244, -1, 210, 217, -1,
1826 210, 25, -1, 210, 3, -1, 210, 5, -1, 210,
1827 4, -1, 210, 6, -1, 210, 26, -1, 210, 27,
1828 -1, 210, 9, -1, 178, 161, 216, 38, 210, 162,
1829 -1, 119, 161, 216, 256, 162, -1, 133, 161, 216,
1830 164, 216, 164, 216, 162, -1, 176, 161, 216, 164,
1831 216, 162, -1, 177, 161, 216, 164, 216, 162, -1,
1832 90, 179, 161, 216, 164, 216, 162, -1, 91, 180,
1833 161, 216, 164, 216, 162, -1, 92, 179, 161, 216,
1834 164, 216, 162, -1, 93, 180, 161, 216, 164, 216,
1835 162, -1, 135, 161, 216, 164, 216, 162, -1, 136,
1836 161, 216, 164, 216, 164, 216, 162, -1, 137, 161,
1837 216, 164, 216, 164, 216, 162, -1, 139, 161, 216,
1838 257, 162, -1, 140, 161, 216, 164, 216, 257, 162,
1839 -1, 218, 164, 216, -1, 216, -1, 32, -1, 33,
1840 -1, 37, -1, -1, 212, 244, -1, 125, 161, 221,
1841 38, 210, 162, -1, 223, -1, -1, 224, -1, 223,
1842 224, -1, -1, 31, 225, 240, -1, -1, 30, 226,
1843 241, -1, 60, 59, 230, -1, 184, 18, 210, -1,
1844 184, 18, 10, -1, -1, 187, 191, 220, 219, 216,
1845 183, 227, 207, -1, -1, 187, 189, 191, 220, 219,
1846 216, 183, 228, 207, -1, -1, 187, 190, 191, 220,
1847 219, 210, 183, 229, 207, -1, 187, 191, 35, 194,
1848 221, -1, 52, 231, -1, 56, 163, 232, -1, 22,
1849 -1, 53, 163, 22, -1, 68, 163, 22, -1, 167,
1850 233, 169, -1, 233, 164, 22, -1, 22, -1, -1,
1851 234, 164, 210, 197, 182, -1, 210, 197, 182, -1,
1852 234, -1, 234, 164, 39, -1, 39, -1, -1, 195,
1853 199, 212, 186, 161, 235, 162, 201, 206, 203, 202,
1854 -1, 28, -1, 172, -1, 193, 191, 236, 237, -1,
1855 29, -1, 173, -1, 248, 239, -1, 192, 191, 236,
1856 -1, -1, 61, -1, 3, -1, 4, -1, 5, -1,
1857 6, -1, 9, -1, 26, -1, 27, -1, 40, -1,
1858 41, -1, 25, -1, 170, 218, 171, -1, 167, 218,
1859 169, -1, 167, 169, -1, 174, 22, -1, 172, 218,
1860 173, -1, 172, 173, -1, 170, 172, 218, 173, 171,
1861 -1, 170, 172, 173, 171, -1, 217, -1, 59, 242,
1862 22, 164, 22, -1, 7, -1, 8, -1, 181, -1,
1863 186, -1, 244, -1, 243, -1, 210, 245, -1, 246,
1864 -1, 247, 164, 246, -1, 248, 249, -1, 238, 249,
1865 -1, 250, 184, 251, -1, 250, 185, 251, -1, 250,
1866 253, -1, -1, 21, -1, 69, 247, -1, 69, 10,
1867 -1, 70, 17, 245, -1, 70, 11, 245, 164, 17,
1868 245, 164, 17, 245, -1, 71, 11, 245, 164, 17,
1869 245, 167, 252, 169, -1, 71, 11, 245, 164, 17,
1870 245, 167, 169, -1, 72, 195, 199, 212, 245, 161,
1871 255, 162, 201, 38, 17, 245, 73, 17, 245, -1,
1872 73, -1, 74, -1, 252, 11, 243, 164, 17, 245,
1873 -1, 11, 243, 164, 17, 245, -1, 184, 259, -1,
1874 185, 259, -1, 210, 167, 245, 164, 245, 169, -1,
1875 254, 164, 167, 245, 164, 245, 169, -1, 210, 197,
1876 245, 197, -1, 17, 197, 245, 197, -1, 255, 164,
1877 210, 197, 245, 197, -1, 255, 164, 17, 197, 245,
1878 197, -1, -1, -1, 256, 164, 246, -1, 164, 4,
1879 -1, 257, 164, 4, -1, 58, 57, -1, 57, -1,
1880 176, 210, 245, 164, 245, -1, 177, 210, 245, 164,
1881 245, -1, 90, 179, 210, 245, 164, 245, -1, 91,
1882 180, 210, 245, 164, 245, -1, 92, 179, 210, 245,
1883 164, 245, -1, 93, 180, 210, 245, 164, 245, -1,
1884 178, 246, 38, 210, -1, 133, 246, 164, 246, 164,
1885 246, -1, 134, 246, 164, 210, -1, 135, 246, 164,
1886 246, -1, 136, 246, 164, 246, 164, 246, -1, 137,
1887 246, 164, 246, 164, 246, -1, 132, 254, -1, 258,
1888 195, 199, 212, 245, 161, 255, 162, 201, -1, 261,
1889 -1, 36, -1, -1, 114, 210, 204, -1, 114, 210,
1890 164, 11, 245, 204, -1, 115, 210, 204, -1, 115,
1891 210, 164, 11, 245, 204, -1, 116, 246, -1, 260,
1892 117, 210, 245, 204, -1, 260, 118, 246, 164, 210,
1893 245, 204, -1, 138, 210, 245, 164, 4, -1, 119,
1894 210, 245, 256, -1, 139, 210, 245, 257, -1, 140,
1895 210, 245, 164, 210, 245, 257, -1
Dan Gohmanf4423b12008-04-19 00:24:39 +00001896};
1897
1898/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1899static const yytype_uint16 yyrline[] =
1900{
Nuno Lopesaa386d02008-11-04 14:43:20 +00001901 0, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152,
1902 1152, 1153, 1153, 1153, 1153, 1153, 1153, 1154, 1154, 1154,
1903 1154, 1154, 1154, 1155, 1155, 1155, 1155, 1155, 1155, 1158,
1904 1158, 1159, 1159, 1160, 1160, 1161, 1161, 1162, 1162, 1166,
1905 1166, 1167, 1167, 1168, 1168, 1169, 1169, 1170, 1170, 1171,
1906 1171, 1172, 1172, 1173, 1174, 1177, 1177, 1177, 1178, 1178,
1907 1180, 1181, 1185, 1189, 1194, 1200, 1200, 1202, 1203, 1208,
1908 1214, 1215, 1216, 1217, 1218, 1219, 1223, 1224, 1225, 1229,
1909 1230, 1231, 1232, 1236, 1237, 1238, 1242, 1243, 1244, 1245,
1910 1246, 1250, 1251, 1252, 1255, 1256, 1257, 1258, 1259, 1260,
1911 1261, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276,
1912 1277, 1281, 1282, 1287, 1288, 1289, 1292, 1293, 1299, 1300,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00001913 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310,
1914 1313, 1314, 1320, 1321, 1328, 1329, 1335, 1336, 1345, 1353,
1915 1354, 1359, 1360, 1361, 1366, 1379, 1379, 1379, 1379, 1379,
1916 1379, 1379, 1382, 1386, 1390, 1397, 1402, 1410, 1445, 1476,
1917 1481, 1491, 1501, 1505, 1515, 1522, 1531, 1538, 1543, 1548,
1918 1555, 1556, 1563, 1570, 1578, 1584, 1596, 1624, 1640, 1667,
1919 1695, 1721, 1741, 1767, 1787, 1799, 1806, 1872, 1882, 1892,
1920 1903, 1916, 1927, 1941, 1948, 1955, 1973, 1985, 2006, 2014,
1921 2020, 2031, 2036, 2041, 2046, 2051, 2057, 2063, 2069, 2077,
1922 2088, 2092, 2100, 2100, 2103, 2103, 2106, 2118, 2139, 2144,
1923 2152, 2153, 2157, 2157, 2161, 2161, 2164, 2167, 2191, 2203,
1924 2202, 2214, 2213, 2223, 2222, 2233, 2273, 2276, 2282, 2292,
1925 2296, 2301, 2303, 2308, 2313, 2322, 2332, 2343, 2347, 2356,
1926 2365, 2370, 2519, 2519, 2521, 2530, 2530, 2532, 2537, 2549,
1927 2553, 2558, 2562, 2566, 2571, 2576, 2580, 2584, 2588, 2592,
1928 2596, 2600, 2622, 2644, 2650, 2663, 2675, 2680, 2692, 2698,
1929 2702, 2712, 2716, 2720, 2725, 2732, 2732, 2738, 2747, 2752,
1930 2757, 2761, 2770, 2779, 2792, 2801, 2805, 2813, 2833, 2837,
1931 2842, 2853, 2872, 2881, 2985, 2989, 2996, 3007, 3020, 3029,
1932 3042, 3053, 3063, 3074, 3082, 3092, 3099, 3102, 3103, 3111,
1933 3117, 3126, 3130, 3135, 3151, 3168, 3180, 3192, 3206, 3220,
1934 3232, 3253, 3260, 3266, 3272, 3278, 3293, 3403, 3408, 3412,
1935 3419, 3426, 3436, 3443, 3453, 3461, 3475, 3492, 3506, 3521,
1936 3536
Dan Gohmanf4423b12008-04-19 00:24:39 +00001937};
1938#endif
1939
1940#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1941/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1942 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1943static const char *const yytname[] =
1944{
1945 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1946 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1947 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1948 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1949 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1950 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1951 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1952 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001953 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "COMMON", "OPAQUE",
Dan Gohmanf4423b12008-04-19 00:24:39 +00001954 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1955 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1956 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
Dale Johannesendfe8c842008-09-26 19:32:34 +00001957 "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE",
1958 "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM",
1959 "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "VICMP",
1960 "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1961 "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1962 "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1963 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1964 "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1965 "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
1966 "GETRESULT", "EXTRACTVALUE", "INSERTVALUE", "SIGNEXT", "ZEROEXT",
1967 "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL", "NEST",
Devang Patel652203f2008-09-29 20:49:50 +00001968 "READNONE", "READONLY", "GC", "OPTSIZE", "NOINLINE", "ALWAYSINLINE",
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00001969 "SSP", "SSPREQ", "DEFAULT", "HIDDEN", "PROTECTED", "'('", "')'", "'='",
1970 "','", "'*'", "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'",
1971 "'c'", "$accept", "ArithmeticOps", "LogicalOps", "CastOps",
1972 "IPredicates", "FPredicates", "LocalName", "OptLocalName",
1973 "OptAddrSpace", "OptLocalAssign", "LocalNumber", "GlobalName",
1974 "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
1975 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1976 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "Attribute",
1977 "OptAttributes", "RetAttr", "OptRetAttrs", "FuncAttr", "OptFuncAttrs",
1978 "OptGC", "OptAlign", "OptCAlign", "SectionString", "OptSection",
Devang Patel652203f2008-09-29 20:49:50 +00001979 "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types",
1980 "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", "TypeListI",
1981 "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "ThreadLocal",
1982 "AliaseeRef", "Module", "DefinitionList", "Definition", "@1", "@2", "@3",
1983 "@4", "@5", "AsmBlock", "TargetDefinition", "LibrariesDefinition",
1984 "LibList", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN",
1985 "FunctionHeader", "END", "Function", "FunctionProto", "OptSideEffect",
1986 "ConstValueRef", "SymbolicValueRef", "ValueRef", "ResolvedVal",
1987 "ReturnedVal", "BasicBlockList", "BasicBlock", "InstructionList",
1988 "BBTerminatorInst", "JumpTable", "Inst", "PHIList", "ParamList",
1989 "IndexList", "ConstantIndexList", "OptTailCall", "InstVal",
Chris Lattner15bd0952008-08-29 17:20:18 +00001990 "OptVolatile", "MemoryInst", 0
Dan Gohmanf4423b12008-04-19 00:24:39 +00001991};
1992#endif
1993
1994# ifdef YYPRINT
1995/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1996 token YYLEX-NUM. */
1997static const yytype_uint16 yytoknum[] =
1998{
1999 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
2000 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
2001 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
2002 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
2003 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
2004 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
2005 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
2006 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
2007 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
2008 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
2009 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
2010 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
2011 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
2012 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
2013 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002014 405, 406, 407, 408, 409, 410, 411, 412, 413, 414,
2015 415, 40, 41, 61, 44, 42, 92, 91, 120, 93,
2016 60, 62, 123, 125, 99
Dan Gohmanf4423b12008-04-19 00:24:39 +00002017};
2018# endif
2019
2020/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002021static const yytype_uint16 yyr1[] =
Dan Gohmanf4423b12008-04-19 00:24:39 +00002022{
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002023 0, 175, 176, 176, 176, 176, 176, 176, 176, 176,
2024 176, 177, 177, 177, 177, 177, 177, 178, 178, 178,
2025 178, 178, 178, 178, 178, 178, 178, 178, 178, 179,
2026 179, 179, 179, 179, 179, 179, 179, 179, 179, 180,
2027 180, 180, 180, 180, 180, 180, 180, 180, 180, 180,
2028 180, 180, 180, 180, 180, 181, 181, 181, 182, 182,
2029 183, 183, 184, 184, 185, 186, 186, 187, 187, 188,
2030 189, 189, 189, 189, 189, 189, 190, 190, 190, 191,
2031 191, 191, 191, 192, 192, 192, 193, 193, 193, 193,
2032 193, 194, 194, 194, 195, 195, 195, 195, 195, 195,
2033 195, 196, 196, 196, 196, 196, 196, 196, 196, 196,
2034 196, 197, 197, 198, 198, 198, 199, 199, 200, 200,
2035 200, 200, 200, 200, 200, 200, 200, 200, 200, 200,
2036 201, 201, 202, 202, 203, 203, 204, 204, 205, 206,
2037 206, 207, 207, 208, 208, 209, 209, 209, 209, 209,
2038 209, 209, 210, 210, 210, 210, 210, 210, 210, 210,
2039 210, 210, 210, 210, 210, 211, 212, 212, 213, 213,
2040 214, 214, 214, 214, 215, 215, 216, 216, 216, 216,
2041 216, 216, 216, 216, 216, 216, 216, 216, 216, 216,
2042 216, 216, 216, 216, 216, 216, 217, 217, 217, 217,
2043 217, 217, 217, 217, 217, 217, 217, 217, 217, 217,
2044 218, 218, 219, 219, 220, 220, 221, 221, 222, 222,
2045 223, 223, 225, 224, 226, 224, 224, 224, 224, 227,
2046 224, 228, 224, 229, 224, 224, 224, 224, 230, 231,
2047 231, 232, 233, 233, 233, 234, 234, 235, 235, 235,
2048 235, 236, 237, 237, 238, 239, 239, 240, 241, 242,
2049 242, 243, 243, 243, 243, 243, 243, 243, 243, 243,
2050 243, 243, 243, 243, 243, 243, 243, 243, 243, 243,
2051 243, 244, 244, 244, 244, 245, 245, 246, 247, 247,
2052 248, 248, 249, 249, 250, 250, 250, 251, 251, 251,
2053 251, 251, 251, 251, 251, 251, 252, 252, 253, 253,
2054 254, 254, 255, 255, 255, 255, 255, 256, 256, 257,
2055 257, 258, 258, 259, 259, 259, 259, 259, 259, 259,
2056 259, 259, 259, 259, 259, 259, 259, 259, 260, 260,
2057 261, 261, 261, 261, 261, 261, 261, 261, 261, 261,
2058 261
Dan Gohmanf4423b12008-04-19 00:24:39 +00002059};
2060
2061/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
2062static const yytype_uint8 yyr2[] =
2063{
2064 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
2065 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2066 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2067 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2068 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Chris Lattner740e7092008-10-15 06:16:57 +00002069 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
2070 4, 0, 2, 0, 2, 1, 1, 1, 0, 2,
2071 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
2072 1, 1, 1, 0, 1, 1, 0, 1, 1, 1,
2073 1, 0, 1, 1, 0, 1, 1, 1, 1, 1,
2074 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2075 2, 0, 2, 1, 1, 1, 0, 2, 1, 1,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002076 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2077 0, 2, 0, 2, 0, 2, 0, 3, 2, 0,
2078 1, 0, 3, 1, 2, 1, 1, 1, 1, 1,
2079 1, 1, 1, 1, 3, 1, 2, 5, 5, 5,
2080 5, 3, 2, 5, 4, 2, 1, 1, 1, 3,
2081 1, 3, 1, 0, 1, 3, 4, 3, 3, 4,
2082 4, 3, 6, 5, 2, 2, 2, 2, 2, 2,
2083 2, 2, 2, 2, 2, 2, 6, 5, 8, 6,
2084 6, 7, 7, 7, 7, 6, 8, 8, 5, 7,
2085 3, 1, 1, 1, 1, 0, 2, 6, 1, 0,
2086 1, 2, 0, 3, 0, 3, 3, 3, 3, 0,
2087 8, 0, 9, 0, 9, 5, 2, 3, 1, 3,
2088 3, 3, 3, 1, 0, 5, 3, 1, 3, 1,
2089 0, 11, 1, 1, 4, 1, 1, 2, 3, 0,
2090 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2091 1, 3, 3, 2, 2, 3, 2, 5, 4, 1,
2092 5, 1, 1, 1, 1, 1, 1, 2, 1, 3,
2093 2, 2, 3, 3, 2, 0, 1, 2, 2, 3,
2094 9, 9, 8, 15, 1, 1, 6, 5, 2, 2,
2095 6, 7, 4, 4, 6, 6, 0, 0, 3, 2,
2096 3, 2, 1, 5, 5, 6, 6, 6, 6, 4,
2097 6, 4, 4, 6, 6, 2, 9, 1, 1, 0,
2098 3, 6, 3, 6, 2, 5, 7, 5, 4, 4,
2099 7
Dan Gohmanf4423b12008-04-19 00:24:39 +00002100};
2101
2102/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2103 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2104 means the default is an error. */
2105static const yytype_uint16 yydefact[] =
2106{
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002107 68, 55, 65, 56, 66, 57, 224, 222, 0, 0,
2108 0, 0, 0, 0, 79, 67, 0, 68, 220, 83,
2109 86, 0, 0, 236, 0, 0, 62, 0, 69, 70,
Chris Lattner740e7092008-10-15 06:16:57 +00002110 72, 71, 73, 76, 74, 77, 75, 78, 80, 81,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002111 82, 79, 79, 215, 1, 221, 84, 85, 79, 225,
2112 87, 88, 89, 90, 79, 295, 223, 295, 0, 0,
2113 244, 237, 238, 226, 281, 282, 228, 145, 146, 147,
2114 150, 149, 148, 151, 152, 0, 0, 0, 0, 283,
2115 284, 153, 227, 155, 215, 215, 91, 214, 0, 94,
2116 94, 296, 291, 63, 255, 256, 257, 290, 239, 240,
2117 243, 0, 173, 156, 0, 0, 0, 0, 162, 174,
2118 0, 0, 173, 0, 0, 0, 93, 92, 0, 212,
2119 213, 0, 0, 95, 96, 97, 98, 99, 116, 258,
2120 0, 0, 339, 339, 294, 0, 241, 172, 111, 168,
2121 170, 0, 0, 0, 0, 0, 0, 161, 0, 0,
2122 154, 0, 0, 167, 0, 166, 0, 235, 61, 61,
2123 100, 0, 252, 253, 254, 64, 338, 322, 0, 0,
2124 0, 0, 94, 304, 305, 2, 3, 4, 5, 6,
Chris Lattner740e7092008-10-15 06:16:57 +00002125 7, 8, 9, 10, 14, 15, 16, 11, 12, 13,
2126 0, 0, 0, 0, 0, 0, 0, 0, 17, 18,
2127 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
Nate Begemanac80ade2008-05-12 19:01:56 +00002128 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002129 0, 0, 292, 94, 308, 0, 337, 293, 309, 242,
2130 165, 0, 130, 61, 61, 164, 0, 175, 0, 130,
2131 61, 61, 0, 216, 189, 191, 190, 192, 195, 188,
2132 193, 194, 184, 185, 0, 0, 0, 0, 0, 0,
Chris Lattner740e7092008-10-15 06:16:57 +00002133 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002134 0, 0, 187, 186, 229, 115, 114, 113, 117, 0,
2135 321, 298, 61, 288, 297, 0, 0, 0, 116, 29,
Chris Lattner740e7092008-10-15 06:16:57 +00002136 30, 31, 32, 33, 34, 35, 36, 37, 38, 0,
2137 53, 54, 49, 50, 51, 52, 39, 40, 41, 42,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002138 43, 44, 45, 46, 47, 48, 0, 0, 0, 136,
2139 136, 344, 61, 61, 335, 0, 0, 0, 0, 0,
Chris Lattner740e7092008-10-15 06:16:57 +00002140 61, 61, 61, 61, 61, 0, 116, 0, 0, 0,
2141 102, 104, 103, 101, 105, 106, 107, 108, 109, 112,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002142 171, 169, 158, 159, 160, 163, 60, 157, 231, 233,
Chris Lattner740e7092008-10-15 06:16:57 +00002143 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002144 0, 0, 177, 211, 0, 0, 0, 181, 0, 178,
2145 0, 0, 0, 141, 0, 261, 262, 263, 264, 265,
2146 270, 266, 267, 268, 269, 259, 0, 0, 0, 0,
2147 279, 286, 285, 287, 0, 0, 299, 0, 0, 61,
2148 61, 61, 61, 0, 340, 0, 342, 317, 0, 0,
Chris Lattner740e7092008-10-15 06:16:57 +00002149 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2150 0, 0, 61, 0, 110, 122, 121, 118, 120, 119,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002151 123, 124, 127, 125, 126, 128, 129, 131, 141, 141,
2152 0, 0, 0, 0, 0, 317, 0, 0, 0, 0,
2153 0, 0, 0, 176, 162, 174, 0, 179, 180, 0,
2154 0, 0, 0, 230, 250, 260, 0, 273, 0, 0,
2155 0, 276, 0, 274, 289, 0, 0, 0, 0, 0,
2156 0, 0, 0, 0, 0, 348, 0, 0, 0, 331,
2157 332, 0, 0, 0, 0, 349, 0, 0, 0, 329,
2158 0, 136, 0, 232, 234, 61, 0, 0, 0, 0,
2159 0, 0, 0, 0, 0, 0, 0, 210, 183, 0,
2160 0, 0, 0, 0, 0, 143, 141, 249, 111, 247,
2161 0, 0, 272, 162, 0, 271, 275, 0, 0, 0,
2162 0, 0, 0, 0, 136, 137, 136, 0, 0, 0,
2163 0, 0, 0, 347, 319, 0, 61, 323, 324, 0,
2164 0, 345, 61, 217, 0, 0, 0, 0, 197, 0,
2165 0, 0, 0, 208, 0, 182, 0, 0, 61, 138,
2166 144, 142, 59, 0, 130, 0, 278, 0, 0, 0,
2167 316, 325, 326, 327, 328, 341, 343, 318, 0, 0,
2168 330, 333, 334, 320, 0, 316, 136, 0, 0, 0,
2169 0, 0, 205, 0, 0, 0, 199, 200, 196, 58,
2170 246, 248, 111, 139, 280, 277, 0, 0, 111, 111,
2171 0, 310, 0, 350, 0, 346, 201, 202, 203, 204,
2172 0, 0, 0, 209, 59, 140, 134, 0, 0, 302,
2173 0, 0, 0, 130, 0, 311, 130, 198, 206, 207,
2174 245, 0, 132, 300, 0, 0, 301, 102, 104, 111,
2175 111, 0, 111, 111, 336, 135, 0, 251, 0, 0,
2176 313, 312, 0, 0, 0, 133, 0, 0, 0, 111,
2177 111, 307, 0, 0, 315, 314, 306, 0, 0, 303
Dan Gohmanf4423b12008-04-19 00:24:39 +00002178};
2179
2180/* YYDEFGOTO[NTERM-NUM]. */
2181static const yytype_int16 yydefgoto[] =
2182{
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002183 -1, 269, 270, 271, 299, 316, 79, 630, 113, 12,
Chris Lattner740e7092008-10-15 06:16:57 +00002184 133, 80, 14, 15, 41, 42, 43, 48, 54, 118,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002185 128, 349, 230, 278, 161, 447, 352, 687, 672, 414,
2186 535, 656, 473, 536, 81, 158, 139, 156, 140, 141,
Chris Lattner740e7092008-10-15 06:16:57 +00002187 110, 373, 400, 374, 121, 88, 157, 16, 17, 18,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002188 20, 19, 383, 448, 449, 63, 23, 61, 101, 539,
2189 540, 129, 164, 55, 96, 56, 49, 476, 401, 83,
2190 403, 283, 284, 57, 92, 93, 222, 660, 134, 324,
2191 640, 495, 505, 223, 224, 225, 226
Dan Gohmanf4423b12008-04-19 00:24:39 +00002192};
2193
2194/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2195 STATE-NUM. */
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002196#define YYPACT_NINF -615
Dan Gohmanf4423b12008-04-19 00:24:39 +00002197static const yytype_int16 yypact[] =
2198{
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002199 789, -615, -615, -615, -615, -615, -615, -615, -10, -110,
2200 29, -106, 31, -56, 22, -615, 45, 1491, -615, 162,
2201 194, 20, 33, -615, -43, 141, -615, 1998, -615, -615,
2202 -615, -615, -615, -615, -615, -615, -615, -615, -615, -615,
2203 -615, 88, 88, 176, -615, -615, -615, -615, 88, -615,
2204 -615, -615, -615, -615, 88, 178, -615, -11, 207, 213,
2205 243, -615, -615, -615, -615, -615, 115, -615, -615, -615,
2206 -615, -615, -615, -615, -615, 275, 289, 1, 480, -615,
2207 -615, -615, 36, -615, 263, 263, 200, -615, 143, 197,
2208 197, -615, -615, 65, -615, -615, -615, -615, -615, -615,
2209 -615, -54, 1723, -615, 140, 155, 549, 115, -615, 36,
2210 -122, 167, 1723, 160, 143, 143, -615, -615, 1767, -615,
2211 -615, 2023, 327, -615, -615, -615, -615, -615, -615, -615,
2212 -16, 180, 2293, 2293, -615, 322, -615, -615, 36, -615,
2213 181, 184, 2023, 2023, 179, -118, 2023, -615, 343, 189,
2214 -615, 2023, 2023, 115, 191, 36, 55, -615, 1277, 298,
2215 -615, 1678, -615, -615, -615, -615, -615, -615, 297, 2064,
2216 112, 344, 197, -615, -615, -615, -615, -615, -615, -615,
2217 -615, -615, -615, -615, -615, -615, -615, -615, -615, -615,
2218 219, 555, 219, 555, 2023, 2023, 2023, 2023, -615, -615,
2219 -615, -615, -615, -615, -615, -615, -615, -615, -615, -615,
2220 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023,
2221 2023, 2023, -615, 197, -615, 132, -615, -615, -615, -615,
2222 334, 1816, -615, -39, -40, -615, 188, 36, 198, -615,
2223 298, -14, 1767, -615, -615, -615, -615, -615, -615, -615,
2224 -615, -615, -615, -615, 219, 555, 219, 555, 195, 201,
2225 202, 203, 205, 206, 210, 1857, 2123, 983, 339, 211,
2226 212, 214, -615, -615, -615, -615, -615, -615, -615, 105,
2227 -615, 115, 933, -615, 216, 1449, 1449, 1449, -615, -615,
2228 -615, -615, -615, -615, -615, -615, -615, -615, -615, 2023,
2229 -615, -615, -615, -615, -615, -615, -615, -615, -615, -615,
2230 -615, -615, -615, -615, -615, -615, 2023, 2023, 2023, 54,
2231 56, -615, 933, -29, 217, 223, 226, 227, 228, 229,
2232 933, 933, 933, 933, 933, 336, -615, 2023, 2023, 372,
2233 -615, -615, -615, -615, -615, -615, -615, -615, -615, -615,
2234 -615, -615, 556, -615, -615, -615, -615, 556, -615, 160,
2235 345, 224, 240, 242, 245, 2023, 2023, 2023, 2023, 2023,
2236 2023, 2023, -615, -615, -19, 1154, -52, -615, -117, -615,
2237 2023, 2023, 2023, 247, 252, -615, -615, -615, -615, -615,
2238 -615, -615, -615, -615, -615, 316, 1898, 2164, 1326, 392,
2239 -615, -615, -615, -615, 2023, 251, -615, 254, 1678, 933,
2240 933, 933, 933, 27, -615, 28, -615, -615, 1449, 253,
2241 2023, 2023, 2023, 2023, 2023, 255, 258, 259, 261, 262,
2242 2023, 1678, 933, 264, -615, -615, -615, -615, -615, -615,
2243 -615, -615, -615, -615, -615, -615, -615, -615, 247, 247,
2244 2023, 2023, 2023, 2023, 2023, -615, 265, 267, 268, 269,
2245 258, 270, 2023, -615, 250, 1105, -74, -615, -615, 271,
2246 272, 399, 6, -615, 1939, -615, 416, -615, 34, 1637,
2247 -37, -615, -70, -615, -615, 424, 429, 1449, 283, 285,
2248 287, 288, 1449, 450, 1449, 293, 295, 1449, 301, 36,
2249 -615, 302, 303, 464, 465, 306, 2023, 1449, 1449, 36,
2250 1449, 310, 2023, -615, -615, -1, 313, 320, 321, 325,
2251 107, 2023, 2023, 2023, 2023, 108, 2023, -615, -615, 341,
2252 2023, 2023, 2023, 476, 501, -615, 247, -615, 36, 349,
2253 352, 351, -615, 350, -60, -615, -615, 1449, 1449, 361,
2254 1449, 1449, 1449, 1449, 310, -615, 310, 2023, 1449, 359,
2255 2023, 2023, 2023, -615, -615, 520, 933, -615, -615, 364,
2256 472, -615, 933, -615, 2023, 2023, 2023, 2023, -615, 363,
2257 366, 365, 368, -615, 258, -615, 371, 375, 4, -615,
2258 -615, -615, 185, 1957, -615, 516, -615, 369, 377, 376,
2259 2189, -615, -615, -615, -615, -615, -615, -615, 370, 1449,
2260 -615, -615, -615, -615, 258, 2189, 310, 380, 382, 383,
2261 384, 2023, -615, 2023, 2023, 118, -615, -615, -615, -615,
2262 -615, -615, 36, -2, -615, -615, 530, -5, 41, 36,
2263 121, -615, 379, 306, 122, -615, -615, -615, -615, -615,
2264 388, 389, 390, -615, 185, -615, 504, 1449, 1587, -615,
2265 3, 777, 777, -615, 2230, -615, -615, -615, -615, -615,
2266 -615, 551, 418, -615, 411, 1587, -615, 415, 417, -615,
2267 -615, 473, 41, 36, 556, -615, 557, -615, 560, 419,
2268 334, 334, 563, 777, 777, -615, 1449, 567, 1449, -615,
2269 -615, -615, 1449, 514, 334, 334, -615, 574, 1449, -615
Dan Gohmanf4423b12008-04-19 00:24:39 +00002270};
2271
2272/* YYPGOTO[NTERM-NUM]. */
2273static const yytype_int16 yypgoto[] =
2274{
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002275 -615, 156, 164, 166, -159, -157, 0, -61, -135, 508,
2276 -615, 8, -615, -615, -615, -615, 60, -615, -615, -615,
2277 -138, -615, -405, -615, -253, -615, -236, -615, -615, -311,
2278 -31, -615, -418, -615, -615, -26, 374, -150, -615, 491,
2279 500, -114, -156, -239, 221, 257, 367, -615, -615, 590,
2280 -615, -615, -615, -615, -615, -615, -615, -615, -615, -615,
2281 -615, 518, -615, -615, -615, -615, -615, -615, -614, -108,
2282 186, -192, -615, -615, 553, -615, 478, -615, -615, -615,
2283 -3, 158, -447, -615, 487, -615, -615
Dan Gohmanf4423b12008-04-19 00:24:39 +00002284};
2285
2286/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2287 positive, shift that token. If negative, reduce the rule which
2288 number is the opposite. If zero, do what YYDEFACT says.
2289 If YYTABLE_NINF, syntax error. */
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002290#define YYTABLE_NINF -220
Dan Gohmanf4423b12008-04-19 00:24:39 +00002291static const yytype_int16 yytable[] =
2292{
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002293 11, 82, 272, 357, 321, 105, 658, 159, 13, 416,
2294 91, 279, 162, 525, 675, 111, 111, 11, 94, 325,
2295 326, 327, 328, 329, 274, 13, 111, 376, 378, 335,
2296 513, 514, 533, 317, 288, 408, 318, 240, 492, 494,
2297 533, 111, 146, 21, 674, 44, 146, 462, 243, 27,
2298 273, 147, 109, 24, 111, 236, 468, 26, 22, 111,
2299 534, 689, 64, 65, 29, 30, 31, 32, 33, 34,
2300 35, 36, 131, 37, 1, 2, 138, 3, 4, 5,
2301 109, 493, 493, 431, 1, 336, 138, 3, 25, 5,
2302 462, 111, 155, 11, 462, 361, -151, 363, 362, 529,
2303 364, 84, 85, 546, 462, 358, 359, 28, 89, 111,
2304 135, 111, 462, 597, 90, 136, 233, 234, 591, 467,
2305 237, 112, 112, 285, 60, 2, 241, 462, 4, 286,
2306 353, 354, 112, 592, 545, 155, 466, 625, 418, 435,
2307 436, 437, 438, 282, 439, 462, 433, 112, 440, 441,
2308 463, 442, 443, 444, 445, 446, 163, 478, 480, 482,
2309 112, 573, 95, 62, 659, 112, 628, 643, 319, 320,
2310 282, 322, 676, 106, 402, 119, 120, 402, 402, 402,
2311 38, 39, 40, 58, 323, 282, 282, 282, 282, 282,
2312 330, 331, 332, 333, 334, 282, 59, 112, 462, 91,
2313 571, -61, -151, 542, 1, 138, -151, 3, 46, 5,
2314 47, 86, 484, 87, 402, 112, 155, 112, 413, -61,
2315 415, -61, 402, 402, 402, 402, 402, 654, 498, 98,
2316 500, 501, 502, 661, 662, 99, 50, 51, 52, 339,
2317 544, 53, 116, 605, 117, 606, 38, 39, 40, 337,
2318 338, 455, 456, 457, 458, 459, 460, 461, 487, 122,
2319 123, 124, 125, 126, 127, 100, 469, 470, 471, 578,
2320 583, 557, 565, 409, 690, 691, 102, 693, 694, 103,
2321 653, 510, 565, 663, 666, 664, 664, 384, 219, 219,
2322 410, 411, 412, 104, 704, 705, 220, 220, 221, 221,
2323 87, 402, 402, 402, 402, 645, 340, 341, 142, 272,
2324 402, 432, 282, 289, 290, 291, 292, 293, 294, 295,
2325 296, 297, 298, 143, 402, 150, 342, 343, 148, 344,
2326 345, 160, 346, 347, 348, 151, 152, 516, 517, 518,
2327 519, 114, 115, 165, 229, 231, 232, 238, 527, 465,
2328 235, 239, 242, 111, 280, 287, 365, 273, 633, 355,
2329 356, 379, 366, 367, 368, 607, 369, 370, 610, 611,
2330 612, 371, 380, 381, 430, 382, 434, 475, 282, 402,
2331 404, 419, 155, 450, 402, 451, 402, 420, 339, 402,
2332 421, 422, 423, 424, 282, 499, 282, 282, 282, 402,
2333 402, 452, 402, 453, 509, 155, 454, 579, 580, 581,
2334 582, 472, 584, 474, 483, 485, 586, 587, 486, 503,
2335 497, 528, 504, 506, 515, 507, 508, 681, 512, 521,
2336 684, 522, 523, 524, 526, 530, 531, 532, 541, 402,
2337 402, 547, 402, 402, 402, 402, 548, 550, 538, 551,
2338 402, 552, 553, 465, 555, 340, 341, 557, 402, 558,
2339 617, 618, 619, 620, 402, 560, 561, 562, 563, 564,
2340 565, 405, 406, 407, 570, 342, 343, 574, 344, 345,
2341 566, 346, 347, 348, 575, 576, 572, 64, 65, 577,
2342 107, 67, 68, 69, 70, 71, 72, 73, 589, 1,
2343 2, 402, 3, 4, 5, 590, 588, 650, 417, 651,
2344 652, 692, 585, 593, 594, 595, 425, 426, 427, 428,
2345 429, 596, 600, 609, 613, 615, 493, 621, 622, 623,
2346 74, 282, 624, 626, 282, 282, 282, 627, 634, 641,
2347 635, 636, 646, 637, 647, 648, 649, 657, 665, 402,
2348 667, 668, 669, 402, 402, 685, 64, 65, 671, 107,
2349 67, 68, 69, 70, 71, 72, 73, 632, 1, 2,
2350 686, 3, 4, 5, 639, 688, -18, 696, -19, 695,
2351 698, 300, 301, 697, 702, 402, 402, 707, 402, 639,
2352 402, 708, 629, 670, 402, 488, 489, 490, 491, 74,
2353 402, 132, 655, 149, 496, 351, 145, 45, 130, 360,
2354 97, 227, 644, 520, 435, 436, 437, 438, 511, 439,
2355 228, 0, 0, 440, 441, 0, 442, 443, 444, 445,
2356 446, 0, 0, 0, 0, 0, 0, 0, 683, 0,
2357 0, 0, 0, 0, 0, 0, 75, 76, 0, 0,
2358 77, 0, 78, 108, 629, 302, 303, 304, 305, 306,
2359 307, 308, 309, 310, 311, 312, 313, 314, 315, 0,
2360 0, 0, 0, 549, 0, 0, 0, 0, 554, 0,
2361 556, 0, 0, 559, 0, 0, 0, 0, 0, 0,
2362 0, 0, 0, 567, 568, 0, 569, 435, 436, 437,
2363 438, 0, 439, 0, 0, 0, 440, 441, 0, 442,
2364 443, 444, 445, 446, 0, 75, 76, 0, 0, 77,
2365 0, 78, 144, 0, 0, 0, 0, 0, 0, 0,
2366 0, 0, 0, 598, 599, 0, 601, 602, 603, 604,
2367 0, 0, 0, 0, 608, 0, 0, 0, 0, 0,
2368 0, 0, 614, 0, 0, 0, 0, 0, 616, 0,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002369 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002370 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2371 385, 386, 387, 388, 64, 65, 389, 0, 0, -219,
2372 0, 0, 0, 0, 0, 642, 1, 2, 0, 3,
2373 4, 5, 390, 391, 392, 0, 0, -63, 1, 2,
2374 0, 3, 4, 5, 0, 0, 0, 393, 394, 6,
2375 7, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2376 0, 339, 0, 0, 0, 0, 395, 0, 0, 0,
2377 0, 8, 0, 673, 0, 9, 0, 679, 680, 10,
2378 0, 0, 175, 176, 177, 178, 179, 180, 181, 182,
2379 183, 184, 185, 186, 187, 188, 189, 254, 255, 256,
2380 257, 0, 0, 0, 0, 0, 0, 0, 0, 699,
2381 700, 0, 701, 0, 703, 0, 0, 0, 706, 0,
2382 0, 0, 0, 0, 709, 0, 258, 198, 677, 678,
2383 201, 202, 203, 204, 205, 206, 207, 208, 209, 0,
2384 259, 0, 260, 261, 262, 0, 263, 264, 342, 343,
2385 0, 344, 345, 0, 346, 347, 348, 0, 0, 0,
2386 0, 0, 0, 0, 0, 0, 385, 386, 387, 388,
2387 64, 65, 389, 0, 396, 0, 0, 397, 0, 398,
2388 0, 399, 1, 2, 0, 3, 4, 5, 390, 391,
2389 392, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2390 0, 0, 0, 393, 394, 0, 0, 0, 0, 0,
2391 0, 0, 0, 0, 0, 0, 0, 0, 111, 0,
2392 64, 65, 395, 107, 67, 68, 69, 70, 71, 72,
2393 73, 0, 1, 2, 0, 3, 4, 5, 175, 176,
2394 177, 178, 179, 180, 181, 182, 183, 184, 185, 186,
2395 187, 188, 189, 254, 255, 256, 257, 0, 0, 0,
2396 0, 0, 0, 74, 0, 0, 0, 0, 0, 0,
2397 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2398 0, 0, 258, 198, 199, 200, 201, 202, 203, 204,
2399 205, 206, 207, 208, 209, 0, 259, 0, 260, 261,
2400 262, 0, 263, 264, 0, 0, 0, 0, 0, 0,
2401 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2402 0, 0, 0, 0, 112, 0, 0, 0, 0, 0,
2403 396, 0, 0, 397, 0, 398, 0, 399, 244, 245,
2404 246, 247, 64, 65, 248, 0, 0, 0, 0, 0,
2405 0, 0, 0, 0, 1, 2, 0, 3, 4, 5,
2406 249, 250, 251, 0, 0, 0, 0, 0, 0, 0,
2407 0, 0, 0, 0, 0, 252, 253, 0, 0, 75,
2408 76, 0, 0, 77, 0, 78, 377, 0, 0, 0,
2409 111, 64, 65, 0, 107, 67, 68, 69, 70, 71,
2410 72, 73, 0, 1, 2, 0, 3, 4, 5, 0,
2411 175, 176, 177, 178, 179, 180, 181, 182, 183, 184,
2412 185, 186, 187, 188, 189, 254, 255, 256, 257, 0,
2413 0, 0, 0, 0, 74, 0, 0, 0, 0, 0,
2414 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2415 0, 0, 0, 0, 258, 198, 199, 200, 201, 202,
2416 203, 204, 205, 206, 207, 208, 209, 0, 259, 0,
2417 260, 261, 262, 0, 263, 264, 0, 0, 0, 0,
2418 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2419 0, 0, 0, 0, 0, 0, 112, 0, 0, 0,
2420 -61, 0, 265, 0, 0, 266, 0, 267, 0, 268,
2421 244, 245, 246, 247, 64, 65, 248, 0, 0, 0,
2422 0, 0, 0, 0, 0, 0, 1, 2, 0, 3,
2423 4, 5, 249, 250, 251, 0, 0, 0, 0, 0,
2424 0, 0, 0, 0, 0, 0, 0, 252, 253, 0,
2425 75, 76, 0, 0, 77, 0, 78, 464, 0, 0,
2426 0, 0, 111, 64, 65, 0, 107, 67, 68, 69,
Chris Lattnerf9078f92008-10-15 06:03:48 +00002427 70, 71, 72, 73, 0, 1, 2, 0, 3, 4,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002428 5, 0, 175, 176, 177, 178, 179, 180, 181, 182,
2429 183, 184, 185, 186, 187, 188, 189, 254, 255, 256,
2430 257, 0, 0, 0, 0, 0, 74, 0, 0, 0,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002431 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002432 0, 0, 0, 0, 0, 0, 258, 198, 199, 200,
2433 201, 202, 203, 204, 205, 206, 207, 208, 209, 0,
2434 259, 0, 260, 261, 262, 0, 263, 264, 0, 0,
Dale Johannesendfe8c842008-09-26 19:32:34 +00002435 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002436 0, 0, 0, 0, 0, 0, 0, 0, 112, 0,
2437 0, 0, 0, 0, 265, 0, 0, 266, 0, 267,
2438 0, 268, 385, 386, 387, 388, 64, 65, 389, 0,
2439 0, 0, 0, 0, 0, 0, 0, 0, 1, 2,
2440 0, 3, 4, 5, 390, 391, 392, 0, 0, 0,
2441 0, 0, 0, 0, 0, 0, 0, 0, 0, 393,
2442 394, -218, 75, 76, 0, 0, 77, 0, 78, 481,
2443 0, 0, 0, 0, 0, 0, 0, 0, 395, -63,
2444 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2445 0, 6, 7, 0, 175, 176, 177, 178, 179, 180,
2446 181, 182, 183, 184, 185, 186, 187, 188, 189, 254,
2447 255, 256, 257, 8, 0, 0, 0, 9, 0, 0,
2448 0, 10, 0, 0, 0, 0, 0, 0, 0, 0,
2449 0, 0, 0, 0, 0, 0, 0, 0, 258, 198,
2450 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,
2451 209, 0, 259, 0, 260, 261, 262, 0, 263, 264,
2452 385, 386, 387, 388, 0, 0, 389, 0, 0, 0,
Devang Patel652203f2008-09-29 20:49:50 +00002453 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002454 0, 0, 390, 391, 392, 0, 396, 0, 0, 397,
2455 0, 398, 0, 399, 0, 0, 0, 393, 394, 0,
Devang Patel652203f2008-09-29 20:49:50 +00002456 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002457 0, 0, 0, 0, 64, 65, 395, 107, 67, 68,
Chris Lattnerf9078f92008-10-15 06:03:48 +00002458 69, 70, 71, 72, 73, 0, 1, 2, 0, 3,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002459 4, 5, 175, 176, 177, 178, 179, 180, 181, 182,
2460 183, 184, 185, 186, 187, 188, 189, 254, 255, 256,
2461 257, 0, 0, 0, 0, 64, 65, 74, 153, 67,
Chris Lattner740e7092008-10-15 06:16:57 +00002462 68, 69, 70, 71, 72, 73, 0, 1, 2, 0,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002463 3, 4, 5, 0, 0, 0, 258, 198, 199, 200,
2464 201, 202, 203, 204, 205, 206, 207, 208, 209, 0,
2465 259, 0, 260, 261, 262, 0, 263, 264, 74, 0,
2466 64, 65, 0, 107, 67, 68, 69, 70, 71, 72,
2467 73, 0, 1, 2, 0, 3, 4, 5, 0, 0,
2468 0, 0, 0, 0, 396, 0, 0, 397, 0, 398,
2469 0, 399, 137, 0, 0, 0, 0, 0, 0, 0,
2470 0, 0, 0, 74, 64, 65, 0, 153, 67, 68,
2471 69, 70, 71, 72, 73, 0, 1, 2, 0, 3,
2472 4, 5, 0, 0, 0, 0, 0, 0, 0, 0,
2473 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
2474 543, 0, 0, 0, 0, 0, 0, 74, 0, 275,
2475 276, 0, 277, 64, 65, 0, 107, 67, 68, 69,
2476 70, 71, 72, 73, 0, 1, 2, 0, 3, 4,
2477 5, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2478 78, 0, 0, 0, 0, 350, 0, 0, 0, 0,
2479 0, 0, 0, 0, 64, 65, 74, 107, 67, 68,
2480 69, 70, 71, 72, 73, 0, 1, 2, 0, 3,
2481 4, 5, 0, 0, 0, 0, 0, 0, 0, 75,
2482 76, 0, 154, 77, 0, 78, 0, 0, 0, 0,
2483 0, 0, 0, 0, 0, 64, 65, 74, 107, 67,
2484 68, 69, 70, 71, 72, 73, 0, 1, 2, 0,
2485 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
2486 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
Chris Lattner740e7092008-10-15 06:16:57 +00002487 0, 0, 0, 0, 0, 0, 64, 65, 74, 107,
2488 67, 68, 69, 70, 71, 72, 73, 0, 1, 2,
2489 0, 3, 4, 5, 64, 65, 0, 107, 67, 68,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002490 69, 70, 71, 72, 73, 0, 1, 2, 537, 3,
2491 4, 5, 75, 76, 0, 0, 77, 0, 78, 74,
2492 0, 0, 0, 0, 0, 0, 631, 0, 0, 0,
2493 0, 0, 0, 0, 0, 64, 65, 74, 66, 67,
2494 68, 69, 70, 71, 72, 73, 0, 1, 2, 0,
2495 3, 4, 5, 75, 76, 0, 372, 77, 0, 78,
2496 64, 65, 0, 107, 67, 68, 69, 70, 71, 72,
2497 73, 0, 1, 2, 0, 3, 4, 5, 74, 0,
Dale Johannesendfe8c842008-09-26 19:32:34 +00002498 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002499 0, 0, 0, 0, 75, 76, 0, 477, 77, 0,
2500 78, 64, 65, 74, 281, 67, 68, 69, 70, 71,
2501 72, 73, 0, 1, 2, 0, 3, 4, 5, 0,
Chris Lattner740e7092008-10-15 06:16:57 +00002502 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002503 0, 0, 0, 0, 0, 75, 76, 0, 0, 77,
2504 0, 78, 0, 0, 74, 0, 0, 0, 0, 0,
2505 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
2506 64, 65, 0, 107, 67, 68, 69, 70, 71, 72,
2507 73, 0, 1, 2, 0, 3, 4, 5, 0, 0,
Chris Lattner740e7092008-10-15 06:16:57 +00002508 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2509 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002510 78, 64, 65, 74, 107, 67, 68, 69, 70, 71,
2511 72, 73, 0, 1, 2, 0, 3, 4, 5, 75,
2512 76, 0, 0, 77, 0, 78, 64, 65, 0, 107,
2513 67, 68, 69, 70, 71, 72, 638, 0, 1, 2,
2514 0, 3, 4, 5, 74, 0, 0, 0, 0, 0,
Chris Lattner740e7092008-10-15 06:16:57 +00002515 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002516 75, 76, 0, 0, 77, 0, 78, 64, 65, 74,
2517 107, 67, 68, 69, 70, 71, 72, 682, 0, 1,
2518 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
Chris Lattner740e7092008-10-15 06:16:57 +00002519 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002520 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2521 74, 0, 0, 0, 0, 0, 0, 0, 0, 75,
2522 76, 0, 0, 77, 0, 375, 0, 0, 0, 0,
2523 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2524 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2525 0, 0, 0, 0, 0, 0, 0, 0, 0, 166,
2526 75, 76, 0, 0, 77, 0, 479, 0, 0, 0,
2527 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2528 167, 168, 0, 0, 0, 75, 76, 0, 0, 77,
2529 0, 78, 169, 170, 171, 172, 173, 174, 175, 176,
2530 177, 178, 179, 180, 181, 182, 183, 184, 185, 186,
2531 187, 188, 189, 190, 191, 192, 193, 0, 0, 0,
2532 0, 0, 0, 0, 0, 0, 75, 76, 0, 0,
2533 77, 0, 78, 0, 0, 0, 0, 194, 195, 196,
2534 0, 0, 197, 198, 199, 200, 201, 202, 203, 204,
2535 205, 206, 207, 208, 209, 210, 211, 212, 213, 214,
2536 215, 216, 217, 218
Dan Gohmanf4423b12008-04-19 00:24:39 +00002537};
2538
2539static const yytype_int16 yycheck[] =
2540{
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002541 0, 27, 158, 239, 196, 4, 11, 121, 0, 320,
2542 21, 161, 28, 460, 11, 55, 55, 17, 29, 211,
2543 212, 213, 214, 215, 159, 17, 55, 266, 267, 221,
2544 448, 449, 34, 192, 172, 288, 193, 151, 11, 11,
2545 34, 55, 164, 53, 658, 0, 164, 164, 156, 18,
2546 158, 173, 78, 163, 55, 173, 173, 163, 68, 55,
2547 54, 675, 7, 8, 42, 43, 44, 45, 46, 47,
2548 48, 49, 7, 51, 19, 20, 102, 22, 23, 24,
2549 106, 54, 54, 336, 19, 223, 112, 22, 59, 24,
2550 164, 55, 118, 93, 164, 254, 55, 256, 255, 173,
2551 257, 41, 42, 173, 164, 240, 241, 163, 48, 55,
2552 164, 55, 164, 173, 54, 169, 142, 143, 536, 171,
2553 146, 161, 161, 11, 167, 20, 152, 164, 23, 17,
2554 169, 171, 161, 538, 171, 161, 375, 584, 167, 141,
2555 142, 143, 144, 169, 146, 164, 338, 161, 150, 151,
2556 169, 153, 154, 155, 156, 157, 172, 396, 397, 398,
2557 161, 162, 173, 22, 169, 161, 162, 614, 194, 195,
2558 196, 197, 169, 172, 282, 32, 33, 285, 286, 287,
2559 158, 159, 160, 163, 210, 211, 212, 213, 214, 215,
2560 216, 217, 218, 219, 220, 221, 163, 161, 164, 21,
2561 511, 165, 161, 169, 19, 231, 165, 22, 46, 24,
2562 48, 35, 404, 37, 322, 161, 242, 161, 164, 165,
2563 164, 165, 330, 331, 332, 333, 334, 632, 420, 22,
2564 422, 423, 424, 638, 639, 22, 42, 43, 44, 54,
2565 479, 47, 42, 554, 44, 556, 158, 159, 160, 117,
2566 118, 365, 366, 367, 368, 369, 370, 371, 408, 62,
2567 63, 64, 65, 66, 67, 22, 380, 381, 382, 162,
2568 162, 164, 164, 299, 679, 680, 161, 682, 683, 4,
2569 162, 431, 164, 162, 162, 164, 164, 279, 132, 133,
2570 316, 317, 318, 4, 699, 700, 132, 133, 132, 133,
2571 37, 409, 410, 411, 412, 616, 121, 122, 168, 465,
2572 418, 337, 338, 94, 95, 96, 97, 98, 99, 100,
2573 101, 102, 103, 168, 432, 165, 141, 142, 161, 144,
2574 145, 4, 147, 148, 149, 114, 115, 451, 452, 453,
2575 454, 84, 85, 163, 22, 164, 162, 4, 462, 375,
2576 171, 162, 161, 55, 57, 11, 161, 465, 594, 171,
2577 162, 22, 161, 161, 161, 557, 161, 161, 560, 561,
2578 562, 161, 161, 161, 38, 161, 4, 61, 404, 487,
2579 164, 164, 408, 38, 492, 161, 494, 164, 54, 497,
2580 164, 164, 164, 164, 420, 421, 422, 423, 424, 507,
2581 508, 161, 510, 161, 430, 431, 161, 521, 522, 523,
2582 524, 164, 526, 161, 22, 164, 530, 531, 164, 164,
2583 167, 171, 164, 164, 450, 164, 164, 663, 164, 164,
2584 666, 164, 164, 164, 164, 164, 164, 38, 22, 547,
2585 548, 17, 550, 551, 552, 553, 17, 164, 474, 164,
2586 558, 164, 164, 479, 4, 121, 122, 164, 566, 164,
2587 574, 575, 576, 577, 572, 164, 164, 164, 4, 4,
2588 164, 285, 286, 287, 164, 141, 142, 164, 144, 145,
2589 506, 147, 148, 149, 164, 164, 512, 7, 8, 164,
2590 10, 11, 12, 13, 14, 15, 16, 17, 22, 19,
2591 20, 609, 22, 23, 24, 4, 532, 621, 322, 623,
2592 624, 38, 171, 164, 162, 164, 330, 331, 332, 333,
2593 334, 171, 161, 164, 4, 161, 54, 164, 162, 164,
2594 50, 557, 164, 162, 560, 561, 562, 162, 22, 169,
2595 171, 164, 162, 167, 162, 162, 162, 17, 169, 657,
2596 162, 162, 162, 661, 662, 4, 7, 8, 54, 10,
2597 11, 12, 13, 14, 15, 16, 17, 593, 19, 20,
2598 152, 22, 23, 24, 600, 164, 161, 17, 161, 22,
2599 17, 26, 27, 164, 17, 693, 694, 73, 696, 615,
2600 698, 17, 592, 654, 702, 409, 410, 411, 412, 50,
2601 708, 93, 633, 112, 418, 231, 106, 17, 90, 242,
2602 57, 133, 615, 455, 141, 142, 143, 144, 432, 146,
2603 133, -1, -1, 150, 151, -1, 153, 154, 155, 156,
2604 157, -1, -1, -1, -1, -1, -1, -1, 664, -1,
2605 -1, -1, -1, -1, -1, -1, 166, 167, -1, -1,
2606 170, -1, 172, 173, 654, 100, 101, 102, 103, 104,
2607 105, 106, 107, 108, 109, 110, 111, 112, 113, -1,
2608 -1, -1, -1, 487, -1, -1, -1, -1, 492, -1,
2609 494, -1, -1, 497, -1, -1, -1, -1, -1, -1,
2610 -1, -1, -1, 507, 508, -1, 510, 141, 142, 143,
2611 144, -1, 146, -1, -1, -1, 150, 151, -1, 153,
2612 154, 155, 156, 157, -1, 166, 167, -1, -1, 170,
2613 -1, 172, 173, -1, -1, -1, -1, -1, -1, -1,
2614 -1, -1, -1, 547, 548, -1, 550, 551, 552, 553,
2615 -1, -1, -1, -1, 558, -1, -1, -1, -1, -1,
2616 -1, -1, 566, -1, -1, -1, -1, -1, 572, -1,
Dale Johannesendfe8c842008-09-26 19:32:34 +00002617 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002618 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2619 3, 4, 5, 6, 7, 8, 9, -1, -1, 0,
2620 -1, -1, -1, -1, -1, 609, 19, 20, -1, 22,
2621 23, 24, 25, 26, 27, -1, -1, 18, 19, 20,
2622 -1, 22, 23, 24, -1, -1, -1, 40, 41, 30,
2623 31, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2624 -1, 54, -1, -1, -1, -1, 59, -1, -1, -1,
2625 -1, 52, -1, 657, -1, 56, -1, 661, 662, 60,
2626 -1, -1, 75, 76, 77, 78, 79, 80, 81, 82,
2627 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
2628 93, -1, -1, -1, -1, -1, -1, -1, -1, 693,
2629 694, -1, 696, -1, 698, -1, -1, -1, 702, -1,
2630 -1, -1, -1, -1, 708, -1, 119, 120, 121, 122,
2631 123, 124, 125, 126, 127, 128, 129, 130, 131, -1,
2632 133, -1, 135, 136, 137, -1, 139, 140, 141, 142,
2633 -1, 144, 145, -1, 147, 148, 149, -1, -1, -1,
2634 -1, -1, -1, -1, -1, -1, 3, 4, 5, 6,
2635 7, 8, 9, -1, 167, -1, -1, 170, -1, 172,
2636 -1, 174, 19, 20, -1, 22, 23, 24, 25, 26,
2637 27, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2638 -1, -1, -1, 40, 41, -1, -1, -1, -1, -1,
2639 -1, -1, -1, -1, -1, -1, -1, -1, 55, -1,
2640 7, 8, 59, 10, 11, 12, 13, 14, 15, 16,
2641 17, -1, 19, 20, -1, 22, 23, 24, 75, 76,
2642 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2643 87, 88, 89, 90, 91, 92, 93, -1, -1, -1,
2644 -1, -1, -1, 50, -1, -1, -1, -1, -1, -1,
2645 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2646 -1, -1, 119, 120, 121, 122, 123, 124, 125, 126,
2647 127, 128, 129, 130, 131, -1, 133, -1, 135, 136,
2648 137, -1, 139, 140, -1, -1, -1, -1, -1, -1,
2649 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2650 -1, -1, -1, -1, 161, -1, -1, -1, -1, -1,
2651 167, -1, -1, 170, -1, 172, -1, 174, 3, 4,
2652 5, 6, 7, 8, 9, -1, -1, -1, -1, -1,
2653 -1, -1, -1, -1, 19, 20, -1, 22, 23, 24,
2654 25, 26, 27, -1, -1, -1, -1, -1, -1, -1,
2655 -1, -1, -1, -1, -1, 40, 41, -1, -1, 166,
2656 167, -1, -1, 170, -1, 172, 173, -1, -1, -1,
2657 55, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2658 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2659 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2660 85, 86, 87, 88, 89, 90, 91, 92, 93, -1,
2661 -1, -1, -1, -1, 50, -1, -1, -1, -1, -1,
2662 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2663 -1, -1, -1, -1, 119, 120, 121, 122, 123, 124,
2664 125, 126, 127, 128, 129, 130, 131, -1, 133, -1,
2665 135, 136, 137, -1, 139, 140, -1, -1, -1, -1,
2666 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2667 -1, -1, -1, -1, -1, -1, 161, -1, -1, -1,
2668 165, -1, 167, -1, -1, 170, -1, 172, -1, 174,
2669 3, 4, 5, 6, 7, 8, 9, -1, -1, -1,
2670 -1, -1, -1, -1, -1, -1, 19, 20, -1, 22,
2671 23, 24, 25, 26, 27, -1, -1, -1, -1, -1,
2672 -1, -1, -1, -1, -1, -1, -1, 40, 41, -1,
2673 166, 167, -1, -1, 170, -1, 172, 173, -1, -1,
2674 -1, -1, 55, 7, 8, -1, 10, 11, 12, 13,
Chris Lattner740e7092008-10-15 06:16:57 +00002675 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002676 24, -1, 75, 76, 77, 78, 79, 80, 81, 82,
2677 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
2678 93, -1, -1, -1, -1, -1, 50, -1, -1, -1,
Chris Lattner740e7092008-10-15 06:16:57 +00002679 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002680 -1, -1, -1, -1, -1, -1, 119, 120, 121, 122,
2681 123, 124, 125, 126, 127, 128, 129, 130, 131, -1,
2682 133, -1, 135, 136, 137, -1, 139, 140, -1, -1,
Devang Patel652203f2008-09-29 20:49:50 +00002683 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002684 -1, -1, -1, -1, -1, -1, -1, -1, 161, -1,
2685 -1, -1, -1, -1, 167, -1, -1, 170, -1, 172,
2686 -1, 174, 3, 4, 5, 6, 7, 8, 9, -1,
2687 -1, -1, -1, -1, -1, -1, -1, -1, 19, 20,
2688 -1, 22, 23, 24, 25, 26, 27, -1, -1, -1,
2689 -1, -1, -1, -1, -1, -1, -1, -1, -1, 40,
2690 41, 0, 166, 167, -1, -1, 170, -1, 172, 173,
2691 -1, -1, -1, -1, -1, -1, -1, -1, 59, 18,
2692 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
2693 -1, 30, 31, -1, 75, 76, 77, 78, 79, 80,
2694 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2695 91, 92, 93, 52, -1, -1, -1, 56, -1, -1,
2696 -1, 60, -1, -1, -1, -1, -1, -1, -1, -1,
2697 -1, -1, -1, -1, -1, -1, -1, -1, 119, 120,
2698 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
2699 131, -1, 133, -1, 135, 136, 137, -1, 139, 140,
2700 3, 4, 5, 6, -1, -1, 9, -1, -1, -1,
Chris Lattnerf9078f92008-10-15 06:03:48 +00002701 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002702 -1, -1, 25, 26, 27, -1, 167, -1, -1, 170,
2703 -1, 172, -1, 174, -1, -1, -1, 40, 41, -1,
Chris Lattner15bd0952008-08-29 17:20:18 +00002704 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002705 -1, -1, -1, -1, 7, 8, 59, 10, 11, 12,
2706 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2707 23, 24, 75, 76, 77, 78, 79, 80, 81, 82,
2708 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
2709 93, -1, -1, -1, -1, 7, 8, 50, 10, 11,
2710 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2711 22, 23, 24, -1, -1, -1, 119, 120, 121, 122,
2712 123, 124, 125, 126, 127, 128, 129, 130, 131, -1,
2713 133, -1, 135, 136, 137, -1, 139, 140, 50, -1,
2714 7, 8, -1, 10, 11, 12, 13, 14, 15, 16,
2715 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
2716 -1, -1, -1, -1, 167, -1, -1, 170, -1, 172,
2717 -1, 174, 39, -1, -1, -1, -1, -1, -1, -1,
2718 -1, -1, -1, 50, 7, 8, -1, 10, 11, 12,
2719 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2720 23, 24, -1, -1, -1, -1, -1, -1, -1, -1,
2721 -1, -1, -1, 166, 167, -1, -1, 170, -1, 172,
2722 173, -1, -1, -1, -1, -1, -1, 50, -1, 141,
2723 142, -1, 144, 7, 8, -1, 10, 11, 12, 13,
Chris Lattner740e7092008-10-15 06:16:57 +00002724 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002725 24, -1, -1, -1, 166, 167, -1, -1, 170, -1,
2726 172, -1, -1, -1, -1, 39, -1, -1, -1, -1,
Chris Lattner740e7092008-10-15 06:16:57 +00002727 -1, -1, -1, -1, 7, 8, 50, 10, 11, 12,
2728 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002729 23, 24, -1, -1, -1, -1, -1, -1, -1, 166,
2730 167, -1, 125, 170, -1, 172, -1, -1, -1, -1,
2731 -1, -1, -1, -1, -1, 7, 8, 50, 10, 11,
Chris Lattner740e7092008-10-15 06:16:57 +00002732 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002733 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
2734 -1, -1, -1, 166, 167, -1, -1, 170, -1, 172,
Chris Lattner740e7092008-10-15 06:16:57 +00002735 -1, -1, -1, -1, -1, -1, 7, 8, 50, 10,
2736 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2737 -1, 22, 23, 24, 7, 8, -1, 10, 11, 12,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002738 13, 14, 15, 16, 17, -1, 19, 20, 39, 22,
2739 23, 24, 166, 167, -1, -1, 170, -1, 172, 50,
2740 -1, -1, -1, -1, -1, -1, 39, -1, -1, -1,
2741 -1, -1, -1, -1, -1, 7, 8, 50, 10, 11,
2742 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2743 22, 23, 24, 166, 167, -1, 169, 170, -1, 172,
2744 7, 8, -1, 10, 11, 12, 13, 14, 15, 16,
2745 17, -1, 19, 20, -1, 22, 23, 24, 50, -1,
Chris Lattner740e7092008-10-15 06:16:57 +00002746 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002747 -1, -1, -1, -1, 166, 167, -1, 169, 170, -1,
2748 172, 7, 8, 50, 10, 11, 12, 13, 14, 15,
Chris Lattner740e7092008-10-15 06:16:57 +00002749 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
Chris Lattner740e7092008-10-15 06:16:57 +00002750 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002751 -1, -1, -1, -1, -1, 166, 167, -1, -1, 170,
2752 -1, 172, -1, -1, 50, -1, -1, -1, -1, -1,
2753 -1, -1, -1, 166, 167, -1, -1, 170, -1, 172,
2754 7, 8, -1, 10, 11, 12, 13, 14, 15, 16,
2755 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
Chris Lattner740e7092008-10-15 06:16:57 +00002756 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002757 -1, -1, -1, -1, 166, 167, -1, -1, 170, -1,
2758 172, 7, 8, 50, 10, 11, 12, 13, 14, 15,
2759 16, 17, -1, 19, 20, -1, 22, 23, 24, 166,
2760 167, -1, -1, 170, -1, 172, 7, 8, -1, 10,
2761 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2762 -1, 22, 23, 24, 50, -1, -1, -1, -1, -1,
2763 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2764 166, 167, -1, -1, 170, -1, 172, 7, 8, 50,
2765 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2766 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2767 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2768 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2769 50, -1, -1, -1, -1, -1, -1, -1, -1, 166,
2770 167, -1, -1, 170, -1, 172, -1, -1, -1, -1,
2771 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2772 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2773 -1, -1, -1, -1, -1, -1, -1, -1, -1, 36,
2774 166, 167, -1, -1, 170, -1, 172, -1, -1, -1,
2775 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2776 57, 58, -1, -1, -1, 166, 167, -1, -1, 170,
2777 -1, 172, 69, 70, 71, 72, 73, 74, 75, 76,
2778 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2779 87, 88, 89, 90, 91, 92, 93, -1, -1, -1,
2780 -1, -1, -1, -1, -1, -1, 166, 167, -1, -1,
2781 170, -1, 172, -1, -1, -1, -1, 114, 115, 116,
2782 -1, -1, 119, 120, 121, 122, 123, 124, 125, 126,
2783 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
2784 137, 138, 139, 140
Dan Gohmanf4423b12008-04-19 00:24:39 +00002785};
2786
2787/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2788 symbol of state STATE-NUM. */
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002789static const yytype_uint16 yystos[] =
Dan Gohmanf4423b12008-04-19 00:24:39 +00002790{
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002791 0, 19, 20, 22, 23, 24, 30, 31, 52, 56,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002792 60, 181, 184, 186, 187, 188, 222, 223, 224, 226,
2793 225, 53, 68, 231, 163, 59, 163, 18, 163, 42,
2794 43, 44, 45, 46, 47, 48, 49, 51, 158, 159,
2795 160, 189, 190, 191, 0, 224, 46, 48, 192, 241,
2796 42, 43, 44, 47, 193, 238, 240, 248, 163, 163,
2797 167, 232, 22, 230, 7, 8, 10, 11, 12, 13,
2798 14, 15, 16, 17, 50, 166, 167, 170, 172, 181,
2799 186, 209, 210, 244, 191, 191, 35, 37, 220, 191,
2800 191, 21, 249, 250, 29, 173, 239, 249, 22, 22,
2801 22, 233, 161, 4, 4, 4, 172, 10, 173, 210,
2802 215, 55, 161, 183, 220, 220, 42, 44, 194, 32,
2803 33, 219, 62, 63, 64, 65, 66, 67, 195, 236,
2804 236, 7, 184, 185, 253, 164, 169, 39, 210, 211,
2805 213, 214, 168, 168, 173, 215, 164, 173, 161, 214,
2806 165, 219, 219, 10, 125, 210, 212, 221, 210, 216,
2807 4, 199, 28, 172, 237, 163, 36, 57, 58, 69,
Chris Lattner740e7092008-10-15 06:16:57 +00002808 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2809 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2810 90, 91, 92, 93, 114, 115, 116, 119, 120, 121,
2811 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002812 132, 133, 134, 135, 136, 137, 138, 139, 140, 176,
2813 177, 178, 251, 258, 259, 260, 261, 251, 259, 22,
2814 197, 164, 162, 210, 210, 171, 173, 210, 4, 162,
2815 216, 210, 161, 244, 3, 4, 5, 6, 9, 25,
Chris Lattner740e7092008-10-15 06:16:57 +00002816 26, 27, 40, 41, 90, 91, 92, 93, 119, 133,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002817 135, 136, 137, 139, 140, 167, 170, 172, 174, 176,
2818 177, 178, 217, 244, 183, 141, 142, 144, 198, 212,
2819 57, 10, 210, 246, 247, 11, 17, 11, 195, 94,
2820 95, 96, 97, 98, 99, 100, 101, 102, 103, 179,
Chris Lattner740e7092008-10-15 06:16:57 +00002821 26, 27, 100, 101, 102, 103, 104, 105, 106, 107,
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002822 108, 109, 110, 111, 112, 113, 180, 179, 180, 210,
2823 210, 246, 210, 210, 254, 246, 246, 246, 246, 246,
2824 210, 210, 210, 210, 210, 246, 195, 117, 118, 54,
2825 121, 122, 141, 142, 144, 145, 147, 148, 149, 196,
2826 39, 211, 201, 169, 171, 171, 162, 201, 183, 183,
2827 221, 179, 180, 179, 180, 161, 161, 161, 161, 161,
2828 161, 161, 169, 216, 218, 172, 218, 173, 218, 22,
2829 161, 161, 161, 227, 186, 3, 4, 5, 6, 9,
2830 25, 26, 27, 40, 41, 59, 167, 170, 172, 174,
2831 217, 243, 244, 245, 164, 245, 245, 245, 199, 210,
2832 210, 210, 210, 164, 204, 164, 204, 245, 167, 164,
2833 164, 164, 164, 164, 164, 245, 245, 245, 245, 245,
2834 38, 199, 210, 246, 4, 141, 142, 143, 144, 146,
2835 150, 151, 153, 154, 155, 156, 157, 200, 228, 229,
2836 38, 161, 161, 161, 161, 216, 216, 216, 216, 216,
2837 216, 216, 164, 169, 173, 210, 218, 171, 173, 216,
2838 216, 216, 164, 207, 161, 61, 242, 169, 218, 172,
2839 218, 173, 218, 22, 246, 164, 164, 212, 245, 245,
2840 245, 245, 11, 54, 11, 256, 245, 167, 246, 210,
2841 246, 246, 246, 164, 164, 257, 164, 164, 164, 210,
2842 212, 245, 164, 207, 207, 210, 216, 216, 216, 216,
2843 256, 164, 164, 164, 164, 257, 164, 216, 171, 173,
2844 164, 164, 38, 34, 54, 205, 208, 39, 210, 234,
2845 235, 22, 169, 173, 218, 171, 173, 17, 17, 245,
2846 164, 164, 164, 164, 245, 4, 245, 164, 164, 245,
2847 164, 164, 164, 4, 4, 164, 210, 245, 245, 245,
2848 164, 204, 210, 162, 164, 164, 164, 164, 162, 216,
2849 216, 216, 216, 162, 216, 171, 216, 216, 210, 22,
2850 4, 207, 197, 164, 162, 164, 171, 173, 245, 245,
2851 161, 245, 245, 245, 245, 204, 204, 246, 245, 164,
2852 246, 246, 246, 4, 245, 161, 245, 216, 216, 216,
2853 216, 164, 162, 164, 164, 257, 162, 162, 162, 181,
2854 182, 39, 210, 201, 22, 171, 164, 167, 17, 210,
2855 255, 169, 245, 257, 255, 204, 162, 162, 162, 162,
2856 216, 216, 216, 162, 197, 205, 206, 17, 11, 169,
2857 252, 197, 197, 162, 164, 169, 162, 162, 162, 162,
2858 182, 54, 203, 245, 243, 11, 169, 121, 122, 245,
2859 245, 201, 17, 210, 201, 4, 152, 202, 164, 243,
2860 197, 197, 38, 197, 197, 22, 17, 164, 17, 245,
2861 245, 245, 17, 245, 197, 197, 245, 73, 17, 245
Dan Gohmanf4423b12008-04-19 00:24:39 +00002862};
David Greene718fda32007-08-01 03:59:32 +00002863
Reid Spencer68a24bd2005-08-27 18:50:39 +00002864#define yyerrok (yyerrstatus = 0)
2865#define yyclearin (yychar = YYEMPTY)
Dan Gohmanf4423b12008-04-19 00:24:39 +00002866#define YYEMPTY (-2)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002867#define YYEOF 0
Dan Gohmanf4423b12008-04-19 00:24:39 +00002868
Reid Spencer68a24bd2005-08-27 18:50:39 +00002869#define YYACCEPT goto yyacceptlab
Dan Gohmanf4423b12008-04-19 00:24:39 +00002870#define YYABORT goto yyabortlab
2871#define YYERROR goto yyerrorlab
2872
2873
2874/* Like YYERROR except do call yyerror. This remains here temporarily
2875 to ease the transition to the new meaning of YYERROR, for GCC.
Reid Spencer68a24bd2005-08-27 18:50:39 +00002876 Once GCC version 2 has supplanted version 1, this can go. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00002877
Reid Spencer68a24bd2005-08-27 18:50:39 +00002878#define YYFAIL goto yyerrlab
Dan Gohmanf4423b12008-04-19 00:24:39 +00002879
Reid Spencer68a24bd2005-08-27 18:50:39 +00002880#define YYRECOVERING() (!!yyerrstatus)
Dan Gohmanf4423b12008-04-19 00:24:39 +00002881
2882#define YYBACKUP(Token, Value) \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002883do \
2884 if (yychar == YYEMPTY && yylen == 1) \
Dan Gohmanf4423b12008-04-19 00:24:39 +00002885 { \
2886 yychar = (Token); \
2887 yylval = (Value); \
2888 yytoken = YYTRANSLATE (yychar); \
2889 YYPOPSTACK (1); \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002890 goto yybackup; \
2891 } \
2892 else \
Dan Gohmanf4423b12008-04-19 00:24:39 +00002893 { \
2894 yyerror (YY_("syntax error: cannot back up")); \
2895 YYERROR; \
2896 } \
2897while (YYID (0))
2898
Anton Korobeynikov38e09802007-04-28 13:48:45 +00002899
Reid Spencer68a24bd2005-08-27 18:50:39 +00002900#define YYTERROR 1
2901#define YYERRCODE 256
2902
Dan Gohmanf4423b12008-04-19 00:24:39 +00002903
2904/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2905 If N is 0, then set CURRENT to the empty location which ends
2906 the previous symbol: RHS[0] (always defined). */
2907
2908#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2909#ifndef YYLLOC_DEFAULT
2910# define YYLLOC_DEFAULT(Current, Rhs, N) \
2911 do \
2912 if (YYID (N)) \
2913 { \
2914 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2915 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2916 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2917 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2918 } \
2919 else \
2920 { \
2921 (Current).first_line = (Current).last_line = \
2922 YYRHSLOC (Rhs, 0).last_line; \
2923 (Current).first_column = (Current).last_column = \
2924 YYRHSLOC (Rhs, 0).last_column; \
2925 } \
2926 while (YYID (0))
Reid Spencer68a24bd2005-08-27 18:50:39 +00002927#endif
2928
Dan Gohmanf4423b12008-04-19 00:24:39 +00002929
2930/* YY_LOCATION_PRINT -- Print the location on the stream.
2931 This macro was not mandated originally: define only if we know
2932 we won't break user code: when these are the locations we know. */
2933
2934#ifndef YY_LOCATION_PRINT
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00002935# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
Dan Gohmanf4423b12008-04-19 00:24:39 +00002936# define YY_LOCATION_PRINT(File, Loc) \
2937 fprintf (File, "%d.%d-%d.%d", \
2938 (Loc).first_line, (Loc).first_column, \
2939 (Loc).last_line, (Loc).last_column)
2940# else
2941# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2942# endif
2943#endif
2944
2945
2946/* YYLEX -- calling `yylex' with the right arguments. */
2947
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00002948#ifdef YYLEX_PARAM
Dan Gohmanf4423b12008-04-19 00:24:39 +00002949# define YYLEX yylex (YYLEX_PARAM)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00002950#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00002951# define YYLEX yylex ()
Gabor Greife64d2482008-04-06 23:07:54 +00002952#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002953
2954/* Enable debugging if requested. */
2955#if YYDEBUG
2956
2957# ifndef YYFPRINTF
2958# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2959# define YYFPRINTF fprintf
2960# endif
2961
2962# define YYDPRINTF(Args) \
2963do { \
2964 if (yydebug) \
2965 YYFPRINTF Args; \
2966} while (YYID (0))
2967
2968# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2969do { \
2970 if (yydebug) \
2971 { \
2972 YYFPRINTF (stderr, "%s ", Title); \
2973 yy_symbol_print (stderr, \
2974 Type, Value); \
2975 YYFPRINTF (stderr, "\n"); \
2976 } \
2977} while (YYID (0))
2978
2979
2980/*--------------------------------.
2981| Print this symbol on YYOUTPUT. |
2982`--------------------------------*/
2983
2984/*ARGSUSED*/
2985#if (defined __STDC__ || defined __C99__FUNC__ \
2986 || defined __cplusplus || defined _MSC_VER)
2987static void
2988yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
Gabor Greife64d2482008-04-06 23:07:54 +00002989#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00002990static void
2991yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2992 FILE *yyoutput;
2993 int yytype;
2994 YYSTYPE const * const yyvaluep;
Gabor Greife64d2482008-04-06 23:07:54 +00002995#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002996{
2997 if (!yyvaluep)
2998 return;
2999# ifdef YYPRINT
3000 if (yytype < YYNTOKENS)
3001 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
3002# else
3003 YYUSE (yyoutput);
3004# endif
3005 switch (yytype)
3006 {
3007 default:
3008 break;
3009 }
3010}
3011
3012
3013/*--------------------------------.
3014| Print this symbol on YYOUTPUT. |
3015`--------------------------------*/
3016
3017#if (defined __STDC__ || defined __C99__FUNC__ \
3018 || defined __cplusplus || defined _MSC_VER)
3019static void
3020yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
3021#else
3022static void
3023yy_symbol_print (yyoutput, yytype, yyvaluep)
3024 FILE *yyoutput;
3025 int yytype;
3026 YYSTYPE const * const yyvaluep;
Scott Michel15dcd8e2008-01-30 03:10:00 +00003027#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003028{
3029 if (yytype < YYNTOKENS)
3030 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
3031 else
3032 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
Chris Lattner38905612008-02-19 04:36:25 +00003033
Dan Gohmanf4423b12008-04-19 00:24:39 +00003034 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
3035 YYFPRINTF (yyoutput, ")");
3036}
Chris Lattner38905612008-02-19 04:36:25 +00003037
Dan Gohmanf4423b12008-04-19 00:24:39 +00003038/*------------------------------------------------------------------.
3039| yy_stack_print -- Print the state stack from its BOTTOM up to its |
3040| TOP (included). |
3041`------------------------------------------------------------------*/
Chris Lattner38905612008-02-19 04:36:25 +00003042
Dan Gohmanf4423b12008-04-19 00:24:39 +00003043#if (defined __STDC__ || defined __C99__FUNC__ \
3044 || defined __cplusplus || defined _MSC_VER)
3045static void
3046yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
3047#else
3048static void
3049yy_stack_print (bottom, top)
3050 yytype_int16 *bottom;
3051 yytype_int16 *top;
Scott Michel15dcd8e2008-01-30 03:10:00 +00003052#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003053{
3054 YYFPRINTF (stderr, "Stack now");
3055 for (; bottom <= top; ++bottom)
3056 YYFPRINTF (stderr, " %d", *bottom);
3057 YYFPRINTF (stderr, "\n");
3058}
Chris Lattner38905612008-02-19 04:36:25 +00003059
Dan Gohmanf4423b12008-04-19 00:24:39 +00003060# define YY_STACK_PRINT(Bottom, Top) \
3061do { \
3062 if (yydebug) \
3063 yy_stack_print ((Bottom), (Top)); \
3064} while (YYID (0))
Chris Lattner38905612008-02-19 04:36:25 +00003065
Dan Gohmanf4423b12008-04-19 00:24:39 +00003066
3067/*------------------------------------------------.
3068| Report that the YYRULE is going to be reduced. |
3069`------------------------------------------------*/
3070
3071#if (defined __STDC__ || defined __C99__FUNC__ \
3072 || defined __cplusplus || defined _MSC_VER)
3073static void
3074yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
3075#else
3076static void
3077yy_reduce_print (yyvsp, yyrule)
3078 YYSTYPE *yyvsp;
3079 int yyrule;
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00003080#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003081{
3082 int yynrhs = yyr2[yyrule];
3083 int yyi;
3084 unsigned long int yylno = yyrline[yyrule];
3085 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
3086 yyrule - 1, yylno);
3087 /* The symbols being reduced. */
3088 for (yyi = 0; yyi < yynrhs; yyi++)
3089 {
3090 fprintf (stderr, " $%d = ", yyi + 1);
3091 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
3092 &(yyvsp[(yyi + 1) - (yynrhs)])
3093 );
3094 fprintf (stderr, "\n");
3095 }
3096}
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003097
Dan Gohmanf4423b12008-04-19 00:24:39 +00003098# define YY_REDUCE_PRINT(Rule) \
3099do { \
3100 if (yydebug) \
3101 yy_reduce_print (yyvsp, Rule); \
3102} while (YYID (0))
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003103
Dan Gohmanf4423b12008-04-19 00:24:39 +00003104/* Nonzero means print parse trace. It is left uninitialized so that
3105 multiple parsers can coexist. */
3106int yydebug;
3107#else /* !YYDEBUG */
3108# define YYDPRINTF(Args)
3109# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
3110# define YY_STACK_PRINT(Bottom, Top)
3111# define YY_REDUCE_PRINT(Rule)
3112#endif /* !YYDEBUG */
3113
3114
3115/* YYINITDEPTH -- initial size of the parser's stacks. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003116#ifndef YYINITDEPTH
Dan Gohmanf4423b12008-04-19 00:24:39 +00003117# define YYINITDEPTH 200
Reid Spencer68a24bd2005-08-27 18:50:39 +00003118#endif
3119
Dan Gohmanf4423b12008-04-19 00:24:39 +00003120/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
3121 if the built-in stack extension method is used).
Reid Spencer68a24bd2005-08-27 18:50:39 +00003122
Dan Gohmanf4423b12008-04-19 00:24:39 +00003123 Do not make this value too large; the results are undefined if
3124 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
3125 evaluated with infinite-precision integer arithmetic. */
David Greene718fda32007-08-01 03:59:32 +00003126
Reid Spencer68a24bd2005-08-27 18:50:39 +00003127#ifndef YYMAXDEPTH
Dan Gohmanf4423b12008-04-19 00:24:39 +00003128# define YYMAXDEPTH 10000
Reid Spencer68a24bd2005-08-27 18:50:39 +00003129#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003130
Reid Spencer68a24bd2005-08-27 18:50:39 +00003131
3132
Dan Gohmanf4423b12008-04-19 00:24:39 +00003133#if YYERROR_VERBOSE
Reid Spencer68a24bd2005-08-27 18:50:39 +00003134
Dan Gohmanf4423b12008-04-19 00:24:39 +00003135# ifndef yystrlen
3136# if defined __GLIBC__ && defined _STRING_H
3137# define yystrlen strlen
3138# else
3139/* Return the length of YYSTR. */
3140#if (defined __STDC__ || defined __C99__FUNC__ \
3141 || defined __cplusplus || defined _MSC_VER)
3142static YYSIZE_T
3143yystrlen (const char *yystr)
Chris Lattner38905612008-02-19 04:36:25 +00003144#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00003145static YYSIZE_T
3146yystrlen (yystr)
3147 const char *yystr;
3148#endif
3149{
3150 YYSIZE_T yylen;
3151 for (yylen = 0; yystr[yylen]; yylen++)
3152 continue;
3153 return yylen;
3154}
3155# endif
3156# endif
3157
3158# ifndef yystpcpy
3159# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
3160# define yystpcpy stpcpy
3161# else
3162/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
3163 YYDEST. */
3164#if (defined __STDC__ || defined __C99__FUNC__ \
3165 || defined __cplusplus || defined _MSC_VER)
3166static char *
3167yystpcpy (char *yydest, const char *yysrc)
3168#else
3169static char *
3170yystpcpy (yydest, yysrc)
3171 char *yydest;
3172 const char *yysrc;
3173#endif
3174{
3175 char *yyd = yydest;
3176 const char *yys = yysrc;
3177
3178 while ((*yyd++ = *yys++) != '\0')
3179 continue;
3180
3181 return yyd - 1;
3182}
3183# endif
3184# endif
3185
3186# ifndef yytnamerr
3187/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3188 quotes and backslashes, so that it's suitable for yyerror. The
3189 heuristic is that double-quoting is unnecessary unless the string
3190 contains an apostrophe, a comma, or backslash (other than
3191 backslash-backslash). YYSTR is taken from yytname. If YYRES is
3192 null, do not copy; instead, return the length of what the result
3193 would have been. */
3194static YYSIZE_T
3195yytnamerr (char *yyres, const char *yystr)
3196{
3197 if (*yystr == '"')
3198 {
3199 YYSIZE_T yyn = 0;
3200 char const *yyp = yystr;
3201
3202 for (;;)
3203 switch (*++yyp)
3204 {
3205 case '\'':
3206 case ',':
3207 goto do_not_strip_quotes;
3208
3209 case '\\':
3210 if (*++yyp != '\\')
3211 goto do_not_strip_quotes;
3212 /* Fall through. */
3213 default:
3214 if (yyres)
3215 yyres[yyn] = *yyp;
3216 yyn++;
3217 break;
3218
3219 case '"':
3220 if (yyres)
3221 yyres[yyn] = '\0';
3222 return yyn;
3223 }
3224 do_not_strip_quotes: ;
3225 }
3226
3227 if (! yyres)
3228 return yystrlen (yystr);
3229
3230 return yystpcpy (yyres, yystr) - yyres;
3231}
3232# endif
3233
3234/* Copy into YYRESULT an error message about the unexpected token
3235 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3236 including the terminating null byte. If YYRESULT is null, do not
3237 copy anything; just return the number of bytes that would be
3238 copied. As a special case, return 0 if an ordinary "syntax error"
3239 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3240 size calculation. */
3241static YYSIZE_T
3242yysyntax_error (char *yyresult, int yystate, int yychar)
3243{
3244 int yyn = yypact[yystate];
3245
3246 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3247 return 0;
3248 else
3249 {
3250 int yytype = YYTRANSLATE (yychar);
3251 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3252 YYSIZE_T yysize = yysize0;
3253 YYSIZE_T yysize1;
3254 int yysize_overflow = 0;
3255 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3256 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3257 int yyx;
3258
3259# if 0
3260 /* This is so xgettext sees the translatable formats that are
3261 constructed on the fly. */
3262 YY_("syntax error, unexpected %s");
3263 YY_("syntax error, unexpected %s, expecting %s");
3264 YY_("syntax error, unexpected %s, expecting %s or %s");
3265 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3266 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3267# endif
3268 char *yyfmt;
3269 char const *yyf;
3270 static char const yyunexpected[] = "syntax error, unexpected %s";
3271 static char const yyexpecting[] = ", expecting %s";
3272 static char const yyor[] = " or %s";
3273 char yyformat[sizeof yyunexpected
3274 + sizeof yyexpecting - 1
3275 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3276 * (sizeof yyor - 1))];
3277 char const *yyprefix = yyexpecting;
3278
3279 /* Start YYX at -YYN if negative to avoid negative indexes in
3280 YYCHECK. */
3281 int yyxbegin = yyn < 0 ? -yyn : 0;
3282
3283 /* Stay within bounds of both yycheck and yytname. */
3284 int yychecklim = YYLAST - yyn + 1;
3285 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3286 int yycount = 1;
3287
3288 yyarg[0] = yytname[yytype];
3289 yyfmt = yystpcpy (yyformat, yyunexpected);
3290
3291 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3292 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3293 {
3294 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3295 {
3296 yycount = 1;
3297 yysize = yysize0;
3298 yyformat[sizeof yyunexpected - 1] = '\0';
3299 break;
3300 }
3301 yyarg[yycount++] = yytname[yyx];
3302 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3303 yysize_overflow |= (yysize1 < yysize);
3304 yysize = yysize1;
3305 yyfmt = yystpcpy (yyfmt, yyprefix);
3306 yyprefix = yyor;
3307 }
3308
3309 yyf = YY_(yyformat);
3310 yysize1 = yysize + yystrlen (yyf);
3311 yysize_overflow |= (yysize1 < yysize);
3312 yysize = yysize1;
3313
3314 if (yysize_overflow)
3315 return YYSIZE_MAXIMUM;
3316
3317 if (yyresult)
3318 {
3319 /* Avoid sprintf, as that infringes on the user's name space.
3320 Don't have undefined behavior even if the translation
3321 produced a string with the wrong number of "%s"s. */
3322 char *yyp = yyresult;
3323 int yyi = 0;
3324 while ((*yyp = *yyf) != '\0')
3325 {
3326 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3327 {
3328 yyp += yytnamerr (yyp, yyarg[yyi++]);
3329 yyf += 2;
3330 }
3331 else
3332 {
3333 yyp++;
3334 yyf++;
3335 }
3336 }
3337 }
3338 return yysize;
3339 }
3340}
3341#endif /* YYERROR_VERBOSE */
3342
3343
3344/*-----------------------------------------------.
3345| Release the memory associated to this symbol. |
3346`-----------------------------------------------*/
3347
3348/*ARGSUSED*/
3349#if (defined __STDC__ || defined __C99__FUNC__ \
3350 || defined __cplusplus || defined _MSC_VER)
3351static void
3352yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3353#else
3354static void
3355yydestruct (yymsg, yytype, yyvaluep)
3356 const char *yymsg;
3357 int yytype;
3358 YYSTYPE *yyvaluep;
3359#endif
3360{
3361 YYUSE (yyvaluep);
3362
3363 if (!yymsg)
3364 yymsg = "Deleting";
3365 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3366
3367 switch (yytype)
3368 {
3369
3370 default:
3371 break;
3372 }
3373}
3374
3375
3376/* Prevent warnings from -Wmissing-prototypes. */
3377
3378#ifdef YYPARSE_PARAM
3379#if defined __STDC__ || defined __cplusplus
3380int yyparse (void *YYPARSE_PARAM);
3381#else
3382int yyparse ();
3383#endif
3384#else /* ! YYPARSE_PARAM */
3385#if defined __STDC__ || defined __cplusplus
David Greene5fd22a82007-09-04 18:46:50 +00003386int yyparse (void);
Gabor Greife64d2482008-04-06 23:07:54 +00003387#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00003388int yyparse ();
Scott Michel15dcd8e2008-01-30 03:10:00 +00003389#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003390#endif /* ! YYPARSE_PARAM */
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003391
Chris Lattner38905612008-02-19 04:36:25 +00003392
Dan Gohmanf4423b12008-04-19 00:24:39 +00003393
3394/* The look-ahead symbol. */
3395int yychar;
3396
3397/* The semantic value of the look-ahead symbol. */
3398YYSTYPE yylval;
3399
3400/* Number of syntax errors so far. */
3401int yynerrs;
3402
3403
3404
3405/*----------.
3406| yyparse. |
3407`----------*/
3408
3409#ifdef YYPARSE_PARAM
3410#if (defined __STDC__ || defined __C99__FUNC__ \
3411 || defined __cplusplus || defined _MSC_VER)
3412int
3413yyparse (void *YYPARSE_PARAM)
3414#else
3415int
3416yyparse (YYPARSE_PARAM)
3417 void *YYPARSE_PARAM;
3418#endif
3419#else /* ! YYPARSE_PARAM */
3420#if (defined __STDC__ || defined __C99__FUNC__ \
3421 || defined __cplusplus || defined _MSC_VER)
3422int
3423yyparse (void)
3424#else
3425int
3426yyparse ()
3427
Gabor Greife64d2482008-04-06 23:07:54 +00003428#endif
3429#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003430{
3431
3432 int yystate;
3433 int yyn;
3434 int yyresult;
3435 /* Number of tokens to shift before error messages enabled. */
3436 int yyerrstatus;
3437 /* Look-ahead token as an internal (translated) token number. */
3438 int yytoken = 0;
3439#if YYERROR_VERBOSE
3440 /* Buffer for error messages, and its allocated size. */
3441 char yymsgbuf[128];
3442 char *yymsg = yymsgbuf;
3443 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
Gabor Greife64d2482008-04-06 23:07:54 +00003444#endif
Chris Lattner38905612008-02-19 04:36:25 +00003445
Dan Gohmanf4423b12008-04-19 00:24:39 +00003446 /* Three stacks and their tools:
3447 `yyss': related to states,
3448 `yyvs': related to semantic values,
3449 `yyls': related to locations.
3450
3451 Refer to the stacks thru separate pointers, to allow yyoverflow
3452 to reallocate them elsewhere. */
3453
3454 /* The state stack. */
3455 yytype_int16 yyssa[YYINITDEPTH];
3456 yytype_int16 *yyss = yyssa;
3457 yytype_int16 *yyssp;
3458
3459 /* The semantic value stack. */
3460 YYSTYPE yyvsa[YYINITDEPTH];
3461 YYSTYPE *yyvs = yyvsa;
3462 YYSTYPE *yyvsp;
3463
3464
3465
3466#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3467
3468 YYSIZE_T yystacksize = YYINITDEPTH;
3469
3470 /* The variables used to return semantic value and location from the
3471 action routines. */
3472 YYSTYPE yyval;
3473
3474
3475 /* The number of symbols on the RHS of the reduced rule.
3476 Keep to zero when no symbol should be popped. */
3477 int yylen = 0;
3478
3479 YYDPRINTF ((stderr, "Starting parse\n"));
3480
Reid Spencer68a24bd2005-08-27 18:50:39 +00003481 yystate = 0;
3482 yyerrstatus = 0;
3483 yynerrs = 0;
3484 yychar = YYEMPTY; /* Cause a token to be read. */
3485
3486 /* Initialize stack pointers.
3487 Waste one element of value and location stack
3488 so that they stay on the same level as the state stack.
3489 The wasted elements are never initialized. */
3490
Dan Gohmanf4423b12008-04-19 00:24:39 +00003491 yyssp = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003492 yyvsp = yyvs;
3493
Dan Gohmanf4423b12008-04-19 00:24:39 +00003494 goto yysetstate;
Jeff Cohen66c5fd62005-10-23 04:37:20 +00003495
Dan Gohmanf4423b12008-04-19 00:24:39 +00003496/*------------------------------------------------------------.
3497| yynewstate -- Push a new state, which is found in yystate. |
3498`------------------------------------------------------------*/
3499 yynewstate:
3500 /* In all cases, when you get here, the value and location stacks
3501 have just been pushed. So pushing a state here evens the stacks. */
3502 yyssp++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003503
Dan Gohmanf4423b12008-04-19 00:24:39 +00003504 yysetstate:
3505 *yyssp = yystate;
3506
3507 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003508 {
3509 /* Get the current used size of the three stacks, in elements. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003510 YYSIZE_T yysize = yyssp - yyss + 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003511
3512#ifdef yyoverflow
Dan Gohmanf4423b12008-04-19 00:24:39 +00003513 {
3514 /* Give user a chance to reallocate the stack. Use copies of
3515 these so that the &'s don't force the real ones into
3516 memory. */
3517 YYSTYPE *yyvs1 = yyvs;
3518 yytype_int16 *yyss1 = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003519
Dan Gohmanf4423b12008-04-19 00:24:39 +00003520
3521 /* Each stack pointer address is followed by the size of the
3522 data in use in that stack, in bytes. This used to be a
3523 conditional around just the two extra args, but that might
3524 be undefined if yyoverflow is a macro. */
3525 yyoverflow (YY_("memory exhausted"),
3526 &yyss1, yysize * sizeof (*yyssp),
3527 &yyvs1, yysize * sizeof (*yyvsp),
3528
3529 &yystacksize);
3530
3531 yyss = yyss1;
3532 yyvs = yyvs1;
3533 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00003534#else /* no yyoverflow */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003535# ifndef YYSTACK_RELOCATE
3536 goto yyexhaustedlab;
3537# else
Reid Spencer68a24bd2005-08-27 18:50:39 +00003538 /* Extend the stack our own way. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003539 if (YYMAXDEPTH <= yystacksize)
3540 goto yyexhaustedlab;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003541 yystacksize *= 2;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003542 if (YYMAXDEPTH < yystacksize)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003543 yystacksize = YYMAXDEPTH;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003544
3545 {
3546 yytype_int16 *yyss1 = yyss;
3547 union yyalloc *yyptr =
3548 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3549 if (! yyptr)
3550 goto yyexhaustedlab;
3551 YYSTACK_RELOCATE (yyss);
3552 YYSTACK_RELOCATE (yyvs);
3553
3554# undef YYSTACK_RELOCATE
3555 if (yyss1 != yyssa)
3556 YYSTACK_FREE (yyss1);
3557 }
3558# endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00003559#endif /* no yyoverflow */
3560
Dan Gohmanf4423b12008-04-19 00:24:39 +00003561 yyssp = yyss + yysize - 1;
3562 yyvsp = yyvs + yysize - 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003563
3564
Dan Gohmanf4423b12008-04-19 00:24:39 +00003565 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3566 (unsigned long int) yystacksize));
3567
3568 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003569 YYABORT;
3570 }
3571
Dan Gohmanf4423b12008-04-19 00:24:39 +00003572 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003573
3574 goto yybackup;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003575
Dan Gohmanf4423b12008-04-19 00:24:39 +00003576/*-----------.
3577| yybackup. |
3578`-----------*/
3579yybackup:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003580
Dan Gohmanf4423b12008-04-19 00:24:39 +00003581 /* Do appropriate processing given the current state. Read a
3582 look-ahead token if we need one and don't already have one. */
Reid Spencer7780acb2007-04-16 06:56:07 +00003583
Dan Gohmanf4423b12008-04-19 00:24:39 +00003584 /* First try to decide what to do without reference to look-ahead token. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003585 yyn = yypact[yystate];
Dan Gohmanf4423b12008-04-19 00:24:39 +00003586 if (yyn == YYPACT_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003587 goto yydefault;
3588
Dan Gohmanf4423b12008-04-19 00:24:39 +00003589 /* Not known => get a look-ahead token if don't already have one. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003590
Dan Gohmanf4423b12008-04-19 00:24:39 +00003591 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003592 if (yychar == YYEMPTY)
3593 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003594 YYDPRINTF ((stderr, "Reading a token: "));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003595 yychar = YYLEX;
3596 }
3597
Dan Gohmanf4423b12008-04-19 00:24:39 +00003598 if (yychar <= YYEOF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003599 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003600 yychar = yytoken = YYEOF;
3601 YYDPRINTF ((stderr, "Now at end of input.\n"));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003602 }
3603 else
3604 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003605 yytoken = YYTRANSLATE (yychar);
3606 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Reid Spencer68a24bd2005-08-27 18:50:39 +00003607 }
3608
Dan Gohmanf4423b12008-04-19 00:24:39 +00003609 /* If the proper action on seeing token YYTOKEN is to reduce or to
3610 detect an error, take that action. */
3611 yyn += yytoken;
3612 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003613 goto yydefault;
3614 yyn = yytable[yyn];
Dan Gohmanf4423b12008-04-19 00:24:39 +00003615 if (yyn <= 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003616 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003617 if (yyn == 0 || yyn == YYTABLE_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003618 goto yyerrlab;
3619 yyn = -yyn;
3620 goto yyreduce;
3621 }
3622
3623 if (yyn == YYFINAL)
3624 YYACCEPT;
3625
Dan Gohmanf4423b12008-04-19 00:24:39 +00003626 /* Count tokens shifted since error; after three, turn off error
3627 status. */
3628 if (yyerrstatus)
3629 yyerrstatus--;
Dale Johannesencdd509a2007-09-07 21:07:57 +00003630
Dan Gohmanf4423b12008-04-19 00:24:39 +00003631 /* Shift the look-ahead token. */
3632 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003633
Dan Gohmanf4423b12008-04-19 00:24:39 +00003634 /* Discard the shifted token unless it is eof. */
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003635 if (yychar != YYEOF)
3636 yychar = YYEMPTY;
3637
Gabor Greife64d2482008-04-06 23:07:54 +00003638 yystate = yyn;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003639 *++yyvsp = yylval;
3640
Reid Spencer68a24bd2005-08-27 18:50:39 +00003641 goto yynewstate;
3642
Gabor Greife64d2482008-04-06 23:07:54 +00003643
Dan Gohmanf4423b12008-04-19 00:24:39 +00003644/*-----------------------------------------------------------.
3645| yydefault -- do the default action for the current state. |
3646`-----------------------------------------------------------*/
3647yydefault:
Reid Spencer68a24bd2005-08-27 18:50:39 +00003648 yyn = yydefact[yystate];
3649 if (yyn == 0)
3650 goto yyerrlab;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003651 goto yyreduce;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003652
Dan Gohmanf4423b12008-04-19 00:24:39 +00003653
3654/*-----------------------------.
3655| yyreduce -- Do a reduction. |
3656`-----------------------------*/
Reid Spencer68a24bd2005-08-27 18:50:39 +00003657yyreduce:
Dan Gohmanf4423b12008-04-19 00:24:39 +00003658 /* yyn is the number of a rule to reduce with. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003659 yylen = yyr2[yyn];
3660
Dan Gohmanf4423b12008-04-19 00:24:39 +00003661 /* If YYLEN is nonzero, implement the default value of the action:
3662 `$$ = $1'.
3663
3664 Otherwise, the following line sets YYVAL to garbage.
3665 This behavior is undocumented and Bison
3666 users should not rely upon it. Assigning to YYVAL
3667 unconditionally makes the parser a bit smaller, and it avoids a
3668 GCC warning that YYVAL may be used uninitialized. */
3669 yyval = yyvsp[1-yylen];
3670
3671
3672 YY_REDUCE_PRINT (yyn);
3673 switch (yyn)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003674 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003675 case 29:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003676#line 1158 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003677 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3678 break;
Reid Spencer41dff5e2007-01-26 08:05:27 +00003679
Dan Gohmanf4423b12008-04-19 00:24:39 +00003680 case 30:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003681#line 1158 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003682 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3683 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003684
Dan Gohmanf4423b12008-04-19 00:24:39 +00003685 case 31:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003686#line 1159 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003687 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3688 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003689
Dan Gohmanf4423b12008-04-19 00:24:39 +00003690 case 32:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003691#line 1159 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003692 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3693 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003694
Dan Gohmanf4423b12008-04-19 00:24:39 +00003695 case 33:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003696#line 1160 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003697 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3698 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003699
Dan Gohmanf4423b12008-04-19 00:24:39 +00003700 case 34:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003701#line 1160 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003702 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3703 break;
3704
3705 case 35:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003706#line 1161 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003707 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3708 break;
3709
3710 case 36:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003711#line 1161 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003712 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3713 break;
3714
3715 case 37:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003716#line 1162 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003717 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3718 break;
3719
3720 case 38:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003721#line 1162 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003722 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3723 break;
3724
3725 case 39:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003726#line 1166 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003727 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3728 break;
3729
3730 case 40:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003731#line 1166 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003732 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3733 break;
3734
3735 case 41:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003736#line 1167 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003737 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3738 break;
3739
3740 case 42:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003741#line 1167 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003742 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3743 break;
3744
3745 case 43:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003746#line 1168 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003747 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3748 break;
3749
3750 case 44:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003751#line 1168 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003752 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3753 break;
3754
3755 case 45:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003756#line 1169 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003757 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3758 break;
3759
3760 case 46:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003761#line 1169 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003762 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3763 break;
3764
3765 case 47:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003766#line 1170 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003767 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3768 break;
3769
3770 case 48:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003771#line 1170 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003772 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3773 break;
3774
3775 case 49:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003776#line 1171 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003777 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3778 break;
3779
3780 case 50:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003781#line 1171 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003782 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3783 break;
3784
3785 case 51:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003786#line 1172 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003787 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3788 break;
3789
3790 case 52:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003791#line 1172 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003792 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3793 break;
3794
3795 case 53:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003796#line 1173 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003797 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3798 break;
3799
3800 case 54:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003801#line 1174 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003802 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3803 break;
3804
Chris Lattner740e7092008-10-15 06:16:57 +00003805 case 59:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003806#line 1178 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003807 { (yyval.StrVal) = 0; ;}
3808 break;
3809
Chris Lattner740e7092008-10-15 06:16:57 +00003810 case 60:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003811#line 1180 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003812 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3813 break;
3814
Chris Lattner740e7092008-10-15 06:16:57 +00003815 case 61:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003816#line 1181 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003817 { (yyval.UIntVal)=0; ;}
3818 break;
3819
Chris Lattner740e7092008-10-15 06:16:57 +00003820 case 62:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003821#line 1185 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003822 {
3823 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003824 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003825 ;}
3826 break;
3827
Chris Lattner740e7092008-10-15 06:16:57 +00003828 case 63:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003829#line 1189 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003830 {
3831 (yyval.StrVal) = 0;
3832 CHECK_FOR_ERROR
3833 ;}
3834 break;
3835
3836 case 64:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003837#line 1194 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003838 {
3839 (yyval.UIntVal) = (yyvsp[(1) - (2)].UIntVal);
3840 CHECK_FOR_ERROR
3841;}
3842 break;
3843
Chris Lattnerf9078f92008-10-15 06:03:48 +00003844 case 68:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003845#line 1203 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003846 {
3847 (yyval.StrVal) = 0;
Christopher Lambbf3348d2007-12-12 08:45:45 +00003848 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003849 ;}
3850 break;
3851
Chris Lattnerf9078f92008-10-15 06:03:48 +00003852 case 69:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003853#line 1208 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003854 {
3855 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00003856 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003857 ;}
3858 break;
3859
Chris Lattner740e7092008-10-15 06:16:57 +00003860 case 70:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003861#line 1214 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003862 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3863 break;
3864
Chris Lattner740e7092008-10-15 06:16:57 +00003865 case 71:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003866#line 1215 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003867 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3868 break;
3869
Chris Lattner740e7092008-10-15 06:16:57 +00003870 case 72:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003871#line 1216 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003872 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3873 break;
3874
Chris Lattner740e7092008-10-15 06:16:57 +00003875 case 73:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003876#line 1217 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003877 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3878 break;
3879
Chris Lattner740e7092008-10-15 06:16:57 +00003880 case 74:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003881#line 1218 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003882 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3883 break;
3884
Chris Lattner740e7092008-10-15 06:16:57 +00003885 case 75:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003886#line 1219 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003887 { (yyval.Linkage) = GlobalValue::CommonLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003888 break;
3889
Chris Lattner740e7092008-10-15 06:16:57 +00003890 case 76:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003891#line 1223 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003892 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003893 break;
3894
Chris Lattner740e7092008-10-15 06:16:57 +00003895 case 77:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003896#line 1224 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003897 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003898 break;
3899
Chris Lattner740e7092008-10-15 06:16:57 +00003900 case 78:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003901#line 1225 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003902 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3903 break;
3904
3905 case 79:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003906#line 1229 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes8a5f3472008-10-15 12:05:02 +00003907 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3908 break;
3909
Nuno Lopes19830332008-11-04 14:28:33 +00003910 case 80:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003911#line 1230 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes19830332008-11-04 14:28:33 +00003912 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3913 break;
3914
3915 case 81:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003916#line 1231 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003917 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3918 break;
3919
3920 case 82:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003921#line 1232 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003922 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
3923 break;
3924
3925 case 83:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003926#line 1236 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003927 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003928 break;
3929
Chris Lattnerf9078f92008-10-15 06:03:48 +00003930 case 84:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003931#line 1237 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003932 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003933 break;
3934
Chris Lattner740e7092008-10-15 06:16:57 +00003935 case 85:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003936#line 1238 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003937 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003938 break;
3939
Chris Lattner740e7092008-10-15 06:16:57 +00003940 case 86:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003941#line 1242 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003942 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3943 break;
3944
3945 case 87:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003946#line 1243 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003947 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3948 break;
3949
3950 case 88:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003951#line 1244 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003952 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3953 break;
3954
3955 case 89:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003956#line 1245 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003957 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3958 break;
3959
3960 case 90:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003961#line 1246 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003962 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3963 break;
3964
3965 case 91:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003966#line 1250 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003967 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3968 break;
3969
Chris Lattnerf9078f92008-10-15 06:03:48 +00003970 case 92:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003971#line 1251 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00003972 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
Chris Lattnerf9078f92008-10-15 06:03:48 +00003973 break;
3974
Chris Lattner15bd0952008-08-29 17:20:18 +00003975 case 93:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003976#line 1252 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003977 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003978 break;
3979
Chris Lattner740e7092008-10-15 06:16:57 +00003980 case 94:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003981#line 1255 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes8a5f3472008-10-15 12:05:02 +00003982 { (yyval.UIntVal) = CallingConv::C; ;}
3983 break;
3984
Nuno Lopes19830332008-11-04 14:28:33 +00003985 case 95:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003986#line 1256 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes19830332008-11-04 14:28:33 +00003987 { (yyval.UIntVal) = CallingConv::C; ;}
3988 break;
3989
3990 case 96:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003991#line 1257 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003992 { (yyval.UIntVal) = CallingConv::Fast; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003993 break;
3994
Chris Lattner740e7092008-10-15 06:16:57 +00003995 case 97:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00003996#line 1258 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003997 { (yyval.UIntVal) = CallingConv::Cold; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003998 break;
3999
Chris Lattner740e7092008-10-15 06:16:57 +00004000 case 98:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004001#line 1259 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004002 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004003 break;
4004
Chris Lattner740e7092008-10-15 06:16:57 +00004005 case 99:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004006#line 1260 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004007 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004008 break;
4009
Chris Lattner740e7092008-10-15 06:16:57 +00004010 case 100:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004011#line 1261 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004012 {
4013 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004014 GEN_ERROR("Calling conv too large");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004015 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004016 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004017 ;}
4018 break;
4019
Chris Lattner740e7092008-10-15 06:16:57 +00004020 case 101:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004021#line 1268 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes8a5f3472008-10-15 12:05:02 +00004022 { (yyval.Attributes) = Attribute::ZExt; ;}
Chris Lattner740e7092008-10-15 06:16:57 +00004023 break;
4024
Nuno Lopes19830332008-11-04 14:28:33 +00004025 case 102:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004026#line 1269 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes19830332008-11-04 14:28:33 +00004027 { (yyval.Attributes) = Attribute::ZExt; ;}
Chris Lattner740e7092008-10-15 06:16:57 +00004028 break;
4029
Nuno Lopes19830332008-11-04 14:28:33 +00004030 case 103:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004031#line 1270 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes8a5f3472008-10-15 12:05:02 +00004032 { (yyval.Attributes) = Attribute::SExt; ;}
4033 break;
4034
Nuno Lopes19830332008-11-04 14:28:33 +00004035 case 104:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004036#line 1271 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Nuno Lopes19830332008-11-04 14:28:33 +00004037 { (yyval.Attributes) = Attribute::SExt; ;}
4038 break;
4039
4040 case 105:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004041#line 1272 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004042 { (yyval.Attributes) = Attribute::InReg; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004043 break;
4044
Chris Lattner740e7092008-10-15 06:16:57 +00004045 case 106:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004046#line 1273 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004047 { (yyval.Attributes) = Attribute::StructRet; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004048 break;
4049
Chris Lattner740e7092008-10-15 06:16:57 +00004050 case 107:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004051#line 1274 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004052 { (yyval.Attributes) = Attribute::NoAlias; ;}
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004053 break;
4054
Chris Lattner740e7092008-10-15 06:16:57 +00004055 case 108:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004056#line 1275 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004057 { (yyval.Attributes) = Attribute::ByVal; ;}
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004058 break;
4059
Chris Lattner740e7092008-10-15 06:16:57 +00004060 case 109:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004061#line 1276 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004062 { (yyval.Attributes) = Attribute::Nest; ;}
Chris Lattner15bd0952008-08-29 17:20:18 +00004063 break;
4064
Chris Lattner740e7092008-10-15 06:16:57 +00004065 case 110:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004066#line 1277 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004067 { (yyval.Attributes) =
4068 Attribute::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004069 break;
4070
Chris Lattner740e7092008-10-15 06:16:57 +00004071 case 111:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004072#line 1281 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004073 { (yyval.Attributes) = Attribute::None; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004074 break;
4075
Chris Lattner740e7092008-10-15 06:16:57 +00004076 case 112:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004077#line 1282 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dale Johannesendfe8c842008-09-26 19:32:34 +00004078 {
4079 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
4080 ;}
4081 break;
4082
Chris Lattner740e7092008-10-15 06:16:57 +00004083 case 113:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004084#line 1287 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004085 { (yyval.Attributes) = Attribute::InReg; ;}
Chris Lattner15bd0952008-08-29 17:20:18 +00004086 break;
4087
Chris Lattner740e7092008-10-15 06:16:57 +00004088 case 114:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004089#line 1288 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004090 { (yyval.Attributes) = Attribute::ZExt; ;}
Chris Lattner15bd0952008-08-29 17:20:18 +00004091 break;
4092
Chris Lattner740e7092008-10-15 06:16:57 +00004093 case 115:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004094#line 1289 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004095 { (yyval.Attributes) = Attribute::SExt; ;}
Chris Lattner15bd0952008-08-29 17:20:18 +00004096 break;
4097
Chris Lattner740e7092008-10-15 06:16:57 +00004098 case 116:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004099#line 1292 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Devang Patel05988662008-09-25 21:00:45 +00004100 { (yyval.Attributes) = Attribute::None; ;}
Chris Lattnerccef6b52008-09-23 21:18:31 +00004101 break;
4102
Chris Lattner740e7092008-10-15 06:16:57 +00004103 case 117:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004104#line 1293 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00004105 {
4106 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
4107 ;}
4108 break;
4109
Chris Lattner740e7092008-10-15 06:16:57 +00004110 case 118:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004111#line 1299 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00004112 { (yyval.Attributes) = Attribute::NoReturn; ;}
4113 break;
4114
Chris Lattner740e7092008-10-15 06:16:57 +00004115 case 119:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004116#line 1300 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00004117 { (yyval.Attributes) = Attribute::NoUnwind; ;}
4118 break;
4119
Chris Lattner740e7092008-10-15 06:16:57 +00004120 case 120:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004121#line 1301 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00004122 { (yyval.Attributes) = Attribute::InReg; ;}
4123 break;
4124
Chris Lattner740e7092008-10-15 06:16:57 +00004125 case 121:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004126#line 1302 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00004127 { (yyval.Attributes) = Attribute::ZExt; ;}
4128 break;
4129
Chris Lattner740e7092008-10-15 06:16:57 +00004130 case 122:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004131#line 1303 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00004132 { (yyval.Attributes) = Attribute::SExt; ;}
4133 break;
4134
Chris Lattner740e7092008-10-15 06:16:57 +00004135 case 123:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004136#line 1304 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00004137 { (yyval.Attributes) = Attribute::ReadNone; ;}
4138 break;
4139
Chris Lattner740e7092008-10-15 06:16:57 +00004140 case 124:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004141#line 1305 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00004142 { (yyval.Attributes) = Attribute::ReadOnly; ;}
4143 break;
4144
Chris Lattner740e7092008-10-15 06:16:57 +00004145 case 125:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004146#line 1306 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner9fc4da42008-10-08 06:44:45 +00004147 { (yyval.Attributes) = Attribute::NoInline; ;}
Devang Patel652203f2008-09-29 20:49:50 +00004148 break;
4149
Chris Lattner740e7092008-10-15 06:16:57 +00004150 case 126:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004151#line 1307 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner9fc4da42008-10-08 06:44:45 +00004152 { (yyval.Attributes) = Attribute::AlwaysInline; ;}
Devang Patel652203f2008-09-29 20:49:50 +00004153 break;
4154
Chris Lattner740e7092008-10-15 06:16:57 +00004155 case 127:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004156#line 1308 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner9fc4da42008-10-08 06:44:45 +00004157 { (yyval.Attributes) = Attribute::OptimizeForSize; ;}
Devang Patel652203f2008-09-29 20:49:50 +00004158 break;
4159
Chris Lattner740e7092008-10-15 06:16:57 +00004160 case 128:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004161#line 1309 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
4162 { (yyval.Attributes) = Attribute::StackProtect; ;}
Devang Patel652203f2008-09-29 20:49:50 +00004163 break;
4164
Chris Lattner740e7092008-10-15 06:16:57 +00004165 case 129:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004166#line 1310 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
4167 { (yyval.Attributes) = Attribute::StackProtectReq; ;}
4168 break;
4169
4170 case 130:
4171#line 1313 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
4172 { (yyval.Attributes) = Attribute::None; ;}
4173 break;
4174
4175 case 131:
4176#line 1314 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004177 {
Devang Patel05988662008-09-25 21:00:45 +00004178 (yyval.Attributes) = (yyvsp[(1) - (2)].Attributes) | (yyvsp[(2) - (2)].Attributes);
Chris Lattner15bd0952008-08-29 17:20:18 +00004179 ;}
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004180 break;
4181
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004182 case 132:
4183#line 1320 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Devang Pateld4980812008-09-02 20:52:40 +00004184 { (yyval.StrVal) = 0; ;}
4185 break;
4186
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004187 case 133:
4188#line 1321 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004189 {
4190 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
4191 ;}
4192 break;
4193
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004194 case 134:
4195#line 1328 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004196 { (yyval.UIntVal) = 0; ;}
4197 break;
4198
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004199 case 135:
4200#line 1329 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004201 {
4202 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
4203 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004204 GEN_ERROR("Alignment must be a power of two");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004205 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004206;}
4207 break;
4208
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004209 case 136:
4210#line 1335 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004211 { (yyval.UIntVal) = 0; ;}
4212 break;
4213
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004214 case 137:
4215#line 1336 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004216 {
4217 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
4218 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Christopher Lambbf3348d2007-12-12 08:45:45 +00004219 GEN_ERROR("Alignment must be a power of two");
4220 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004221;}
4222 break;
4223
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004224 case 138:
4225#line 1345 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004226 {
4227 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
4228 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004229 GEN_ERROR("Invalid character in section name");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004230 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004231 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004232;}
4233 break;
4234
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004235 case 139:
4236#line 1353 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004237 { (yyval.StrVal) = 0; ;}
4238 break;
4239
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004240 case 140:
4241#line 1354 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004242 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
4243 break;
4244
Nuno Lopes19830332008-11-04 14:28:33 +00004245 case 141:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004246#line 1359 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
4247 {;}
4248 break;
4249
4250 case 142:
4251#line 1360 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
4252 {;}
4253 break;
4254
4255 case 143:
4256#line 1361 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004257 {
4258 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
4259 delete (yyvsp[(1) - (1)].StrVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004260 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004261 ;}
4262 break;
4263
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004264 case 144:
4265#line 1366 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004266 {
4267 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004268 GEN_ERROR("Alignment must be a power of two");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004269 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004270 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004271 ;}
4272 break;
4273
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004274 case 152:
4275#line 1382 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004276 {
4277 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004278 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004279 ;}
4280 break;
4281
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004282 case 153:
4283#line 1386 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004284 {
4285 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004286 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004287 ;}
4288 break;
4289
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004290 case 154:
4291#line 1390 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004292 { // Pointer type?
4293 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
Christopher Lambbf3348d2007-12-12 08:45:45 +00004294 GEN_ERROR("Cannot form a pointer to a basic block");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004295 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4296 delete (yyvsp[(1) - (3)].TypeVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00004297 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004298 ;}
4299 break;
4300
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004301 case 155:
4302#line 1397 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004303 { // Named types are also simple types...
4304 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00004305 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004306 (yyval.TypeVal) = new PATypeHolder(tmp);
4307 ;}
4308 break;
4309
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004310 case 156:
4311#line 1402 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004312 { // Type UpReference
4313 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004314 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Dan Gohmanf4423b12008-04-19 00:24:39 +00004315 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4316 (yyval.TypeVal) = new PATypeHolder(OT);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004317 UR_OUT("New Upreference!\n");
4318 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004319 ;}
4320 break;
4321
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004322 case 157:
4323#line 1410 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004324 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004325 // Allow but ignore attributes on function types; this permits auto-upgrade.
4326 // FIXME: remove in LLVM 3.0.
Chris Lattnera925a142008-04-23 05:37:08 +00004327 const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal);
4328 if (!FunctionType::isValidReturnType(RetTy))
4329 GEN_ERROR("Invalid result type for LLVM function");
Eric Christopher2a5196f2008-09-24 04:55:49 +00004330
Reid Spencer41dff5e2007-01-26 08:05:27 +00004331 std::vector<const Type*> Params;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004332 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00004333 for (; I != E; ++I ) {
Reid Spencer66728ef2007-03-20 01:13:36 +00004334 const Type *Ty = I->Ty->get();
Reid Spencer66728ef2007-03-20 01:13:36 +00004335 Params.push_back(Ty);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004336 }
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004337
Reid Spencer41dff5e2007-01-26 08:05:27 +00004338 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4339 if (isVarArg) Params.pop_back();
4340
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004341 for (unsigned i = 0; i != Params.size(); ++i)
4342 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4343 GEN_ERROR("Function arguments must be value types!");
4344
4345 CHECK_FOR_ERROR
4346
Anton Korobeynikovc36284e2007-12-03 19:17:47 +00004347 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004348 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
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 Spencere4d87aa2006-12-23 06:05:41 +00004357 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004358 ;}
4359 break;
4360
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004361 case 158:
4362#line 1445 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004363 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004364 // Allow but ignore attributes on function types; this permits auto-upgrade.
4365 // FIXME: remove in LLVM 3.0.
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004366 std::vector<const Type*> Params;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004367 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00004368 for ( ; I != E; ++I ) {
Reid Spencer66728ef2007-03-20 01:13:36 +00004369 const Type* Ty = I->Ty->get();
Reid Spencer66728ef2007-03-20 01:13:36 +00004370 Params.push_back(Ty);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004371 }
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004372
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004373 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4374 if (isVarArg) Params.pop_back();
4375
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004376 for (unsigned i = 0; i != Params.size(); ++i)
4377 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4378 GEN_ERROR("Function arguments must be value types!");
4379
4380 CHECK_FOR_ERROR
4381
Dan Gohmanf4423b12008-04-19 00:24:39 +00004382 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
Eric Christopher2a5196f2008-09-24 04:55:49 +00004383 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Nuno Lopes8a88a372008-10-05 16:49:34 +00004384
4385 // Delete the argument list
4386 for (I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin() ; I != E; ++I ) {
4387 delete I->Ty;
4388 }
4389 delete (yyvsp[(3) - (5)].TypeWithAttrsList);
4390
Reid Spencer41dff5e2007-01-26 08:05:27 +00004391 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004392 ;}
4393 break;
4394
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004395 case 159:
4396#line 1476 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004397 { // Sized array type?
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004398 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (yyvsp[(2) - (5)].UInt64Val))));
Dan Gohmanf4423b12008-04-19 00:24:39 +00004399 delete (yyvsp[(4) - (5)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004400 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004401 ;}
4402 break;
4403
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004404 case 160:
4405#line 1481 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004406 { // Vector type?
4407 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4408 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004409 GEN_ERROR("Unsigned result not equal to signed result");
4410 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4411 GEN_ERROR("Element type of a VectorType must be primitive");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004412 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4413 delete (yyvsp[(4) - (5)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004414 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004415 ;}
4416 break;
4417
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004418 case 161:
4419#line 1491 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004420 { // Structure type?
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004421 std::vector<const Type*> Elements;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004422 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4423 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004424 Elements.push_back(*I);
4425
Dan Gohmanf4423b12008-04-19 00:24:39 +00004426 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4427 delete (yyvsp[(2) - (3)].TypeList);
Reid Spencer14310612006-12-31 05:40:51 +00004428 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004429 ;}
4430 break;
4431
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004432 case 162:
4433#line 1501 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004434 { // Empty structure type?
4435 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Reid Spencer14310612006-12-31 05:40:51 +00004436 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004437 ;}
4438 break;
4439
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004440 case 163:
4441#line 1505 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004442 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004443 std::vector<const Type*> Elements;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004444 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4445 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004446 Elements.push_back(*I);
4447
Dan Gohmanf4423b12008-04-19 00:24:39 +00004448 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4449 delete (yyvsp[(3) - (5)].TypeList);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004450 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004451 ;}
4452 break;
4453
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004454 case 164:
4455#line 1515 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004456 { // Empty structure type?
4457 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004458 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004459 ;}
4460 break;
4461
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004462 case 165:
4463#line 1522 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004464 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004465 // Allow but ignore attributes on function types; this permits auto-upgrade.
4466 // FIXME: remove in LLVM 3.0.
Eric Christopher2a5196f2008-09-24 04:55:49 +00004467 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
Devang Patel05988662008-09-25 21:00:45 +00004468 (yyval.TypeWithAttrs).Attrs = Attribute::None;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004469 ;}
4470 break;
4471
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004472 case 166:
4473#line 1531 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004474 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004475 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004476 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4477 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004478 GEN_ERROR("LLVM functions cannot return aggregate types");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004479 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4480 ;}
4481 break;
4482
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004483 case 167:
4484#line 1538 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004485 {
4486 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4487 ;}
4488 break;
4489
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004490 case 168:
4491#line 1543 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004492 {
4493 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4494 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
Reid Spencer3da59db2006-11-27 01:05:10 +00004495 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004496 ;}
4497 break;
4498
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004499 case 169:
4500#line 1548 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004501 {
4502 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004503 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004504 ;}
4505 break;
4506
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004507 case 171:
4508#line 1556 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004509 {
4510 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
Devang Patel05988662008-09-25 21:00:45 +00004511 TypeWithAttrs TWA; TWA.Attrs = Attribute::None;
Reid Spencer41dff5e2007-01-26 08:05:27 +00004512 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004513 (yyval.TypeWithAttrsList)->push_back(TWA);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004514 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004515 ;}
4516 break;
4517
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004518 case 172:
4519#line 1563 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004520 {
4521 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
Devang Patel05988662008-09-25 21:00:45 +00004522 TypeWithAttrs TWA; TWA.Attrs = Attribute::None;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004523 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004524 (yyval.TypeWithAttrsList)->push_back(TWA);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004525 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004526 ;}
4527 break;
4528
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004529 case 173:
4530#line 1570 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004531 {
4532 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004533 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004534 ;}
4535 break;
4536
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004537 case 174:
4538#line 1578 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004539 {
4540 (yyval.TypeList) = new std::list<PATypeHolder>();
Eric Christopher2a5196f2008-09-24 04:55:49 +00004541 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
Dan Gohmanf4423b12008-04-19 00:24:39 +00004542 delete (yyvsp[(1) - (1)].TypeVal);
Reid Spencer3da59db2006-11-27 01:05:10 +00004543 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004544 ;}
4545 break;
4546
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004547 case 175:
4548#line 1584 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004549 {
Eric Christopher2a5196f2008-09-24 04:55:49 +00004550 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
Dan Gohmanf4423b12008-04-19 00:24:39 +00004551 delete (yyvsp[(3) - (3)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004552 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004553 ;}
4554 break;
4555
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004556 case 176:
4557#line 1596 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004558 { // Nonempty unsized arr
Reid Spencer14310612006-12-31 05:40:51 +00004559 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004560 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4561 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004562 if (ATy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004563 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004564 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004565 const Type *ETy = ATy->getElementType();
Dan Gohman180c1692008-06-23 18:43:26 +00004566 uint64_t NumElements = ATy->getNumElements();
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004567
4568 // Verify that we have the correct size...
Mon P Wang28873102008-06-25 08:15:39 +00004569 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (4)].ConstVector)->size())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004570 GEN_ERROR("Type mismatch: constant sized array initialized with " +
Eric Christopher2a5196f2008-09-24 04:55:49 +00004571 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Mon P Wang28873102008-06-25 08:15:39 +00004572 utostr(NumElements) + "");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004573
4574 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004575 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4576 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Eric Christopher2a5196f2008-09-24 04:55:49 +00004577 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004578 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohmanf4423b12008-04-19 00:24:39 +00004579 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004580 }
4581
Dan Gohmanf4423b12008-04-19 00:24:39 +00004582 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4583 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004584 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004585 ;}
4586 break;
4587
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004588 case 177:
4589#line 1624 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004590 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004591 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004592 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4593 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004594 if (ATy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004595 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004596 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004597
Dan Gohman180c1692008-06-23 18:43:26 +00004598 uint64_t NumElements = ATy->getNumElements();
Eric Christopher2a5196f2008-09-24 04:55:49 +00004599 if (NumElements != uint64_t(-1) && NumElements != 0)
Andrew Lenharth6353e052006-12-08 18:07:09 +00004600 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
Mon P Wang28873102008-06-25 08:15:39 +00004601 " arguments, but has size of " + utostr(NumElements) +"");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004602 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4603 delete (yyvsp[(1) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00004604 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004605 ;}
4606 break;
4607
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004608 case 178:
4609#line 1640 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004610 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004611 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004612 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4613 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004614 if (ATy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004615 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004616 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004617
Dan Gohman180c1692008-06-23 18:43:26 +00004618 uint64_t NumElements = ATy->getNumElements();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004619 const Type *ETy = ATy->getElementType();
Mon P Wang28873102008-06-25 08:15:39 +00004620 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (3)].StrVal)->length())
Eric Christopher2a5196f2008-09-24 04:55:49 +00004621 GEN_ERROR("Can't build string constant of size " +
Mon P Wang28873102008-06-25 08:15:39 +00004622 utostr((yyvsp[(3) - (3)].StrVal)->length()) +
4623 " when array has size " + utostr(NumElements) + "");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004624 std::vector<Constant*> Vals;
4625 if (ETy == Type::Int8Ty) {
Mon P Wang28873102008-06-25 08:15:39 +00004626 for (uint64_t i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
Dan Gohmanf4423b12008-04-19 00:24:39 +00004627 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004628 } else {
Dan Gohmanf4423b12008-04-19 00:24:39 +00004629 delete (yyvsp[(3) - (3)].StrVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004630 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4631 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004632 delete (yyvsp[(3) - (3)].StrVal);
4633 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4634 delete (yyvsp[(1) - (3)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004635 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004636 ;}
4637 break;
4638
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004639 case 179:
4640#line 1667 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004641 { // Nonempty unsized arr
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004642 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004643 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4644 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004645 if (PTy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004646 GEN_ERROR("Cannot make packed constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004647 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004648 const Type *ETy = PTy->getElementType();
Dan Gohman180c1692008-06-23 18:43:26 +00004649 unsigned NumElements = PTy->getNumElements();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004650
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004651 // Verify that we have the correct size...
Mon P Wang28873102008-06-25 08:15:39 +00004652 if (NumElements != unsigned(-1) && NumElements != (unsigned)(yyvsp[(3) - (4)].ConstVector)->size())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004653 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
Eric Christopher2a5196f2008-09-24 04:55:49 +00004654 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Mon P Wang28873102008-06-25 08:15:39 +00004655 utostr(NumElements) + "");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004656
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004657 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004658 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4659 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Eric Christopher2a5196f2008-09-24 04:55:49 +00004660 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004661 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohmanf4423b12008-04-19 00:24:39 +00004662 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004663 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00004664
Dan Gohmanf4423b12008-04-19 00:24:39 +00004665 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4666 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004667 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004668 ;}
4669 break;
4670
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004671 case 180:
4672#line 1695 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004673 {
4674 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004675 if (STy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004676 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004677 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004678
Dan Gohmanf4423b12008-04-19 00:24:39 +00004679 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004680 GEN_ERROR("Illegal number of initializers for structure type");
4681
4682 // Check to ensure that constants are compatible with the type initializer!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004683 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4684 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004685 GEN_ERROR("Expected type '" +
4686 STy->getElementType(i)->getDescription() +
4687 "' for element #" + utostr(i) +
4688 " of structure initializer");
4689
4690 // Check to ensure that Type is not packed
4691 if (STy->isPacked())
4692 GEN_ERROR("Unpacked Initializer to vector type '" +
4693 STy->getDescription() + "'");
4694
Dan Gohmanf4423b12008-04-19 00:24:39 +00004695 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4696 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004697 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004698 ;}
4699 break;
4700
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004701 case 181:
4702#line 1721 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004703 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004704 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004705 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4706 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004707 if (STy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004708 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004709 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004710
4711 if (STy->getNumContainedTypes() != 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00004712 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004713
4714 // Check to ensure that Type is not packed
4715 if (STy->isPacked())
Chris Lattner6cdc6822007-04-26 05:31:05 +00004716 GEN_ERROR("Unpacked Initializer to vector type '" +
4717 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004718
Dan Gohmanf4423b12008-04-19 00:24:39 +00004719 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4720 delete (yyvsp[(1) - (3)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004721 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004722 ;}
4723 break;
4724
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004725 case 182:
4726#line 1741 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004727 {
4728 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004729 if (STy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004730 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004731 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004732
Dan Gohmanf4423b12008-04-19 00:24:39 +00004733 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
Reid Spencerb5334b02007-02-05 10:18:06 +00004734 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004735
4736 // Check to ensure that constants are compatible with the type initializer!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004737 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4738 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
Reid Spencer41dff5e2007-01-26 08:05:27 +00004739 GEN_ERROR("Expected type '" +
4740 STy->getElementType(i)->getDescription() +
4741 "' for element #" + utostr(i) +
Reid Spencerb5334b02007-02-05 10:18:06 +00004742 " of structure initializer");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004743
4744 // Check to ensure that Type is packed
4745 if (!STy->isPacked())
Eric Christopher2a5196f2008-09-24 04:55:49 +00004746 GEN_ERROR("Vector initializer to non-vector type '" +
Chris Lattner32980692007-02-19 07:44:24 +00004747 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004748
Dan Gohmanf4423b12008-04-19 00:24:39 +00004749 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4750 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004751 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004752 ;}
4753 break;
4754
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004755 case 183:
4756#line 1767 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004757 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004758 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004759 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4760 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004761 if (STy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004762 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004763 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004764
4765 if (STy->getNumContainedTypes() != 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00004766 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004767
4768 // Check to ensure that Type is packed
4769 if (!STy->isPacked())
Eric Christopher2a5196f2008-09-24 04:55:49 +00004770 GEN_ERROR("Vector initializer to non-vector type '" +
Chris Lattner32980692007-02-19 07:44:24 +00004771 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004772
Dan Gohmanf4423b12008-04-19 00:24:39 +00004773 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4774 delete (yyvsp[(1) - (5)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004775 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004776 ;}
4777 break;
4778
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004779 case 184:
4780#line 1787 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004781 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004782 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004783 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4784 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004785 if (PTy == 0)
Eric Christopher2a5196f2008-09-24 04:55:49 +00004786 GEN_ERROR("Cannot make null pointer constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004787 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004788
Dan Gohmanf4423b12008-04-19 00:24:39 +00004789 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4790 delete (yyvsp[(1) - (2)].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004791 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004792 ;}
4793 break;
4794
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004795 case 185:
4796#line 1799 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004797 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004798 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004799 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4800 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4801 delete (yyvsp[(1) - (2)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004802 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004803 ;}
4804 break;
4805
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004806 case 186:
4807#line 1806 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004808 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004809 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004810 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4811 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004812 if (Ty == 0)
Dan Gohmanf4423b12008-04-19 00:24:39 +00004813 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004814
4815 // ConstExprs can exist in the body of a function, thus creating
4816 // GlobalValues whenever they refer to a variable. Because we are in
Reid Spencer93c40032007-03-19 18:40:50 +00004817 // the context of a function, getExistingVal will search the functions
Reid Spencer68a24bd2005-08-27 18:50:39 +00004818 // symbol table instead of the module symbol table for the global symbol,
4819 // which throws things all off. To get around this, we just tell
Reid Spencer93c40032007-03-19 18:40:50 +00004820 // getExistingVal that we are at global scope here.
Reid Spencer68a24bd2005-08-27 18:50:39 +00004821 //
4822 Function *SavedCurFn = CurFun.CurrentFunction;
4823 CurFun.CurrentFunction = 0;
4824
Dan Gohmanf4423b12008-04-19 00:24:39 +00004825 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00004826 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00004827
4828 CurFun.CurrentFunction = SavedCurFn;
4829
4830 // If this is an initializer for a constant pointer, which is referencing a
4831 // (currently) undefined variable, create a stub now that shall be replaced
4832 // in the future with the right type of variable.
4833 //
4834 if (V == 0) {
Reid Spencera9720f52007-02-05 17:04:00 +00004835 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004836 const PointerType *PT = cast<PointerType>(Ty);
4837
4838 // First check to see if the forward references value is already created!
4839 PerModuleInfo::GlobalRefsType::iterator I =
Dan Gohmanf4423b12008-04-19 00:24:39 +00004840 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
Eric Christopher2a5196f2008-09-24 04:55:49 +00004841
Reid Spencer68a24bd2005-08-27 18:50:39 +00004842 if (I != CurModule.GlobalRefs.end()) {
4843 V = I->second; // Placeholder already exists, use it...
Dan Gohmanf4423b12008-04-19 00:24:39 +00004844 (yyvsp[(2) - (2)].ValIDVal).destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +00004845 } else {
4846 std::string Name;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004847 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4848 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4849 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
Reid Spencer41dff5e2007-01-26 08:05:27 +00004850 GEN_ERROR("Invalid reference to global");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004851
4852 // Create the forward referenced global.
4853 GlobalValue *GV;
Eric Christopher2a5196f2008-09-24 04:55:49 +00004854 if (const FunctionType *FTy =
Reid Spencer68a24bd2005-08-27 18:50:39 +00004855 dyn_cast<FunctionType>(PT->getElementType())) {
Gabor Greife64d2482008-04-06 23:07:54 +00004856 GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
4857 CurModule.CurrentModule);
Reid Spencer68a24bd2005-08-27 18:50:39 +00004858 } else {
4859 GV = new GlobalVariable(PT->getElementType(), false,
Chris Lattner6cdc6822007-04-26 05:31:05 +00004860 GlobalValue::ExternalWeakLinkage, 0,
Reid Spencer68a24bd2005-08-27 18:50:39 +00004861 Name, CurModule.CurrentModule);
4862 }
4863
4864 // Keep track of the fact that we have a forward ref to recycle it
Dan Gohmanf4423b12008-04-19 00:24:39 +00004865 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004866 V = GV;
4867 }
4868 }
4869
Dan Gohmanf4423b12008-04-19 00:24:39 +00004870 (yyval.ConstVal) = cast<GlobalValue>(V);
4871 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
Reid Spencer61c83e02006-08-18 08:43:06 +00004872 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004873 ;}
4874 break;
4875
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004876 case 187:
4877#line 1872 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004878 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004879 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004880 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4881 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
Eric Christopher2a5196f2008-09-24 04:55:49 +00004882 GEN_ERROR("Mismatched types for constant expression: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004883 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4884 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4885 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004886 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004887 ;}
4888 break;
4889
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004890 case 188:
4891#line 1882 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004892 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004893 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004894 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4895 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004896 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4897 GEN_ERROR("Cannot create a null initialized value of this type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004898 (yyval.ConstVal) = Constant::getNullValue(Ty);
4899 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004900 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004901 ;}
4902 break;
4903
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004904 case 189:
4905#line 1892 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004906 { // integral constants
Chris Lattner740e7092008-10-15 06:16:57 +00004907 if (IntegerType *IT = dyn_cast<IntegerType>((yyvsp[(1) - (2)].TypeVal)->get())) {
4908 if (!ConstantInt::isValueValidForType(IT, (yyvsp[(2) - (2)].SInt64Val)))
4909 GEN_ERROR("Constant value doesn't fit in type");
4910 (yyval.ConstVal) = ConstantInt::get(IT, (yyvsp[(2) - (2)].SInt64Val), true);
4911 } else {
4912 GEN_ERROR("integer constant must have integer type");
4913 }
4914 delete (yyvsp[(1) - (2)].TypeVal);
4915 CHECK_FOR_ERROR
4916 ;}
4917 break;
4918
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004919 case 190:
4920#line 1903 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00004921 { // arbitrary precision integer constants
4922 if (IntegerType *IT = dyn_cast<IntegerType>((yyvsp[(1) - (2)].TypeVal)->get())) {
4923 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > IT->getBitWidth())
4924 GEN_ERROR("Constant value does not fit in type");
4925 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(IT->getBitWidth());
4926 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4927 } else {
4928 GEN_ERROR("integer constant must have integer type");
4929 }
4930 delete (yyvsp[(1) - (2)].TypeVal);
4931 delete (yyvsp[(2) - (2)].APIntVal);
4932 CHECK_FOR_ERROR
4933 ;}
4934 break;
4935
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004936 case 191:
4937#line 1916 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00004938 { // integral constants
4939 if (IntegerType *IT = dyn_cast<IntegerType>((yyvsp[(1) - (2)].TypeVal)->get())) {
4940 if (!ConstantInt::isValueValidForType(IT, (yyvsp[(2) - (2)].UInt64Val)))
4941 GEN_ERROR("Constant value doesn't fit in type");
4942 (yyval.ConstVal) = ConstantInt::get(IT, (yyvsp[(2) - (2)].UInt64Val), false);
4943 } else {
4944 GEN_ERROR("integer constant must have integer type");
4945 }
4946 delete (yyvsp[(1) - (2)].TypeVal);
4947 CHECK_FOR_ERROR
4948 ;}
4949 break;
4950
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004951 case 192:
4952#line 1927 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00004953 { // arbitrary precision integer constants
4954 if (IntegerType *IT = dyn_cast<IntegerType>((yyvsp[(1) - (2)].TypeVal)->get())) {
4955 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > IT->getBitWidth())
4956 GEN_ERROR("Constant value does not fit in type");
4957 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(IT->getBitWidth());
4958 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4959 } else {
4960 GEN_ERROR("integer constant must have integer type");
4961 }
4962
4963 delete (yyvsp[(2) - (2)].APIntVal);
4964 delete (yyvsp[(1) - (2)].TypeVal);
4965 CHECK_FOR_ERROR
4966 ;}
4967 break;
4968
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004969 case 193:
4970#line 1941 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00004971 { // Boolean constants
4972 if ((yyvsp[(1) - (2)].TypeVal)->get() != Type::Int1Ty)
4973 GEN_ERROR("Constant true must have type i1");
4974 (yyval.ConstVal) = ConstantInt::getTrue();
4975 delete (yyvsp[(1) - (2)].TypeVal);
4976 CHECK_FOR_ERROR
4977 ;}
4978 break;
4979
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004980 case 194:
4981#line 1948 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner740e7092008-10-15 06:16:57 +00004982 { // Boolean constants
4983 if ((yyvsp[(1) - (2)].TypeVal)->get() != Type::Int1Ty)
4984 GEN_ERROR("Constant false must have type i1");
4985 (yyval.ConstVal) = ConstantInt::getFalse();
4986 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer38c91a92007-02-28 02:24:54 +00004987 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004988 ;}
4989 break;
4990
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00004991 case 195:
4992#line 1955 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004993 { // Floating point constants
Chris Lattner740e7092008-10-15 06:16:57 +00004994 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].TypeVal)->get(), *(yyvsp[(2) - (2)].FPVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004995 GEN_ERROR("Floating point constant invalid for type");
Chris Lattner740e7092008-10-15 06:16:57 +00004996
Eric Christopher2a5196f2008-09-24 04:55:49 +00004997 // Lexer has no type info, so builds all float and double FP constants
Dale Johannesenc72cd7e2007-09-11 18:33:39 +00004998 // as double. Fix this here. Long double is done right.
Chris Lattner740e7092008-10-15 06:16:57 +00004999 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].TypeVal)->get()==Type::FloatTy) {
Dale Johannesen236bbd42008-10-09 23:01:34 +00005000 bool ignored;
5001 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven,
5002 &ignored);
5003 }
Chris Lattnerd8eb63f2008-04-20 00:41:19 +00005004 (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal));
Chris Lattner740e7092008-10-15 06:16:57 +00005005 delete (yyvsp[(1) - (2)].TypeVal);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005006 delete (yyvsp[(2) - (2)].FPVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005007 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005008 ;}
5009 break;
5010
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005011 case 196:
5012#line 1973 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005013 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005014 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005015 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
5016 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
5017 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
5018 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005019 GEN_ERROR("invalid cast opcode for cast from '" +
5020 Val->getType()->getDescription() + "' to '" +
Eric Christopher2a5196f2008-09-24 04:55:49 +00005021 DestTy->getDescription() + "'");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005022 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
5023 delete (yyvsp[(5) - (6)].TypeVal);
5024 ;}
5025 break;
5026
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005027 case 197:
5028#line 1985 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005029 {
5030 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
Reid Spencerb5334b02007-02-05 10:18:06 +00005031 GEN_ERROR("GetElementPtr requires a pointer operand");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005032
5033 const Type *IdxTy =
Dan Gohman041e2eb2008-05-15 19:50:34 +00005034 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005035 if (!IdxTy)
Reid Spencerb5334b02007-02-05 10:18:06 +00005036 GEN_ERROR("Index list invalid for constant getelementptr");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005037
Chris Lattnerf7469af2007-01-31 04:44:08 +00005038 SmallVector<Constant*, 8> IdxVec;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005039 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
5040 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005041 IdxVec.push_back(C);
5042 else
Reid Spencerb5334b02007-02-05 10:18:06 +00005043 GEN_ERROR("Indices to constant getelementptr must be constants");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005044
Dan Gohmanf4423b12008-04-19 00:24:39 +00005045 delete (yyvsp[(4) - (5)].ValueList);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005046
Dan Gohmanf4423b12008-04-19 00:24:39 +00005047 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
Andrew Lenharth6353e052006-12-08 18:07:09 +00005048 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005049 ;}
5050 break;
5051
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005052 case 198:
5053#line 2006 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005054 {
5055 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005056 GEN_ERROR("Select condition must be of boolean type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005057 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005058 GEN_ERROR("Select operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005059 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005060 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005061 ;}
5062 break;
5063
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005064 case 199:
5065#line 2014 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005066 {
5067 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005068 GEN_ERROR("Binary operator types must match");
5069 CHECK_FOR_ERROR;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005070 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
5071 ;}
5072 break;
5073
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005074 case 200:
5075#line 2020 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005076 {
5077 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005078 GEN_ERROR("Logical operator types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005079 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
Eric Christopher2a5196f2008-09-24 04:55:49 +00005080 if (!isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
Dan Gohmanf4423b12008-04-19 00:24:39 +00005081 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005082 GEN_ERROR("Logical operator requires integral operands");
5083 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00005084 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005085 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005086 ;}
5087 break;
5088
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005089 case 201:
5090#line 2031 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005091 {
5092 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005093 GEN_ERROR("icmp operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005094 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5095 ;}
5096 break;
5097
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005098 case 202:
5099#line 2036 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005100 {
5101 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005102 GEN_ERROR("fcmp operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005103 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5104 ;}
5105 break;
5106
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005107 case 203:
5108#line 2041 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00005109 {
5110 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5111 GEN_ERROR("vicmp operand types must match");
5112 (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5113 ;}
5114 break;
5115
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005116 case 204:
5117#line 2046 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00005118 {
5119 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5120 GEN_ERROR("vfcmp operand types must match");
5121 (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5122 ;}
5123 break;
5124
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005125 case 205:
5126#line 2051 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005127 {
5128 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005129 GEN_ERROR("Invalid extractelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005130 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00005131 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005132 ;}
5133 break;
5134
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005135 case 206:
5136#line 2057 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005137 {
5138 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005139 GEN_ERROR("Invalid insertelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005140 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00005141 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005142 ;}
5143 break;
5144
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005145 case 207:
5146#line 2063 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005147 {
5148 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005149 GEN_ERROR("Invalid shufflevector operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005150 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00005151 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005152 ;}
5153 break;
5154
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005155 case 208:
5156#line 2069 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005157 {
5158 if (!isa<StructType>((yyvsp[(3) - (5)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (5)].ConstVal)->getType()))
5159 GEN_ERROR("ExtractValue requires an aggregate operand");
5160
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005161 (yyval.ConstVal) = ConstantExpr::getExtractValue((yyvsp[(3) - (5)].ConstVal), &(*(yyvsp[(4) - (5)].ConstantList))[0], (yyvsp[(4) - (5)].ConstantList)->size());
5162 delete (yyvsp[(4) - (5)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00005163 CHECK_FOR_ERROR
5164 ;}
5165 break;
5166
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005167 case 209:
5168#line 2077 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005169 {
5170 if (!isa<StructType>((yyvsp[(3) - (7)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (7)].ConstVal)->getType()))
5171 GEN_ERROR("InsertValue requires an aggregate operand");
5172
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005173 (yyval.ConstVal) = ConstantExpr::getInsertValue((yyvsp[(3) - (7)].ConstVal), (yyvsp[(5) - (7)].ConstVal), &(*(yyvsp[(6) - (7)].ConstantList))[0], (yyvsp[(6) - (7)].ConstantList)->size());
5174 delete (yyvsp[(6) - (7)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00005175 CHECK_FOR_ERROR
5176 ;}
5177 break;
5178
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005179 case 210:
5180#line 2088 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005181 {
5182 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005183 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005184 ;}
5185 break;
5186
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005187 case 211:
5188#line 2092 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005189 {
5190 (yyval.ConstVector) = new std::vector<Constant*>();
5191 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005192 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005193 ;}
5194 break;
5195
Chris Lattner740e7092008-10-15 06:16:57 +00005196 case 212:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005197#line 2100 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
5198 { (yyval.BoolVal) = false; ;}
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005199 break;
5200
Chris Lattner740e7092008-10-15 06:16:57 +00005201 case 213:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005202#line 2100 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
5203 { (yyval.BoolVal) = true; ;}
Devang Patel652203f2008-09-29 20:49:50 +00005204 break;
5205
Chris Lattner740e7092008-10-15 06:16:57 +00005206 case 214:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005207#line 2103 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
5208 { (yyval.BoolVal) = true; ;}
5209 break;
5210
5211 case 215:
5212#line 2103 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
5213 { (yyval.BoolVal) = false; ;}
5214 break;
5215
5216 case 216:
5217#line 2106 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005218 {
5219 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
5220 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
Chris Lattner0275cff2007-08-06 21:00:46 +00005221 CHECK_FOR_ERROR
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005222 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
5223 if (!Aliasee)
5224 GEN_ERROR("Aliases can be created only to global values");
5225
Dan Gohmanf4423b12008-04-19 00:24:39 +00005226 (yyval.ConstVal) = Aliasee;
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005227 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005228 delete (yyvsp[(1) - (2)].TypeVal);
5229 ;}
5230 break;
5231
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005232 case 217:
5233#line 2118 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005234 {
5235 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
5236 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
5237 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005238 GEN_ERROR("invalid cast opcode for cast from '" +
5239 Val->getType()->getDescription() + "' to '" +
5240 DestTy->getDescription() + "'");
Eric Christopher2a5196f2008-09-24 04:55:49 +00005241
Dan Gohmanf4423b12008-04-19 00:24:39 +00005242 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005243 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005244 delete (yyvsp[(5) - (6)].TypeVal);
5245 ;}
5246 break;
5247
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005248 case 218:
5249#line 2139 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattnerf9078f92008-10-15 06:03:48 +00005250 {
5251 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5252 CurModule.ModuleDone();
5253 CHECK_FOR_ERROR;
5254 ;}
5255 break;
5256
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005257 case 219:
5258#line 2144 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00005259 {
5260 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5261 CurModule.ModuleDone();
5262 CHECK_FOR_ERROR;
5263 ;}
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005264 break;
5265
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005266 case 222:
5267#line 2157 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Devang Patel652203f2008-09-29 20:49:50 +00005268 { CurFun.isDeclare = false; ;}
5269 break;
5270
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005271 case 223:
5272#line 2157 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005273 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005274 CurFun.FunctionDone();
5275 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005276 ;}
5277 break;
5278
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005279 case 224:
5280#line 2161 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005281 { CurFun.isDeclare = true; ;}
5282 break;
5283
Chris Lattner740e7092008-10-15 06:16:57 +00005284 case 225:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005285#line 2161 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
5286 {
5287 CHECK_FOR_ERROR
5288 ;}
5289 break;
5290
5291 case 226:
5292#line 2164 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
5293 {
5294 CHECK_FOR_ERROR
5295 ;}
5296 break;
5297
5298 case 227:
5299#line 2167 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005300 {
Reid Spencer14310612006-12-31 05:40:51 +00005301 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005302 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005303 // Eagerly resolve types. This is not an optimization, this is a
5304 // requirement that is due to the fact that we could have this:
5305 //
5306 // %list = type { %list * }
5307 // %list = type { %list * } ; repeated type decl
5308 //
5309 // If types are not resolved eagerly, then the two types will not be
5310 // determined to be the same type!
5311 //
Dan Gohmanf4423b12008-04-19 00:24:39 +00005312 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005313
Dan Gohmanf4423b12008-04-19 00:24:39 +00005314 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Reid Spencer5b7e7532006-09-28 19:28:24 +00005315 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005316 // If this is a named type that is not a redefinition, add it to the slot
5317 // table.
Dan Gohmanf4423b12008-04-19 00:24:39 +00005318 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005319 }
Reid Spencera132e042006-12-03 05:46:11 +00005320
Dan Gohmanf4423b12008-04-19 00:24:39 +00005321 delete (yyvsp[(3) - (3)].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005322 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005323 ;}
5324 break;
Reid Spencerb8f85052007-07-31 03:50:36 +00005325
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005326 case 228:
5327#line 2191 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005328 {
5329 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
5330
5331 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005332 CHECK_FOR_ERROR
5333 // If this is a named type that is not a redefinition, add it to the slot
5334 // table.
Dan Gohmanf4423b12008-04-19 00:24:39 +00005335 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005336 }
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005337 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005338 ;}
5339 break;
5340
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005341 case 229:
5342#line 2203 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Eric Christopher2a5196f2008-09-24 04:55:49 +00005343 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005344 /* "Externally Visible" Linkage */
Eric Christopher2a5196f2008-09-24 04:55:49 +00005345 if ((yyvsp[(5) - (6)].ConstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005346 GEN_ERROR("Global value initializer is not a constant");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005347 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5348 (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 +00005349 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005350 ;}
5351 break;
5352
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005353 case 230:
5354#line 2210 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005355 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005356 CurGV = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005357 ;}
5358 break;
5359
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005360 case 231:
5361#line 2214 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005362 {
Eric Christopher2a5196f2008-09-24 04:55:49 +00005363 if ((yyvsp[(6) - (7)].ConstVal) == 0)
Christopher Lambbf3348d2007-12-12 08:45:45 +00005364 GEN_ERROR("Global value initializer is not a constant");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005365 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 +00005366 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005367 ;}
5368 break;
5369
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005370 case 232:
5371#line 2219 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005372 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005373 CurGV = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005374 ;}
5375 break;
5376
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005377 case 233:
5378#line 2223 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005379 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005380 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005381 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5382 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 +00005383 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005384 delete (yyvsp[(6) - (7)].TypeVal);
5385 ;}
5386 break;
5387
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005388 case 234:
5389#line 2229 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005390 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005391 CurGV = 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +00005392 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005393 ;}
5394 break;
5395
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005396 case 235:
5397#line 2233 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005398 {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005399 std::string Name;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005400 if ((yyvsp[(1) - (5)].StrVal)) {
5401 Name = *(yyvsp[(1) - (5)].StrVal);
5402 delete (yyvsp[(1) - (5)].StrVal);
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005403 }
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005404 if (Name.empty())
5405 GEN_ERROR("Alias name cannot be empty");
Eric Christopher2a5196f2008-09-24 04:55:49 +00005406
Dan Gohmanf4423b12008-04-19 00:24:39 +00005407 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005408 if (Aliasee == 0)
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005409 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005410
Dan Gohmanf4423b12008-04-19 00:24:39 +00005411 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005412 CurModule.CurrentModule);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005413 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005414 InsertValue(GA, CurModule.Values);
Eric Christopher2a5196f2008-09-24 04:55:49 +00005415
5416
Chris Lattner569f7372007-09-10 23:24:14 +00005417 // If there was a forward reference of this alias, resolve it now.
Eric Christopher2a5196f2008-09-24 04:55:49 +00005418
Chris Lattner569f7372007-09-10 23:24:14 +00005419 ValID ID;
5420 if (!Name.empty())
5421 ID = ValID::createGlobalName(Name);
5422 else
5423 ID = ValID::createGlobalID(CurModule.Values.size()-1);
Eric Christopher2a5196f2008-09-24 04:55:49 +00005424
Chris Lattner569f7372007-09-10 23:24:14 +00005425 if (GlobalValue *FWGV =
5426 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5427 // Replace uses of the fwdref with the actual alias.
5428 FWGV->replaceAllUsesWith(GA);
5429 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5430 GV->eraseFromParent();
5431 else
5432 cast<Function>(FWGV)->eraseFromParent();
5433 }
5434 ID.destroy();
Eric Christopher2a5196f2008-09-24 04:55:49 +00005435
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005436 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005437 ;}
5438 break;
5439
Chris Lattner740e7092008-10-15 06:16:57 +00005440 case 236:
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005441#line 2273 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
5442 {
5443 CHECK_FOR_ERROR
5444 ;}
5445 break;
5446
5447 case 237:
5448#line 2276 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
5449 {
5450 CHECK_FOR_ERROR
5451 ;}
5452 break;
5453
5454 case 238:
5455#line 2282 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005456 {
Chris Lattner66316012006-01-24 04:14:29 +00005457 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
Chris Lattner66316012006-01-24 04:14:29 +00005458 if (AsmSoFar.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005459 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
Chris Lattner66316012006-01-24 04:14:29 +00005460 else
Dan Gohmanf4423b12008-04-19 00:24:39 +00005461 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5462 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00005463 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005464;}
5465 break;
5466
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005467 case 239:
5468#line 2292 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005469 {
5470 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5471 delete (yyvsp[(3) - (3)].StrVal);
5472 ;}
5473 break;
5474
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005475 case 240:
5476#line 2296 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005477 {
5478 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5479 delete (yyvsp[(3) - (3)].StrVal);
5480 ;}
5481 break;
5482
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005483 case 242:
5484#line 2303 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005485 {
5486 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5487 delete (yyvsp[(3) - (3)].StrVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00005488 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005489 ;}
5490 break;
5491
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005492 case 243:
5493#line 2308 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005494 {
5495 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5496 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer1013b4d2007-07-31 14:41:17 +00005497 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005498 ;}
5499 break;
5500
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005501 case 244:
5502#line 2313 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005503 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005504 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005505 ;}
5506 break;
5507
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005508 case 245:
5509#line 2322 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005510 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005511 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005512 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005513 if (!(*(yyvsp[(3) - (5)].TypeVal))->isFirstClassType())
5514 GEN_ERROR("Argument types must be first-class");
Devang Patel05988662008-09-25 21:00:45 +00005515 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 +00005516 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5517 (yyvsp[(1) - (5)].ArgList)->push_back(E);
Reid Spencer6f407902007-01-13 05:00:46 +00005518 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005519 ;}
5520 break;
5521
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005522 case 246:
5523#line 2332 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005524 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005525 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005526 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005527 if (!(*(yyvsp[(1) - (3)].TypeVal))->isFirstClassType())
5528 GEN_ERROR("Argument types must be first-class");
Devang Patel05988662008-09-25 21:00:45 +00005529 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 +00005530 (yyval.ArgList) = new ArgListType;
5531 (yyval.ArgList)->push_back(E);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005532 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005533 ;}
5534 break;
5535
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005536 case 247:
5537#line 2343 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005538 {
5539 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005540 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005541 ;}
5542 break;
5543
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005544 case 248:
5545#line 2347 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005546 {
5547 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005548 struct ArgListEntry E;
5549 E.Ty = new PATypeHolder(Type::VoidTy);
5550 E.Name = 0;
Devang Patel05988662008-09-25 21:00:45 +00005551 E.Attrs = Attribute::None;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005552 (yyval.ArgList)->push_back(E);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005553 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005554 ;}
5555 break;
5556
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005557 case 249:
5558#line 2356 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005559 {
5560 (yyval.ArgList) = new ArgListType;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005561 struct ArgListEntry E;
5562 E.Ty = new PATypeHolder(Type::VoidTy);
5563 E.Name = 0;
Devang Patel05988662008-09-25 21:00:45 +00005564 E.Attrs = Attribute::None;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005565 (yyval.ArgList)->push_back(E);
Reid Spencer61c83e02006-08-18 08:43:06 +00005566 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005567 ;}
5568 break;
5569
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005570 case 250:
5571#line 2365 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005572 {
5573 (yyval.ArgList) = 0;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005574 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005575 ;}
5576 break;
5577
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005578 case 251:
5579#line 2371 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005580 {
Devang Patel652203f2008-09-29 20:49:50 +00005581 std::string FunctionName(*(yyvsp[(4) - (11)].StrVal));
5582 delete (yyvsp[(4) - (11)].StrVal); // Free strdup'd memory!
Eric Christopher2a5196f2008-09-24 04:55:49 +00005583
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005584 // Check the function result for abstractness if this is a define. We should
5585 // have no abstract types at this point
Devang Patel652203f2008-09-29 20:49:50 +00005586 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(3) - (11)].TypeVal)))
5587 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(3) - (11)].TypeVal)->get()->getDescription());
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005588
Devang Patel652203f2008-09-29 20:49:50 +00005589 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (11)].TypeVal)))
Chris Lattnera925a142008-04-23 05:37:08 +00005590 GEN_ERROR("Invalid result type for LLVM function");
Eric Christopher2a5196f2008-09-24 04:55:49 +00005591
Reid Spencer68a24bd2005-08-27 18:50:39 +00005592 std::vector<const Type*> ParamTypeList;
Devang Patel05988662008-09-25 21:00:45 +00005593 SmallVector<AttributeWithIndex, 8> Attrs;
Dale Johannesene7261862008-09-26 23:46:20 +00005594 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
5595 //attributes.
Devang Patel652203f2008-09-29 20:49:50 +00005596 Attributes RetAttrs = (yyvsp[(2) - (11)].Attributes);
5597 if ((yyvsp[(8) - (11)].Attributes) != Attribute::None) {
5598 if ((yyvsp[(8) - (11)].Attributes) & Attribute::ZExt) {
Dale Johannesene7261862008-09-26 23:46:20 +00005599 RetAttrs = RetAttrs | Attribute::ZExt;
Devang Patel652203f2008-09-29 20:49:50 +00005600 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::ZExt;
Dale Johannesene7261862008-09-26 23:46:20 +00005601 }
Devang Patel652203f2008-09-29 20:49:50 +00005602 if ((yyvsp[(8) - (11)].Attributes) & Attribute::SExt) {
Dale Johannesene7261862008-09-26 23:46:20 +00005603 RetAttrs = RetAttrs | Attribute::SExt;
Devang Patel652203f2008-09-29 20:49:50 +00005604 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::SExt;
Dale Johannesene7261862008-09-26 23:46:20 +00005605 }
Devang Patel652203f2008-09-29 20:49:50 +00005606 if ((yyvsp[(8) - (11)].Attributes) & Attribute::InReg) {
Dale Johannesene7261862008-09-26 23:46:20 +00005607 RetAttrs = RetAttrs | Attribute::InReg;
Devang Patel652203f2008-09-29 20:49:50 +00005608 (yyvsp[(8) - (11)].Attributes) = (yyvsp[(8) - (11)].Attributes) ^ Attribute::InReg;
Dale Johannesene7261862008-09-26 23:46:20 +00005609 }
Dale Johannesene7261862008-09-26 23:46:20 +00005610 }
Devang Patel652203f2008-09-29 20:49:50 +00005611 if (RetAttrs != Attribute::None)
5612 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
5613 if ((yyvsp[(6) - (11)].ArgList)) { // If there are arguments...
Reid Spencer7b5d4662007-04-09 06:16:21 +00005614 unsigned index = 1;
Devang Patel652203f2008-09-29 20:49:50 +00005615 for (ArgListType::iterator I = (yyvsp[(6) - (11)].ArgList)->begin(); I != (yyvsp[(6) - (11)].ArgList)->end(); ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00005616 const Type* Ty = I->Ty->get();
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005617 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5618 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
Reid Spencer14310612006-12-31 05:40:51 +00005619 ParamTypeList.push_back(Ty);
Devang Patel05988662008-09-25 21:00:45 +00005620 if (Ty != Type::VoidTy && I->Attrs != Attribute::None)
5621 Attrs.push_back(AttributeWithIndex::get(index, I->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00005622 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005623 }
Devang Patel652203f2008-09-29 20:49:50 +00005624 if ((yyvsp[(8) - (11)].Attributes) != Attribute::None)
5625 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(8) - (11)].Attributes)));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005626
5627 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5628 if (isVarArg) ParamTypeList.pop_back();
5629
Devang Patel05988662008-09-25 21:00:45 +00005630 AttrListPtr PAL;
Christopher Lamb5c104242007-04-22 20:09:11 +00005631 if (!Attrs.empty())
Devang Patel05988662008-09-25 21:00:45 +00005632 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
Reid Spencer7b5d4662007-04-09 06:16:21 +00005633
Devang Patel652203f2008-09-29 20:49:50 +00005634 FunctionType *FT = FunctionType::get(*(yyvsp[(3) - (11)].TypeVal), ParamTypeList, isVarArg);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00005635 const PointerType *PFT = PointerType::getUnqual(FT);
Devang Patel652203f2008-09-29 20:49:50 +00005636 delete (yyvsp[(3) - (11)].TypeVal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005637
5638 ValID ID;
5639 if (!FunctionName.empty()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005640 ID = ValID::createGlobalName((char*)FunctionName.c_str());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005641 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00005642 ID = ValID::createGlobalID(CurModule.Values.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005643 }
5644
5645 Function *Fn = 0;
5646 // See if this function was forward referenced. If so, recycle the object.
5647 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
Eric Christopher2a5196f2008-09-24 04:55:49 +00005648 // Move the function to the end of the list, from whereever it was
Reid Spencer68a24bd2005-08-27 18:50:39 +00005649 // previously inserted.
5650 Fn = cast<Function>(FWRef);
Devang Patel05988662008-09-25 21:00:45 +00005651 assert(Fn->getAttributes().isEmpty() &&
Chris Lattner58d74912008-03-12 17:45:29 +00005652 "Forward reference has parameter attributes!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005653 CurModule.CurrentModule->getFunctionList().remove(Fn);
5654 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5655 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
Reid Spenceref9b9a72007-02-05 20:47:22 +00005656 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
Duncan Sandsdc024672007-11-27 13:23:08 +00005657 if (Fn->getFunctionType() != FT ) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00005658 // The existing function doesn't have the same type. This is an overload
5659 // error.
5660 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Devang Patel05988662008-09-25 21:00:45 +00005661 } else if (Fn->getAttributes() != PAL) {
Duncan Sandsdc024672007-11-27 13:23:08 +00005662 // The existing function doesn't have the same parameter attributes.
5663 // This is an overload error.
5664 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Reid Spenceref9b9a72007-02-05 20:47:22 +00005665 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
Chris Lattner6cdc6822007-04-26 05:31:05 +00005666 // Neither the existing or the current function is a declaration and they
5667 // have the same name and same type. Clearly this is a redefinition.
5668 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
Duncan Sandsdc024672007-11-27 13:23:08 +00005669 } else if (Fn->isDeclaration()) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00005670 // Make sure to strip off any argument names so we can't get conflicts.
Reid Spencer68a24bd2005-08-27 18:50:39 +00005671 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5672 AI != AE; ++AI)
5673 AI->setName("");
Reid Spenceref9b9a72007-02-05 20:47:22 +00005674 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005675 } else { // Not already defined?
Gabor Greife64d2482008-04-06 23:07:54 +00005676 Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5677 CurModule.CurrentModule);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005678 InsertValue(Fn, CurModule.Values);
5679 }
5680
Nuno Lopes9e9631d2008-10-03 15:45:58 +00005681 ID.destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +00005682 CurFun.FunctionStart(Fn);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00005683
5684 if (CurFun.isDeclare) {
5685 // If we have declaration, always overwrite linkage. This will allow us to
5686 // correctly handle cases, when pointer to function is passed as argument to
5687 // another function.
5688 Fn->setLinkage(CurFun.Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005689 Fn->setVisibility(CurFun.Visibility);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00005690 }
Devang Pateld4980812008-09-02 20:52:40 +00005691 Fn->setCallingConv((yyvsp[(1) - (11)].UIntVal));
Devang Patel05988662008-09-25 21:00:45 +00005692 Fn->setAttributes(PAL);
Devang Patel652203f2008-09-29 20:49:50 +00005693 Fn->setAlignment((yyvsp[(10) - (11)].UIntVal));
5694 if ((yyvsp[(9) - (11)].StrVal)) {
5695 Fn->setSection(*(yyvsp[(9) - (11)].StrVal));
5696 delete (yyvsp[(9) - (11)].StrVal);
Gordon Henriksen80a75bf2007-12-10 03:18:06 +00005697 }
Devang Patel652203f2008-09-29 20:49:50 +00005698 if ((yyvsp[(11) - (11)].StrVal)) {
5699 Fn->setGC((yyvsp[(11) - (11)].StrVal)->c_str());
5700 delete (yyvsp[(11) - (11)].StrVal);
Chris Lattnere869eef2005-11-12 00:11:49 +00005701 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005702
5703 // Add all of the arguments we parsed to the function...
Devang Patel652203f2008-09-29 20:49:50 +00005704 if ((yyvsp[(6) - (11)].ArgList)) { // Is null if empty...
Reid Spencer68a24bd2005-08-27 18:50:39 +00005705 if (isVarArg) { // Nuke the last entry
Devang Patel652203f2008-09-29 20:49:50 +00005706 assert((yyvsp[(6) - (11)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(6) - (11)].ArgList)->back().Name == 0 &&
Reid Spencera9720f52007-02-05 17:04:00 +00005707 "Not a varargs marker!");
Devang Patel652203f2008-09-29 20:49:50 +00005708 delete (yyvsp[(6) - (11)].ArgList)->back().Ty;
5709 (yyvsp[(6) - (11)].ArgList)->pop_back(); // Delete the last entry
Reid Spencer68a24bd2005-08-27 18:50:39 +00005710 }
5711 Function::arg_iterator ArgIt = Fn->arg_begin();
Reid Spenceref9b9a72007-02-05 20:47:22 +00005712 Function::arg_iterator ArgEnd = Fn->arg_end();
Reid Spencer14310612006-12-31 05:40:51 +00005713 unsigned Idx = 1;
Devang Patel652203f2008-09-29 20:49:50 +00005714 for (ArgListType::iterator I = (yyvsp[(6) - (11)].ArgList)->begin();
5715 I != (yyvsp[(6) - (11)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
Reid Spencer14310612006-12-31 05:40:51 +00005716 delete I->Ty; // Delete the typeholder...
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005717 setValueName(ArgIt, I->Name); // Insert arg into symtab...
Reid Spencer5b7e7532006-09-28 19:28:24 +00005718 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005719 InsertValue(ArgIt);
Reid Spencer14310612006-12-31 05:40:51 +00005720 Idx++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005721 }
Reid Spencera132e042006-12-03 05:46:11 +00005722
Devang Patel652203f2008-09-29 20:49:50 +00005723 delete (yyvsp[(6) - (11)].ArgList); // We're now done with the argument list
Reid Spencer68a24bd2005-08-27 18:50:39 +00005724 }
Reid Spencer61c83e02006-08-18 08:43:06 +00005725 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005726;}
5727 break;
5728
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005729 case 254:
5730#line 2521 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005731 {
5732 (yyval.FunctionVal) = CurFun.CurrentFunction;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005733
5734 // Make sure that we keep track of the linkage type even if there was a
5735 // previous "declare".
Dan Gohmanf4423b12008-04-19 00:24:39 +00005736 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5737 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5738;}
5739 break;
5740
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005741 case 257:
5742#line 2532 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005743 {
5744 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005745 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005746;}
5747 break;
5748
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005749 case 258:
5750#line 2537 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005751 {
5752 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5753 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5754 (yyval.FunctionVal) = CurFun.CurrentFunction;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005755 CurFun.FunctionDone();
Reid Spencer41dff5e2007-01-26 08:05:27 +00005756 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005757 ;}
5758 break;
5759
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005760 case 259:
5761#line 2549 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005762 {
5763 (yyval.BoolVal) = false;
Reid Spencer61c83e02006-08-18 08:43:06 +00005764 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005765 ;}
5766 break;
5767
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005768 case 260:
5769#line 2553 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005770 {
5771 (yyval.BoolVal) = true;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005772 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005773 ;}
5774 break;
5775
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005776 case 261:
5777#line 2558 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005778 { // A reference to a direct constant
5779 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005780 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005781 ;}
5782 break;
5783
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005784 case 262:
5785#line 2562 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005786 {
5787 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005788 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005789 ;}
5790 break;
5791
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005792 case 263:
5793#line 2566 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner1913b942008-07-11 00:30:39 +00005794 { // arbitrary precision integer constants
5795 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), true);
5796 delete (yyvsp[(1) - (1)].APIntVal);
5797 CHECK_FOR_ERROR
5798 ;}
5799 break;
5800
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005801 case 264:
5802#line 2571 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner1913b942008-07-11 00:30:39 +00005803 { // arbitrary precision integer constants
5804 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), false);
5805 delete (yyvsp[(1) - (1)].APIntVal);
5806 CHECK_FOR_ERROR
5807 ;}
5808 break;
5809
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005810 case 265:
5811#line 2576 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005812 { // Perhaps it's an FP constant?
5813 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00005814 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005815 ;}
5816 break;
5817
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005818 case 266:
5819#line 2580 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005820 {
5821 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
Reid Spencere4d87aa2006-12-23 06:05:41 +00005822 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005823 ;}
5824 break;
5825
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005826 case 267:
5827#line 2584 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005828 {
5829 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00005830 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005831 ;}
5832 break;
5833
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005834 case 268:
5835#line 2588 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005836 {
5837 (yyval.ValIDVal) = ValID::createNull();
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00005838 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005839 ;}
5840 break;
5841
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005842 case 269:
5843#line 2592 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005844 {
5845 (yyval.ValIDVal) = ValID::createUndef();
Reid Spencer61c83e02006-08-18 08:43:06 +00005846 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005847 ;}
5848 break;
5849
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005850 case 270:
5851#line 2596 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005852 { // A vector zero constant.
5853 (yyval.ValIDVal) = ValID::createZeroInit();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005854 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005855 ;}
5856 break;
5857
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005858 case 271:
5859#line 2600 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005860 { // Nonempty unsized packed vector
5861 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
Eric Christopher2a5196f2008-09-24 04:55:49 +00005862 unsigned NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005863
5864 if (!ETy->isInteger() && !ETy->isFloatingPoint())
5865 GEN_ERROR("Invalid vector element type: " + ETy->getDescription());
Eric Christopher2a5196f2008-09-24 04:55:49 +00005866
Reid Spencer9d6565a2007-02-15 02:26:10 +00005867 VectorType* pt = VectorType::get(ETy, NumElements);
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005868 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(pt));
Eric Christopher2a5196f2008-09-24 04:55:49 +00005869
Reid Spencer68a24bd2005-08-27 18:50:39 +00005870 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00005871 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5872 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Eric Christopher2a5196f2008-09-24 04:55:49 +00005873 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +00005874 ETy->getDescription() +"' as required!\nIt is of type '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00005875 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005876 }
5877
Dan Gohmanf4423b12008-04-19 00:24:39 +00005878 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5879 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
Reid Spencer832254e2007-02-02 02:16:23 +00005880 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005881 ;}
5882 break;
5883
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005884 case 272:
5885#line 2622 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005886 { // Nonempty unsized arr
5887 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
Eric Christopher2a5196f2008-09-24 04:55:49 +00005888 uint64_t NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005889
5890 if (!ETy->isFirstClassType())
5891 GEN_ERROR("Invalid array element type: " + ETy->getDescription());
5892
5893 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5894 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(ATy));
5895
5896 // Verify all elements are correct type!
5897 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5898 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Eric Christopher2a5196f2008-09-24 04:55:49 +00005899 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005900 ETy->getDescription() +"' as required!\nIt is of type '"+
5901 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5902 }
5903
5904 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, *(yyvsp[(2) - (3)].ConstVector)));
5905 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5906 CHECK_FOR_ERROR
5907 ;}
5908 break;
5909
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005910 case 273:
5911#line 2644 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005912 {
Dan Gohman180c1692008-06-23 18:43:26 +00005913 // Use undef instead of an array because it's inconvenient to determine
5914 // the element type at this point, there being no elements to examine.
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005915 (yyval.ValIDVal) = ValID::createUndef();
5916 CHECK_FOR_ERROR
5917 ;}
5918 break;
5919
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005920 case 274:
5921#line 2650 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005922 {
Dan Gohman180c1692008-06-23 18:43:26 +00005923 uint64_t NumElements = (yyvsp[(2) - (2)].StrVal)->length();
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005924 const Type *ETy = Type::Int8Ty;
5925
5926 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5927
5928 std::vector<Constant*> Vals;
5929 for (unsigned i = 0; i < (yyvsp[(2) - (2)].StrVal)->length(); ++i)
5930 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(2) - (2)].StrVal))[i]));
5931 delete (yyvsp[(2) - (2)].StrVal);
5932 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, Vals));
5933 CHECK_FOR_ERROR
5934 ;}
5935 break;
5936
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005937 case 275:
5938#line 2663 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005939 {
5940 std::vector<const Type*> Elements((yyvsp[(2) - (3)].ConstVector)->size());
5941 for (unsigned i = 0, e = (yyvsp[(2) - (3)].ConstVector)->size(); i != e; ++i)
5942 Elements[i] = (*(yyvsp[(2) - (3)].ConstVector))[i]->getType();
5943
5944 const StructType *STy = StructType::get(Elements);
5945 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5946
5947 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(2) - (3)].ConstVector)));
5948 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5949 CHECK_FOR_ERROR
5950 ;}
5951 break;
5952
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005953 case 276:
5954#line 2675 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005955 {
5956 const StructType *STy = StructType::get(std::vector<const Type*>());
5957 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5958 CHECK_FOR_ERROR
5959 ;}
5960 break;
5961
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005962 case 277:
5963#line 2680 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005964 {
5965 std::vector<const Type*> Elements((yyvsp[(3) - (5)].ConstVector)->size());
5966 for (unsigned i = 0, e = (yyvsp[(3) - (5)].ConstVector)->size(); i != e; ++i)
5967 Elements[i] = (*(yyvsp[(3) - (5)].ConstVector))[i]->getType();
5968
5969 const StructType *STy = StructType::get(Elements, /*isPacked=*/true);
5970 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5971
5972 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(3) - (5)].ConstVector)));
5973 delete PTy; delete (yyvsp[(3) - (5)].ConstVector);
5974 CHECK_FOR_ERROR
5975 ;}
5976 break;
5977
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005978 case 278:
5979#line 2692 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005980 {
5981 const StructType *STy = StructType::get(std::vector<const Type*>(),
5982 /*isPacked=*/true);
5983 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5984 CHECK_FOR_ERROR
5985 ;}
5986 break;
5987
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005988 case 279:
5989#line 2698 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005990 {
5991 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
Reid Spencer832254e2007-02-02 02:16:23 +00005992 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005993 ;}
5994 break;
5995
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00005996 case 280:
5997#line 2702 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005998 {
5999 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
6000 delete (yyvsp[(3) - (5)].StrVal);
6001 delete (yyvsp[(5) - (5)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00006002 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006003 ;}
6004 break;
6005
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006006 case 281:
6007#line 2712 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006008 { // Is it an integer reference...?
6009 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006010 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006011 ;}
6012 break;
6013
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006014 case 282:
6015#line 2716 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006016 {
6017 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
Reid Spencer832254e2007-02-02 02:16:23 +00006018 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006019 ;}
6020 break;
6021
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006022 case 283:
6023#line 2720 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006024 { // Is it a named reference...?
6025 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
6026 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00006027 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006028 ;}
6029 break;
6030
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006031 case 284:
6032#line 2725 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006033 { // Is it a named reference...?
6034 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
6035 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00006036 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006037 ;}
6038 break;
6039
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006040 case 287:
6041#line 2738 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006042 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006043 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006044 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Eric Christopher2a5196f2008-09-24 04:55:49 +00006045 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
Dan Gohmanf4423b12008-04-19 00:24:39 +00006046 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer832254e2007-02-02 02:16:23 +00006047 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006048 ;}
6049 break;
6050
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006051 case 288:
6052#line 2747 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006053 {
6054 (yyval.ValueList) = new std::vector<Value *>();
Eric Christopher2a5196f2008-09-24 04:55:49 +00006055 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
Devang Patel7990dc72008-02-20 22:40:23 +00006056 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006057 ;}
6058 break;
6059
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006060 case 289:
6061#line 2752 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006062 {
Eric Christopher2a5196f2008-09-24 04:55:49 +00006063 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
Devang Patel7990dc72008-02-20 22:40:23 +00006064 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006065 ;}
6066 break;
6067
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006068 case 290:
6069#line 2757 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006070 {
6071 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006072 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006073 ;}
6074 break;
6075
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006076 case 291:
6077#line 2761 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Eric Christopher2a5196f2008-09-24 04:55:49 +00006078 { // Do not allow functions with 0 basic blocks
Dan Gohmanf4423b12008-04-19 00:24:39 +00006079 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006080 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006081 ;}
6082 break;
6083
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006084 case 292:
6085#line 2770 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006086 {
6087 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006088 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006089 InsertValue((yyvsp[(3) - (3)].TermInstVal));
6090 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
6091 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006092 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006093 ;}
6094 break;
6095
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006096 case 293:
6097#line 2779 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00006098 {
6099 CHECK_FOR_ERROR
6100 int ValNum = InsertValue((yyvsp[(3) - (3)].TermInstVal));
6101 if (ValNum != (int)(yyvsp[(2) - (3)].UIntVal))
6102 GEN_ERROR("Result value number %" + utostr((yyvsp[(2) - (3)].UIntVal)) +
6103 " is incorrect, expected %" + utostr((unsigned)ValNum));
Eric Christopher2a5196f2008-09-24 04:55:49 +00006104
Chris Lattner15bd0952008-08-29 17:20:18 +00006105 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
6106 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
6107 CHECK_FOR_ERROR
6108;}
6109 break;
6110
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006111 case 294:
6112#line 2792 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006113 {
6114 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006115 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
6116 if (CI2->getParent() == 0)
Dan Gohmanf4423b12008-04-19 00:24:39 +00006117 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
6118 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
6119 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
Anton Korobeynikov38e09802007-04-28 13:48:45 +00006120 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006121 ;}
6122 break;
Chris Lattner38905612008-02-19 04:36:25 +00006123
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006124 case 295:
6125#line 2801 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006126 { // Empty space between instruction lists
Chris Lattnercc81d152008-05-04 17:18:47 +00006127 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
Dan Gohmanf4423b12008-04-19 00:24:39 +00006128 CHECK_FOR_ERROR
6129 ;}
6130 break;
6131
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006132 case 296:
6133#line 2805 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattnercc81d152008-05-04 17:18:47 +00006134 { // Labelled (named) basic block
6135 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
6136 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006137 CHECK_FOR_ERROR
Chris Lattnercc81d152008-05-04 17:18:47 +00006138
Dan Gohmanf4423b12008-04-19 00:24:39 +00006139 ;}
6140 break;
6141
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006142 case 297:
6143#line 2813 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006144 { // Return with a result...
6145 ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
6146 assert(!VL.empty() && "Invalid ret operands!");
Dan Gohman1a570242008-07-23 00:54:54 +00006147 const Type *ReturnType = CurFun.CurrentFunction->getReturnType();
6148 if (VL.size() > 1 ||
6149 (isa<StructType>(ReturnType) &&
6150 (VL.empty() || VL[0]->getType() != ReturnType))) {
6151 Value *RV = UndefValue::get(ReturnType);
6152 for (unsigned i = 0, e = VL.size(); i != e; ++i) {
6153 Instruction *I = InsertValueInst::Create(RV, VL[i], i, "mrv");
6154 ((yyvsp[(-1) - (2)].BasicBlockVal))->getInstList().push_back(I);
6155 RV = I;
6156 }
6157 (yyval.TermInstVal) = ReturnInst::Create(RV);
6158 } else {
6159 (yyval.TermInstVal) = ReturnInst::Create(VL[0]);
6160 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006161 delete (yyvsp[(2) - (2)].ValueList);
6162 CHECK_FOR_ERROR
6163 ;}
6164 break;
6165
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006166 case 298:
6167#line 2833 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006168 { // Return with no result...
6169 (yyval.TermInstVal) = ReturnInst::Create();
6170 CHECK_FOR_ERROR
6171 ;}
6172 break;
6173
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006174 case 299:
6175#line 2837 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006176 { // Unconditional Branch...
6177 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
6178 CHECK_FOR_ERROR
6179 (yyval.TermInstVal) = BranchInst::Create(tmpBB);
6180 ;}
6181 break;
6182
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006183 case 300:
6184#line 2842 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Eric Christopher2a5196f2008-09-24 04:55:49 +00006185 {
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006186 if (cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() != 1)
6187 GEN_ERROR("Branch condition must have type i1");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006188 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6189 CHECK_FOR_ERROR
6190 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
6191 CHECK_FOR_ERROR
6192 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
6193 CHECK_FOR_ERROR
6194 (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal);
6195 ;}
6196 break;
6197
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006198 case 301:
6199#line 2853 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006200 {
6201 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
6202 CHECK_FOR_ERROR
6203 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6204 CHECK_FOR_ERROR
6205 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
6206 (yyval.TermInstVal) = S;
6207
6208 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
6209 E = (yyvsp[(8) - (9)].JumpTable)->end();
Reid Spencer68a24bd2005-08-27 18:50:39 +00006210 for (; I != E; ++I) {
6211 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
6212 S->addCase(CI, I->second);
6213 else
Reid Spencerb5334b02007-02-05 10:18:06 +00006214 GEN_ERROR("Switch case is constant, but not a simple integer");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006215 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006216 delete (yyvsp[(8) - (9)].JumpTable);
Reid Spencer61c83e02006-08-18 08:43:06 +00006217 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006218 ;}
6219 break;
6220
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006221 case 302:
6222#line 2872 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006223 {
6224 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006225 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006226 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006227 CHECK_FOR_ERROR
Gabor Greife64d2482008-04-06 23:07:54 +00006228 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006229 (yyval.TermInstVal) = S;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006230 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006231 ;}
6232 break;
6233
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006234 case 303:
6235#line 2882 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006236 {
Reid Spencer3822ff52006-11-08 06:47:33 +00006237
Reid Spencer14310612006-12-31 05:40:51 +00006238 // Handle the short syntax
6239 const PointerType *PFTy = 0;
6240 const FunctionType *Ty = 0;
Devang Patel652203f2008-09-29 20:49:50 +00006241 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(4) - (15)].TypeVal)->get())) ||
Reid Spencer68a24bd2005-08-27 18:50:39 +00006242 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6243 // Pull out the types of all of the arguments...
6244 std::vector<const Type*> ParamTypes;
Devang Patel652203f2008-09-29 20:49:50 +00006245 ParamList::iterator I = (yyvsp[(7) - (15)].ParamList)->begin(), E = (yyvsp[(7) - (15)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006246 for (; I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00006247 const Type *Ty = I->Val->getType();
6248 if (Ty == Type::VoidTy)
6249 GEN_ERROR("Short call syntax cannot be used with varargs");
6250 ParamTypes.push_back(Ty);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006251 }
Eric Christopher2a5196f2008-09-24 04:55:49 +00006252
Devang Patel652203f2008-09-29 20:49:50 +00006253 if (!FunctionType::isValidReturnType(*(yyvsp[(4) - (15)].TypeVal)))
Chris Lattnera925a142008-04-23 05:37:08 +00006254 GEN_ERROR("Invalid result type for LLVM function");
6255
Devang Patel652203f2008-09-29 20:49:50 +00006256 Ty = FunctionType::get((yyvsp[(4) - (15)].TypeVal)->get(), ParamTypes, false);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00006257 PFTy = PointerType::getUnqual(Ty);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006258 }
6259
Devang Patel652203f2008-09-29 20:49:50 +00006260 delete (yyvsp[(4) - (15)].TypeVal);
Reid Spencer66728ef2007-03-20 01:13:36 +00006261
Devang Patel652203f2008-09-29 20:49:50 +00006262 Value *V = getVal(PFTy, (yyvsp[(5) - (15)].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00006263 CHECK_FOR_ERROR
Devang Patel652203f2008-09-29 20:49:50 +00006264 BasicBlock *Normal = getBBVal((yyvsp[(12) - (15)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006265 CHECK_FOR_ERROR
Devang Patel652203f2008-09-29 20:49:50 +00006266 BasicBlock *Except = getBBVal((yyvsp[(15) - (15)].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00006267 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00006268
Devang Patel05988662008-09-25 21:00:45 +00006269 SmallVector<AttributeWithIndex, 8> Attrs;
Dale Johannesene7261862008-09-26 23:46:20 +00006270 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
6271 //attributes.
Devang Patel652203f2008-09-29 20:49:50 +00006272 Attributes RetAttrs = (yyvsp[(3) - (15)].Attributes);
6273 if ((yyvsp[(9) - (15)].Attributes) != Attribute::None) {
6274 if ((yyvsp[(9) - (15)].Attributes) & Attribute::ZExt) {
Dale Johannesene7261862008-09-26 23:46:20 +00006275 RetAttrs = RetAttrs | Attribute::ZExt;
Devang Patel652203f2008-09-29 20:49:50 +00006276 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::ZExt;
Dale Johannesene7261862008-09-26 23:46:20 +00006277 }
Devang Patel652203f2008-09-29 20:49:50 +00006278 if ((yyvsp[(9) - (15)].Attributes) & Attribute::SExt) {
Dale Johannesene7261862008-09-26 23:46:20 +00006279 RetAttrs = RetAttrs | Attribute::SExt;
Devang Patel652203f2008-09-29 20:49:50 +00006280 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::SExt;
Dale Johannesene7261862008-09-26 23:46:20 +00006281 }
Devang Patel652203f2008-09-29 20:49:50 +00006282 if ((yyvsp[(9) - (15)].Attributes) & Attribute::InReg) {
Dale Johannesene7261862008-09-26 23:46:20 +00006283 RetAttrs = RetAttrs | Attribute::InReg;
Devang Patel652203f2008-09-29 20:49:50 +00006284 (yyvsp[(9) - (15)].Attributes) = (yyvsp[(9) - (15)].Attributes) ^ Attribute::InReg;
Dale Johannesene7261862008-09-26 23:46:20 +00006285 }
Dale Johannesene7261862008-09-26 23:46:20 +00006286 }
Devang Patel652203f2008-09-29 20:49:50 +00006287 if (RetAttrs != Attribute::None)
6288 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
Dale Johannesene7261862008-09-26 23:46:20 +00006289
Reid Spencer14310612006-12-31 05:40:51 +00006290 // Check the arguments
6291 ValueList Args;
Devang Patel652203f2008-09-29 20:49:50 +00006292 if ((yyvsp[(7) - (15)].ParamList)->empty()) { // Has no arguments?
Reid Spencer14310612006-12-31 05:40:51 +00006293 // Make sure no arguments is a good thing!
6294 if (Ty->getNumParams() != 0)
6295 GEN_ERROR("No arguments passed to a function that "
Reid Spencerb5334b02007-02-05 10:18:06 +00006296 "expects arguments");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006297 } else { // Has arguments?
6298 // Loop through FunctionType's arguments and ensure they are specified
6299 // correctly!
Reid Spencer68a24bd2005-08-27 18:50:39 +00006300 FunctionType::param_iterator I = Ty->param_begin();
6301 FunctionType::param_iterator E = Ty->param_end();
Devang Patel652203f2008-09-29 20:49:50 +00006302 ParamList::iterator ArgI = (yyvsp[(7) - (15)].ParamList)->begin(), ArgE = (yyvsp[(7) - (15)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006303 unsigned index = 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00006304
Duncan Sandsdc024672007-11-27 13:23:08 +00006305 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006306 if (ArgI->Val->getType() != *I)
6307 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00006308 (*I)->getDescription() + "'");
Reid Spencer14310612006-12-31 05:40:51 +00006309 Args.push_back(ArgI->Val);
Devang Patel05988662008-09-25 21:00:45 +00006310 if (ArgI->Attrs != Attribute::None)
6311 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00006312 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00006313
Reid Spencer14310612006-12-31 05:40:51 +00006314 if (Ty->isVarArg()) {
6315 if (I == E)
Chris Lattner38905612008-02-19 04:36:25 +00006316 for (; ArgI != ArgE; ++ArgI, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006317 Args.push_back(ArgI->Val); // push the remaining varargs
Devang Patel05988662008-09-25 21:00:45 +00006318 if (ArgI->Attrs != Attribute::None)
6319 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Chris Lattner38905612008-02-19 04:36:25 +00006320 }
Reid Spencer14310612006-12-31 05:40:51 +00006321 } else if (I != E || ArgI != ArgE)
Reid Spencerb5334b02007-02-05 10:18:06 +00006322 GEN_ERROR("Invalid number of parameters detected");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006323 }
Devang Patel652203f2008-09-29 20:49:50 +00006324 if ((yyvsp[(9) - (15)].Attributes) != Attribute::None)
6325 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(9) - (15)].Attributes)));
Devang Patel05988662008-09-25 21:00:45 +00006326 AttrListPtr PAL;
Duncan Sandsdc024672007-11-27 13:23:08 +00006327 if (!Attrs.empty())
Devang Patel05988662008-09-25 21:00:45 +00006328 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsdc024672007-11-27 13:23:08 +00006329
Reid Spencer14310612006-12-31 05:40:51 +00006330 // Create the InvokeInst
Dan Gohman041e2eb2008-05-15 19:50:34 +00006331 InvokeInst *II = InvokeInst::Create(V, Normal, Except,
6332 Args.begin(), Args.end());
Devang Patel652203f2008-09-29 20:49:50 +00006333 II->setCallingConv((yyvsp[(2) - (15)].UIntVal));
Devang Patel05988662008-09-25 21:00:45 +00006334 II->setAttributes(PAL);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006335 (yyval.TermInstVal) = II;
Devang Patel652203f2008-09-29 20:49:50 +00006336 delete (yyvsp[(7) - (15)].ParamList);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006337 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006338 ;}
6339 break;
6340
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006341 case 304:
6342#line 2985 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006343 {
6344 (yyval.TermInstVal) = new UnwindInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00006345 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006346 ;}
6347 break;
6348
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006349 case 305:
6350#line 2989 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006351 {
6352 (yyval.TermInstVal) = new UnreachableInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00006353 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006354 ;}
6355 break;
6356
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006357 case 306:
6358#line 2996 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006359 {
6360 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
6361 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006362 CHECK_FOR_ERROR
6363 if (V == 0)
6364 GEN_ERROR("May only switch on a constant pool value");
6365
Dan Gohmanf4423b12008-04-19 00:24:39 +00006366 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006367 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006368 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
6369 ;}
6370 break;
6371
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006372 case 307:
6373#line 3007 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006374 {
6375 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
6376 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006377 CHECK_FOR_ERROR
6378
6379 if (V == 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00006380 GEN_ERROR("May only switch on a constant pool value");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006381
Dan Gohmanf4423b12008-04-19 00:24:39 +00006382 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006383 CHECK_FOR_ERROR
Eric Christopher2a5196f2008-09-24 04:55:49 +00006384 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
Dan Gohmanf4423b12008-04-19 00:24:39 +00006385 ;}
6386 break;
6387
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006388 case 308:
6389#line 3020 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006390 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006391 // Is this definition named?? if so, assign the name...
Dan Gohmanf4423b12008-04-19 00:24:39 +00006392 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006393 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006394 InsertValue((yyvsp[(2) - (2)].InstVal));
6395 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006396 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006397 ;}
6398 break;
6399
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006400 case 309:
6401#line 3029 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00006402 {
6403 CHECK_FOR_ERROR
6404 int ValNum = InsertValue((yyvsp[(2) - (2)].InstVal));
Eric Christopher2a5196f2008-09-24 04:55:49 +00006405
Chris Lattner15bd0952008-08-29 17:20:18 +00006406 if (ValNum != (int)(yyvsp[(1) - (2)].UIntVal))
6407 GEN_ERROR("Result value number %" + utostr((yyvsp[(1) - (2)].UIntVal)) +
6408 " is incorrect, expected %" + utostr((unsigned)ValNum));
6409
6410 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
6411 CHECK_FOR_ERROR
6412 ;}
6413 break;
6414
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006415 case 310:
6416#line 3042 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006417 { // Used for PHI nodes
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006418 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006419 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
6420 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
6421 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
Reid Spencer6f407902007-01-13 05:00:46 +00006422 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006423 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006424 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006425 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6426 delete (yyvsp[(1) - (6)].TypeVal);
6427 ;}
6428 break;
6429
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006430 case 311:
6431#line 3053 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006432 {
6433 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
6434 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006435 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006436 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006437 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006438 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6439 ;}
6440 break;
6441
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006442 case 312:
6443#line 3063 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006444 {
Devang Patel05988662008-09-25 21:00:45 +00006445 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006446 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006447 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006448 // Used for call and invoke instructions
Dan Gohmanf4423b12008-04-19 00:24:39 +00006449 (yyval.ParamList) = new ParamList();
Devang Patel05988662008-09-25 21:00:45 +00006450 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 +00006451 (yyval.ParamList)->push_back(E);
6452 delete (yyvsp[(1) - (4)].TypeVal);
Duncan Sandsdc024672007-11-27 13:23:08 +00006453 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006454 ;}
6455 break;
6456
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006457 case 313:
6458#line 3074 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006459 {
Devang Patel05988662008-09-25 21:00:45 +00006460 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Dale Johanneseneb57ea72007-11-05 21:20:28 +00006461 // Labels are only valid in ASMs
Dan Gohmanf4423b12008-04-19 00:24:39 +00006462 (yyval.ParamList) = new ParamList();
Devang Patel05988662008-09-25 21:00:45 +00006463 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 +00006464 (yyval.ParamList)->push_back(E);
Duncan Sandsdc024672007-11-27 13:23:08 +00006465 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006466 ;}
6467 break;
6468
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006469 case 314:
6470#line 3082 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006471 {
Devang Patel05988662008-09-25 21:00:45 +00006472 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006473 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006474 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6475 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
Devang Patel05988662008-09-25 21:00:45 +00006476 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 +00006477 (yyval.ParamList)->push_back(E);
6478 delete (yyvsp[(3) - (6)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006479 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006480 ;}
6481 break;
6482
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006483 case 315:
6484#line 3092 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006485 {
Devang Patel05988662008-09-25 21:00:45 +00006486 // FIXME: Remove trailing OptAttributes in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf4423b12008-04-19 00:24:39 +00006487 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
Devang Patel05988662008-09-25 21:00:45 +00006488 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 +00006489 (yyval.ParamList)->push_back(E);
Dale Johanneseneb57ea72007-11-05 21:20:28 +00006490 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006491 ;}
6492 break;
6493
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006494 case 316:
6495#line 3099 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006496 { (yyval.ParamList) = new ParamList(); ;}
6497 break;
6498
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006499 case 317:
6500#line 3102 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006501 { (yyval.ValueList) = new std::vector<Value*>(); ;}
6502 break;
6503
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006504 case 318:
6505#line 3103 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006506 {
6507 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
6508 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00006509 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006510 ;}
6511 break;
6512
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006513 case 319:
6514#line 3111 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006515 {
6516 (yyval.ConstantList) = new std::vector<unsigned>();
6517 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
6518 GEN_ERROR("Index " + utostr((yyvsp[(2) - (2)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6519 (yyval.ConstantList)->push_back((yyvsp[(2) - (2)].UInt64Val));
6520 ;}
6521 break;
6522
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006523 case 320:
6524#line 3117 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006525 {
6526 (yyval.ConstantList) = (yyvsp[(1) - (3)].ConstantList);
6527 if ((unsigned)(yyvsp[(3) - (3)].UInt64Val) != (yyvsp[(3) - (3)].UInt64Val))
6528 GEN_ERROR("Index " + utostr((yyvsp[(3) - (3)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6529 (yyval.ConstantList)->push_back((yyvsp[(3) - (3)].UInt64Val));
6530 CHECK_FOR_ERROR
6531 ;}
6532 break;
6533
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006534 case 321:
6535#line 3126 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006536 {
6537 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00006538 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006539 ;}
6540 break;
6541
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006542 case 322:
6543#line 3130 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006544 {
6545 (yyval.BoolVal) = false;
Andrew Lenharth6353e052006-12-08 18:07:09 +00006546 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006547 ;}
6548 break;
6549
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006550 case 323:
6551#line 3135 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006552 {
Reid Spencer14310612006-12-31 05:40:51 +00006553 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006554 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
Eric Christopher2a5196f2008-09-24 04:55:49 +00006555 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
Dan Gohmanf4423b12008-04-19 00:24:39 +00006556 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006557 GEN_ERROR(
6558 "Arithmetic operator requires integer, FP, or packed operands");
Eric Christopher2a5196f2008-09-24 04:55:49 +00006559 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006560 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006561 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006562 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006563 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006564 if ((yyval.InstVal) == 0)
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006565 GEN_ERROR("binary operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006566 delete (yyvsp[(2) - (5)].TypeVal);
6567 ;}
6568 break;
6569
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006570 case 324:
6571#line 3151 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006572 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006573 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006574 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6575 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006576 if (!isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
Dan Gohmanf4423b12008-04-19 00:24:39 +00006577 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006578 GEN_ERROR("Logical operator requires integral operands");
6579 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006580 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006581 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006582 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006583 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006584 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006585 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006586 GEN_ERROR("binary operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006587 delete (yyvsp[(2) - (5)].TypeVal);
6588 ;}
6589 break;
6590
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006591 case 325:
6592#line 3168 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006593 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006594 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006595 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
Dan Gohmanf4423b12008-04-19 00:24:39 +00006596 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006597 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006598 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006599 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);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006601 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006602 GEN_ERROR("icmp operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006603 delete (yyvsp[(3) - (6)].TypeVal);
6604 ;}
6605 break;
6606
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006607 case 326:
6608#line 3180 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006609 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006610 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006611 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
Dan Gohmanf4423b12008-04-19 00:24:39 +00006612 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006613 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006614 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006615 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006616 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006617 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006618 GEN_ERROR("fcmp operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006619 delete (yyvsp[(3) - (6)].TypeVal);
6620 ;}
6621 break;
6622
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006623 case 327:
6624#line 3192 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00006625 {
6626 if (!UpRefs.empty())
6627 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6628 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6629 GEN_ERROR("Scalar types not supported by vicmp instruction");
6630 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6631 CHECK_FOR_ERROR
6632 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6633 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006634 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Nate Begemanac80ade2008-05-12 19:01:56 +00006635 if ((yyval.InstVal) == 0)
Dan Gohmand8ee59b2008-09-09 01:13:24 +00006636 GEN_ERROR("vicmp operator returned null");
Nate Begemanac80ade2008-05-12 19:01:56 +00006637 delete (yyvsp[(3) - (6)].TypeVal);
6638 ;}
6639 break;
6640
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006641 case 328:
6642#line 3206 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00006643 {
6644 if (!UpRefs.empty())
6645 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6646 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6647 GEN_ERROR("Scalar types not supported by vfcmp instruction");
6648 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6649 CHECK_FOR_ERROR
6650 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6651 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006652 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Nate Begemanac80ade2008-05-12 19:01:56 +00006653 if ((yyval.InstVal) == 0)
Dan Gohmand8ee59b2008-09-09 01:13:24 +00006654 GEN_ERROR("vfcmp operator returned null");
Nate Begemanac80ade2008-05-12 19:01:56 +00006655 delete (yyvsp[(3) - (6)].TypeVal);
6656 ;}
6657 break;
6658
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006659 case 329:
6660#line 3220 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006661 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006662 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006663 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6664 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6665 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6666 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006667 GEN_ERROR("invalid cast opcode for cast from '" +
6668 Val->getType()->getDescription() + "' to '" +
Eric Christopher2a5196f2008-09-24 04:55:49 +00006669 DestTy->getDescription() + "'");
Dan Gohmane4977cf2008-05-23 01:55:30 +00006670 (yyval.InstVal) = CastInst::Create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006671 delete (yyvsp[(4) - (4)].TypeVal);
6672 ;}
6673 break;
6674
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006675 case 330:
6676#line 3232 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006677 {
Dan Gohmand8ee59b2008-09-09 01:13:24 +00006678 if (isa<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType())) {
6679 // vector select
6680 if (!isa<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType())
6681 || !isa<VectorType>((yyvsp[(6) - (6)].ValueVal)->getType()) )
6682 GEN_ERROR("vector select value types must be vector types");
6683 const VectorType* cond_type = cast<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType());
6684 const VectorType* select_type = cast<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType());
6685 if (cond_type->getElementType() != Type::Int1Ty)
6686 GEN_ERROR("vector select condition element type must be boolean");
6687 if (cond_type->getNumElements() != select_type->getNumElements())
6688 GEN_ERROR("vector select number of elements must be the same");
6689 } else {
6690 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
6691 GEN_ERROR("select condition must be boolean");
6692 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006693 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
Dan Gohmand8ee59b2008-09-09 01:13:24 +00006694 GEN_ERROR("select value types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006695 (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006696 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006697 ;}
6698 break;
6699
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006700 case 331:
6701#line 3253 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006702 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006703 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006704 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6705 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6706 delete (yyvsp[(4) - (4)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006707 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006708 ;}
6709 break;
6710
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006711 case 332:
6712#line 3260 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006713 {
6714 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006715 GEN_ERROR("Invalid extractelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006716 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006717 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006718 ;}
6719 break;
6720
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006721 case 333:
6722#line 3266 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006723 {
6724 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006725 GEN_ERROR("Invalid insertelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006726 (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006727 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006728 ;}
6729 break;
6730
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006731 case 334:
6732#line 3272 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006733 {
6734 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006735 GEN_ERROR("Invalid shufflevector operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006736 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006737 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006738 ;}
6739 break;
6740
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006741 case 335:
6742#line 3278 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006743 {
6744 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006745 if (!Ty->isFirstClassType())
6746 GEN_ERROR("PHI node operands must be of first class type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006747 (yyval.InstVal) = PHINode::Create(Ty);
6748 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6749 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
Eric Christopher2a5196f2008-09-24 04:55:49 +00006750 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006751 GEN_ERROR("All elements of a PHI node must be of the same type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006752 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6753 (yyvsp[(2) - (2)].PHIList)->pop_front();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006754 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006755 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006756 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006757 ;}
6758 break;
6759
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006760 case 336:
6761#line 3294 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006762 {
Reid Spencer14310612006-12-31 05:40:51 +00006763
6764 // Handle the short syntax
Andrew Lenharth6353e052006-12-08 18:07:09 +00006765 const PointerType *PFTy = 0;
6766 const FunctionType *Ty = 0;
Devang Patel652203f2008-09-29 20:49:50 +00006767 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(4) - (9)].TypeVal)->get())) ||
Andrew Lenharth6353e052006-12-08 18:07:09 +00006768 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6769 // Pull out the types of all of the arguments...
6770 std::vector<const Type*> ParamTypes;
Devang Patel652203f2008-09-29 20:49:50 +00006771 ParamList::iterator I = (yyvsp[(7) - (9)].ParamList)->begin(), E = (yyvsp[(7) - (9)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006772 for (; I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00006773 const Type *Ty = I->Val->getType();
6774 if (Ty == Type::VoidTy)
6775 GEN_ERROR("Short call syntax cannot be used with varargs");
6776 ParamTypes.push_back(Ty);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006777 }
Chris Lattnera925a142008-04-23 05:37:08 +00006778
Devang Patel652203f2008-09-29 20:49:50 +00006779 if (!FunctionType::isValidReturnType(*(yyvsp[(4) - (9)].TypeVal)))
Chris Lattnera925a142008-04-23 05:37:08 +00006780 GEN_ERROR("Invalid result type for LLVM function");
6781
Devang Patel652203f2008-09-29 20:49:50 +00006782 Ty = FunctionType::get((yyvsp[(4) - (9)].TypeVal)->get(), ParamTypes, false);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00006783 PFTy = PointerType::getUnqual(Ty);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006784 }
Chris Lattner6cdc6822007-04-26 05:31:05 +00006785
Devang Patel652203f2008-09-29 20:49:50 +00006786 Value *V = getVal(PFTy, (yyvsp[(5) - (9)].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00006787 CHECK_FOR_ERROR
Chris Lattner6cdc6822007-04-26 05:31:05 +00006788
Reid Spencer7780acb2007-04-16 06:56:07 +00006789 // Check for call to invalid intrinsic to avoid crashing later.
6790 if (Function *theF = dyn_cast<Function>(V)) {
Reid Spencered48de22007-04-16 22:02:23 +00006791 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
Reid Spencer36fdde12007-04-16 20:35:38 +00006792 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6793 !theF->getIntrinsicID(true))
Reid Spencer7780acb2007-04-16 06:56:07 +00006794 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6795 theF->getName() + "'");
6796 }
6797
Devang Patel05988662008-09-25 21:00:45 +00006798 // Set up the Attributes for the function
6799 SmallVector<AttributeWithIndex, 8> Attrs;
Dale Johannesene7261862008-09-26 23:46:20 +00006800 //FIXME : In 3.0, stop accepting zext, sext and inreg as optional function
6801 //attributes.
Devang Patel652203f2008-09-29 20:49:50 +00006802 Attributes RetAttrs = (yyvsp[(3) - (9)].Attributes);
6803 if ((yyvsp[(9) - (9)].Attributes) != Attribute::None) {
6804 if ((yyvsp[(9) - (9)].Attributes) & Attribute::ZExt) {
Dale Johannesene7261862008-09-26 23:46:20 +00006805 RetAttrs = RetAttrs | Attribute::ZExt;
Devang Patel652203f2008-09-29 20:49:50 +00006806 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::ZExt;
Dale Johannesene7261862008-09-26 23:46:20 +00006807 }
Devang Patel652203f2008-09-29 20:49:50 +00006808 if ((yyvsp[(9) - (9)].Attributes) & Attribute::SExt) {
Dale Johannesene7261862008-09-26 23:46:20 +00006809 RetAttrs = RetAttrs | Attribute::SExt;
Devang Patel652203f2008-09-29 20:49:50 +00006810 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::SExt;
Dale Johannesene7261862008-09-26 23:46:20 +00006811 }
Devang Patel652203f2008-09-29 20:49:50 +00006812 if ((yyvsp[(9) - (9)].Attributes) & Attribute::InReg) {
Dale Johannesene7261862008-09-26 23:46:20 +00006813 RetAttrs = RetAttrs | Attribute::InReg;
Devang Patel652203f2008-09-29 20:49:50 +00006814 (yyvsp[(9) - (9)].Attributes) = (yyvsp[(9) - (9)].Attributes) ^ Attribute::InReg;
Dale Johannesene7261862008-09-26 23:46:20 +00006815 }
Dale Johannesene7261862008-09-26 23:46:20 +00006816 }
Devang Patel652203f2008-09-29 20:49:50 +00006817 if (RetAttrs != Attribute::None)
6818 Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
Dale Johannesene7261862008-09-26 23:46:20 +00006819
Eric Christopher2a5196f2008-09-24 04:55:49 +00006820 // Check the arguments
Reid Spencer14310612006-12-31 05:40:51 +00006821 ValueList Args;
Devang Patel652203f2008-09-29 20:49:50 +00006822 if ((yyvsp[(7) - (9)].ParamList)->empty()) { // Has no arguments?
Andrew Lenharth6353e052006-12-08 18:07:09 +00006823 // Make sure no arguments is a good thing!
6824 if (Ty->getNumParams() != 0)
6825 GEN_ERROR("No arguments passed to a function that "
Reid Spencerb5334b02007-02-05 10:18:06 +00006826 "expects arguments");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006827 } else { // Has arguments?
6828 // Loop through FunctionType's arguments and ensure they are specified
Duncan Sandsdc024672007-11-27 13:23:08 +00006829 // correctly. Also, gather any parameter attributes.
Andrew Lenharth6353e052006-12-08 18:07:09 +00006830 FunctionType::param_iterator I = Ty->param_begin();
6831 FunctionType::param_iterator E = Ty->param_end();
Devang Patel652203f2008-09-29 20:49:50 +00006832 ParamList::iterator ArgI = (yyvsp[(7) - (9)].ParamList)->begin(), ArgE = (yyvsp[(7) - (9)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006833 unsigned index = 1;
Andrew Lenharth6353e052006-12-08 18:07:09 +00006834
Duncan Sandsdc024672007-11-27 13:23:08 +00006835 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006836 if (ArgI->Val->getType() != *I)
6837 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00006838 (*I)->getDescription() + "'");
Reid Spencer14310612006-12-31 05:40:51 +00006839 Args.push_back(ArgI->Val);
Devang Patel05988662008-09-25 21:00:45 +00006840 if (ArgI->Attrs != Attribute::None)
6841 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00006842 }
6843 if (Ty->isVarArg()) {
6844 if (I == E)
Chris Lattner38905612008-02-19 04:36:25 +00006845 for (; ArgI != ArgE; ++ArgI, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006846 Args.push_back(ArgI->Val); // push the remaining varargs
Devang Patel05988662008-09-25 21:00:45 +00006847 if (ArgI->Attrs != Attribute::None)
6848 Attrs.push_back(AttributeWithIndex::get(index, ArgI->Attrs));
Chris Lattner38905612008-02-19 04:36:25 +00006849 }
Reid Spencer14310612006-12-31 05:40:51 +00006850 } else if (I != E || ArgI != ArgE)
Reid Spencerb5334b02007-02-05 10:18:06 +00006851 GEN_ERROR("Invalid number of parameters detected");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006852 }
Devang Patel652203f2008-09-29 20:49:50 +00006853 if ((yyvsp[(9) - (9)].Attributes) != Attribute::None)
6854 Attrs.push_back(AttributeWithIndex::get(~0, (yyvsp[(9) - (9)].Attributes)));
Duncan Sandsdc024672007-11-27 13:23:08 +00006855
Devang Patel05988662008-09-25 21:00:45 +00006856 // Finish off the Attributes and check them
6857 AttrListPtr PAL;
Duncan Sandsdc024672007-11-27 13:23:08 +00006858 if (!Attrs.empty())
Devang Patel05988662008-09-25 21:00:45 +00006859 PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsdc024672007-11-27 13:23:08 +00006860
Reid Spencer14310612006-12-31 05:40:51 +00006861 // Create the call node
Gabor Greife64d2482008-04-06 23:07:54 +00006862 CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
Devang Patel652203f2008-09-29 20:49:50 +00006863 CI->setTailCall((yyvsp[(1) - (9)].BoolVal));
6864 CI->setCallingConv((yyvsp[(2) - (9)].UIntVal));
Devang Patel05988662008-09-25 21:00:45 +00006865 CI->setAttributes(PAL);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006866 (yyval.InstVal) = CI;
Devang Patel652203f2008-09-29 20:49:50 +00006867 delete (yyvsp[(7) - (9)].ParamList);
6868 delete (yyvsp[(4) - (9)].TypeVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00006869 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006870 ;}
6871 break;
6872
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006873 case 337:
6874#line 3403 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006875 {
6876 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00006877 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006878 ;}
6879 break;
6880
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006881 case 338:
6882#line 3408 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006883 {
6884 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00006885 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006886 ;}
6887 break;
6888
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006889 case 339:
6890#line 3412 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006891 {
6892 (yyval.BoolVal) = false;
Reid Spencer61c83e02006-08-18 08:43:06 +00006893 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006894 ;}
6895 break;
6896
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006897 case 340:
6898#line 3419 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006899 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006900 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006901 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6902 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6903 delete (yyvsp[(2) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006904 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006905 ;}
6906 break;
6907
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006908 case 341:
6909#line 3426 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006910 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006911 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006912 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006913 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6914 GEN_ERROR("Malloc array size is not a 32-bit integer!");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006915 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00006916 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006917 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6918 delete (yyvsp[(2) - (6)].TypeVal);
6919 ;}
6920 break;
6921
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006922 case 342:
6923#line 3436 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006924 {
Reid Spencer14310612006-12-31 05:40:51 +00006925 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006926 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6927 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6928 delete (yyvsp[(2) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006929 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006930 ;}
6931 break;
6932
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006933 case 343:
6934#line 3443 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006935 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006936 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006937 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006938 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6939 GEN_ERROR("Alloca array size is not a 32-bit integer!");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006940 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006941 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006942 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6943 delete (yyvsp[(2) - (6)].TypeVal);
6944 ;}
6945 break;
6946
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006947 case 344:
6948#line 3453 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006949 {
6950 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
Eric Christopher2a5196f2008-09-24 04:55:49 +00006951 GEN_ERROR("Trying to free nonpointer type " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006952 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6953 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006954 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006955 ;}
6956 break;
6957
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006958 case 345:
6959#line 3461 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006960 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006961 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006962 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6963 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006964 GEN_ERROR("Can't load from nonpointer type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006965 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6966 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006967 GEN_ERROR("Can't load from pointer of non-first-class type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006968 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6969 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006970 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006971 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6972 delete (yyvsp[(3) - (5)].TypeVal);
6973 ;}
6974 break;
6975
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006976 case 346:
6977#line 3475 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006978 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006979 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006980 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6981 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006982 if (!PT)
6983 GEN_ERROR("Can't store to a nonpointer type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006984 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006985 const Type *ElTy = PT->getElementType();
Dan Gohmanf4423b12008-04-19 00:24:39 +00006986 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6987 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006988 "' into space of type '" + ElTy->getDescription() + "'");
6989
Dan Gohmanf4423b12008-04-19 00:24:39 +00006990 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006991 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006992 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6993 delete (yyvsp[(5) - (7)].TypeVal);
6994 ;}
6995 break;
6996
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00006997 case 347:
6998#line 3492 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006999 {
Dan Gohman1a570242008-07-23 00:54:54 +00007000 if (!UpRefs.empty())
7001 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
7002 if (!isa<StructType>((yyvsp[(2) - (5)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (5)].TypeVal)->get()))
7003 GEN_ERROR("getresult insn requires an aggregate operand");
7004 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].UInt64Val)))
7005 GEN_ERROR("Invalid getresult index for type '" +
7006 (*(yyvsp[(2) - (5)].TypeVal))->getDescription()+ "'");
7007
7008 Value *tmpVal = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Devang Patel5a970972008-02-19 22:27:01 +00007009 CHECK_FOR_ERROR
Dan Gohman1a570242008-07-23 00:54:54 +00007010 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(5) - (5)].UInt64Val));
7011 delete (yyvsp[(2) - (5)].TypeVal);
Dan Gohmanf4423b12008-04-19 00:24:39 +00007012 ;}
7013 break;
7014
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00007015 case 348:
7016#line 3506 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00007017 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00007018 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00007019 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
7020 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
Reid Spencerb5334b02007-02-05 10:18:06 +00007021 GEN_ERROR("getelementptr insn requires pointer operand");
Reid Spencer68a24bd2005-08-27 18:50:39 +00007022
Dan Gohman041e2eb2008-05-15 19:50:34 +00007023 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()))
Reid Spencer61c83e02006-08-18 08:43:06 +00007024 GEN_ERROR("Invalid getelementptr indices for type '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00007025 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
7026 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00007027 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00007028 (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
Eric Christopher2a5196f2008-09-24 04:55:49 +00007029 delete (yyvsp[(2) - (4)].TypeVal);
Dan Gohmanf4423b12008-04-19 00:24:39 +00007030 delete (yyvsp[(4) - (4)].ValueList);
7031 ;}
7032 break;
Reid Spencer7780acb2007-04-16 06:56:07 +00007033
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00007034 case 349:
7035#line 3521 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00007036 {
7037 if (!UpRefs.empty())
7038 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
7039 if (!isa<StructType>((yyvsp[(2) - (4)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (4)].TypeVal)->get()))
7040 GEN_ERROR("extractvalue insn requires an aggregate operand");
7041
Dan Gohman81a0c0b2008-05-31 00:58:22 +00007042 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end()))
Dan Gohmane4977cf2008-05-23 01:55:30 +00007043 GEN_ERROR("Invalid extractvalue indices for type '" +
7044 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
7045 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
7046 CHECK_FOR_ERROR
Dan Gohman81a0c0b2008-05-31 00:58:22 +00007047 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end());
Eric Christopher2a5196f2008-09-24 04:55:49 +00007048 delete (yyvsp[(2) - (4)].TypeVal);
Dan Gohman81a0c0b2008-05-31 00:58:22 +00007049 delete (yyvsp[(4) - (4)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00007050 ;}
7051 break;
7052
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00007053 case 350:
7054#line 3536 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00007055 {
7056 if (!UpRefs.empty())
7057 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription());
7058 if (!isa<StructType>((yyvsp[(2) - (7)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (7)].TypeVal)->get()))
7059 GEN_ERROR("extractvalue insn requires an aggregate operand");
7060
Dan Gohman81a0c0b2008-05-31 00:58:22 +00007061 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 +00007062 GEN_ERROR("Invalid insertvalue indices for type '" +
7063 (*(yyvsp[(2) - (7)].TypeVal))->getDescription()+ "'");
7064 Value* aggVal = getVal(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(3) - (7)].ValIDVal));
7065 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
7066 CHECK_FOR_ERROR
Dan Gohman81a0c0b2008-05-31 00:58:22 +00007067 (yyval.InstVal) = InsertValueInst::Create(aggVal, tmpVal, (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end());
Eric Christopher2a5196f2008-09-24 04:55:49 +00007068 delete (yyvsp[(2) - (7)].TypeVal);
Dan Gohmane4977cf2008-05-23 01:55:30 +00007069 delete (yyvsp[(5) - (7)].TypeVal);
Dan Gohman81a0c0b2008-05-31 00:58:22 +00007070 delete (yyvsp[(7) - (7)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00007071 ;}
7072 break;
7073
Dan Gohmanf4423b12008-04-19 00:24:39 +00007074
7075/* Line 1267 of yacc.c. */
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00007076#line 7077 "llvmAsmParser.tab.c"
Dan Gohmanf4423b12008-04-19 00:24:39 +00007077 default: break;
Dale Johannesencdd509a2007-09-07 21:07:57 +00007078 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00007079 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
7080
7081 YYPOPSTACK (yylen);
7082 yylen = 0;
7083 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00007084
7085 *++yyvsp = yyval;
7086
7087
Dan Gohmanf4423b12008-04-19 00:24:39 +00007088 /* Now `shift' the result of the reduction. Determine what state
7089 that goes to, based on the state we popped back to and the rule
7090 number reduced by. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00007091
7092 yyn = yyr1[yyn];
7093
Dan Gohmanf4423b12008-04-19 00:24:39 +00007094 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
7095 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00007096 yystate = yytable[yystate];
7097 else
Dan Gohmanf4423b12008-04-19 00:24:39 +00007098 yystate = yydefgoto[yyn - YYNTOKENS];
Reid Spencer68a24bd2005-08-27 18:50:39 +00007099
7100 goto yynewstate;
7101
7102
Dan Gohmanf4423b12008-04-19 00:24:39 +00007103/*------------------------------------.
7104| yyerrlab -- here on detecting error |
7105`------------------------------------*/
7106yyerrlab:
7107 /* If not already recovering from an error, report this error. */
7108 if (!yyerrstatus)
Reid Spencer68a24bd2005-08-27 18:50:39 +00007109 {
7110 ++yynerrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00007111#if ! YYERROR_VERBOSE
7112 yyerror (YY_("syntax error"));
7113#else
7114 {
7115 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
7116 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
7117 {
7118 YYSIZE_T yyalloc = 2 * yysize;
7119 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
7120 yyalloc = YYSTACK_ALLOC_MAXIMUM;
7121 if (yymsg != yymsgbuf)
7122 YYSTACK_FREE (yymsg);
7123 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
7124 if (yymsg)
7125 yymsg_alloc = yyalloc;
7126 else
7127 {
7128 yymsg = yymsgbuf;
7129 yymsg_alloc = sizeof yymsgbuf;
7130 }
7131 }
Dale Johannesencdd509a2007-09-07 21:07:57 +00007132
Dan Gohmanf4423b12008-04-19 00:24:39 +00007133 if (0 < yysize && yysize <= yymsg_alloc)
7134 {
7135 (void) yysyntax_error (yymsg, yystate, yychar);
7136 yyerror (yymsg);
7137 }
7138 else
7139 {
7140 yyerror (YY_("syntax error"));
7141 if (yysize != 0)
7142 goto yyexhaustedlab;
7143 }
7144 }
7145#endif
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00007146 }
7147
Dan Gohmanf4423b12008-04-19 00:24:39 +00007148
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00007149
7150 if (yyerrstatus == 3)
7151 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00007152 /* If just tried and failed to reuse look-ahead token after an
7153 error, discard it. */
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00007154
Dan Gohmanf4423b12008-04-19 00:24:39 +00007155 if (yychar <= YYEOF)
7156 {
7157 /* Return failure if at end of input. */
7158 if (yychar == YYEOF)
7159 YYABORT;
7160 }
7161 else
7162 {
7163 yydestruct ("Error: discarding",
7164 yytoken, &yylval);
7165 yychar = YYEMPTY;
7166 }
7167 }
7168
7169 /* Else will try to reuse look-ahead token after shifting the error
7170 token. */
7171 goto yyerrlab1;
7172
7173
7174/*---------------------------------------------------.
7175| yyerrorlab -- error raised explicitly by YYERROR. |
7176`---------------------------------------------------*/
7177yyerrorlab:
7178
7179 /* Pacify compilers like GCC when the user code never invokes
7180 YYERROR and the label yyerrorlab therefore never appears in user
7181 code. */
7182 if (/*CONSTCOND*/ 0)
7183 goto yyerrorlab;
7184
7185 /* Do not reclaim the symbols of the rule which action triggered
7186 this YYERROR. */
7187 YYPOPSTACK (yylen);
7188 yylen = 0;
7189 YY_STACK_PRINT (yyss, yyssp);
7190 yystate = *yyssp;
7191 goto yyerrlab1;
7192
7193
7194/*-------------------------------------------------------------.
7195| yyerrlab1 -- common code for both syntax error and YYERROR. |
7196`-------------------------------------------------------------*/
7197yyerrlab1:
7198 yyerrstatus = 3; /* Each real token shifted decrements this. */
7199
7200 for (;;)
7201 {
7202 yyn = yypact[yystate];
7203 if (yyn != YYPACT_NINF)
7204 {
7205 yyn += YYTERROR;
7206 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
7207 {
7208 yyn = yytable[yyn];
7209 if (0 < yyn)
7210 break;
7211 }
7212 }
7213
7214 /* Pop the current state because it cannot handle the error token. */
7215 if (yyssp == yyss)
Reid Spencer68a24bd2005-08-27 18:50:39 +00007216 YYABORT;
7217
Dale Johannesencdd509a2007-09-07 21:07:57 +00007218
Dan Gohmanf4423b12008-04-19 00:24:39 +00007219 yydestruct ("Error: popping",
7220 yystos[yystate], yyvsp);
7221 YYPOPSTACK (1);
7222 yystate = *yyssp;
7223 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00007224 }
7225
7226 if (yyn == YYFINAL)
7227 YYACCEPT;
7228
Reid Spencer68a24bd2005-08-27 18:50:39 +00007229 *++yyvsp = yylval;
Dan Gohmanf4423b12008-04-19 00:24:39 +00007230
7231
7232 /* Shift the error token. */
7233 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spencerb8f85052007-07-31 03:50:36 +00007234
Reid Spencer68a24bd2005-08-27 18:50:39 +00007235 yystate = yyn;
7236 goto yynewstate;
7237
Gabor Greife64d2482008-04-06 23:07:54 +00007238
Dan Gohmanf4423b12008-04-19 00:24:39 +00007239/*-------------------------------------.
7240| yyacceptlab -- YYACCEPT comes here. |
7241`-------------------------------------*/
7242yyacceptlab:
7243 yyresult = 0;
7244 goto yyreturn;
7245
7246/*-----------------------------------.
7247| yyabortlab -- YYABORT comes here. |
7248`-----------------------------------*/
7249yyabortlab:
7250 yyresult = 1;
7251 goto yyreturn;
7252
7253#ifndef yyoverflow
7254/*-------------------------------------------------.
7255| yyexhaustedlab -- memory exhaustion comes here. |
7256`-------------------------------------------------*/
7257yyexhaustedlab:
7258 yyerror (YY_("memory exhausted"));
7259 yyresult = 2;
7260 /* Fall through. */
Chris Lattner38905612008-02-19 04:36:25 +00007261#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00007262
7263yyreturn:
7264 if (yychar != YYEOF && yychar != YYEMPTY)
7265 yydestruct ("Cleanup: discarding lookahead",
7266 yytoken, &yylval);
7267 /* Do not reclaim the symbols of the rule which action triggered
7268 this YYABORT or YYACCEPT. */
7269 YYPOPSTACK (yylen);
7270 YY_STACK_PRINT (yyss, yyssp);
7271 while (yyssp != yyss)
7272 {
7273 yydestruct ("Cleanup: popping",
7274 yystos[*yyssp], yyvsp);
7275 YYPOPSTACK (1);
Gabor Greife64d2482008-04-06 23:07:54 +00007276 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00007277#ifndef yyoverflow
7278 if (yyss != yyssa)
7279 YYSTACK_FREE (yyss);
7280#endif
7281#if YYERROR_VERBOSE
7282 if (yymsg != yymsgbuf)
7283 YYSTACK_FREE (yymsg);
7284#endif
7285 /* Make sure YYID is used. */
7286 return YYID (yyresult);
Reid Spencer68a24bd2005-08-27 18:50:39 +00007287}
Dan Gohmanf4423b12008-04-19 00:24:39 +00007288
7289
Bill Wendling6ff4bfe2008-11-13 01:03:00 +00007290#line 3555 "/Volumes/Gir/devel/llvm/llvm.src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer61c83e02006-08-18 08:43:06 +00007291
7292
Reid Spencer14310612006-12-31 05:40:51 +00007293// common code from the two 'RunVMAsmParser' functions
7294static Module* RunParser(Module * M) {
Reid Spencer14310612006-12-31 05:40:51 +00007295 CurModule.CurrentModule = M;
Reid Spencer14310612006-12-31 05:40:51 +00007296 // Check to make sure the parser succeeded
7297 if (yyparse()) {
7298 if (ParserResult)
7299 delete ParserResult;
7300 return 0;
7301 }
7302
Reid Spencer0d60b5a2007-03-30 01:37:39 +00007303 // Emit an error if there are any unresolved types left.
7304 if (!CurModule.LateResolveTypes.empty()) {
7305 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
7306 if (DID.Type == ValID::LocalName) {
7307 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
7308 } else {
7309 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
7310 }
7311 if (ParserResult)
7312 delete ParserResult;
7313 return 0;
7314 }
7315
7316 // Emit an error if there are any unresolved values left.
7317 if (!CurModule.LateResolveValues.empty()) {
7318 Value *V = CurModule.LateResolveValues.back();
7319 std::map<Value*, std::pair<ValID, int> >::iterator I =
7320 CurModule.PlaceHolderInfo.find(V);
7321
7322 if (I != CurModule.PlaceHolderInfo.end()) {
7323 ValID &DID = I->second.first;
7324 if (DID.Type == ValID::LocalName) {
7325 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
7326 } else {
7327 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
7328 }
7329 if (ParserResult)
7330 delete ParserResult;
7331 return 0;
7332 }
7333 }
7334
Reid Spencer14310612006-12-31 05:40:51 +00007335 // Check to make sure that parsing produced a result
7336 if (!ParserResult)
7337 return 0;
7338
7339 // Reset ParserResult variable while saving its value for the result.
7340 Module *Result = ParserResult;
7341 ParserResult = 0;
7342
7343 return Result;
7344}
7345
Reid Spencer61c83e02006-08-18 08:43:06 +00007346void llvm::GenerateError(const std::string &message, int LineNo) {
Duncan Sandsdc024672007-11-27 13:23:08 +00007347 if (LineNo == -1) LineNo = LLLgetLineNo();
Reid Spencer61c83e02006-08-18 08:43:06 +00007348 // TODO: column number in exception
7349 if (TheParseError)
Duncan Sandsdc024672007-11-27 13:23:08 +00007350 TheParseError->setError(LLLgetFilename(), message, LineNo);
Reid Spencer61c83e02006-08-18 08:43:06 +00007351 TriggerError = 1;
7352}
Reid Spencer68a24bd2005-08-27 18:50:39 +00007353
7354int yyerror(const char *ErrorMsg) {
Duncan Sandsdc024672007-11-27 13:23:08 +00007355 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
Reid Spenceref9b9a72007-02-05 20:47:22 +00007356 std::string errMsg = where + "error: " + std::string(ErrorMsg);
Duncan Sandsdc024672007-11-27 13:23:08 +00007357 if (yychar != YYEMPTY && yychar != 0) {
7358 errMsg += " while reading token: '";
Eric Christopher2a5196f2008-09-24 04:55:49 +00007359 errMsg += std::string(LLLgetTokenStart(),
Duncan Sandsdc024672007-11-27 13:23:08 +00007360 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
7361 }
Reid Spencer61c83e02006-08-18 08:43:06 +00007362 GenerateError(errMsg);
Reid Spencer68a24bd2005-08-27 18:50:39 +00007363 return 0;
7364}
Dan Gohmanf4423b12008-04-19 00:24:39 +00007365