blob: 2a90405dc061e86042b106b365a7686a87025675 [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 Johannesen20ab78b2008-08-13 18:41:46 +0000142 X86_SSECALLCC_TOK = 323,
143 DATALAYOUT = 324,
144 RET = 325,
145 BR = 326,
146 SWITCH = 327,
147 INVOKE = 328,
148 UNWIND = 329,
149 UNREACHABLE = 330,
150 ADD = 331,
151 SUB = 332,
152 MUL = 333,
153 UDIV = 334,
154 SDIV = 335,
155 FDIV = 336,
156 UREM = 337,
157 SREM = 338,
158 FREM = 339,
159 AND = 340,
160 OR = 341,
161 XOR = 342,
162 SHL = 343,
163 LSHR = 344,
164 ASHR = 345,
165 ICMP = 346,
166 FCMP = 347,
167 VICMP = 348,
168 VFCMP = 349,
169 EQ = 350,
170 NE = 351,
171 SLT = 352,
172 SGT = 353,
173 SLE = 354,
174 SGE = 355,
175 ULT = 356,
176 UGT = 357,
177 ULE = 358,
178 UGE = 359,
179 OEQ = 360,
180 ONE = 361,
181 OLT = 362,
182 OGT = 363,
183 OLE = 364,
184 OGE = 365,
185 ORD = 366,
186 UNO = 367,
187 UEQ = 368,
188 UNE = 369,
189 MALLOC = 370,
190 ALLOCA = 371,
191 FREE = 372,
192 LOAD = 373,
193 STORE = 374,
194 GETELEMENTPTR = 375,
195 TRUNC = 376,
196 ZEXT = 377,
197 SEXT = 378,
198 FPTRUNC = 379,
199 FPEXT = 380,
200 BITCAST = 381,
201 UITOFP = 382,
202 SITOFP = 383,
203 FPTOUI = 384,
204 FPTOSI = 385,
205 INTTOPTR = 386,
206 PTRTOINT = 387,
207 PHI_TOK = 388,
208 SELECT = 389,
209 VAARG = 390,
210 EXTRACTELEMENT = 391,
211 INSERTELEMENT = 392,
212 SHUFFLEVECTOR = 393,
213 GETRESULT = 394,
214 EXTRACTVALUE = 395,
215 INSERTVALUE = 396,
216 SIGNEXT = 397,
217 ZEROEXT = 398,
218 NORETURN = 399,
219 INREG = 400,
220 SRET = 401,
221 NOUNWIND = 402,
222 NOALIAS = 403,
223 BYVAL = 404,
224 NEST = 405,
225 READNONE = 406,
226 READONLY = 407,
227 GC = 408,
Devang Pateld4980812008-09-02 20:52:40 +0000228 FNNOTE = 409,
229 INLINE = 410,
230 ALWAYS = 411,
231 NEVER = 412,
232 OPTIMIZEFORSIZE = 413,
233 DEFAULT = 414,
234 HIDDEN = 415,
235 PROTECTED = 416
Dan Gohmanf4423b12008-04-19 00:24:39 +0000236 };
237#endif
238/* Tokens. */
239#define ESINT64VAL 258
240#define EUINT64VAL 259
241#define ESAPINTVAL 260
242#define EUAPINTVAL 261
243#define LOCALVAL_ID 262
244#define GLOBALVAL_ID 263
245#define FPVAL 264
246#define VOID 265
247#define INTTYPE 266
248#define FLOAT 267
249#define DOUBLE 268
250#define X86_FP80 269
251#define FP128 270
252#define PPC_FP128 271
253#define LABEL 272
254#define TYPE 273
255#define LOCALVAR 274
256#define GLOBALVAR 275
257#define LABELSTR 276
258#define STRINGCONSTANT 277
259#define ATSTRINGCONSTANT 278
260#define PCTSTRINGCONSTANT 279
261#define ZEROINITIALIZER 280
262#define TRUETOK 281
263#define FALSETOK 282
264#define BEGINTOK 283
265#define ENDTOK 284
266#define DECLARE 285
267#define DEFINE 286
268#define GLOBAL 287
269#define CONSTANT 288
270#define SECTION 289
271#define ALIAS 290
272#define VOLATILE 291
273#define THREAD_LOCAL 292
274#define TO 293
275#define DOTDOTDOT 294
276#define NULL_TOK 295
277#define UNDEF 296
278#define INTERNAL 297
279#define LINKONCE 298
280#define WEAK 299
281#define APPENDING 300
282#define DLLIMPORT 301
283#define DLLEXPORT 302
284#define EXTERN_WEAK 303
Dale Johannesenc7071cc2008-05-14 20:13:36 +0000285#define COMMON 304
286#define OPAQUE 305
287#define EXTERNAL 306
288#define TARGET 307
289#define TRIPLE 308
290#define ALIGN 309
291#define ADDRSPACE 310
292#define DEPLIBS 311
293#define CALL 312
294#define TAIL 313
295#define ASM_TOK 314
296#define MODULE 315
297#define SIDEEFFECT 316
298#define CC_TOK 317
299#define CCC_TOK 318
300#define FASTCC_TOK 319
301#define COLDCC_TOK 320
302#define X86_STDCALLCC_TOK 321
303#define X86_FASTCALLCC_TOK 322
Dale Johannesen20ab78b2008-08-13 18:41:46 +0000304#define X86_SSECALLCC_TOK 323
305#define DATALAYOUT 324
306#define RET 325
307#define BR 326
308#define SWITCH 327
309#define INVOKE 328
310#define UNWIND 329
311#define UNREACHABLE 330
312#define ADD 331
313#define SUB 332
314#define MUL 333
315#define UDIV 334
316#define SDIV 335
317#define FDIV 336
318#define UREM 337
319#define SREM 338
320#define FREM 339
321#define AND 340
322#define OR 341
323#define XOR 342
324#define SHL 343
325#define LSHR 344
326#define ASHR 345
327#define ICMP 346
328#define FCMP 347
329#define VICMP 348
330#define VFCMP 349
331#define EQ 350
332#define NE 351
333#define SLT 352
334#define SGT 353
335#define SLE 354
336#define SGE 355
337#define ULT 356
338#define UGT 357
339#define ULE 358
340#define UGE 359
341#define OEQ 360
342#define ONE 361
343#define OLT 362
344#define OGT 363
345#define OLE 364
346#define OGE 365
347#define ORD 366
348#define UNO 367
349#define UEQ 368
350#define UNE 369
351#define MALLOC 370
352#define ALLOCA 371
353#define FREE 372
354#define LOAD 373
355#define STORE 374
356#define GETELEMENTPTR 375
357#define TRUNC 376
358#define ZEXT 377
359#define SEXT 378
360#define FPTRUNC 379
361#define FPEXT 380
362#define BITCAST 381
363#define UITOFP 382
364#define SITOFP 383
365#define FPTOUI 384
366#define FPTOSI 385
367#define INTTOPTR 386
368#define PTRTOINT 387
369#define PHI_TOK 388
370#define SELECT 389
371#define VAARG 390
372#define EXTRACTELEMENT 391
373#define INSERTELEMENT 392
374#define SHUFFLEVECTOR 393
375#define GETRESULT 394
376#define EXTRACTVALUE 395
377#define INSERTVALUE 396
378#define SIGNEXT 397
379#define ZEROEXT 398
380#define NORETURN 399
381#define INREG 400
382#define SRET 401
383#define NOUNWIND 402
384#define NOALIAS 403
385#define BYVAL 404
386#define NEST 405
387#define READNONE 406
388#define READONLY 407
389#define GC 408
Devang Pateld4980812008-09-02 20:52:40 +0000390#define FNNOTE 409
391#define INLINE 410
392#define ALWAYS 411
393#define NEVER 412
394#define OPTIMIZEFORSIZE 413
395#define DEFAULT 414
396#define HIDDEN 415
397#define PROTECTED 416
Dan Gohmanf4423b12008-04-19 00:24:39 +0000398
399
400
401
402/* Copy the first part of user declarations. */
Chris Lattnerccef6b52008-09-23 21:18:31 +0000403#line 14 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000404
405#include "ParserInternals.h"
406#include "llvm/CallingConv.h"
Chris Lattner0e9c3762006-01-25 22:27:16 +0000407#include "llvm/InlineAsm.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000408#include "llvm/Instructions.h"
409#include "llvm/Module.h"
Reid Spenceref9b9a72007-02-05 20:47:22 +0000410#include "llvm/ValueSymbolTable.h"
Chandler Carruth02202192007-08-04 01:56:21 +0000411#include "llvm/AutoUpgrade.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000412#include "llvm/Support/GetElementPtrTypeIterator.h"
Reid Spencer14310612006-12-31 05:40:51 +0000413#include "llvm/Support/CommandLine.h"
Chris Lattnerf7469af2007-01-31 04:44:08 +0000414#include "llvm/ADT/SmallVector.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000415#include "llvm/ADT/STLExtras.h"
Chris Lattner0019bbe2005-11-06 06:46:53 +0000416#include "llvm/Support/MathExtras.h"
Reid Spencer481169e2006-12-01 00:33:46 +0000417#include "llvm/Support/Streams.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000418#include <algorithm>
Reid Spencer68a24bd2005-08-27 18:50:39 +0000419#include <list>
Chris Lattner8adde282007-02-11 21:40:10 +0000420#include <map>
Reid Spencer68a24bd2005-08-27 18:50:39 +0000421#include <utility>
422
Reid Spencere4f47592006-08-18 17:32:55 +0000423// The following is a gross hack. In order to rid the libAsmParser library of
424// exceptions, we have to have a way of getting the yyparse function to go into
425// an error situation. So, whenever we want an error to occur, the GenerateError
426// function (see bottom of file) sets TriggerError. Then, at the end of each
427// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
428// (a goto) to put YACC in error state. Furthermore, several calls to
429// GenerateError are made from inside productions and they must simulate the
430// previous exception behavior by exiting the production immediately. We have
431// replaced these with the GEN_ERROR macro which calls GeneratError and then
432// immediately invokes YYERROR. This would be so much cleaner if it was a
433// recursive descent parser.
Reid Spencer61c83e02006-08-18 08:43:06 +0000434static bool TriggerError = false;
Reid Spencerf63697d2006-10-09 17:36:59 +0000435#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
Reid Spencer61c83e02006-08-18 08:43:06 +0000436#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
437
Reid Spencer68a24bd2005-08-27 18:50:39 +0000438int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
439int yylex(); // declaration" of xxx warnings.
440int yyparse();
Reid Spencer68a24bd2005-08-27 18:50:39 +0000441using namespace llvm;
442
443static Module *ParserResult;
444
445// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
446// relating to upreferences in the input stream.
447//
448//#define DEBUG_UPREFS 1
449#ifdef DEBUG_UPREFS
Bill Wendlinge8156192006-12-07 01:30:32 +0000450#define UR_OUT(X) cerr << X
Reid Spencer68a24bd2005-08-27 18:50:39 +0000451#else
452#define UR_OUT(X)
453#endif
454
455#define YYERROR_VERBOSE 1
456
Chris Lattnerb475c422005-11-12 18:22:38 +0000457static GlobalVariable *CurGV;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000458
459
460// This contains info used when building the body of a function. It is
461// destroyed when the function is completed.
462//
463typedef std::vector<Value *> ValueList; // Numbered defs
Reid Spencer14310612006-12-31 05:40:51 +0000464
Reid Spencer68a24bd2005-08-27 18:50:39 +0000465static void
Reid Spencer93c40032007-03-19 18:40:50 +0000466ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000467
468static struct PerModuleInfo {
469 Module *CurrentModule;
Reid Spencer93c40032007-03-19 18:40:50 +0000470 ValueList Values; // Module level numbered definitions
471 ValueList LateResolveValues;
Reid Spencer861d9d62006-11-28 07:29:44 +0000472 std::vector<PATypeHolder> Types;
473 std::map<ValID, PATypeHolder> LateResolveTypes;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000474
475 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
Chris Lattner0ad19702006-06-21 16:53:00 +0000476 /// how they were referenced and on which line of the input they came from so
Reid Spencer68a24bd2005-08-27 18:50:39 +0000477 /// that we can resolve them later and print error messages as appropriate.
478 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
479
480 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
481 // references to global values. Global values may be referenced before they
482 // are defined, and if so, the temporary object that they represent is held
483 // here. This is used for forward references of GlobalValues.
484 //
485 typedef std::map<std::pair<const PointerType *,
486 ValID>, GlobalValue*> GlobalRefsType;
487 GlobalRefsType GlobalRefs;
488
489 void ModuleDone() {
490 // If we could not resolve some functions at function compilation time
491 // (calls to functions before they are defined), resolve them now... Types
492 // are resolved when the constant pool has been completely parsed.
493 //
494 ResolveDefinitions(LateResolveValues);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000495 if (TriggerError)
496 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000497
498 // Check to make sure that all global value forward references have been
499 // resolved!
500 //
501 if (!GlobalRefs.empty()) {
502 std::string UndefinedReferences = "Unresolved global references exist:\n";
503
504 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
505 I != E; ++I) {
506 UndefinedReferences += " " + I->first.first->getDescription() + " " +
507 I->first.second.getName() + "\n";
508 }
Reid Spencer61c83e02006-08-18 08:43:06 +0000509 GenerateError(UndefinedReferences);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000510 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000511 }
512
Chandler Carruth02202192007-08-04 01:56:21 +0000513 // Look for intrinsic functions and CallInst that need to be upgraded
514 for (Module::iterator FI = CurrentModule->begin(),
515 FE = CurrentModule->end(); FI != FE; )
516 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
517
Reid Spencer68a24bd2005-08-27 18:50:39 +0000518 Values.clear(); // Clear out function local definitions
519 Types.clear();
520 CurrentModule = 0;
521 }
522
Reid Spencer68a24bd2005-08-27 18:50:39 +0000523 // GetForwardRefForGlobal - Check to see if there is a forward reference
524 // for this global. If so, remove it from the GlobalRefs map and return it.
525 // If not, just return null.
526 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
527 // Check to see if there is a forward reference to this global variable...
528 // if there is, eliminate it and patch the reference to use the new def'n.
529 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
530 GlobalValue *Ret = 0;
531 if (I != GlobalRefs.end()) {
532 Ret = I->second;
533 GlobalRefs.erase(I);
534 }
535 return Ret;
536 }
Reid Spencer8c8a2dc2007-01-02 21:54:12 +0000537
538 bool TypeIsUnresolved(PATypeHolder* PATy) {
539 // If it isn't abstract, its resolved
540 const Type* Ty = PATy->get();
541 if (!Ty->isAbstract())
542 return false;
543 // Traverse the type looking for abstract types. If it isn't abstract then
544 // we don't need to traverse that leg of the type.
545 std::vector<const Type*> WorkList, SeenList;
546 WorkList.push_back(Ty);
547 while (!WorkList.empty()) {
548 const Type* Ty = WorkList.back();
549 SeenList.push_back(Ty);
550 WorkList.pop_back();
551 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
552 // Check to see if this is an unresolved type
553 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
554 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
555 for ( ; I != E; ++I) {
556 if (I->second.get() == OpTy)
557 return true;
558 }
559 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
560 const Type* TheTy = SeqTy->getElementType();
561 if (TheTy->isAbstract() && TheTy != Ty) {
562 std::vector<const Type*>::iterator I = SeenList.begin(),
563 E = SeenList.end();
564 for ( ; I != E; ++I)
565 if (*I == TheTy)
566 break;
567 if (I == E)
568 WorkList.push_back(TheTy);
569 }
570 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
571 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
572 const Type* TheTy = StrTy->getElementType(i);
573 if (TheTy->isAbstract() && TheTy != Ty) {
574 std::vector<const Type*>::iterator I = SeenList.begin(),
575 E = SeenList.end();
576 for ( ; I != E; ++I)
577 if (*I == TheTy)
578 break;
579 if (I == E)
580 WorkList.push_back(TheTy);
581 }
582 }
583 }
584 }
585 return false;
586 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000587} CurModule;
588
589static struct PerFunctionInfo {
590 Function *CurrentFunction; // Pointer to current function being created
591
Reid Spencer93c40032007-03-19 18:40:50 +0000592 ValueList Values; // Keep track of #'d definitions
593 unsigned NextValNum;
594 ValueList LateResolveValues;
Reid Spenceref9b9a72007-02-05 20:47:22 +0000595 bool isDeclare; // Is this function a forward declararation?
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000596 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000597 GlobalValue::VisibilityTypes Visibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000598
599 /// BBForwardRefs - When we see forward references to basic blocks, keep
600 /// track of them here.
Reid Spencer93c40032007-03-19 18:40:50 +0000601 std::map<ValID, BasicBlock*> BBForwardRefs;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000602
603 inline PerFunctionInfo() {
604 CurrentFunction = 0;
605 isDeclare = false;
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000606 Linkage = GlobalValue::ExternalLinkage;
607 Visibility = GlobalValue::DefaultVisibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000608 }
609
610 inline void FunctionStart(Function *M) {
611 CurrentFunction = M;
Reid Spencer93c40032007-03-19 18:40:50 +0000612 NextValNum = 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000613 }
614
615 void FunctionDone() {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000616 // Any forward referenced blocks left?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000617 if (!BBForwardRefs.empty()) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000618 GenerateError("Undefined reference to label " +
Reid Spencer93c40032007-03-19 18:40:50 +0000619 BBForwardRefs.begin()->second->getName());
Reid Spencer5b7e7532006-09-28 19:28:24 +0000620 return;
621 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000622
623 // Resolve all forward references now.
624 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
625
626 Values.clear(); // Clear out function local definitions
Reid Spencer93c40032007-03-19 18:40:50 +0000627 BBForwardRefs.clear();
Reid Spencer68a24bd2005-08-27 18:50:39 +0000628 CurrentFunction = 0;
629 isDeclare = false;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000630 Linkage = GlobalValue::ExternalLinkage;
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000631 Visibility = GlobalValue::DefaultVisibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000632 }
633} CurFun; // Info for the current function...
634
635static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
636
637
638//===----------------------------------------------------------------------===//
639// Code to handle definitions of all the types
640//===----------------------------------------------------------------------===//
641
Chris Lattner15bd0952008-08-29 17:20:18 +0000642/// InsertValue - Insert a value into the value table. If it is named, this
643/// returns -1, otherwise it returns the slot number for the value.
644static int InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
Reid Spencer93c40032007-03-19 18:40:50 +0000645 // Things that have names or are void typed don't get slot numbers
646 if (V->hasName() || (V->getType() == Type::VoidTy))
Chris Lattner15bd0952008-08-29 17:20:18 +0000647 return -1;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000648
Reid Spencer93c40032007-03-19 18:40:50 +0000649 // In the case of function values, we have to allow for the forward reference
650 // of basic blocks, which are included in the numbering. Consequently, we keep
651 // track of the next insertion location with NextValNum. When a BB gets
652 // inserted, it could change the size of the CurFun.Values vector.
653 if (&ValueTab == &CurFun.Values) {
654 if (ValueTab.size() <= CurFun.NextValNum)
655 ValueTab.resize(CurFun.NextValNum+1);
656 ValueTab[CurFun.NextValNum++] = V;
Chris Lattner15bd0952008-08-29 17:20:18 +0000657 return CurFun.NextValNum-1;
Reid Spencer93c40032007-03-19 18:40:50 +0000658 }
659 // For all other lists, its okay to just tack it on the back of the vector.
660 ValueTab.push_back(V);
Chris Lattner15bd0952008-08-29 17:20:18 +0000661 return ValueTab.size()-1;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000662}
663
664static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
665 switch (D.Type) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000666 case ValID::LocalID: // Is it a numbered definition?
Reid Spencer68a24bd2005-08-27 18:50:39 +0000667 // Module constants occupy the lowest numbered slots...
Reid Spencer41dff5e2007-01-26 08:05:27 +0000668 if (D.Num < CurModule.Types.size())
669 return CurModule.Types[D.Num];
Reid Spencer68a24bd2005-08-27 18:50:39 +0000670 break;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000671 case ValID::LocalName: // Is it a named definition?
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000672 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000673 D.destroy(); // Free old strdup'd memory...
674 return N;
675 }
676 break;
677 default:
Reid Spencerb5334b02007-02-05 10:18:06 +0000678 GenerateError("Internal parser error: Invalid symbol type reference");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000679 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000680 }
681
682 // If we reached here, we referenced either a symbol that we don't know about
683 // or an id number that hasn't been read yet. We may be referencing something
684 // forward, so just create an entry to be resolved later and get to it...
685 //
686 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
687
688
689 if (inFunctionScope()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000690 if (D.Type == ValID::LocalName) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000691 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000692 return 0;
693 } else {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000694 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
Reid Spencer5b7e7532006-09-28 19:28:24 +0000695 return 0;
696 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000697 }
698
Reid Spencer861d9d62006-11-28 07:29:44 +0000699 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000700 if (I != CurModule.LateResolveTypes.end())
Reid Spencer861d9d62006-11-28 07:29:44 +0000701 return I->second;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000702
Reid Spencer861d9d62006-11-28 07:29:44 +0000703 Type *Typ = OpaqueType::get();
704 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
705 return Typ;
Reid Spencera132e042006-12-03 05:46:11 +0000706 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000707
Reid Spencer93c40032007-03-19 18:40:50 +0000708// getExistingVal - Look up the value specified by the provided type and
Reid Spencer68a24bd2005-08-27 18:50:39 +0000709// the provided ValID. If the value exists and has already been defined, return
710// it. Otherwise return null.
711//
Reid Spencer93c40032007-03-19 18:40:50 +0000712static Value *getExistingVal(const Type *Ty, const ValID &D) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000713 if (isa<FunctionType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000714 GenerateError("Functions are not values and "
Reid Spencer68a24bd2005-08-27 18:50:39 +0000715 "must be referenced as pointers");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000716 return 0;
717 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000718
719 switch (D.Type) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000720 case ValID::LocalID: { // Is it a numbered definition?
Reid Spencer41dff5e2007-01-26 08:05:27 +0000721 // Check that the number is within bounds.
Reid Spencer93c40032007-03-19 18:40:50 +0000722 if (D.Num >= CurFun.Values.size())
723 return 0;
724 Value *Result = CurFun.Values[D.Num];
725 if (Ty != Result->getType()) {
726 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
727 Result->getType()->getDescription() + "' does not match "
728 "expected type, '" + Ty->getDescription() + "'");
729 return 0;
730 }
731 return Result;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000732 }
733 case ValID::GlobalID: { // Is it a numbered definition?
Reid Spencer93c40032007-03-19 18:40:50 +0000734 if (D.Num >= CurModule.Values.size())
Reid Spenceref9b9a72007-02-05 20:47:22 +0000735 return 0;
Reid Spencer93c40032007-03-19 18:40:50 +0000736 Value *Result = CurModule.Values[D.Num];
737 if (Ty != Result->getType()) {
738 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
739 Result->getType()->getDescription() + "' does not match "
740 "expected type, '" + Ty->getDescription() + "'");
Reid Spenceref9b9a72007-02-05 20:47:22 +0000741 return 0;
Reid Spencer93c40032007-03-19 18:40:50 +0000742 }
743 return Result;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000744 }
Reid Spencer41dff5e2007-01-26 08:05:27 +0000745
746 case ValID::LocalName: { // Is it a named definition?
Reid Spenceref9b9a72007-02-05 20:47:22 +0000747 if (!inFunctionScope())
748 return 0;
749 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000750 Value *N = SymTab.lookup(D.getName());
Reid Spenceref9b9a72007-02-05 20:47:22 +0000751 if (N == 0)
752 return 0;
753 if (N->getType() != Ty)
754 return 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000755
756 D.destroy(); // Free old strdup'd memory...
757 return N;
758 }
759 case ValID::GlobalName: { // Is it a named definition?
Reid Spenceref9b9a72007-02-05 20:47:22 +0000760 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000761 Value *N = SymTab.lookup(D.getName());
Reid Spenceref9b9a72007-02-05 20:47:22 +0000762 if (N == 0)
763 return 0;
764 if (N->getType() != Ty)
765 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000766
767 D.destroy(); // Free old strdup'd memory...
768 return N;
769 }
770
771 // Check to make sure that "Ty" is an integral type, and that our
772 // value will fit into the specified type...
773 case ValID::ConstSIntVal: // Is it a constant pool reference??
Chris Lattner38905612008-02-19 04:36:25 +0000774 if (!isa<IntegerType>(Ty) ||
775 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000776 GenerateError("Signed integral constant '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000777 itostr(D.ConstPool64) + "' is invalid for type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +0000778 Ty->getDescription() + "'");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000779 return 0;
780 }
Reid Spencer49d273e2007-03-19 20:40:51 +0000781 return ConstantInt::get(Ty, D.ConstPool64, true);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000782
783 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
Chris Lattner38905612008-02-19 04:36:25 +0000784 if (isa<IntegerType>(Ty) &&
785 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
Reid Spencerb83eb642006-10-20 07:07:24 +0000786 return ConstantInt::get(Ty, D.UConstPool64);
Chris Lattner38905612008-02-19 04:36:25 +0000787
788 if (!isa<IntegerType>(Ty) ||
789 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
790 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
791 "' is invalid or out of range for type '" +
792 Ty->getDescription() + "'");
793 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000794 }
Chris Lattner38905612008-02-19 04:36:25 +0000795 // This is really a signed reference. Transmogrify.
796 return ConstantInt::get(Ty, D.ConstPool64, true);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000797
Chris Lattner1913b942008-07-11 00:30:39 +0000798 case ValID::ConstAPInt: // Is it an unsigned const pool reference?
799 if (!isa<IntegerType>(Ty)) {
800 GenerateError("Integral constant '" + D.getName() +
801 "' is invalid or out of range for type '" +
802 Ty->getDescription() + "'");
803 return 0;
804 }
805
806 {
807 APSInt Tmp = *D.ConstPoolInt;
808 Tmp.extOrTrunc(Ty->getPrimitiveSizeInBits());
809 return ConstantInt::get(Tmp);
810 }
811
Reid Spencer68a24bd2005-08-27 18:50:39 +0000812 case ValID::ConstFPVal: // Is it a floating point const pool reference?
Chris Lattner38905612008-02-19 04:36:25 +0000813 if (!Ty->isFloatingPoint() ||
814 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000815 GenerateError("FP constant invalid for type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000816 return 0;
817 }
Chris Lattnerd8eb63f2008-04-20 00:41:19 +0000818 // Lexer has no type info, so builds all float and double FP constants
Dale Johannesenc72cd7e2007-09-11 18:33:39 +0000819 // as double. Fix this here. Long double does not need this.
820 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
821 Ty==Type::FloatTy)
Dale Johannesencdd509a2007-09-07 21:07:57 +0000822 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
Chris Lattnerd8eb63f2008-04-20 00:41:19 +0000823 return ConstantFP::get(*D.ConstPoolFP);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000824
825 case ValID::ConstNullVal: // Is it a null value?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000826 if (!isa<PointerType>(Ty)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000827 GenerateError("Cannot create a a non pointer null");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000828 return 0;
829 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000830 return ConstantPointerNull::get(cast<PointerType>(Ty));
831
832 case ValID::ConstUndefVal: // Is it an undef value?
833 return UndefValue::get(Ty);
834
Chris Lattner7aa61892005-12-21 17:53:23 +0000835 case ValID::ConstZeroVal: // Is it a zero value?
836 return Constant::getNullValue(Ty);
837
Reid Spencer68a24bd2005-08-27 18:50:39 +0000838 case ValID::ConstantVal: // Fully resolved constant?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000839 if (D.ConstantValue->getType() != Ty) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000840 GenerateError("Constant expression type different from required type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000841 return 0;
842 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000843 return D.ConstantValue;
844
Chris Lattner0e9c3762006-01-25 22:27:16 +0000845 case ValID::InlineAsmVal: { // Inline asm expression
846 const PointerType *PTy = dyn_cast<PointerType>(Ty);
847 const FunctionType *FTy =
848 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000849 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000850 GenerateError("Invalid type for asm constraint string");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000851 return 0;
852 }
Chris Lattner0e9c3762006-01-25 22:27:16 +0000853 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
854 D.IAD->HasSideEffects);
855 D.destroy(); // Free InlineAsmDescriptor.
856 return IA;
857 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000858 default:
Reid Spencera9720f52007-02-05 17:04:00 +0000859 assert(0 && "Unhandled case!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000860 return 0;
861 } // End of switch
862
Reid Spencera9720f52007-02-05 17:04:00 +0000863 assert(0 && "Unhandled case!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000864 return 0;
865}
866
Reid Spencer93c40032007-03-19 18:40:50 +0000867// getVal - This function is identical to getExistingVal, except that if a
Reid Spencer68a24bd2005-08-27 18:50:39 +0000868// value is not already defined, it "improvises" by creating a placeholder var
869// that looks and acts just like the requested variable. When the value is
870// defined later, all uses of the placeholder variable are replaced with the
871// real thing.
872//
873static Value *getVal(const Type *Ty, const ValID &ID) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000874 if (Ty == Type::LabelTy) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000875 GenerateError("Cannot use a basic block here");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000876 return 0;
877 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000878
879 // See if the value has already been defined.
Reid Spencer93c40032007-03-19 18:40:50 +0000880 Value *V = getExistingVal(Ty, ID);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000881 if (V) return V;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000882 if (TriggerError) return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000883
Reid Spencer5b7e7532006-09-28 19:28:24 +0000884 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
Dan Gohmane4977cf2008-05-23 01:55:30 +0000885 GenerateError("Invalid use of a non-first-class type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000886 return 0;
887 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000888
889 // If we reached here, we referenced either a symbol that we don't know about
890 // or an id number that hasn't been read yet. We may be referencing something
891 // forward, so just create an entry to be resolved later and get to it...
892 //
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000893 switch (ID.Type) {
894 case ValID::GlobalName:
Reid Spencer9c9b63a2007-04-28 16:07:31 +0000895 case ValID::GlobalID: {
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000896 const PointerType *PTy = dyn_cast<PointerType>(Ty);
897 if (!PTy) {
898 GenerateError("Invalid type for reference to global" );
899 return 0;
900 }
901 const Type* ElTy = PTy->getElementType();
902 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
Gabor Greife64d2482008-04-06 23:07:54 +0000903 V = Function::Create(FTy, GlobalValue::ExternalLinkage);
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000904 else
Christopher Lamba8ed9bf2007-12-11 09:02:08 +0000905 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
906 (Module*)0, false, PTy->getAddressSpace());
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000907 break;
Reid Spencer9c9b63a2007-04-28 16:07:31 +0000908 }
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000909 default:
910 V = new Argument(Ty);
911 }
912
Reid Spencer68a24bd2005-08-27 18:50:39 +0000913 // Remember where this forward reference came from. FIXME, shouldn't we try
914 // to recycle these things??
915 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
Duncan Sandsdc024672007-11-27 13:23:08 +0000916 LLLgetLineNo())));
Reid Spencer68a24bd2005-08-27 18:50:39 +0000917
918 if (inFunctionScope())
919 InsertValue(V, CurFun.LateResolveValues);
920 else
921 InsertValue(V, CurModule.LateResolveValues);
922 return V;
923}
924
Reid Spencer93c40032007-03-19 18:40:50 +0000925/// defineBBVal - This is a definition of a new basic block with the specified
926/// identifier which must be the same as CurFun.NextValNum, if its numeric.
Chris Lattnercc81d152008-05-04 17:18:47 +0000927static BasicBlock *defineBBVal(const ValID &ID) {
Reid Spencera9720f52007-02-05 17:04:00 +0000928 assert(inFunctionScope() && "Can't get basic block at global scope!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000929
Reid Spencer68a24bd2005-08-27 18:50:39 +0000930 BasicBlock *BB = 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000931
Reid Spencer93c40032007-03-19 18:40:50 +0000932 // First, see if this was forward referenced
Reid Spencer68a24bd2005-08-27 18:50:39 +0000933
Reid Spencer93c40032007-03-19 18:40:50 +0000934 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
935 if (BBI != CurFun.BBForwardRefs.end()) {
936 BB = BBI->second;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000937 // The forward declaration could have been inserted anywhere in the
938 // function: insert it into the correct place now.
939 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
940 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
Reid Spencer93c40032007-03-19 18:40:50 +0000941
Reid Spencer66728ef2007-03-20 01:13:36 +0000942 // We're about to erase the entry, save the key so we can clean it up.
943 ValID Tmp = BBI->first;
944
Reid Spencer93c40032007-03-19 18:40:50 +0000945 // Erase the forward ref from the map as its no longer "forward"
946 CurFun.BBForwardRefs.erase(ID);
947
Reid Spencer66728ef2007-03-20 01:13:36 +0000948 // The key has been removed from the map but so we don't want to leave
949 // strdup'd memory around so destroy it too.
950 Tmp.destroy();
951
Reid Spencer93c40032007-03-19 18:40:50 +0000952 // If its a numbered definition, bump the number and set the BB value.
953 if (ID.Type == ValID::LocalID) {
954 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
955 InsertValue(BB);
956 }
Devang Patel67909432008-03-03 18:58:47 +0000957 } else {
958 // We haven't seen this BB before and its first mention is a definition.
959 // Just create it and return it.
960 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
Gabor Greife64d2482008-04-06 23:07:54 +0000961 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Devang Patel67909432008-03-03 18:58:47 +0000962 if (ID.Type == ValID::LocalID) {
963 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
964 InsertValue(BB);
965 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000966 }
Reid Spencer93c40032007-03-19 18:40:50 +0000967
Devang Patel67909432008-03-03 18:58:47 +0000968 ID.destroy();
Reid Spencer93c40032007-03-19 18:40:50 +0000969 return BB;
970}
971
972/// getBBVal - get an existing BB value or create a forward reference for it.
973///
974static BasicBlock *getBBVal(const ValID &ID) {
975 assert(inFunctionScope() && "Can't get basic block at global scope!");
976
977 BasicBlock *BB = 0;
978
979 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
980 if (BBI != CurFun.BBForwardRefs.end()) {
981 BB = BBI->second;
982 } if (ID.Type == ValID::LocalName) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000983 std::string Name = ID.getName();
Reid Spencer93c40032007-03-19 18:40:50 +0000984 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
Anton Korobeynikovc70d7732008-02-20 12:10:37 +0000985 if (N) {
Reid Spencer93c40032007-03-19 18:40:50 +0000986 if (N->getType()->getTypeID() == Type::LabelTyID)
987 BB = cast<BasicBlock>(N);
988 else
989 GenerateError("Reference to label '" + Name + "' is actually of type '"+
990 N->getType()->getDescription() + "'");
Anton Korobeynikovc70d7732008-02-20 12:10:37 +0000991 }
Reid Spencer93c40032007-03-19 18:40:50 +0000992 } else if (ID.Type == ValID::LocalID) {
993 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
994 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
995 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
996 else
997 GenerateError("Reference to label '%" + utostr(ID.Num) +
998 "' is actually of type '"+
999 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
1000 }
1001 } else {
1002 GenerateError("Illegal label reference " + ID.getName());
1003 return 0;
1004 }
1005
1006 // If its already been defined, return it now.
1007 if (BB) {
1008 ID.destroy(); // Free strdup'd memory.
1009 return BB;
1010 }
1011
1012 // Otherwise, this block has not been seen before, create it.
1013 std::string Name;
1014 if (ID.Type == ValID::LocalName)
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001015 Name = ID.getName();
Gabor Greife64d2482008-04-06 23:07:54 +00001016 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Reid Spencer93c40032007-03-19 18:40:50 +00001017
1018 // Insert it in the forward refs map.
1019 CurFun.BBForwardRefs[ID] = BB;
1020
Reid Spencer68a24bd2005-08-27 18:50:39 +00001021 return BB;
1022}
1023
1024
1025//===----------------------------------------------------------------------===//
1026// Code to handle forward references in instructions
1027//===----------------------------------------------------------------------===//
1028//
1029// This code handles the late binding needed with statements that reference
1030// values not defined yet... for example, a forward branch, or the PHI node for
1031// a loop body.
1032//
1033// This keeps a table (CurFun.LateResolveValues) of all such forward references
1034// and back patchs after we are done.
1035//
1036
1037// ResolveDefinitions - If we could not resolve some defs at parsing
1038// time (forward branches, phi functions for loops, etc...) resolve the
1039// defs now...
1040//
1041static void
Reid Spencer93c40032007-03-19 18:40:50 +00001042ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001043 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
Reid Spencer93c40032007-03-19 18:40:50 +00001044 while (!LateResolvers.empty()) {
1045 Value *V = LateResolvers.back();
1046 LateResolvers.pop_back();
Reid Spencer68a24bd2005-08-27 18:50:39 +00001047
Reid Spencer93c40032007-03-19 18:40:50 +00001048 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1049 CurModule.PlaceHolderInfo.find(V);
1050 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001051
Reid Spencer93c40032007-03-19 18:40:50 +00001052 ValID &DID = PHI->second.first;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001053
Reid Spencer93c40032007-03-19 18:40:50 +00001054 Value *TheRealValue = getExistingVal(V->getType(), DID);
1055 if (TriggerError)
1056 return;
1057 if (TheRealValue) {
1058 V->replaceAllUsesWith(TheRealValue);
1059 delete V;
1060 CurModule.PlaceHolderInfo.erase(PHI);
1061 } else if (FutureLateResolvers) {
1062 // Functions have their unresolved items forwarded to the module late
1063 // resolver table
1064 InsertValue(V, *FutureLateResolvers);
1065 } else {
1066 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1067 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1068 "' of type '" + V->getType()->getDescription() + "'",
1069 PHI->second.second);
Reid Spencer5b7e7532006-09-28 19:28:24 +00001070 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001071 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00001072 GenerateError("Reference to an invalid definition: #" +
1073 itostr(DID.Num) + " of type '" +
1074 V->getType()->getDescription() + "'",
1075 PHI->second.second);
1076 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001077 }
1078 }
1079 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001080 LateResolvers.clear();
1081}
1082
1083// ResolveTypeTo - A brand new type was just declared. This means that (if
1084// name is not null) things referencing Name can be resolved. Otherwise, things
1085// refering to the number can be resolved. Do this now.
1086//
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001087static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001088 ValID D;
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001089 if (Name)
1090 D = ValID::createLocalName(*Name);
1091 else
1092 D = ValID::createLocalID(CurModule.Types.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00001093
Reid Spencer861d9d62006-11-28 07:29:44 +00001094 std::map<ValID, PATypeHolder>::iterator I =
Reid Spencer68a24bd2005-08-27 18:50:39 +00001095 CurModule.LateResolveTypes.find(D);
1096 if (I != CurModule.LateResolveTypes.end()) {
Reid Spencer861d9d62006-11-28 07:29:44 +00001097 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001098 CurModule.LateResolveTypes.erase(I);
1099 }
1100}
1101
1102// setValueName - Set the specified value to the name given. The name may be
1103// null potentially, in which case this is a noop. The string passed in is
1104// assumed to be a malloc'd string buffer, and is free'd by this function.
1105//
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001106static void setValueName(Value *V, std::string *NameStr) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00001107 if (!NameStr) return;
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001108 std::string Name(*NameStr); // Copy string
1109 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001110
Reid Spencer41dff5e2007-01-26 08:05:27 +00001111 if (V->getType() == Type::VoidTy) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001112 GenerateError("Can't assign name '" + Name+"' to value with void type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00001113 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001114 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00001115
Reid Spencera9720f52007-02-05 17:04:00 +00001116 assert(inFunctionScope() && "Must be in function scope!");
Reid Spenceref9b9a72007-02-05 20:47:22 +00001117 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1118 if (ST.lookup(Name)) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00001119 GenerateError("Redefinition of value '" + Name + "' of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00001120 V->getType()->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00001121 return;
1122 }
1123
1124 // Set the name.
1125 V->setName(Name);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001126}
1127
1128/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1129/// this is a declaration, otherwise it is a definition.
Chris Lattnerb475c422005-11-12 18:22:38 +00001130static GlobalVariable *
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001131ParseGlobalVariable(std::string *NameStr,
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001132 GlobalValue::LinkageTypes Linkage,
1133 GlobalValue::VisibilityTypes Visibility,
Chris Lattnerb475c422005-11-12 18:22:38 +00001134 bool isConstantGlobal, const Type *Ty,
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001135 Constant *Initializer, bool IsThreadLocal,
1136 unsigned AddressSpace = 0) {
Reid Spencer5b7e7532006-09-28 19:28:24 +00001137 if (isa<FunctionType>(Ty)) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001138 GenerateError("Cannot declare global vars of function type");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001139 return 0;
1140 }
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001141 if (Ty == Type::LabelTy) {
1142 GenerateError("Cannot declare global vars of label type");
1143 return 0;
1144 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001145
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001146 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001147
1148 std::string Name;
1149 if (NameStr) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001150 Name = *NameStr; // Copy string
1151 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001152 }
1153
1154 // See if this global value was forward referenced. If so, recycle the
1155 // object.
1156 ValID ID;
1157 if (!Name.empty()) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001158 ID = ValID::createGlobalName(Name);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001159 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00001160 ID = ValID::createGlobalID(CurModule.Values.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00001161 }
1162
1163 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1164 // Move the global to the end of the list, from whereever it was
1165 // previously inserted.
1166 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1167 CurModule.CurrentModule->getGlobalList().remove(GV);
1168 CurModule.CurrentModule->getGlobalList().push_back(GV);
1169 GV->setInitializer(Initializer);
1170 GV->setLinkage(Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001171 GV->setVisibility(Visibility);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001172 GV->setConstant(isConstantGlobal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00001173 GV->setThreadLocal(IsThreadLocal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001174 InsertValue(GV, CurModule.Values);
Chris Lattnerb475c422005-11-12 18:22:38 +00001175 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001176 }
1177
Reid Spenceref9b9a72007-02-05 20:47:22 +00001178 // If this global has a name
Reid Spencer68a24bd2005-08-27 18:50:39 +00001179 if (!Name.empty()) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00001180 // if the global we're parsing has an initializer (is a definition) and
1181 // has external linkage.
1182 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1183 // If there is already a global with external linkage with this name
1184 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1185 // If we allow this GVar to get created, it will be renamed in the
1186 // symbol table because it conflicts with an existing GVar. We can't
1187 // allow redefinition of GVars whose linking indicates that their name
1188 // must stay the same. Issue the error.
1189 GenerateError("Redefinition of global variable named '" + Name +
1190 "' of type '" + Ty->getDescription() + "'");
1191 return 0;
1192 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001193 }
1194
1195 // Otherwise there is no existing GV to use, create one now.
1196 GlobalVariable *GV =
1197 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001198 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001199 GV->setVisibility(Visibility);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001200 InsertValue(GV, CurModule.Values);
Chris Lattnerb475c422005-11-12 18:22:38 +00001201 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001202}
1203
1204// setTypeName - Set the specified type to the name given. The name may be
1205// null potentially, in which case this is a noop. The string passed in is
1206// assumed to be a malloc'd string buffer, and is freed by this function.
1207//
1208// This function returns true if the type has already been defined, but is
1209// allowed to be redefined in the specified context. If the name is a new name
1210// for the type plane, it is inserted and false is returned.
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001211static bool setTypeName(const Type *T, std::string *NameStr) {
Reid Spencera9720f52007-02-05 17:04:00 +00001212 assert(!inFunctionScope() && "Can't give types function-local names!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001213 if (NameStr == 0) return false;
1214
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001215 std::string Name(*NameStr); // Copy string
1216 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001217
1218 // We don't allow assigning names to void type
Reid Spencer5b7e7532006-09-28 19:28:24 +00001219 if (T == Type::VoidTy) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001220 GenerateError("Can't assign name '" + Name + "' to the void type");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001221 return false;
1222 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001223
1224 // Set the type name, checking for conflicts as we do so.
1225 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1226
1227 if (AlreadyExists) { // Inserting a name that is already defined???
1228 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
Reid Spencera9720f52007-02-05 17:04:00 +00001229 assert(Existing && "Conflict but no matching type?!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001230
1231 // There is only one case where this is allowed: when we are refining an
1232 // opaque type. In this case, Existing will be an opaque type.
1233 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1234 // We ARE replacing an opaque type!
1235 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1236 return true;
1237 }
1238
1239 // Otherwise, this is an attempt to redefine a type. That's okay if
1240 // the redefinition is identical to the original. This will be so if
1241 // Existing and T point to the same Type object. In this one case we
1242 // allow the equivalent redefinition.
1243 if (Existing == T) return true; // Yes, it's equal.
1244
1245 // Any other kind of (non-equivalent) redefinition is an error.
Reid Spencer63c34452007-01-05 21:51:07 +00001246 GenerateError("Redefinition of type named '" + Name + "' of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00001247 T->getDescription() + "'");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001248 }
1249
1250 return false;
1251}
1252
1253//===----------------------------------------------------------------------===//
1254// Code for handling upreferences in type names...
1255//
1256
1257// TypeContains - Returns true if Ty directly contains E in it.
1258//
1259static bool TypeContains(const Type *Ty, const Type *E) {
1260 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1261 E) != Ty->subtype_end();
1262}
1263
1264namespace {
1265 struct UpRefRecord {
1266 // NestingLevel - The number of nesting levels that need to be popped before
1267 // this type is resolved.
1268 unsigned NestingLevel;
1269
1270 // LastContainedTy - This is the type at the current binding level for the
1271 // type. Every time we reduce the nesting level, this gets updated.
1272 const Type *LastContainedTy;
1273
1274 // UpRefTy - This is the actual opaque type that the upreference is
1275 // represented with.
1276 OpaqueType *UpRefTy;
1277
1278 UpRefRecord(unsigned NL, OpaqueType *URTy)
1279 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1280 };
1281}
1282
1283// UpRefs - A list of the outstanding upreferences that need to be resolved.
1284static std::vector<UpRefRecord> UpRefs;
1285
1286/// HandleUpRefs - Every time we finish a new layer of types, this function is
1287/// called. It loops through the UpRefs vector, which is a list of the
1288/// currently active types. For each type, if the up reference is contained in
1289/// the newly completed type, we decrement the level count. When the level
1290/// count reaches zero, the upreferenced type is the type that is passed in:
1291/// thus we can complete the cycle.
1292///
1293static PATypeHolder HandleUpRefs(const Type *ty) {
Chris Lattner224f84f2006-08-18 17:34:45 +00001294 // If Ty isn't abstract, or if there are no up-references in it, then there is
1295 // nothing to resolve here.
1296 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1297
Reid Spencer68a24bd2005-08-27 18:50:39 +00001298 PATypeHolder Ty(ty);
1299 UR_OUT("Type '" << Ty->getDescription() <<
1300 "' newly formed. Resolving upreferences.\n" <<
1301 UpRefs.size() << " upreferences active!\n");
1302
1303 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1304 // to zero), we resolve them all together before we resolve them to Ty. At
1305 // the end of the loop, if there is anything to resolve to Ty, it will be in
1306 // this variable.
1307 OpaqueType *TypeToResolve = 0;
1308
1309 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1310 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1311 << UpRefs[i].second->getDescription() << ") = "
1312 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1313 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1314 // Decrement level of upreference
1315 unsigned Level = --UpRefs[i].NestingLevel;
1316 UpRefs[i].LastContainedTy = Ty;
1317 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1318 if (Level == 0) { // Upreference should be resolved!
1319 if (!TypeToResolve) {
1320 TypeToResolve = UpRefs[i].UpRefTy;
1321 } else {
1322 UR_OUT(" * Resolving upreference for "
1323 << UpRefs[i].second->getDescription() << "\n";
1324 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1325 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1326 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1327 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1328 }
1329 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1330 --i; // Do not skip the next element...
1331 }
1332 }
1333 }
1334
1335 if (TypeToResolve) {
1336 UR_OUT(" * Resolving upreference for "
1337 << UpRefs[i].second->getDescription() << "\n";
1338 std::string OldName = TypeToResolve->getDescription());
1339 TypeToResolve->refineAbstractTypeTo(Ty);
1340 }
1341
1342 return Ty;
1343}
1344
Reid Spencer68a24bd2005-08-27 18:50:39 +00001345//===----------------------------------------------------------------------===//
1346// RunVMAsmParser - Define an interface to this parser
1347//===----------------------------------------------------------------------===//
1348//
Reid Spencer14310612006-12-31 05:40:51 +00001349static Module* RunParser(Module * M);
1350
Duncan Sandsdc024672007-11-27 13:23:08 +00001351Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1352 InitLLLexer(MB);
1353 Module *M = RunParser(new Module(LLLgetFilename()));
1354 FreeLexer();
1355 return M;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001356}
1357
1358
Dan Gohmanf4423b12008-04-19 00:24:39 +00001359
1360/* Enabling traces. */
1361#ifndef YYDEBUG
1362# define YYDEBUG 0
1363#endif
1364
1365/* Enabling verbose error messages. */
1366#ifdef YYERROR_VERBOSE
1367# undef YYERROR_VERBOSE
1368# define YYERROR_VERBOSE 1
1369#else
1370# define YYERROR_VERBOSE 0
1371#endif
1372
1373/* Enabling the token table. */
1374#ifndef YYTOKEN_TABLE
1375# define YYTOKEN_TABLE 0
1376#endif
1377
1378#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1379typedef union YYSTYPE
Chris Lattnerccef6b52008-09-23 21:18:31 +00001380#line 970 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00001381{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001382 llvm::Module *ModuleVal;
1383 llvm::Function *FunctionVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001384 llvm::BasicBlock *BasicBlockVal;
1385 llvm::TerminatorInst *TermInstVal;
1386 llvm::Instruction *InstVal;
Reid Spencera132e042006-12-03 05:46:11 +00001387 llvm::Constant *ConstVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001388
Reid Spencera132e042006-12-03 05:46:11 +00001389 const llvm::Type *PrimType;
Reid Spencer14310612006-12-31 05:40:51 +00001390 std::list<llvm::PATypeHolder> *TypeList;
Reid Spencera132e042006-12-03 05:46:11 +00001391 llvm::PATypeHolder *TypeVal;
1392 llvm::Value *ValueVal;
Reid Spencera132e042006-12-03 05:46:11 +00001393 std::vector<llvm::Value*> *ValueList;
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001394 std::vector<unsigned> *ConstantList;
Reid Spencer14310612006-12-31 05:40:51 +00001395 llvm::ArgListType *ArgList;
1396 llvm::TypeWithAttrs TypeWithAttrs;
1397 llvm::TypeWithAttrsList *TypeWithAttrsList;
Dale Johanneseneb57ea72007-11-05 21:20:28 +00001398 llvm::ParamList *ParamList;
Reid Spencer14310612006-12-31 05:40:51 +00001399
Reid Spencer68a24bd2005-08-27 18:50:39 +00001400 // Represent the RHS of PHI node
Reid Spencera132e042006-12-03 05:46:11 +00001401 std::list<std::pair<llvm::Value*,
1402 llvm::BasicBlock*> > *PHIList;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001403 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
Reid Spencera132e042006-12-03 05:46:11 +00001404 std::vector<llvm::Constant*> *ConstVector;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001405
1406 llvm::GlobalValue::LinkageTypes Linkage;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001407 llvm::GlobalValue::VisibilityTypes Visibility;
Dale Johannesen222ebf72008-02-19 21:40:51 +00001408 llvm::ParameterAttributes ParamAttrs;
Devang Pateld4980812008-09-02 20:52:40 +00001409 llvm::FunctionNotes FunctionNotes;
Reid Spencer38c91a92007-02-28 02:24:54 +00001410 llvm::APInt *APIntVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001411 int64_t SInt64Val;
1412 uint64_t UInt64Val;
1413 int SIntVal;
1414 unsigned UIntVal;
Dale Johannesencdd509a2007-09-07 21:07:57 +00001415 llvm::APFloat *FPVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001416 bool BoolVal;
1417
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001418 std::string *StrVal; // This memory must be deleted
1419 llvm::ValID ValIDVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001420
Reid Spencera132e042006-12-03 05:46:11 +00001421 llvm::Instruction::BinaryOps BinaryOpVal;
1422 llvm::Instruction::TermOps TermOpVal;
1423 llvm::Instruction::MemoryOps MemOpVal;
1424 llvm::Instruction::CastOps CastOpVal;
1425 llvm::Instruction::OtherOps OtherOpVal;
Reid Spencera132e042006-12-03 05:46:11 +00001426 llvm::ICmpInst::Predicate IPredicate;
1427 llvm::FCmpInst::Predicate FPredicate;
Dan Gohmanf4423b12008-04-19 00:24:39 +00001428}
Dan Gohman180c1692008-06-23 18:43:26 +00001429/* Line 193 of yacc.c. */
Devang Pateld4980812008-09-02 20:52:40 +00001430#line 1431 "llvmAsmParser.tab.c"
Dan Gohmanf4423b12008-04-19 00:24:39 +00001431 YYSTYPE;
1432# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1433# define YYSTYPE_IS_DECLARED 1
1434# define YYSTYPE_IS_TRIVIAL 1
Reid Spencer68a24bd2005-08-27 18:50:39 +00001435#endif
1436
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001437
Reid Spencer68a24bd2005-08-27 18:50:39 +00001438
Dan Gohmanf4423b12008-04-19 00:24:39 +00001439/* Copy the second part of user declarations. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001440
1441
Dan Gohmanf4423b12008-04-19 00:24:39 +00001442/* Line 216 of yacc.c. */
Devang Pateld4980812008-09-02 20:52:40 +00001443#line 1444 "llvmAsmParser.tab.c"
Reid Spencerb8f85052007-07-31 03:50:36 +00001444
Dan Gohmanf4423b12008-04-19 00:24:39 +00001445#ifdef short
1446# undef short
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001447#endif
1448
Dan Gohmanf4423b12008-04-19 00:24:39 +00001449#ifdef YYTYPE_UINT8
1450typedef YYTYPE_UINT8 yytype_uint8;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001451#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00001452typedef unsigned char yytype_uint8;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001453#endif
1454
Dan Gohmanf4423b12008-04-19 00:24:39 +00001455#ifdef YYTYPE_INT8
1456typedef YYTYPE_INT8 yytype_int8;
1457#elif (defined __STDC__ || defined __C99__FUNC__ \
1458 || defined __cplusplus || defined _MSC_VER)
1459typedef signed char yytype_int8;
1460#else
1461typedef short int yytype_int8;
1462#endif
1463
1464#ifdef YYTYPE_UINT16
1465typedef YYTYPE_UINT16 yytype_uint16;
1466#else
1467typedef unsigned short int yytype_uint16;
1468#endif
1469
1470#ifdef YYTYPE_INT16
1471typedef YYTYPE_INT16 yytype_int16;
1472#else
1473typedef short int yytype_int16;
1474#endif
1475
1476#ifndef YYSIZE_T
1477# ifdef __SIZE_TYPE__
1478# define YYSIZE_T __SIZE_TYPE__
1479# elif defined size_t
1480# define YYSIZE_T size_t
1481# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1482 || defined __cplusplus || defined _MSC_VER)
1483# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1484# define YYSIZE_T size_t
1485# else
1486# define YYSIZE_T unsigned int
1487# endif
1488#endif
1489
1490#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1491
1492#ifndef YY_
Dan Gohman180c1692008-06-23 18:43:26 +00001493# if defined YYENABLE_NLS && YYENABLE_NLS
Dan Gohmanf4423b12008-04-19 00:24:39 +00001494# if ENABLE_NLS
1495# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1496# define YY_(msgid) dgettext ("bison-runtime", msgid)
1497# endif
1498# endif
1499# ifndef YY_
1500# define YY_(msgid) msgid
1501# endif
1502#endif
1503
1504/* Suppress unused-variable warnings by "using" E. */
1505#if ! defined lint || defined __GNUC__
1506# define YYUSE(e) ((void) (e))
1507#else
1508# define YYUSE(e) /* empty */
1509#endif
1510
1511/* Identity function, used to suppress warnings about constant conditions. */
1512#ifndef lint
1513# define YYID(n) (n)
1514#else
1515#if (defined __STDC__ || defined __C99__FUNC__ \
1516 || defined __cplusplus || defined _MSC_VER)
1517static int
1518YYID (int i)
1519#else
1520static int
1521YYID (i)
1522 int i;
1523#endif
1524{
1525 return i;
1526}
1527#endif
1528
1529#if ! defined yyoverflow || YYERROR_VERBOSE
1530
1531/* The parser invokes alloca or malloc; define the necessary symbols. */
1532
1533# ifdef YYSTACK_USE_ALLOCA
1534# if YYSTACK_USE_ALLOCA
1535# ifdef __GNUC__
1536# define YYSTACK_ALLOC __builtin_alloca
1537# elif defined __BUILTIN_VA_ARG_INCR
1538# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1539# elif defined _AIX
1540# define YYSTACK_ALLOC __alloca
1541# elif defined _MSC_VER
1542# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1543# define alloca _alloca
1544# else
1545# define YYSTACK_ALLOC alloca
1546# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1547 || defined __cplusplus || defined _MSC_VER)
1548# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1549# ifndef _STDLIB_H
1550# define _STDLIB_H 1
1551# endif
1552# endif
1553# endif
1554# endif
1555# endif
1556
1557# ifdef YYSTACK_ALLOC
1558 /* Pacify GCC's `empty if-body' warning. */
1559# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1560# ifndef YYSTACK_ALLOC_MAXIMUM
1561 /* The OS might guarantee only one guard page at the bottom of the stack,
1562 and a page size can be as small as 4096 bytes. So we cannot safely
1563 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1564 to allow for a few compiler-allocated temporary stack slots. */
1565# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1566# endif
1567# else
1568# define YYSTACK_ALLOC YYMALLOC
1569# define YYSTACK_FREE YYFREE
1570# ifndef YYSTACK_ALLOC_MAXIMUM
1571# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1572# endif
1573# if (defined __cplusplus && ! defined _STDLIB_H \
1574 && ! ((defined YYMALLOC || defined malloc) \
1575 && (defined YYFREE || defined free)))
1576# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1577# ifndef _STDLIB_H
1578# define _STDLIB_H 1
1579# endif
1580# endif
1581# ifndef YYMALLOC
1582# define YYMALLOC malloc
1583# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1584 || defined __cplusplus || defined _MSC_VER)
1585void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1586# endif
1587# endif
1588# ifndef YYFREE
1589# define YYFREE free
1590# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1591 || defined __cplusplus || defined _MSC_VER)
1592void free (void *); /* INFRINGES ON USER NAME SPACE */
1593# endif
1594# endif
1595# endif
1596#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1597
1598
1599#if (! defined yyoverflow \
1600 && (! defined __cplusplus \
1601 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1602
1603/* A type that is properly aligned for any stack member. */
1604union yyalloc
1605{
1606 yytype_int16 yyss;
1607 YYSTYPE yyvs;
1608 };
1609
1610/* The size of the maximum gap between one aligned stack and the next. */
1611# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1612
1613/* The size of an array large to enough to hold all stacks, each with
1614 N elements. */
1615# define YYSTACK_BYTES(N) \
1616 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1617 + YYSTACK_GAP_MAXIMUM)
1618
1619/* Copy COUNT objects from FROM to TO. The source and destination do
1620 not overlap. */
1621# ifndef YYCOPY
1622# if defined __GNUC__ && 1 < __GNUC__
1623# define YYCOPY(To, From, Count) \
1624 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1625# else
1626# define YYCOPY(To, From, Count) \
1627 do \
1628 { \
1629 YYSIZE_T yyi; \
1630 for (yyi = 0; yyi < (Count); yyi++) \
1631 (To)[yyi] = (From)[yyi]; \
1632 } \
1633 while (YYID (0))
1634# endif
1635# endif
1636
1637/* Relocate STACK from its old location to the new one. The
1638 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1639 elements in the stack, and YYPTR gives the new location of the
1640 stack. Advance YYPTR to a properly aligned location for the next
1641 stack. */
1642# define YYSTACK_RELOCATE(Stack) \
1643 do \
1644 { \
1645 YYSIZE_T yynewbytes; \
1646 YYCOPY (&yyptr->Stack, Stack, yysize); \
1647 Stack = &yyptr->Stack; \
1648 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1649 yyptr += yynewbytes / sizeof (*yyptr); \
1650 } \
1651 while (YYID (0))
1652
1653#endif
1654
1655/* YYFINAL -- State number of the termination state. */
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001656#define YYFINAL 44
Dan Gohmanf4423b12008-04-19 00:24:39 +00001657/* YYLAST -- Last index in YYTABLE. */
Chris Lattnerccef6b52008-09-23 21:18:31 +00001658#define YYLAST 2384
Dan Gohmanf4423b12008-04-19 00:24:39 +00001659
1660/* YYNTOKENS -- Number of terminals. */
Devang Pateld4980812008-09-02 20:52:40 +00001661#define YYNTOKENS 176
Dan Gohmanf4423b12008-04-19 00:24:39 +00001662/* YYNNTS -- Number of nonterminals. */
Devang Pateld4980812008-09-02 20:52:40 +00001663#define YYNNTS 90
Dan Gohmanf4423b12008-04-19 00:24:39 +00001664/* YYNRULES -- Number of rules. */
Chris Lattnerccef6b52008-09-23 21:18:31 +00001665#define YYNRULES 354
Dan Gohmanf4423b12008-04-19 00:24:39 +00001666/* YYNRULES -- Number of states. */
Chris Lattnerccef6b52008-09-23 21:18:31 +00001667#define YYNSTATES 721
Dan Gohmanf4423b12008-04-19 00:24:39 +00001668
1669/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1670#define YYUNDEFTOK 2
Devang Pateld4980812008-09-02 20:52:40 +00001671#define YYMAXUTOK 416
Dan Gohmanf4423b12008-04-19 00:24:39 +00001672
1673#define YYTRANSLATE(YYX) \
1674 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1675
1676/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1677static const yytype_uint8 yytranslate[] =
1678{
1679 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1680 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1681 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1682 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Pateld4980812008-09-02 20:52:40 +00001683 162, 163, 166, 2, 165, 2, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001684 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Pateld4980812008-09-02 20:52:40 +00001685 171, 164, 172, 2, 2, 2, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001686 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1687 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Pateld4980812008-09-02 20:52:40 +00001688 2, 168, 167, 170, 2, 2, 2, 2, 2, 175,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001689 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1690 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Pateld4980812008-09-02 20:52:40 +00001691 169, 2, 2, 173, 2, 174, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001692 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1693 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1694 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1695 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1696 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1697 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1698 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1699 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1700 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1701 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1702 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1703 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1704 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1705 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1706 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1707 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1708 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1709 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1710 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1711 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1712 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1713 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1714 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1715 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1716 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1717 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1718 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001719 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
Devang Pateld4980812008-09-02 20:52:40 +00001720 155, 156, 157, 158, 159, 160, 161
Dan Gohmanf4423b12008-04-19 00:24:39 +00001721};
1722
1723#if YYDEBUG
1724/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1725 YYRHS. */
1726static const yytype_uint16 yyprhs[] =
1727{
1728 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1729 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1730 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1731 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1732 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1733 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1734 119, 121, 123, 125, 127, 129, 130, 135, 136, 139,
Chris Lattner15bd0952008-08-29 17:20:18 +00001735 140, 143, 145, 147, 149, 150, 153, 155, 157, 159,
1736 161, 163, 165, 167, 169, 171, 172, 174, 176, 178,
1737 179, 181, 183, 184, 186, 188, 190, 192, 193, 195,
1738 197, 198, 200, 202, 204, 206, 208, 210, 213, 215,
1739 217, 219, 221, 223, 225, 227, 229, 231, 234, 235,
Chris Lattnerccef6b52008-09-23 21:18:31 +00001740 238, 240, 242, 244, 246, 248, 250, 252, 253, 256,
1741 258, 262, 266, 270, 272, 273, 278, 279, 282, 283,
1742 286, 287, 291, 294, 295, 297, 298, 302, 304, 307,
1743 309, 311, 313, 315, 317, 319, 321, 323, 325, 329,
1744 331, 334, 340, 346, 352, 358, 362, 365, 371, 376,
1745 379, 381, 383, 385, 389, 391, 395, 397, 398, 400,
1746 404, 409, 413, 417, 422, 427, 431, 438, 444, 447,
1747 450, 453, 456, 459, 462, 465, 468, 471, 474, 477,
1748 480, 487, 493, 502, 509, 516, 524, 532, 540, 548,
1749 555, 564, 573, 579, 587, 591, 593, 595, 597, 599,
1750 600, 603, 610, 612, 613, 615, 618, 619, 623, 624,
1751 628, 632, 636, 640, 641, 650, 651, 661, 662, 672,
1752 678, 681, 685, 687, 691, 695, 699, 703, 705, 706,
1753 712, 716, 718, 722, 724, 725, 737, 739, 741, 746,
1754 748, 750, 753, 757, 758, 760, 762, 764, 766, 768,
1755 770, 772, 774, 776, 778, 780, 784, 788, 791, 794,
1756 798, 801, 807, 812, 814, 820, 822, 824, 826, 828,
1757 830, 832, 835, 837, 841, 844, 847, 851, 855, 858,
1758 859, 861, 864, 867, 871, 881, 891, 900, 915, 917,
1759 919, 926, 932, 935, 938, 945, 953, 958, 963, 970,
1760 977, 978, 979, 983, 986, 990, 993, 995, 1001, 1007,
1761 1014, 1021, 1028, 1035, 1040, 1047, 1052, 1057, 1064, 1071,
1762 1074, 1083, 1085, 1087, 1088, 1092, 1099, 1103, 1110, 1113,
1763 1119, 1127, 1133, 1138, 1143
Dan Gohmanf4423b12008-04-19 00:24:39 +00001764};
1765
1766/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1767static const yytype_int16 yyrhs[] =
1768{
Devang Pateld4980812008-09-02 20:52:40 +00001769 226, 0, -1, 76, -1, 77, -1, 78, -1, 79,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00001770 -1, 80, -1, 81, -1, 82, -1, 83, -1, 84,
1771 -1, 88, -1, 89, -1, 90, -1, 85, -1, 86,
1772 -1, 87, -1, 121, -1, 122, -1, 123, -1, 124,
1773 -1, 125, -1, 126, -1, 127, -1, 128, -1, 129,
1774 -1, 130, -1, 131, -1, 132, -1, 95, -1, 96,
1775 -1, 97, -1, 98, -1, 99, -1, 100, -1, 101,
1776 -1, 102, -1, 103, -1, 104, -1, 105, -1, 106,
1777 -1, 107, -1, 108, -1, 109, -1, 110, -1, 111,
1778 -1, 112, -1, 113, -1, 114, -1, 101, -1, 102,
1779 -1, 103, -1, 104, -1, 26, -1, 27, -1, 11,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001780 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
Devang Pateld4980812008-09-02 20:52:40 +00001781 -1, 19, -1, 22, -1, 24, -1, 184, -1, -1,
1782 55, 162, 4, 163, -1, -1, 184, 164, -1, -1,
1783 7, 164, -1, 20, -1, 23, -1, 191, -1, -1,
1784 189, 164, -1, 42, -1, 44, -1, 43, -1, 45,
Chris Lattner15bd0952008-08-29 17:20:18 +00001785 -1, 47, -1, 49, -1, 46, -1, 48, -1, 51,
Devang Pateld4980812008-09-02 20:52:40 +00001786 -1, -1, 159, -1, 160, -1, 161, -1, -1, 46,
Chris Lattner15bd0952008-08-29 17:20:18 +00001787 -1, 48, -1, -1, 42, -1, 43, -1, 44, -1,
1788 47, -1, -1, 44, -1, 42, -1, -1, 63, -1,
1789 64, -1, 65, -1, 66, -1, 67, -1, 68, -1,
1790 62, 4, -1, 143, -1, 122, -1, 142, -1, 123,
1791 -1, 145, -1, 146, -1, 148, -1, 149, -1, 150,
Devang Pateld4980812008-09-02 20:52:40 +00001792 -1, 54, 4, -1, -1, 200, 199, -1, 144, -1,
Chris Lattnerccef6b52008-09-23 21:18:31 +00001793 147, -1, 145, -1, 143, -1, 142, -1, 151, -1,
1794 152, -1, -1, 202, 201, -1, 204, -1, 203, 165,
1795 204, -1, 155, 164, 157, -1, 155, 164, 156, -1,
1796 158, -1, -1, 154, 162, 203, 163, -1, -1, 153,
1797 22, -1, -1, 54, 4, -1, -1, 165, 54, 4,
1798 -1, 34, 22, -1, -1, 209, -1, -1, 165, 212,
1799 211, -1, 209, -1, 54, 4, -1, 11, -1, 12,
1800 -1, 13, -1, 16, -1, 15, -1, 14, -1, 17,
1801 -1, 50, -1, 213, -1, 214, 186, 166, -1, 248,
1802 -1, 167, 4, -1, 214, 162, 218, 163, 202, -1,
1803 10, 162, 218, 163, 202, -1, 168, 4, 169, 214,
1804 170, -1, 171, 4, 169, 214, 172, -1, 173, 219,
1805 174, -1, 173, 174, -1, 171, 173, 219, 174, 172,
1806 -1, 171, 173, 174, 172, -1, 214, 200, -1, 214,
1807 -1, 10, -1, 215, -1, 217, 165, 215, -1, 217,
1808 -1, 217, 165, 39, -1, 39, -1, -1, 214, -1,
1809 219, 165, 214, -1, 214, 168, 222, 170, -1, 214,
1810 168, 170, -1, 214, 175, 22, -1, 214, 171, 222,
1811 172, -1, 214, 173, 222, 174, -1, 214, 173, 174,
1812 -1, 214, 171, 173, 222, 174, 172, -1, 214, 171,
1813 173, 174, 172, -1, 214, 40, -1, 214, 41, -1,
1814 214, 248, -1, 214, 221, -1, 214, 25, -1, 182,
1815 3, -1, 182, 5, -1, 182, 4, -1, 182, 6,
1816 -1, 11, 26, -1, 11, 27, -1, 183, 9, -1,
1817 179, 162, 220, 38, 214, 163, -1, 120, 162, 220,
1818 260, 163, -1, 134, 162, 220, 165, 220, 165, 220,
1819 163, -1, 177, 162, 220, 165, 220, 163, -1, 178,
1820 162, 220, 165, 220, 163, -1, 91, 180, 162, 220,
1821 165, 220, 163, -1, 92, 181, 162, 220, 165, 220,
1822 163, -1, 93, 180, 162, 220, 165, 220, 163, -1,
1823 94, 181, 162, 220, 165, 220, 163, -1, 136, 162,
1824 220, 165, 220, 163, -1, 137, 162, 220, 165, 220,
1825 165, 220, 163, -1, 138, 162, 220, 165, 220, 165,
1826 220, 163, -1, 140, 162, 220, 261, 163, -1, 141,
1827 162, 220, 165, 220, 261, 163, -1, 222, 165, 220,
1828 -1, 220, -1, 32, -1, 33, -1, 37, -1, -1,
1829 216, 248, -1, 126, 162, 225, 38, 214, 163, -1,
1830 227, -1, -1, 228, -1, 227, 228, -1, -1, 31,
1831 229, 244, -1, -1, 30, 230, 245, -1, 60, 59,
1832 234, -1, 187, 18, 214, -1, 187, 18, 10, -1,
1833 -1, 190, 194, 224, 223, 220, 186, 231, 211, -1,
1834 -1, 190, 192, 194, 224, 223, 220, 186, 232, 211,
1835 -1, -1, 190, 193, 194, 224, 223, 214, 186, 233,
1836 211, -1, 190, 194, 35, 197, 225, -1, 52, 235,
1837 -1, 56, 164, 236, -1, 22, -1, 53, 164, 22,
1838 -1, 69, 164, 22, -1, 168, 237, 170, -1, 237,
1839 165, 22, -1, 22, -1, -1, 238, 165, 214, 200,
1840 185, -1, 214, 200, 185, -1, 238, -1, 238, 165,
1841 39, -1, 39, -1, -1, 198, 216, 189, 162, 239,
1842 163, 202, 210, 207, 206, 205, -1, 28, -1, 173,
1843 -1, 196, 194, 240, 241, -1, 29, -1, 174, -1,
1844 252, 243, -1, 195, 194, 240, -1, -1, 61, -1,
1845 3, -1, 4, -1, 5, -1, 6, -1, 9, -1,
1846 26, -1, 27, -1, 40, -1, 41, -1, 25, -1,
1847 171, 222, 172, -1, 168, 222, 170, -1, 168, 170,
1848 -1, 175, 22, -1, 173, 222, 174, -1, 173, 174,
1849 -1, 171, 173, 222, 174, 172, -1, 171, 173, 174,
1850 172, -1, 221, -1, 59, 246, 22, 165, 22, -1,
1851 7, -1, 8, -1, 184, -1, 189, -1, 248, -1,
1852 247, -1, 214, 249, -1, 250, -1, 251, 165, 250,
1853 -1, 252, 253, -1, 242, 253, -1, 254, 187, 255,
1854 -1, 254, 188, 255, -1, 254, 257, -1, -1, 21,
1855 -1, 70, 251, -1, 70, 10, -1, 71, 17, 249,
1856 -1, 71, 11, 249, 165, 17, 249, 165, 17, 249,
1857 -1, 72, 182, 249, 165, 17, 249, 168, 256, 170,
1858 -1, 72, 182, 249, 165, 17, 249, 168, 170, -1,
1859 73, 198, 216, 249, 162, 259, 163, 202, 38, 17,
1860 249, 74, 17, 249, -1, 74, -1, 75, -1, 256,
1861 182, 247, 165, 17, 249, -1, 182, 247, 165, 17,
1862 249, -1, 187, 263, -1, 188, 263, -1, 214, 168,
1863 249, 165, 249, 170, -1, 258, 165, 168, 249, 165,
1864 249, 170, -1, 214, 200, 249, 200, -1, 17, 200,
1865 249, 200, -1, 259, 165, 214, 200, 249, 200, -1,
1866 259, 165, 17, 200, 249, 200, -1, -1, -1, 260,
1867 165, 250, -1, 165, 4, -1, 261, 165, 4, -1,
1868 58, 57, -1, 57, -1, 177, 214, 249, 165, 249,
1869 -1, 178, 214, 249, 165, 249, -1, 91, 180, 214,
1870 249, 165, 249, -1, 92, 181, 214, 249, 165, 249,
1871 -1, 93, 180, 214, 249, 165, 249, -1, 94, 181,
1872 214, 249, 165, 249, -1, 179, 250, 38, 214, -1,
1873 134, 250, 165, 250, 165, 250, -1, 135, 250, 165,
1874 214, -1, 136, 250, 165, 250, -1, 137, 250, 165,
1875 250, 165, 250, -1, 138, 250, 165, 250, 165, 250,
1876 -1, 133, 258, -1, 262, 198, 216, 249, 162, 259,
1877 163, 202, -1, 265, -1, 36, -1, -1, 115, 214,
1878 208, -1, 115, 214, 165, 11, 249, 208, -1, 116,
1879 214, 208, -1, 116, 214, 165, 11, 249, 208, -1,
1880 117, 250, -1, 264, 118, 214, 249, 208, -1, 264,
1881 119, 250, 165, 214, 249, 208, -1, 139, 214, 249,
1882 165, 4, -1, 120, 214, 249, 260, -1, 140, 214,
1883 249, 261, -1, 141, 214, 249, 165, 214, 249, 261,
1884 -1
Dan Gohmanf4423b12008-04-19 00:24:39 +00001885};
1886
1887/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1888static const yytype_uint16 yyrline[] =
1889{
Devang Pateld4980812008-09-02 20:52:40 +00001890 0, 1142, 1142, 1142, 1142, 1142, 1142, 1142, 1142, 1142,
1891 1142, 1143, 1143, 1143, 1143, 1143, 1143, 1144, 1144, 1144,
1892 1144, 1144, 1144, 1145, 1145, 1145, 1145, 1145, 1145, 1148,
1893 1148, 1149, 1149, 1150, 1150, 1151, 1151, 1152, 1152, 1156,
1894 1156, 1157, 1157, 1158, 1158, 1159, 1159, 1160, 1160, 1161,
1895 1161, 1162, 1162, 1163, 1164, 1169, 1170, 1170, 1170, 1170,
1896 1170, 1172, 1172, 1172, 1173, 1173, 1175, 1176, 1180, 1184,
1897 1189, 1195, 1195, 1197, 1198, 1203, 1209, 1210, 1211, 1212,
1898 1213, 1214, 1218, 1219, 1220, 1224, 1225, 1226, 1227, 1231,
1899 1232, 1233, 1237, 1238, 1239, 1240, 1241, 1245, 1246, 1247,
1900 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1264, 1265,
1901 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1277, 1278,
Chris Lattnerccef6b52008-09-23 21:18:31 +00001902 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1292, 1293, 1298,
1903 1299, 1310, 1311, 1312, 1315, 1316, 1321, 1322, 1329, 1330,
1904 1336, 1337, 1346, 1354, 1355, 1360, 1361, 1362, 1367, 1380,
1905 1380, 1380, 1380, 1380, 1380, 1380, 1383, 1387, 1391, 1398,
1906 1403, 1411, 1440, 1465, 1470, 1480, 1490, 1494, 1504, 1511,
1907 1520, 1527, 1532, 1537, 1544, 1545, 1552, 1559, 1567, 1573,
1908 1585, 1613, 1629, 1656, 1684, 1710, 1730, 1756, 1776, 1788,
1909 1795, 1861, 1871, 1881, 1887, 1897, 1903, 1913, 1919, 1925,
1910 1938, 1950, 1971, 1979, 1985, 1996, 2001, 2006, 2011, 2016,
1911 2022, 2028, 2034, 2042, 2053, 2057, 2065, 2065, 2068, 2068,
1912 2071, 2083, 2104, 2109, 2117, 2118, 2122, 2122, 2126, 2126,
1913 2129, 2132, 2156, 2168, 2167, 2179, 2178, 2188, 2187, 2198,
1914 2238, 2241, 2247, 2257, 2261, 2266, 2268, 2273, 2278, 2287,
1915 2297, 2308, 2312, 2321, 2330, 2335, 2467, 2467, 2469, 2478,
1916 2478, 2480, 2485, 2497, 2501, 2506, 2510, 2514, 2519, 2524,
1917 2528, 2532, 2536, 2540, 2544, 2548, 2570, 2592, 2598, 2611,
1918 2623, 2628, 2640, 2646, 2650, 2660, 2664, 2668, 2673, 2680,
1919 2680, 2686, 2695, 2700, 2705, 2709, 2718, 2727, 2740, 2749,
1920 2753, 2761, 2781, 2785, 2790, 2801, 2820, 2829, 2915, 2919,
1921 2926, 2937, 2950, 2959, 2972, 2983, 2993, 3004, 3012, 3022,
1922 3029, 3032, 3033, 3041, 3047, 3056, 3060, 3065, 3081, 3098,
1923 3110, 3122, 3136, 3150, 3162, 3183, 3190, 3196, 3202, 3208,
1924 3223, 3313, 3318, 3322, 3329, 3336, 3346, 3353, 3363, 3371,
1925 3385, 3402, 3416, 3431, 3446
Dan Gohmanf4423b12008-04-19 00:24:39 +00001926};
1927#endif
1928
1929#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1930/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1931 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1932static const char *const yytname[] =
1933{
1934 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1935 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1936 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1937 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1938 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1939 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1940 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1941 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001942 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "COMMON", "OPAQUE",
Dan Gohmanf4423b12008-04-19 00:24:39 +00001943 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1944 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1945 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
Dale Johannesen20ab78b2008-08-13 18:41:46 +00001946 "X86_SSECALLCC_TOK", "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE",
1947 "UNWIND", "UNREACHABLE", "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV",
1948 "UREM", "SREM", "FREM", "AND", "OR", "XOR", "SHL", "LSHR", "ASHR",
1949 "ICMP", "FCMP", "VICMP", "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE",
1950 "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE",
1951 "ORD", "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE",
1952 "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST",
1953 "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT",
1954 "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT",
1955 "SHUFFLEVECTOR", "GETRESULT", "EXTRACTVALUE", "INSERTVALUE", "SIGNEXT",
1956 "ZEROEXT", "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL",
Devang Pateld4980812008-09-02 20:52:40 +00001957 "NEST", "READNONE", "READONLY", "GC", "FNNOTE", "INLINE", "ALWAYS",
1958 "NEVER", "OPTIMIZEFORSIZE", "DEFAULT", "HIDDEN", "PROTECTED", "'('",
1959 "')'", "'='", "','", "'*'", "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'",
1960 "'{'", "'}'", "'c'", "$accept", "ArithmeticOps", "LogicalOps", "CastOps",
1961 "IPredicates", "FPredicates", "IntType", "FPType", "LocalName",
1962 "OptLocalName", "OptAddrSpace", "OptLocalAssign", "LocalNumber",
1963 "GlobalName", "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
1964 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1965 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr",
1966 "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "FuncNoteList", "FuncNote",
1967 "OptFuncNotes", "OptGC", "OptAlign", "OptCAlign", "SectionString",
Chris Lattner15bd0952008-08-29 17:20:18 +00001968 "OptSection", "GlobalVarAttributes", "GlobalVarAttribute", "PrimType",
1969 "Types", "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI",
1970 "TypeListI", "ConstVal", "ConstExpr", "ConstVector", "GlobalType",
1971 "ThreadLocal", "AliaseeRef", "Module", "DefinitionList", "Definition",
1972 "@1", "@2", "@3", "@4", "@5", "AsmBlock", "TargetDefinition",
1973 "LibrariesDefinition", "LibList", "ArgListH", "ArgList",
1974 "FunctionHeaderH", "BEGIN", "FunctionHeader", "END", "Function",
1975 "FunctionProto", "OptSideEffect", "ConstValueRef", "SymbolicValueRef",
1976 "ValueRef", "ResolvedVal", "ReturnedVal", "BasicBlockList", "BasicBlock",
1977 "InstructionList", "BBTerminatorInst", "JumpTable", "Inst", "PHIList",
1978 "ParamList", "IndexList", "ConstantIndexList", "OptTailCall", "InstVal",
1979 "OptVolatile", "MemoryInst", 0
Dan Gohmanf4423b12008-04-19 00:24:39 +00001980};
1981#endif
1982
1983# ifdef YYPRINT
1984/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1985 token YYLEX-NUM. */
1986static const yytype_uint16 yytoknum[] =
1987{
1988 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1989 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1990 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1991 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1992 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1993 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1994 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1995 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1996 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1997 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1998 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1999 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
2000 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
2001 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
2002 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
Devang Pateld4980812008-09-02 20:52:40 +00002003 405, 406, 407, 408, 409, 410, 411, 412, 413, 414,
2004 415, 416, 40, 41, 61, 44, 42, 92, 91, 120,
2005 93, 60, 62, 123, 125, 99
Dan Gohmanf4423b12008-04-19 00:24:39 +00002006};
2007# endif
2008
2009/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002010static const yytype_uint16 yyr1[] =
Dan Gohmanf4423b12008-04-19 00:24:39 +00002011{
Devang Pateld4980812008-09-02 20:52:40 +00002012 0, 176, 177, 177, 177, 177, 177, 177, 177, 177,
2013 177, 178, 178, 178, 178, 178, 178, 179, 179, 179,
2014 179, 179, 179, 179, 179, 179, 179, 179, 179, 180,
2015 180, 180, 180, 180, 180, 180, 180, 180, 180, 181,
2016 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
2017 181, 181, 181, 181, 181, 182, 183, 183, 183, 183,
2018 183, 184, 184, 184, 185, 185, 186, 186, 187, 187,
2019 188, 189, 189, 190, 190, 191, 192, 192, 192, 192,
2020 192, 192, 193, 193, 193, 194, 194, 194, 194, 195,
2021 195, 195, 196, 196, 196, 196, 196, 197, 197, 197,
2022 198, 198, 198, 198, 198, 198, 198, 198, 199, 199,
2023 199, 199, 199, 199, 199, 199, 199, 199, 200, 200,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002024 201, 201, 201, 201, 201, 201, 201, 202, 202, 203,
2025 203, 204, 204, 204, 205, 205, 206, 206, 207, 207,
2026 208, 208, 209, 210, 210, 211, 211, 212, 212, 213,
2027 213, 213, 213, 213, 213, 213, 214, 214, 214, 214,
2028 214, 214, 214, 214, 214, 214, 214, 214, 214, 215,
2029 216, 216, 217, 217, 218, 218, 218, 218, 219, 219,
Devang Pateld4980812008-09-02 20:52:40 +00002030 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002031 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,
Devang Pateld4980812008-09-02 20:52:40 +00002032 221, 221, 221, 221, 221, 221, 221, 221, 221, 221,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002033 221, 221, 221, 221, 222, 222, 223, 223, 224, 224,
2034 225, 225, 226, 226, 227, 227, 229, 228, 230, 228,
2035 228, 228, 228, 231, 228, 232, 228, 233, 228, 228,
2036 228, 228, 234, 235, 235, 236, 237, 237, 237, 238,
2037 238, 239, 239, 239, 239, 240, 241, 241, 242, 243,
2038 243, 244, 245, 246, 246, 247, 247, 247, 247, 247,
Devang Pateld4980812008-09-02 20:52:40 +00002039 247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002040 247, 247, 247, 247, 247, 248, 248, 248, 248, 249,
2041 249, 250, 251, 251, 252, 252, 253, 253, 254, 254,
2042 254, 255, 255, 255, 255, 255, 255, 255, 255, 255,
2043 256, 256, 257, 257, 258, 258, 259, 259, 259, 259,
2044 259, 260, 260, 261, 261, 262, 262, 263, 263, 263,
Devang Pateld4980812008-09-02 20:52:40 +00002045 263, 263, 263, 263, 263, 263, 263, 263, 263, 263,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002046 263, 263, 264, 264, 265, 265, 265, 265, 265, 265,
2047 265, 265, 265, 265, 265
Dan Gohmanf4423b12008-04-19 00:24:39 +00002048};
2049
2050/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
2051static const yytype_uint8 yyr2[] =
2052{
2053 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
2054 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2055 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2056 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2057 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2058 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2059 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
Chris Lattner15bd0952008-08-29 17:20:18 +00002060 2, 1, 1, 1, 0, 2, 1, 1, 1, 1,
2061 1, 1, 1, 1, 1, 0, 1, 1, 1, 0,
2062 1, 1, 0, 1, 1, 1, 1, 0, 1, 1,
2063 0, 1, 1, 1, 1, 1, 1, 2, 1, 1,
2064 1, 1, 1, 1, 1, 1, 1, 2, 0, 2,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002065 1, 1, 1, 1, 1, 1, 1, 0, 2, 1,
2066 3, 3, 3, 1, 0, 4, 0, 2, 0, 2,
2067 0, 3, 2, 0, 1, 0, 3, 1, 2, 1,
2068 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
2069 2, 5, 5, 5, 5, 3, 2, 5, 4, 2,
2070 1, 1, 1, 3, 1, 3, 1, 0, 1, 3,
2071 4, 3, 3, 4, 4, 3, 6, 5, 2, 2,
2072 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2073 6, 5, 8, 6, 6, 7, 7, 7, 7, 6,
2074 8, 8, 5, 7, 3, 1, 1, 1, 1, 0,
2075 2, 6, 1, 0, 1, 2, 0, 3, 0, 3,
2076 3, 3, 3, 0, 8, 0, 9, 0, 9, 5,
2077 2, 3, 1, 3, 3, 3, 3, 1, 0, 5,
2078 3, 1, 3, 1, 0, 11, 1, 1, 4, 1,
2079 1, 2, 3, 0, 1, 1, 1, 1, 1, 1,
2080 1, 1, 1, 1, 1, 3, 3, 2, 2, 3,
2081 2, 5, 4, 1, 5, 1, 1, 1, 1, 1,
2082 1, 2, 1, 3, 2, 2, 3, 3, 2, 0,
2083 1, 2, 2, 3, 9, 9, 8, 14, 1, 1,
2084 6, 5, 2, 2, 6, 7, 4, 4, 6, 6,
2085 0, 0, 3, 2, 3, 2, 1, 5, 5, 6,
2086 6, 6, 6, 4, 6, 4, 4, 6, 6, 2,
2087 8, 1, 1, 0, 3, 6, 3, 6, 2, 5,
2088 7, 5, 4, 4, 7
Dan Gohmanf4423b12008-04-19 00:24:39 +00002089};
2090
2091/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2092 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2093 means the default is an error. */
2094static const yytype_uint16 yydefact[] =
2095{
Chris Lattnerccef6b52008-09-23 21:18:31 +00002096 74, 61, 71, 62, 72, 63, 228, 226, 0, 0,
2097 0, 0, 0, 0, 85, 73, 0, 74, 224, 89,
2098 92, 0, 0, 240, 0, 0, 68, 0, 75, 76,
Chris Lattner15bd0952008-08-29 17:20:18 +00002099 78, 77, 79, 82, 80, 83, 81, 84, 86, 87,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002100 88, 85, 85, 219, 1, 225, 90, 91, 85, 229,
2101 93, 94, 95, 96, 85, 299, 227, 299, 0, 0,
2102 248, 241, 242, 230, 285, 286, 232, 149, 150, 151,
2103 154, 153, 152, 155, 156, 0, 0, 0, 0, 287,
2104 288, 157, 231, 159, 219, 219, 97, 218, 0, 100,
2105 100, 300, 295, 69, 259, 260, 261, 294, 243, 244,
2106 247, 0, 177, 160, 0, 0, 0, 0, 166, 178,
2107 0, 0, 177, 0, 0, 0, 99, 98, 0, 216,
2108 217, 0, 0, 101, 102, 103, 104, 105, 106, 0,
2109 262, 0, 0, 343, 343, 298, 0, 245, 176, 118,
2110 172, 174, 0, 0, 0, 0, 0, 0, 165, 0,
2111 0, 158, 0, 0, 171, 0, 170, 0, 239, 149,
2112 150, 151, 154, 153, 152, 0, 0, 67, 67, 107,
2113 0, 256, 257, 258, 70, 342, 326, 0, 0, 0,
2114 0, 100, 308, 309, 2, 3, 4, 5, 6, 7,
Chris Lattner15bd0952008-08-29 17:20:18 +00002115 8, 9, 10, 14, 15, 16, 11, 12, 13, 0,
2116 0, 0, 0, 0, 0, 0, 0, 17, 18, 19,
2117 20, 21, 22, 23, 24, 25, 26, 27, 28, 0,
Nate Begemanac80ade2008-05-12 19:01:56 +00002118 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002119 0, 296, 100, 312, 0, 341, 297, 313, 246, 169,
2120 0, 127, 67, 67, 168, 0, 179, 0, 127, 67,
2121 67, 0, 220, 197, 198, 193, 195, 194, 196, 199,
2122 192, 188, 189, 0, 0, 0, 0, 0, 0, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002123 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002124 0, 191, 190, 233, 0, 325, 302, 67, 292, 301,
Chris Lattner15bd0952008-08-29 17:20:18 +00002125 0, 0, 55, 0, 0, 29, 30, 31, 32, 33,
2126 34, 35, 36, 37, 38, 0, 53, 54, 49, 50,
2127 51, 52, 39, 40, 41, 42, 43, 44, 45, 46,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002128 47, 48, 0, 0, 0, 140, 140, 348, 67, 67,
2129 339, 0, 0, 0, 0, 0, 67, 67, 67, 67,
Chris Lattner15bd0952008-08-29 17:20:18 +00002130 67, 0, 0, 0, 0, 0, 109, 111, 110, 108,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002131 112, 113, 114, 115, 116, 119, 175, 173, 162, 163,
2132 164, 167, 66, 161, 235, 237, 0, 0, 0, 0,
2133 0, 0, 0, 0, 0, 0, 0, 0, 181, 215,
2134 0, 0, 0, 185, 0, 182, 0, 0, 0, 145,
2135 254, 265, 266, 267, 268, 269, 274, 270, 271, 272,
2136 273, 263, 0, 0, 0, 0, 283, 290, 289, 291,
2137 0, 0, 303, 0, 0, 67, 67, 67, 67, 0,
2138 344, 0, 346, 321, 0, 0, 0, 0, 0, 0,
Chris Lattner15bd0952008-08-29 17:20:18 +00002139 0, 0, 0, 0, 0, 0, 0, 0, 67, 0,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002140 117, 124, 123, 120, 122, 121, 125, 126, 128, 145,
2141 145, 0, 0, 0, 0, 0, 321, 0, 0, 0,
2142 0, 0, 0, 0, 180, 166, 178, 0, 183, 184,
2143 0, 0, 0, 0, 234, 253, 118, 251, 0, 264,
2144 0, 277, 0, 0, 0, 280, 0, 278, 293, 0,
2145 0, 0, 0, 0, 0, 0, 0, 0, 0, 352,
2146 0, 0, 0, 335, 336, 0, 0, 0, 0, 353,
2147 0, 0, 0, 333, 0, 140, 0, 236, 238, 67,
Chris Lattner15bd0952008-08-29 17:20:18 +00002148 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002149 0, 214, 187, 0, 0, 0, 0, 0, 0, 147,
2150 145, 65, 0, 127, 0, 276, 166, 0, 275, 279,
2151 0, 0, 320, 0, 0, 0, 0, 140, 141, 140,
2152 0, 0, 0, 0, 0, 0, 351, 323, 0, 67,
2153 327, 328, 320, 0, 349, 67, 221, 0, 0, 0,
2154 0, 201, 0, 0, 0, 0, 212, 0, 186, 0,
2155 0, 67, 142, 148, 146, 64, 250, 252, 118, 143,
2156 0, 282, 0, 0, 0, 118, 118, 0, 329, 330,
2157 331, 332, 345, 347, 322, 0, 0, 334, 337, 338,
2158 324, 0, 0, 140, 0, 0, 0, 0, 0, 209,
2159 0, 0, 0, 203, 204, 200, 65, 144, 138, 284,
2160 281, 0, 0, 0, 0, 127, 0, 314, 0, 354,
2161 127, 350, 205, 206, 207, 208, 0, 0, 0, 213,
2162 249, 0, 136, 0, 306, 0, 0, 109, 111, 118,
2163 118, 0, 118, 118, 315, 340, 202, 210, 211, 139,
2164 0, 134, 304, 0, 305, 0, 317, 316, 0, 0,
2165 0, 137, 0, 255, 0, 0, 0, 118, 118, 0,
2166 0, 0, 0, 319, 318, 0, 133, 0, 129, 311,
2167 0, 0, 0, 135, 0, 310, 0, 132, 131, 130,
2168 307
Dan Gohmanf4423b12008-04-19 00:24:39 +00002169};
2170
2171/* YYDEFGOTO[NTERM-NUM]. */
2172static const yytype_int16 yydefgoto[] =
2173{
Chris Lattnerccef6b52008-09-23 21:18:31 +00002174 -1, 278, 279, 280, 305, 322, 165, 166, 79, 596,
Chris Lattner15bd0952008-08-29 17:20:18 +00002175 113, 12, 134, 80, 14, 15, 41, 42, 43, 48,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002176 54, 118, 129, 355, 239, 448, 358, 707, 708, 693,
2177 681, 662, 420, 539, 638, 474, 540, 81, 167, 140,
Devang Pateld4980812008-09-02 20:52:40 +00002178 157, 141, 142, 110, 379, 406, 380, 121, 88, 158,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002179 16, 17, 18, 20, 19, 389, 449, 450, 63, 23,
2180 61, 101, 477, 478, 130, 173, 55, 96, 56, 49,
2181 480, 407, 83, 409, 288, 289, 57, 92, 93, 231,
2182 666, 135, 330, 607, 499, 509, 232, 233, 234, 235
Dan Gohmanf4423b12008-04-19 00:24:39 +00002183};
2184
2185/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2186 STATE-NUM. */
Chris Lattnerccef6b52008-09-23 21:18:31 +00002187#define YYPACT_NINF -613
Dan Gohmanf4423b12008-04-19 00:24:39 +00002188static const yytype_int16 yypact[] =
2189{
Chris Lattnerccef6b52008-09-23 21:18:31 +00002190 872, -613, -613, -613, -613, -613, -613, -613, 37, -106,
2191 25, -23, 155, 44, -11, -613, 189, 1045, -613, 66,
2192 239, 56, 60, -613, 64, 218, -613, 1877, -613, -613,
2193 -613, -613, -613, -613, -613, -613, -613, -613, -613, -613,
2194 -613, 178, 178, 181, -613, -613, -613, -613, 178, -613,
2195 -613, -613, -613, -613, 178, 223, -613, 1, 226, 230,
2196 237, -613, -613, -613, -613, -613, 116, -613, -613, -613,
2197 -613, -613, -613, -613, -613, 291, 296, 3, 55, -613,
2198 -613, -613, 49, -613, 278, 278, 194, -613, 252, 485,
2199 485, -613, -613, 144, -613, -613, -613, -613, -613, -613,
2200 -613, -109, 1581, -613, 152, 161, 312, 116, -613, 49,
2201 -117, 171, 1581, 174, 252, 252, -613, -613, 1625, -613,
2202 -613, 1918, 342, -613, -613, -613, -613, -613, -613, 1959,
2203 -613, -14, 186, 2193, 2193, -613, 331, -613, -613, 49,
2204 -613, 192, 200, 2003, 2003, 193, -115, 2003, -613, 371,
2205 214, -613, 1918, 2003, 116, 220, 49, 163, -613, 267,
2206 376, 384, 390, 396, 400, 305, 413, 1444, 375, -613,
2207 279, -613, -613, -613, -613, -613, -613, 377, 2044, 173,
2208 427, 485, -613, -613, -613, -613, -613, -613, -613, -613,
2209 -613, -613, -613, -613, -613, -613, -613, -613, -613, 594,
2210 574, 594, 574, 2003, 2003, 2003, 2003, -613, -613, -613,
2211 -613, -613, -613, -613, -613, -613, -613, -613, -613, 2003,
2212 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003,
2213 2003, -613, 485, -613, 253, -613, -613, -613, -613, 108,
2214 1666, -613, -31, -36, -613, 271, 49, 276, -613, 375,
2215 -1, 1625, -613, -613, -613, -613, -613, -613, -613, -613,
2216 -613, -613, -613, 594, 574, 594, 574, 282, 283, 285,
2217 289, 290, 292, 293, 1707, 2085, 566, 424, 294, 297,
2218 299, -613, -613, -613, 300, -613, 116, 860, -613, 295,
2219 1033, 1033, -613, 1033, 1959, -613, -613, -613, -613, -613,
2220 -613, -613, -613, -613, -613, 2003, -613, -613, -613, -613,
2221 -613, -613, -613, -613, -613, -613, -613, -613, -613, -613,
2222 -613, -613, 2003, 2003, 2003, -37, 26, -613, 860, 65,
2223 306, 313, 316, 322, 323, 326, 860, 860, 860, 860,
2224 860, 411, 1959, 2003, 2003, 454, -613, -613, -613, -613,
2225 -613, -613, -613, -613, -613, -613, -613, -613, 284, -613,
2226 -613, -613, -613, 284, -613, 174, 432, 315, 330, 332,
2227 335, 1918, 1918, 1918, 1918, 1918, 1918, 1918, -613, -613,
2228 -55, 792, -28, -613, -114, -613, 1918, 1918, 1918, 328,
2229 1751, -613, -613, -613, -613, -613, -613, -613, -613, -613,
2230 -613, 437, 1792, 2129, 1490, 477, -613, -613, -613, -613,
2231 2003, 336, -613, 339, 1033, 860, 860, 860, 860, 33,
2232 -613, 34, -613, -613, 1033, 341, 2003, 2003, 2003, 2003,
2233 2003, 346, 347, 349, 350, 353, 2003, 1033, 860, 357,
2234 -613, -613, -613, -613, -613, -613, -613, -613, -613, 328,
2235 328, 2003, 1918, 1918, 1918, 1918, -613, 358, 359, 360,
2236 363, 347, 364, 1918, -613, 361, 1308, -110, -613, -613,
2237 365, 366, 462, -5, -613, -613, 49, 367, 372, -613,
2238 514, -613, -25, 1536, 47, -613, -52, -613, -613, 525,
2239 527, 393, 392, 395, 397, 398, 1033, 554, 1033, 399,
2240 401, 1033, 402, 49, -613, 406, 407, 557, 561, 419,
2241 2003, 1033, 1033, 49, 425, 426, 2003, -613, -613, -16,
2242 428, 429, 433, 434, 104, 1918, 1918, 1918, 1918, 149,
2243 1918, -613, -613, 420, 1918, 1918, 2003, 575, 598, -613,
2244 328, 521, 1833, -613, 438, -613, 435, 81, -613, -613,
2245 1033, 1033, 2170, 1033, 1033, 1033, 1033, 426, -613, 426,
2246 2003, 1033, 439, 2003, 2003, 2003, -613, -613, 601, 860,
2247 -613, -613, 2170, 552, -613, 860, -613, 1918, 1918, 1918,
2248 1918, -613, 445, 455, 452, 456, -613, 347, -613, 459,
2249 460, -9, -613, -613, -613, -613, -613, -613, 49, 13,
2250 602, -613, 453, 461, 463, 75, 49, 182, -613, -613,
2251 -613, -613, -613, -613, -613, 458, 1033, -613, -613, -613,
2252 -613, 347, 191, 426, 466, 467, 469, 471, 1918, -613,
2253 1918, 1918, 195, -613, -613, -613, 521, -613, 581, -613,
2254 -613, 620, -3, 703, 703, -613, 2211, -613, 468, 419,
2255 -613, -613, -613, -613, -613, -613, 476, 482, 483, -613,
2256 -613, 636, 494, 1033, -613, 1172, 4, 487, 488, -613,
2257 -613, 236, 75, 49, -613, 284, -613, -613, -613, -613,
2258 629, 499, -613, 489, -613, 1172, 108, 108, 638, 703,
2259 703, -613, 495, -613, 639, 493, 1033, -613, -613, -135,
2260 1033, 642, 586, 108, 108, 497, -613, 196, -613, -613,
2261 1033, 648, 217, -613, -135, -613, 1033, -613, -613, -613,
2262 -613
Dan Gohmanf4423b12008-04-19 00:24:39 +00002263};
2264
2265/* YYPGOTO[NTERM-NUM]. */
2266static const yytype_int16 yypgoto[] =
2267{
Chris Lattnerccef6b52008-09-23 21:18:31 +00002268 -613, 258, 274, 287, -180, -175, -177, -613, 0, 36,
2269 -126, 580, -613, 11, -613, -613, -613, -613, 54, -613,
2270 -613, -613, -138, -613, -463, -613, -239, -613, -15, -613,
2271 -613, -613, -310, 101, -613, -424, -613, -613, -26, 464,
2272 -125, -613, 591, 599, -111, -165, -270, 298, 348, 465,
2273 -613, -613, 696, -613, -613, -613, -613, -613, -613, -613,
2274 -613, -613, -613, -613, 624, -613, -613, -613, -613, -613,
2275 -613, -612, -48, 58, -123, -613, -613, 658, -613, 583,
2276 -613, -613, -613, 146, 263, -449, -613, 590, -613, -613
Dan Gohmanf4423b12008-04-19 00:24:39 +00002277};
2278
2279/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2280 positive, shift that token. If negative, reduce the rule which
2281 number is the opposite. If zero, do what YYDEFACT says.
2282 If YYTABLE_NINF, syntax error. */
Chris Lattnerccef6b52008-09-23 21:18:31 +00002283#define YYTABLE_NINF -224
Dan Gohmanf4423b12008-04-19 00:24:39 +00002284static const yytype_int16 yytable[] =
2285{
Chris Lattnerccef6b52008-09-23 21:18:31 +00002286 11, 82, 281, 293, 170, 382, 384, 105, 292, 363,
2287 168, 13, 529, 541, 171, 292, 422, 11, 111, 111,
2288 705, 323, 91, 706, 111, 517, 518, 324, 13, 537,
2289 94, 29, 30, 31, 32, 33, 34, 35, 36, 111,
2290 37, 249, 283, 294, 496, 498, 111, 537, 147, 538,
2291 147, 463, 109, 683, 111, 463, 136, 148, 24, 245,
2292 469, 137, 64, 65, 533, 107, 67, 68, 69, 70,
2293 71, 72, 73, 695, 1, 2, 139, 3, 4, 5,
2294 109, 111, 327, 367, 25, 369, 139, 497, 497, 368,
2295 21, 370, 156, 11, 342, 84, 85, 331, 332, 333,
2296 334, 335, 89, 156, 111, 74, 22, 341, 90, 252,
2297 463, 467, 46, 463, 47, 464, 594, 242, 243, 282,
2298 111, 246, 549, 364, 365, 112, 112, 250, 419, -67,
2299 -155, 112, 482, 484, 486, 636, 360, 463, 632, 359,
2300 463, 26, 643, 644, 468, 545, 112, 576, 38, 39,
2301 40, 132, 287, 112, 635, 441, 442, 443, 444, 172,
2302 445, 112, 345, 1, 446, 447, 3, 664, 5, 414,
2303 64, 65, 649, 27, 684, 95, 106, 325, 326, 287,
2304 328, 284, 1, 2, 290, 3, 4, 5, 112, 44,
2305 291, 421, -67, 329, 287, 287, 287, 287, 287, 336,
2306 337, 338, 339, 340, 287, 574, 686, 687, 28, 689,
2307 690, 112, 463, 547, 139, -67, 86, 437, 87, 548,
2308 58, 439, 75, 76, 59, 156, 77, 112, 78, 108,
2309 346, 347, 60, 424, 703, 704, 116, -155, 117, 408,
2310 62, -155, 408, 408, 91, 408, 463, 612, 98, 613,
2311 348, 349, 99, 350, 351, 602, 352, 353, 354, 100,
2312 456, 457, 458, 459, 460, 461, 462, 581, 156, 560,
2313 -55, -55, -55, -55, 688, 470, 471, 472, 102, 415,
2314 408, 50, 51, 52, 119, 120, 53, 488, 408, 408,
2315 408, 408, 408, 253, 254, 103, 416, 417, 418, 2,
2316 104, 281, 4, 502, 599, 504, 505, 506, 255, 256,
2317 257, 258, 586, 651, 568, 87, 156, 438, 287, 64,
2318 65, 143, 107, 67, 68, 69, 70, 71, 72, 73,
2319 144, 1, 2, 149, 3, 4, 5, 38, 39, 40,
2320 151, 520, 521, 522, 523, 645, 169, 646, 411, 412,
2321 174, 413, 531, 238, 650, 466, 646, 240, 659, 713,
2322 568, 714, 74, 241, 476, 244, 408, 408, 408, 408,
2323 408, 343, 344, 717, 718, 247, 408, 248, 441, 442,
2324 443, 444, 251, 445, 287, -56, 423, 446, 447, 408,
2325 408, 228, 228, -57, 431, 432, 433, 434, 435, -60,
2326 287, 503, 287, 287, 287, -59, 671, 229, 229, -58,
2327 513, 675, 152, 153, 582, 583, 584, 585, 282, 587,
2328 230, 230, 259, 589, 590, 519, 441, 442, 443, 444,
2329 111, 445, 114, 115, 285, 446, 447, 614, 292, 362,
2330 617, 618, 619, 361, 371, 372, 385, 373, 408, 436,
2331 408, 374, 375, 408, 376, 377, 386, 466, 440, 387,
2332 410, 388, 390, 408, 408, 665, 624, 625, 626, 627,
2333 451, 425, 491, 492, 493, 494, 495, 452, 426, 75,
2334 76, 427, 500, 77, 569, 78, 145, 428, 429, 685,
2335 575, 430, 453, 473, 454, 514, 515, 455, 479, 487,
2336 536, 489, 408, 408, 490, 408, 408, 408, 408, 501,
2337 591, 507, 508, 408, 510, 511, 598, 656, 512, 657,
2338 658, 408, 516, 525, 526, 527, 606, 408, 528, 530,
2339 534, 535, 542, 532, 287, 543, 544, 287, 287, 287,
2340 1, 595, 550, 3, 551, 5, 606, 122, 123, 124,
2341 125, 126, 127, 128, 557, 552, 559, 553, 558, 562,
2342 554, 566, 555, 556, 560, 567, 561, 563, 408, 570,
2343 571, 564, 565, 64, 65, 345, 107, 159, 160, 161,
2344 162, 163, 164, 73, 568, 1, 2, 572, 3, 4,
2345 5, 573, 588, 577, 578, 408, 408, 592, 579, 580,
2346 306, 307, 593, 600, 616, 620, 497, 601, 603, 604,
2347 628, 608, 609, 610, 611, 408, 74, 630, 629, 615,
2348 673, 631, 633, 634, 639, 640, 641, 621, 647, 652,
2349 653, 642, 654, 623, 655, 661, 595, 663, 674, 676,
2350 679, 408, 408, 346, 347, 677, 678, 680, 408, -18,
2351 -19, 691, 408, 692, 694, 696, 700, 699, 701, 710,
2352 711, 712, 408, 348, 349, 716, 350, 351, 408, 352,
2353 353, 354, 660, 133, 648, 308, 309, 310, 311, 312,
2354 313, 314, 315, 316, 317, 318, 319, 320, 321, 295,
2355 296, 297, 298, 299, 300, 301, 302, 303, 304, 719,
2356 637, 669, 670, 150, 357, 146, 391, 392, 393, 394,
2357 64, 65, 395, 45, 131, 97, 366, 236, 622, 524,
2358 0, 682, 1, 2, 237, 3, 4, 5, 396, 397,
2359 398, 0, 0, 75, 76, 0, 0, 77, 0, 78,
2360 383, 0, 0, 399, 400, 0, 0, 697, 698, 0,
2361 0, 0, 0, 0, 702, 0, 0, 345, 709, 0,
2362 0, 0, 401, 0, 0, 0, 0, 0, 715, 0,
2363 0, 0, 0, 0, 720, 0, 0, 0, 0, 184,
2364 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
2365 195, 196, 197, 198, 263, 264, 265, 266, 0, 64,
2366 65, 0, 107, 159, 160, 161, 162, 163, 164, 73,
2367 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2368 0, 0, 0, 267, 207, 667, 668, 210, 211, 212,
2369 213, 214, 215, 216, 217, 218, 0, 268, 0, 269,
2370 270, 271, 74, 272, 273, 348, 349, 0, 350, 351,
2371 0, 352, 353, 354, 0, 0, 0, 0, 0, 0,
2372 0, 0, 0, 391, 392, 393, 394, 64, 65, 395,
2373 0, 402, -223, 0, 403, 0, 404, 0, 405, 1,
2374 2, 0, 3, 4, 5, 396, 397, 398, 0, 0,
2375 -69, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2376 399, 400, 6, 7, 0, 0, 0, 0, 0, 0,
2377 0, 0, 0, 0, 0, 111, 0, 0, 0, 401,
2378 0, 0, 0, 0, 8, 0, 0, 0, 9, 0,
2379 0, 0, 10, 0, 0, 0, 184, 185, 186, 187,
2380 188, 189, 190, 191, 192, 193, 194, 195, 196, 197,
2381 198, 263, 264, 265, 266, 0, 0, 0, 0, 75,
2382 76, 0, 0, 77, 0, 78, 465, 0, 0, 0,
Chris Lattner15bd0952008-08-29 17:20:18 +00002383 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002384 267, 207, 208, 209, 210, 211, 212, 213, 214, 215,
2385 216, 217, 218, 0, 268, 0, 269, 270, 271, 0,
2386 272, 273, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner15bd0952008-08-29 17:20:18 +00002387 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002388 0, 0, 112, 0, 0, 0, 0, 0, 402, 0,
2389 0, 403, 0, 404, 0, 405, 391, 392, 393, 394,
2390 64, 65, 395, 0, 0, -222, 0, 0, 0, 0,
2391 0, 0, 1, 2, 0, 3, 4, 5, 396, 397,
2392 398, 0, 0, -69, 1, 2, 0, 3, 4, 5,
2393 0, 0, 0, 399, 400, 6, 7, 0, 0, 0,
Devang Pateld4980812008-09-02 20:52:40 +00002394 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002395 0, 0, 401, 0, 0, 0, 0, 8, 0, 0,
2396 0, 9, 0, 0, 0, 10, 0, 0, 0, 184,
2397 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
2398 195, 196, 197, 198, 263, 264, 265, 266, 0, 0,
Chris Lattner15bd0952008-08-29 17:20:18 +00002399 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Pateld4980812008-09-02 20:52:40 +00002400 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002401 0, 0, 0, 267, 207, 208, 209, 210, 211, 212,
2402 213, 214, 215, 216, 217, 218, 0, 268, 0, 269,
2403 270, 271, 0, 272, 273, 391, 392, 393, 394, 0,
2404 0, 395, 0, 0, 0, 0, 0, 0, 0, 0,
2405 0, 0, 0, 0, 0, 0, 0, 396, 397, 398,
2406 0, 402, 0, 0, 403, 0, 404, 0, 405, 0,
2407 0, 0, 399, 400, 0, 0, 0, 0, 0, 0,
Devang Pateld4980812008-09-02 20:52:40 +00002408 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002409 0, 401, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Pateld4980812008-09-02 20:52:40 +00002410 0, 0, 0, 0, 0, 0, 0, 0, 184, 185,
2411 186, 187, 188, 189, 190, 191, 192, 193, 194, 195,
2412 196, 197, 198, 263, 264, 265, 266, 0, 0, 0,
2413 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2414 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2415 0, 0, 267, 207, 208, 209, 210, 211, 212, 213,
2416 214, 215, 216, 217, 218, 0, 268, 0, 269, 270,
2417 271, 0, 272, 273, 0, 64, 65, 0, 0, 0,
2418 0, 0, 0, 0, 0, 0, 0, 1, 2, 0,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002419 3, 4, 5, 260, 0, 0, 0, 0, 0, 0,
2420 402, 0, 0, 403, 0, 404, 0, 405, 261, 262,
Devang Pateld4980812008-09-02 20:52:40 +00002421 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002422 0, 0, 0, 111, 0, 0, 0, 0, 0, 0,
2423 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Pateld4980812008-09-02 20:52:40 +00002424 0, 0, 0, 0, 184, 185, 186, 187, 188, 189,
2425 190, 191, 192, 193, 194, 195, 196, 197, 198, 263,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002426 264, 265, 266, 0, 0, 0, 0, 0, 0, 0,
2427 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2428 0, 0, 0, 0, 0, 0, 0, 0, 267, 207,
Devang Pateld4980812008-09-02 20:52:40 +00002429 208, 209, 210, 211, 212, 213, 214, 215, 216, 217,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002430 218, 0, 268, 0, 269, 270, 271, 0, 272, 273,
2431 0, 64, 65, 0, 0, 0, 0, 0, 0, 0,
2432 0, 0, 0, 1, 2, 0, 3, 4, 5, 260,
2433 112, 0, 0, 0, -67, 0, 274, 0, 0, 275,
2434 0, 276, 0, 277, 261, 262, 0, 0, 0, 0,
2435 0, 0, 0, 0, 0, 0, 0, 64, 65, 111,
2436 107, 159, 160, 161, 162, 163, 164, 73, 0, 1,
2437 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2438 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
2439 194, 195, 196, 197, 198, 263, 264, 265, 266, 0,
2440 74, 0, 0, 64, 65, 0, 107, 159, 160, 161,
2441 162, 163, 164, 73, 0, 1, 2, 0, 3, 4,
2442 5, 0, 0, 0, 267, 207, 208, 209, 210, 211,
2443 212, 213, 214, 215, 216, 217, 218, 0, 268, 0,
2444 269, 270, 271, 0, 272, 273, 74, 0, 64, 65,
2445 0, 107, 67, 68, 69, 70, 71, 72, 73, 0,
2446 1, 2, 0, 3, 4, 5, 112, 0, 0, 0,
2447 0, 0, 274, 0, 0, 275, 0, 276, 0, 277,
2448 138, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2449 0, 74, 64, 65, 0, 154, 67, 68, 69, 70,
2450 71, 72, 73, 0, 1, 2, 0, 3, 4, 5,
2451 0, 0, 0, 0, 0, 0, 0, 75, 76, 0,
2452 0, 77, 0, 78, 485, 0, 0, 0, 0, 0,
2453 0, 0, 0, 64, 65, 74, 107, 67, 68, 69,
2454 70, 71, 72, 73, 0, 1, 2, 0, 3, 4,
2455 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2456 0, 0, 0, 75, 76, 356, 0, 77, 0, 78,
2457 546, 0, 0, 0, 64, 65, 74, 107, 159, 160,
2458 161, 162, 163, 164, 73, 0, 1, 2, 0, 3,
2459 4, 5, 0, 0, 0, 0, 0, 0, 0, 0,
2460 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2461 0, 155, 77, 0, 78, 0, 0, 74, 64, 65,
2462 0, 107, 67, 68, 69, 70, 71, 72, 73, 0,
2463 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2464 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2465 475, 0, 75, 76, 0, 0, 77, 0, 78, 64,
2466 65, 74, 107, 159, 160, 161, 162, 163, 164, 73,
2467 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2468 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2469 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
Devang Pateld4980812008-09-02 20:52:40 +00002470 64, 65, 74, 107, 67, 68, 69, 70, 71, 72,
2471 73, 0, 1, 2, 0, 3, 4, 5, 0, 0,
Devang Pateld4980812008-09-02 20:52:40 +00002472 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002473 0, 0, 597, 0, 75, 76, 0, 378, 77, 0,
2474 78, 0, 0, 74, 64, 65, 0, 66, 67, 68,
2475 69, 70, 71, 72, 73, 0, 1, 2, 0, 3,
2476 4, 5, 0, 0, 0, 0, 0, 0, 0, 0,
2477 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2478 0, 0, 77, 0, 78, 64, 65, 74, 107, 159,
2479 160, 161, 162, 163, 164, 73, 0, 1, 2, 0,
Devang Pateld4980812008-09-02 20:52:40 +00002480 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002481 0, 0, 0, 0, 0, 0, 0, 0, 0, 75,
2482 76, 0, 481, 77, 0, 78, 64, 65, 74, 154,
2483 67, 68, 69, 70, 71, 72, 73, 0, 1, 2,
Devang Pateld4980812008-09-02 20:52:40 +00002484 0, 3, 4, 5, 0, 0, 0, 0, 0, 0,
2485 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002486 75, 76, 0, 0, 77, 0, 78, 0, 0, 74,
2487 64, 65, 0, 107, 67, 68, 69, 70, 71, 72,
2488 73, 0, 1, 2, 0, 3, 4, 5, 0, 0,
2489 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2490 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2491 78, 64, 65, 74, 286, 67, 68, 69, 70, 71,
Devang Pateld4980812008-09-02 20:52:40 +00002492 72, 73, 0, 1, 2, 0, 3, 4, 5, 0,
2493 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2494 0, 0, 0, 0, 0, 75, 76, 0, 0, 77,
2495 0, 78, 64, 65, 74, 107, 159, 160, 161, 162,
2496 163, 164, 73, 0, 1, 2, 0, 3, 4, 5,
2497 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002498 0, 0, 0, 0, 0, 0, 75, 76, 0, 0,
2499 77, 0, 78, 0, 0, 74, 64, 65, 0, 107,
2500 159, 160, 161, 162, 163, 164, 73, 0, 1, 2,
2501 0, 3, 4, 5, 0, 0, 0, 0, 0, 0,
2502 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2503 75, 76, 0, 0, 77, 0, 78, 64, 65, 74,
2504 107, 67, 68, 69, 70, 71, 72, 605, 0, 1,
Devang Pateld4980812008-09-02 20:52:40 +00002505 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2506 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner15bd0952008-08-29 17:20:18 +00002507 0, 75, 76, 0, 0, 77, 0, 78, 64, 65,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002508 74, 107, 67, 68, 69, 70, 71, 72, 672, 175,
Chris Lattner15bd0952008-08-29 17:20:18 +00002509 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2510 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002511 176, 177, 75, 76, 0, 0, 77, 0, 381, 0,
2512 0, 74, 0, 178, 179, 180, 181, 182, 183, 184,
2513 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
2514 195, 196, 197, 198, 199, 200, 201, 202, 0, 0,
2515 0, 0, 0, 0, 0, 0, 75, 76, 0, 0,
2516 77, 0, 483, 0, 0, 0, 0, 0, 203, 204,
2517 205, 0, 0, 206, 207, 208, 209, 210, 211, 212,
2518 213, 214, 215, 216, 217, 218, 219, 220, 221, 222,
2519 223, 224, 225, 226, 227, 0, 0, 75, 76, 0,
2520 0, 77, 0, 78, 0, 0, 0, 0, 0, 0,
Chris Lattner15bd0952008-08-29 17:20:18 +00002521 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002522 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner15bd0952008-08-29 17:20:18 +00002523 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002524 0, 0, 77, 0, 78
Dan Gohmanf4423b12008-04-19 00:24:39 +00002525};
2526
2527static const yytype_int16 yycheck[] =
2528{
Chris Lattnerccef6b52008-09-23 21:18:31 +00002529 0, 27, 167, 180, 129, 275, 276, 4, 11, 248,
2530 121, 0, 461, 476, 28, 11, 326, 17, 55, 55,
2531 155, 201, 21, 158, 55, 449, 450, 202, 17, 34,
2532 29, 42, 43, 44, 45, 46, 47, 48, 49, 55,
2533 51, 152, 168, 181, 11, 11, 55, 34, 165, 54,
2534 165, 165, 78, 665, 55, 165, 165, 174, 164, 174,
2535 174, 170, 7, 8, 174, 10, 11, 12, 13, 14,
2536 15, 16, 17, 685, 19, 20, 102, 22, 23, 24,
2537 106, 55, 205, 263, 59, 265, 112, 54, 54, 264,
2538 53, 266, 118, 93, 232, 41, 42, 220, 221, 222,
2539 223, 224, 48, 129, 55, 50, 69, 230, 54, 157,
2540 165, 381, 46, 165, 48, 170, 540, 143, 144, 167,
2541 55, 147, 174, 249, 250, 162, 162, 153, 165, 166,
2542 55, 162, 402, 403, 404, 598, 172, 165, 587, 170,
2543 165, 164, 605, 606, 172, 170, 162, 163, 159, 160,
2544 161, 7, 178, 162, 163, 142, 143, 144, 145, 173,
2545 147, 162, 54, 19, 151, 152, 22, 170, 24, 294,
2546 7, 8, 621, 18, 170, 174, 173, 203, 204, 205,
2547 206, 170, 19, 20, 11, 22, 23, 24, 162, 0,
2548 17, 165, 166, 219, 220, 221, 222, 223, 224, 225,
2549 226, 227, 228, 229, 230, 515, 669, 670, 164, 672,
2550 673, 162, 165, 483, 240, 166, 35, 342, 37, 172,
2551 164, 344, 167, 168, 164, 251, 171, 162, 173, 174,
2552 122, 123, 168, 168, 697, 698, 42, 162, 44, 287,
2553 22, 166, 290, 291, 21, 293, 165, 557, 22, 559,
2554 142, 143, 22, 145, 146, 174, 148, 149, 150, 22,
2555 371, 372, 373, 374, 375, 376, 377, 163, 294, 165,
2556 3, 4, 5, 6, 38, 386, 387, 388, 162, 305,
2557 328, 42, 43, 44, 32, 33, 47, 410, 336, 337,
2558 338, 339, 340, 26, 27, 4, 322, 323, 324, 20,
2559 4, 466, 23, 426, 543, 428, 429, 430, 3, 4,
2560 5, 6, 163, 623, 165, 37, 342, 343, 344, 7,
2561 8, 169, 10, 11, 12, 13, 14, 15, 16, 17,
2562 169, 19, 20, 162, 22, 23, 24, 159, 160, 161,
2563 166, 452, 453, 454, 455, 163, 4, 165, 290, 291,
2564 164, 293, 463, 22, 163, 381, 165, 165, 163, 163,
2565 165, 165, 50, 163, 390, 172, 414, 415, 416, 417,
2566 418, 118, 119, 156, 157, 4, 424, 163, 142, 143,
2567 144, 145, 162, 147, 410, 9, 328, 151, 152, 437,
2568 438, 133, 134, 9, 336, 337, 338, 339, 340, 9,
2569 426, 427, 428, 429, 430, 9, 645, 133, 134, 9,
2570 436, 650, 114, 115, 525, 526, 527, 528, 466, 530,
2571 133, 134, 9, 534, 535, 451, 142, 143, 144, 145,
2572 55, 147, 84, 85, 57, 151, 152, 560, 11, 163,
2573 563, 564, 565, 172, 162, 162, 22, 162, 496, 38,
2574 498, 162, 162, 501, 162, 162, 162, 483, 4, 162,
2575 165, 162, 162, 511, 512, 642, 577, 578, 579, 580,
2576 38, 165, 414, 415, 416, 417, 418, 162, 165, 167,
2577 168, 165, 424, 171, 510, 173, 174, 165, 165, 666,
2578 516, 165, 162, 165, 162, 437, 438, 162, 61, 22,
2579 38, 165, 550, 551, 165, 553, 554, 555, 556, 168,
2580 536, 165, 165, 561, 165, 165, 542, 628, 165, 630,
2581 631, 569, 165, 165, 165, 165, 552, 575, 165, 165,
2582 165, 165, 165, 172, 560, 163, 22, 563, 564, 565,
2583 19, 541, 17, 22, 17, 24, 572, 62, 63, 64,
2584 65, 66, 67, 68, 496, 162, 498, 165, 4, 501,
2585 165, 4, 165, 165, 165, 4, 165, 165, 616, 511,
2586 512, 165, 165, 7, 8, 54, 10, 11, 12, 13,
2587 14, 15, 16, 17, 165, 19, 20, 162, 22, 23,
2588 24, 165, 172, 165, 165, 643, 644, 22, 165, 165,
2589 26, 27, 4, 165, 165, 4, 54, 172, 550, 551,
2590 165, 553, 554, 555, 556, 663, 50, 165, 163, 561,
2591 646, 165, 163, 163, 22, 172, 165, 569, 170, 163,
2592 163, 168, 163, 575, 163, 54, 636, 17, 170, 163,
2593 4, 689, 690, 122, 123, 163, 163, 153, 696, 162,
2594 162, 22, 700, 154, 165, 17, 17, 162, 165, 17,
2595 74, 164, 710, 142, 143, 17, 145, 146, 716, 148,
2596 149, 150, 636, 93, 616, 101, 102, 103, 104, 105,
2597 106, 107, 108, 109, 110, 111, 112, 113, 114, 95,
2598 96, 97, 98, 99, 100, 101, 102, 103, 104, 714,
2599 599, 643, 644, 112, 240, 106, 3, 4, 5, 6,
2600 7, 8, 9, 17, 90, 57, 251, 134, 572, 456,
2601 -1, 663, 19, 20, 134, 22, 23, 24, 25, 26,
2602 27, -1, -1, 167, 168, -1, -1, 171, -1, 173,
2603 174, -1, -1, 40, 41, -1, -1, 689, 690, -1,
2604 -1, -1, -1, -1, 696, -1, -1, 54, 700, -1,
2605 -1, -1, 59, -1, -1, -1, -1, -1, 710, -1,
2606 -1, -1, -1, -1, 716, -1, -1, -1, -1, 76,
2607 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2608 87, 88, 89, 90, 91, 92, 93, 94, -1, 7,
2609 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2610 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2611 -1, -1, -1, 120, 121, 122, 123, 124, 125, 126,
2612 127, 128, 129, 130, 131, 132, -1, 134, -1, 136,
2613 137, 138, 50, 140, 141, 142, 143, -1, 145, 146,
2614 -1, 148, 149, 150, -1, -1, -1, -1, -1, -1,
2615 -1, -1, -1, 3, 4, 5, 6, 7, 8, 9,
2616 -1, 168, 0, -1, 171, -1, 173, -1, 175, 19,
2617 20, -1, 22, 23, 24, 25, 26, 27, -1, -1,
2618 18, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2619 40, 41, 30, 31, -1, -1, -1, -1, -1, -1,
2620 -1, -1, -1, -1, -1, 55, -1, -1, -1, 59,
2621 -1, -1, -1, -1, 52, -1, -1, -1, 56, -1,
2622 -1, -1, 60, -1, -1, -1, 76, 77, 78, 79,
2623 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2624 90, 91, 92, 93, 94, -1, -1, -1, -1, 167,
2625 168, -1, -1, 171, -1, 173, 174, -1, -1, -1,
Devang Pateld4980812008-09-02 20:52:40 +00002626 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002627 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
2628 130, 131, 132, -1, 134, -1, 136, 137, 138, -1,
2629 140, 141, -1, -1, -1, -1, -1, -1, -1, -1,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002630 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002631 -1, -1, 162, -1, -1, -1, -1, -1, 168, -1,
2632 -1, 171, -1, 173, -1, 175, 3, 4, 5, 6,
2633 7, 8, 9, -1, -1, 0, -1, -1, -1, -1,
2634 -1, -1, 19, 20, -1, 22, 23, 24, 25, 26,
2635 27, -1, -1, 18, 19, 20, -1, 22, 23, 24,
2636 -1, -1, -1, 40, 41, 30, 31, -1, -1, -1,
Devang Pateld4980812008-09-02 20:52:40 +00002637 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002638 -1, -1, 59, -1, -1, -1, -1, 52, -1, -1,
2639 -1, 56, -1, -1, -1, 60, -1, -1, -1, 76,
2640 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2641 87, 88, 89, 90, 91, 92, 93, 94, -1, -1,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002642 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Pateld4980812008-09-02 20:52:40 +00002643 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002644 -1, -1, -1, 120, 121, 122, 123, 124, 125, 126,
2645 127, 128, 129, 130, 131, 132, -1, 134, -1, 136,
2646 137, 138, -1, 140, 141, 3, 4, 5, 6, -1,
2647 -1, 9, -1, -1, -1, -1, -1, -1, -1, -1,
2648 -1, -1, -1, -1, -1, -1, -1, 25, 26, 27,
2649 -1, 168, -1, -1, 171, -1, 173, -1, 175, -1,
2650 -1, -1, 40, 41, -1, -1, -1, -1, -1, -1,
Devang Pateld4980812008-09-02 20:52:40 +00002651 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002652 -1, 59, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Pateld4980812008-09-02 20:52:40 +00002653 -1, -1, -1, -1, -1, -1, -1, -1, 76, 77,
2654 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2655 88, 89, 90, 91, 92, 93, 94, -1, -1, -1,
2656 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2657 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2658 -1, -1, 120, 121, 122, 123, 124, 125, 126, 127,
2659 128, 129, 130, 131, 132, -1, 134, -1, 136, 137,
2660 138, -1, 140, 141, -1, 7, 8, -1, -1, -1,
2661 -1, -1, -1, -1, -1, -1, -1, 19, 20, -1,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002662 22, 23, 24, 25, -1, -1, -1, -1, -1, -1,
Devang Pateld4980812008-09-02 20:52:40 +00002663 168, -1, -1, 171, -1, 173, -1, 175, 40, 41,
2664 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002665 -1, -1, -1, 55, -1, -1, -1, -1, -1, -1,
2666 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Pateld4980812008-09-02 20:52:40 +00002667 -1, -1, -1, -1, 76, 77, 78, 79, 80, 81,
2668 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002669 92, 93, 94, -1, -1, -1, -1, -1, -1, -1,
2670 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2671 -1, -1, -1, -1, -1, -1, -1, -1, 120, 121,
Devang Pateld4980812008-09-02 20:52:40 +00002672 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002673 132, -1, 134, -1, 136, 137, 138, -1, 140, 141,
2674 -1, 7, 8, -1, -1, -1, -1, -1, -1, -1,
2675 -1, -1, -1, 19, 20, -1, 22, 23, 24, 25,
2676 162, -1, -1, -1, 166, -1, 168, -1, -1, 171,
2677 -1, 173, -1, 175, 40, 41, -1, -1, -1, -1,
2678 -1, -1, -1, -1, -1, -1, -1, 7, 8, 55,
2679 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2680 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2681 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2682 86, 87, 88, 89, 90, 91, 92, 93, 94, -1,
2683 50, -1, -1, 7, 8, -1, 10, 11, 12, 13,
2684 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2685 24, -1, -1, -1, 120, 121, 122, 123, 124, 125,
2686 126, 127, 128, 129, 130, 131, 132, -1, 134, -1,
2687 136, 137, 138, -1, 140, 141, 50, -1, 7, 8,
2688 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2689 19, 20, -1, 22, 23, 24, 162, -1, -1, -1,
2690 -1, -1, 168, -1, -1, 171, -1, 173, -1, 175,
2691 39, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2692 -1, 50, 7, 8, -1, 10, 11, 12, 13, 14,
2693 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2694 -1, -1, -1, -1, -1, -1, -1, 167, 168, -1,
2695 -1, 171, -1, 173, 174, -1, -1, -1, -1, -1,
2696 -1, -1, -1, 7, 8, 50, 10, 11, 12, 13,
2697 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2698 24, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2699 -1, -1, -1, 167, 168, 39, -1, 171, -1, 173,
2700 174, -1, -1, -1, 7, 8, 50, 10, 11, 12,
2701 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2702 23, 24, -1, -1, -1, -1, -1, -1, -1, -1,
2703 -1, -1, -1, -1, -1, -1, -1, -1, 167, 168,
2704 -1, 126, 171, -1, 173, -1, -1, 50, 7, 8,
2705 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2706 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
2707 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2708 39, -1, 167, 168, -1, -1, 171, -1, 173, 7,
2709 8, 50, 10, 11, 12, 13, 14, 15, 16, 17,
2710 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2711 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2712 -1, -1, -1, 167, 168, -1, -1, 171, -1, 173,
Devang Pateld4980812008-09-02 20:52:40 +00002713 7, 8, 50, 10, 11, 12, 13, 14, 15, 16,
2714 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
Devang Pateld4980812008-09-02 20:52:40 +00002715 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002716 -1, -1, 39, -1, 167, 168, -1, 170, 171, -1,
2717 173, -1, -1, 50, 7, 8, -1, 10, 11, 12,
2718 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2719 23, 24, -1, -1, -1, -1, -1, -1, -1, -1,
2720 -1, -1, -1, -1, -1, -1, -1, -1, 167, 168,
2721 -1, -1, 171, -1, 173, 7, 8, 50, 10, 11,
Devang Pateld4980812008-09-02 20:52:40 +00002722 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2723 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002724 -1, -1, -1, -1, -1, -1, -1, -1, -1, 167,
2725 168, -1, 170, 171, -1, 173, 7, 8, 50, 10,
Devang Pateld4980812008-09-02 20:52:40 +00002726 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2727 -1, 22, 23, 24, -1, -1, -1, -1, -1, -1,
2728 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002729 167, 168, -1, -1, 171, -1, 173, -1, -1, 50,
2730 7, 8, -1, 10, 11, 12, 13, 14, 15, 16,
2731 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
2732 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2733 -1, -1, -1, -1, 167, 168, -1, -1, 171, -1,
2734 173, 7, 8, 50, 10, 11, 12, 13, 14, 15,
Devang Pateld4980812008-09-02 20:52:40 +00002735 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2736 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2737 -1, -1, -1, -1, -1, 167, 168, -1, -1, 171,
2738 -1, 173, 7, 8, 50, 10, 11, 12, 13, 14,
2739 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2740 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002741 -1, -1, -1, -1, -1, -1, 167, 168, -1, -1,
2742 171, -1, 173, -1, -1, 50, 7, 8, -1, 10,
2743 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2744 -1, 22, 23, 24, -1, -1, -1, -1, -1, -1,
2745 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2746 167, 168, -1, -1, 171, -1, 173, 7, 8, 50,
Devang Pateld4980812008-09-02 20:52:40 +00002747 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2748 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2749 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2750 -1, 167, 168, -1, -1, 171, -1, 173, 7, 8,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002751 50, 10, 11, 12, 13, 14, 15, 16, 17, 36,
Chris Lattner15bd0952008-08-29 17:20:18 +00002752 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
2753 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002754 57, 58, 167, 168, -1, -1, 171, -1, 173, -1,
2755 -1, 50, -1, 70, 71, 72, 73, 74, 75, 76,
2756 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2757 87, 88, 89, 90, 91, 92, 93, 94, -1, -1,
2758 -1, -1, -1, -1, -1, -1, 167, 168, -1, -1,
2759 171, -1, 173, -1, -1, -1, -1, -1, 115, 116,
2760 117, -1, -1, 120, 121, 122, 123, 124, 125, 126,
2761 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
2762 137, 138, 139, 140, 141, -1, -1, 167, 168, -1,
2763 -1, 171, -1, 173, -1, -1, -1, -1, -1, -1,
Chris Lattner15bd0952008-08-29 17:20:18 +00002764 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002765 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Pateld4980812008-09-02 20:52:40 +00002766 -1, -1, -1, -1, -1, -1, -1, -1, 167, 168,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002767 -1, -1, 171, -1, 173
Dan Gohmanf4423b12008-04-19 00:24:39 +00002768};
2769
2770/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2771 symbol of state STATE-NUM. */
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002772static const yytype_uint16 yystos[] =
Dan Gohmanf4423b12008-04-19 00:24:39 +00002773{
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002774 0, 19, 20, 22, 23, 24, 30, 31, 52, 56,
Devang Pateld4980812008-09-02 20:52:40 +00002775 60, 184, 187, 189, 190, 191, 226, 227, 228, 230,
2776 229, 53, 69, 235, 164, 59, 164, 18, 164, 42,
2777 43, 44, 45, 46, 47, 48, 49, 51, 159, 160,
2778 161, 192, 193, 194, 0, 228, 46, 48, 195, 245,
2779 42, 43, 44, 47, 196, 242, 244, 252, 164, 164,
2780 168, 236, 22, 234, 7, 8, 10, 11, 12, 13,
2781 14, 15, 16, 17, 50, 167, 168, 171, 173, 184,
2782 189, 213, 214, 248, 194, 194, 35, 37, 224, 194,
2783 194, 21, 253, 254, 29, 174, 243, 253, 22, 22,
2784 22, 237, 162, 4, 4, 4, 173, 10, 174, 214,
2785 219, 55, 162, 186, 224, 224, 42, 44, 197, 32,
2786 33, 223, 62, 63, 64, 65, 66, 67, 68, 198,
2787 240, 240, 7, 187, 188, 257, 165, 170, 39, 214,
2788 215, 217, 218, 169, 169, 174, 219, 165, 174, 162,
2789 218, 166, 223, 223, 10, 126, 214, 216, 225, 11,
2790 12, 13, 14, 15, 16, 182, 183, 214, 220, 4,
2791 216, 28, 173, 241, 164, 36, 57, 58, 70, 71,
Chris Lattner15bd0952008-08-29 17:20:18 +00002792 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
2793 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
2794 92, 93, 94, 115, 116, 117, 120, 121, 122, 123,
2795 124, 125, 126, 127, 128, 129, 130, 131, 132, 133,
Devang Pateld4980812008-09-02 20:52:40 +00002796 134, 135, 136, 137, 138, 139, 140, 141, 177, 178,
2797 179, 255, 262, 263, 264, 265, 255, 263, 22, 200,
2798 165, 163, 214, 214, 172, 174, 214, 4, 163, 220,
2799 214, 162, 248, 26, 27, 3, 4, 5, 6, 9,
Chris Lattner15bd0952008-08-29 17:20:18 +00002800 25, 40, 41, 91, 92, 93, 94, 120, 134, 136,
Devang Pateld4980812008-09-02 20:52:40 +00002801 137, 138, 140, 141, 168, 171, 173, 175, 177, 178,
2802 179, 221, 248, 186, 189, 57, 10, 214, 250, 251,
2803 11, 17, 11, 182, 198, 95, 96, 97, 98, 99,
2804 100, 101, 102, 103, 104, 180, 26, 27, 101, 102,
Chris Lattner15bd0952008-08-29 17:20:18 +00002805 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
Devang Pateld4980812008-09-02 20:52:40 +00002806 113, 114, 181, 180, 181, 214, 214, 250, 214, 214,
2807 258, 250, 250, 250, 250, 250, 214, 214, 214, 214,
2808 214, 250, 198, 118, 119, 54, 122, 123, 142, 143,
2809 145, 146, 148, 149, 150, 199, 39, 215, 202, 170,
2810 172, 172, 163, 202, 186, 186, 225, 180, 181, 180,
2811 181, 162, 162, 162, 162, 162, 162, 162, 170, 220,
2812 222, 173, 222, 174, 222, 22, 162, 162, 162, 231,
2813 162, 3, 4, 5, 6, 9, 25, 26, 27, 40,
2814 41, 59, 168, 171, 173, 175, 221, 247, 248, 249,
2815 165, 249, 249, 249, 216, 214, 214, 214, 214, 165,
2816 208, 165, 208, 249, 168, 165, 165, 165, 165, 165,
2817 165, 249, 249, 249, 249, 249, 38, 216, 214, 250,
Chris Lattnerccef6b52008-09-23 21:18:31 +00002818 4, 142, 143, 144, 145, 147, 151, 152, 201, 232,
2819 233, 38, 162, 162, 162, 162, 220, 220, 220, 220,
2820 220, 220, 220, 165, 170, 174, 214, 222, 172, 174,
2821 220, 220, 220, 165, 211, 39, 214, 238, 239, 61,
2822 246, 170, 222, 173, 222, 174, 222, 22, 250, 165,
2823 165, 249, 249, 249, 249, 249, 11, 54, 11, 260,
2824 249, 168, 250, 214, 250, 250, 250, 165, 165, 261,
2825 165, 165, 165, 214, 249, 249, 165, 211, 211, 214,
2826 220, 220, 220, 220, 260, 165, 165, 165, 165, 261,
2827 165, 220, 172, 174, 165, 165, 38, 34, 54, 209,
2828 212, 200, 165, 163, 22, 170, 174, 222, 172, 174,
2829 17, 17, 162, 165, 165, 165, 165, 249, 4, 249,
2830 165, 165, 249, 165, 165, 165, 4, 4, 165, 214,
2831 249, 249, 162, 165, 208, 214, 163, 165, 165, 165,
2832 165, 163, 220, 220, 220, 220, 163, 220, 172, 220,
2833 220, 214, 22, 4, 211, 184, 185, 39, 214, 202,
2834 165, 172, 174, 249, 249, 17, 214, 259, 249, 249,
2835 249, 249, 208, 208, 250, 249, 165, 250, 250, 250,
2836 4, 249, 259, 249, 220, 220, 220, 220, 165, 163,
2837 165, 165, 261, 163, 163, 163, 200, 209, 210, 22,
2838 172, 165, 168, 200, 200, 163, 165, 170, 249, 261,
2839 163, 208, 163, 163, 163, 163, 220, 220, 220, 163,
2840 185, 54, 207, 17, 170, 182, 256, 122, 123, 249,
2841 249, 202, 17, 214, 170, 202, 163, 163, 163, 4,
2842 153, 206, 249, 247, 170, 182, 200, 200, 38, 200,
2843 200, 22, 154, 205, 165, 247, 17, 249, 249, 162,
2844 17, 165, 249, 200, 200, 155, 158, 203, 204, 249,
2845 17, 74, 164, 163, 165, 249, 17, 156, 157, 204,
2846 249
Dan Gohmanf4423b12008-04-19 00:24:39 +00002847};
David Greene718fda32007-08-01 03:59:32 +00002848
Reid Spencer68a24bd2005-08-27 18:50:39 +00002849#define yyerrok (yyerrstatus = 0)
2850#define yyclearin (yychar = YYEMPTY)
Dan Gohmanf4423b12008-04-19 00:24:39 +00002851#define YYEMPTY (-2)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002852#define YYEOF 0
Dan Gohmanf4423b12008-04-19 00:24:39 +00002853
Reid Spencer68a24bd2005-08-27 18:50:39 +00002854#define YYACCEPT goto yyacceptlab
Dan Gohmanf4423b12008-04-19 00:24:39 +00002855#define YYABORT goto yyabortlab
2856#define YYERROR goto yyerrorlab
2857
2858
2859/* Like YYERROR except do call yyerror. This remains here temporarily
2860 to ease the transition to the new meaning of YYERROR, for GCC.
Reid Spencer68a24bd2005-08-27 18:50:39 +00002861 Once GCC version 2 has supplanted version 1, this can go. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00002862
Reid Spencer68a24bd2005-08-27 18:50:39 +00002863#define YYFAIL goto yyerrlab
Dan Gohmanf4423b12008-04-19 00:24:39 +00002864
Reid Spencer68a24bd2005-08-27 18:50:39 +00002865#define YYRECOVERING() (!!yyerrstatus)
Dan Gohmanf4423b12008-04-19 00:24:39 +00002866
2867#define YYBACKUP(Token, Value) \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002868do \
2869 if (yychar == YYEMPTY && yylen == 1) \
Dan Gohmanf4423b12008-04-19 00:24:39 +00002870 { \
2871 yychar = (Token); \
2872 yylval = (Value); \
2873 yytoken = YYTRANSLATE (yychar); \
2874 YYPOPSTACK (1); \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002875 goto yybackup; \
2876 } \
2877 else \
Dan Gohmanf4423b12008-04-19 00:24:39 +00002878 { \
2879 yyerror (YY_("syntax error: cannot back up")); \
2880 YYERROR; \
2881 } \
2882while (YYID (0))
2883
Anton Korobeynikov38e09802007-04-28 13:48:45 +00002884
Reid Spencer68a24bd2005-08-27 18:50:39 +00002885#define YYTERROR 1
2886#define YYERRCODE 256
2887
Dan Gohmanf4423b12008-04-19 00:24:39 +00002888
2889/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2890 If N is 0, then set CURRENT to the empty location which ends
2891 the previous symbol: RHS[0] (always defined). */
2892
2893#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2894#ifndef YYLLOC_DEFAULT
2895# define YYLLOC_DEFAULT(Current, Rhs, N) \
2896 do \
2897 if (YYID (N)) \
2898 { \
2899 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2900 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2901 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2902 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2903 } \
2904 else \
2905 { \
2906 (Current).first_line = (Current).last_line = \
2907 YYRHSLOC (Rhs, 0).last_line; \
2908 (Current).first_column = (Current).last_column = \
2909 YYRHSLOC (Rhs, 0).last_column; \
2910 } \
2911 while (YYID (0))
Reid Spencer68a24bd2005-08-27 18:50:39 +00002912#endif
2913
Dan Gohmanf4423b12008-04-19 00:24:39 +00002914
2915/* YY_LOCATION_PRINT -- Print the location on the stream.
2916 This macro was not mandated originally: define only if we know
2917 we won't break user code: when these are the locations we know. */
2918
2919#ifndef YY_LOCATION_PRINT
Dan Gohman180c1692008-06-23 18:43:26 +00002920# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
Dan Gohmanf4423b12008-04-19 00:24:39 +00002921# define YY_LOCATION_PRINT(File, Loc) \
2922 fprintf (File, "%d.%d-%d.%d", \
2923 (Loc).first_line, (Loc).first_column, \
2924 (Loc).last_line, (Loc).last_column)
2925# else
2926# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2927# endif
2928#endif
2929
2930
2931/* YYLEX -- calling `yylex' with the right arguments. */
2932
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00002933#ifdef YYLEX_PARAM
Dan Gohmanf4423b12008-04-19 00:24:39 +00002934# define YYLEX yylex (YYLEX_PARAM)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00002935#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00002936# define YYLEX yylex ()
Gabor Greife64d2482008-04-06 23:07:54 +00002937#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002938
2939/* Enable debugging if requested. */
2940#if YYDEBUG
2941
2942# ifndef YYFPRINTF
2943# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2944# define YYFPRINTF fprintf
2945# endif
2946
2947# define YYDPRINTF(Args) \
2948do { \
2949 if (yydebug) \
2950 YYFPRINTF Args; \
2951} while (YYID (0))
2952
2953# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2954do { \
2955 if (yydebug) \
2956 { \
2957 YYFPRINTF (stderr, "%s ", Title); \
2958 yy_symbol_print (stderr, \
2959 Type, Value); \
2960 YYFPRINTF (stderr, "\n"); \
2961 } \
2962} while (YYID (0))
2963
2964
2965/*--------------------------------.
2966| Print this symbol on YYOUTPUT. |
2967`--------------------------------*/
2968
2969/*ARGSUSED*/
2970#if (defined __STDC__ || defined __C99__FUNC__ \
2971 || defined __cplusplus || defined _MSC_VER)
2972static void
2973yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
Gabor Greife64d2482008-04-06 23:07:54 +00002974#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00002975static void
2976yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2977 FILE *yyoutput;
2978 int yytype;
2979 YYSTYPE const * const yyvaluep;
Gabor Greife64d2482008-04-06 23:07:54 +00002980#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002981{
2982 if (!yyvaluep)
2983 return;
2984# ifdef YYPRINT
2985 if (yytype < YYNTOKENS)
2986 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2987# else
2988 YYUSE (yyoutput);
2989# endif
2990 switch (yytype)
2991 {
2992 default:
2993 break;
2994 }
2995}
2996
2997
2998/*--------------------------------.
2999| Print this symbol on YYOUTPUT. |
3000`--------------------------------*/
3001
3002#if (defined __STDC__ || defined __C99__FUNC__ \
3003 || defined __cplusplus || defined _MSC_VER)
3004static void
3005yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
3006#else
3007static void
3008yy_symbol_print (yyoutput, yytype, yyvaluep)
3009 FILE *yyoutput;
3010 int yytype;
3011 YYSTYPE const * const yyvaluep;
Scott Michel15dcd8e2008-01-30 03:10:00 +00003012#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003013{
3014 if (yytype < YYNTOKENS)
3015 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
3016 else
3017 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
Chris Lattner38905612008-02-19 04:36:25 +00003018
Dan Gohmanf4423b12008-04-19 00:24:39 +00003019 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
3020 YYFPRINTF (yyoutput, ")");
3021}
Chris Lattner38905612008-02-19 04:36:25 +00003022
Dan Gohmanf4423b12008-04-19 00:24:39 +00003023/*------------------------------------------------------------------.
3024| yy_stack_print -- Print the state stack from its BOTTOM up to its |
3025| TOP (included). |
3026`------------------------------------------------------------------*/
Chris Lattner38905612008-02-19 04:36:25 +00003027
Dan Gohmanf4423b12008-04-19 00:24:39 +00003028#if (defined __STDC__ || defined __C99__FUNC__ \
3029 || defined __cplusplus || defined _MSC_VER)
3030static void
3031yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
3032#else
3033static void
3034yy_stack_print (bottom, top)
3035 yytype_int16 *bottom;
3036 yytype_int16 *top;
Scott Michel15dcd8e2008-01-30 03:10:00 +00003037#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003038{
3039 YYFPRINTF (stderr, "Stack now");
3040 for (; bottom <= top; ++bottom)
3041 YYFPRINTF (stderr, " %d", *bottom);
3042 YYFPRINTF (stderr, "\n");
3043}
Chris Lattner38905612008-02-19 04:36:25 +00003044
Dan Gohmanf4423b12008-04-19 00:24:39 +00003045# define YY_STACK_PRINT(Bottom, Top) \
3046do { \
3047 if (yydebug) \
3048 yy_stack_print ((Bottom), (Top)); \
3049} while (YYID (0))
Chris Lattner38905612008-02-19 04:36:25 +00003050
Dan Gohmanf4423b12008-04-19 00:24:39 +00003051
3052/*------------------------------------------------.
3053| Report that the YYRULE is going to be reduced. |
3054`------------------------------------------------*/
3055
3056#if (defined __STDC__ || defined __C99__FUNC__ \
3057 || defined __cplusplus || defined _MSC_VER)
3058static void
3059yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
3060#else
3061static void
3062yy_reduce_print (yyvsp, yyrule)
3063 YYSTYPE *yyvsp;
3064 int yyrule;
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00003065#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003066{
3067 int yynrhs = yyr2[yyrule];
3068 int yyi;
3069 unsigned long int yylno = yyrline[yyrule];
3070 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
3071 yyrule - 1, yylno);
3072 /* The symbols being reduced. */
3073 for (yyi = 0; yyi < yynrhs; yyi++)
3074 {
3075 fprintf (stderr, " $%d = ", yyi + 1);
3076 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
3077 &(yyvsp[(yyi + 1) - (yynrhs)])
3078 );
3079 fprintf (stderr, "\n");
3080 }
3081}
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003082
Dan Gohmanf4423b12008-04-19 00:24:39 +00003083# define YY_REDUCE_PRINT(Rule) \
3084do { \
3085 if (yydebug) \
3086 yy_reduce_print (yyvsp, Rule); \
3087} while (YYID (0))
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003088
Dan Gohmanf4423b12008-04-19 00:24:39 +00003089/* Nonzero means print parse trace. It is left uninitialized so that
3090 multiple parsers can coexist. */
3091int yydebug;
3092#else /* !YYDEBUG */
3093# define YYDPRINTF(Args)
3094# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
3095# define YY_STACK_PRINT(Bottom, Top)
3096# define YY_REDUCE_PRINT(Rule)
3097#endif /* !YYDEBUG */
3098
3099
3100/* YYINITDEPTH -- initial size of the parser's stacks. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003101#ifndef YYINITDEPTH
Dan Gohmanf4423b12008-04-19 00:24:39 +00003102# define YYINITDEPTH 200
Reid Spencer68a24bd2005-08-27 18:50:39 +00003103#endif
3104
Dan Gohmanf4423b12008-04-19 00:24:39 +00003105/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
3106 if the built-in stack extension method is used).
Reid Spencer68a24bd2005-08-27 18:50:39 +00003107
Dan Gohmanf4423b12008-04-19 00:24:39 +00003108 Do not make this value too large; the results are undefined if
3109 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
3110 evaluated with infinite-precision integer arithmetic. */
David Greene718fda32007-08-01 03:59:32 +00003111
Reid Spencer68a24bd2005-08-27 18:50:39 +00003112#ifndef YYMAXDEPTH
Dan Gohmanf4423b12008-04-19 00:24:39 +00003113# define YYMAXDEPTH 10000
Reid Spencer68a24bd2005-08-27 18:50:39 +00003114#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003115
Reid Spencer68a24bd2005-08-27 18:50:39 +00003116
3117
Dan Gohmanf4423b12008-04-19 00:24:39 +00003118#if YYERROR_VERBOSE
Reid Spencer68a24bd2005-08-27 18:50:39 +00003119
Dan Gohmanf4423b12008-04-19 00:24:39 +00003120# ifndef yystrlen
3121# if defined __GLIBC__ && defined _STRING_H
3122# define yystrlen strlen
3123# else
3124/* Return the length of YYSTR. */
3125#if (defined __STDC__ || defined __C99__FUNC__ \
3126 || defined __cplusplus || defined _MSC_VER)
3127static YYSIZE_T
3128yystrlen (const char *yystr)
Chris Lattner38905612008-02-19 04:36:25 +00003129#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00003130static YYSIZE_T
3131yystrlen (yystr)
3132 const char *yystr;
3133#endif
3134{
3135 YYSIZE_T yylen;
3136 for (yylen = 0; yystr[yylen]; yylen++)
3137 continue;
3138 return yylen;
3139}
3140# endif
3141# endif
3142
3143# ifndef yystpcpy
3144# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
3145# define yystpcpy stpcpy
3146# else
3147/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
3148 YYDEST. */
3149#if (defined __STDC__ || defined __C99__FUNC__ \
3150 || defined __cplusplus || defined _MSC_VER)
3151static char *
3152yystpcpy (char *yydest, const char *yysrc)
3153#else
3154static char *
3155yystpcpy (yydest, yysrc)
3156 char *yydest;
3157 const char *yysrc;
3158#endif
3159{
3160 char *yyd = yydest;
3161 const char *yys = yysrc;
3162
3163 while ((*yyd++ = *yys++) != '\0')
3164 continue;
3165
3166 return yyd - 1;
3167}
3168# endif
3169# endif
3170
3171# ifndef yytnamerr
3172/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3173 quotes and backslashes, so that it's suitable for yyerror. The
3174 heuristic is that double-quoting is unnecessary unless the string
3175 contains an apostrophe, a comma, or backslash (other than
3176 backslash-backslash). YYSTR is taken from yytname. If YYRES is
3177 null, do not copy; instead, return the length of what the result
3178 would have been. */
3179static YYSIZE_T
3180yytnamerr (char *yyres, const char *yystr)
3181{
3182 if (*yystr == '"')
3183 {
3184 YYSIZE_T yyn = 0;
3185 char const *yyp = yystr;
3186
3187 for (;;)
3188 switch (*++yyp)
3189 {
3190 case '\'':
3191 case ',':
3192 goto do_not_strip_quotes;
3193
3194 case '\\':
3195 if (*++yyp != '\\')
3196 goto do_not_strip_quotes;
3197 /* Fall through. */
3198 default:
3199 if (yyres)
3200 yyres[yyn] = *yyp;
3201 yyn++;
3202 break;
3203
3204 case '"':
3205 if (yyres)
3206 yyres[yyn] = '\0';
3207 return yyn;
3208 }
3209 do_not_strip_quotes: ;
3210 }
3211
3212 if (! yyres)
3213 return yystrlen (yystr);
3214
3215 return yystpcpy (yyres, yystr) - yyres;
3216}
3217# endif
3218
3219/* Copy into YYRESULT an error message about the unexpected token
3220 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3221 including the terminating null byte. If YYRESULT is null, do not
3222 copy anything; just return the number of bytes that would be
3223 copied. As a special case, return 0 if an ordinary "syntax error"
3224 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3225 size calculation. */
3226static YYSIZE_T
3227yysyntax_error (char *yyresult, int yystate, int yychar)
3228{
3229 int yyn = yypact[yystate];
3230
3231 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3232 return 0;
3233 else
3234 {
3235 int yytype = YYTRANSLATE (yychar);
3236 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3237 YYSIZE_T yysize = yysize0;
3238 YYSIZE_T yysize1;
3239 int yysize_overflow = 0;
3240 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3241 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3242 int yyx;
3243
3244# if 0
3245 /* This is so xgettext sees the translatable formats that are
3246 constructed on the fly. */
3247 YY_("syntax error, unexpected %s");
3248 YY_("syntax error, unexpected %s, expecting %s");
3249 YY_("syntax error, unexpected %s, expecting %s or %s");
3250 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3251 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3252# endif
3253 char *yyfmt;
3254 char const *yyf;
3255 static char const yyunexpected[] = "syntax error, unexpected %s";
3256 static char const yyexpecting[] = ", expecting %s";
3257 static char const yyor[] = " or %s";
3258 char yyformat[sizeof yyunexpected
3259 + sizeof yyexpecting - 1
3260 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3261 * (sizeof yyor - 1))];
3262 char const *yyprefix = yyexpecting;
3263
3264 /* Start YYX at -YYN if negative to avoid negative indexes in
3265 YYCHECK. */
3266 int yyxbegin = yyn < 0 ? -yyn : 0;
3267
3268 /* Stay within bounds of both yycheck and yytname. */
3269 int yychecklim = YYLAST - yyn + 1;
3270 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3271 int yycount = 1;
3272
3273 yyarg[0] = yytname[yytype];
3274 yyfmt = yystpcpy (yyformat, yyunexpected);
3275
3276 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3277 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3278 {
3279 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3280 {
3281 yycount = 1;
3282 yysize = yysize0;
3283 yyformat[sizeof yyunexpected - 1] = '\0';
3284 break;
3285 }
3286 yyarg[yycount++] = yytname[yyx];
3287 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3288 yysize_overflow |= (yysize1 < yysize);
3289 yysize = yysize1;
3290 yyfmt = yystpcpy (yyfmt, yyprefix);
3291 yyprefix = yyor;
3292 }
3293
3294 yyf = YY_(yyformat);
3295 yysize1 = yysize + yystrlen (yyf);
3296 yysize_overflow |= (yysize1 < yysize);
3297 yysize = yysize1;
3298
3299 if (yysize_overflow)
3300 return YYSIZE_MAXIMUM;
3301
3302 if (yyresult)
3303 {
3304 /* Avoid sprintf, as that infringes on the user's name space.
3305 Don't have undefined behavior even if the translation
3306 produced a string with the wrong number of "%s"s. */
3307 char *yyp = yyresult;
3308 int yyi = 0;
3309 while ((*yyp = *yyf) != '\0')
3310 {
3311 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3312 {
3313 yyp += yytnamerr (yyp, yyarg[yyi++]);
3314 yyf += 2;
3315 }
3316 else
3317 {
3318 yyp++;
3319 yyf++;
3320 }
3321 }
3322 }
3323 return yysize;
3324 }
3325}
3326#endif /* YYERROR_VERBOSE */
3327
3328
3329/*-----------------------------------------------.
3330| Release the memory associated to this symbol. |
3331`-----------------------------------------------*/
3332
3333/*ARGSUSED*/
3334#if (defined __STDC__ || defined __C99__FUNC__ \
3335 || defined __cplusplus || defined _MSC_VER)
3336static void
3337yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3338#else
3339static void
3340yydestruct (yymsg, yytype, yyvaluep)
3341 const char *yymsg;
3342 int yytype;
3343 YYSTYPE *yyvaluep;
3344#endif
3345{
3346 YYUSE (yyvaluep);
3347
3348 if (!yymsg)
3349 yymsg = "Deleting";
3350 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3351
3352 switch (yytype)
3353 {
3354
3355 default:
3356 break;
3357 }
3358}
3359
3360
3361/* Prevent warnings from -Wmissing-prototypes. */
3362
3363#ifdef YYPARSE_PARAM
3364#if defined __STDC__ || defined __cplusplus
3365int yyparse (void *YYPARSE_PARAM);
3366#else
3367int yyparse ();
3368#endif
3369#else /* ! YYPARSE_PARAM */
3370#if defined __STDC__ || defined __cplusplus
David Greene5fd22a82007-09-04 18:46:50 +00003371int yyparse (void);
Gabor Greife64d2482008-04-06 23:07:54 +00003372#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00003373int yyparse ();
Scott Michel15dcd8e2008-01-30 03:10:00 +00003374#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003375#endif /* ! YYPARSE_PARAM */
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003376
Chris Lattner38905612008-02-19 04:36:25 +00003377
Dan Gohmanf4423b12008-04-19 00:24:39 +00003378
3379/* The look-ahead symbol. */
3380int yychar;
3381
3382/* The semantic value of the look-ahead symbol. */
3383YYSTYPE yylval;
3384
3385/* Number of syntax errors so far. */
3386int yynerrs;
3387
3388
3389
3390/*----------.
3391| yyparse. |
3392`----------*/
3393
3394#ifdef YYPARSE_PARAM
3395#if (defined __STDC__ || defined __C99__FUNC__ \
3396 || defined __cplusplus || defined _MSC_VER)
3397int
3398yyparse (void *YYPARSE_PARAM)
3399#else
3400int
3401yyparse (YYPARSE_PARAM)
3402 void *YYPARSE_PARAM;
3403#endif
3404#else /* ! YYPARSE_PARAM */
3405#if (defined __STDC__ || defined __C99__FUNC__ \
3406 || defined __cplusplus || defined _MSC_VER)
3407int
3408yyparse (void)
3409#else
3410int
3411yyparse ()
3412
Gabor Greife64d2482008-04-06 23:07:54 +00003413#endif
3414#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003415{
3416
3417 int yystate;
3418 int yyn;
3419 int yyresult;
3420 /* Number of tokens to shift before error messages enabled. */
3421 int yyerrstatus;
3422 /* Look-ahead token as an internal (translated) token number. */
3423 int yytoken = 0;
3424#if YYERROR_VERBOSE
3425 /* Buffer for error messages, and its allocated size. */
3426 char yymsgbuf[128];
3427 char *yymsg = yymsgbuf;
3428 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
Gabor Greife64d2482008-04-06 23:07:54 +00003429#endif
Chris Lattner38905612008-02-19 04:36:25 +00003430
Dan Gohmanf4423b12008-04-19 00:24:39 +00003431 /* Three stacks and their tools:
3432 `yyss': related to states,
3433 `yyvs': related to semantic values,
3434 `yyls': related to locations.
3435
3436 Refer to the stacks thru separate pointers, to allow yyoverflow
3437 to reallocate them elsewhere. */
3438
3439 /* The state stack. */
3440 yytype_int16 yyssa[YYINITDEPTH];
3441 yytype_int16 *yyss = yyssa;
3442 yytype_int16 *yyssp;
3443
3444 /* The semantic value stack. */
3445 YYSTYPE yyvsa[YYINITDEPTH];
3446 YYSTYPE *yyvs = yyvsa;
3447 YYSTYPE *yyvsp;
3448
3449
3450
3451#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3452
3453 YYSIZE_T yystacksize = YYINITDEPTH;
3454
3455 /* The variables used to return semantic value and location from the
3456 action routines. */
3457 YYSTYPE yyval;
3458
3459
3460 /* The number of symbols on the RHS of the reduced rule.
3461 Keep to zero when no symbol should be popped. */
3462 int yylen = 0;
3463
3464 YYDPRINTF ((stderr, "Starting parse\n"));
3465
Reid Spencer68a24bd2005-08-27 18:50:39 +00003466 yystate = 0;
3467 yyerrstatus = 0;
3468 yynerrs = 0;
3469 yychar = YYEMPTY; /* Cause a token to be read. */
3470
3471 /* Initialize stack pointers.
3472 Waste one element of value and location stack
3473 so that they stay on the same level as the state stack.
3474 The wasted elements are never initialized. */
3475
Dan Gohmanf4423b12008-04-19 00:24:39 +00003476 yyssp = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003477 yyvsp = yyvs;
3478
Dan Gohmanf4423b12008-04-19 00:24:39 +00003479 goto yysetstate;
Jeff Cohen66c5fd62005-10-23 04:37:20 +00003480
Dan Gohmanf4423b12008-04-19 00:24:39 +00003481/*------------------------------------------------------------.
3482| yynewstate -- Push a new state, which is found in yystate. |
3483`------------------------------------------------------------*/
3484 yynewstate:
3485 /* In all cases, when you get here, the value and location stacks
3486 have just been pushed. So pushing a state here evens the stacks. */
3487 yyssp++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003488
Dan Gohmanf4423b12008-04-19 00:24:39 +00003489 yysetstate:
3490 *yyssp = yystate;
3491
3492 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003493 {
3494 /* Get the current used size of the three stacks, in elements. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003495 YYSIZE_T yysize = yyssp - yyss + 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003496
3497#ifdef yyoverflow
Dan Gohmanf4423b12008-04-19 00:24:39 +00003498 {
3499 /* Give user a chance to reallocate the stack. Use copies of
3500 these so that the &'s don't force the real ones into
3501 memory. */
3502 YYSTYPE *yyvs1 = yyvs;
3503 yytype_int16 *yyss1 = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003504
Dan Gohmanf4423b12008-04-19 00:24:39 +00003505
3506 /* Each stack pointer address is followed by the size of the
3507 data in use in that stack, in bytes. This used to be a
3508 conditional around just the two extra args, but that might
3509 be undefined if yyoverflow is a macro. */
3510 yyoverflow (YY_("memory exhausted"),
3511 &yyss1, yysize * sizeof (*yyssp),
3512 &yyvs1, yysize * sizeof (*yyvsp),
3513
3514 &yystacksize);
3515
3516 yyss = yyss1;
3517 yyvs = yyvs1;
3518 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00003519#else /* no yyoverflow */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003520# ifndef YYSTACK_RELOCATE
3521 goto yyexhaustedlab;
3522# else
Reid Spencer68a24bd2005-08-27 18:50:39 +00003523 /* Extend the stack our own way. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003524 if (YYMAXDEPTH <= yystacksize)
3525 goto yyexhaustedlab;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003526 yystacksize *= 2;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003527 if (YYMAXDEPTH < yystacksize)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003528 yystacksize = YYMAXDEPTH;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003529
3530 {
3531 yytype_int16 *yyss1 = yyss;
3532 union yyalloc *yyptr =
3533 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3534 if (! yyptr)
3535 goto yyexhaustedlab;
3536 YYSTACK_RELOCATE (yyss);
3537 YYSTACK_RELOCATE (yyvs);
3538
3539# undef YYSTACK_RELOCATE
3540 if (yyss1 != yyssa)
3541 YYSTACK_FREE (yyss1);
3542 }
3543# endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00003544#endif /* no yyoverflow */
3545
Dan Gohmanf4423b12008-04-19 00:24:39 +00003546 yyssp = yyss + yysize - 1;
3547 yyvsp = yyvs + yysize - 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003548
3549
Dan Gohmanf4423b12008-04-19 00:24:39 +00003550 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3551 (unsigned long int) yystacksize));
3552
3553 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003554 YYABORT;
3555 }
3556
Dan Gohmanf4423b12008-04-19 00:24:39 +00003557 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003558
3559 goto yybackup;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003560
Dan Gohmanf4423b12008-04-19 00:24:39 +00003561/*-----------.
3562| yybackup. |
3563`-----------*/
3564yybackup:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003565
Dan Gohmanf4423b12008-04-19 00:24:39 +00003566 /* Do appropriate processing given the current state. Read a
3567 look-ahead token if we need one and don't already have one. */
Reid Spencer7780acb2007-04-16 06:56:07 +00003568
Dan Gohmanf4423b12008-04-19 00:24:39 +00003569 /* First try to decide what to do without reference to look-ahead token. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003570 yyn = yypact[yystate];
Dan Gohmanf4423b12008-04-19 00:24:39 +00003571 if (yyn == YYPACT_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003572 goto yydefault;
3573
Dan Gohmanf4423b12008-04-19 00:24:39 +00003574 /* Not known => get a look-ahead token if don't already have one. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003575
Dan Gohmanf4423b12008-04-19 00:24:39 +00003576 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003577 if (yychar == YYEMPTY)
3578 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003579 YYDPRINTF ((stderr, "Reading a token: "));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003580 yychar = YYLEX;
3581 }
3582
Dan Gohmanf4423b12008-04-19 00:24:39 +00003583 if (yychar <= YYEOF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003584 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003585 yychar = yytoken = YYEOF;
3586 YYDPRINTF ((stderr, "Now at end of input.\n"));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003587 }
3588 else
3589 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003590 yytoken = YYTRANSLATE (yychar);
3591 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Reid Spencer68a24bd2005-08-27 18:50:39 +00003592 }
3593
Dan Gohmanf4423b12008-04-19 00:24:39 +00003594 /* If the proper action on seeing token YYTOKEN is to reduce or to
3595 detect an error, take that action. */
3596 yyn += yytoken;
3597 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003598 goto yydefault;
3599 yyn = yytable[yyn];
Dan Gohmanf4423b12008-04-19 00:24:39 +00003600 if (yyn <= 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003601 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003602 if (yyn == 0 || yyn == YYTABLE_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003603 goto yyerrlab;
3604 yyn = -yyn;
3605 goto yyreduce;
3606 }
3607
3608 if (yyn == YYFINAL)
3609 YYACCEPT;
3610
Dan Gohmanf4423b12008-04-19 00:24:39 +00003611 /* Count tokens shifted since error; after three, turn off error
3612 status. */
3613 if (yyerrstatus)
3614 yyerrstatus--;
Dale Johannesencdd509a2007-09-07 21:07:57 +00003615
Dan Gohmanf4423b12008-04-19 00:24:39 +00003616 /* Shift the look-ahead token. */
3617 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003618
Dan Gohmanf4423b12008-04-19 00:24:39 +00003619 /* Discard the shifted token unless it is eof. */
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003620 if (yychar != YYEOF)
3621 yychar = YYEMPTY;
3622
Gabor Greife64d2482008-04-06 23:07:54 +00003623 yystate = yyn;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003624 *++yyvsp = yylval;
3625
Reid Spencer68a24bd2005-08-27 18:50:39 +00003626 goto yynewstate;
3627
Gabor Greife64d2482008-04-06 23:07:54 +00003628
Dan Gohmanf4423b12008-04-19 00:24:39 +00003629/*-----------------------------------------------------------.
3630| yydefault -- do the default action for the current state. |
3631`-----------------------------------------------------------*/
3632yydefault:
Reid Spencer68a24bd2005-08-27 18:50:39 +00003633 yyn = yydefact[yystate];
3634 if (yyn == 0)
3635 goto yyerrlab;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003636 goto yyreduce;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003637
Dan Gohmanf4423b12008-04-19 00:24:39 +00003638
3639/*-----------------------------.
3640| yyreduce -- Do a reduction. |
3641`-----------------------------*/
Reid Spencer68a24bd2005-08-27 18:50:39 +00003642yyreduce:
Dan Gohmanf4423b12008-04-19 00:24:39 +00003643 /* yyn is the number of a rule to reduce with. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003644 yylen = yyr2[yyn];
3645
Dan Gohmanf4423b12008-04-19 00:24:39 +00003646 /* If YYLEN is nonzero, implement the default value of the action:
3647 `$$ = $1'.
3648
3649 Otherwise, the following line sets YYVAL to garbage.
3650 This behavior is undocumented and Bison
3651 users should not rely upon it. Assigning to YYVAL
3652 unconditionally makes the parser a bit smaller, and it avoids a
3653 GCC warning that YYVAL may be used uninitialized. */
3654 yyval = yyvsp[1-yylen];
3655
3656
3657 YY_REDUCE_PRINT (yyn);
3658 switch (yyn)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003659 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003660 case 29:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003661#line 1148 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003662 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3663 break;
Reid Spencer41dff5e2007-01-26 08:05:27 +00003664
Dan Gohmanf4423b12008-04-19 00:24:39 +00003665 case 30:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003666#line 1148 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003667 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3668 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003669
Dan Gohmanf4423b12008-04-19 00:24:39 +00003670 case 31:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003671#line 1149 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003672 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3673 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003674
Dan Gohmanf4423b12008-04-19 00:24:39 +00003675 case 32:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003676#line 1149 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003677 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3678 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003679
Dan Gohmanf4423b12008-04-19 00:24:39 +00003680 case 33:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003681#line 1150 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003682 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3683 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003684
Dan Gohmanf4423b12008-04-19 00:24:39 +00003685 case 34:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003686#line 1150 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003687 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3688 break;
3689
3690 case 35:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003691#line 1151 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003692 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3693 break;
3694
3695 case 36:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003696#line 1151 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003697 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3698 break;
3699
3700 case 37:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003701#line 1152 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003702 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3703 break;
3704
3705 case 38:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003706#line 1152 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003707 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3708 break;
3709
3710 case 39:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003711#line 1156 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003712 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3713 break;
3714
3715 case 40:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003716#line 1156 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003717 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3718 break;
3719
3720 case 41:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003721#line 1157 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003722 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3723 break;
3724
3725 case 42:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003726#line 1157 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003727 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3728 break;
3729
3730 case 43:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003731#line 1158 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003732 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3733 break;
3734
3735 case 44:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003736#line 1158 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003737 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3738 break;
3739
3740 case 45:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003741#line 1159 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003742 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3743 break;
3744
3745 case 46:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003746#line 1159 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003747 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3748 break;
3749
3750 case 47:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003751#line 1160 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003752 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3753 break;
3754
3755 case 48:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003756#line 1160 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003757 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3758 break;
3759
3760 case 49:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003761#line 1161 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003762 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3763 break;
3764
3765 case 50:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003766#line 1161 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003767 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3768 break;
3769
3770 case 51:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003771#line 1162 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003772 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3773 break;
3774
3775 case 52:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003776#line 1162 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003777 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3778 break;
3779
3780 case 53:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003781#line 1163 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003782 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3783 break;
3784
3785 case 54:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003786#line 1164 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003787 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3788 break;
3789
3790 case 65:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003791#line 1173 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003792 { (yyval.StrVal) = 0; ;}
3793 break;
3794
3795 case 66:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003796#line 1175 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003797 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3798 break;
3799
3800 case 67:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003801#line 1176 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003802 { (yyval.UIntVal)=0; ;}
3803 break;
3804
3805 case 68:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003806#line 1180 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003807 {
3808 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003809 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003810 ;}
3811 break;
3812
3813 case 69:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003814#line 1184 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003815 {
3816 (yyval.StrVal) = 0;
Christopher Lambbf3348d2007-12-12 08:45:45 +00003817 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003818 ;}
3819 break;
3820
Chris Lattner15bd0952008-08-29 17:20:18 +00003821 case 70:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003822#line 1189 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003823 {
Chris Lattner15bd0952008-08-29 17:20:18 +00003824 (yyval.UIntVal) = (yyvsp[(1) - (2)].UIntVal);
3825 CHECK_FOR_ERROR
3826;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003827 break;
3828
3829 case 74:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003830#line 1198 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003831 {
3832 (yyval.StrVal) = 0;
3833 CHECK_FOR_ERROR
3834 ;}
3835 break;
3836
3837 case 75:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003838#line 1203 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003839 {
3840 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00003841 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003842 ;}
3843 break;
3844
Chris Lattner15bd0952008-08-29 17:20:18 +00003845 case 76:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003846#line 1209 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003847 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3848 break;
3849
Chris Lattner15bd0952008-08-29 17:20:18 +00003850 case 77:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003851#line 1210 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003852 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3853 break;
3854
Chris Lattner15bd0952008-08-29 17:20:18 +00003855 case 78:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003856#line 1211 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003857 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3858 break;
3859
Chris Lattner15bd0952008-08-29 17:20:18 +00003860 case 79:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003861#line 1212 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003862 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3863 break;
3864
Chris Lattner15bd0952008-08-29 17:20:18 +00003865 case 80:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003866#line 1213 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003867 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3868 break;
3869
Chris Lattner15bd0952008-08-29 17:20:18 +00003870 case 81:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003871#line 1214 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003872 { (yyval.Linkage) = GlobalValue::CommonLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003873 break;
3874
Chris Lattner15bd0952008-08-29 17:20:18 +00003875 case 82:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003876#line 1218 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003877 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003878 break;
3879
Chris Lattner15bd0952008-08-29 17:20:18 +00003880 case 83:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003881#line 1219 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003882 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003883 break;
3884
Chris Lattner15bd0952008-08-29 17:20:18 +00003885 case 84:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003886#line 1220 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003887 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003888 break;
3889
Dan Gohmanf4423b12008-04-19 00:24:39 +00003890 case 85:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003891#line 1224 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003892 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003893 break;
3894
3895 case 86:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003896#line 1225 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003897 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003898 break;
3899
3900 case 87:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003901#line 1226 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003902 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003903 break;
3904
3905 case 88:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003906#line 1227 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003907 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003908 break;
3909
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003910 case 89:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003911#line 1231 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003912 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003913 break;
3914
3915 case 90:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003916#line 1232 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003917 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003918 break;
3919
3920 case 91:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003921#line 1233 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003922 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003923 break;
3924
3925 case 92:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003926#line 1237 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003927 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3928 break;
3929
Chris Lattner15bd0952008-08-29 17:20:18 +00003930 case 93:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003931#line 1238 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003932 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003933 break;
3934
Chris Lattner15bd0952008-08-29 17:20:18 +00003935 case 94:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003936#line 1239 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003937 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3938 break;
3939
3940 case 95:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003941#line 1240 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003942 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3943 break;
3944
3945 case 96:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003946#line 1241 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003947 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3948 break;
3949
3950 case 97:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003951#line 1245 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003952 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3953 break;
3954
3955 case 98:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003956#line 1246 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003957 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3958 break;
3959
Dan Gohmanf4423b12008-04-19 00:24:39 +00003960 case 99:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003961#line 1247 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003962 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003963 break;
3964
3965 case 100:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003966#line 1250 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003967 { (yyval.UIntVal) = CallingConv::C; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003968 break;
3969
3970 case 101:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003971#line 1251 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003972 { (yyval.UIntVal) = CallingConv::C; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003973 break;
3974
3975 case 102:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003976#line 1252 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003977 { (yyval.UIntVal) = CallingConv::Fast; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003978 break;
3979
3980 case 103:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003981#line 1253 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003982 { (yyval.UIntVal) = CallingConv::Cold; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003983 break;
3984
3985 case 104:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003986#line 1254 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003987 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003988 break;
3989
3990 case 105:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003991#line 1255 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003992 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003993 break;
3994
3995 case 106:
Chris Lattnerccef6b52008-09-23 21:18:31 +00003996#line 1256 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003997 { (yyval.UIntVal) = CallingConv::X86_SSECall; ;}
3998 break;
3999
4000 case 107:
Chris Lattnerccef6b52008-09-23 21:18:31 +00004001#line 1257 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004002 {
4003 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004004 GEN_ERROR("Calling conv too large");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004005 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004006 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004007 ;}
4008 break;
4009
Dan Gohmanf4423b12008-04-19 00:24:39 +00004010 case 108:
Chris Lattnerccef6b52008-09-23 21:18:31 +00004011#line 1264 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004012 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004013 break;
4014
4015 case 109:
Chris Lattnerccef6b52008-09-23 21:18:31 +00004016#line 1265 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004017 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004018 break;
4019
4020 case 110:
Chris Lattnerccef6b52008-09-23 21:18:31 +00004021#line 1266 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004022 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004023 break;
4024
4025 case 111:
Chris Lattnerccef6b52008-09-23 21:18:31 +00004026#line 1267 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004027 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004028 break;
4029
4030 case 112:
Chris Lattnerccef6b52008-09-23 21:18:31 +00004031#line 1268 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004032 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004033 break;
4034
4035 case 113:
Chris Lattnerccef6b52008-09-23 21:18:31 +00004036#line 1269 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004037 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004038 break;
4039
4040 case 114:
Chris Lattnerccef6b52008-09-23 21:18:31 +00004041#line 1270 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004042 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004043 break;
4044
4045 case 115:
Chris Lattnerccef6b52008-09-23 21:18:31 +00004046#line 1271 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004047 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004048 break;
4049
4050 case 116:
Chris Lattnerccef6b52008-09-23 21:18:31 +00004051#line 1272 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004052 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
4053 break;
4054
4055 case 117:
Chris Lattnerccef6b52008-09-23 21:18:31 +00004056#line 1273 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004057 { (yyval.ParamAttrs) =
4058 ParamAttr::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
4059 break;
4060
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004061 case 118:
Chris Lattnerccef6b52008-09-23 21:18:31 +00004062#line 1277 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004063 { (yyval.ParamAttrs) = ParamAttr::None; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004064 break;
4065
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004066 case 119:
Chris Lattnerccef6b52008-09-23 21:18:31 +00004067#line 1278 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004068 {
4069 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
4070 ;}
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004071 break;
4072
Chris Lattner15bd0952008-08-29 17:20:18 +00004073 case 120:
Chris Lattnerccef6b52008-09-23 21:18:31 +00004074#line 1283 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004075 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
4076 break;
4077
4078 case 121:
Chris Lattnerccef6b52008-09-23 21:18:31 +00004079#line 1284 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004080 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
4081 break;
4082
4083 case 122:
Chris Lattnerccef6b52008-09-23 21:18:31 +00004084#line 1285 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4085 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
Chris Lattner15bd0952008-08-29 17:20:18 +00004086 break;
4087
4088 case 123:
Chris Lattnerccef6b52008-09-23 21:18:31 +00004089#line 1286 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4090 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
Chris Lattner15bd0952008-08-29 17:20:18 +00004091 break;
4092
4093 case 124:
Chris Lattnerccef6b52008-09-23 21:18:31 +00004094#line 1287 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4095 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
Chris Lattner15bd0952008-08-29 17:20:18 +00004096 break;
4097
4098 case 125:
Chris Lattnerccef6b52008-09-23 21:18:31 +00004099#line 1288 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4100 { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
Chris Lattner15bd0952008-08-29 17:20:18 +00004101 break;
4102
4103 case 126:
Chris Lattnerccef6b52008-09-23 21:18:31 +00004104#line 1289 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4105 { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
Chris Lattner15bd0952008-08-29 17:20:18 +00004106 break;
4107
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004108 case 127:
Chris Lattnerccef6b52008-09-23 21:18:31 +00004109#line 1292 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4110 { (yyval.ParamAttrs) = ParamAttr::None; ;}
4111 break;
4112
4113 case 128:
4114#line 1293 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004115 {
4116 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
4117 ;}
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004118 break;
4119
Chris Lattnerccef6b52008-09-23 21:18:31 +00004120 case 129:
4121#line 1298 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld4980812008-09-02 20:52:40 +00004122 { (yyval.FunctionNotes) = (yyvsp[(1) - (1)].FunctionNotes); ;}
Chris Lattner15bd0952008-08-29 17:20:18 +00004123 break;
4124
Chris Lattnerccef6b52008-09-23 21:18:31 +00004125 case 130:
4126#line 1299 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld4980812008-09-02 20:52:40 +00004127 {
4128 FunctionNotes tmp = (yyvsp[(1) - (3)].FunctionNotes) | (yyvsp[(3) - (3)].FunctionNotes);
Devang Patelcb7f4832008-09-02 22:43:57 +00004129 if ((yyvsp[(3) - (3)].FunctionNotes) == FN_NOTE_NoInline && ((yyvsp[(1) - (3)].FunctionNotes) & FN_NOTE_AlwaysInline))
Devang Pateld4980812008-09-02 20:52:40 +00004130 GEN_ERROR("Function Notes may include only one inline notes!")
Devang Patelcb7f4832008-09-02 22:43:57 +00004131 if ((yyvsp[(3) - (3)].FunctionNotes) == FN_NOTE_AlwaysInline && ((yyvsp[(1) - (3)].FunctionNotes) & FN_NOTE_NoInline))
Devang Pateld4980812008-09-02 20:52:40 +00004132 GEN_ERROR("Function Notes may include only one inline notes!")
4133 (yyval.FunctionNotes) = tmp;
4134 CHECK_FOR_ERROR
4135 ;}
4136 break;
4137
Chris Lattnerccef6b52008-09-23 21:18:31 +00004138 case 131:
4139#line 1310 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcb7f4832008-09-02 22:43:57 +00004140 { (yyval.FunctionNotes) = FN_NOTE_NoInline; ;}
Devang Pateld4980812008-09-02 20:52:40 +00004141 break;
4142
Chris Lattnerccef6b52008-09-23 21:18:31 +00004143 case 132:
4144#line 1311 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcb7f4832008-09-02 22:43:57 +00004145 { (yyval.FunctionNotes) = FN_NOTE_AlwaysInline; ;}
Devang Pateld4980812008-09-02 20:52:40 +00004146 break;
4147
Chris Lattnerccef6b52008-09-23 21:18:31 +00004148 case 133:
4149#line 1312 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcb7f4832008-09-02 22:43:57 +00004150 { (yyval.FunctionNotes) = FN_NOTE_OptimizeForSize; ;}
Devang Pateld4980812008-09-02 20:52:40 +00004151 break;
4152
Chris Lattnerccef6b52008-09-23 21:18:31 +00004153 case 134:
4154#line 1315 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcb7f4832008-09-02 22:43:57 +00004155 { (yyval.FunctionNotes) = FN_NOTE_None; ;}
Devang Pateld4980812008-09-02 20:52:40 +00004156 break;
4157
Chris Lattnerccef6b52008-09-23 21:18:31 +00004158 case 135:
4159#line 1316 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld4980812008-09-02 20:52:40 +00004160 {
4161 (yyval.FunctionNotes) = (yyvsp[(3) - (4)].FunctionNotes);
4162 ;}
4163 break;
4164
Chris Lattnerccef6b52008-09-23 21:18:31 +00004165 case 136:
4166#line 1321 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Pateld4980812008-09-02 20:52:40 +00004167 { (yyval.StrVal) = 0; ;}
4168 break;
4169
Chris Lattnerccef6b52008-09-23 21:18:31 +00004170 case 137:
4171#line 1322 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004172 {
4173 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
4174 ;}
4175 break;
4176
Chris Lattnerccef6b52008-09-23 21:18:31 +00004177 case 138:
4178#line 1329 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004179 { (yyval.UIntVal) = 0; ;}
4180 break;
4181
Chris Lattnerccef6b52008-09-23 21:18:31 +00004182 case 139:
4183#line 1330 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004184 {
4185 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
4186 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004187 GEN_ERROR("Alignment must be a power of two");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004188 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004189;}
4190 break;
4191
Chris Lattnerccef6b52008-09-23 21:18:31 +00004192 case 140:
4193#line 1336 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004194 { (yyval.UIntVal) = 0; ;}
4195 break;
4196
Chris Lattnerccef6b52008-09-23 21:18:31 +00004197 case 141:
4198#line 1337 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004199 {
4200 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
4201 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Christopher Lambbf3348d2007-12-12 08:45:45 +00004202 GEN_ERROR("Alignment must be a power of two");
4203 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004204;}
4205 break;
4206
Chris Lattnerccef6b52008-09-23 21:18:31 +00004207 case 142:
4208#line 1346 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004209 {
4210 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
4211 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004212 GEN_ERROR("Invalid character in section name");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004213 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004214 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004215;}
4216 break;
4217
Chris Lattnerccef6b52008-09-23 21:18:31 +00004218 case 143:
4219#line 1354 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004220 { (yyval.StrVal) = 0; ;}
4221 break;
4222
Chris Lattnerccef6b52008-09-23 21:18:31 +00004223 case 144:
4224#line 1355 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004225 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
4226 break;
4227
Devang Pateld4980812008-09-02 20:52:40 +00004228 case 145:
Chris Lattnerccef6b52008-09-23 21:18:31 +00004229#line 1360 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004230 {;}
4231 break;
4232
Devang Pateld4980812008-09-02 20:52:40 +00004233 case 146:
Chris Lattnerccef6b52008-09-23 21:18:31 +00004234#line 1361 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
4235 {;}
4236 break;
4237
4238 case 147:
4239#line 1362 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004240 {
4241 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
4242 delete (yyvsp[(1) - (1)].StrVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004243 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004244 ;}
4245 break;
4246
Chris Lattnerccef6b52008-09-23 21:18:31 +00004247 case 148:
4248#line 1367 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004249 {
4250 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004251 GEN_ERROR("Alignment must be a power of two");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004252 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004253 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004254 ;}
4255 break;
4256
Chris Lattnerccef6b52008-09-23 21:18:31 +00004257 case 156:
4258#line 1383 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004259 {
4260 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004261 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004262 ;}
4263 break;
4264
Chris Lattnerccef6b52008-09-23 21:18:31 +00004265 case 157:
4266#line 1387 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004267 {
4268 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004269 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004270 ;}
4271 break;
4272
Chris Lattnerccef6b52008-09-23 21:18:31 +00004273 case 158:
4274#line 1391 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004275 { // Pointer type?
4276 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
Christopher Lambbf3348d2007-12-12 08:45:45 +00004277 GEN_ERROR("Cannot form a pointer to a basic block");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004278 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4279 delete (yyvsp[(1) - (3)].TypeVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00004280 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004281 ;}
4282 break;
4283
Chris Lattnerccef6b52008-09-23 21:18:31 +00004284 case 159:
4285#line 1398 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004286 { // Named types are also simple types...
4287 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00004288 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004289 (yyval.TypeVal) = new PATypeHolder(tmp);
4290 ;}
4291 break;
4292
Chris Lattnerccef6b52008-09-23 21:18:31 +00004293 case 160:
4294#line 1403 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004295 { // Type UpReference
4296 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004297 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Dan Gohmanf4423b12008-04-19 00:24:39 +00004298 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4299 (yyval.TypeVal) = new PATypeHolder(OT);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004300 UR_OUT("New Upreference!\n");
4301 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004302 ;}
4303 break;
4304
Chris Lattnerccef6b52008-09-23 21:18:31 +00004305 case 161:
4306#line 1411 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004307 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004308 // Allow but ignore attributes on function types; this permits auto-upgrade.
4309 // FIXME: remove in LLVM 3.0.
Chris Lattnera925a142008-04-23 05:37:08 +00004310 const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal);
4311 if (!FunctionType::isValidReturnType(RetTy))
4312 GEN_ERROR("Invalid result type for LLVM function");
4313
Reid Spencer41dff5e2007-01-26 08:05:27 +00004314 std::vector<const Type*> Params;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004315 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00004316 for (; I != E; ++I ) {
Reid Spencer66728ef2007-03-20 01:13:36 +00004317 const Type *Ty = I->Ty->get();
Reid Spencer66728ef2007-03-20 01:13:36 +00004318 Params.push_back(Ty);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004319 }
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004320
Reid Spencer41dff5e2007-01-26 08:05:27 +00004321 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4322 if (isVarArg) Params.pop_back();
4323
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004324 for (unsigned i = 0; i != Params.size(); ++i)
4325 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4326 GEN_ERROR("Function arguments must be value types!");
4327
4328 CHECK_FOR_ERROR
4329
Anton Korobeynikovc36284e2007-12-03 19:17:47 +00004330 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004331 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4332 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4333 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Reid Spencere4d87aa2006-12-23 06:05:41 +00004334 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004335 ;}
4336 break;
4337
Chris Lattnerccef6b52008-09-23 21:18:31 +00004338 case 162:
4339#line 1440 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004340 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004341 // Allow but ignore attributes on function types; this permits auto-upgrade.
4342 // FIXME: remove in LLVM 3.0.
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004343 std::vector<const Type*> Params;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004344 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00004345 for ( ; I != E; ++I ) {
Reid Spencer66728ef2007-03-20 01:13:36 +00004346 const Type* Ty = I->Ty->get();
Reid Spencer66728ef2007-03-20 01:13:36 +00004347 Params.push_back(Ty);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004348 }
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004349
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004350 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4351 if (isVarArg) Params.pop_back();
4352
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004353 for (unsigned i = 0; i != Params.size(); ++i)
4354 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4355 GEN_ERROR("Function arguments must be value types!");
4356
4357 CHECK_FOR_ERROR
4358
Dan Gohmanf4423b12008-04-19 00:24:39 +00004359 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4360 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4361 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004362 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004363 ;}
4364 break;
4365
Chris Lattnerccef6b52008-09-23 21:18:31 +00004366 case 163:
4367#line 1465 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004368 { // Sized array type?
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004369 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (yyvsp[(2) - (5)].UInt64Val))));
Dan Gohmanf4423b12008-04-19 00:24:39 +00004370 delete (yyvsp[(4) - (5)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004371 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004372 ;}
4373 break;
4374
Chris Lattnerccef6b52008-09-23 21:18:31 +00004375 case 164:
4376#line 1470 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004377 { // Vector type?
4378 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4379 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004380 GEN_ERROR("Unsigned result not equal to signed result");
4381 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4382 GEN_ERROR("Element type of a VectorType must be primitive");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004383 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4384 delete (yyvsp[(4) - (5)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004385 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004386 ;}
4387 break;
4388
Chris Lattnerccef6b52008-09-23 21:18:31 +00004389 case 165:
4390#line 1480 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004391 { // Structure type?
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004392 std::vector<const Type*> Elements;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004393 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4394 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004395 Elements.push_back(*I);
4396
Dan Gohmanf4423b12008-04-19 00:24:39 +00004397 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4398 delete (yyvsp[(2) - (3)].TypeList);
Reid Spencer14310612006-12-31 05:40:51 +00004399 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004400 ;}
4401 break;
4402
Chris Lattnerccef6b52008-09-23 21:18:31 +00004403 case 166:
4404#line 1490 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004405 { // Empty structure type?
4406 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Reid Spencer14310612006-12-31 05:40:51 +00004407 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004408 ;}
4409 break;
4410
Chris Lattnerccef6b52008-09-23 21:18:31 +00004411 case 167:
4412#line 1494 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004413 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004414 std::vector<const Type*> Elements;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004415 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4416 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004417 Elements.push_back(*I);
4418
Dan Gohmanf4423b12008-04-19 00:24:39 +00004419 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4420 delete (yyvsp[(3) - (5)].TypeList);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004421 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004422 ;}
4423 break;
4424
Chris Lattnerccef6b52008-09-23 21:18:31 +00004425 case 168:
4426#line 1504 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004427 { // Empty structure type?
4428 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004429 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004430 ;}
4431 break;
4432
Chris Lattnerccef6b52008-09-23 21:18:31 +00004433 case 169:
4434#line 1511 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004435 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004436 // Allow but ignore attributes on function types; this permits auto-upgrade.
4437 // FIXME: remove in LLVM 3.0.
Dan Gohmanf4423b12008-04-19 00:24:39 +00004438 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4439 (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
4440 ;}
4441 break;
4442
Chris Lattnerccef6b52008-09-23 21:18:31 +00004443 case 170:
4444#line 1520 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004445 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004446 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004447 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4448 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004449 GEN_ERROR("LLVM functions cannot return aggregate types");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004450 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4451 ;}
4452 break;
4453
Chris Lattnerccef6b52008-09-23 21:18:31 +00004454 case 171:
4455#line 1527 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004456 {
4457 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4458 ;}
4459 break;
4460
Chris Lattnerccef6b52008-09-23 21:18:31 +00004461 case 172:
4462#line 1532 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004463 {
4464 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4465 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
Reid Spencer3da59db2006-11-27 01:05:10 +00004466 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004467 ;}
4468 break;
4469
Chris Lattnerccef6b52008-09-23 21:18:31 +00004470 case 173:
4471#line 1537 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004472 {
4473 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004474 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004475 ;}
4476 break;
4477
Chris Lattnerccef6b52008-09-23 21:18:31 +00004478 case 175:
4479#line 1545 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004480 {
4481 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
Reid Spencer18da0722007-04-11 02:44:20 +00004482 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
Reid Spencer41dff5e2007-01-26 08:05:27 +00004483 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004484 (yyval.TypeWithAttrsList)->push_back(TWA);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004485 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004486 ;}
4487 break;
4488
Chris Lattnerccef6b52008-09-23 21:18:31 +00004489 case 176:
4490#line 1552 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004491 {
4492 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004493 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4494 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004495 (yyval.TypeWithAttrsList)->push_back(TWA);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004496 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004497 ;}
4498 break;
4499
Chris Lattnerccef6b52008-09-23 21:18:31 +00004500 case 177:
4501#line 1559 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004502 {
4503 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004504 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004505 ;}
4506 break;
4507
Chris Lattnerccef6b52008-09-23 21:18:31 +00004508 case 178:
4509#line 1567 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004510 {
4511 (yyval.TypeList) = new std::list<PATypeHolder>();
4512 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4513 delete (yyvsp[(1) - (1)].TypeVal);
Reid Spencer3da59db2006-11-27 01:05:10 +00004514 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004515 ;}
4516 break;
4517
Chris Lattnerccef6b52008-09-23 21:18:31 +00004518 case 179:
4519#line 1573 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004520 {
4521 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4522 delete (yyvsp[(3) - (3)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004523 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004524 ;}
4525 break;
4526
Chris Lattnerccef6b52008-09-23 21:18:31 +00004527 case 180:
4528#line 1585 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004529 { // Nonempty unsized arr
Reid Spencer14310612006-12-31 05:40:51 +00004530 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004531 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4532 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004533 if (ATy == 0)
Reid Spencer61c83e02006-08-18 08:43:06 +00004534 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004535 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004536 const Type *ETy = ATy->getElementType();
Dan Gohman180c1692008-06-23 18:43:26 +00004537 uint64_t NumElements = ATy->getNumElements();
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004538
4539 // Verify that we have the correct size...
Mon P Wang28873102008-06-25 08:15:39 +00004540 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (4)].ConstVector)->size())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004541 GEN_ERROR("Type mismatch: constant sized array initialized with " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004542 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Mon P Wang28873102008-06-25 08:15:39 +00004543 utostr(NumElements) + "");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004544
4545 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004546 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4547 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004548 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4549 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohmanf4423b12008-04-19 00:24:39 +00004550 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004551 }
4552
Dan Gohmanf4423b12008-04-19 00:24:39 +00004553 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4554 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004555 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004556 ;}
4557 break;
4558
Chris Lattnerccef6b52008-09-23 21:18:31 +00004559 case 181:
4560#line 1613 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004561 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004562 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004563 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4564 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004565 if (ATy == 0)
4566 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004567 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004568
Dan Gohman180c1692008-06-23 18:43:26 +00004569 uint64_t NumElements = ATy->getNumElements();
Mon P Wang28873102008-06-25 08:15:39 +00004570 if (NumElements != uint64_t(-1) && NumElements != 0)
Andrew Lenharth6353e052006-12-08 18:07:09 +00004571 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
Mon P Wang28873102008-06-25 08:15:39 +00004572 " arguments, but has size of " + utostr(NumElements) +"");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004573 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4574 delete (yyvsp[(1) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00004575 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004576 ;}
4577 break;
4578
Chris Lattnerccef6b52008-09-23 21:18:31 +00004579 case 182:
4580#line 1629 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004581 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004582 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004583 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4584 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004585 if (ATy == 0)
4586 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004587 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004588
Dan Gohman180c1692008-06-23 18:43:26 +00004589 uint64_t NumElements = ATy->getNumElements();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004590 const Type *ETy = ATy->getElementType();
Mon P Wang28873102008-06-25 08:15:39 +00004591 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (3)].StrVal)->length())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004592 GEN_ERROR("Can't build string constant of size " +
Mon P Wang28873102008-06-25 08:15:39 +00004593 utostr((yyvsp[(3) - (3)].StrVal)->length()) +
4594 " when array has size " + utostr(NumElements) + "");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004595 std::vector<Constant*> Vals;
4596 if (ETy == Type::Int8Ty) {
Mon P Wang28873102008-06-25 08:15:39 +00004597 for (uint64_t i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
Dan Gohmanf4423b12008-04-19 00:24:39 +00004598 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004599 } else {
Dan Gohmanf4423b12008-04-19 00:24:39 +00004600 delete (yyvsp[(3) - (3)].StrVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004601 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4602 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004603 delete (yyvsp[(3) - (3)].StrVal);
4604 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4605 delete (yyvsp[(1) - (3)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004606 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004607 ;}
4608 break;
4609
Chris Lattnerccef6b52008-09-23 21:18:31 +00004610 case 183:
4611#line 1656 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004612 { // Nonempty unsized arr
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004613 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004614 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4615 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004616 if (PTy == 0)
4617 GEN_ERROR("Cannot make packed constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004618 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004619 const Type *ETy = PTy->getElementType();
Dan Gohman180c1692008-06-23 18:43:26 +00004620 unsigned NumElements = PTy->getNumElements();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004621
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004622 // Verify that we have the correct size...
Mon P Wang28873102008-06-25 08:15:39 +00004623 if (NumElements != unsigned(-1) && NumElements != (unsigned)(yyvsp[(3) - (4)].ConstVector)->size())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004624 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004625 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Mon P Wang28873102008-06-25 08:15:39 +00004626 utostr(NumElements) + "");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004627
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004628 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004629 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4630 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004631 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4632 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohmanf4423b12008-04-19 00:24:39 +00004633 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004634 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00004635
Dan Gohmanf4423b12008-04-19 00:24:39 +00004636 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4637 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004638 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004639 ;}
4640 break;
4641
Chris Lattnerccef6b52008-09-23 21:18:31 +00004642 case 184:
4643#line 1684 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004644 {
4645 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004646 if (STy == 0)
4647 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004648 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004649
Dan Gohmanf4423b12008-04-19 00:24:39 +00004650 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004651 GEN_ERROR("Illegal number of initializers for structure type");
4652
4653 // Check to ensure that constants are compatible with the type initializer!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004654 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4655 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004656 GEN_ERROR("Expected type '" +
4657 STy->getElementType(i)->getDescription() +
4658 "' for element #" + utostr(i) +
4659 " of structure initializer");
4660
4661 // Check to ensure that Type is not packed
4662 if (STy->isPacked())
4663 GEN_ERROR("Unpacked Initializer to vector type '" +
4664 STy->getDescription() + "'");
4665
Dan Gohmanf4423b12008-04-19 00:24:39 +00004666 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4667 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004668 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004669 ;}
4670 break;
4671
Chris Lattnerccef6b52008-09-23 21:18:31 +00004672 case 185:
4673#line 1710 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004674 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004675 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004676 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4677 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004678 if (STy == 0)
4679 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004680 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004681
4682 if (STy->getNumContainedTypes() != 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00004683 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004684
4685 // Check to ensure that Type is not packed
4686 if (STy->isPacked())
Chris Lattner6cdc6822007-04-26 05:31:05 +00004687 GEN_ERROR("Unpacked Initializer to vector type '" +
4688 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004689
Dan Gohmanf4423b12008-04-19 00:24:39 +00004690 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4691 delete (yyvsp[(1) - (3)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004692 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004693 ;}
4694 break;
4695
Chris Lattnerccef6b52008-09-23 21:18:31 +00004696 case 186:
4697#line 1730 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004698 {
4699 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004700 if (STy == 0)
4701 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004702 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004703
Dan Gohmanf4423b12008-04-19 00:24:39 +00004704 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
Reid Spencerb5334b02007-02-05 10:18:06 +00004705 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004706
4707 // Check to ensure that constants are compatible with the type initializer!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004708 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4709 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
Reid Spencer41dff5e2007-01-26 08:05:27 +00004710 GEN_ERROR("Expected type '" +
4711 STy->getElementType(i)->getDescription() +
4712 "' for element #" + utostr(i) +
Reid Spencerb5334b02007-02-05 10:18:06 +00004713 " of structure initializer");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004714
4715 // Check to ensure that Type is packed
4716 if (!STy->isPacked())
Chris Lattner32980692007-02-19 07:44:24 +00004717 GEN_ERROR("Vector initializer to non-vector type '" +
4718 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004719
Dan Gohmanf4423b12008-04-19 00:24:39 +00004720 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4721 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004722 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004723 ;}
4724 break;
4725
Chris Lattnerccef6b52008-09-23 21:18:31 +00004726 case 187:
4727#line 1756 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004728 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004729 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004730 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4731 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004732 if (STy == 0)
4733 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004734 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004735
4736 if (STy->getNumContainedTypes() != 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00004737 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004738
4739 // Check to ensure that Type is packed
4740 if (!STy->isPacked())
Chris Lattner32980692007-02-19 07:44:24 +00004741 GEN_ERROR("Vector initializer to non-vector type '" +
4742 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004743
Dan Gohmanf4423b12008-04-19 00:24:39 +00004744 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4745 delete (yyvsp[(1) - (5)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004746 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004747 ;}
4748 break;
4749
Chris Lattnerccef6b52008-09-23 21:18:31 +00004750 case 188:
4751#line 1776 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004752 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004753 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004754 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4755 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004756 if (PTy == 0)
4757 GEN_ERROR("Cannot make null pointer constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004758 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004759
Dan Gohmanf4423b12008-04-19 00:24:39 +00004760 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4761 delete (yyvsp[(1) - (2)].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004762 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004763 ;}
4764 break;
4765
Chris Lattnerccef6b52008-09-23 21:18:31 +00004766 case 189:
4767#line 1788 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004768 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004769 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004770 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4771 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4772 delete (yyvsp[(1) - (2)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004773 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004774 ;}
4775 break;
4776
Chris Lattnerccef6b52008-09-23 21:18:31 +00004777 case 190:
4778#line 1795 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004779 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004780 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004781 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4782 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004783 if (Ty == 0)
Dan Gohmanf4423b12008-04-19 00:24:39 +00004784 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004785
4786 // ConstExprs can exist in the body of a function, thus creating
4787 // GlobalValues whenever they refer to a variable. Because we are in
Reid Spencer93c40032007-03-19 18:40:50 +00004788 // the context of a function, getExistingVal will search the functions
Reid Spencer68a24bd2005-08-27 18:50:39 +00004789 // symbol table instead of the module symbol table for the global symbol,
4790 // which throws things all off. To get around this, we just tell
Reid Spencer93c40032007-03-19 18:40:50 +00004791 // getExistingVal that we are at global scope here.
Reid Spencer68a24bd2005-08-27 18:50:39 +00004792 //
4793 Function *SavedCurFn = CurFun.CurrentFunction;
4794 CurFun.CurrentFunction = 0;
4795
Dan Gohmanf4423b12008-04-19 00:24:39 +00004796 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00004797 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00004798
4799 CurFun.CurrentFunction = SavedCurFn;
4800
4801 // If this is an initializer for a constant pointer, which is referencing a
4802 // (currently) undefined variable, create a stub now that shall be replaced
4803 // in the future with the right type of variable.
4804 //
4805 if (V == 0) {
Reid Spencera9720f52007-02-05 17:04:00 +00004806 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004807 const PointerType *PT = cast<PointerType>(Ty);
4808
4809 // First check to see if the forward references value is already created!
4810 PerModuleInfo::GlobalRefsType::iterator I =
Dan Gohmanf4423b12008-04-19 00:24:39 +00004811 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004812
4813 if (I != CurModule.GlobalRefs.end()) {
4814 V = I->second; // Placeholder already exists, use it...
Dan Gohmanf4423b12008-04-19 00:24:39 +00004815 (yyvsp[(2) - (2)].ValIDVal).destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +00004816 } else {
4817 std::string Name;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004818 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4819 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4820 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
Reid Spencer41dff5e2007-01-26 08:05:27 +00004821 GEN_ERROR("Invalid reference to global");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004822
4823 // Create the forward referenced global.
4824 GlobalValue *GV;
4825 if (const FunctionType *FTy =
4826 dyn_cast<FunctionType>(PT->getElementType())) {
Gabor Greife64d2482008-04-06 23:07:54 +00004827 GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
4828 CurModule.CurrentModule);
Reid Spencer68a24bd2005-08-27 18:50:39 +00004829 } else {
4830 GV = new GlobalVariable(PT->getElementType(), false,
Chris Lattner6cdc6822007-04-26 05:31:05 +00004831 GlobalValue::ExternalWeakLinkage, 0,
Reid Spencer68a24bd2005-08-27 18:50:39 +00004832 Name, CurModule.CurrentModule);
4833 }
4834
4835 // Keep track of the fact that we have a forward ref to recycle it
Dan Gohmanf4423b12008-04-19 00:24:39 +00004836 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004837 V = GV;
4838 }
4839 }
4840
Dan Gohmanf4423b12008-04-19 00:24:39 +00004841 (yyval.ConstVal) = cast<GlobalValue>(V);
4842 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
Reid Spencer61c83e02006-08-18 08:43:06 +00004843 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004844 ;}
4845 break;
4846
Chris Lattnerccef6b52008-09-23 21:18:31 +00004847 case 191:
4848#line 1861 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004849 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004850 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004851 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4852 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004853 GEN_ERROR("Mismatched types for constant expression: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004854 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4855 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4856 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004857 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004858 ;}
4859 break;
4860
Chris Lattnerccef6b52008-09-23 21:18:31 +00004861 case 192:
4862#line 1871 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004863 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004864 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004865 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4866 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004867 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4868 GEN_ERROR("Cannot create a null initialized value of this type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004869 (yyval.ConstVal) = Constant::getNullValue(Ty);
4870 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004871 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004872 ;}
4873 break;
4874
Chris Lattnerccef6b52008-09-23 21:18:31 +00004875 case 193:
4876#line 1881 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004877 { // integral constants
4878 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004879 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004880 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
Reid Spencer38c91a92007-02-28 02:24:54 +00004881 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004882 ;}
4883 break;
4884
Chris Lattnerccef6b52008-09-23 21:18:31 +00004885 case 194:
4886#line 1887 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004887 { // arbitrary precision integer constants
4888 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4889 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004890 GEN_ERROR("Constant value does not fit in type");
4891 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004892 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4893 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4894 delete (yyvsp[(2) - (2)].APIntVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004895 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004896 ;}
4897 break;
4898
Chris Lattnerccef6b52008-09-23 21:18:31 +00004899 case 195:
4900#line 1897 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004901 { // integral constants
4902 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004903 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004904 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004905 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004906 ;}
4907 break;
4908
Chris Lattnerccef6b52008-09-23 21:18:31 +00004909 case 196:
4910#line 1903 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004911 { // arbitrary precision integer constants
4912 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4913 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004914 GEN_ERROR("Constant value does not fit in type");
4915 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004916 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4917 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4918 delete (yyvsp[(2) - (2)].APIntVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004919 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004920 ;}
4921 break;
4922
Chris Lattnerccef6b52008-09-23 21:18:31 +00004923 case 197:
4924#line 1913 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004925 { // Boolean constants
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004926 if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1)
4927 GEN_ERROR("Constant true must have type i1");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004928 (yyval.ConstVal) = ConstantInt::getTrue();
Reid Spencer38c91a92007-02-28 02:24:54 +00004929 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004930 ;}
4931 break;
4932
Chris Lattnerccef6b52008-09-23 21:18:31 +00004933 case 198:
4934#line 1919 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004935 { // Boolean constants
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004936 if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1)
4937 GEN_ERROR("Constant false must have type i1");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004938 (yyval.ConstVal) = ConstantInt::getFalse();
Reid Spencer6f407902007-01-13 05:00:46 +00004939 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004940 ;}
4941 break;
4942
Chris Lattnerccef6b52008-09-23 21:18:31 +00004943 case 199:
4944#line 1925 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004945 { // Floating point constants
4946 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004947 GEN_ERROR("Floating point constant invalid for type");
Dale Johannesenc72cd7e2007-09-11 18:33:39 +00004948 // Lexer has no type info, so builds all float and double FP constants
4949 // as double. Fix this here. Long double is done right.
Dan Gohmanf4423b12008-04-19 00:24:39 +00004950 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4951 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
Chris Lattnerd8eb63f2008-04-20 00:41:19 +00004952 (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal));
Dan Gohmanf4423b12008-04-19 00:24:39 +00004953 delete (yyvsp[(2) - (2)].FPVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004954 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004955 ;}
4956 break;
4957
Chris Lattnerccef6b52008-09-23 21:18:31 +00004958 case 200:
4959#line 1938 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004960 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004961 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004962 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4963 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4964 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4965 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004966 GEN_ERROR("invalid cast opcode for cast from '" +
4967 Val->getType()->getDescription() + "' to '" +
4968 DestTy->getDescription() + "'");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004969 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4970 delete (yyvsp[(5) - (6)].TypeVal);
4971 ;}
4972 break;
4973
Chris Lattnerccef6b52008-09-23 21:18:31 +00004974 case 201:
4975#line 1950 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004976 {
4977 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
Reid Spencerb5334b02007-02-05 10:18:06 +00004978 GEN_ERROR("GetElementPtr requires a pointer operand");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004979
4980 const Type *IdxTy =
Dan Gohman041e2eb2008-05-15 19:50:34 +00004981 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004982 if (!IdxTy)
Reid Spencerb5334b02007-02-05 10:18:06 +00004983 GEN_ERROR("Index list invalid for constant getelementptr");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004984
Chris Lattnerf7469af2007-01-31 04:44:08 +00004985 SmallVector<Constant*, 8> IdxVec;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004986 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4987 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004988 IdxVec.push_back(C);
4989 else
Reid Spencerb5334b02007-02-05 10:18:06 +00004990 GEN_ERROR("Indices to constant getelementptr must be constants");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004991
Dan Gohmanf4423b12008-04-19 00:24:39 +00004992 delete (yyvsp[(4) - (5)].ValueList);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004993
Dan Gohmanf4423b12008-04-19 00:24:39 +00004994 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
Andrew Lenharth6353e052006-12-08 18:07:09 +00004995 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004996 ;}
4997 break;
4998
Chris Lattnerccef6b52008-09-23 21:18:31 +00004999 case 202:
5000#line 1971 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005001 {
5002 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005003 GEN_ERROR("Select condition must be of boolean type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005004 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005005 GEN_ERROR("Select operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005006 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005007 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005008 ;}
5009 break;
5010
Chris Lattnerccef6b52008-09-23 21:18:31 +00005011 case 203:
5012#line 1979 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005013 {
5014 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005015 GEN_ERROR("Binary operator types must match");
5016 CHECK_FOR_ERROR;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005017 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
5018 ;}
5019 break;
5020
Chris Lattnerccef6b52008-09-23 21:18:31 +00005021 case 204:
5022#line 1985 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005023 {
5024 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005025 GEN_ERROR("Logical operator types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005026 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005027 if (!isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
Dan Gohmanf4423b12008-04-19 00:24:39 +00005028 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005029 GEN_ERROR("Logical operator requires integral operands");
5030 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00005031 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005032 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005033 ;}
5034 break;
5035
Chris Lattnerccef6b52008-09-23 21:18:31 +00005036 case 205:
5037#line 1996 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005038 {
5039 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005040 GEN_ERROR("icmp operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005041 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5042 ;}
5043 break;
5044
Chris Lattnerccef6b52008-09-23 21:18:31 +00005045 case 206:
5046#line 2001 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005047 {
5048 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005049 GEN_ERROR("fcmp operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005050 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5051 ;}
5052 break;
5053
Chris Lattnerccef6b52008-09-23 21:18:31 +00005054 case 207:
5055#line 2006 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00005056 {
5057 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5058 GEN_ERROR("vicmp operand types must match");
5059 (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5060 ;}
5061 break;
5062
Chris Lattnerccef6b52008-09-23 21:18:31 +00005063 case 208:
5064#line 2011 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00005065 {
5066 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5067 GEN_ERROR("vfcmp operand types must match");
5068 (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5069 ;}
5070 break;
5071
Chris Lattnerccef6b52008-09-23 21:18:31 +00005072 case 209:
5073#line 2016 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005074 {
5075 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005076 GEN_ERROR("Invalid extractelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005077 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00005078 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005079 ;}
5080 break;
5081
Chris Lattnerccef6b52008-09-23 21:18:31 +00005082 case 210:
5083#line 2022 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005084 {
5085 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005086 GEN_ERROR("Invalid insertelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005087 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00005088 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005089 ;}
5090 break;
5091
Chris Lattnerccef6b52008-09-23 21:18:31 +00005092 case 211:
5093#line 2028 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005094 {
5095 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005096 GEN_ERROR("Invalid shufflevector operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005097 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00005098 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005099 ;}
5100 break;
5101
Chris Lattnerccef6b52008-09-23 21:18:31 +00005102 case 212:
5103#line 2034 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005104 {
5105 if (!isa<StructType>((yyvsp[(3) - (5)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (5)].ConstVal)->getType()))
5106 GEN_ERROR("ExtractValue requires an aggregate operand");
5107
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005108 (yyval.ConstVal) = ConstantExpr::getExtractValue((yyvsp[(3) - (5)].ConstVal), &(*(yyvsp[(4) - (5)].ConstantList))[0], (yyvsp[(4) - (5)].ConstantList)->size());
5109 delete (yyvsp[(4) - (5)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00005110 CHECK_FOR_ERROR
5111 ;}
5112 break;
5113
Chris Lattnerccef6b52008-09-23 21:18:31 +00005114 case 213:
5115#line 2042 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005116 {
5117 if (!isa<StructType>((yyvsp[(3) - (7)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (7)].ConstVal)->getType()))
5118 GEN_ERROR("InsertValue requires an aggregate operand");
5119
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005120 (yyval.ConstVal) = ConstantExpr::getInsertValue((yyvsp[(3) - (7)].ConstVal), (yyvsp[(5) - (7)].ConstVal), &(*(yyvsp[(6) - (7)].ConstantList))[0], (yyvsp[(6) - (7)].ConstantList)->size());
5121 delete (yyvsp[(6) - (7)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00005122 CHECK_FOR_ERROR
5123 ;}
5124 break;
5125
Chris Lattnerccef6b52008-09-23 21:18:31 +00005126 case 214:
5127#line 2053 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005128 {
5129 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005130 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005131 ;}
5132 break;
5133
Chris Lattnerccef6b52008-09-23 21:18:31 +00005134 case 215:
5135#line 2057 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005136 {
5137 (yyval.ConstVector) = new std::vector<Constant*>();
5138 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005139 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005140 ;}
5141 break;
5142
Chris Lattnerccef6b52008-09-23 21:18:31 +00005143 case 216:
5144#line 2065 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005145 { (yyval.BoolVal) = false; ;}
Nate Begemanac80ade2008-05-12 19:01:56 +00005146 break;
5147
Devang Pateld4980812008-09-02 20:52:40 +00005148 case 217:
Chris Lattnerccef6b52008-09-23 21:18:31 +00005149#line 2065 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00005150 { (yyval.BoolVal) = true; ;}
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005151 break;
5152
Devang Pateld4980812008-09-02 20:52:40 +00005153 case 218:
Chris Lattnerccef6b52008-09-23 21:18:31 +00005154#line 2068 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5155 { (yyval.BoolVal) = true; ;}
Chris Lattner15bd0952008-08-29 17:20:18 +00005156 break;
5157
Devang Pateld4980812008-09-02 20:52:40 +00005158 case 219:
Chris Lattnerccef6b52008-09-23 21:18:31 +00005159#line 2068 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5160 { (yyval.BoolVal) = false; ;}
5161 break;
5162
5163 case 220:
5164#line 2071 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005165 {
5166 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
5167 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
Chris Lattner0275cff2007-08-06 21:00:46 +00005168 CHECK_FOR_ERROR
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005169 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
5170 if (!Aliasee)
5171 GEN_ERROR("Aliases can be created only to global values");
5172
Dan Gohmanf4423b12008-04-19 00:24:39 +00005173 (yyval.ConstVal) = Aliasee;
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005174 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005175 delete (yyvsp[(1) - (2)].TypeVal);
5176 ;}
5177 break;
5178
Chris Lattnerccef6b52008-09-23 21:18:31 +00005179 case 221:
5180#line 2083 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005181 {
5182 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
5183 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
5184 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005185 GEN_ERROR("invalid cast opcode for cast from '" +
5186 Val->getType()->getDescription() + "' to '" +
5187 DestTy->getDescription() + "'");
5188
Dan Gohmanf4423b12008-04-19 00:24:39 +00005189 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005190 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005191 delete (yyvsp[(5) - (6)].TypeVal);
5192 ;}
5193 break;
5194
Devang Pateld4980812008-09-02 20:52:40 +00005195 case 222:
Chris Lattnerccef6b52008-09-23 21:18:31 +00005196#line 2104 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00005197 {
5198 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5199 CurModule.ModuleDone();
5200 CHECK_FOR_ERROR;
5201 ;}
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005202 break;
5203
Chris Lattnerccef6b52008-09-23 21:18:31 +00005204 case 223:
5205#line 2109 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5206 {
5207 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5208 CurModule.ModuleDone();
5209 CHECK_FOR_ERROR;
5210 ;}
Chris Lattner15bd0952008-08-29 17:20:18 +00005211 break;
5212
Devang Pateld4980812008-09-02 20:52:40 +00005213 case 226:
Chris Lattnerccef6b52008-09-23 21:18:31 +00005214#line 2122 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5215 { CurFun.isDeclare = false; ;}
5216 break;
5217
5218 case 227:
5219#line 2122 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005220 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005221 CurFun.FunctionDone();
5222 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005223 ;}
5224 break;
5225
Chris Lattnerccef6b52008-09-23 21:18:31 +00005226 case 228:
5227#line 2126 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005228 { CurFun.isDeclare = true; ;}
5229 break;
5230
Devang Pateld4980812008-09-02 20:52:40 +00005231 case 229:
Chris Lattnerccef6b52008-09-23 21:18:31 +00005232#line 2126 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00005233 {
5234 CHECK_FOR_ERROR
5235 ;}
5236 break;
5237
Devang Pateld4980812008-09-02 20:52:40 +00005238 case 230:
Chris Lattnerccef6b52008-09-23 21:18:31 +00005239#line 2129 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
5240 {
5241 CHECK_FOR_ERROR
5242 ;}
5243 break;
5244
5245 case 231:
5246#line 2132 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005247 {
Reid Spencer14310612006-12-31 05:40:51 +00005248 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005249 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005250 // Eagerly resolve types. This is not an optimization, this is a
5251 // requirement that is due to the fact that we could have this:
5252 //
5253 // %list = type { %list * }
5254 // %list = type { %list * } ; repeated type decl
5255 //
5256 // If types are not resolved eagerly, then the two types will not be
5257 // determined to be the same type!
5258 //
Dan Gohmanf4423b12008-04-19 00:24:39 +00005259 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005260
Dan Gohmanf4423b12008-04-19 00:24:39 +00005261 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Reid Spencer5b7e7532006-09-28 19:28:24 +00005262 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005263 // If this is a named type that is not a redefinition, add it to the slot
5264 // table.
Dan Gohmanf4423b12008-04-19 00:24:39 +00005265 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005266 }
Reid Spencera132e042006-12-03 05:46:11 +00005267
Dan Gohmanf4423b12008-04-19 00:24:39 +00005268 delete (yyvsp[(3) - (3)].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005269 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005270 ;}
5271 break;
Reid Spencerb8f85052007-07-31 03:50:36 +00005272
Chris Lattnerccef6b52008-09-23 21:18:31 +00005273 case 232:
5274#line 2156 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005275 {
5276 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
5277
5278 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005279 CHECK_FOR_ERROR
5280 // If this is a named type that is not a redefinition, add it to the slot
5281 // table.
Dan Gohmanf4423b12008-04-19 00:24:39 +00005282 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005283 }
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005284 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005285 ;}
5286 break;
5287
Chris Lattnerccef6b52008-09-23 21:18:31 +00005288 case 233:
5289#line 2168 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005290 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005291 /* "Externally Visible" Linkage */
Dan Gohmanf4423b12008-04-19 00:24:39 +00005292 if ((yyvsp[(5) - (6)].ConstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005293 GEN_ERROR("Global value initializer is not a constant");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005294 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5295 (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 +00005296 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005297 ;}
5298 break;
5299
Chris Lattnerccef6b52008-09-23 21:18:31 +00005300 case 234:
5301#line 2175 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005302 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005303 CurGV = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005304 ;}
5305 break;
5306
Chris Lattnerccef6b52008-09-23 21:18:31 +00005307 case 235:
5308#line 2179 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005309 {
5310 if ((yyvsp[(6) - (7)].ConstVal) == 0)
Christopher Lambbf3348d2007-12-12 08:45:45 +00005311 GEN_ERROR("Global value initializer is not a constant");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005312 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 +00005313 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005314 ;}
5315 break;
5316
Chris Lattnerccef6b52008-09-23 21:18:31 +00005317 case 236:
5318#line 2184 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005319 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005320 CurGV = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005321 ;}
5322 break;
5323
Chris Lattnerccef6b52008-09-23 21:18:31 +00005324 case 237:
5325#line 2188 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005326 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005327 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005328 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5329 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 +00005330 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005331 delete (yyvsp[(6) - (7)].TypeVal);
5332 ;}
5333 break;
5334
Chris Lattnerccef6b52008-09-23 21:18:31 +00005335 case 238:
5336#line 2194 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005337 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005338 CurGV = 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +00005339 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005340 ;}
5341 break;
5342
Chris Lattnerccef6b52008-09-23 21:18:31 +00005343 case 239:
5344#line 2198 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005345 {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005346 std::string Name;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005347 if ((yyvsp[(1) - (5)].StrVal)) {
5348 Name = *(yyvsp[(1) - (5)].StrVal);
5349 delete (yyvsp[(1) - (5)].StrVal);
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005350 }
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005351 if (Name.empty())
5352 GEN_ERROR("Alias name cannot be empty");
5353
Dan Gohmanf4423b12008-04-19 00:24:39 +00005354 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005355 if (Aliasee == 0)
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005356 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005357
Dan Gohmanf4423b12008-04-19 00:24:39 +00005358 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005359 CurModule.CurrentModule);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005360 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005361 InsertValue(GA, CurModule.Values);
Chris Lattner569f7372007-09-10 23:24:14 +00005362
5363
5364 // If there was a forward reference of this alias, resolve it now.
5365
5366 ValID ID;
5367 if (!Name.empty())
5368 ID = ValID::createGlobalName(Name);
5369 else
5370 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5371
5372 if (GlobalValue *FWGV =
5373 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5374 // Replace uses of the fwdref with the actual alias.
5375 FWGV->replaceAllUsesWith(GA);
5376 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5377 GV->eraseFromParent();
5378 else
5379 cast<Function>(FWGV)->eraseFromParent();
5380 }
5381 ID.destroy();
5382
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005383 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005384 ;}
5385 break;
5386
Chris Lattnerccef6b52008-09-23 21:18:31 +00005387 case 240:
5388#line 2238 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005389 {
Anton Korobeynikov77d0f972007-04-25 14:29:12 +00005390 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005391 ;}
5392 break;
5393
Chris Lattnerccef6b52008-09-23 21:18:31 +00005394 case 241:
5395#line 2241 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005396 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005397 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005398 ;}
5399 break;
5400
Chris Lattnerccef6b52008-09-23 21:18:31 +00005401 case 242:
5402#line 2247 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005403 {
Chris Lattner66316012006-01-24 04:14:29 +00005404 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
Chris Lattner66316012006-01-24 04:14:29 +00005405 if (AsmSoFar.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005406 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
Chris Lattner66316012006-01-24 04:14:29 +00005407 else
Dan Gohmanf4423b12008-04-19 00:24:39 +00005408 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5409 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00005410 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005411;}
5412 break;
5413
Chris Lattnerccef6b52008-09-23 21:18:31 +00005414 case 243:
5415#line 2257 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005416 {
5417 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5418 delete (yyvsp[(3) - (3)].StrVal);
5419 ;}
5420 break;
5421
Chris Lattnerccef6b52008-09-23 21:18:31 +00005422 case 244:
5423#line 2261 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005424 {
5425 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5426 delete (yyvsp[(3) - (3)].StrVal);
5427 ;}
5428 break;
5429
Chris Lattnerccef6b52008-09-23 21:18:31 +00005430 case 246:
5431#line 2268 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005432 {
5433 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5434 delete (yyvsp[(3) - (3)].StrVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00005435 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005436 ;}
5437 break;
5438
Chris Lattnerccef6b52008-09-23 21:18:31 +00005439 case 247:
5440#line 2273 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005441 {
5442 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5443 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer1013b4d2007-07-31 14:41:17 +00005444 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005445 ;}
5446 break;
5447
Chris Lattnerccef6b52008-09-23 21:18:31 +00005448 case 248:
5449#line 2278 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005450 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005451 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005452 ;}
5453 break;
5454
Chris Lattnerccef6b52008-09-23 21:18:31 +00005455 case 249:
5456#line 2287 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005457 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005458 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005459 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005460 if (!(*(yyvsp[(3) - (5)].TypeVal))->isFirstClassType())
5461 GEN_ERROR("Argument types must be first-class");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005462 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5463 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5464 (yyvsp[(1) - (5)].ArgList)->push_back(E);
Reid Spencer6f407902007-01-13 05:00:46 +00005465 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005466 ;}
5467 break;
5468
Chris Lattnerccef6b52008-09-23 21:18:31 +00005469 case 250:
5470#line 2297 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005471 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005472 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005473 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005474 if (!(*(yyvsp[(1) - (3)].TypeVal))->isFirstClassType())
5475 GEN_ERROR("Argument types must be first-class");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005476 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5477 (yyval.ArgList) = new ArgListType;
5478 (yyval.ArgList)->push_back(E);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005479 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005480 ;}
5481 break;
5482
Chris Lattnerccef6b52008-09-23 21:18:31 +00005483 case 251:
5484#line 2308 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005485 {
5486 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005487 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005488 ;}
5489 break;
5490
Chris Lattnerccef6b52008-09-23 21:18:31 +00005491 case 252:
5492#line 2312 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005493 {
5494 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005495 struct ArgListEntry E;
5496 E.Ty = new PATypeHolder(Type::VoidTy);
5497 E.Name = 0;
Reid Spencer18da0722007-04-11 02:44:20 +00005498 E.Attrs = ParamAttr::None;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005499 (yyval.ArgList)->push_back(E);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005500 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005501 ;}
5502 break;
5503
Chris Lattnerccef6b52008-09-23 21:18:31 +00005504 case 253:
5505#line 2321 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005506 {
5507 (yyval.ArgList) = new ArgListType;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005508 struct ArgListEntry E;
5509 E.Ty = new PATypeHolder(Type::VoidTy);
5510 E.Name = 0;
5511 E.Attrs = ParamAttr::None;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005512 (yyval.ArgList)->push_back(E);
Reid Spencer61c83e02006-08-18 08:43:06 +00005513 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005514 ;}
5515 break;
5516
Chris Lattnerccef6b52008-09-23 21:18:31 +00005517 case 254:
5518#line 2330 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005519 {
5520 (yyval.ArgList) = 0;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005521 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005522 ;}
5523 break;
5524
Chris Lattnerccef6b52008-09-23 21:18:31 +00005525 case 255:
5526#line 2336 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005527 {
Devang Pateld4980812008-09-02 20:52:40 +00005528 std::string FunctionName(*(yyvsp[(3) - (11)].StrVal));
5529 delete (yyvsp[(3) - (11)].StrVal); // Free strdup'd memory!
Reid Spencer68a24bd2005-08-27 18:50:39 +00005530
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005531 // Check the function result for abstractness if this is a define. We should
5532 // have no abstract types at this point
Devang Pateld4980812008-09-02 20:52:40 +00005533 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (11)].TypeVal)))
5534 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (11)].TypeVal)->get()->getDescription());
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005535
Devang Pateld4980812008-09-02 20:52:40 +00005536 if (!FunctionType::isValidReturnType(*(yyvsp[(2) - (11)].TypeVal)))
Chris Lattnera925a142008-04-23 05:37:08 +00005537 GEN_ERROR("Invalid result type for LLVM function");
5538
Reid Spencer68a24bd2005-08-27 18:50:39 +00005539 std::vector<const Type*> ParamTypeList;
Chris Lattner58d74912008-03-12 17:45:29 +00005540 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Devang Pateld4980812008-09-02 20:52:40 +00005541 if ((yyvsp[(7) - (11)].ParamAttrs) != ParamAttr::None)
5542 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(7) - (11)].ParamAttrs)));
5543 if ((yyvsp[(5) - (11)].ArgList)) { // If there are arguments...
Reid Spencer7b5d4662007-04-09 06:16:21 +00005544 unsigned index = 1;
Devang Pateld4980812008-09-02 20:52:40 +00005545 for (ArgListType::iterator I = (yyvsp[(5) - (11)].ArgList)->begin(); I != (yyvsp[(5) - (11)].ArgList)->end(); ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00005546 const Type* Ty = I->Ty->get();
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005547 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5548 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
Reid Spencer14310612006-12-31 05:40:51 +00005549 ParamTypeList.push_back(Ty);
Chris Lattner58d74912008-03-12 17:45:29 +00005550 if (Ty != Type::VoidTy && I->Attrs != ParamAttr::None)
5551 Attrs.push_back(ParamAttrsWithIndex::get(index, I->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00005552 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005553 }
5554
5555 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5556 if (isVarArg) ParamTypeList.pop_back();
5557
Chris Lattner58d74912008-03-12 17:45:29 +00005558 PAListPtr PAL;
Christopher Lamb5c104242007-04-22 20:09:11 +00005559 if (!Attrs.empty())
Chris Lattner58d74912008-03-12 17:45:29 +00005560 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Reid Spencer7b5d4662007-04-09 06:16:21 +00005561
Devang Pateld4980812008-09-02 20:52:40 +00005562 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (11)].TypeVal), ParamTypeList, isVarArg);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00005563 const PointerType *PFT = PointerType::getUnqual(FT);
Devang Pateld4980812008-09-02 20:52:40 +00005564 delete (yyvsp[(2) - (11)].TypeVal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005565
5566 ValID ID;
5567 if (!FunctionName.empty()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005568 ID = ValID::createGlobalName((char*)FunctionName.c_str());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005569 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00005570 ID = ValID::createGlobalID(CurModule.Values.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005571 }
5572
5573 Function *Fn = 0;
5574 // See if this function was forward referenced. If so, recycle the object.
5575 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5576 // Move the function to the end of the list, from whereever it was
5577 // previously inserted.
5578 Fn = cast<Function>(FWRef);
Chris Lattner58d74912008-03-12 17:45:29 +00005579 assert(Fn->getParamAttrs().isEmpty() &&
5580 "Forward reference has parameter attributes!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005581 CurModule.CurrentModule->getFunctionList().remove(Fn);
5582 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5583 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
Reid Spenceref9b9a72007-02-05 20:47:22 +00005584 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
Duncan Sandsdc024672007-11-27 13:23:08 +00005585 if (Fn->getFunctionType() != FT ) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00005586 // The existing function doesn't have the same type. This is an overload
5587 // error.
5588 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Duncan Sandsdc024672007-11-27 13:23:08 +00005589 } else if (Fn->getParamAttrs() != PAL) {
5590 // The existing function doesn't have the same parameter attributes.
5591 // This is an overload error.
5592 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Reid Spenceref9b9a72007-02-05 20:47:22 +00005593 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
Chris Lattner6cdc6822007-04-26 05:31:05 +00005594 // Neither the existing or the current function is a declaration and they
5595 // have the same name and same type. Clearly this is a redefinition.
5596 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
Duncan Sandsdc024672007-11-27 13:23:08 +00005597 } else if (Fn->isDeclaration()) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00005598 // Make sure to strip off any argument names so we can't get conflicts.
Reid Spencer68a24bd2005-08-27 18:50:39 +00005599 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5600 AI != AE; ++AI)
5601 AI->setName("");
Reid Spenceref9b9a72007-02-05 20:47:22 +00005602 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005603 } else { // Not already defined?
Gabor Greife64d2482008-04-06 23:07:54 +00005604 Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5605 CurModule.CurrentModule);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005606 InsertValue(Fn, CurModule.Values);
5607 }
5608
5609 CurFun.FunctionStart(Fn);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00005610
5611 if (CurFun.isDeclare) {
5612 // If we have declaration, always overwrite linkage. This will allow us to
5613 // correctly handle cases, when pointer to function is passed as argument to
5614 // another function.
5615 Fn->setLinkage(CurFun.Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005616 Fn->setVisibility(CurFun.Visibility);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00005617 }
Devang Pateld4980812008-09-02 20:52:40 +00005618 Fn->setCallingConv((yyvsp[(1) - (11)].UIntVal));
Duncan Sandsdc024672007-11-27 13:23:08 +00005619 Fn->setParamAttrs(PAL);
Devang Pateld4980812008-09-02 20:52:40 +00005620 Fn->setAlignment((yyvsp[(9) - (11)].UIntVal));
5621 if ((yyvsp[(8) - (11)].StrVal)) {
5622 Fn->setSection(*(yyvsp[(8) - (11)].StrVal));
5623 delete (yyvsp[(8) - (11)].StrVal);
Gordon Henriksen80a75bf2007-12-10 03:18:06 +00005624 }
Devang Pateld4980812008-09-02 20:52:40 +00005625 if ((yyvsp[(10) - (11)].StrVal)) {
5626 Fn->setGC((yyvsp[(10) - (11)].StrVal)->c_str());
5627 delete (yyvsp[(10) - (11)].StrVal);
5628 }
5629 if ((yyvsp[(11) - (11)].FunctionNotes)) {
5630 Fn->setNotes((yyvsp[(11) - (11)].FunctionNotes));
Chris Lattnere869eef2005-11-12 00:11:49 +00005631 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005632
5633 // Add all of the arguments we parsed to the function...
Devang Pateld4980812008-09-02 20:52:40 +00005634 if ((yyvsp[(5) - (11)].ArgList)) { // Is null if empty...
Reid Spencer68a24bd2005-08-27 18:50:39 +00005635 if (isVarArg) { // Nuke the last entry
Devang Pateld4980812008-09-02 20:52:40 +00005636 assert((yyvsp[(5) - (11)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (11)].ArgList)->back().Name == 0 &&
Reid Spencera9720f52007-02-05 17:04:00 +00005637 "Not a varargs marker!");
Devang Pateld4980812008-09-02 20:52:40 +00005638 delete (yyvsp[(5) - (11)].ArgList)->back().Ty;
5639 (yyvsp[(5) - (11)].ArgList)->pop_back(); // Delete the last entry
Reid Spencer68a24bd2005-08-27 18:50:39 +00005640 }
5641 Function::arg_iterator ArgIt = Fn->arg_begin();
Reid Spenceref9b9a72007-02-05 20:47:22 +00005642 Function::arg_iterator ArgEnd = Fn->arg_end();
Reid Spencer14310612006-12-31 05:40:51 +00005643 unsigned Idx = 1;
Devang Pateld4980812008-09-02 20:52:40 +00005644 for (ArgListType::iterator I = (yyvsp[(5) - (11)].ArgList)->begin();
5645 I != (yyvsp[(5) - (11)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
Reid Spencer14310612006-12-31 05:40:51 +00005646 delete I->Ty; // Delete the typeholder...
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005647 setValueName(ArgIt, I->Name); // Insert arg into symtab...
Reid Spencer5b7e7532006-09-28 19:28:24 +00005648 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005649 InsertValue(ArgIt);
Reid Spencer14310612006-12-31 05:40:51 +00005650 Idx++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005651 }
Reid Spencera132e042006-12-03 05:46:11 +00005652
Devang Pateld4980812008-09-02 20:52:40 +00005653 delete (yyvsp[(5) - (11)].ArgList); // We're now done with the argument list
Reid Spencer68a24bd2005-08-27 18:50:39 +00005654 }
Reid Spencer61c83e02006-08-18 08:43:06 +00005655 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005656;}
5657 break;
5658
Chris Lattnerccef6b52008-09-23 21:18:31 +00005659 case 258:
5660#line 2469 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005661 {
5662 (yyval.FunctionVal) = CurFun.CurrentFunction;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005663
5664 // Make sure that we keep track of the linkage type even if there was a
5665 // previous "declare".
Dan Gohmanf4423b12008-04-19 00:24:39 +00005666 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5667 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5668;}
5669 break;
5670
Chris Lattnerccef6b52008-09-23 21:18:31 +00005671 case 261:
5672#line 2480 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005673 {
5674 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005675 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005676;}
5677 break;
5678
Chris Lattnerccef6b52008-09-23 21:18:31 +00005679 case 262:
5680#line 2485 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005681 {
5682 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5683 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5684 (yyval.FunctionVal) = CurFun.CurrentFunction;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005685 CurFun.FunctionDone();
Reid Spencer41dff5e2007-01-26 08:05:27 +00005686 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005687 ;}
5688 break;
5689
Chris Lattnerccef6b52008-09-23 21:18:31 +00005690 case 263:
5691#line 2497 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005692 {
5693 (yyval.BoolVal) = false;
Reid Spencer61c83e02006-08-18 08:43:06 +00005694 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005695 ;}
5696 break;
5697
Chris Lattnerccef6b52008-09-23 21:18:31 +00005698 case 264:
5699#line 2501 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005700 {
5701 (yyval.BoolVal) = true;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005702 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005703 ;}
5704 break;
5705
Chris Lattnerccef6b52008-09-23 21:18:31 +00005706 case 265:
5707#line 2506 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005708 { // A reference to a direct constant
5709 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005710 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005711 ;}
5712 break;
5713
Chris Lattnerccef6b52008-09-23 21:18:31 +00005714 case 266:
5715#line 2510 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005716 {
5717 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005718 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005719 ;}
5720 break;
5721
Chris Lattnerccef6b52008-09-23 21:18:31 +00005722 case 267:
5723#line 2514 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner1913b942008-07-11 00:30:39 +00005724 { // arbitrary precision integer constants
5725 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), true);
5726 delete (yyvsp[(1) - (1)].APIntVal);
5727 CHECK_FOR_ERROR
5728 ;}
5729 break;
5730
Chris Lattnerccef6b52008-09-23 21:18:31 +00005731 case 268:
5732#line 2519 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner1913b942008-07-11 00:30:39 +00005733 { // arbitrary precision integer constants
5734 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), false);
5735 delete (yyvsp[(1) - (1)].APIntVal);
5736 CHECK_FOR_ERROR
5737 ;}
5738 break;
5739
Chris Lattnerccef6b52008-09-23 21:18:31 +00005740 case 269:
5741#line 2524 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005742 { // Perhaps it's an FP constant?
5743 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00005744 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005745 ;}
5746 break;
5747
Chris Lattnerccef6b52008-09-23 21:18:31 +00005748 case 270:
5749#line 2528 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005750 {
5751 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
Reid Spencere4d87aa2006-12-23 06:05:41 +00005752 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005753 ;}
5754 break;
5755
Chris Lattnerccef6b52008-09-23 21:18:31 +00005756 case 271:
5757#line 2532 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005758 {
5759 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00005760 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005761 ;}
5762 break;
5763
Chris Lattnerccef6b52008-09-23 21:18:31 +00005764 case 272:
5765#line 2536 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005766 {
5767 (yyval.ValIDVal) = ValID::createNull();
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00005768 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005769 ;}
5770 break;
5771
Chris Lattnerccef6b52008-09-23 21:18:31 +00005772 case 273:
5773#line 2540 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005774 {
5775 (yyval.ValIDVal) = ValID::createUndef();
Reid Spencer61c83e02006-08-18 08:43:06 +00005776 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005777 ;}
5778 break;
5779
Chris Lattnerccef6b52008-09-23 21:18:31 +00005780 case 274:
5781#line 2544 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005782 { // A vector zero constant.
5783 (yyval.ValIDVal) = ValID::createZeroInit();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005784 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005785 ;}
5786 break;
5787
Chris Lattnerccef6b52008-09-23 21:18:31 +00005788 case 275:
5789#line 2548 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005790 { // Nonempty unsized packed vector
5791 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
Dan Gohman180c1692008-06-23 18:43:26 +00005792 unsigned NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005793
5794 if (!ETy->isInteger() && !ETy->isFloatingPoint())
5795 GEN_ERROR("Invalid vector element type: " + ETy->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005796
Reid Spencer9d6565a2007-02-15 02:26:10 +00005797 VectorType* pt = VectorType::get(ETy, NumElements);
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005798 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(pt));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005799
5800 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00005801 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5802 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Reid Spencer61c83e02006-08-18 08:43:06 +00005803 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +00005804 ETy->getDescription() +"' as required!\nIt is of type '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00005805 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005806 }
5807
Dan Gohmanf4423b12008-04-19 00:24:39 +00005808 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5809 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
Reid Spencer832254e2007-02-02 02:16:23 +00005810 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005811 ;}
5812 break;
5813
Chris Lattnerccef6b52008-09-23 21:18:31 +00005814 case 276:
5815#line 2570 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005816 { // Nonempty unsized arr
5817 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
Dan Gohman180c1692008-06-23 18:43:26 +00005818 uint64_t NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005819
5820 if (!ETy->isFirstClassType())
5821 GEN_ERROR("Invalid array element type: " + ETy->getDescription());
5822
5823 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5824 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(ATy));
5825
5826 // Verify all elements are correct type!
5827 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5828 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
5829 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5830 ETy->getDescription() +"' as required!\nIt is of type '"+
5831 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5832 }
5833
5834 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, *(yyvsp[(2) - (3)].ConstVector)));
5835 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5836 CHECK_FOR_ERROR
5837 ;}
5838 break;
5839
Chris Lattnerccef6b52008-09-23 21:18:31 +00005840 case 277:
5841#line 2592 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005842 {
Dan Gohman180c1692008-06-23 18:43:26 +00005843 // Use undef instead of an array because it's inconvenient to determine
5844 // the element type at this point, there being no elements to examine.
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005845 (yyval.ValIDVal) = ValID::createUndef();
5846 CHECK_FOR_ERROR
5847 ;}
5848 break;
5849
Chris Lattnerccef6b52008-09-23 21:18:31 +00005850 case 278:
5851#line 2598 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005852 {
Dan Gohman180c1692008-06-23 18:43:26 +00005853 uint64_t NumElements = (yyvsp[(2) - (2)].StrVal)->length();
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005854 const Type *ETy = Type::Int8Ty;
5855
5856 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5857
5858 std::vector<Constant*> Vals;
5859 for (unsigned i = 0; i < (yyvsp[(2) - (2)].StrVal)->length(); ++i)
5860 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(2) - (2)].StrVal))[i]));
5861 delete (yyvsp[(2) - (2)].StrVal);
5862 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, Vals));
5863 CHECK_FOR_ERROR
5864 ;}
5865 break;
5866
Chris Lattnerccef6b52008-09-23 21:18:31 +00005867 case 279:
5868#line 2611 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005869 {
5870 std::vector<const Type*> Elements((yyvsp[(2) - (3)].ConstVector)->size());
5871 for (unsigned i = 0, e = (yyvsp[(2) - (3)].ConstVector)->size(); i != e; ++i)
5872 Elements[i] = (*(yyvsp[(2) - (3)].ConstVector))[i]->getType();
5873
5874 const StructType *STy = StructType::get(Elements);
5875 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5876
5877 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(2) - (3)].ConstVector)));
5878 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5879 CHECK_FOR_ERROR
5880 ;}
5881 break;
5882
Chris Lattnerccef6b52008-09-23 21:18:31 +00005883 case 280:
5884#line 2623 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005885 {
5886 const StructType *STy = StructType::get(std::vector<const Type*>());
5887 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5888 CHECK_FOR_ERROR
5889 ;}
5890 break;
5891
Chris Lattnerccef6b52008-09-23 21:18:31 +00005892 case 281:
5893#line 2628 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005894 {
5895 std::vector<const Type*> Elements((yyvsp[(3) - (5)].ConstVector)->size());
5896 for (unsigned i = 0, e = (yyvsp[(3) - (5)].ConstVector)->size(); i != e; ++i)
5897 Elements[i] = (*(yyvsp[(3) - (5)].ConstVector))[i]->getType();
5898
5899 const StructType *STy = StructType::get(Elements, /*isPacked=*/true);
5900 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5901
5902 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(3) - (5)].ConstVector)));
5903 delete PTy; delete (yyvsp[(3) - (5)].ConstVector);
5904 CHECK_FOR_ERROR
5905 ;}
5906 break;
5907
Chris Lattnerccef6b52008-09-23 21:18:31 +00005908 case 282:
5909#line 2640 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005910 {
5911 const StructType *STy = StructType::get(std::vector<const Type*>(),
5912 /*isPacked=*/true);
5913 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5914 CHECK_FOR_ERROR
5915 ;}
5916 break;
5917
Chris Lattnerccef6b52008-09-23 21:18:31 +00005918 case 283:
5919#line 2646 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005920 {
5921 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
Reid Spencer832254e2007-02-02 02:16:23 +00005922 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005923 ;}
5924 break;
5925
Chris Lattnerccef6b52008-09-23 21:18:31 +00005926 case 284:
5927#line 2650 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005928 {
5929 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5930 delete (yyvsp[(3) - (5)].StrVal);
5931 delete (yyvsp[(5) - (5)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005932 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005933 ;}
5934 break;
5935
Chris Lattnerccef6b52008-09-23 21:18:31 +00005936 case 285:
5937#line 2660 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005938 { // Is it an integer reference...?
5939 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005940 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005941 ;}
5942 break;
5943
Chris Lattnerccef6b52008-09-23 21:18:31 +00005944 case 286:
5945#line 2664 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005946 {
5947 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
Reid Spencer832254e2007-02-02 02:16:23 +00005948 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005949 ;}
5950 break;
5951
Chris Lattnerccef6b52008-09-23 21:18:31 +00005952 case 287:
5953#line 2668 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005954 { // Is it a named reference...?
5955 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5956 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005957 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005958 ;}
5959 break;
5960
Chris Lattnerccef6b52008-09-23 21:18:31 +00005961 case 288:
5962#line 2673 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005963 { // Is it a named reference...?
5964 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5965 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005966 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005967 ;}
5968 break;
5969
Chris Lattnerccef6b52008-09-23 21:18:31 +00005970 case 291:
5971#line 2686 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005972 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005973 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005974 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5975 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5976 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005977 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005978 ;}
5979 break;
5980
Chris Lattnerccef6b52008-09-23 21:18:31 +00005981 case 292:
5982#line 2695 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005983 {
5984 (yyval.ValueList) = new std::vector<Value *>();
5985 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
Devang Patel7990dc72008-02-20 22:40:23 +00005986 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005987 ;}
5988 break;
5989
Chris Lattnerccef6b52008-09-23 21:18:31 +00005990 case 293:
5991#line 2700 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005992 {
5993 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
Devang Patel7990dc72008-02-20 22:40:23 +00005994 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005995 ;}
5996 break;
5997
Chris Lattnerccef6b52008-09-23 21:18:31 +00005998 case 294:
5999#line 2705 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006000 {
6001 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006002 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006003 ;}
6004 break;
6005
Chris Lattnerccef6b52008-09-23 21:18:31 +00006006 case 295:
6007#line 2709 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006008 { // Do not allow functions with 0 basic blocks
6009 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006010 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006011 ;}
6012 break;
6013
Chris Lattnerccef6b52008-09-23 21:18:31 +00006014 case 296:
6015#line 2718 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006016 {
6017 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006018 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006019 InsertValue((yyvsp[(3) - (3)].TermInstVal));
6020 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
6021 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006022 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006023 ;}
6024 break;
6025
Chris Lattnerccef6b52008-09-23 21:18:31 +00006026 case 297:
6027#line 2727 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00006028 {
6029 CHECK_FOR_ERROR
6030 int ValNum = InsertValue((yyvsp[(3) - (3)].TermInstVal));
6031 if (ValNum != (int)(yyvsp[(2) - (3)].UIntVal))
6032 GEN_ERROR("Result value number %" + utostr((yyvsp[(2) - (3)].UIntVal)) +
6033 " is incorrect, expected %" + utostr((unsigned)ValNum));
6034
6035 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
6036 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
6037 CHECK_FOR_ERROR
6038;}
6039 break;
6040
Chris Lattnerccef6b52008-09-23 21:18:31 +00006041 case 298:
6042#line 2740 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006043 {
6044 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006045 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
6046 if (CI2->getParent() == 0)
Dan Gohmanf4423b12008-04-19 00:24:39 +00006047 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
6048 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
6049 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
Anton Korobeynikov38e09802007-04-28 13:48:45 +00006050 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006051 ;}
6052 break;
Chris Lattner38905612008-02-19 04:36:25 +00006053
Chris Lattnerccef6b52008-09-23 21:18:31 +00006054 case 299:
6055#line 2749 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006056 { // Empty space between instruction lists
Chris Lattnercc81d152008-05-04 17:18:47 +00006057 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
Dan Gohmanf4423b12008-04-19 00:24:39 +00006058 CHECK_FOR_ERROR
6059 ;}
6060 break;
6061
Chris Lattnerccef6b52008-09-23 21:18:31 +00006062 case 300:
6063#line 2753 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnercc81d152008-05-04 17:18:47 +00006064 { // Labelled (named) basic block
6065 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
6066 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006067 CHECK_FOR_ERROR
Chris Lattnercc81d152008-05-04 17:18:47 +00006068
Dan Gohmanf4423b12008-04-19 00:24:39 +00006069 ;}
6070 break;
6071
Chris Lattnerccef6b52008-09-23 21:18:31 +00006072 case 301:
6073#line 2761 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006074 { // Return with a result...
6075 ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
6076 assert(!VL.empty() && "Invalid ret operands!");
Dan Gohman1a570242008-07-23 00:54:54 +00006077 const Type *ReturnType = CurFun.CurrentFunction->getReturnType();
6078 if (VL.size() > 1 ||
6079 (isa<StructType>(ReturnType) &&
6080 (VL.empty() || VL[0]->getType() != ReturnType))) {
6081 Value *RV = UndefValue::get(ReturnType);
6082 for (unsigned i = 0, e = VL.size(); i != e; ++i) {
6083 Instruction *I = InsertValueInst::Create(RV, VL[i], i, "mrv");
6084 ((yyvsp[(-1) - (2)].BasicBlockVal))->getInstList().push_back(I);
6085 RV = I;
6086 }
6087 (yyval.TermInstVal) = ReturnInst::Create(RV);
6088 } else {
6089 (yyval.TermInstVal) = ReturnInst::Create(VL[0]);
6090 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006091 delete (yyvsp[(2) - (2)].ValueList);
6092 CHECK_FOR_ERROR
6093 ;}
6094 break;
6095
Chris Lattnerccef6b52008-09-23 21:18:31 +00006096 case 302:
6097#line 2781 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006098 { // Return with no result...
6099 (yyval.TermInstVal) = ReturnInst::Create();
6100 CHECK_FOR_ERROR
6101 ;}
6102 break;
6103
Chris Lattnerccef6b52008-09-23 21:18:31 +00006104 case 303:
6105#line 2785 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006106 { // Unconditional Branch...
6107 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
6108 CHECK_FOR_ERROR
6109 (yyval.TermInstVal) = BranchInst::Create(tmpBB);
6110 ;}
6111 break;
6112
Chris Lattnerccef6b52008-09-23 21:18:31 +00006113 case 304:
6114#line 2790 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006115 {
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006116 if (cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() != 1)
6117 GEN_ERROR("Branch condition must have type i1");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006118 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6119 CHECK_FOR_ERROR
6120 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
6121 CHECK_FOR_ERROR
6122 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
6123 CHECK_FOR_ERROR
6124 (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal);
6125 ;}
6126 break;
6127
Chris Lattnerccef6b52008-09-23 21:18:31 +00006128 case 305:
6129#line 2801 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006130 {
6131 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
6132 CHECK_FOR_ERROR
6133 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6134 CHECK_FOR_ERROR
6135 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
6136 (yyval.TermInstVal) = S;
6137
6138 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
6139 E = (yyvsp[(8) - (9)].JumpTable)->end();
Reid Spencer68a24bd2005-08-27 18:50:39 +00006140 for (; I != E; ++I) {
6141 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
6142 S->addCase(CI, I->second);
6143 else
Reid Spencerb5334b02007-02-05 10:18:06 +00006144 GEN_ERROR("Switch case is constant, but not a simple integer");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006145 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006146 delete (yyvsp[(8) - (9)].JumpTable);
Reid Spencer61c83e02006-08-18 08:43:06 +00006147 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006148 ;}
6149 break;
6150
Chris Lattnerccef6b52008-09-23 21:18:31 +00006151 case 306:
6152#line 2820 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006153 {
6154 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006155 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006156 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006157 CHECK_FOR_ERROR
Gabor Greife64d2482008-04-06 23:07:54 +00006158 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006159 (yyval.TermInstVal) = S;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006160 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006161 ;}
6162 break;
6163
Chris Lattnerccef6b52008-09-23 21:18:31 +00006164 case 307:
6165#line 2830 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006166 {
Reid Spencer3822ff52006-11-08 06:47:33 +00006167
Reid Spencer14310612006-12-31 05:40:51 +00006168 // Handle the short syntax
6169 const PointerType *PFTy = 0;
6170 const FunctionType *Ty = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006171 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
Reid Spencer68a24bd2005-08-27 18:50:39 +00006172 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6173 // Pull out the types of all of the arguments...
6174 std::vector<const Type*> ParamTypes;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006175 ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006176 for (; I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00006177 const Type *Ty = I->Val->getType();
6178 if (Ty == Type::VoidTy)
6179 GEN_ERROR("Short call syntax cannot be used with varargs");
6180 ParamTypes.push_back(Ty);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006181 }
Chris Lattnera925a142008-04-23 05:37:08 +00006182
6183 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (14)].TypeVal)))
6184 GEN_ERROR("Invalid result type for LLVM function");
6185
Dan Gohmanf4423b12008-04-19 00:24:39 +00006186 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00006187 PFTy = PointerType::getUnqual(Ty);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006188 }
6189
Dan Gohmanf4423b12008-04-19 00:24:39 +00006190 delete (yyvsp[(3) - (14)].TypeVal);
Reid Spencer66728ef2007-03-20 01:13:36 +00006191
Dan Gohmanf4423b12008-04-19 00:24:39 +00006192 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00006193 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006194 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006195 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006196 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00006197 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00006198
Chris Lattner58d74912008-03-12 17:45:29 +00006199 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006200 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None)
6201 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (14)].ParamAttrs)));
Duncan Sandsdc024672007-11-27 13:23:08 +00006202
Reid Spencer14310612006-12-31 05:40:51 +00006203 // Check the arguments
6204 ValueList Args;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006205 if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments?
Reid Spencer14310612006-12-31 05:40:51 +00006206 // Make sure no arguments is a good thing!
6207 if (Ty->getNumParams() != 0)
6208 GEN_ERROR("No arguments passed to a function that "
Reid Spencerb5334b02007-02-05 10:18:06 +00006209 "expects arguments");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006210 } else { // Has arguments?
6211 // Loop through FunctionType's arguments and ensure they are specified
6212 // correctly!
Reid Spencer68a24bd2005-08-27 18:50:39 +00006213 FunctionType::param_iterator I = Ty->param_begin();
6214 FunctionType::param_iterator E = Ty->param_end();
Dan Gohmanf4423b12008-04-19 00:24:39 +00006215 ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006216 unsigned index = 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00006217
Duncan Sandsdc024672007-11-27 13:23:08 +00006218 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006219 if (ArgI->Val->getType() != *I)
6220 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00006221 (*I)->getDescription() + "'");
Reid Spencer14310612006-12-31 05:40:51 +00006222 Args.push_back(ArgI->Val);
Chris Lattner58d74912008-03-12 17:45:29 +00006223 if (ArgI->Attrs != ParamAttr::None)
6224 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00006225 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00006226
Reid Spencer14310612006-12-31 05:40:51 +00006227 if (Ty->isVarArg()) {
6228 if (I == E)
Chris Lattner38905612008-02-19 04:36:25 +00006229 for (; ArgI != ArgE; ++ArgI, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006230 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner58d74912008-03-12 17:45:29 +00006231 if (ArgI->Attrs != ParamAttr::None)
6232 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Chris Lattner38905612008-02-19 04:36:25 +00006233 }
Reid Spencer14310612006-12-31 05:40:51 +00006234 } else if (I != E || ArgI != ArgE)
Reid Spencerb5334b02007-02-05 10:18:06 +00006235 GEN_ERROR("Invalid number of parameters detected");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006236 }
Reid Spencer14310612006-12-31 05:40:51 +00006237
Chris Lattner58d74912008-03-12 17:45:29 +00006238 PAListPtr PAL;
Duncan Sandsdc024672007-11-27 13:23:08 +00006239 if (!Attrs.empty())
Chris Lattner58d74912008-03-12 17:45:29 +00006240 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsdc024672007-11-27 13:23:08 +00006241
Reid Spencer14310612006-12-31 05:40:51 +00006242 // Create the InvokeInst
Dan Gohman041e2eb2008-05-15 19:50:34 +00006243 InvokeInst *II = InvokeInst::Create(V, Normal, Except,
6244 Args.begin(), Args.end());
Dan Gohmanf4423b12008-04-19 00:24:39 +00006245 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
Duncan Sandsdc024672007-11-27 13:23:08 +00006246 II->setParamAttrs(PAL);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006247 (yyval.TermInstVal) = II;
6248 delete (yyvsp[(6) - (14)].ParamList);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006249 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006250 ;}
6251 break;
6252
Chris Lattnerccef6b52008-09-23 21:18:31 +00006253 case 308:
6254#line 2915 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006255 {
6256 (yyval.TermInstVal) = new UnwindInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00006257 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006258 ;}
6259 break;
6260
Chris Lattnerccef6b52008-09-23 21:18:31 +00006261 case 309:
6262#line 2919 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006263 {
6264 (yyval.TermInstVal) = new UnreachableInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00006265 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006266 ;}
6267 break;
6268
Chris Lattnerccef6b52008-09-23 21:18:31 +00006269 case 310:
6270#line 2926 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006271 {
6272 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
6273 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006274 CHECK_FOR_ERROR
6275 if (V == 0)
6276 GEN_ERROR("May only switch on a constant pool value");
6277
Dan Gohmanf4423b12008-04-19 00:24:39 +00006278 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006279 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006280 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
6281 ;}
6282 break;
6283
Chris Lattnerccef6b52008-09-23 21:18:31 +00006284 case 311:
6285#line 2937 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006286 {
6287 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
6288 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006289 CHECK_FOR_ERROR
6290
6291 if (V == 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00006292 GEN_ERROR("May only switch on a constant pool value");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006293
Dan Gohmanf4423b12008-04-19 00:24:39 +00006294 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006295 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006296 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
6297 ;}
6298 break;
6299
Chris Lattnerccef6b52008-09-23 21:18:31 +00006300 case 312:
6301#line 2950 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006302 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006303 // Is this definition named?? if so, assign the name...
Dan Gohmanf4423b12008-04-19 00:24:39 +00006304 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006305 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006306 InsertValue((yyvsp[(2) - (2)].InstVal));
6307 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006308 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006309 ;}
6310 break;
6311
Chris Lattnerccef6b52008-09-23 21:18:31 +00006312 case 313:
6313#line 2959 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00006314 {
6315 CHECK_FOR_ERROR
6316 int ValNum = InsertValue((yyvsp[(2) - (2)].InstVal));
6317
6318 if (ValNum != (int)(yyvsp[(1) - (2)].UIntVal))
6319 GEN_ERROR("Result value number %" + utostr((yyvsp[(1) - (2)].UIntVal)) +
6320 " is incorrect, expected %" + utostr((unsigned)ValNum));
6321
6322 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
6323 CHECK_FOR_ERROR
6324 ;}
6325 break;
6326
Chris Lattnerccef6b52008-09-23 21:18:31 +00006327 case 314:
6328#line 2972 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006329 { // Used for PHI nodes
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006330 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006331 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
6332 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
6333 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
Reid Spencer6f407902007-01-13 05:00:46 +00006334 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006335 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006336 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006337 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6338 delete (yyvsp[(1) - (6)].TypeVal);
6339 ;}
6340 break;
6341
Chris Lattnerccef6b52008-09-23 21:18:31 +00006342 case 315:
6343#line 2983 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006344 {
6345 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
6346 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006347 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006348 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006349 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006350 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6351 ;}
6352 break;
6353
Chris Lattnerccef6b52008-09-23 21:18:31 +00006354 case 316:
6355#line 2993 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006356 {
Duncan Sandsdc024672007-11-27 13:23:08 +00006357 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006358 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006359 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006360 // Used for call and invoke instructions
Dan Gohmanf4423b12008-04-19 00:24:39 +00006361 (yyval.ParamList) = new ParamList();
6362 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
6363 (yyval.ParamList)->push_back(E);
6364 delete (yyvsp[(1) - (4)].TypeVal);
Duncan Sandsdc024672007-11-27 13:23:08 +00006365 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006366 ;}
6367 break;
6368
Chris Lattnerccef6b52008-09-23 21:18:31 +00006369 case 317:
6370#line 3004 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006371 {
Duncan Sandsdc024672007-11-27 13:23:08 +00006372 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dale Johanneseneb57ea72007-11-05 21:20:28 +00006373 // Labels are only valid in ASMs
Dan Gohmanf4423b12008-04-19 00:24:39 +00006374 (yyval.ParamList) = new ParamList();
6375 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
6376 (yyval.ParamList)->push_back(E);
Duncan Sandsdc024672007-11-27 13:23:08 +00006377 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006378 ;}
6379 break;
6380
Chris Lattnerccef6b52008-09-23 21:18:31 +00006381 case 318:
6382#line 3012 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006383 {
Duncan Sandsdc024672007-11-27 13:23:08 +00006384 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006385 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006386 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6387 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
6388 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
6389 (yyval.ParamList)->push_back(E);
6390 delete (yyvsp[(3) - (6)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006391 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006392 ;}
6393 break;
6394
Chris Lattnerccef6b52008-09-23 21:18:31 +00006395 case 319:
6396#line 3022 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006397 {
Duncan Sandsdc024672007-11-27 13:23:08 +00006398 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf4423b12008-04-19 00:24:39 +00006399 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
6400 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
6401 (yyval.ParamList)->push_back(E);
Dale Johanneseneb57ea72007-11-05 21:20:28 +00006402 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006403 ;}
6404 break;
6405
Chris Lattnerccef6b52008-09-23 21:18:31 +00006406 case 320:
6407#line 3029 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006408 { (yyval.ParamList) = new ParamList(); ;}
6409 break;
6410
Chris Lattnerccef6b52008-09-23 21:18:31 +00006411 case 321:
6412#line 3032 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006413 { (yyval.ValueList) = new std::vector<Value*>(); ;}
6414 break;
6415
Chris Lattnerccef6b52008-09-23 21:18:31 +00006416 case 322:
6417#line 3033 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006418 {
6419 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
6420 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00006421 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006422 ;}
6423 break;
6424
Chris Lattnerccef6b52008-09-23 21:18:31 +00006425 case 323:
6426#line 3041 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006427 {
6428 (yyval.ConstantList) = new std::vector<unsigned>();
6429 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
6430 GEN_ERROR("Index " + utostr((yyvsp[(2) - (2)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6431 (yyval.ConstantList)->push_back((yyvsp[(2) - (2)].UInt64Val));
6432 ;}
6433 break;
6434
Chris Lattnerccef6b52008-09-23 21:18:31 +00006435 case 324:
6436#line 3047 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006437 {
6438 (yyval.ConstantList) = (yyvsp[(1) - (3)].ConstantList);
6439 if ((unsigned)(yyvsp[(3) - (3)].UInt64Val) != (yyvsp[(3) - (3)].UInt64Val))
6440 GEN_ERROR("Index " + utostr((yyvsp[(3) - (3)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6441 (yyval.ConstantList)->push_back((yyvsp[(3) - (3)].UInt64Val));
6442 CHECK_FOR_ERROR
6443 ;}
6444 break;
6445
Chris Lattnerccef6b52008-09-23 21:18:31 +00006446 case 325:
6447#line 3056 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006448 {
6449 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00006450 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006451 ;}
6452 break;
6453
Chris Lattnerccef6b52008-09-23 21:18:31 +00006454 case 326:
6455#line 3060 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006456 {
6457 (yyval.BoolVal) = false;
Andrew Lenharth6353e052006-12-08 18:07:09 +00006458 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006459 ;}
6460 break;
6461
Chris Lattnerccef6b52008-09-23 21:18:31 +00006462 case 327:
6463#line 3065 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006464 {
Reid Spencer14310612006-12-31 05:40:51 +00006465 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006466 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6467 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
6468 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006469 GEN_ERROR(
6470 "Arithmetic operator requires integer, FP, or packed operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006471 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006472 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006473 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006474 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006475 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006476 if ((yyval.InstVal) == 0)
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006477 GEN_ERROR("binary operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006478 delete (yyvsp[(2) - (5)].TypeVal);
6479 ;}
6480 break;
6481
Chris Lattnerccef6b52008-09-23 21:18:31 +00006482 case 328:
6483#line 3081 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006484 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006485 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006486 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6487 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006488 if (!isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
Dan Gohmanf4423b12008-04-19 00:24:39 +00006489 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006490 GEN_ERROR("Logical operator requires integral operands");
6491 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006492 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006493 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006494 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006495 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006496 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006497 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006498 GEN_ERROR("binary operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006499 delete (yyvsp[(2) - (5)].TypeVal);
6500 ;}
6501 break;
6502
Chris Lattnerccef6b52008-09-23 21:18:31 +00006503 case 329:
6504#line 3098 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006505 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006506 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006507 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
Dan Gohmanf4423b12008-04-19 00:24:39 +00006508 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006509 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006510 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006511 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006512 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006513 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006514 GEN_ERROR("icmp operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006515 delete (yyvsp[(3) - (6)].TypeVal);
6516 ;}
6517 break;
6518
Chris Lattnerccef6b52008-09-23 21:18:31 +00006519 case 330:
6520#line 3110 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006521 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006522 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006523 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
Dan Gohmanf4423b12008-04-19 00:24:39 +00006524 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006525 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006526 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006527 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006528 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006529 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006530 GEN_ERROR("fcmp operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006531 delete (yyvsp[(3) - (6)].TypeVal);
6532 ;}
6533 break;
6534
Chris Lattnerccef6b52008-09-23 21:18:31 +00006535 case 331:
6536#line 3122 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00006537 {
6538 if (!UpRefs.empty())
6539 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6540 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6541 GEN_ERROR("Scalar types not supported by vicmp instruction");
6542 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6543 CHECK_FOR_ERROR
6544 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6545 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006546 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Nate Begemanac80ade2008-05-12 19:01:56 +00006547 if ((yyval.InstVal) == 0)
Dan Gohmand8ee59b2008-09-09 01:13:24 +00006548 GEN_ERROR("vicmp operator returned null");
Nate Begemanac80ade2008-05-12 19:01:56 +00006549 delete (yyvsp[(3) - (6)].TypeVal);
6550 ;}
6551 break;
6552
Chris Lattnerccef6b52008-09-23 21:18:31 +00006553 case 332:
6554#line 3136 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00006555 {
6556 if (!UpRefs.empty())
6557 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6558 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6559 GEN_ERROR("Scalar types not supported by vfcmp instruction");
6560 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6561 CHECK_FOR_ERROR
6562 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6563 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006564 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Nate Begemanac80ade2008-05-12 19:01:56 +00006565 if ((yyval.InstVal) == 0)
Dan Gohmand8ee59b2008-09-09 01:13:24 +00006566 GEN_ERROR("vfcmp operator returned null");
Nate Begemanac80ade2008-05-12 19:01:56 +00006567 delete (yyvsp[(3) - (6)].TypeVal);
6568 ;}
6569 break;
6570
Chris Lattnerccef6b52008-09-23 21:18:31 +00006571 case 333:
6572#line 3150 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006573 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006574 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006575 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6576 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6577 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6578 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006579 GEN_ERROR("invalid cast opcode for cast from '" +
6580 Val->getType()->getDescription() + "' to '" +
6581 DestTy->getDescription() + "'");
Dan Gohmane4977cf2008-05-23 01:55:30 +00006582 (yyval.InstVal) = CastInst::Create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006583 delete (yyvsp[(4) - (4)].TypeVal);
6584 ;}
6585 break;
6586
Chris Lattnerccef6b52008-09-23 21:18:31 +00006587 case 334:
6588#line 3162 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006589 {
Dan Gohmand8ee59b2008-09-09 01:13:24 +00006590 if (isa<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType())) {
6591 // vector select
6592 if (!isa<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType())
6593 || !isa<VectorType>((yyvsp[(6) - (6)].ValueVal)->getType()) )
6594 GEN_ERROR("vector select value types must be vector types");
6595 const VectorType* cond_type = cast<VectorType>((yyvsp[(2) - (6)].ValueVal)->getType());
6596 const VectorType* select_type = cast<VectorType>((yyvsp[(4) - (6)].ValueVal)->getType());
6597 if (cond_type->getElementType() != Type::Int1Ty)
6598 GEN_ERROR("vector select condition element type must be boolean");
6599 if (cond_type->getNumElements() != select_type->getNumElements())
6600 GEN_ERROR("vector select number of elements must be the same");
6601 } else {
6602 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
6603 GEN_ERROR("select condition must be boolean");
6604 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006605 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
Dan Gohmand8ee59b2008-09-09 01:13:24 +00006606 GEN_ERROR("select value types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006607 (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006608 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006609 ;}
6610 break;
6611
Chris Lattnerccef6b52008-09-23 21:18:31 +00006612 case 335:
6613#line 3183 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006614 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006615 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006616 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6617 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6618 delete (yyvsp[(4) - (4)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006619 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006620 ;}
6621 break;
6622
Chris Lattnerccef6b52008-09-23 21:18:31 +00006623 case 336:
6624#line 3190 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006625 {
6626 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006627 GEN_ERROR("Invalid extractelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006628 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006629 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006630 ;}
6631 break;
6632
Chris Lattnerccef6b52008-09-23 21:18:31 +00006633 case 337:
6634#line 3196 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006635 {
6636 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006637 GEN_ERROR("Invalid insertelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006638 (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006639 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006640 ;}
6641 break;
6642
Chris Lattnerccef6b52008-09-23 21:18:31 +00006643 case 338:
6644#line 3202 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006645 {
6646 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006647 GEN_ERROR("Invalid shufflevector operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006648 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006649 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006650 ;}
6651 break;
6652
Chris Lattnerccef6b52008-09-23 21:18:31 +00006653 case 339:
6654#line 3208 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006655 {
6656 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006657 if (!Ty->isFirstClassType())
6658 GEN_ERROR("PHI node operands must be of first class type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006659 (yyval.InstVal) = PHINode::Create(Ty);
6660 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6661 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6662 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006663 GEN_ERROR("All elements of a PHI node must be of the same type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006664 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6665 (yyvsp[(2) - (2)].PHIList)->pop_front();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006666 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006667 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006668 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006669 ;}
6670 break;
6671
Chris Lattnerccef6b52008-09-23 21:18:31 +00006672 case 340:
6673#line 3224 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006674 {
Reid Spencer14310612006-12-31 05:40:51 +00006675
6676 // Handle the short syntax
Andrew Lenharth6353e052006-12-08 18:07:09 +00006677 const PointerType *PFTy = 0;
6678 const FunctionType *Ty = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006679 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
Andrew Lenharth6353e052006-12-08 18:07:09 +00006680 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6681 // Pull out the types of all of the arguments...
6682 std::vector<const Type*> ParamTypes;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006683 ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006684 for (; I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00006685 const Type *Ty = I->Val->getType();
6686 if (Ty == Type::VoidTy)
6687 GEN_ERROR("Short call syntax cannot be used with varargs");
6688 ParamTypes.push_back(Ty);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006689 }
Chris Lattnera925a142008-04-23 05:37:08 +00006690
6691 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (8)].TypeVal)))
6692 GEN_ERROR("Invalid result type for LLVM function");
6693
Dan Gohmanf4423b12008-04-19 00:24:39 +00006694 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00006695 PFTy = PointerType::getUnqual(Ty);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006696 }
Chris Lattner6cdc6822007-04-26 05:31:05 +00006697
Dan Gohmanf4423b12008-04-19 00:24:39 +00006698 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00006699 CHECK_FOR_ERROR
Chris Lattner6cdc6822007-04-26 05:31:05 +00006700
Reid Spencer7780acb2007-04-16 06:56:07 +00006701 // Check for call to invalid intrinsic to avoid crashing later.
6702 if (Function *theF = dyn_cast<Function>(V)) {
Reid Spencered48de22007-04-16 22:02:23 +00006703 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
Reid Spencer36fdde12007-04-16 20:35:38 +00006704 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6705 !theF->getIntrinsicID(true))
Reid Spencer7780acb2007-04-16 06:56:07 +00006706 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6707 theF->getName() + "'");
6708 }
6709
Duncan Sandsdc024672007-11-27 13:23:08 +00006710 // Set up the ParamAttrs for the function
Chris Lattner58d74912008-03-12 17:45:29 +00006711 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006712 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None)
6713 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (8)].ParamAttrs)));
Reid Spencer14310612006-12-31 05:40:51 +00006714 // Check the arguments
6715 ValueList Args;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006716 if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments?
Andrew Lenharth6353e052006-12-08 18:07:09 +00006717 // Make sure no arguments is a good thing!
6718 if (Ty->getNumParams() != 0)
6719 GEN_ERROR("No arguments passed to a function that "
Reid Spencerb5334b02007-02-05 10:18:06 +00006720 "expects arguments");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006721 } else { // Has arguments?
6722 // Loop through FunctionType's arguments and ensure they are specified
Duncan Sandsdc024672007-11-27 13:23:08 +00006723 // correctly. Also, gather any parameter attributes.
Andrew Lenharth6353e052006-12-08 18:07:09 +00006724 FunctionType::param_iterator I = Ty->param_begin();
6725 FunctionType::param_iterator E = Ty->param_end();
Dan Gohmanf4423b12008-04-19 00:24:39 +00006726 ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006727 unsigned index = 1;
Andrew Lenharth6353e052006-12-08 18:07:09 +00006728
Duncan Sandsdc024672007-11-27 13:23:08 +00006729 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006730 if (ArgI->Val->getType() != *I)
6731 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00006732 (*I)->getDescription() + "'");
Reid Spencer14310612006-12-31 05:40:51 +00006733 Args.push_back(ArgI->Val);
Chris Lattner58d74912008-03-12 17:45:29 +00006734 if (ArgI->Attrs != ParamAttr::None)
6735 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00006736 }
6737 if (Ty->isVarArg()) {
6738 if (I == E)
Chris Lattner38905612008-02-19 04:36:25 +00006739 for (; ArgI != ArgE; ++ArgI, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006740 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner58d74912008-03-12 17:45:29 +00006741 if (ArgI->Attrs != ParamAttr::None)
6742 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Chris Lattner38905612008-02-19 04:36:25 +00006743 }
Reid Spencer14310612006-12-31 05:40:51 +00006744 } else if (I != E || ArgI != ArgE)
Reid Spencerb5334b02007-02-05 10:18:06 +00006745 GEN_ERROR("Invalid number of parameters detected");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006746 }
Duncan Sandsdc024672007-11-27 13:23:08 +00006747
6748 // Finish off the ParamAttrs and check them
Chris Lattner58d74912008-03-12 17:45:29 +00006749 PAListPtr PAL;
Duncan Sandsdc024672007-11-27 13:23:08 +00006750 if (!Attrs.empty())
Chris Lattner58d74912008-03-12 17:45:29 +00006751 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsdc024672007-11-27 13:23:08 +00006752
Reid Spencer14310612006-12-31 05:40:51 +00006753 // Create the call node
Gabor Greife64d2482008-04-06 23:07:54 +00006754 CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
Dan Gohmanf4423b12008-04-19 00:24:39 +00006755 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6756 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
Duncan Sandsdc024672007-11-27 13:23:08 +00006757 CI->setParamAttrs(PAL);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006758 (yyval.InstVal) = CI;
6759 delete (yyvsp[(6) - (8)].ParamList);
6760 delete (yyvsp[(3) - (8)].TypeVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00006761 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006762 ;}
6763 break;
6764
Chris Lattnerccef6b52008-09-23 21:18:31 +00006765 case 341:
6766#line 3313 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006767 {
6768 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00006769 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006770 ;}
6771 break;
6772
Chris Lattnerccef6b52008-09-23 21:18:31 +00006773 case 342:
6774#line 3318 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006775 {
6776 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00006777 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006778 ;}
6779 break;
6780
Chris Lattnerccef6b52008-09-23 21:18:31 +00006781 case 343:
6782#line 3322 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006783 {
6784 (yyval.BoolVal) = false;
Reid Spencer61c83e02006-08-18 08:43:06 +00006785 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006786 ;}
6787 break;
6788
Chris Lattnerccef6b52008-09-23 21:18:31 +00006789 case 344:
6790#line 3329 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006791 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006792 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006793 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6794 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6795 delete (yyvsp[(2) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006796 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006797 ;}
6798 break;
6799
Chris Lattnerccef6b52008-09-23 21:18:31 +00006800 case 345:
6801#line 3336 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006802 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006803 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006804 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006805 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6806 GEN_ERROR("Malloc array size is not a 32-bit integer!");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006807 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00006808 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006809 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6810 delete (yyvsp[(2) - (6)].TypeVal);
6811 ;}
6812 break;
6813
Chris Lattnerccef6b52008-09-23 21:18:31 +00006814 case 346:
6815#line 3346 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006816 {
Reid Spencer14310612006-12-31 05:40:51 +00006817 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006818 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6819 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6820 delete (yyvsp[(2) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006821 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006822 ;}
6823 break;
6824
Chris Lattnerccef6b52008-09-23 21:18:31 +00006825 case 347:
6826#line 3353 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006827 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006828 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006829 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006830 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6831 GEN_ERROR("Alloca array size is not a 32-bit integer!");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006832 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006833 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006834 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6835 delete (yyvsp[(2) - (6)].TypeVal);
6836 ;}
6837 break;
6838
Chris Lattnerccef6b52008-09-23 21:18:31 +00006839 case 348:
6840#line 3363 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006841 {
6842 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006843 GEN_ERROR("Trying to free nonpointer type " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006844 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6845 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006846 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006847 ;}
6848 break;
6849
Chris Lattnerccef6b52008-09-23 21:18:31 +00006850 case 349:
6851#line 3371 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006852 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006853 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006854 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6855 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006856 GEN_ERROR("Can't load from nonpointer type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006857 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6858 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006859 GEN_ERROR("Can't load from pointer of non-first-class type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006860 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6861 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006862 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006863 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6864 delete (yyvsp[(3) - (5)].TypeVal);
6865 ;}
6866 break;
6867
Chris Lattnerccef6b52008-09-23 21:18:31 +00006868 case 350:
6869#line 3385 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006870 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006871 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006872 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6873 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006874 if (!PT)
6875 GEN_ERROR("Can't store to a nonpointer type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006876 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006877 const Type *ElTy = PT->getElementType();
Dan Gohmanf4423b12008-04-19 00:24:39 +00006878 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6879 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006880 "' into space of type '" + ElTy->getDescription() + "'");
6881
Dan Gohmanf4423b12008-04-19 00:24:39 +00006882 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006883 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006884 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6885 delete (yyvsp[(5) - (7)].TypeVal);
6886 ;}
6887 break;
6888
Chris Lattnerccef6b52008-09-23 21:18:31 +00006889 case 351:
6890#line 3402 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006891 {
Dan Gohman1a570242008-07-23 00:54:54 +00006892 if (!UpRefs.empty())
6893 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6894 if (!isa<StructType>((yyvsp[(2) - (5)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (5)].TypeVal)->get()))
6895 GEN_ERROR("getresult insn requires an aggregate operand");
6896 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].UInt64Val)))
6897 GEN_ERROR("Invalid getresult index for type '" +
6898 (*(yyvsp[(2) - (5)].TypeVal))->getDescription()+ "'");
6899
6900 Value *tmpVal = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Devang Patel5a970972008-02-19 22:27:01 +00006901 CHECK_FOR_ERROR
Dan Gohman1a570242008-07-23 00:54:54 +00006902 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(5) - (5)].UInt64Val));
6903 delete (yyvsp[(2) - (5)].TypeVal);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006904 ;}
6905 break;
6906
Chris Lattnerccef6b52008-09-23 21:18:31 +00006907 case 352:
6908#line 3416 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006909 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006910 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006911 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6912 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
Reid Spencerb5334b02007-02-05 10:18:06 +00006913 GEN_ERROR("getelementptr insn requires pointer operand");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006914
Dan Gohman041e2eb2008-05-15 19:50:34 +00006915 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()))
Reid Spencer61c83e02006-08-18 08:43:06 +00006916 GEN_ERROR("Invalid getelementptr indices for type '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006917 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6918 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00006919 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006920 (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6921 delete (yyvsp[(2) - (4)].TypeVal);
6922 delete (yyvsp[(4) - (4)].ValueList);
6923 ;}
6924 break;
Reid Spencer7780acb2007-04-16 06:56:07 +00006925
Chris Lattnerccef6b52008-09-23 21:18:31 +00006926 case 353:
6927#line 3431 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00006928 {
6929 if (!UpRefs.empty())
6930 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6931 if (!isa<StructType>((yyvsp[(2) - (4)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (4)].TypeVal)->get()))
6932 GEN_ERROR("extractvalue insn requires an aggregate operand");
6933
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006934 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end()))
Dan Gohmane4977cf2008-05-23 01:55:30 +00006935 GEN_ERROR("Invalid extractvalue indices for type '" +
6936 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6937 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6938 CHECK_FOR_ERROR
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006939 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end());
Dan Gohmane4977cf2008-05-23 01:55:30 +00006940 delete (yyvsp[(2) - (4)].TypeVal);
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006941 delete (yyvsp[(4) - (4)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00006942 ;}
6943 break;
6944
Chris Lattnerccef6b52008-09-23 21:18:31 +00006945 case 354:
6946#line 3446 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00006947 {
6948 if (!UpRefs.empty())
6949 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription());
6950 if (!isa<StructType>((yyvsp[(2) - (7)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (7)].TypeVal)->get()))
6951 GEN_ERROR("extractvalue insn requires an aggregate operand");
6952
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006953 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 +00006954 GEN_ERROR("Invalid insertvalue indices for type '" +
6955 (*(yyvsp[(2) - (7)].TypeVal))->getDescription()+ "'");
6956 Value* aggVal = getVal(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(3) - (7)].ValIDVal));
6957 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
6958 CHECK_FOR_ERROR
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006959 (yyval.InstVal) = InsertValueInst::Create(aggVal, tmpVal, (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end());
Dan Gohmane4977cf2008-05-23 01:55:30 +00006960 delete (yyvsp[(2) - (7)].TypeVal);
6961 delete (yyvsp[(5) - (7)].TypeVal);
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006962 delete (yyvsp[(7) - (7)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00006963 ;}
6964 break;
6965
Dan Gohmanf4423b12008-04-19 00:24:39 +00006966
6967/* Line 1267 of yacc.c. */
Chris Lattnerccef6b52008-09-23 21:18:31 +00006968#line 6969 "llvmAsmParser.tab.c"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006969 default: break;
Dale Johannesencdd509a2007-09-07 21:07:57 +00006970 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006971 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6972
6973 YYPOPSTACK (yylen);
6974 yylen = 0;
6975 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006976
6977 *++yyvsp = yyval;
6978
6979
Dan Gohmanf4423b12008-04-19 00:24:39 +00006980 /* Now `shift' the result of the reduction. Determine what state
6981 that goes to, based on the state we popped back to and the rule
6982 number reduced by. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00006983
6984 yyn = yyr1[yyn];
6985
Dan Gohmanf4423b12008-04-19 00:24:39 +00006986 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6987 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00006988 yystate = yytable[yystate];
6989 else
Dan Gohmanf4423b12008-04-19 00:24:39 +00006990 yystate = yydefgoto[yyn - YYNTOKENS];
Reid Spencer68a24bd2005-08-27 18:50:39 +00006991
6992 goto yynewstate;
6993
6994
Dan Gohmanf4423b12008-04-19 00:24:39 +00006995/*------------------------------------.
6996| yyerrlab -- here on detecting error |
6997`------------------------------------*/
6998yyerrlab:
6999 /* If not already recovering from an error, report this error. */
7000 if (!yyerrstatus)
Reid Spencer68a24bd2005-08-27 18:50:39 +00007001 {
7002 ++yynerrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00007003#if ! YYERROR_VERBOSE
7004 yyerror (YY_("syntax error"));
7005#else
7006 {
7007 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
7008 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
7009 {
7010 YYSIZE_T yyalloc = 2 * yysize;
7011 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
7012 yyalloc = YYSTACK_ALLOC_MAXIMUM;
7013 if (yymsg != yymsgbuf)
7014 YYSTACK_FREE (yymsg);
7015 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
7016 if (yymsg)
7017 yymsg_alloc = yyalloc;
7018 else
7019 {
7020 yymsg = yymsgbuf;
7021 yymsg_alloc = sizeof yymsgbuf;
7022 }
7023 }
Dale Johannesencdd509a2007-09-07 21:07:57 +00007024
Dan Gohmanf4423b12008-04-19 00:24:39 +00007025 if (0 < yysize && yysize <= yymsg_alloc)
7026 {
7027 (void) yysyntax_error (yymsg, yystate, yychar);
7028 yyerror (yymsg);
7029 }
7030 else
7031 {
7032 yyerror (YY_("syntax error"));
7033 if (yysize != 0)
7034 goto yyexhaustedlab;
7035 }
7036 }
7037#endif
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00007038 }
7039
Dan Gohmanf4423b12008-04-19 00:24:39 +00007040
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00007041
7042 if (yyerrstatus == 3)
7043 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00007044 /* If just tried and failed to reuse look-ahead token after an
7045 error, discard it. */
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00007046
Dan Gohmanf4423b12008-04-19 00:24:39 +00007047 if (yychar <= YYEOF)
7048 {
7049 /* Return failure if at end of input. */
7050 if (yychar == YYEOF)
7051 YYABORT;
7052 }
7053 else
7054 {
7055 yydestruct ("Error: discarding",
7056 yytoken, &yylval);
7057 yychar = YYEMPTY;
7058 }
7059 }
7060
7061 /* Else will try to reuse look-ahead token after shifting the error
7062 token. */
7063 goto yyerrlab1;
7064
7065
7066/*---------------------------------------------------.
7067| yyerrorlab -- error raised explicitly by YYERROR. |
7068`---------------------------------------------------*/
7069yyerrorlab:
7070
7071 /* Pacify compilers like GCC when the user code never invokes
7072 YYERROR and the label yyerrorlab therefore never appears in user
7073 code. */
7074 if (/*CONSTCOND*/ 0)
7075 goto yyerrorlab;
7076
7077 /* Do not reclaim the symbols of the rule which action triggered
7078 this YYERROR. */
7079 YYPOPSTACK (yylen);
7080 yylen = 0;
7081 YY_STACK_PRINT (yyss, yyssp);
7082 yystate = *yyssp;
7083 goto yyerrlab1;
7084
7085
7086/*-------------------------------------------------------------.
7087| yyerrlab1 -- common code for both syntax error and YYERROR. |
7088`-------------------------------------------------------------*/
7089yyerrlab1:
7090 yyerrstatus = 3; /* Each real token shifted decrements this. */
7091
7092 for (;;)
7093 {
7094 yyn = yypact[yystate];
7095 if (yyn != YYPACT_NINF)
7096 {
7097 yyn += YYTERROR;
7098 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
7099 {
7100 yyn = yytable[yyn];
7101 if (0 < yyn)
7102 break;
7103 }
7104 }
7105
7106 /* Pop the current state because it cannot handle the error token. */
7107 if (yyssp == yyss)
Reid Spencer68a24bd2005-08-27 18:50:39 +00007108 YYABORT;
7109
Dale Johannesencdd509a2007-09-07 21:07:57 +00007110
Dan Gohmanf4423b12008-04-19 00:24:39 +00007111 yydestruct ("Error: popping",
7112 yystos[yystate], yyvsp);
7113 YYPOPSTACK (1);
7114 yystate = *yyssp;
7115 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00007116 }
7117
7118 if (yyn == YYFINAL)
7119 YYACCEPT;
7120
Reid Spencer68a24bd2005-08-27 18:50:39 +00007121 *++yyvsp = yylval;
Dan Gohmanf4423b12008-04-19 00:24:39 +00007122
7123
7124 /* Shift the error token. */
7125 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spencerb8f85052007-07-31 03:50:36 +00007126
Reid Spencer68a24bd2005-08-27 18:50:39 +00007127 yystate = yyn;
7128 goto yynewstate;
7129
Gabor Greife64d2482008-04-06 23:07:54 +00007130
Dan Gohmanf4423b12008-04-19 00:24:39 +00007131/*-------------------------------------.
7132| yyacceptlab -- YYACCEPT comes here. |
7133`-------------------------------------*/
7134yyacceptlab:
7135 yyresult = 0;
7136 goto yyreturn;
7137
7138/*-----------------------------------.
7139| yyabortlab -- YYABORT comes here. |
7140`-----------------------------------*/
7141yyabortlab:
7142 yyresult = 1;
7143 goto yyreturn;
7144
7145#ifndef yyoverflow
7146/*-------------------------------------------------.
7147| yyexhaustedlab -- memory exhaustion comes here. |
7148`-------------------------------------------------*/
7149yyexhaustedlab:
7150 yyerror (YY_("memory exhausted"));
7151 yyresult = 2;
7152 /* Fall through. */
Chris Lattner38905612008-02-19 04:36:25 +00007153#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00007154
7155yyreturn:
7156 if (yychar != YYEOF && yychar != YYEMPTY)
7157 yydestruct ("Cleanup: discarding lookahead",
7158 yytoken, &yylval);
7159 /* Do not reclaim the symbols of the rule which action triggered
7160 this YYABORT or YYACCEPT. */
7161 YYPOPSTACK (yylen);
7162 YY_STACK_PRINT (yyss, yyssp);
7163 while (yyssp != yyss)
7164 {
7165 yydestruct ("Cleanup: popping",
7166 yystos[*yyssp], yyvsp);
7167 YYPOPSTACK (1);
Gabor Greife64d2482008-04-06 23:07:54 +00007168 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00007169#ifndef yyoverflow
7170 if (yyss != yyssa)
7171 YYSTACK_FREE (yyss);
7172#endif
7173#if YYERROR_VERBOSE
7174 if (yymsg != yymsgbuf)
7175 YYSTACK_FREE (yymsg);
7176#endif
7177 /* Make sure YYID is used. */
7178 return YYID (yyresult);
Reid Spencer68a24bd2005-08-27 18:50:39 +00007179}
Dan Gohmanf4423b12008-04-19 00:24:39 +00007180
7181
Chris Lattnerccef6b52008-09-23 21:18:31 +00007182#line 3465 "/Users/sabre/llvm/lib/AsmParser/llvmAsmParser.y"
Reid Spencer61c83e02006-08-18 08:43:06 +00007183
7184
Reid Spencer14310612006-12-31 05:40:51 +00007185// common code from the two 'RunVMAsmParser' functions
7186static Module* RunParser(Module * M) {
Reid Spencer14310612006-12-31 05:40:51 +00007187 CurModule.CurrentModule = M;
Reid Spencer14310612006-12-31 05:40:51 +00007188 // Check to make sure the parser succeeded
7189 if (yyparse()) {
7190 if (ParserResult)
7191 delete ParserResult;
7192 return 0;
7193 }
7194
Reid Spencer0d60b5a2007-03-30 01:37:39 +00007195 // Emit an error if there are any unresolved types left.
7196 if (!CurModule.LateResolveTypes.empty()) {
7197 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
7198 if (DID.Type == ValID::LocalName) {
7199 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
7200 } else {
7201 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
7202 }
7203 if (ParserResult)
7204 delete ParserResult;
7205 return 0;
7206 }
7207
7208 // Emit an error if there are any unresolved values left.
7209 if (!CurModule.LateResolveValues.empty()) {
7210 Value *V = CurModule.LateResolveValues.back();
7211 std::map<Value*, std::pair<ValID, int> >::iterator I =
7212 CurModule.PlaceHolderInfo.find(V);
7213
7214 if (I != CurModule.PlaceHolderInfo.end()) {
7215 ValID &DID = I->second.first;
7216 if (DID.Type == ValID::LocalName) {
7217 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
7218 } else {
7219 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
7220 }
7221 if (ParserResult)
7222 delete ParserResult;
7223 return 0;
7224 }
7225 }
7226
Reid Spencer14310612006-12-31 05:40:51 +00007227 // Check to make sure that parsing produced a result
7228 if (!ParserResult)
7229 return 0;
7230
7231 // Reset ParserResult variable while saving its value for the result.
7232 Module *Result = ParserResult;
7233 ParserResult = 0;
7234
7235 return Result;
7236}
7237
Reid Spencer61c83e02006-08-18 08:43:06 +00007238void llvm::GenerateError(const std::string &message, int LineNo) {
Duncan Sandsdc024672007-11-27 13:23:08 +00007239 if (LineNo == -1) LineNo = LLLgetLineNo();
Reid Spencer61c83e02006-08-18 08:43:06 +00007240 // TODO: column number in exception
7241 if (TheParseError)
Duncan Sandsdc024672007-11-27 13:23:08 +00007242 TheParseError->setError(LLLgetFilename(), message, LineNo);
Reid Spencer61c83e02006-08-18 08:43:06 +00007243 TriggerError = 1;
7244}
Reid Spencer68a24bd2005-08-27 18:50:39 +00007245
7246int yyerror(const char *ErrorMsg) {
Duncan Sandsdc024672007-11-27 13:23:08 +00007247 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
Reid Spenceref9b9a72007-02-05 20:47:22 +00007248 std::string errMsg = where + "error: " + std::string(ErrorMsg);
Duncan Sandsdc024672007-11-27 13:23:08 +00007249 if (yychar != YYEMPTY && yychar != 0) {
7250 errMsg += " while reading token: '";
7251 errMsg += std::string(LLLgetTokenStart(),
7252 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
7253 }
Reid Spencer61c83e02006-08-18 08:43:06 +00007254 GenerateError(errMsg);
Reid Spencer68a24bd2005-08-27 18:50:39 +00007255 return 0;
7256}
Dan Gohmanf4423b12008-04-19 00:24:39 +00007257