blob: 9f58529133f0e37b090874ddecb496b73e8222fd [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,
142 DATALAYOUT = 323,
143 RET = 324,
144 BR = 325,
145 SWITCH = 326,
146 INVOKE = 327,
147 UNWIND = 328,
148 UNREACHABLE = 329,
149 ADD = 330,
150 SUB = 331,
151 MUL = 332,
152 UDIV = 333,
153 SDIV = 334,
154 FDIV = 335,
155 UREM = 336,
156 SREM = 337,
157 FREM = 338,
158 AND = 339,
159 OR = 340,
160 XOR = 341,
161 SHL = 342,
162 LSHR = 343,
163 ASHR = 344,
164 ICMP = 345,
165 FCMP = 346,
166 VICMP = 347,
167 VFCMP = 348,
168 EQ = 349,
169 NE = 350,
170 SLT = 351,
171 SGT = 352,
172 SLE = 353,
173 SGE = 354,
174 ULT = 355,
175 UGT = 356,
176 ULE = 357,
177 UGE = 358,
178 OEQ = 359,
179 ONE = 360,
180 OLT = 361,
181 OGT = 362,
182 OLE = 363,
183 OGE = 364,
184 ORD = 365,
185 UNO = 366,
186 UEQ = 367,
187 UNE = 368,
188 MALLOC = 369,
189 ALLOCA = 370,
190 FREE = 371,
191 LOAD = 372,
192 STORE = 373,
193 GETELEMENTPTR = 374,
194 TRUNC = 375,
195 ZEXT = 376,
196 SEXT = 377,
197 FPTRUNC = 378,
198 FPEXT = 379,
199 BITCAST = 380,
200 UITOFP = 381,
201 SITOFP = 382,
202 FPTOUI = 383,
203 FPTOSI = 384,
204 INTTOPTR = 385,
205 PTRTOINT = 386,
206 PHI_TOK = 387,
207 SELECT = 388,
208 VAARG = 389,
209 EXTRACTELEMENT = 390,
210 INSERTELEMENT = 391,
211 SHUFFLEVECTOR = 392,
212 GETRESULT = 393,
Dan Gohmane4977cf2008-05-23 01:55:30 +0000213 EXTRACTVALUE = 394,
214 INSERTVALUE = 395,
215 SIGNEXT = 396,
216 ZEROEXT = 397,
217 NORETURN = 398,
218 INREG = 399,
219 SRET = 400,
220 NOUNWIND = 401,
221 NOALIAS = 402,
222 BYVAL = 403,
223 NEST = 404,
224 READNONE = 405,
225 READONLY = 406,
226 GC = 407,
227 DEFAULT = 408,
228 HIDDEN = 409,
229 PROTECTED = 410
Dan Gohmanf4423b12008-04-19 00:24:39 +0000230 };
231#endif
232/* Tokens. */
233#define ESINT64VAL 258
234#define EUINT64VAL 259
235#define ESAPINTVAL 260
236#define EUAPINTVAL 261
237#define LOCALVAL_ID 262
238#define GLOBALVAL_ID 263
239#define FPVAL 264
240#define VOID 265
241#define INTTYPE 266
242#define FLOAT 267
243#define DOUBLE 268
244#define X86_FP80 269
245#define FP128 270
246#define PPC_FP128 271
247#define LABEL 272
248#define TYPE 273
249#define LOCALVAR 274
250#define GLOBALVAR 275
251#define LABELSTR 276
252#define STRINGCONSTANT 277
253#define ATSTRINGCONSTANT 278
254#define PCTSTRINGCONSTANT 279
255#define ZEROINITIALIZER 280
256#define TRUETOK 281
257#define FALSETOK 282
258#define BEGINTOK 283
259#define ENDTOK 284
260#define DECLARE 285
261#define DEFINE 286
262#define GLOBAL 287
263#define CONSTANT 288
264#define SECTION 289
265#define ALIAS 290
266#define VOLATILE 291
267#define THREAD_LOCAL 292
268#define TO 293
269#define DOTDOTDOT 294
270#define NULL_TOK 295
271#define UNDEF 296
272#define INTERNAL 297
273#define LINKONCE 298
274#define WEAK 299
275#define APPENDING 300
276#define DLLIMPORT 301
277#define DLLEXPORT 302
278#define EXTERN_WEAK 303
Dale Johannesenc7071cc2008-05-14 20:13:36 +0000279#define COMMON 304
280#define OPAQUE 305
281#define EXTERNAL 306
282#define TARGET 307
283#define TRIPLE 308
284#define ALIGN 309
285#define ADDRSPACE 310
286#define DEPLIBS 311
287#define CALL 312
288#define TAIL 313
289#define ASM_TOK 314
290#define MODULE 315
291#define SIDEEFFECT 316
292#define CC_TOK 317
293#define CCC_TOK 318
294#define FASTCC_TOK 319
295#define COLDCC_TOK 320
296#define X86_STDCALLCC_TOK 321
297#define X86_FASTCALLCC_TOK 322
298#define DATALAYOUT 323
299#define RET 324
300#define BR 325
301#define SWITCH 326
302#define INVOKE 327
303#define UNWIND 328
304#define UNREACHABLE 329
305#define ADD 330
306#define SUB 331
307#define MUL 332
308#define UDIV 333
309#define SDIV 334
310#define FDIV 335
311#define UREM 336
312#define SREM 337
313#define FREM 338
314#define AND 339
315#define OR 340
316#define XOR 341
317#define SHL 342
318#define LSHR 343
319#define ASHR 344
320#define ICMP 345
321#define FCMP 346
322#define VICMP 347
323#define VFCMP 348
324#define EQ 349
325#define NE 350
326#define SLT 351
327#define SGT 352
328#define SLE 353
329#define SGE 354
330#define ULT 355
331#define UGT 356
332#define ULE 357
333#define UGE 358
334#define OEQ 359
335#define ONE 360
336#define OLT 361
337#define OGT 362
338#define OLE 363
339#define OGE 364
340#define ORD 365
341#define UNO 366
342#define UEQ 367
343#define UNE 368
344#define MALLOC 369
345#define ALLOCA 370
346#define FREE 371
347#define LOAD 372
348#define STORE 373
349#define GETELEMENTPTR 374
350#define TRUNC 375
351#define ZEXT 376
352#define SEXT 377
353#define FPTRUNC 378
354#define FPEXT 379
355#define BITCAST 380
356#define UITOFP 381
357#define SITOFP 382
358#define FPTOUI 383
359#define FPTOSI 384
360#define INTTOPTR 385
361#define PTRTOINT 386
362#define PHI_TOK 387
363#define SELECT 388
364#define VAARG 389
365#define EXTRACTELEMENT 390
366#define INSERTELEMENT 391
367#define SHUFFLEVECTOR 392
368#define GETRESULT 393
Dan Gohmane4977cf2008-05-23 01:55:30 +0000369#define EXTRACTVALUE 394
370#define INSERTVALUE 395
371#define SIGNEXT 396
372#define ZEROEXT 397
373#define NORETURN 398
374#define INREG 399
375#define SRET 400
376#define NOUNWIND 401
377#define NOALIAS 402
378#define BYVAL 403
379#define NEST 404
380#define READNONE 405
381#define READONLY 406
382#define GC 407
383#define DEFAULT 408
384#define HIDDEN 409
385#define PROTECTED 410
Dan Gohmanf4423b12008-04-19 00:24:39 +0000386
387
388
389
390/* Copy the first part of user declarations. */
Dan Gohmane4977cf2008-05-23 01:55:30 +0000391#line 14 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000392
393#include "ParserInternals.h"
394#include "llvm/CallingConv.h"
Chris Lattner0e9c3762006-01-25 22:27:16 +0000395#include "llvm/InlineAsm.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000396#include "llvm/Instructions.h"
397#include "llvm/Module.h"
Reid Spenceref9b9a72007-02-05 20:47:22 +0000398#include "llvm/ValueSymbolTable.h"
Chandler Carruth02202192007-08-04 01:56:21 +0000399#include "llvm/AutoUpgrade.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000400#include "llvm/Support/GetElementPtrTypeIterator.h"
Reid Spencer14310612006-12-31 05:40:51 +0000401#include "llvm/Support/CommandLine.h"
Chris Lattnerf7469af2007-01-31 04:44:08 +0000402#include "llvm/ADT/SmallVector.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000403#include "llvm/ADT/STLExtras.h"
Chris Lattner0019bbe2005-11-06 06:46:53 +0000404#include "llvm/Support/MathExtras.h"
Reid Spencer481169e2006-12-01 00:33:46 +0000405#include "llvm/Support/Streams.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000406#include <algorithm>
Reid Spencer68a24bd2005-08-27 18:50:39 +0000407#include <list>
Chris Lattner8adde282007-02-11 21:40:10 +0000408#include <map>
Reid Spencer68a24bd2005-08-27 18:50:39 +0000409#include <utility>
410
Reid Spencere4f47592006-08-18 17:32:55 +0000411// The following is a gross hack. In order to rid the libAsmParser library of
412// exceptions, we have to have a way of getting the yyparse function to go into
413// an error situation. So, whenever we want an error to occur, the GenerateError
414// function (see bottom of file) sets TriggerError. Then, at the end of each
415// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
416// (a goto) to put YACC in error state. Furthermore, several calls to
417// GenerateError are made from inside productions and they must simulate the
418// previous exception behavior by exiting the production immediately. We have
419// replaced these with the GEN_ERROR macro which calls GeneratError and then
420// immediately invokes YYERROR. This would be so much cleaner if it was a
421// recursive descent parser.
Reid Spencer61c83e02006-08-18 08:43:06 +0000422static bool TriggerError = false;
Reid Spencerf63697d2006-10-09 17:36:59 +0000423#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
Reid Spencer61c83e02006-08-18 08:43:06 +0000424#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
425
Reid Spencer68a24bd2005-08-27 18:50:39 +0000426int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
427int yylex(); // declaration" of xxx warnings.
428int yyparse();
Reid Spencer68a24bd2005-08-27 18:50:39 +0000429using namespace llvm;
430
431static Module *ParserResult;
432
433// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
434// relating to upreferences in the input stream.
435//
436//#define DEBUG_UPREFS 1
437#ifdef DEBUG_UPREFS
Bill Wendlinge8156192006-12-07 01:30:32 +0000438#define UR_OUT(X) cerr << X
Reid Spencer68a24bd2005-08-27 18:50:39 +0000439#else
440#define UR_OUT(X)
441#endif
442
443#define YYERROR_VERBOSE 1
444
Chris Lattnerb475c422005-11-12 18:22:38 +0000445static GlobalVariable *CurGV;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000446
447
448// This contains info used when building the body of a function. It is
449// destroyed when the function is completed.
450//
451typedef std::vector<Value *> ValueList; // Numbered defs
Reid Spencer14310612006-12-31 05:40:51 +0000452
Reid Spencer68a24bd2005-08-27 18:50:39 +0000453static void
Reid Spencer93c40032007-03-19 18:40:50 +0000454ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000455
456static struct PerModuleInfo {
457 Module *CurrentModule;
Reid Spencer93c40032007-03-19 18:40:50 +0000458 ValueList Values; // Module level numbered definitions
459 ValueList LateResolveValues;
Reid Spencer861d9d62006-11-28 07:29:44 +0000460 std::vector<PATypeHolder> Types;
461 std::map<ValID, PATypeHolder> LateResolveTypes;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000462
463 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
Chris Lattner0ad19702006-06-21 16:53:00 +0000464 /// how they were referenced and on which line of the input they came from so
Reid Spencer68a24bd2005-08-27 18:50:39 +0000465 /// that we can resolve them later and print error messages as appropriate.
466 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
467
468 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
469 // references to global values. Global values may be referenced before they
470 // are defined, and if so, the temporary object that they represent is held
471 // here. This is used for forward references of GlobalValues.
472 //
473 typedef std::map<std::pair<const PointerType *,
474 ValID>, GlobalValue*> GlobalRefsType;
475 GlobalRefsType GlobalRefs;
476
477 void ModuleDone() {
478 // If we could not resolve some functions at function compilation time
479 // (calls to functions before they are defined), resolve them now... Types
480 // are resolved when the constant pool has been completely parsed.
481 //
482 ResolveDefinitions(LateResolveValues);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000483 if (TriggerError)
484 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000485
486 // Check to make sure that all global value forward references have been
487 // resolved!
488 //
489 if (!GlobalRefs.empty()) {
490 std::string UndefinedReferences = "Unresolved global references exist:\n";
491
492 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
493 I != E; ++I) {
494 UndefinedReferences += " " + I->first.first->getDescription() + " " +
495 I->first.second.getName() + "\n";
496 }
Reid Spencer61c83e02006-08-18 08:43:06 +0000497 GenerateError(UndefinedReferences);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000498 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000499 }
500
Chandler Carruth02202192007-08-04 01:56:21 +0000501 // Look for intrinsic functions and CallInst that need to be upgraded
502 for (Module::iterator FI = CurrentModule->begin(),
503 FE = CurrentModule->end(); FI != FE; )
504 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
505
Reid Spencer68a24bd2005-08-27 18:50:39 +0000506 Values.clear(); // Clear out function local definitions
507 Types.clear();
508 CurrentModule = 0;
509 }
510
Reid Spencer68a24bd2005-08-27 18:50:39 +0000511 // GetForwardRefForGlobal - Check to see if there is a forward reference
512 // for this global. If so, remove it from the GlobalRefs map and return it.
513 // If not, just return null.
514 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
515 // Check to see if there is a forward reference to this global variable...
516 // if there is, eliminate it and patch the reference to use the new def'n.
517 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
518 GlobalValue *Ret = 0;
519 if (I != GlobalRefs.end()) {
520 Ret = I->second;
521 GlobalRefs.erase(I);
522 }
523 return Ret;
524 }
Reid Spencer8c8a2dc2007-01-02 21:54:12 +0000525
526 bool TypeIsUnresolved(PATypeHolder* PATy) {
527 // If it isn't abstract, its resolved
528 const Type* Ty = PATy->get();
529 if (!Ty->isAbstract())
530 return false;
531 // Traverse the type looking for abstract types. If it isn't abstract then
532 // we don't need to traverse that leg of the type.
533 std::vector<const Type*> WorkList, SeenList;
534 WorkList.push_back(Ty);
535 while (!WorkList.empty()) {
536 const Type* Ty = WorkList.back();
537 SeenList.push_back(Ty);
538 WorkList.pop_back();
539 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
540 // Check to see if this is an unresolved type
541 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
542 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
543 for ( ; I != E; ++I) {
544 if (I->second.get() == OpTy)
545 return true;
546 }
547 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
548 const Type* TheTy = SeqTy->getElementType();
549 if (TheTy->isAbstract() && TheTy != Ty) {
550 std::vector<const Type*>::iterator I = SeenList.begin(),
551 E = SeenList.end();
552 for ( ; I != E; ++I)
553 if (*I == TheTy)
554 break;
555 if (I == E)
556 WorkList.push_back(TheTy);
557 }
558 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
559 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
560 const Type* TheTy = StrTy->getElementType(i);
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 }
571 }
572 }
573 return false;
574 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000575} CurModule;
576
577static struct PerFunctionInfo {
578 Function *CurrentFunction; // Pointer to current function being created
579
Reid Spencer93c40032007-03-19 18:40:50 +0000580 ValueList Values; // Keep track of #'d definitions
581 unsigned NextValNum;
582 ValueList LateResolveValues;
Reid Spenceref9b9a72007-02-05 20:47:22 +0000583 bool isDeclare; // Is this function a forward declararation?
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000584 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000585 GlobalValue::VisibilityTypes Visibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000586
587 /// BBForwardRefs - When we see forward references to basic blocks, keep
588 /// track of them here.
Reid Spencer93c40032007-03-19 18:40:50 +0000589 std::map<ValID, BasicBlock*> BBForwardRefs;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000590
591 inline PerFunctionInfo() {
592 CurrentFunction = 0;
593 isDeclare = false;
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000594 Linkage = GlobalValue::ExternalLinkage;
595 Visibility = GlobalValue::DefaultVisibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000596 }
597
598 inline void FunctionStart(Function *M) {
599 CurrentFunction = M;
Reid Spencer93c40032007-03-19 18:40:50 +0000600 NextValNum = 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000601 }
602
603 void FunctionDone() {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000604 // Any forward referenced blocks left?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000605 if (!BBForwardRefs.empty()) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000606 GenerateError("Undefined reference to label " +
Reid Spencer93c40032007-03-19 18:40:50 +0000607 BBForwardRefs.begin()->second->getName());
Reid Spencer5b7e7532006-09-28 19:28:24 +0000608 return;
609 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000610
611 // Resolve all forward references now.
612 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
613
614 Values.clear(); // Clear out function local definitions
Reid Spencer93c40032007-03-19 18:40:50 +0000615 BBForwardRefs.clear();
Reid Spencer68a24bd2005-08-27 18:50:39 +0000616 CurrentFunction = 0;
617 isDeclare = false;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000618 Linkage = GlobalValue::ExternalLinkage;
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000619 Visibility = GlobalValue::DefaultVisibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000620 }
621} CurFun; // Info for the current function...
622
623static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
624
625
626//===----------------------------------------------------------------------===//
627// Code to handle definitions of all the types
628//===----------------------------------------------------------------------===//
629
Reid Spencer93c40032007-03-19 18:40:50 +0000630static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
631 // Things that have names or are void typed don't get slot numbers
632 if (V->hasName() || (V->getType() == Type::VoidTy))
633 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000634
Reid Spencer93c40032007-03-19 18:40:50 +0000635 // In the case of function values, we have to allow for the forward reference
636 // of basic blocks, which are included in the numbering. Consequently, we keep
637 // track of the next insertion location with NextValNum. When a BB gets
638 // inserted, it could change the size of the CurFun.Values vector.
639 if (&ValueTab == &CurFun.Values) {
640 if (ValueTab.size() <= CurFun.NextValNum)
641 ValueTab.resize(CurFun.NextValNum+1);
642 ValueTab[CurFun.NextValNum++] = V;
643 return;
644 }
645 // For all other lists, its okay to just tack it on the back of the vector.
646 ValueTab.push_back(V);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000647}
648
649static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
650 switch (D.Type) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000651 case ValID::LocalID: // Is it a numbered definition?
Reid Spencer68a24bd2005-08-27 18:50:39 +0000652 // Module constants occupy the lowest numbered slots...
Reid Spencer41dff5e2007-01-26 08:05:27 +0000653 if (D.Num < CurModule.Types.size())
654 return CurModule.Types[D.Num];
Reid Spencer68a24bd2005-08-27 18:50:39 +0000655 break;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000656 case ValID::LocalName: // Is it a named definition?
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000657 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000658 D.destroy(); // Free old strdup'd memory...
659 return N;
660 }
661 break;
662 default:
Reid Spencerb5334b02007-02-05 10:18:06 +0000663 GenerateError("Internal parser error: Invalid symbol type reference");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000664 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000665 }
666
667 // If we reached here, we referenced either a symbol that we don't know about
668 // or an id number that hasn't been read yet. We may be referencing something
669 // forward, so just create an entry to be resolved later and get to it...
670 //
671 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
672
673
674 if (inFunctionScope()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000675 if (D.Type == ValID::LocalName) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000676 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000677 return 0;
678 } else {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000679 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
Reid Spencer5b7e7532006-09-28 19:28:24 +0000680 return 0;
681 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000682 }
683
Reid Spencer861d9d62006-11-28 07:29:44 +0000684 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000685 if (I != CurModule.LateResolveTypes.end())
Reid Spencer861d9d62006-11-28 07:29:44 +0000686 return I->second;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000687
Reid Spencer861d9d62006-11-28 07:29:44 +0000688 Type *Typ = OpaqueType::get();
689 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
690 return Typ;
Reid Spencera132e042006-12-03 05:46:11 +0000691 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000692
Reid Spencer93c40032007-03-19 18:40:50 +0000693// getExistingVal - Look up the value specified by the provided type and
Reid Spencer68a24bd2005-08-27 18:50:39 +0000694// the provided ValID. If the value exists and has already been defined, return
695// it. Otherwise return null.
696//
Reid Spencer93c40032007-03-19 18:40:50 +0000697static Value *getExistingVal(const Type *Ty, const ValID &D) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000698 if (isa<FunctionType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000699 GenerateError("Functions are not values and "
Reid Spencer68a24bd2005-08-27 18:50:39 +0000700 "must be referenced as pointers");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000701 return 0;
702 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000703
704 switch (D.Type) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000705 case ValID::LocalID: { // Is it a numbered definition?
Reid Spencer41dff5e2007-01-26 08:05:27 +0000706 // Check that the number is within bounds.
Reid Spencer93c40032007-03-19 18:40:50 +0000707 if (D.Num >= CurFun.Values.size())
708 return 0;
709 Value *Result = CurFun.Values[D.Num];
710 if (Ty != Result->getType()) {
711 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
712 Result->getType()->getDescription() + "' does not match "
713 "expected type, '" + Ty->getDescription() + "'");
714 return 0;
715 }
716 return Result;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000717 }
718 case ValID::GlobalID: { // Is it a numbered definition?
Reid Spencer93c40032007-03-19 18:40:50 +0000719 if (D.Num >= CurModule.Values.size())
Reid Spenceref9b9a72007-02-05 20:47:22 +0000720 return 0;
Reid Spencer93c40032007-03-19 18:40:50 +0000721 Value *Result = CurModule.Values[D.Num];
722 if (Ty != Result->getType()) {
723 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
724 Result->getType()->getDescription() + "' does not match "
725 "expected type, '" + Ty->getDescription() + "'");
Reid Spenceref9b9a72007-02-05 20:47:22 +0000726 return 0;
Reid Spencer93c40032007-03-19 18:40:50 +0000727 }
728 return Result;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000729 }
Reid Spencer41dff5e2007-01-26 08:05:27 +0000730
731 case ValID::LocalName: { // Is it a named definition?
Reid Spenceref9b9a72007-02-05 20:47:22 +0000732 if (!inFunctionScope())
733 return 0;
734 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000735 Value *N = SymTab.lookup(D.getName());
Reid Spenceref9b9a72007-02-05 20:47:22 +0000736 if (N == 0)
737 return 0;
738 if (N->getType() != Ty)
739 return 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000740
741 D.destroy(); // Free old strdup'd memory...
742 return N;
743 }
744 case ValID::GlobalName: { // Is it a named definition?
Reid Spenceref9b9a72007-02-05 20:47:22 +0000745 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000746 Value *N = SymTab.lookup(D.getName());
Reid Spenceref9b9a72007-02-05 20:47:22 +0000747 if (N == 0)
748 return 0;
749 if (N->getType() != Ty)
750 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000751
752 D.destroy(); // Free old strdup'd memory...
753 return N;
754 }
755
756 // Check to make sure that "Ty" is an integral type, and that our
757 // value will fit into the specified type...
758 case ValID::ConstSIntVal: // Is it a constant pool reference??
Chris Lattner38905612008-02-19 04:36:25 +0000759 if (!isa<IntegerType>(Ty) ||
760 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000761 GenerateError("Signed integral constant '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000762 itostr(D.ConstPool64) + "' is invalid for type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +0000763 Ty->getDescription() + "'");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000764 return 0;
765 }
Reid Spencer49d273e2007-03-19 20:40:51 +0000766 return ConstantInt::get(Ty, D.ConstPool64, true);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000767
768 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
Chris Lattner38905612008-02-19 04:36:25 +0000769 if (isa<IntegerType>(Ty) &&
770 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
Reid Spencerb83eb642006-10-20 07:07:24 +0000771 return ConstantInt::get(Ty, D.UConstPool64);
Chris Lattner38905612008-02-19 04:36:25 +0000772
773 if (!isa<IntegerType>(Ty) ||
774 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
775 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
776 "' is invalid or out of range for type '" +
777 Ty->getDescription() + "'");
778 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000779 }
Chris Lattner38905612008-02-19 04:36:25 +0000780 // This is really a signed reference. Transmogrify.
781 return ConstantInt::get(Ty, D.ConstPool64, true);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000782
783 case ValID::ConstFPVal: // Is it a floating point const pool reference?
Chris Lattner38905612008-02-19 04:36:25 +0000784 if (!Ty->isFloatingPoint() ||
785 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000786 GenerateError("FP constant invalid for type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000787 return 0;
788 }
Chris Lattnerd8eb63f2008-04-20 00:41:19 +0000789 // Lexer has no type info, so builds all float and double FP constants
Dale Johannesenc72cd7e2007-09-11 18:33:39 +0000790 // as double. Fix this here. Long double does not need this.
791 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
792 Ty==Type::FloatTy)
Dale Johannesencdd509a2007-09-07 21:07:57 +0000793 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
Chris Lattnerd8eb63f2008-04-20 00:41:19 +0000794 return ConstantFP::get(*D.ConstPoolFP);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000795
796 case ValID::ConstNullVal: // Is it a null value?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000797 if (!isa<PointerType>(Ty)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000798 GenerateError("Cannot create a a non pointer null");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000799 return 0;
800 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000801 return ConstantPointerNull::get(cast<PointerType>(Ty));
802
803 case ValID::ConstUndefVal: // Is it an undef value?
804 return UndefValue::get(Ty);
805
Chris Lattner7aa61892005-12-21 17:53:23 +0000806 case ValID::ConstZeroVal: // Is it a zero value?
807 return Constant::getNullValue(Ty);
808
Reid Spencer68a24bd2005-08-27 18:50:39 +0000809 case ValID::ConstantVal: // Fully resolved constant?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000810 if (D.ConstantValue->getType() != Ty) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000811 GenerateError("Constant expression type different from required type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000812 return 0;
813 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000814 return D.ConstantValue;
815
Chris Lattner0e9c3762006-01-25 22:27:16 +0000816 case ValID::InlineAsmVal: { // Inline asm expression
817 const PointerType *PTy = dyn_cast<PointerType>(Ty);
818 const FunctionType *FTy =
819 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000820 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000821 GenerateError("Invalid type for asm constraint string");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000822 return 0;
823 }
Chris Lattner0e9c3762006-01-25 22:27:16 +0000824 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
825 D.IAD->HasSideEffects);
826 D.destroy(); // Free InlineAsmDescriptor.
827 return IA;
828 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000829 default:
Reid Spencera9720f52007-02-05 17:04:00 +0000830 assert(0 && "Unhandled case!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000831 return 0;
832 } // End of switch
833
Reid Spencera9720f52007-02-05 17:04:00 +0000834 assert(0 && "Unhandled case!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000835 return 0;
836}
837
Reid Spencer93c40032007-03-19 18:40:50 +0000838// getVal - This function is identical to getExistingVal, except that if a
Reid Spencer68a24bd2005-08-27 18:50:39 +0000839// value is not already defined, it "improvises" by creating a placeholder var
840// that looks and acts just like the requested variable. When the value is
841// defined later, all uses of the placeholder variable are replaced with the
842// real thing.
843//
844static Value *getVal(const Type *Ty, const ValID &ID) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000845 if (Ty == Type::LabelTy) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000846 GenerateError("Cannot use a basic block here");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000847 return 0;
848 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000849
850 // See if the value has already been defined.
Reid Spencer93c40032007-03-19 18:40:50 +0000851 Value *V = getExistingVal(Ty, ID);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000852 if (V) return V;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000853 if (TriggerError) return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000854
Reid Spencer5b7e7532006-09-28 19:28:24 +0000855 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
Dan Gohmane4977cf2008-05-23 01:55:30 +0000856 GenerateError("Invalid use of a non-first-class type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000857 return 0;
858 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000859
860 // If we reached here, we referenced either a symbol that we don't know about
861 // or an id number that hasn't been read yet. We may be referencing something
862 // forward, so just create an entry to be resolved later and get to it...
863 //
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000864 switch (ID.Type) {
865 case ValID::GlobalName:
Reid Spencer9c9b63a2007-04-28 16:07:31 +0000866 case ValID::GlobalID: {
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000867 const PointerType *PTy = dyn_cast<PointerType>(Ty);
868 if (!PTy) {
869 GenerateError("Invalid type for reference to global" );
870 return 0;
871 }
872 const Type* ElTy = PTy->getElementType();
873 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
Gabor Greife64d2482008-04-06 23:07:54 +0000874 V = Function::Create(FTy, GlobalValue::ExternalLinkage);
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000875 else
Christopher Lamba8ed9bf2007-12-11 09:02:08 +0000876 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
877 (Module*)0, false, PTy->getAddressSpace());
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000878 break;
Reid Spencer9c9b63a2007-04-28 16:07:31 +0000879 }
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000880 default:
881 V = new Argument(Ty);
882 }
883
Reid Spencer68a24bd2005-08-27 18:50:39 +0000884 // Remember where this forward reference came from. FIXME, shouldn't we try
885 // to recycle these things??
886 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
Duncan Sandsdc024672007-11-27 13:23:08 +0000887 LLLgetLineNo())));
Reid Spencer68a24bd2005-08-27 18:50:39 +0000888
889 if (inFunctionScope())
890 InsertValue(V, CurFun.LateResolveValues);
891 else
892 InsertValue(V, CurModule.LateResolveValues);
893 return V;
894}
895
Reid Spencer93c40032007-03-19 18:40:50 +0000896/// defineBBVal - This is a definition of a new basic block with the specified
897/// identifier which must be the same as CurFun.NextValNum, if its numeric.
Chris Lattnercc81d152008-05-04 17:18:47 +0000898static BasicBlock *defineBBVal(const ValID &ID) {
Reid Spencera9720f52007-02-05 17:04:00 +0000899 assert(inFunctionScope() && "Can't get basic block at global scope!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000900
Reid Spencer68a24bd2005-08-27 18:50:39 +0000901 BasicBlock *BB = 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000902
Reid Spencer93c40032007-03-19 18:40:50 +0000903 // First, see if this was forward referenced
Reid Spencer68a24bd2005-08-27 18:50:39 +0000904
Reid Spencer93c40032007-03-19 18:40:50 +0000905 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
906 if (BBI != CurFun.BBForwardRefs.end()) {
907 BB = BBI->second;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000908 // The forward declaration could have been inserted anywhere in the
909 // function: insert it into the correct place now.
910 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
911 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
Reid Spencer93c40032007-03-19 18:40:50 +0000912
Reid Spencer66728ef2007-03-20 01:13:36 +0000913 // We're about to erase the entry, save the key so we can clean it up.
914 ValID Tmp = BBI->first;
915
Reid Spencer93c40032007-03-19 18:40:50 +0000916 // Erase the forward ref from the map as its no longer "forward"
917 CurFun.BBForwardRefs.erase(ID);
918
Reid Spencer66728ef2007-03-20 01:13:36 +0000919 // The key has been removed from the map but so we don't want to leave
920 // strdup'd memory around so destroy it too.
921 Tmp.destroy();
922
Reid Spencer93c40032007-03-19 18:40:50 +0000923 // If its a numbered definition, bump the number and set the BB value.
924 if (ID.Type == ValID::LocalID) {
925 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
926 InsertValue(BB);
927 }
Devang Patel67909432008-03-03 18:58:47 +0000928 } else {
929 // We haven't seen this BB before and its first mention is a definition.
930 // Just create it and return it.
931 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
Gabor Greife64d2482008-04-06 23:07:54 +0000932 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Devang Patel67909432008-03-03 18:58:47 +0000933 if (ID.Type == ValID::LocalID) {
934 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
935 InsertValue(BB);
936 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000937 }
Reid Spencer93c40032007-03-19 18:40:50 +0000938
Devang Patel67909432008-03-03 18:58:47 +0000939 ID.destroy();
Reid Spencer93c40032007-03-19 18:40:50 +0000940 return BB;
941}
942
943/// getBBVal - get an existing BB value or create a forward reference for it.
944///
945static BasicBlock *getBBVal(const ValID &ID) {
946 assert(inFunctionScope() && "Can't get basic block at global scope!");
947
948 BasicBlock *BB = 0;
949
950 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
951 if (BBI != CurFun.BBForwardRefs.end()) {
952 BB = BBI->second;
953 } if (ID.Type == ValID::LocalName) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000954 std::string Name = ID.getName();
Reid Spencer93c40032007-03-19 18:40:50 +0000955 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
Anton Korobeynikovc70d7732008-02-20 12:10:37 +0000956 if (N) {
Reid Spencer93c40032007-03-19 18:40:50 +0000957 if (N->getType()->getTypeID() == Type::LabelTyID)
958 BB = cast<BasicBlock>(N);
959 else
960 GenerateError("Reference to label '" + Name + "' is actually of type '"+
961 N->getType()->getDescription() + "'");
Anton Korobeynikovc70d7732008-02-20 12:10:37 +0000962 }
Reid Spencer93c40032007-03-19 18:40:50 +0000963 } else if (ID.Type == ValID::LocalID) {
964 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
965 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
966 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
967 else
968 GenerateError("Reference to label '%" + utostr(ID.Num) +
969 "' is actually of type '"+
970 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
971 }
972 } else {
973 GenerateError("Illegal label reference " + ID.getName());
974 return 0;
975 }
976
977 // If its already been defined, return it now.
978 if (BB) {
979 ID.destroy(); // Free strdup'd memory.
980 return BB;
981 }
982
983 // Otherwise, this block has not been seen before, create it.
984 std::string Name;
985 if (ID.Type == ValID::LocalName)
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000986 Name = ID.getName();
Gabor Greife64d2482008-04-06 23:07:54 +0000987 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Reid Spencer93c40032007-03-19 18:40:50 +0000988
989 // Insert it in the forward refs map.
990 CurFun.BBForwardRefs[ID] = BB;
991
Reid Spencer68a24bd2005-08-27 18:50:39 +0000992 return BB;
993}
994
995
996//===----------------------------------------------------------------------===//
997// Code to handle forward references in instructions
998//===----------------------------------------------------------------------===//
999//
1000// This code handles the late binding needed with statements that reference
1001// values not defined yet... for example, a forward branch, or the PHI node for
1002// a loop body.
1003//
1004// This keeps a table (CurFun.LateResolveValues) of all such forward references
1005// and back patchs after we are done.
1006//
1007
1008// ResolveDefinitions - If we could not resolve some defs at parsing
1009// time (forward branches, phi functions for loops, etc...) resolve the
1010// defs now...
1011//
1012static void
Reid Spencer93c40032007-03-19 18:40:50 +00001013ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001014 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
Reid Spencer93c40032007-03-19 18:40:50 +00001015 while (!LateResolvers.empty()) {
1016 Value *V = LateResolvers.back();
1017 LateResolvers.pop_back();
Reid Spencer68a24bd2005-08-27 18:50:39 +00001018
Reid Spencer93c40032007-03-19 18:40:50 +00001019 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1020 CurModule.PlaceHolderInfo.find(V);
1021 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001022
Reid Spencer93c40032007-03-19 18:40:50 +00001023 ValID &DID = PHI->second.first;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001024
Reid Spencer93c40032007-03-19 18:40:50 +00001025 Value *TheRealValue = getExistingVal(V->getType(), DID);
1026 if (TriggerError)
1027 return;
1028 if (TheRealValue) {
1029 V->replaceAllUsesWith(TheRealValue);
1030 delete V;
1031 CurModule.PlaceHolderInfo.erase(PHI);
1032 } else if (FutureLateResolvers) {
1033 // Functions have their unresolved items forwarded to the module late
1034 // resolver table
1035 InsertValue(V, *FutureLateResolvers);
1036 } else {
1037 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1038 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1039 "' of type '" + V->getType()->getDescription() + "'",
1040 PHI->second.second);
Reid Spencer5b7e7532006-09-28 19:28:24 +00001041 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001042 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00001043 GenerateError("Reference to an invalid definition: #" +
1044 itostr(DID.Num) + " of type '" +
1045 V->getType()->getDescription() + "'",
1046 PHI->second.second);
1047 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001048 }
1049 }
1050 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001051 LateResolvers.clear();
1052}
1053
1054// ResolveTypeTo - A brand new type was just declared. This means that (if
1055// name is not null) things referencing Name can be resolved. Otherwise, things
1056// refering to the number can be resolved. Do this now.
1057//
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001058static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001059 ValID D;
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001060 if (Name)
1061 D = ValID::createLocalName(*Name);
1062 else
1063 D = ValID::createLocalID(CurModule.Types.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00001064
Reid Spencer861d9d62006-11-28 07:29:44 +00001065 std::map<ValID, PATypeHolder>::iterator I =
Reid Spencer68a24bd2005-08-27 18:50:39 +00001066 CurModule.LateResolveTypes.find(D);
1067 if (I != CurModule.LateResolveTypes.end()) {
Reid Spencer861d9d62006-11-28 07:29:44 +00001068 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001069 CurModule.LateResolveTypes.erase(I);
1070 }
1071}
1072
1073// setValueName - Set the specified value to the name given. The name may be
1074// null potentially, in which case this is a noop. The string passed in is
1075// assumed to be a malloc'd string buffer, and is free'd by this function.
1076//
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001077static void setValueName(Value *V, std::string *NameStr) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00001078 if (!NameStr) return;
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001079 std::string Name(*NameStr); // Copy string
1080 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001081
Reid Spencer41dff5e2007-01-26 08:05:27 +00001082 if (V->getType() == Type::VoidTy) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001083 GenerateError("Can't assign name '" + Name+"' to value with void type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00001084 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001085 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00001086
Reid Spencera9720f52007-02-05 17:04:00 +00001087 assert(inFunctionScope() && "Must be in function scope!");
Reid Spenceref9b9a72007-02-05 20:47:22 +00001088 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1089 if (ST.lookup(Name)) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00001090 GenerateError("Redefinition of value '" + Name + "' of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00001091 V->getType()->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00001092 return;
1093 }
1094
1095 // Set the name.
1096 V->setName(Name);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001097}
1098
1099/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1100/// this is a declaration, otherwise it is a definition.
Chris Lattnerb475c422005-11-12 18:22:38 +00001101static GlobalVariable *
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001102ParseGlobalVariable(std::string *NameStr,
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001103 GlobalValue::LinkageTypes Linkage,
1104 GlobalValue::VisibilityTypes Visibility,
Chris Lattnerb475c422005-11-12 18:22:38 +00001105 bool isConstantGlobal, const Type *Ty,
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001106 Constant *Initializer, bool IsThreadLocal,
1107 unsigned AddressSpace = 0) {
Reid Spencer5b7e7532006-09-28 19:28:24 +00001108 if (isa<FunctionType>(Ty)) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001109 GenerateError("Cannot declare global vars of function type");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001110 return 0;
1111 }
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001112 if (Ty == Type::LabelTy) {
1113 GenerateError("Cannot declare global vars of label type");
1114 return 0;
1115 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001116
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001117 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001118
1119 std::string Name;
1120 if (NameStr) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001121 Name = *NameStr; // Copy string
1122 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001123 }
1124
1125 // See if this global value was forward referenced. If so, recycle the
1126 // object.
1127 ValID ID;
1128 if (!Name.empty()) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001129 ID = ValID::createGlobalName(Name);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001130 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00001131 ID = ValID::createGlobalID(CurModule.Values.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00001132 }
1133
1134 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1135 // Move the global to the end of the list, from whereever it was
1136 // previously inserted.
1137 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1138 CurModule.CurrentModule->getGlobalList().remove(GV);
1139 CurModule.CurrentModule->getGlobalList().push_back(GV);
1140 GV->setInitializer(Initializer);
1141 GV->setLinkage(Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001142 GV->setVisibility(Visibility);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001143 GV->setConstant(isConstantGlobal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00001144 GV->setThreadLocal(IsThreadLocal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001145 InsertValue(GV, CurModule.Values);
Chris Lattnerb475c422005-11-12 18:22:38 +00001146 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001147 }
1148
Reid Spenceref9b9a72007-02-05 20:47:22 +00001149 // If this global has a name
Reid Spencer68a24bd2005-08-27 18:50:39 +00001150 if (!Name.empty()) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00001151 // if the global we're parsing has an initializer (is a definition) and
1152 // has external linkage.
1153 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1154 // If there is already a global with external linkage with this name
1155 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1156 // If we allow this GVar to get created, it will be renamed in the
1157 // symbol table because it conflicts with an existing GVar. We can't
1158 // allow redefinition of GVars whose linking indicates that their name
1159 // must stay the same. Issue the error.
1160 GenerateError("Redefinition of global variable named '" + Name +
1161 "' of type '" + Ty->getDescription() + "'");
1162 return 0;
1163 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001164 }
1165
1166 // Otherwise there is no existing GV to use, create one now.
1167 GlobalVariable *GV =
1168 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001169 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001170 GV->setVisibility(Visibility);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001171 InsertValue(GV, CurModule.Values);
Chris Lattnerb475c422005-11-12 18:22:38 +00001172 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001173}
1174
1175// setTypeName - Set the specified type to the name given. The name may be
1176// null potentially, in which case this is a noop. The string passed in is
1177// assumed to be a malloc'd string buffer, and is freed by this function.
1178//
1179// This function returns true if the type has already been defined, but is
1180// allowed to be redefined in the specified context. If the name is a new name
1181// for the type plane, it is inserted and false is returned.
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001182static bool setTypeName(const Type *T, std::string *NameStr) {
Reid Spencera9720f52007-02-05 17:04:00 +00001183 assert(!inFunctionScope() && "Can't give types function-local names!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001184 if (NameStr == 0) return false;
1185
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001186 std::string Name(*NameStr); // Copy string
1187 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001188
1189 // We don't allow assigning names to void type
Reid Spencer5b7e7532006-09-28 19:28:24 +00001190 if (T == Type::VoidTy) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001191 GenerateError("Can't assign name '" + Name + "' to the void type");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001192 return false;
1193 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001194
1195 // Set the type name, checking for conflicts as we do so.
1196 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1197
1198 if (AlreadyExists) { // Inserting a name that is already defined???
1199 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
Reid Spencera9720f52007-02-05 17:04:00 +00001200 assert(Existing && "Conflict but no matching type?!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001201
1202 // There is only one case where this is allowed: when we are refining an
1203 // opaque type. In this case, Existing will be an opaque type.
1204 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1205 // We ARE replacing an opaque type!
1206 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1207 return true;
1208 }
1209
1210 // Otherwise, this is an attempt to redefine a type. That's okay if
1211 // the redefinition is identical to the original. This will be so if
1212 // Existing and T point to the same Type object. In this one case we
1213 // allow the equivalent redefinition.
1214 if (Existing == T) return true; // Yes, it's equal.
1215
1216 // Any other kind of (non-equivalent) redefinition is an error.
Reid Spencer63c34452007-01-05 21:51:07 +00001217 GenerateError("Redefinition of type named '" + Name + "' of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00001218 T->getDescription() + "'");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001219 }
1220
1221 return false;
1222}
1223
1224//===----------------------------------------------------------------------===//
1225// Code for handling upreferences in type names...
1226//
1227
1228// TypeContains - Returns true if Ty directly contains E in it.
1229//
1230static bool TypeContains(const Type *Ty, const Type *E) {
1231 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1232 E) != Ty->subtype_end();
1233}
1234
1235namespace {
1236 struct UpRefRecord {
1237 // NestingLevel - The number of nesting levels that need to be popped before
1238 // this type is resolved.
1239 unsigned NestingLevel;
1240
1241 // LastContainedTy - This is the type at the current binding level for the
1242 // type. Every time we reduce the nesting level, this gets updated.
1243 const Type *LastContainedTy;
1244
1245 // UpRefTy - This is the actual opaque type that the upreference is
1246 // represented with.
1247 OpaqueType *UpRefTy;
1248
1249 UpRefRecord(unsigned NL, OpaqueType *URTy)
1250 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1251 };
1252}
1253
1254// UpRefs - A list of the outstanding upreferences that need to be resolved.
1255static std::vector<UpRefRecord> UpRefs;
1256
1257/// HandleUpRefs - Every time we finish a new layer of types, this function is
1258/// called. It loops through the UpRefs vector, which is a list of the
1259/// currently active types. For each type, if the up reference is contained in
1260/// the newly completed type, we decrement the level count. When the level
1261/// count reaches zero, the upreferenced type is the type that is passed in:
1262/// thus we can complete the cycle.
1263///
1264static PATypeHolder HandleUpRefs(const Type *ty) {
Chris Lattner224f84f2006-08-18 17:34:45 +00001265 // If Ty isn't abstract, or if there are no up-references in it, then there is
1266 // nothing to resolve here.
1267 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1268
Reid Spencer68a24bd2005-08-27 18:50:39 +00001269 PATypeHolder Ty(ty);
1270 UR_OUT("Type '" << Ty->getDescription() <<
1271 "' newly formed. Resolving upreferences.\n" <<
1272 UpRefs.size() << " upreferences active!\n");
1273
1274 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1275 // to zero), we resolve them all together before we resolve them to Ty. At
1276 // the end of the loop, if there is anything to resolve to Ty, it will be in
1277 // this variable.
1278 OpaqueType *TypeToResolve = 0;
1279
1280 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1281 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1282 << UpRefs[i].second->getDescription() << ") = "
1283 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1284 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1285 // Decrement level of upreference
1286 unsigned Level = --UpRefs[i].NestingLevel;
1287 UpRefs[i].LastContainedTy = Ty;
1288 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1289 if (Level == 0) { // Upreference should be resolved!
1290 if (!TypeToResolve) {
1291 TypeToResolve = UpRefs[i].UpRefTy;
1292 } else {
1293 UR_OUT(" * Resolving upreference for "
1294 << UpRefs[i].second->getDescription() << "\n";
1295 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1296 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1297 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1298 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1299 }
1300 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1301 --i; // Do not skip the next element...
1302 }
1303 }
1304 }
1305
1306 if (TypeToResolve) {
1307 UR_OUT(" * Resolving upreference for "
1308 << UpRefs[i].second->getDescription() << "\n";
1309 std::string OldName = TypeToResolve->getDescription());
1310 TypeToResolve->refineAbstractTypeTo(Ty);
1311 }
1312
1313 return Ty;
1314}
1315
Reid Spencer68a24bd2005-08-27 18:50:39 +00001316//===----------------------------------------------------------------------===//
1317// RunVMAsmParser - Define an interface to this parser
1318//===----------------------------------------------------------------------===//
1319//
Reid Spencer14310612006-12-31 05:40:51 +00001320static Module* RunParser(Module * M);
1321
Duncan Sandsdc024672007-11-27 13:23:08 +00001322Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1323 InitLLLexer(MB);
1324 Module *M = RunParser(new Module(LLLgetFilename()));
1325 FreeLexer();
1326 return M;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001327}
1328
1329
Dan Gohmanf4423b12008-04-19 00:24:39 +00001330
1331/* Enabling traces. */
1332#ifndef YYDEBUG
1333# define YYDEBUG 0
1334#endif
1335
1336/* Enabling verbose error messages. */
1337#ifdef YYERROR_VERBOSE
1338# undef YYERROR_VERBOSE
1339# define YYERROR_VERBOSE 1
1340#else
1341# define YYERROR_VERBOSE 0
1342#endif
1343
1344/* Enabling the token table. */
1345#ifndef YYTOKEN_TABLE
1346# define YYTOKEN_TABLE 0
1347#endif
1348
1349#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1350typedef union YYSTYPE
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001351#line 953 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00001352{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001353 llvm::Module *ModuleVal;
1354 llvm::Function *FunctionVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001355 llvm::BasicBlock *BasicBlockVal;
1356 llvm::TerminatorInst *TermInstVal;
1357 llvm::Instruction *InstVal;
Reid Spencera132e042006-12-03 05:46:11 +00001358 llvm::Constant *ConstVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001359
Reid Spencera132e042006-12-03 05:46:11 +00001360 const llvm::Type *PrimType;
Reid Spencer14310612006-12-31 05:40:51 +00001361 std::list<llvm::PATypeHolder> *TypeList;
Reid Spencera132e042006-12-03 05:46:11 +00001362 llvm::PATypeHolder *TypeVal;
1363 llvm::Value *ValueVal;
Reid Spencera132e042006-12-03 05:46:11 +00001364 std::vector<llvm::Value*> *ValueList;
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001365 std::vector<unsigned> *ConstantList;
Reid Spencer14310612006-12-31 05:40:51 +00001366 llvm::ArgListType *ArgList;
1367 llvm::TypeWithAttrs TypeWithAttrs;
1368 llvm::TypeWithAttrsList *TypeWithAttrsList;
Dale Johanneseneb57ea72007-11-05 21:20:28 +00001369 llvm::ParamList *ParamList;
Reid Spencer14310612006-12-31 05:40:51 +00001370
Reid Spencer68a24bd2005-08-27 18:50:39 +00001371 // Represent the RHS of PHI node
Reid Spencera132e042006-12-03 05:46:11 +00001372 std::list<std::pair<llvm::Value*,
1373 llvm::BasicBlock*> > *PHIList;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001374 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
Reid Spencera132e042006-12-03 05:46:11 +00001375 std::vector<llvm::Constant*> *ConstVector;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001376
1377 llvm::GlobalValue::LinkageTypes Linkage;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001378 llvm::GlobalValue::VisibilityTypes Visibility;
Dale Johannesen222ebf72008-02-19 21:40:51 +00001379 llvm::ParameterAttributes ParamAttrs;
Reid Spencer38c91a92007-02-28 02:24:54 +00001380 llvm::APInt *APIntVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001381 int64_t SInt64Val;
1382 uint64_t UInt64Val;
1383 int SIntVal;
1384 unsigned UIntVal;
Dale Johannesencdd509a2007-09-07 21:07:57 +00001385 llvm::APFloat *FPVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001386 bool BoolVal;
1387
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001388 std::string *StrVal; // This memory must be deleted
1389 llvm::ValID ValIDVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001390
Reid Spencera132e042006-12-03 05:46:11 +00001391 llvm::Instruction::BinaryOps BinaryOpVal;
1392 llvm::Instruction::TermOps TermOpVal;
1393 llvm::Instruction::MemoryOps MemOpVal;
1394 llvm::Instruction::CastOps CastOpVal;
1395 llvm::Instruction::OtherOps OtherOpVal;
Reid Spencera132e042006-12-03 05:46:11 +00001396 llvm::ICmpInst::Predicate IPredicate;
1397 llvm::FCmpInst::Predicate FPredicate;
Dan Gohmanf4423b12008-04-19 00:24:39 +00001398}
Dan Gohmanf910eaa2008-06-09 14:45:02 +00001399/* Line 187 of yacc.c. */
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001400#line 1401 "llvmAsmParser.tab.c"
Dan Gohmanf4423b12008-04-19 00:24:39 +00001401 YYSTYPE;
1402# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1403# define YYSTYPE_IS_DECLARED 1
1404# define YYSTYPE_IS_TRIVIAL 1
Reid Spencer68a24bd2005-08-27 18:50:39 +00001405#endif
1406
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001407
Reid Spencer68a24bd2005-08-27 18:50:39 +00001408
Dan Gohmanf4423b12008-04-19 00:24:39 +00001409/* Copy the second part of user declarations. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001410
1411
Dan Gohmanf4423b12008-04-19 00:24:39 +00001412/* Line 216 of yacc.c. */
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001413#line 1414 "llvmAsmParser.tab.c"
Reid Spencerb8f85052007-07-31 03:50:36 +00001414
Dan Gohmanf4423b12008-04-19 00:24:39 +00001415#ifdef short
1416# undef short
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001417#endif
1418
Dan Gohmanf4423b12008-04-19 00:24:39 +00001419#ifdef YYTYPE_UINT8
1420typedef YYTYPE_UINT8 yytype_uint8;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001421#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00001422typedef unsigned char yytype_uint8;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001423#endif
1424
Dan Gohmanf4423b12008-04-19 00:24:39 +00001425#ifdef YYTYPE_INT8
1426typedef YYTYPE_INT8 yytype_int8;
1427#elif (defined __STDC__ || defined __C99__FUNC__ \
1428 || defined __cplusplus || defined _MSC_VER)
1429typedef signed char yytype_int8;
1430#else
1431typedef short int yytype_int8;
1432#endif
1433
1434#ifdef YYTYPE_UINT16
1435typedef YYTYPE_UINT16 yytype_uint16;
1436#else
1437typedef unsigned short int yytype_uint16;
1438#endif
1439
1440#ifdef YYTYPE_INT16
1441typedef YYTYPE_INT16 yytype_int16;
1442#else
1443typedef short int yytype_int16;
1444#endif
1445
1446#ifndef YYSIZE_T
1447# ifdef __SIZE_TYPE__
1448# define YYSIZE_T __SIZE_TYPE__
1449# elif defined size_t
1450# define YYSIZE_T size_t
1451# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1452 || defined __cplusplus || defined _MSC_VER)
1453# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1454# define YYSIZE_T size_t
1455# else
1456# define YYSIZE_T unsigned int
1457# endif
1458#endif
1459
1460#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1461
1462#ifndef YY_
Dan Gohmanf910eaa2008-06-09 14:45:02 +00001463# if YYENABLE_NLS
Dan Gohmanf4423b12008-04-19 00:24:39 +00001464# if ENABLE_NLS
1465# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1466# define YY_(msgid) dgettext ("bison-runtime", msgid)
1467# endif
1468# endif
1469# ifndef YY_
1470# define YY_(msgid) msgid
1471# endif
1472#endif
1473
1474/* Suppress unused-variable warnings by "using" E. */
1475#if ! defined lint || defined __GNUC__
1476# define YYUSE(e) ((void) (e))
1477#else
1478# define YYUSE(e) /* empty */
1479#endif
1480
1481/* Identity function, used to suppress warnings about constant conditions. */
1482#ifndef lint
1483# define YYID(n) (n)
1484#else
1485#if (defined __STDC__ || defined __C99__FUNC__ \
1486 || defined __cplusplus || defined _MSC_VER)
1487static int
1488YYID (int i)
1489#else
1490static int
1491YYID (i)
1492 int i;
1493#endif
1494{
1495 return i;
1496}
1497#endif
1498
1499#if ! defined yyoverflow || YYERROR_VERBOSE
1500
1501/* The parser invokes alloca or malloc; define the necessary symbols. */
1502
1503# ifdef YYSTACK_USE_ALLOCA
1504# if YYSTACK_USE_ALLOCA
1505# ifdef __GNUC__
1506# define YYSTACK_ALLOC __builtin_alloca
1507# elif defined __BUILTIN_VA_ARG_INCR
1508# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1509# elif defined _AIX
1510# define YYSTACK_ALLOC __alloca
1511# elif defined _MSC_VER
1512# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1513# define alloca _alloca
1514# else
1515# define YYSTACK_ALLOC alloca
1516# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1517 || defined __cplusplus || defined _MSC_VER)
1518# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1519# ifndef _STDLIB_H
1520# define _STDLIB_H 1
1521# endif
1522# endif
1523# endif
1524# endif
1525# endif
1526
1527# ifdef YYSTACK_ALLOC
1528 /* Pacify GCC's `empty if-body' warning. */
1529# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1530# ifndef YYSTACK_ALLOC_MAXIMUM
1531 /* The OS might guarantee only one guard page at the bottom of the stack,
1532 and a page size can be as small as 4096 bytes. So we cannot safely
1533 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1534 to allow for a few compiler-allocated temporary stack slots. */
1535# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1536# endif
1537# else
1538# define YYSTACK_ALLOC YYMALLOC
1539# define YYSTACK_FREE YYFREE
1540# ifndef YYSTACK_ALLOC_MAXIMUM
1541# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1542# endif
1543# if (defined __cplusplus && ! defined _STDLIB_H \
1544 && ! ((defined YYMALLOC || defined malloc) \
1545 && (defined YYFREE || defined free)))
1546# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1547# ifndef _STDLIB_H
1548# define _STDLIB_H 1
1549# endif
1550# endif
1551# ifndef YYMALLOC
1552# define YYMALLOC malloc
1553# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1554 || defined __cplusplus || defined _MSC_VER)
1555void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1556# endif
1557# endif
1558# ifndef YYFREE
1559# define YYFREE free
1560# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1561 || defined __cplusplus || defined _MSC_VER)
1562void free (void *); /* INFRINGES ON USER NAME SPACE */
1563# endif
1564# endif
1565# endif
1566#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1567
1568
1569#if (! defined yyoverflow \
1570 && (! defined __cplusplus \
1571 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1572
1573/* A type that is properly aligned for any stack member. */
1574union yyalloc
1575{
1576 yytype_int16 yyss;
1577 YYSTYPE yyvs;
1578 };
1579
1580/* The size of the maximum gap between one aligned stack and the next. */
1581# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1582
1583/* The size of an array large to enough to hold all stacks, each with
1584 N elements. */
1585# define YYSTACK_BYTES(N) \
1586 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1587 + YYSTACK_GAP_MAXIMUM)
1588
1589/* Copy COUNT objects from FROM to TO. The source and destination do
1590 not overlap. */
1591# ifndef YYCOPY
1592# if defined __GNUC__ && 1 < __GNUC__
1593# define YYCOPY(To, From, Count) \
1594 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1595# else
1596# define YYCOPY(To, From, Count) \
1597 do \
1598 { \
1599 YYSIZE_T yyi; \
1600 for (yyi = 0; yyi < (Count); yyi++) \
1601 (To)[yyi] = (From)[yyi]; \
1602 } \
1603 while (YYID (0))
1604# endif
1605# endif
1606
1607/* Relocate STACK from its old location to the new one. The
1608 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1609 elements in the stack, and YYPTR gives the new location of the
1610 stack. Advance YYPTR to a properly aligned location for the next
1611 stack. */
1612# define YYSTACK_RELOCATE(Stack) \
1613 do \
1614 { \
1615 YYSIZE_T yynewbytes; \
1616 YYCOPY (&yyptr->Stack, Stack, yysize); \
1617 Stack = &yyptr->Stack; \
1618 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1619 yyptr += yynewbytes / sizeof (*yyptr); \
1620 } \
1621 while (YYID (0))
1622
1623#endif
1624
1625/* YYFINAL -- State number of the termination state. */
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001626#define YYFINAL 44
Dan Gohmanf4423b12008-04-19 00:24:39 +00001627/* YYLAST -- Last index in YYTABLE. */
Dan Gohmanf910eaa2008-06-09 14:45:02 +00001628#define YYLAST 2339
Dan Gohmanf4423b12008-04-19 00:24:39 +00001629
1630/* YYNTOKENS -- Number of terminals. */
Dan Gohmane4977cf2008-05-23 01:55:30 +00001631#define YYNTOKENS 170
Dan Gohmanf4423b12008-04-19 00:24:39 +00001632/* YYNNTS -- Number of nonterminals. */
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001633#define YYNNTS 86
Dan Gohmanf4423b12008-04-19 00:24:39 +00001634/* YYNRULES -- Number of rules. */
Dan Gohmanf910eaa2008-06-09 14:45:02 +00001635#define YYNRULES 340
Dan Gohmanf4423b12008-04-19 00:24:39 +00001636/* YYNRULES -- Number of states. */
Dan Gohmanf910eaa2008-06-09 14:45:02 +00001637#define YYNSTATES 699
Dan Gohmanf4423b12008-04-19 00:24:39 +00001638
1639/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1640#define YYUNDEFTOK 2
Dan Gohmane4977cf2008-05-23 01:55:30 +00001641#define YYMAXUTOK 410
Dan Gohmanf4423b12008-04-19 00:24:39 +00001642
1643#define YYTRANSLATE(YYX) \
1644 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1645
1646/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1647static const yytype_uint8 yytranslate[] =
1648{
1649 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1650 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1651 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1652 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001653 156, 157, 160, 2, 159, 2, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001654 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001655 165, 158, 166, 2, 2, 2, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001656 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1657 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001658 2, 162, 161, 164, 2, 2, 2, 2, 2, 169,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001659 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1660 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001661 163, 2, 2, 167, 2, 168, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001662 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1663 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1664 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1665 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1666 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1667 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1668 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1669 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1670 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1671 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1672 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1673 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1674 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1675 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1676 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1677 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1678 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1679 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1680 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1681 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1682 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1683 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1684 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1685 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1686 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1687 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1688 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001689 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
1690 155
Dan Gohmanf4423b12008-04-19 00:24:39 +00001691};
1692
1693#if YYDEBUG
1694/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1695 YYRHS. */
1696static const yytype_uint16 yyprhs[] =
1697{
1698 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1699 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1700 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1701 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1702 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1703 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1704 119, 121, 123, 125, 127, 129, 130, 135, 136, 139,
1705 140, 142, 144, 146, 147, 150, 152, 154, 156, 158,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001706 160, 162, 164, 166, 168, 169, 171, 173, 175, 176,
1707 178, 180, 181, 183, 185, 187, 189, 190, 192, 194,
1708 195, 197, 199, 201, 203, 205, 208, 210, 212, 214,
1709 216, 218, 220, 222, 224, 226, 229, 230, 233, 235,
1710 237, 239, 241, 243, 245, 246, 249, 250, 253, 254,
1711 257, 258, 262, 265, 266, 268, 269, 273, 275, 278,
1712 280, 282, 284, 286, 288, 290, 292, 294, 296, 300,
1713 302, 305, 311, 317, 323, 329, 333, 336, 342, 347,
1714 350, 352, 354, 356, 360, 362, 366, 368, 369, 371,
1715 375, 380, 384, 388, 393, 398, 402, 409, 415, 418,
1716 421, 424, 427, 430, 433, 436, 439, 442, 445, 448,
1717 451, 458, 464, 473, 480, 487, 495, 503, 511, 519,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001718 526, 535, 544, 550, 558, 562, 564, 566, 568, 570,
1719 571, 574, 581, 583, 584, 586, 589, 590, 594, 595,
1720 599, 603, 607, 611, 612, 621, 622, 632, 633, 643,
1721 649, 652, 656, 658, 662, 666, 670, 674, 676, 677,
1722 683, 687, 689, 693, 695, 696, 707, 709, 711, 716,
1723 718, 720, 723, 727, 728, 730, 732, 734, 736, 738,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00001724 740, 742, 744, 746, 750, 754, 757, 760, 764, 767,
1725 773, 778, 780, 786, 788, 790, 792, 794, 796, 798,
1726 801, 803, 807, 810, 813, 817, 820, 821, 823, 826,
1727 829, 833, 843, 853, 862, 877, 879, 881, 888, 894,
1728 897, 904, 912, 917, 922, 929, 936, 937, 938, 942,
1729 945, 949, 952, 954, 960, 966, 973, 980, 987, 994,
1730 999, 1006, 1011, 1016, 1023, 1030, 1033, 1042, 1044, 1046,
1731 1047, 1051, 1058, 1062, 1069, 1072, 1078, 1086, 1092, 1097,
1732 1102
Dan Gohmanf4423b12008-04-19 00:24:39 +00001733};
1734
1735/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1736static const yytype_int16 yyrhs[] =
1737{
Dan Gohmane4977cf2008-05-23 01:55:30 +00001738 216, 0, -1, 75, -1, 76, -1, 77, -1, 78,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001739 -1, 79, -1, 80, -1, 81, -1, 82, -1, 83,
1740 -1, 87, -1, 88, -1, 89, -1, 84, -1, 85,
1741 -1, 86, -1, 120, -1, 121, -1, 122, -1, 123,
1742 -1, 124, -1, 125, -1, 126, -1, 127, -1, 128,
1743 -1, 129, -1, 130, -1, 131, -1, 94, -1, 95,
1744 -1, 96, -1, 97, -1, 98, -1, 99, -1, 100,
1745 -1, 101, -1, 102, -1, 103, -1, 104, -1, 105,
1746 -1, 106, -1, 107, -1, 108, -1, 109, -1, 110,
1747 -1, 111, -1, 112, -1, 113, -1, 100, -1, 101,
1748 -1, 102, -1, 103, -1, 26, -1, 27, -1, 11,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001749 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001750 -1, 19, -1, 22, -1, 24, -1, 178, -1, -1,
1751 55, 156, 4, 157, -1, -1, 178, 158, -1, -1,
1752 20, -1, 23, -1, 184, -1, -1, 182, 158, -1,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001753 42, -1, 44, -1, 43, -1, 45, -1, 47, -1,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001754 49, -1, 46, -1, 48, -1, 51, -1, -1, 153,
1755 -1, 154, -1, 155, -1, -1, 46, -1, 48, -1,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001756 -1, 42, -1, 43, -1, 44, -1, 47, -1, -1,
1757 44, -1, 42, -1, -1, 63, -1, 64, -1, 65,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001758 -1, 66, -1, 67, -1, 62, 4, -1, 142, -1,
1759 121, -1, 141, -1, 122, -1, 144, -1, 145, -1,
1760 147, -1, 148, -1, 149, -1, 54, 4, -1, -1,
1761 193, 192, -1, 143, -1, 146, -1, 142, -1, 141,
1762 -1, 150, -1, 151, -1, -1, 195, 194, -1, -1,
1763 152, 22, -1, -1, 54, 4, -1, -1, 159, 54,
1764 4, -1, 34, 22, -1, -1, 199, -1, -1, 159,
1765 202, 201, -1, 199, -1, 54, 4, -1, 11, -1,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001766 12, -1, 13, -1, 16, -1, 15, -1, 14, -1,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001767 17, -1, 50, -1, 203, -1, 204, 180, 160, -1,
1768 238, -1, 161, 4, -1, 204, 156, 208, 157, 195,
1769 -1, 10, 156, 208, 157, 195, -1, 162, 4, 163,
1770 204, 164, -1, 165, 4, 163, 204, 166, -1, 167,
1771 209, 168, -1, 167, 168, -1, 165, 167, 209, 168,
1772 166, -1, 165, 167, 168, 166, -1, 204, 193, -1,
1773 204, -1, 10, -1, 205, -1, 207, 159, 205, -1,
1774 207, -1, 207, 159, 39, -1, 39, -1, -1, 204,
1775 -1, 209, 159, 204, -1, 204, 162, 212, 164, -1,
1776 204, 162, 164, -1, 204, 169, 22, -1, 204, 165,
1777 212, 166, -1, 204, 167, 212, 168, -1, 204, 167,
1778 168, -1, 204, 165, 167, 212, 168, 166, -1, 204,
1779 165, 167, 168, 166, -1, 204, 40, -1, 204, 41,
1780 -1, 204, 238, -1, 204, 211, -1, 204, 25, -1,
1781 176, 3, -1, 176, 5, -1, 176, 4, -1, 176,
1782 6, -1, 11, 26, -1, 11, 27, -1, 177, 9,
1783 -1, 173, 156, 210, 38, 204, 157, -1, 119, 156,
1784 210, 250, 157, -1, 133, 156, 210, 159, 210, 159,
1785 210, 157, -1, 171, 156, 210, 159, 210, 157, -1,
1786 172, 156, 210, 159, 210, 157, -1, 90, 174, 156,
1787 210, 159, 210, 157, -1, 91, 175, 156, 210, 159,
1788 210, 157, -1, 92, 174, 156, 210, 159, 210, 157,
1789 -1, 93, 175, 156, 210, 159, 210, 157, -1, 135,
1790 156, 210, 159, 210, 157, -1, 136, 156, 210, 159,
1791 210, 159, 210, 157, -1, 137, 156, 210, 159, 210,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001792 159, 210, 157, -1, 139, 156, 210, 251, 157, -1,
1793 140, 156, 210, 159, 210, 251, 157, -1, 212, 159,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001794 210, -1, 210, -1, 32, -1, 33, -1, 37, -1,
1795 -1, 206, 238, -1, 125, 156, 215, 38, 204, 157,
1796 -1, 217, -1, -1, 218, -1, 217, 218, -1, -1,
1797 31, 219, 234, -1, -1, 30, 220, 235, -1, 60,
1798 59, 224, -1, 181, 18, 204, -1, 181, 18, 10,
1799 -1, -1, 183, 187, 214, 213, 210, 180, 221, 201,
1800 -1, -1, 183, 185, 187, 214, 213, 210, 180, 222,
1801 201, -1, -1, 183, 186, 187, 214, 213, 204, 180,
1802 223, 201, -1, 183, 187, 35, 190, 215, -1, 52,
1803 225, -1, 56, 158, 226, -1, 22, -1, 53, 158,
1804 22, -1, 68, 158, 22, -1, 162, 227, 164, -1,
1805 227, 159, 22, -1, 22, -1, -1, 228, 159, 204,
1806 193, 179, -1, 204, 193, 179, -1, 228, -1, 228,
1807 159, 39, -1, 39, -1, -1, 191, 206, 182, 156,
1808 229, 157, 195, 200, 197, 196, -1, 28, -1, 167,
1809 -1, 189, 187, 230, 231, -1, 29, -1, 168, -1,
1810 242, 233, -1, 188, 187, 230, -1, -1, 61, -1,
1811 3, -1, 4, -1, 9, -1, 26, -1, 27, -1,
1812 40, -1, 41, -1, 25, -1, 165, 212, 166, -1,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00001813 162, 212, 164, -1, 162, 164, -1, 169, 22, -1,
1814 167, 212, 168, -1, 167, 168, -1, 165, 167, 212,
1815 168, 166, -1, 165, 167, 168, 166, -1, 211, -1,
1816 59, 236, 22, 159, 22, -1, 7, -1, 8, -1,
1817 178, -1, 182, -1, 238, -1, 237, -1, 204, 239,
1818 -1, 240, -1, 241, 159, 240, -1, 242, 243, -1,
1819 232, 243, -1, 244, 181, 245, -1, 244, 247, -1,
1820 -1, 21, -1, 69, 241, -1, 69, 10, -1, 70,
1821 17, 239, -1, 70, 11, 239, 159, 17, 239, 159,
1822 17, 239, -1, 71, 176, 239, 159, 17, 239, 162,
1823 246, 164, -1, 71, 176, 239, 159, 17, 239, 162,
1824 164, -1, 72, 191, 206, 239, 156, 249, 157, 195,
1825 38, 17, 239, 73, 17, 239, -1, 73, -1, 74,
1826 -1, 246, 176, 237, 159, 17, 239, -1, 176, 237,
1827 159, 17, 239, -1, 181, 253, -1, 204, 162, 239,
1828 159, 239, 164, -1, 248, 159, 162, 239, 159, 239,
1829 164, -1, 204, 193, 239, 193, -1, 17, 193, 239,
1830 193, -1, 249, 159, 204, 193, 239, 193, -1, 249,
1831 159, 17, 193, 239, 193, -1, -1, -1, 250, 159,
1832 240, -1, 159, 4, -1, 251, 159, 4, -1, 58,
1833 57, -1, 57, -1, 171, 204, 239, 159, 239, -1,
1834 172, 204, 239, 159, 239, -1, 90, 174, 204, 239,
1835 159, 239, -1, 91, 175, 204, 239, 159, 239, -1,
1836 92, 174, 204, 239, 159, 239, -1, 93, 175, 204,
1837 239, 159, 239, -1, 173, 240, 38, 204, -1, 133,
1838 240, 159, 240, 159, 240, -1, 134, 240, 159, 204,
1839 -1, 135, 240, 159, 240, -1, 136, 240, 159, 240,
1840 159, 240, -1, 137, 240, 159, 240, 159, 240, -1,
1841 132, 248, -1, 252, 191, 206, 239, 156, 249, 157,
1842 195, -1, 255, -1, 36, -1, -1, 114, 204, 198,
1843 -1, 114, 204, 159, 11, 239, 198, -1, 115, 204,
1844 198, -1, 115, 204, 159, 11, 239, 198, -1, 116,
1845 240, -1, 254, 117, 204, 239, 198, -1, 254, 118,
1846 240, 159, 204, 239, 198, -1, 138, 204, 239, 159,
1847 4, -1, 119, 204, 239, 250, -1, 139, 204, 239,
1848 251, -1, 140, 204, 239, 159, 204, 239, 251, -1
Dan Gohmanf4423b12008-04-19 00:24:39 +00001849};
1850
1851/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1852static const yytype_uint16 yyrline[] =
1853{
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001854 0, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
1855 1118, 1119, 1119, 1119, 1119, 1119, 1119, 1120, 1120, 1120,
1856 1120, 1120, 1120, 1121, 1121, 1121, 1121, 1121, 1121, 1124,
1857 1124, 1125, 1125, 1126, 1126, 1127, 1127, 1128, 1128, 1132,
1858 1132, 1133, 1133, 1134, 1134, 1135, 1135, 1136, 1136, 1137,
1859 1137, 1138, 1138, 1139, 1140, 1145, 1146, 1146, 1146, 1146,
1860 1146, 1148, 1148, 1148, 1149, 1149, 1151, 1152, 1156, 1160,
1861 1165, 1165, 1167, 1168, 1173, 1179, 1180, 1181, 1182, 1183,
1862 1184, 1188, 1189, 1190, 1194, 1195, 1196, 1197, 1201, 1202,
1863 1203, 1207, 1208, 1209, 1210, 1211, 1215, 1216, 1217, 1220,
1864 1221, 1222, 1223, 1224, 1225, 1226, 1233, 1234, 1235, 1236,
1865 1237, 1238, 1239, 1240, 1241, 1242, 1246, 1247, 1252, 1253,
1866 1254, 1255, 1256, 1257, 1260, 1261, 1266, 1267, 1274, 1275,
1867 1281, 1282, 1291, 1299, 1300, 1305, 1306, 1307, 1312, 1325,
1868 1325, 1325, 1325, 1325, 1325, 1325, 1328, 1332, 1336, 1343,
1869 1348, 1356, 1385, 1410, 1415, 1425, 1435, 1439, 1449, 1456,
1870 1465, 1472, 1477, 1482, 1489, 1490, 1497, 1504, 1512, 1518,
1871 1530, 1558, 1574, 1601, 1629, 1655, 1675, 1701, 1721, 1733,
1872 1740, 1806, 1816, 1826, 1832, 1842, 1848, 1858, 1864, 1870,
1873 1883, 1895, 1916, 1924, 1930, 1941, 1946, 1951, 1956, 1961,
1874 1967, 1973, 1979, 1987, 1998, 2002, 2010, 2010, 2013, 2013,
1875 2016, 2028, 2049, 2054, 2062, 2063, 2067, 2067, 2071, 2071,
1876 2074, 2077, 2101, 2113, 2112, 2124, 2123, 2133, 2132, 2143,
1877 2183, 2186, 2192, 2202, 2206, 2211, 2213, 2218, 2223, 2232,
1878 2242, 2253, 2257, 2266, 2275, 2280, 2409, 2409, 2411, 2420,
1879 2420, 2422, 2427, 2439, 2443, 2448, 2452, 2456, 2460, 2464,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00001880 2468, 2472, 2476, 2480, 2502, 2524, 2528, 2541, 2553, 2558,
1881 2570, 2576, 2580, 2590, 2594, 2598, 2603, 2610, 2610, 2616,
1882 2625, 2630, 2635, 2639, 2648, 2657, 2666, 2670, 2678, 2685,
1883 2689, 2694, 2705, 2724, 2733, 2819, 2823, 2830, 2841, 2854,
1884 2864, 2875, 2885, 2896, 2904, 2914, 2921, 2924, 2925, 2933,
1885 2939, 2948, 2952, 2957, 2973, 2990, 3004, 3018, 3032, 3046,
1886 3058, 3066, 3073, 3079, 3085, 3091, 3106, 3196, 3201, 3205,
1887 3212, 3219, 3229, 3236, 3246, 3254, 3268, 3285, 3293, 3308,
1888 3323
Dan Gohmanf4423b12008-04-19 00:24:39 +00001889};
1890#endif
1891
1892#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1893/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1894 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1895static const char *const yytname[] =
1896{
1897 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1898 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1899 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1900 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1901 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1902 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1903 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1904 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001905 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "COMMON", "OPAQUE",
Dan Gohmanf4423b12008-04-19 00:24:39 +00001906 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1907 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1908 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
Chris Lattnercc81d152008-05-04 17:18:47 +00001909 "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE",
1910 "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM",
Nate Begemanac80ade2008-05-12 19:01:56 +00001911 "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "VICMP",
1912 "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1913 "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1914 "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1915 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1916 "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1917 "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
Dan Gohmane4977cf2008-05-23 01:55:30 +00001918 "GETRESULT", "EXTRACTVALUE", "INSERTVALUE", "SIGNEXT", "ZEROEXT",
1919 "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL", "NEST",
1920 "READNONE", "READONLY", "GC", "DEFAULT", "HIDDEN", "PROTECTED", "'('",
1921 "')'", "'='", "','", "'*'", "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'",
1922 "'{'", "'}'", "'c'", "$accept", "ArithmeticOps", "LogicalOps", "CastOps",
1923 "IPredicates", "FPredicates", "IntType", "FPType", "LocalName",
1924 "OptLocalName", "OptAddrSpace", "OptLocalAssign", "GlobalName",
1925 "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
1926 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1927 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr",
1928 "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign",
1929 "OptCAlign", "SectionString", "OptSection", "GlobalVarAttributes",
Dan Gohmanf4423b12008-04-19 00:24:39 +00001930 "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
1931 "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
1932 "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
1933 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1934 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1935 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1936 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1937 "SymbolicValueRef", "ValueRef", "ResolvedVal", "ReturnedVal",
1938 "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst",
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001939 "JumpTable", "Inst", "PHIList", "ParamList", "IndexList",
1940 "ConstantIndexList", "OptTailCall", "InstVal", "OptVolatile",
1941 "MemoryInst", 0
Dan Gohmanf4423b12008-04-19 00:24:39 +00001942};
1943#endif
1944
1945# ifdef YYPRINT
1946/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1947 token YYLEX-NUM. */
1948static const yytype_uint16 yytoknum[] =
1949{
1950 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1951 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1952 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1953 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1954 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1955 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1956 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1957 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1958 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1959 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1960 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1961 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1962 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1963 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1964 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001965 405, 406, 407, 408, 409, 410, 40, 41, 61, 44,
1966 42, 92, 91, 120, 93, 60, 62, 123, 125, 99
Dan Gohmanf4423b12008-04-19 00:24:39 +00001967};
1968# endif
1969
1970/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1971static const yytype_uint8 yyr1[] =
1972{
Dan Gohmane4977cf2008-05-23 01:55:30 +00001973 0, 170, 171, 171, 171, 171, 171, 171, 171, 171,
1974 171, 172, 172, 172, 172, 172, 172, 173, 173, 173,
1975 173, 173, 173, 173, 173, 173, 173, 173, 173, 174,
1976 174, 174, 174, 174, 174, 174, 174, 174, 174, 175,
1977 175, 175, 175, 175, 175, 175, 175, 175, 175, 175,
1978 175, 175, 175, 175, 175, 176, 177, 177, 177, 177,
1979 177, 178, 178, 178, 179, 179, 180, 180, 181, 181,
1980 182, 182, 183, 183, 184, 185, 185, 185, 185, 185,
1981 185, 186, 186, 186, 187, 187, 187, 187, 188, 188,
1982 188, 189, 189, 189, 189, 189, 190, 190, 190, 191,
1983 191, 191, 191, 191, 191, 191, 192, 192, 192, 192,
1984 192, 192, 192, 192, 192, 192, 193, 193, 194, 194,
1985 194, 194, 194, 194, 195, 195, 196, 196, 197, 197,
1986 198, 198, 199, 200, 200, 201, 201, 202, 202, 203,
1987 203, 203, 203, 203, 203, 203, 204, 204, 204, 204,
1988 204, 204, 204, 204, 204, 204, 204, 204, 204, 205,
1989 206, 206, 207, 207, 208, 208, 208, 208, 209, 209,
1990 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
1991 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
1992 211, 211, 211, 211, 211, 211, 211, 211, 211, 211,
1993 211, 211, 211, 211, 212, 212, 213, 213, 214, 214,
1994 215, 215, 216, 216, 217, 217, 219, 218, 220, 218,
1995 218, 218, 218, 221, 218, 222, 218, 223, 218, 218,
1996 218, 218, 224, 225, 225, 226, 227, 227, 227, 228,
1997 228, 229, 229, 229, 229, 230, 231, 231, 232, 233,
1998 233, 234, 235, 236, 236, 237, 237, 237, 237, 237,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00001999 237, 237, 237, 237, 237, 237, 237, 237, 237, 237,
2000 237, 237, 237, 238, 238, 238, 238, 239, 239, 240,
2001 241, 241, 242, 242, 243, 244, 244, 244, 245, 245,
2002 245, 245, 245, 245, 245, 245, 245, 246, 246, 247,
2003 248, 248, 249, 249, 249, 249, 249, 250, 250, 251,
2004 251, 252, 252, 253, 253, 253, 253, 253, 253, 253,
2005 253, 253, 253, 253, 253, 253, 253, 253, 254, 254,
2006 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
2007 255
Dan Gohmanf4423b12008-04-19 00:24:39 +00002008};
2009
2010/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
2011static const yytype_uint8 yyr2[] =
2012{
2013 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
2014 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2015 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2016 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2017 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2018 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2019 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
2020 1, 1, 1, 0, 2, 1, 1, 1, 1, 1,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002021 1, 1, 1, 1, 0, 1, 1, 1, 0, 1,
2022 1, 0, 1, 1, 1, 1, 0, 1, 1, 0,
2023 1, 1, 1, 1, 1, 2, 1, 1, 1, 1,
2024 1, 1, 1, 1, 1, 2, 0, 2, 1, 1,
2025 1, 1, 1, 1, 0, 2, 0, 2, 0, 2,
2026 0, 3, 2, 0, 1, 0, 3, 1, 2, 1,
2027 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
2028 2, 5, 5, 5, 5, 3, 2, 5, 4, 2,
2029 1, 1, 1, 3, 1, 3, 1, 0, 1, 3,
2030 4, 3, 3, 4, 4, 3, 6, 5, 2, 2,
2031 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2032 6, 5, 8, 6, 6, 7, 7, 7, 7, 6,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002033 8, 8, 5, 7, 3, 1, 1, 1, 1, 0,
2034 2, 6, 1, 0, 1, 2, 0, 3, 0, 3,
2035 3, 3, 3, 0, 8, 0, 9, 0, 9, 5,
2036 2, 3, 1, 3, 3, 3, 3, 1, 0, 5,
2037 3, 1, 3, 1, 0, 10, 1, 1, 4, 1,
2038 1, 2, 3, 0, 1, 1, 1, 1, 1, 1,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002039 1, 1, 1, 3, 3, 2, 2, 3, 2, 5,
2040 4, 1, 5, 1, 1, 1, 1, 1, 1, 2,
2041 1, 3, 2, 2, 3, 2, 0, 1, 2, 2,
2042 3, 9, 9, 8, 14, 1, 1, 6, 5, 2,
2043 6, 7, 4, 4, 6, 6, 0, 0, 3, 2,
2044 3, 2, 1, 5, 5, 6, 6, 6, 6, 4,
2045 6, 4, 4, 6, 6, 2, 8, 1, 1, 0,
2046 3, 6, 3, 6, 2, 5, 7, 5, 4, 4,
2047 7
Dan Gohmanf4423b12008-04-19 00:24:39 +00002048};
2049
2050/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2051 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2052 means the default is an error. */
2053static const yytype_uint16 yydefact[] =
2054{
Dan Gohmane4977cf2008-05-23 01:55:30 +00002055 73, 61, 70, 62, 71, 63, 218, 216, 0, 0,
2056 0, 0, 0, 0, 84, 72, 0, 73, 214, 88,
2057 91, 0, 0, 230, 0, 0, 68, 0, 74, 75,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002058 77, 76, 78, 81, 79, 82, 80, 83, 85, 86,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002059 87, 84, 84, 209, 1, 215, 89, 90, 84, 219,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002060 92, 93, 94, 95, 84, 286, 217, 286, 0, 0,
2061 238, 231, 232, 220, 273, 274, 222, 139, 140, 141,
2062 144, 143, 142, 145, 146, 0, 0, 0, 0, 275,
2063 276, 147, 221, 149, 209, 209, 96, 208, 0, 99,
2064 99, 287, 283, 69, 249, 250, 251, 282, 233, 234,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002065 237, 0, 167, 150, 0, 0, 0, 0, 156, 168,
2066 0, 0, 167, 0, 0, 0, 98, 97, 0, 206,
2067 207, 0, 0, 100, 101, 102, 103, 104, 0, 252,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002068 0, 329, 285, 0, 235, 166, 116, 162, 164, 0,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002069 0, 0, 0, 0, 0, 155, 0, 0, 148, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002070 0, 161, 0, 160, 0, 229, 139, 140, 141, 144,
2071 143, 142, 0, 0, 67, 67, 105, 0, 246, 247,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002072 248, 328, 312, 0, 0, 0, 0, 99, 295, 296,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002073 2, 3, 4, 5, 6, 7, 8, 9, 10, 14,
2074 15, 16, 11, 12, 13, 0, 0, 0, 0, 0,
2075 0, 0, 0, 17, 18, 19, 20, 21, 22, 23,
2076 24, 25, 26, 27, 28, 0, 0, 0, 0, 0,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002077 0, 0, 0, 0, 0, 0, 0, 284, 99, 299,
2078 0, 327, 236, 159, 0, 124, 67, 67, 158, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002079 169, 0, 124, 67, 67, 0, 210, 187, 188, 183,
2080 185, 184, 186, 189, 182, 178, 179, 0, 0, 0,
Nate Begemanac80ade2008-05-12 19:01:56 +00002081 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002082 0, 0, 0, 0, 0, 181, 180, 223, 0, 311,
2083 289, 67, 280, 288, 0, 0, 55, 0, 0, 29,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002084 30, 31, 32, 33, 34, 35, 36, 37, 38, 0,
2085 53, 54, 49, 50, 51, 52, 39, 40, 41, 42,
2086 43, 44, 45, 46, 47, 48, 0, 0, 0, 130,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002087 130, 334, 67, 67, 325, 0, 0, 0, 0, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002088 67, 67, 67, 67, 67, 0, 0, 0, 0, 0,
2089 107, 109, 108, 106, 110, 111, 112, 113, 114, 117,
2090 165, 163, 152, 153, 154, 157, 66, 151, 225, 227,
2091 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2092 0, 0, 171, 205, 0, 0, 0, 175, 0, 172,
2093 0, 0, 0, 135, 244, 255, 256, 257, 262, 258,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002094 259, 260, 261, 253, 0, 0, 0, 0, 271, 278,
2095 277, 279, 0, 0, 290, 0, 0, 67, 67, 67,
2096 67, 0, 330, 0, 332, 307, 0, 0, 0, 0,
2097 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2098 67, 0, 115, 121, 120, 118, 119, 122, 123, 125,
2099 135, 135, 0, 0, 0, 0, 0, 307, 0, 0,
2100 0, 0, 0, 0, 0, 170, 156, 168, 0, 173,
2101 174, 0, 0, 0, 0, 224, 243, 116, 241, 0,
2102 254, 0, 265, 0, 0, 0, 268, 0, 266, 281,
2103 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2104 338, 0, 0, 0, 321, 322, 0, 0, 0, 0,
2105 339, 0, 0, 0, 319, 0, 130, 0, 226, 228,
2106 67, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2107 0, 0, 204, 177, 0, 0, 0, 0, 0, 0,
2108 137, 135, 65, 0, 124, 0, 264, 156, 0, 263,
2109 267, 0, 0, 306, 0, 0, 0, 0, 130, 131,
2110 130, 0, 0, 0, 0, 0, 0, 337, 309, 0,
2111 67, 313, 314, 306, 0, 335, 67, 211, 0, 0,
2112 0, 0, 191, 0, 0, 0, 0, 202, 0, 176,
2113 0, 0, 67, 132, 138, 136, 64, 240, 242, 116,
2114 133, 0, 270, 0, 0, 0, 116, 116, 0, 315,
2115 316, 317, 318, 331, 333, 308, 0, 0, 320, 323,
2116 324, 310, 0, 0, 130, 0, 0, 0, 0, 0,
2117 199, 0, 0, 0, 193, 194, 190, 65, 134, 128,
2118 272, 269, 0, 0, 0, 0, 124, 0, 300, 0,
2119 340, 124, 336, 195, 196, 197, 198, 0, 0, 0,
2120 203, 239, 0, 126, 0, 293, 0, 0, 107, 109,
2121 116, 116, 0, 116, 116, 301, 326, 192, 200, 201,
2122 129, 0, 245, 291, 0, 292, 0, 303, 302, 0,
2123 0, 0, 127, 0, 0, 0, 116, 116, 0, 0,
2124 0, 305, 304, 298, 0, 0, 297, 0, 294
Dan Gohmanf4423b12008-04-19 00:24:39 +00002125};
2126
2127/* YYDEFGOTO[NTERM-NUM]. */
2128static const yytype_int16 yydefgoto[] =
2129{
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002130 -1, 272, 273, 274, 299, 316, 162, 163, 79, 587,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002131 113, 12, 80, 14, 15, 41, 42, 43, 48, 54,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002132 118, 128, 349, 233, 439, 352, 672, 653, 412, 530,
2133 629, 465, 531, 81, 164, 137, 154, 138, 139, 110,
2134 373, 398, 374, 121, 88, 155, 16, 17, 18, 20,
2135 19, 383, 440, 441, 63, 23, 61, 101, 468, 469,
2136 129, 170, 55, 96, 56, 49, 471, 399, 83, 401,
2137 282, 283, 57, 92, 93, 227, 657, 132, 324, 598,
2138 490, 500, 228, 229, 230, 231
Dan Gohmanf4423b12008-04-19 00:24:39 +00002139};
2140
2141/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2142 STATE-NUM. */
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002143#define YYPACT_NINF -622
Dan Gohmanf4423b12008-04-19 00:24:39 +00002144static const yytype_int16 yypact[] =
2145{
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002146 805, -622, -622, -622, -622, -622, -622, -622, -6, -112,
2147 23, -97, 91, -94, 24, -622, 126, 1385, -622, 135,
2148 257, 48, 77, -622, 3, 216, -622, 1807, -622, -622,
2149 -622, -622, -622, -622, -622, -622, -622, -622, -622, -622,
2150 -622, 49, 49, 187, -622, -622, -622, -622, 49, -622,
2151 -622, -622, -622, -622, 49, 218, -622, 16, 220, 239,
2152 243, -622, -622, -622, -622, -622, 110, -622, -622, -622,
2153 -622, -622, -622, -622, -622, 267, 271, 1, 691, -622,
2154 -622, -622, -28, -622, 246, 246, 206, -622, 46, 215,
2155 215, -622, -622, 343, -622, -622, -622, -622, -622, -622,
2156 -622, -59, 1537, -622, 121, 130, 880, 110, -622, -28,
2157 -110, 138, 1537, 142, 46, 46, -622, -622, 1555, -622,
2158 -622, 1830, 302, -622, -622, -622, -622, -622, 1848, -622,
2159 -14, 2199, -622, 293, -622, -622, -28, -622, 160, 165,
2160 1877, 1877, 168, -103, 1877, -622, 334, 189, -622, 1830,
2161 1877, 110, 191, -28, 221, -622, 85, 341, 342, 345,
2162 354, 355, 323, 360, 1373, 315, -622, 28, -622, -622,
2163 -622, -622, -622, 316, 1921, 42, 361, 215, -622, -622,
2164 -622, -622, -622, -622, -622, -622, -622, -622, -622, -622,
2165 -622, -622, -622, -622, -622, 393, 529, 393, 529, 1877,
2166 1877, 1877, 1877, -622, -622, -622, -622, -622, -622, -622,
2167 -622, -622, -622, -622, -622, 1877, 1877, 1877, 1877, 1877,
2168 1877, 1877, 1877, 1877, 1877, 1877, 1877, -622, 215, -622,
2169 70, -622, -622, 176, 1578, -622, -39, -46, -622, 208,
2170 -28, 223, -622, 315, 5, 1555, -622, -622, -622, -622,
2171 -622, -622, -622, -622, -622, -622, -622, 393, 529, 393,
2172 529, 219, 227, 228, 234, 235, 241, 242, 1596, 2009,
2173 993, 356, 244, 245, 251, -622, -622, -622, 254, -622,
2174 110, 792, -622, 240, 943, 943, -622, 943, 1848, -622,
2175 -622, -622, -622, -622, -622, -622, -622, -622, -622, 1877,
2176 -622, -622, -622, -622, -622, -622, -622, -622, -622, -622,
2177 -622, -622, -622, -622, -622, -622, 1877, 1877, 1877, 26,
2178 58, -622, 792, -35, 252, 256, 258, 259, 260, 263,
2179 792, 792, 792, 792, 792, 389, 1848, 1877, 1877, 375,
2180 -622, -622, -622, -622, -622, -622, -622, -622, -622, -622,
2181 -622, -622, 202, -622, -622, -622, -622, 202, -622, 142,
2182 390, 273, 274, 276, 277, 1830, 1830, 1830, 1830, 1830,
2183 1830, 1830, -622, -622, 57, 1268, -82, -622, -64, -622,
2184 1830, 1830, 1830, 275, 1628, -622, -622, -622, -622, -622,
2185 -622, -622, -622, 374, 1757, 2041, 1313, 414, -622, -622,
2186 -622, -622, 1877, 278, -622, 279, 943, 792, 792, 792,
2187 792, 31, -622, 33, -622, -622, 943, 280, 1877, 1877,
2188 1877, 1877, 1877, 281, 282, 284, 285, 287, 1877, 943,
2189 792, 288, -622, -622, -622, -622, -622, -622, -622, -622,
2190 275, 275, 1877, 1830, 1830, 1830, 1830, -622, 290, 291,
2191 292, 294, 282, 295, 1830, -622, 286, 1222, -62, -622,
2192 -622, 301, 307, 429, 20, -622, -622, -28, 309, 312,
2193 -622, 448, -622, 87, 1508, -10, -622, -61, -622, -622,
2194 455, 456, 318, 317, 319, 320, 321, 943, 473, 943,
2195 338, 339, 943, 340, -28, -622, 344, 346, 478, 496,
2196 351, 1877, 943, 943, -28, 348, 352, 1877, -622, -622,
2197 -5, 353, 357, 359, 362, 115, 1830, 1830, 1830, 1830,
2198 146, 1830, -622, -622, 336, 1830, 1830, 1877, 493, 515,
2199 -622, 275, 530, 1789, -622, 363, -622, 358, -60, -622,
2200 -622, 943, 943, 2082, 943, 943, 943, 943, 352, -622,
2201 352, 1877, 943, 364, 1877, 1877, 1877, -622, -622, 516,
2202 792, -622, -622, 2082, 472, -622, 792, -622, 1830, 1830,
2203 1830, 1830, -622, 368, 377, 372, 376, -622, 282, -622,
2204 379, 381, 2, -622, -622, -622, -622, -622, -622, -28,
2205 4, 517, -622, 380, 382, 378, -16, -28, 157, -622,
2206 -622, -622, -622, -622, -622, -622, 384, 943, -622, -622,
2207 -622, -622, 282, 178, 352, 386, 388, 394, 396, 1830,
2208 -622, 1830, 1830, 198, -622, -622, -622, 530, -622, 507,
2209 -622, -622, 533, -7, 641, 641, -622, 2100, -622, 398,
2210 351, -622, -622, -622, -622, -622, -622, 406, 408, 409,
2211 -622, -622, 564, 417, 943, -622, 1088, 7, 415, 416,
2212 -622, -622, -12, -16, -28, -622, 202, -622, -622, -622,
2213 -622, 548, -622, -622, 418, -622, 1088, 176, 176, 557,
2214 641, 641, -622, 558, 419, 943, -622, -622, 943, 562,
2215 508, 176, 176, -622, 943, 563, -622, 943, -622
Dan Gohmanf4423b12008-04-19 00:24:39 +00002216};
2217
2218/* YYPGOTO[NTERM-NUM]. */
2219static const yytype_int16 yypgoto[] =
2220{
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002221 -622, 451, 452, 454, -163, -157, -174, -622, 0, -41,
2222 -102, 494, 13, -622, -622, -622, -622, 222, -622, -622,
2223 -622, -145, -622, -427, -622, -227, -622, -622, -301, -2,
2224 -622, -412, -622, -622, -26, 369, -116, -622, 477, 484,
2225 -113, -161, -259, 8, 147, 347, -622, -622, 574, -622,
2226 -622, -622, -622, -622, -622, -622, -622, -622, -622, -622,
2227 503, -622, -622, -622, -622, -622, -622, -621, -121, 55,
2228 -195, -622, -622, 537, -622, -622, -622, -622, -622, 32,
2229 151, -445, -622, -622, -622, -622
Dan Gohmanf4423b12008-04-19 00:24:39 +00002230};
2231
2232/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2233 positive, shift that token. If negative, reduce the rule which
2234 number is the opposite. If zero, do what YYDEFACT says.
2235 If YYTABLE_NINF, syntax error. */
Dan Gohmane4977cf2008-05-23 01:55:30 +00002236#define YYTABLE_NINF -214
Dan Gohmanf4423b12008-04-19 00:24:39 +00002237static const yytype_int16 yytable[] =
2238{
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002239 11, 82, 287, 275, 286, 105, 321, 520, 165, 111,
2240 376, 378, 167, 13, 168, 357, 111, 11, 286, 414,
2241 111, 325, 326, 327, 328, 329, 679, 111, 508, 509,
2242 13, 335, 288, 246, 317, 674, 243, 91, 528, -145,
2243 532, 318, 487, 276, 489, 94, 24, 21, 2, 144,
2244 111, 4, 109, 284, 528, 684, 144, 111, 145, 285,
2245 111, 26, 22, 277, 28, 239, 29, 30, 31, 32,
2246 33, 34, 35, 36, 529, 37, 136, 454, 119, 120,
2247 109, 111, 25, 336, 459, 488, 136, 488, -55, -55,
2248 -55, -55, 153, 11, 361, 454, 363, 454, 454, 454,
2249 133, 362, 153, 364, 460, 134, 524, 540, 593, 27,
2250 112, 247, 248, 111, 236, 237, 458, 112, 240, 585,
2251 354, 112, 149, 150, 244, 353, 44, 416, 112, 433,
2252 434, 435, -67, 623, 436, 473, 475, 477, 437, 438,
2253 -145, 358, 359, 431, -145, 433, 434, 435, 281, 454,
2254 436, 112, 567, 169, 437, 438, 539, 655, 112, 626,
2255 400, 112, 627, 400, 400, 60, 400, 640, 106, 634,
2256 635, 675, 406, 319, 320, 281, 322, 38, 39, 40,
2257 278, 46, 112, 47, 95, 411, -67, 337, 338, 323,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002258 281, 281, 281, 281, 281, 330, 331, 332, 333, 334,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002259 281, 400, 38, 39, 40, 565, 58, 479, 136, 400,
2260 400, 400, 400, 400, 112, 538, 454, 413, -67, 153,
2261 429, 455, 86, 493, 87, 495, 496, 497, 64, 65,
2262 339, 114, 115, 677, 678, 59, 680, 681, 62, 91,
2263 1, 2, 98, 3, 4, 5, 454, 603, 116, 604,
2264 117, 536, 447, 448, 449, 450, 451, 452, 453, 691,
2265 692, 99, 153, 84, 85, 100, 102, 461, 462, 463,
2266 89, 103, 572, 407, 551, 104, 90, 122, 123, 124,
2267 125, 126, 127, 87, 140, 400, 400, 400, 400, 400,
2268 408, 409, 410, 141, 146, 400, 275, 340, 341, 50,
2269 51, 52, 148, 577, 53, 559, 166, 590, 400, 400,
2270 153, 430, 281, 642, 636, 232, 637, 342, 343, 234,
2271 344, 345, 235, 346, 347, 348, 249, 250, 251, 252,
2272 511, 512, 513, 514, 238, 641, 276, 637, 241, 403,
2273 404, 522, 405, 433, 434, 435, 242, 245, 436, 457,
2274 -56, -57, 437, 438, -60, 650, 605, 559, 467, 608,
2275 609, 610, 1, -59, -58, 3, 400, 5, 400, 253,
2276 111, 400, 286, 279, 355, 365, 281, 415, 379, 432,
2277 356, 400, 400, 366, 367, 423, 424, 425, 426, 427,
2278 368, 369, 281, 494, 281, 281, 281, 370, 371, 402,
2279 380, 381, 504, 573, 574, 575, 576, 382, 578, 662,
2280 384, 417, 580, 581, 666, 418, 510, 419, 420, 421,
2281 400, 400, 422, 400, 400, 400, 400, 428, 442, 443,
2282 444, 400, 445, 446, 464, 470, 478, 480, 481, 400,
2283 498, 499, 492, 501, 502, 400, 503, 507, 457, 516,
2284 517, 518, 523, 519, 521, 615, 616, 617, 618, 656,
2285 525, 482, 483, 484, 485, 486, 526, 527, 533, 534,
2286 535, 491, 541, 542, 543, 560, 544, 549, 545, 546,
2287 547, 566, 557, 676, 505, 506, 400, 289, 290, 291,
2288 292, 293, 294, 295, 296, 297, 298, 551, 552, 554,
2289 558, 582, 579, 555, 563, 556, 647, 589, 648, 649,
2290 559, 564, 568, 400, 400, 583, 569, 597, 570, 584,
2291 611, 571, 591, 607, 592, 281, 488, 619, 281, 281,
2292 281, 621, 586, 400, 620, 622, 624, 597, 625, 630,
2293 633, 632, 548, 643, 550, 644, 631, 553, 638, 1,
2294 654, 645, 3, 646, 5, 300, 301, 561, 562, 400,
2295 400, 652, 665, 667, 400, 668, 669, 400, 670, 671,
2296 682, -18, -19, 400, 685, 688, 400, 683, 689, 694,
2297 697, 695, 224, 225, 339, 226, 651, 131, 628, 147,
2298 143, 45, 360, 130, 97, 613, 594, 595, 515, 599,
2299 600, 601, 602, 351, 0, 0, 0, 606, 0, 0,
2300 0, 664, 0, 0, 0, 612, 0, 0, 0, 0,
2301 0, 614, 0, 0, 0, 0, 0, 586, 0, 302,
2302 303, 304, 305, 306, 307, 308, 309, 310, 311, 312,
2303 313, 314, 315, 0, 385, 386, 0, 0, 64, 65,
2304 387, 340, 341, 0, 0, 0, 0, 0, 0, 0,
2305 1, 2, 639, 3, 4, 5, 388, 389, 390, 0,
2306 0, 342, 343, 0, 344, 345, 0, 346, 347, 348,
2307 0, 391, 392, 0, 0, 0, 0, 0, 0, 660,
2308 661, 0, 0, 0, 0, 339, 0, 0, 64, 65,
2309 393, 107, 67, 68, 69, 70, 71, 72, 73, 673,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002310 1, 2, 0, 3, 4, 5, 180, 181, 182, 183,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002311 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002312 194, 257, 258, 259, 260, 686, 687, 0, 0, 0,
2313 690, 74, 0, 693, 0, 0, 0, 0, 0, 696,
2314 0, 0, 698, 0, 0, 0, 0, 0, 0, 0,
2315 261, 203, 658, 659, 206, 207, 208, 209, 210, 211,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002316 212, 213, 214, 0, 262, 0, 263, 264, 265, 0,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002317 266, 267, 342, 343, 0, 344, 345, 0, 346, 347,
2318 348, 0, 0, 0, 0, 385, 386, 0, 0, 64,
2319 65, 387, 0, 394, 0, -213, 395, 0, 396, 0,
2320 397, 1, 2, 0, 3, 4, 5, 388, 389, 390,
2321 0, 0, 0, -69, 1, 2, 0, 3, 4, 5,
2322 0, 0, 391, 392, 0, 6, 7, 0, 0, 0,
2323 0, 0, 0, 0, 0, 0, 0, 111, 0, 0,
2324 0, 393, 75, 76, 0, 0, 77, 8, 78, 108,
2325 0, 9, 0, 0, 0, 10, 0, 180, 181, 182,
2326 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
2327 193, 194, 257, 258, 259, 260, 0, 64, 65, 0,
2328 107, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2329 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2330 0, 261, 203, 204, 205, 206, 207, 208, 209, 210,
2331 211, 212, 213, 214, 0, 262, 0, 263, 264, 265,
2332 74, 266, 267, 0, 0, 0, 0, 0, 0, 0,
2333 0, 0, 0, 0, 0, 0, 385, 386, 112, 0,
2334 64, 65, 387, 0, 394, 0, 0, 395, 0, 396,
2335 0, 397, 1, 2, 0, 3, 4, 5, 388, 389,
2336 390, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2337 0, 0, 0, 391, 392, 0, 0, 0, 0, 0,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002338 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002339 64, 65, 393, 107, 156, 157, 158, 159, 160, 161,
2340 73, 0, 1, 2, 0, 3, 4, 5, 180, 181,
2341 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
2342 192, 193, 194, 257, 258, 259, 260, 0, 0, 0,
2343 0, 75, 76, 74, 0, 77, 0, 78, 142, 0,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002344 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002345 0, 0, 261, 203, 204, 205, 206, 207, 208, 209,
2346 210, 211, 212, 213, 214, 0, 262, 0, 263, 264,
2347 265, 0, 266, 267, 0, 0, 0, 0, 0, 0,
2348 0, 385, 386, 0, 0, 0, 0, 387, 0, 0,
2349 0, 0, 0, 0, 0, 394, 0, 0, 395, 0,
2350 396, 0, 397, 388, 389, 390, 0, 0, 0, 0,
2351 0, 0, 0, 0, 0, 0, 0, 0, 391, 392,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002352 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002353 0, 0, 0, 0, 0, 0, 0, 393, 0, 0,
2354 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2355 78, 377, 0, 180, 181, 182, 183, 184, 185, 186,
2356 187, 188, 189, 190, 191, 192, 193, 194, 257, 258,
2357 259, 260, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002358 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002359 0, 0, 0, 0, 0, 0, 0, 261, 203, 204,
2360 205, 206, 207, 208, 209, 210, 211, 212, 213, 214,
2361 0, 262, 0, 263, 264, 265, 0, 266, 267, 64,
2362 65, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2363 0, 1, 2, 0, 3, 4, 5, 254, 0, 0,
2364 394, 0, 0, 395, 0, 396, 0, 397, 0, 0,
2365 0, 0, 255, 256, 0, 0, 0, 0, 0, 0,
2366 0, 0, 0, 0, 0, 64, 65, 111, 107, 156,
2367 157, 158, 159, 160, 161, 73, 0, 1, 2, 0,
2368 3, 4, 5, 0, 0, 0, 0, 180, 181, 182,
2369 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
2370 193, 194, 257, 258, 259, 260, 0, 0, 74, 0,
2371 64, 65, 0, 107, 156, 157, 158, 159, 160, 161,
2372 73, 0, 1, 2, 0, 3, 4, 5, 0, 0,
2373 0, 261, 203, 204, 205, 206, 207, 208, 209, 210,
2374 211, 212, 213, 214, 0, 262, 0, 263, 264, 265,
2375 0, 266, 267, 74, 0, 0, 0, 0, 0, 0,
2376 0, 0, 0, 0, 0, 0, 0, 0, 112, 0,
2377 64, 65, -67, 0, 268, -212, 0, 269, 0, 270,
2378 0, 271, 1, 2, 0, 3, 4, 5, 254, 0,
2379 0, 0, 0, -69, 1, 2, 0, 3, 4, 5,
2380 0, 0, 0, 255, 256, 6, 7, 0, 0, 0,
2381 0, 0, 0, 0, 0, 0, 0, 0, 111, 75,
2382 76, 0, 0, 77, 0, 78, 456, 8, 0, 0,
2383 0, 9, 0, 0, 0, 10, 0, 0, 180, 181,
2384 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
2385 192, 193, 194, 257, 258, 259, 260, 0, 0, 0,
2386 0, 0, 0, 0, 75, 76, 0, 0, 77, 0,
2387 78, 476, 0, 0, 0, 0, 0, 0, 0, 0,
2388 0, 0, 261, 203, 204, 205, 206, 207, 208, 209,
2389 210, 211, 212, 213, 214, 0, 262, 0, 263, 264,
2390 265, 0, 266, 267, 0, 64, 65, 0, 107, 156,
2391 157, 158, 159, 160, 161, 73, 0, 1, 2, 112,
2392 3, 4, 5, 0, 0, 268, 0, 0, 269, 0,
2393 270, 0, 271, 0, 64, 65, 0, 107, 67, 68,
2394 69, 70, 71, 72, 73, 0, 1, 2, 74, 3,
2395 4, 5, 64, 65, 0, 151, 67, 68, 69, 70,
2396 71, 72, 73, 0, 1, 2, 135, 3, 4, 5,
2397 0, 0, 0, 0, 0, 64, 65, 74, 107, 67,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002398 68, 69, 70, 71, 72, 73, 0, 1, 2, 0,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002399 3, 4, 5, 64, 65, 74, 107, 156, 157, 158,
2400 159, 160, 161, 73, 0, 1, 2, 350, 3, 4,
2401 5, 0, 0, 0, 0, 0, 0, 0, 74, 0,
2402 0, 0, 0, 0, 0, 64, 65, 0, 107, 67,
2403 68, 69, 70, 71, 72, 73, 74, 1, 2, 0,
2404 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
2405 0, 0, 0, 0, 0, 0, 0, 466, 0, 75,
2406 76, 0, 0, 77, 0, 78, 537, 0, 74, 0,
2407 152, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2408 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2409 0, 0, 77, 0, 78, 0, 0, 0, 0, 0,
2410 0, 0, 0, 0, 0, 0, 75, 76, 0, 0,
2411 77, 0, 78, 0, 0, 0, 0, 0, 0, 0,
2412 0, 0, 0, 0, 0, 0, 0, 0, 0, 75,
2413 76, 0, 0, 77, 0, 78, 0, 0, 0, 0,
2414 0, 0, 0, 0, 0, 0, 0, 75, 76, 0,
2415 372, 77, 0, 78, 64, 65, 0, 107, 156, 157,
2416 158, 159, 160, 161, 73, 0, 1, 2, 0, 3,
2417 4, 5, 0, 0, 0, 0, 0, 0, 0, 75,
2418 76, 0, 0, 77, 0, 78, 64, 65, 0, 107,
2419 67, 68, 69, 70, 71, 72, 73, 74, 1, 2,
2420 0, 3, 4, 5, 64, 65, 0, 66, 67, 68,
2421 69, 70, 71, 72, 73, 0, 1, 2, 588, 3,
2422 4, 5, 0, 0, 0, 0, 0, 64, 65, 74,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002423 107, 156, 157, 158, 159, 160, 161, 73, 0, 1,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002424 2, 0, 3, 4, 5, 64, 65, 74, 151, 67,
2425 68, 69, 70, 71, 72, 73, 0, 1, 2, 0,
2426 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
2427 74, 0, 0, 0, 64, 65, 0, 107, 67, 68,
2428 69, 70, 71, 72, 73, 0, 1, 2, 74, 3,
2429 4, 5, 0, 0, 0, 0, 0, 0, 0, 0,
2430 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2431 0, 472, 77, 0, 78, 0, 0, 74, 64, 65,
2432 0, 280, 67, 68, 69, 70, 71, 72, 73, 0,
2433 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2434 75, 76, 0, 0, 77, 0, 78, 0, 0, 0,
2435 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2436 0, 74, 77, 0, 78, 0, 0, 0, 0, 0,
2437 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2438 0, 75, 76, 0, 0, 77, 0, 78, 0, 0,
2439 0, 0, 0, 0, 0, 0, 0, 0, 0, 75,
2440 76, 0, 0, 77, 0, 78, 64, 65, 0, 107,
2441 156, 157, 158, 159, 160, 161, 73, 0, 1, 2,
2442 0, 3, 4, 5, 0, 0, 0, 0, 75, 76,
2443 0, 0, 77, 0, 78, 0, 0, 0, 64, 65,
2444 0, 107, 156, 157, 158, 159, 160, 161, 73, 74,
2445 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2446 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2447 0, 0, 75, 76, 0, 0, 77, 0, 78, 64,
2448 65, 74, 107, 67, 68, 69, 70, 71, 72, 596,
2449 0, 1, 2, 0, 3, 4, 5, 64, 65, 0,
2450 107, 67, 68, 69, 70, 71, 72, 663, 0, 1,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002451 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002452 0, 0, 74, 0, 0, 0, 0, 0, 0, 0,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002453 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2454 74, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2455 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2456 75, 76, 0, 0, 77, 0, 375, 0, 0, 0,
2457 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2458 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2459 0, 0, 75, 76, 0, 0, 77, 0, 474, 0,
2460 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2461 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2462 0, 0, 0, 0, 0, 171, 0, 0, 0, 0,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002463 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002464 0, 0, 0, 0, 0, 0, 172, 173, 0, 0,
2465 0, 75, 76, 0, 0, 77, 0, 78, 174, 175,
2466 176, 177, 178, 179, 180, 181, 182, 183, 184, 185,
2467 186, 187, 188, 189, 190, 191, 192, 193, 194, 195,
2468 196, 197, 198, 0, 0, 0, 0, 0, 0, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002469 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002470 0, 0, 0, 199, 200, 201, 0, 0, 202, 203,
2471 204, 205, 206, 207, 208, 209, 210, 211, 212, 213,
2472 214, 215, 216, 217, 218, 219, 220, 221, 222, 223
Dan Gohmanf4423b12008-04-19 00:24:39 +00002473};
2474
2475static const yytype_int16 yycheck[] =
2476{
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002477 0, 27, 176, 164, 11, 4, 201, 452, 121, 55,
2478 269, 270, 128, 0, 28, 242, 55, 17, 11, 320,
2479 55, 216, 217, 218, 219, 220, 38, 55, 440, 441,
2480 17, 226, 177, 154, 197, 656, 149, 21, 34, 55,
2481 467, 198, 11, 164, 11, 29, 158, 53, 20, 159,
2482 55, 23, 78, 11, 34, 676, 159, 55, 168, 17,
2483 55, 158, 68, 165, 158, 168, 42, 43, 44, 45,
2484 46, 47, 48, 49, 54, 51, 102, 159, 32, 33,
2485 106, 55, 59, 228, 166, 54, 112, 54, 3, 4,
2486 5, 6, 118, 93, 257, 159, 259, 159, 159, 159,
2487 159, 258, 128, 260, 168, 164, 168, 168, 168, 18,
2488 156, 26, 27, 55, 140, 141, 375, 156, 144, 531,
2489 166, 156, 114, 115, 150, 164, 0, 162, 156, 141,
2490 142, 143, 160, 578, 146, 394, 395, 396, 150, 151,
2491 156, 243, 244, 338, 160, 141, 142, 143, 174, 159,
2492 146, 156, 157, 167, 150, 151, 166, 164, 156, 157,
2493 281, 156, 589, 284, 285, 162, 287, 612, 167, 596,
2494 597, 164, 288, 199, 200, 201, 202, 153, 154, 155,
2495 167, 46, 156, 48, 168, 159, 160, 117, 118, 215,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002496 216, 217, 218, 219, 220, 221, 222, 223, 224, 225,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002497 226, 322, 153, 154, 155, 506, 158, 402, 234, 330,
2498 331, 332, 333, 334, 156, 474, 159, 159, 160, 245,
2499 336, 164, 35, 418, 37, 420, 421, 422, 7, 8,
2500 54, 84, 85, 660, 661, 158, 663, 664, 22, 21,
2501 19, 20, 22, 22, 23, 24, 159, 548, 42, 550,
2502 44, 164, 365, 366, 367, 368, 369, 370, 371, 686,
2503 687, 22, 288, 41, 42, 22, 156, 380, 381, 382,
2504 48, 4, 157, 299, 159, 4, 54, 62, 63, 64,
2505 65, 66, 67, 37, 163, 406, 407, 408, 409, 410,
2506 316, 317, 318, 163, 156, 416, 457, 121, 122, 42,
2507 43, 44, 160, 157, 47, 159, 4, 534, 429, 430,
2508 336, 337, 338, 614, 157, 22, 159, 141, 142, 159,
2509 144, 145, 157, 147, 148, 149, 3, 4, 5, 6,
2510 443, 444, 445, 446, 166, 157, 457, 159, 4, 284,
2511 285, 454, 287, 141, 142, 143, 157, 156, 146, 375,
2512 9, 9, 150, 151, 9, 157, 551, 159, 384, 554,
2513 555, 556, 19, 9, 9, 22, 487, 24, 489, 9,
2514 55, 492, 11, 57, 166, 156, 402, 322, 22, 4,
2515 157, 502, 503, 156, 156, 330, 331, 332, 333, 334,
2516 156, 156, 418, 419, 420, 421, 422, 156, 156, 159,
2517 156, 156, 428, 516, 517, 518, 519, 156, 521, 636,
2518 156, 159, 525, 526, 641, 159, 442, 159, 159, 159,
2519 541, 542, 159, 544, 545, 546, 547, 38, 38, 156,
2520 156, 552, 156, 156, 159, 61, 22, 159, 159, 560,
2521 159, 159, 162, 159, 159, 566, 159, 159, 474, 159,
2522 159, 159, 166, 159, 159, 568, 569, 570, 571, 633,
2523 159, 406, 407, 408, 409, 410, 159, 38, 159, 157,
2524 22, 416, 17, 17, 156, 501, 159, 4, 159, 159,
2525 159, 507, 4, 657, 429, 430, 607, 94, 95, 96,
2526 97, 98, 99, 100, 101, 102, 103, 159, 159, 159,
2527 4, 527, 166, 159, 156, 159, 619, 533, 621, 622,
2528 159, 159, 159, 634, 635, 22, 159, 543, 159, 4,
2529 4, 159, 159, 159, 166, 551, 54, 159, 554, 555,
2530 556, 159, 532, 654, 157, 159, 157, 563, 157, 22,
2531 162, 159, 487, 157, 489, 157, 166, 492, 164, 19,
2532 17, 157, 22, 157, 24, 26, 27, 502, 503, 680,
2533 681, 54, 164, 157, 685, 157, 157, 688, 4, 152,
2534 22, 156, 156, 694, 17, 17, 697, 159, 159, 17,
2535 17, 73, 131, 131, 54, 131, 627, 93, 590, 112,
2536 106, 17, 245, 90, 57, 563, 541, 542, 447, 544,
2537 545, 546, 547, 234, -1, -1, -1, 552, -1, -1,
2538 -1, 637, -1, -1, -1, 560, -1, -1, -1, -1,
2539 -1, 566, -1, -1, -1, -1, -1, 627, -1, 100,
2540 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
2541 111, 112, 113, -1, 3, 4, -1, -1, 7, 8,
2542 9, 121, 122, -1, -1, -1, -1, -1, -1, -1,
2543 19, 20, 607, 22, 23, 24, 25, 26, 27, -1,
2544 -1, 141, 142, -1, 144, 145, -1, 147, 148, 149,
2545 -1, 40, 41, -1, -1, -1, -1, -1, -1, 634,
2546 635, -1, -1, -1, -1, 54, -1, -1, 7, 8,
2547 59, 10, 11, 12, 13, 14, 15, 16, 17, 654,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002548 19, 20, -1, 22, 23, 24, 75, 76, 77, 78,
2549 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002550 89, 90, 91, 92, 93, 680, 681, -1, -1, -1,
2551 685, 50, -1, 688, -1, -1, -1, -1, -1, 694,
2552 -1, -1, 697, -1, -1, -1, -1, -1, -1, -1,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002553 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
2554 129, 130, 131, -1, 133, -1, 135, 136, 137, -1,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002555 139, 140, 141, 142, -1, 144, 145, -1, 147, 148,
2556 149, -1, -1, -1, -1, 3, 4, -1, -1, 7,
2557 8, 9, -1, 162, -1, 0, 165, -1, 167, -1,
2558 169, 19, 20, -1, 22, 23, 24, 25, 26, 27,
2559 -1, -1, -1, 18, 19, 20, -1, 22, 23, 24,
2560 -1, -1, 40, 41, -1, 30, 31, -1, -1, -1,
2561 -1, -1, -1, -1, -1, -1, -1, 55, -1, -1,
2562 -1, 59, 161, 162, -1, -1, 165, 52, 167, 168,
2563 -1, 56, -1, -1, -1, 60, -1, 75, 76, 77,
2564 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2565 88, 89, 90, 91, 92, 93, -1, 7, 8, -1,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002566 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002567 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2568 -1, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2569 128, 129, 130, 131, -1, 133, -1, 135, 136, 137,
2570 50, 139, 140, -1, -1, -1, -1, -1, -1, -1,
2571 -1, -1, -1, -1, -1, -1, 3, 4, 156, -1,
2572 7, 8, 9, -1, 162, -1, -1, 165, -1, 167,
2573 -1, 169, 19, 20, -1, 22, 23, 24, 25, 26,
2574 27, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2575 -1, -1, -1, 40, 41, -1, -1, -1, -1, -1,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002576 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002577 7, 8, 59, 10, 11, 12, 13, 14, 15, 16,
2578 17, -1, 19, 20, -1, 22, 23, 24, 75, 76,
2579 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2580 87, 88, 89, 90, 91, 92, 93, -1, -1, -1,
2581 -1, 161, 162, 50, -1, 165, -1, 167, 168, -1,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002582 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002583 -1, -1, 119, 120, 121, 122, 123, 124, 125, 126,
2584 127, 128, 129, 130, 131, -1, 133, -1, 135, 136,
2585 137, -1, 139, 140, -1, -1, -1, -1, -1, -1,
2586 -1, 3, 4, -1, -1, -1, -1, 9, -1, -1,
2587 -1, -1, -1, -1, -1, 162, -1, -1, 165, -1,
2588 167, -1, 169, 25, 26, 27, -1, -1, -1, -1,
2589 -1, -1, -1, -1, -1, -1, -1, -1, 40, 41,
2590 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2591 -1, -1, -1, -1, -1, -1, -1, 59, -1, -1,
2592 -1, -1, -1, -1, 161, 162, -1, -1, 165, -1,
2593 167, 168, -1, 75, 76, 77, 78, 79, 80, 81,
2594 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
2595 92, 93, -1, -1, -1, -1, -1, -1, -1, -1,
2596 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2597 -1, -1, -1, -1, -1, -1, -1, 119, 120, 121,
2598 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
2599 -1, 133, -1, 135, 136, 137, -1, 139, 140, 7,
2600 8, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2601 -1, 19, 20, -1, 22, 23, 24, 25, -1, -1,
2602 162, -1, -1, 165, -1, 167, -1, 169, -1, -1,
2603 -1, -1, 40, 41, -1, -1, -1, -1, -1, -1,
2604 -1, -1, -1, -1, -1, 7, 8, 55, 10, 11,
2605 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2606 22, 23, 24, -1, -1, -1, -1, 75, 76, 77,
2607 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2608 88, 89, 90, 91, 92, 93, -1, -1, 50, -1,
2609 7, 8, -1, 10, 11, 12, 13, 14, 15, 16,
2610 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
2611 -1, 119, 120, 121, 122, 123, 124, 125, 126, 127,
2612 128, 129, 130, 131, -1, 133, -1, 135, 136, 137,
2613 -1, 139, 140, 50, -1, -1, -1, -1, -1, -1,
2614 -1, -1, -1, -1, -1, -1, -1, -1, 156, -1,
2615 7, 8, 160, -1, 162, 0, -1, 165, -1, 167,
2616 -1, 169, 19, 20, -1, 22, 23, 24, 25, -1,
2617 -1, -1, -1, 18, 19, 20, -1, 22, 23, 24,
2618 -1, -1, -1, 40, 41, 30, 31, -1, -1, -1,
2619 -1, -1, -1, -1, -1, -1, -1, -1, 55, 161,
2620 162, -1, -1, 165, -1, 167, 168, 52, -1, -1,
2621 -1, 56, -1, -1, -1, 60, -1, -1, 75, 76,
2622 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2623 87, 88, 89, 90, 91, 92, 93, -1, -1, -1,
2624 -1, -1, -1, -1, 161, 162, -1, -1, 165, -1,
2625 167, 168, -1, -1, -1, -1, -1, -1, -1, -1,
2626 -1, -1, 119, 120, 121, 122, 123, 124, 125, 126,
2627 127, 128, 129, 130, 131, -1, 133, -1, 135, 136,
2628 137, -1, 139, 140, -1, 7, 8, -1, 10, 11,
2629 12, 13, 14, 15, 16, 17, -1, 19, 20, 156,
2630 22, 23, 24, -1, -1, 162, -1, -1, 165, -1,
2631 167, -1, 169, -1, 7, 8, -1, 10, 11, 12,
2632 13, 14, 15, 16, 17, -1, 19, 20, 50, 22,
2633 23, 24, 7, 8, -1, 10, 11, 12, 13, 14,
2634 15, 16, 17, -1, 19, 20, 39, 22, 23, 24,
2635 -1, -1, -1, -1, -1, 7, 8, 50, 10, 11,
2636 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2637 22, 23, 24, 7, 8, 50, 10, 11, 12, 13,
2638 14, 15, 16, 17, -1, 19, 20, 39, 22, 23,
2639 24, -1, -1, -1, -1, -1, -1, -1, 50, -1,
2640 -1, -1, -1, -1, -1, 7, 8, -1, 10, 11,
2641 12, 13, 14, 15, 16, 17, 50, 19, 20, -1,
2642 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
2643 -1, -1, -1, -1, -1, -1, -1, 39, -1, 161,
2644 162, -1, -1, 165, -1, 167, 168, -1, 50, -1,
2645 125, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2646 -1, -1, -1, -1, -1, -1, -1, -1, 161, 162,
2647 -1, -1, 165, -1, 167, -1, -1, -1, -1, -1,
2648 -1, -1, -1, -1, -1, -1, 161, 162, -1, -1,
2649 165, -1, 167, -1, -1, -1, -1, -1, -1, -1,
2650 -1, -1, -1, -1, -1, -1, -1, -1, -1, 161,
2651 162, -1, -1, 165, -1, 167, -1, -1, -1, -1,
2652 -1, -1, -1, -1, -1, -1, -1, 161, 162, -1,
2653 164, 165, -1, 167, 7, 8, -1, 10, 11, 12,
2654 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2655 23, 24, -1, -1, -1, -1, -1, -1, -1, 161,
2656 162, -1, -1, 165, -1, 167, 7, 8, -1, 10,
2657 11, 12, 13, 14, 15, 16, 17, 50, 19, 20,
2658 -1, 22, 23, 24, 7, 8, -1, 10, 11, 12,
2659 13, 14, 15, 16, 17, -1, 19, 20, 39, 22,
2660 23, 24, -1, -1, -1, -1, -1, 7, 8, 50,
2661 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2662 20, -1, 22, 23, 24, 7, 8, 50, 10, 11,
2663 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2664 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
2665 50, -1, -1, -1, 7, 8, -1, 10, 11, 12,
2666 13, 14, 15, 16, 17, -1, 19, 20, 50, 22,
2667 23, 24, -1, -1, -1, -1, -1, -1, -1, -1,
2668 -1, -1, -1, -1, -1, -1, -1, -1, 161, 162,
2669 -1, 164, 165, -1, 167, -1, -1, 50, 7, 8,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002670 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2671 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002672 161, 162, -1, -1, 165, -1, 167, -1, -1, -1,
2673 -1, -1, -1, -1, -1, -1, -1, -1, 161, 162,
2674 -1, 50, 165, -1, 167, -1, -1, -1, -1, -1,
2675 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2676 -1, 161, 162, -1, -1, 165, -1, 167, -1, -1,
2677 -1, -1, -1, -1, -1, -1, -1, -1, -1, 161,
2678 162, -1, -1, 165, -1, 167, 7, 8, -1, 10,
2679 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2680 -1, 22, 23, 24, -1, -1, -1, -1, 161, 162,
2681 -1, -1, 165, -1, 167, -1, -1, -1, 7, 8,
2682 -1, 10, 11, 12, 13, 14, 15, 16, 17, 50,
2683 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002684 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2685 -1, -1, 161, 162, -1, -1, 165, -1, 167, 7,
2686 8, 50, 10, 11, 12, 13, 14, 15, 16, 17,
2687 -1, 19, 20, -1, 22, 23, 24, 7, 8, -1,
2688 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2689 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2690 -1, -1, 50, -1, -1, -1, -1, -1, -1, -1,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002691 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2692 50, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2693 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2694 161, 162, -1, -1, 165, -1, 167, -1, -1, -1,
2695 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2696 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002697 -1, -1, 161, 162, -1, -1, 165, -1, 167, -1,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002698 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2699 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002700 -1, -1, -1, -1, -1, 36, -1, -1, -1, -1,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002701 -1, -1, -1, 161, 162, -1, -1, 165, -1, 167,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002702 -1, -1, -1, -1, -1, -1, 57, 58, -1, -1,
2703 -1, 161, 162, -1, -1, 165, -1, 167, 69, 70,
2704 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2705 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2706 91, 92, 93, -1, -1, -1, -1, -1, -1, -1,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002707 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002708 -1, -1, -1, 114, 115, 116, -1, -1, 119, 120,
2709 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
2710 131, 132, 133, 134, 135, 136, 137, 138, 139, 140
Dan Gohmanf4423b12008-04-19 00:24:39 +00002711};
2712
2713/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2714 symbol of state STATE-NUM. */
2715static const yytype_uint8 yystos[] =
2716{
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002717 0, 19, 20, 22, 23, 24, 30, 31, 52, 56,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002718 60, 178, 181, 182, 183, 184, 216, 217, 218, 220,
2719 219, 53, 68, 225, 158, 59, 158, 18, 158, 42,
2720 43, 44, 45, 46, 47, 48, 49, 51, 153, 154,
2721 155, 185, 186, 187, 0, 218, 46, 48, 188, 235,
2722 42, 43, 44, 47, 189, 232, 234, 242, 158, 158,
2723 162, 226, 22, 224, 7, 8, 10, 11, 12, 13,
2724 14, 15, 16, 17, 50, 161, 162, 165, 167, 178,
2725 182, 203, 204, 238, 187, 187, 35, 37, 214, 187,
2726 187, 21, 243, 244, 29, 168, 233, 243, 22, 22,
2727 22, 227, 156, 4, 4, 4, 167, 10, 168, 204,
2728 209, 55, 156, 180, 214, 214, 42, 44, 190, 32,
2729 33, 213, 62, 63, 64, 65, 66, 67, 191, 230,
2730 230, 181, 247, 159, 164, 39, 204, 205, 207, 208,
2731 163, 163, 168, 209, 159, 168, 156, 208, 160, 213,
2732 213, 10, 125, 204, 206, 215, 11, 12, 13, 14,
2733 15, 16, 176, 177, 204, 210, 4, 206, 28, 167,
2734 231, 36, 57, 58, 69, 70, 71, 72, 73, 74,
Chris Lattnercc81d152008-05-04 17:18:47 +00002735 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002736 85, 86, 87, 88, 89, 90, 91, 92, 93, 114,
2737 115, 116, 119, 120, 121, 122, 123, 124, 125, 126,
Nate Begemanac80ade2008-05-12 19:01:56 +00002738 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002739 137, 138, 139, 140, 171, 172, 173, 245, 252, 253,
2740 254, 255, 22, 193, 159, 157, 204, 204, 166, 168,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002741 204, 4, 157, 210, 204, 156, 238, 26, 27, 3,
2742 4, 5, 6, 9, 25, 40, 41, 90, 91, 92,
2743 93, 119, 133, 135, 136, 137, 139, 140, 162, 165,
2744 167, 169, 171, 172, 173, 211, 238, 180, 182, 57,
2745 10, 204, 240, 241, 11, 17, 11, 176, 191, 94,
2746 95, 96, 97, 98, 99, 100, 101, 102, 103, 174,
2747 26, 27, 100, 101, 102, 103, 104, 105, 106, 107,
2748 108, 109, 110, 111, 112, 113, 175, 174, 175, 204,
2749 204, 240, 204, 204, 248, 240, 240, 240, 240, 240,
2750 204, 204, 204, 204, 204, 240, 191, 117, 118, 54,
2751 121, 122, 141, 142, 144, 145, 147, 148, 149, 192,
2752 39, 205, 195, 164, 166, 166, 157, 195, 180, 180,
2753 215, 174, 175, 174, 175, 156, 156, 156, 156, 156,
2754 156, 156, 164, 210, 212, 167, 212, 168, 212, 22,
2755 156, 156, 156, 221, 156, 3, 4, 9, 25, 26,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002756 27, 40, 41, 59, 162, 165, 167, 169, 211, 237,
2757 238, 239, 159, 239, 239, 239, 206, 204, 204, 204,
2758 204, 159, 198, 159, 198, 239, 162, 159, 159, 159,
2759 159, 159, 159, 239, 239, 239, 239, 239, 38, 206,
2760 204, 240, 4, 141, 142, 143, 146, 150, 151, 194,
2761 222, 223, 38, 156, 156, 156, 156, 210, 210, 210,
2762 210, 210, 210, 210, 159, 164, 168, 204, 212, 166,
2763 168, 210, 210, 210, 159, 201, 39, 204, 228, 229,
2764 61, 236, 164, 212, 167, 212, 168, 212, 22, 240,
2765 159, 159, 239, 239, 239, 239, 239, 11, 54, 11,
2766 250, 239, 162, 240, 204, 240, 240, 240, 159, 159,
2767 251, 159, 159, 159, 204, 239, 239, 159, 201, 201,
2768 204, 210, 210, 210, 210, 250, 159, 159, 159, 159,
2769 251, 159, 210, 166, 168, 159, 159, 38, 34, 54,
2770 199, 202, 193, 159, 157, 22, 164, 168, 212, 166,
2771 168, 17, 17, 156, 159, 159, 159, 159, 239, 4,
2772 239, 159, 159, 239, 159, 159, 159, 4, 4, 159,
2773 204, 239, 239, 156, 159, 198, 204, 157, 159, 159,
2774 159, 159, 157, 210, 210, 210, 210, 157, 210, 166,
2775 210, 210, 204, 22, 4, 201, 178, 179, 39, 204,
2776 195, 159, 166, 168, 239, 239, 17, 204, 249, 239,
2777 239, 239, 239, 198, 198, 240, 239, 159, 240, 240,
2778 240, 4, 239, 249, 239, 210, 210, 210, 210, 159,
2779 157, 159, 159, 251, 157, 157, 157, 193, 199, 200,
2780 22, 166, 159, 162, 193, 193, 157, 159, 164, 239,
2781 251, 157, 198, 157, 157, 157, 157, 210, 210, 210,
2782 157, 179, 54, 197, 17, 164, 176, 246, 121, 122,
2783 239, 239, 195, 17, 204, 164, 195, 157, 157, 157,
2784 4, 152, 196, 239, 237, 164, 176, 193, 193, 38,
2785 193, 193, 22, 159, 237, 17, 239, 239, 17, 159,
2786 239, 193, 193, 239, 17, 73, 239, 17, 239
Dan Gohmanf4423b12008-04-19 00:24:39 +00002787};
David Greene718fda32007-08-01 03:59:32 +00002788
Reid Spencer68a24bd2005-08-27 18:50:39 +00002789#define yyerrok (yyerrstatus = 0)
2790#define yyclearin (yychar = YYEMPTY)
Dan Gohmanf4423b12008-04-19 00:24:39 +00002791#define YYEMPTY (-2)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002792#define YYEOF 0
Dan Gohmanf4423b12008-04-19 00:24:39 +00002793
Reid Spencer68a24bd2005-08-27 18:50:39 +00002794#define YYACCEPT goto yyacceptlab
Dan Gohmanf4423b12008-04-19 00:24:39 +00002795#define YYABORT goto yyabortlab
2796#define YYERROR goto yyerrorlab
2797
2798
2799/* Like YYERROR except do call yyerror. This remains here temporarily
2800 to ease the transition to the new meaning of YYERROR, for GCC.
Reid Spencer68a24bd2005-08-27 18:50:39 +00002801 Once GCC version 2 has supplanted version 1, this can go. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00002802
Reid Spencer68a24bd2005-08-27 18:50:39 +00002803#define YYFAIL goto yyerrlab
Dan Gohmanf4423b12008-04-19 00:24:39 +00002804
Reid Spencer68a24bd2005-08-27 18:50:39 +00002805#define YYRECOVERING() (!!yyerrstatus)
Dan Gohmanf4423b12008-04-19 00:24:39 +00002806
2807#define YYBACKUP(Token, Value) \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002808do \
2809 if (yychar == YYEMPTY && yylen == 1) \
Dan Gohmanf4423b12008-04-19 00:24:39 +00002810 { \
2811 yychar = (Token); \
2812 yylval = (Value); \
2813 yytoken = YYTRANSLATE (yychar); \
2814 YYPOPSTACK (1); \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002815 goto yybackup; \
2816 } \
2817 else \
Dan Gohmanf4423b12008-04-19 00:24:39 +00002818 { \
2819 yyerror (YY_("syntax error: cannot back up")); \
2820 YYERROR; \
2821 } \
2822while (YYID (0))
2823
Anton Korobeynikov38e09802007-04-28 13:48:45 +00002824
Reid Spencer68a24bd2005-08-27 18:50:39 +00002825#define YYTERROR 1
2826#define YYERRCODE 256
2827
Dan Gohmanf4423b12008-04-19 00:24:39 +00002828
2829/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2830 If N is 0, then set CURRENT to the empty location which ends
2831 the previous symbol: RHS[0] (always defined). */
2832
2833#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2834#ifndef YYLLOC_DEFAULT
2835# define YYLLOC_DEFAULT(Current, Rhs, N) \
2836 do \
2837 if (YYID (N)) \
2838 { \
2839 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2840 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2841 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2842 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2843 } \
2844 else \
2845 { \
2846 (Current).first_line = (Current).last_line = \
2847 YYRHSLOC (Rhs, 0).last_line; \
2848 (Current).first_column = (Current).last_column = \
2849 YYRHSLOC (Rhs, 0).last_column; \
2850 } \
2851 while (YYID (0))
Reid Spencer68a24bd2005-08-27 18:50:39 +00002852#endif
2853
Dan Gohmanf4423b12008-04-19 00:24:39 +00002854
2855/* YY_LOCATION_PRINT -- Print the location on the stream.
2856 This macro was not mandated originally: define only if we know
2857 we won't break user code: when these are the locations we know. */
2858
2859#ifndef YY_LOCATION_PRINT
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002860# if YYLTYPE_IS_TRIVIAL
Dan Gohmanf4423b12008-04-19 00:24:39 +00002861# define YY_LOCATION_PRINT(File, Loc) \
2862 fprintf (File, "%d.%d-%d.%d", \
2863 (Loc).first_line, (Loc).first_column, \
2864 (Loc).last_line, (Loc).last_column)
2865# else
2866# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2867# endif
2868#endif
2869
2870
2871/* YYLEX -- calling `yylex' with the right arguments. */
2872
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00002873#ifdef YYLEX_PARAM
Dan Gohmanf4423b12008-04-19 00:24:39 +00002874# define YYLEX yylex (YYLEX_PARAM)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00002875#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00002876# define YYLEX yylex ()
Gabor Greife64d2482008-04-06 23:07:54 +00002877#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002878
2879/* Enable debugging if requested. */
2880#if YYDEBUG
2881
2882# ifndef YYFPRINTF
2883# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2884# define YYFPRINTF fprintf
2885# endif
2886
2887# define YYDPRINTF(Args) \
2888do { \
2889 if (yydebug) \
2890 YYFPRINTF Args; \
2891} while (YYID (0))
2892
2893# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2894do { \
2895 if (yydebug) \
2896 { \
2897 YYFPRINTF (stderr, "%s ", Title); \
2898 yy_symbol_print (stderr, \
2899 Type, Value); \
2900 YYFPRINTF (stderr, "\n"); \
2901 } \
2902} while (YYID (0))
2903
2904
2905/*--------------------------------.
2906| Print this symbol on YYOUTPUT. |
2907`--------------------------------*/
2908
2909/*ARGSUSED*/
2910#if (defined __STDC__ || defined __C99__FUNC__ \
2911 || defined __cplusplus || defined _MSC_VER)
2912static void
2913yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
Gabor Greife64d2482008-04-06 23:07:54 +00002914#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00002915static void
2916yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2917 FILE *yyoutput;
2918 int yytype;
2919 YYSTYPE const * const yyvaluep;
Gabor Greife64d2482008-04-06 23:07:54 +00002920#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002921{
2922 if (!yyvaluep)
2923 return;
2924# ifdef YYPRINT
2925 if (yytype < YYNTOKENS)
2926 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2927# else
2928 YYUSE (yyoutput);
2929# endif
2930 switch (yytype)
2931 {
2932 default:
2933 break;
2934 }
2935}
2936
2937
2938/*--------------------------------.
2939| Print this symbol on YYOUTPUT. |
2940`--------------------------------*/
2941
2942#if (defined __STDC__ || defined __C99__FUNC__ \
2943 || defined __cplusplus || defined _MSC_VER)
2944static void
2945yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2946#else
2947static void
2948yy_symbol_print (yyoutput, yytype, yyvaluep)
2949 FILE *yyoutput;
2950 int yytype;
2951 YYSTYPE const * const yyvaluep;
Scott Michel15dcd8e2008-01-30 03:10:00 +00002952#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002953{
2954 if (yytype < YYNTOKENS)
2955 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2956 else
2957 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
Chris Lattner38905612008-02-19 04:36:25 +00002958
Dan Gohmanf4423b12008-04-19 00:24:39 +00002959 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2960 YYFPRINTF (yyoutput, ")");
2961}
Chris Lattner38905612008-02-19 04:36:25 +00002962
Dan Gohmanf4423b12008-04-19 00:24:39 +00002963/*------------------------------------------------------------------.
2964| yy_stack_print -- Print the state stack from its BOTTOM up to its |
2965| TOP (included). |
2966`------------------------------------------------------------------*/
Chris Lattner38905612008-02-19 04:36:25 +00002967
Dan Gohmanf4423b12008-04-19 00:24:39 +00002968#if (defined __STDC__ || defined __C99__FUNC__ \
2969 || defined __cplusplus || defined _MSC_VER)
2970static void
2971yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
2972#else
2973static void
2974yy_stack_print (bottom, top)
2975 yytype_int16 *bottom;
2976 yytype_int16 *top;
Scott Michel15dcd8e2008-01-30 03:10:00 +00002977#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002978{
2979 YYFPRINTF (stderr, "Stack now");
2980 for (; bottom <= top; ++bottom)
2981 YYFPRINTF (stderr, " %d", *bottom);
2982 YYFPRINTF (stderr, "\n");
2983}
Chris Lattner38905612008-02-19 04:36:25 +00002984
Dan Gohmanf4423b12008-04-19 00:24:39 +00002985# define YY_STACK_PRINT(Bottom, Top) \
2986do { \
2987 if (yydebug) \
2988 yy_stack_print ((Bottom), (Top)); \
2989} while (YYID (0))
Chris Lattner38905612008-02-19 04:36:25 +00002990
Dan Gohmanf4423b12008-04-19 00:24:39 +00002991
2992/*------------------------------------------------.
2993| Report that the YYRULE is going to be reduced. |
2994`------------------------------------------------*/
2995
2996#if (defined __STDC__ || defined __C99__FUNC__ \
2997 || defined __cplusplus || defined _MSC_VER)
2998static void
2999yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
3000#else
3001static void
3002yy_reduce_print (yyvsp, yyrule)
3003 YYSTYPE *yyvsp;
3004 int yyrule;
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00003005#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003006{
3007 int yynrhs = yyr2[yyrule];
3008 int yyi;
3009 unsigned long int yylno = yyrline[yyrule];
3010 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
3011 yyrule - 1, yylno);
3012 /* The symbols being reduced. */
3013 for (yyi = 0; yyi < yynrhs; yyi++)
3014 {
3015 fprintf (stderr, " $%d = ", yyi + 1);
3016 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
3017 &(yyvsp[(yyi + 1) - (yynrhs)])
3018 );
3019 fprintf (stderr, "\n");
3020 }
3021}
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003022
Dan Gohmanf4423b12008-04-19 00:24:39 +00003023# define YY_REDUCE_PRINT(Rule) \
3024do { \
3025 if (yydebug) \
3026 yy_reduce_print (yyvsp, Rule); \
3027} while (YYID (0))
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003028
Dan Gohmanf4423b12008-04-19 00:24:39 +00003029/* Nonzero means print parse trace. It is left uninitialized so that
3030 multiple parsers can coexist. */
3031int yydebug;
3032#else /* !YYDEBUG */
3033# define YYDPRINTF(Args)
3034# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
3035# define YY_STACK_PRINT(Bottom, Top)
3036# define YY_REDUCE_PRINT(Rule)
3037#endif /* !YYDEBUG */
3038
3039
3040/* YYINITDEPTH -- initial size of the parser's stacks. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003041#ifndef YYINITDEPTH
Dan Gohmanf4423b12008-04-19 00:24:39 +00003042# define YYINITDEPTH 200
Reid Spencer68a24bd2005-08-27 18:50:39 +00003043#endif
3044
Dan Gohmanf4423b12008-04-19 00:24:39 +00003045/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
3046 if the built-in stack extension method is used).
Reid Spencer68a24bd2005-08-27 18:50:39 +00003047
Dan Gohmanf4423b12008-04-19 00:24:39 +00003048 Do not make this value too large; the results are undefined if
3049 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
3050 evaluated with infinite-precision integer arithmetic. */
David Greene718fda32007-08-01 03:59:32 +00003051
Reid Spencer68a24bd2005-08-27 18:50:39 +00003052#ifndef YYMAXDEPTH
Dan Gohmanf4423b12008-04-19 00:24:39 +00003053# define YYMAXDEPTH 10000
Reid Spencer68a24bd2005-08-27 18:50:39 +00003054#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003055
Reid Spencer68a24bd2005-08-27 18:50:39 +00003056
3057
Dan Gohmanf4423b12008-04-19 00:24:39 +00003058#if YYERROR_VERBOSE
Reid Spencer68a24bd2005-08-27 18:50:39 +00003059
Dan Gohmanf4423b12008-04-19 00:24:39 +00003060# ifndef yystrlen
3061# if defined __GLIBC__ && defined _STRING_H
3062# define yystrlen strlen
3063# else
3064/* Return the length of YYSTR. */
3065#if (defined __STDC__ || defined __C99__FUNC__ \
3066 || defined __cplusplus || defined _MSC_VER)
3067static YYSIZE_T
3068yystrlen (const char *yystr)
Chris Lattner38905612008-02-19 04:36:25 +00003069#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00003070static YYSIZE_T
3071yystrlen (yystr)
3072 const char *yystr;
3073#endif
3074{
3075 YYSIZE_T yylen;
3076 for (yylen = 0; yystr[yylen]; yylen++)
3077 continue;
3078 return yylen;
3079}
3080# endif
3081# endif
3082
3083# ifndef yystpcpy
3084# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
3085# define yystpcpy stpcpy
3086# else
3087/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
3088 YYDEST. */
3089#if (defined __STDC__ || defined __C99__FUNC__ \
3090 || defined __cplusplus || defined _MSC_VER)
3091static char *
3092yystpcpy (char *yydest, const char *yysrc)
3093#else
3094static char *
3095yystpcpy (yydest, yysrc)
3096 char *yydest;
3097 const char *yysrc;
3098#endif
3099{
3100 char *yyd = yydest;
3101 const char *yys = yysrc;
3102
3103 while ((*yyd++ = *yys++) != '\0')
3104 continue;
3105
3106 return yyd - 1;
3107}
3108# endif
3109# endif
3110
3111# ifndef yytnamerr
3112/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3113 quotes and backslashes, so that it's suitable for yyerror. The
3114 heuristic is that double-quoting is unnecessary unless the string
3115 contains an apostrophe, a comma, or backslash (other than
3116 backslash-backslash). YYSTR is taken from yytname. If YYRES is
3117 null, do not copy; instead, return the length of what the result
3118 would have been. */
3119static YYSIZE_T
3120yytnamerr (char *yyres, const char *yystr)
3121{
3122 if (*yystr == '"')
3123 {
3124 YYSIZE_T yyn = 0;
3125 char const *yyp = yystr;
3126
3127 for (;;)
3128 switch (*++yyp)
3129 {
3130 case '\'':
3131 case ',':
3132 goto do_not_strip_quotes;
3133
3134 case '\\':
3135 if (*++yyp != '\\')
3136 goto do_not_strip_quotes;
3137 /* Fall through. */
3138 default:
3139 if (yyres)
3140 yyres[yyn] = *yyp;
3141 yyn++;
3142 break;
3143
3144 case '"':
3145 if (yyres)
3146 yyres[yyn] = '\0';
3147 return yyn;
3148 }
3149 do_not_strip_quotes: ;
3150 }
3151
3152 if (! yyres)
3153 return yystrlen (yystr);
3154
3155 return yystpcpy (yyres, yystr) - yyres;
3156}
3157# endif
3158
3159/* Copy into YYRESULT an error message about the unexpected token
3160 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3161 including the terminating null byte. If YYRESULT is null, do not
3162 copy anything; just return the number of bytes that would be
3163 copied. As a special case, return 0 if an ordinary "syntax error"
3164 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3165 size calculation. */
3166static YYSIZE_T
3167yysyntax_error (char *yyresult, int yystate, int yychar)
3168{
3169 int yyn = yypact[yystate];
3170
3171 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3172 return 0;
3173 else
3174 {
3175 int yytype = YYTRANSLATE (yychar);
3176 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3177 YYSIZE_T yysize = yysize0;
3178 YYSIZE_T yysize1;
3179 int yysize_overflow = 0;
3180 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3181 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3182 int yyx;
3183
3184# if 0
3185 /* This is so xgettext sees the translatable formats that are
3186 constructed on the fly. */
3187 YY_("syntax error, unexpected %s");
3188 YY_("syntax error, unexpected %s, expecting %s");
3189 YY_("syntax error, unexpected %s, expecting %s or %s");
3190 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3191 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3192# endif
3193 char *yyfmt;
3194 char const *yyf;
3195 static char const yyunexpected[] = "syntax error, unexpected %s";
3196 static char const yyexpecting[] = ", expecting %s";
3197 static char const yyor[] = " or %s";
3198 char yyformat[sizeof yyunexpected
3199 + sizeof yyexpecting - 1
3200 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3201 * (sizeof yyor - 1))];
3202 char const *yyprefix = yyexpecting;
3203
3204 /* Start YYX at -YYN if negative to avoid negative indexes in
3205 YYCHECK. */
3206 int yyxbegin = yyn < 0 ? -yyn : 0;
3207
3208 /* Stay within bounds of both yycheck and yytname. */
3209 int yychecklim = YYLAST - yyn + 1;
3210 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3211 int yycount = 1;
3212
3213 yyarg[0] = yytname[yytype];
3214 yyfmt = yystpcpy (yyformat, yyunexpected);
3215
3216 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3217 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3218 {
3219 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3220 {
3221 yycount = 1;
3222 yysize = yysize0;
3223 yyformat[sizeof yyunexpected - 1] = '\0';
3224 break;
3225 }
3226 yyarg[yycount++] = yytname[yyx];
3227 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3228 yysize_overflow |= (yysize1 < yysize);
3229 yysize = yysize1;
3230 yyfmt = yystpcpy (yyfmt, yyprefix);
3231 yyprefix = yyor;
3232 }
3233
3234 yyf = YY_(yyformat);
3235 yysize1 = yysize + yystrlen (yyf);
3236 yysize_overflow |= (yysize1 < yysize);
3237 yysize = yysize1;
3238
3239 if (yysize_overflow)
3240 return YYSIZE_MAXIMUM;
3241
3242 if (yyresult)
3243 {
3244 /* Avoid sprintf, as that infringes on the user's name space.
3245 Don't have undefined behavior even if the translation
3246 produced a string with the wrong number of "%s"s. */
3247 char *yyp = yyresult;
3248 int yyi = 0;
3249 while ((*yyp = *yyf) != '\0')
3250 {
3251 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3252 {
3253 yyp += yytnamerr (yyp, yyarg[yyi++]);
3254 yyf += 2;
3255 }
3256 else
3257 {
3258 yyp++;
3259 yyf++;
3260 }
3261 }
3262 }
3263 return yysize;
3264 }
3265}
3266#endif /* YYERROR_VERBOSE */
3267
3268
3269/*-----------------------------------------------.
3270| Release the memory associated to this symbol. |
3271`-----------------------------------------------*/
3272
3273/*ARGSUSED*/
3274#if (defined __STDC__ || defined __C99__FUNC__ \
3275 || defined __cplusplus || defined _MSC_VER)
3276static void
3277yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3278#else
3279static void
3280yydestruct (yymsg, yytype, yyvaluep)
3281 const char *yymsg;
3282 int yytype;
3283 YYSTYPE *yyvaluep;
3284#endif
3285{
3286 YYUSE (yyvaluep);
3287
3288 if (!yymsg)
3289 yymsg = "Deleting";
3290 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3291
3292 switch (yytype)
3293 {
3294
3295 default:
3296 break;
3297 }
3298}
3299
3300
3301/* Prevent warnings from -Wmissing-prototypes. */
3302
3303#ifdef YYPARSE_PARAM
3304#if defined __STDC__ || defined __cplusplus
3305int yyparse (void *YYPARSE_PARAM);
3306#else
3307int yyparse ();
3308#endif
3309#else /* ! YYPARSE_PARAM */
3310#if defined __STDC__ || defined __cplusplus
David Greene5fd22a82007-09-04 18:46:50 +00003311int yyparse (void);
Gabor Greife64d2482008-04-06 23:07:54 +00003312#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00003313int yyparse ();
Scott Michel15dcd8e2008-01-30 03:10:00 +00003314#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003315#endif /* ! YYPARSE_PARAM */
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003316
Chris Lattner38905612008-02-19 04:36:25 +00003317
Dan Gohmanf4423b12008-04-19 00:24:39 +00003318
3319/* The look-ahead symbol. */
3320int yychar;
3321
3322/* The semantic value of the look-ahead symbol. */
3323YYSTYPE yylval;
3324
3325/* Number of syntax errors so far. */
3326int yynerrs;
3327
3328
3329
3330/*----------.
3331| yyparse. |
3332`----------*/
3333
3334#ifdef YYPARSE_PARAM
3335#if (defined __STDC__ || defined __C99__FUNC__ \
3336 || defined __cplusplus || defined _MSC_VER)
3337int
3338yyparse (void *YYPARSE_PARAM)
3339#else
3340int
3341yyparse (YYPARSE_PARAM)
3342 void *YYPARSE_PARAM;
3343#endif
3344#else /* ! YYPARSE_PARAM */
3345#if (defined __STDC__ || defined __C99__FUNC__ \
3346 || defined __cplusplus || defined _MSC_VER)
3347int
3348yyparse (void)
3349#else
3350int
3351yyparse ()
3352
Gabor Greife64d2482008-04-06 23:07:54 +00003353#endif
3354#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003355{
3356
3357 int yystate;
3358 int yyn;
3359 int yyresult;
3360 /* Number of tokens to shift before error messages enabled. */
3361 int yyerrstatus;
3362 /* Look-ahead token as an internal (translated) token number. */
3363 int yytoken = 0;
3364#if YYERROR_VERBOSE
3365 /* Buffer for error messages, and its allocated size. */
3366 char yymsgbuf[128];
3367 char *yymsg = yymsgbuf;
3368 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
Gabor Greife64d2482008-04-06 23:07:54 +00003369#endif
Chris Lattner38905612008-02-19 04:36:25 +00003370
Dan Gohmanf4423b12008-04-19 00:24:39 +00003371 /* Three stacks and their tools:
3372 `yyss': related to states,
3373 `yyvs': related to semantic values,
3374 `yyls': related to locations.
3375
3376 Refer to the stacks thru separate pointers, to allow yyoverflow
3377 to reallocate them elsewhere. */
3378
3379 /* The state stack. */
3380 yytype_int16 yyssa[YYINITDEPTH];
3381 yytype_int16 *yyss = yyssa;
3382 yytype_int16 *yyssp;
3383
3384 /* The semantic value stack. */
3385 YYSTYPE yyvsa[YYINITDEPTH];
3386 YYSTYPE *yyvs = yyvsa;
3387 YYSTYPE *yyvsp;
3388
3389
3390
3391#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3392
3393 YYSIZE_T yystacksize = YYINITDEPTH;
3394
3395 /* The variables used to return semantic value and location from the
3396 action routines. */
3397 YYSTYPE yyval;
3398
3399
3400 /* The number of symbols on the RHS of the reduced rule.
3401 Keep to zero when no symbol should be popped. */
3402 int yylen = 0;
3403
3404 YYDPRINTF ((stderr, "Starting parse\n"));
3405
Reid Spencer68a24bd2005-08-27 18:50:39 +00003406 yystate = 0;
3407 yyerrstatus = 0;
3408 yynerrs = 0;
3409 yychar = YYEMPTY; /* Cause a token to be read. */
3410
3411 /* Initialize stack pointers.
3412 Waste one element of value and location stack
3413 so that they stay on the same level as the state stack.
3414 The wasted elements are never initialized. */
3415
Dan Gohmanf4423b12008-04-19 00:24:39 +00003416 yyssp = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003417 yyvsp = yyvs;
3418
Dan Gohmanf4423b12008-04-19 00:24:39 +00003419 goto yysetstate;
Jeff Cohen66c5fd62005-10-23 04:37:20 +00003420
Dan Gohmanf4423b12008-04-19 00:24:39 +00003421/*------------------------------------------------------------.
3422| yynewstate -- Push a new state, which is found in yystate. |
3423`------------------------------------------------------------*/
3424 yynewstate:
3425 /* In all cases, when you get here, the value and location stacks
3426 have just been pushed. So pushing a state here evens the stacks. */
3427 yyssp++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003428
Dan Gohmanf4423b12008-04-19 00:24:39 +00003429 yysetstate:
3430 *yyssp = yystate;
3431
3432 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003433 {
3434 /* Get the current used size of the three stacks, in elements. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003435 YYSIZE_T yysize = yyssp - yyss + 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003436
3437#ifdef yyoverflow
Dan Gohmanf4423b12008-04-19 00:24:39 +00003438 {
3439 /* Give user a chance to reallocate the stack. Use copies of
3440 these so that the &'s don't force the real ones into
3441 memory. */
3442 YYSTYPE *yyvs1 = yyvs;
3443 yytype_int16 *yyss1 = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003444
Dan Gohmanf4423b12008-04-19 00:24:39 +00003445
3446 /* Each stack pointer address is followed by the size of the
3447 data in use in that stack, in bytes. This used to be a
3448 conditional around just the two extra args, but that might
3449 be undefined if yyoverflow is a macro. */
3450 yyoverflow (YY_("memory exhausted"),
3451 &yyss1, yysize * sizeof (*yyssp),
3452 &yyvs1, yysize * sizeof (*yyvsp),
3453
3454 &yystacksize);
3455
3456 yyss = yyss1;
3457 yyvs = yyvs1;
3458 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00003459#else /* no yyoverflow */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003460# ifndef YYSTACK_RELOCATE
3461 goto yyexhaustedlab;
3462# else
Reid Spencer68a24bd2005-08-27 18:50:39 +00003463 /* Extend the stack our own way. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003464 if (YYMAXDEPTH <= yystacksize)
3465 goto yyexhaustedlab;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003466 yystacksize *= 2;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003467 if (YYMAXDEPTH < yystacksize)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003468 yystacksize = YYMAXDEPTH;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003469
3470 {
3471 yytype_int16 *yyss1 = yyss;
3472 union yyalloc *yyptr =
3473 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3474 if (! yyptr)
3475 goto yyexhaustedlab;
3476 YYSTACK_RELOCATE (yyss);
3477 YYSTACK_RELOCATE (yyvs);
3478
3479# undef YYSTACK_RELOCATE
3480 if (yyss1 != yyssa)
3481 YYSTACK_FREE (yyss1);
3482 }
3483# endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00003484#endif /* no yyoverflow */
3485
Dan Gohmanf4423b12008-04-19 00:24:39 +00003486 yyssp = yyss + yysize - 1;
3487 yyvsp = yyvs + yysize - 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003488
3489
Dan Gohmanf4423b12008-04-19 00:24:39 +00003490 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3491 (unsigned long int) yystacksize));
3492
3493 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003494 YYABORT;
3495 }
3496
Dan Gohmanf4423b12008-04-19 00:24:39 +00003497 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003498
3499 goto yybackup;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003500
Dan Gohmanf4423b12008-04-19 00:24:39 +00003501/*-----------.
3502| yybackup. |
3503`-----------*/
3504yybackup:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003505
Dan Gohmanf4423b12008-04-19 00:24:39 +00003506 /* Do appropriate processing given the current state. Read a
3507 look-ahead token if we need one and don't already have one. */
Reid Spencer7780acb2007-04-16 06:56:07 +00003508
Dan Gohmanf4423b12008-04-19 00:24:39 +00003509 /* First try to decide what to do without reference to look-ahead token. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003510 yyn = yypact[yystate];
Dan Gohmanf4423b12008-04-19 00:24:39 +00003511 if (yyn == YYPACT_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003512 goto yydefault;
3513
Dan Gohmanf4423b12008-04-19 00:24:39 +00003514 /* Not known => get a look-ahead token if don't already have one. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003515
Dan Gohmanf4423b12008-04-19 00:24:39 +00003516 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003517 if (yychar == YYEMPTY)
3518 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003519 YYDPRINTF ((stderr, "Reading a token: "));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003520 yychar = YYLEX;
3521 }
3522
Dan Gohmanf4423b12008-04-19 00:24:39 +00003523 if (yychar <= YYEOF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003524 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003525 yychar = yytoken = YYEOF;
3526 YYDPRINTF ((stderr, "Now at end of input.\n"));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003527 }
3528 else
3529 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003530 yytoken = YYTRANSLATE (yychar);
3531 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Reid Spencer68a24bd2005-08-27 18:50:39 +00003532 }
3533
Dan Gohmanf4423b12008-04-19 00:24:39 +00003534 /* If the proper action on seeing token YYTOKEN is to reduce or to
3535 detect an error, take that action. */
3536 yyn += yytoken;
3537 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003538 goto yydefault;
3539 yyn = yytable[yyn];
Dan Gohmanf4423b12008-04-19 00:24:39 +00003540 if (yyn <= 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003541 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003542 if (yyn == 0 || yyn == YYTABLE_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003543 goto yyerrlab;
3544 yyn = -yyn;
3545 goto yyreduce;
3546 }
3547
3548 if (yyn == YYFINAL)
3549 YYACCEPT;
3550
Dan Gohmanf4423b12008-04-19 00:24:39 +00003551 /* Count tokens shifted since error; after three, turn off error
3552 status. */
3553 if (yyerrstatus)
3554 yyerrstatus--;
Dale Johannesencdd509a2007-09-07 21:07:57 +00003555
Dan Gohmanf4423b12008-04-19 00:24:39 +00003556 /* Shift the look-ahead token. */
3557 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003558
Dan Gohmanf4423b12008-04-19 00:24:39 +00003559 /* Discard the shifted token unless it is eof. */
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003560 if (yychar != YYEOF)
3561 yychar = YYEMPTY;
3562
Gabor Greife64d2482008-04-06 23:07:54 +00003563 yystate = yyn;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003564 *++yyvsp = yylval;
3565
Reid Spencer68a24bd2005-08-27 18:50:39 +00003566 goto yynewstate;
3567
Gabor Greife64d2482008-04-06 23:07:54 +00003568
Dan Gohmanf4423b12008-04-19 00:24:39 +00003569/*-----------------------------------------------------------.
3570| yydefault -- do the default action for the current state. |
3571`-----------------------------------------------------------*/
3572yydefault:
Reid Spencer68a24bd2005-08-27 18:50:39 +00003573 yyn = yydefact[yystate];
3574 if (yyn == 0)
3575 goto yyerrlab;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003576 goto yyreduce;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003577
Dan Gohmanf4423b12008-04-19 00:24:39 +00003578
3579/*-----------------------------.
3580| yyreduce -- Do a reduction. |
3581`-----------------------------*/
Reid Spencer68a24bd2005-08-27 18:50:39 +00003582yyreduce:
Dan Gohmanf4423b12008-04-19 00:24:39 +00003583 /* yyn is the number of a rule to reduce with. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003584 yylen = yyr2[yyn];
3585
Dan Gohmanf4423b12008-04-19 00:24:39 +00003586 /* If YYLEN is nonzero, implement the default value of the action:
3587 `$$ = $1'.
3588
3589 Otherwise, the following line sets YYVAL to garbage.
3590 This behavior is undocumented and Bison
3591 users should not rely upon it. Assigning to YYVAL
3592 unconditionally makes the parser a bit smaller, and it avoids a
3593 GCC warning that YYVAL may be used uninitialized. */
3594 yyval = yyvsp[1-yylen];
3595
3596
3597 YY_REDUCE_PRINT (yyn);
3598 switch (yyn)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003599 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003600 case 29:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003601#line 1124 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003602 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3603 break;
Reid Spencer41dff5e2007-01-26 08:05:27 +00003604
Dan Gohmanf4423b12008-04-19 00:24:39 +00003605 case 30:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003606#line 1124 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003607 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3608 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003609
Dan Gohmanf4423b12008-04-19 00:24:39 +00003610 case 31:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003611#line 1125 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003612 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3613 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003614
Dan Gohmanf4423b12008-04-19 00:24:39 +00003615 case 32:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003616#line 1125 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003617 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3618 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003619
Dan Gohmanf4423b12008-04-19 00:24:39 +00003620 case 33:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003621#line 1126 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003622 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3623 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003624
Dan Gohmanf4423b12008-04-19 00:24:39 +00003625 case 34:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003626#line 1126 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003627 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3628 break;
3629
3630 case 35:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003631#line 1127 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003632 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3633 break;
3634
3635 case 36:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003636#line 1127 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003637 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3638 break;
3639
3640 case 37:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003641#line 1128 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003642 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3643 break;
3644
3645 case 38:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003646#line 1128 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003647 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3648 break;
3649
3650 case 39:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003651#line 1132 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003652 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3653 break;
3654
3655 case 40:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003656#line 1132 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003657 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3658 break;
3659
3660 case 41:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003661#line 1133 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003662 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3663 break;
3664
3665 case 42:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003666#line 1133 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003667 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3668 break;
3669
3670 case 43:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003671#line 1134 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003672 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3673 break;
3674
3675 case 44:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003676#line 1134 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003677 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3678 break;
3679
3680 case 45:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003681#line 1135 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003682 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3683 break;
3684
3685 case 46:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003686#line 1135 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003687 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3688 break;
3689
3690 case 47:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003691#line 1136 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003692 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3693 break;
3694
3695 case 48:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003696#line 1136 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003697 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3698 break;
3699
3700 case 49:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003701#line 1137 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003702 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3703 break;
3704
3705 case 50:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003706#line 1137 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003707 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3708 break;
3709
3710 case 51:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003711#line 1138 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003712 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3713 break;
3714
3715 case 52:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003716#line 1138 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003717 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3718 break;
3719
3720 case 53:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003721#line 1139 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003722 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3723 break;
3724
3725 case 54:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003726#line 1140 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003727 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3728 break;
3729
3730 case 65:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003731#line 1149 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003732 { (yyval.StrVal) = 0; ;}
3733 break;
3734
3735 case 66:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003736#line 1151 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003737 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3738 break;
3739
3740 case 67:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003741#line 1152 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003742 { (yyval.UIntVal)=0; ;}
3743 break;
3744
3745 case 68:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003746#line 1156 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003747 {
3748 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003749 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003750 ;}
3751 break;
3752
3753 case 69:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003754#line 1160 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003755 {
3756 (yyval.StrVal) = 0;
Christopher Lambbf3348d2007-12-12 08:45:45 +00003757 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003758 ;}
3759 break;
3760
3761 case 73:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003762#line 1168 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003763 {
3764 (yyval.StrVal) = 0;
Christopher Lambbf3348d2007-12-12 08:45:45 +00003765 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003766 ;}
3767 break;
3768
3769 case 74:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003770#line 1173 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003771 {
3772 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00003773 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003774 ;}
3775 break;
3776
3777 case 75:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003778#line 1179 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003779 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3780 break;
3781
3782 case 76:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003783#line 1180 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003784 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3785 break;
3786
3787 case 77:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003788#line 1181 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003789 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3790 break;
3791
3792 case 78:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003793#line 1182 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003794 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3795 break;
3796
3797 case 79:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003798#line 1183 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003799 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3800 break;
3801
3802 case 80:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003803#line 1184 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003804 { (yyval.Linkage) = GlobalValue::CommonLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003805 break;
3806
3807 case 81:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003808#line 1188 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003809 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003810 break;
3811
3812 case 82:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003813#line 1189 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003814 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003815 break;
3816
3817 case 83:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003818#line 1190 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003819 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003820 break;
3821
3822 case 84:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003823#line 1194 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003824 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3825 break;
3826
3827 case 85:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003828#line 1195 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003829 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003830 break;
3831
3832 case 86:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003833#line 1196 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003834 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003835 break;
3836
3837 case 87:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003838#line 1197 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003839 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003840 break;
3841
3842 case 88:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003843#line 1201 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003844 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3845 break;
3846
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003847 case 89:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003848#line 1202 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003849 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3850 break;
3851
3852 case 90:
3853#line 1203 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3854 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3855 break;
3856
3857 case 91:
3858#line 1207 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3859 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3860 break;
3861
3862 case 92:
3863#line 1208 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003864 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3865 break;
3866
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003867 case 93:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003868#line 1209 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003869 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3870 break;
3871
3872 case 94:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003873#line 1210 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003874 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3875 break;
3876
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003877 case 95:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003878#line 1211 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003879 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3880 break;
3881
3882 case 96:
3883#line 1215 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3884 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3885 break;
3886
3887 case 97:
3888#line 1216 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3889 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3890 break;
3891
3892 case 98:
3893#line 1217 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003894 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003895 break;
3896
3897 case 99:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003898#line 1220 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003899 { (yyval.UIntVal) = CallingConv::C; ;}
3900 break;
3901
3902 case 100:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003903#line 1221 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003904 { (yyval.UIntVal) = CallingConv::C; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003905 break;
3906
3907 case 101:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003908#line 1222 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003909 { (yyval.UIntVal) = CallingConv::Fast; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003910 break;
3911
3912 case 102:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003913#line 1223 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003914 { (yyval.UIntVal) = CallingConv::Cold; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003915 break;
3916
3917 case 103:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003918#line 1224 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003919 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003920 break;
3921
3922 case 104:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003923#line 1225 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003924 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3925 break;
3926
3927 case 105:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003928#line 1226 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003929 {
3930 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003931 GEN_ERROR("Calling conv too large");
Dan Gohmanf4423b12008-04-19 00:24:39 +00003932 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003933 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003934 ;}
3935 break;
3936
Dan Gohmanf4423b12008-04-19 00:24:39 +00003937 case 106:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003938#line 1233 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003939 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3940 break;
3941
3942 case 107:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003943#line 1234 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003944 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003945 break;
3946
3947 case 108:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003948#line 1235 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003949 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3950 break;
3951
3952 case 109:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003953#line 1236 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003954 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003955 break;
3956
3957 case 110:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003958#line 1237 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003959 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003960 break;
3961
3962 case 111:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003963#line 1238 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003964 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003965 break;
3966
3967 case 112:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003968#line 1239 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003969 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003970 break;
3971
3972 case 113:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003973#line 1240 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003974 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003975 break;
3976
3977 case 114:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003978#line 1241 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003979 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
3980 break;
3981
3982 case 115:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003983#line 1242 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003984 { (yyval.ParamAttrs) =
3985 ParamAttr::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
3986 break;
3987
Dan Gohmanf4423b12008-04-19 00:24:39 +00003988 case 116:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003989#line 1246 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003990 { (yyval.ParamAttrs) = ParamAttr::None; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003991 break;
3992
3993 case 117:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003994#line 1247 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003995 {
3996 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3997 ;}
3998 break;
3999
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004000 case 118:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004001#line 1252 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004002 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
4003 break;
4004
4005 case 119:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004006#line 1253 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004007 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
4008 break;
4009
4010 case 120:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004011#line 1254 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004012 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
4013 break;
4014
4015 case 121:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004016#line 1255 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004017 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
4018 break;
4019
4020 case 122:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004021#line 1256 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004022 { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
4023 break;
4024
4025 case 123:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004026#line 1257 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004027 { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
4028 break;
4029
4030 case 124:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004031#line 1260 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004032 { (yyval.ParamAttrs) = ParamAttr::None; ;}
4033 break;
4034
Dan Gohmanf4423b12008-04-19 00:24:39 +00004035 case 125:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004036#line 1261 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004037 {
4038 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
4039 ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004040 break;
4041
4042 case 126:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004043#line 1266 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004044 { (yyval.StrVal) = 0; ;}
4045 break;
4046
4047 case 127:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004048#line 1267 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004049 {
4050 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
4051 ;}
4052 break;
4053
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004054 case 128:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004055#line 1274 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004056 { (yyval.UIntVal) = 0; ;}
4057 break;
4058
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004059 case 129:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004060#line 1275 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004061 {
4062 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
4063 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004064 GEN_ERROR("Alignment must be a power of two");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004065 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004066;}
4067 break;
4068
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004069 case 130:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004070#line 1281 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004071 { (yyval.UIntVal) = 0; ;}
4072 break;
4073
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004074 case 131:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004075#line 1282 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004076 {
4077 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
4078 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Christopher Lambbf3348d2007-12-12 08:45:45 +00004079 GEN_ERROR("Alignment must be a power of two");
4080 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004081;}
4082 break;
4083
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004084 case 132:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004085#line 1291 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004086 {
4087 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
4088 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004089 GEN_ERROR("Invalid character in section name");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004090 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004091 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004092;}
4093 break;
4094
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004095 case 133:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004096#line 1299 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004097 { (yyval.StrVal) = 0; ;}
4098 break;
4099
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004100 case 134:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004101#line 1300 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004102 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
4103 break;
4104
Dan Gohmanf4423b12008-04-19 00:24:39 +00004105 case 135:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004106#line 1305 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004107 {;}
4108 break;
4109
4110 case 136:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004111#line 1306 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004112 {;}
4113 break;
4114
4115 case 137:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004116#line 1307 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004117 {
4118 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
4119 delete (yyvsp[(1) - (1)].StrVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004120 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004121 ;}
4122 break;
4123
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004124 case 138:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004125#line 1312 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004126 {
4127 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004128 GEN_ERROR("Alignment must be a power of two");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004129 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004130 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004131 ;}
4132 break;
4133
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004134 case 146:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004135#line 1328 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004136 {
4137 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004138 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004139 ;}
4140 break;
4141
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004142 case 147:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004143#line 1332 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004144 {
4145 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004146 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004147 ;}
4148 break;
4149
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004150 case 148:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004151#line 1336 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004152 { // Pointer type?
4153 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
Christopher Lambbf3348d2007-12-12 08:45:45 +00004154 GEN_ERROR("Cannot form a pointer to a basic block");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004155 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4156 delete (yyvsp[(1) - (3)].TypeVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00004157 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004158 ;}
4159 break;
4160
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004161 case 149:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004162#line 1343 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004163 { // Named types are also simple types...
4164 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00004165 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004166 (yyval.TypeVal) = new PATypeHolder(tmp);
4167 ;}
4168 break;
4169
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004170 case 150:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004171#line 1348 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004172 { // Type UpReference
4173 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004174 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Dan Gohmanf4423b12008-04-19 00:24:39 +00004175 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4176 (yyval.TypeVal) = new PATypeHolder(OT);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004177 UR_OUT("New Upreference!\n");
4178 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004179 ;}
4180 break;
4181
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004182 case 151:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004183#line 1356 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004184 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004185 // Allow but ignore attributes on function types; this permits auto-upgrade.
4186 // FIXME: remove in LLVM 3.0.
Chris Lattnera925a142008-04-23 05:37:08 +00004187 const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal);
4188 if (!FunctionType::isValidReturnType(RetTy))
4189 GEN_ERROR("Invalid result type for LLVM function");
4190
Reid Spencer41dff5e2007-01-26 08:05:27 +00004191 std::vector<const Type*> Params;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004192 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00004193 for (; I != E; ++I ) {
Reid Spencer66728ef2007-03-20 01:13:36 +00004194 const Type *Ty = I->Ty->get();
Reid Spencer66728ef2007-03-20 01:13:36 +00004195 Params.push_back(Ty);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004196 }
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004197
Reid Spencer41dff5e2007-01-26 08:05:27 +00004198 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4199 if (isVarArg) Params.pop_back();
4200
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004201 for (unsigned i = 0; i != Params.size(); ++i)
4202 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4203 GEN_ERROR("Function arguments must be value types!");
4204
4205 CHECK_FOR_ERROR
4206
Anton Korobeynikovc36284e2007-12-03 19:17:47 +00004207 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004208 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4209 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4210 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Reid Spencere4d87aa2006-12-23 06:05:41 +00004211 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004212 ;}
4213 break;
4214
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004215 case 152:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004216#line 1385 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004217 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004218 // Allow but ignore attributes on function types; this permits auto-upgrade.
4219 // FIXME: remove in LLVM 3.0.
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004220 std::vector<const Type*> Params;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004221 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00004222 for ( ; I != E; ++I ) {
Reid Spencer66728ef2007-03-20 01:13:36 +00004223 const Type* Ty = I->Ty->get();
Reid Spencer66728ef2007-03-20 01:13:36 +00004224 Params.push_back(Ty);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004225 }
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004226
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004227 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4228 if (isVarArg) Params.pop_back();
4229
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004230 for (unsigned i = 0; i != Params.size(); ++i)
4231 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4232 GEN_ERROR("Function arguments must be value types!");
4233
4234 CHECK_FOR_ERROR
4235
Dan Gohmanf4423b12008-04-19 00:24:39 +00004236 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4237 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4238 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004239 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004240 ;}
4241 break;
4242
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004243 case 153:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004244#line 1410 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004245 { // Sized array type?
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004246 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (yyvsp[(2) - (5)].UInt64Val))));
Dan Gohmanf4423b12008-04-19 00:24:39 +00004247 delete (yyvsp[(4) - (5)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004248 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004249 ;}
4250 break;
4251
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004252 case 154:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004253#line 1415 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004254 { // Vector type?
4255 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4256 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004257 GEN_ERROR("Unsigned result not equal to signed result");
4258 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4259 GEN_ERROR("Element type of a VectorType must be primitive");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004260 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4261 delete (yyvsp[(4) - (5)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004262 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004263 ;}
4264 break;
4265
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004266 case 155:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004267#line 1425 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004268 { // Structure type?
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004269 std::vector<const Type*> Elements;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004270 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4271 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004272 Elements.push_back(*I);
4273
Dan Gohmanf4423b12008-04-19 00:24:39 +00004274 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4275 delete (yyvsp[(2) - (3)].TypeList);
Reid Spencer14310612006-12-31 05:40:51 +00004276 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004277 ;}
4278 break;
4279
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004280 case 156:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004281#line 1435 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004282 { // Empty structure type?
4283 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Reid Spencer14310612006-12-31 05:40:51 +00004284 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004285 ;}
4286 break;
4287
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004288 case 157:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004289#line 1439 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004290 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004291 std::vector<const Type*> Elements;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004292 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4293 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004294 Elements.push_back(*I);
4295
Dan Gohmanf4423b12008-04-19 00:24:39 +00004296 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4297 delete (yyvsp[(3) - (5)].TypeList);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004298 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004299 ;}
4300 break;
4301
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004302 case 158:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004303#line 1449 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004304 { // Empty structure type?
4305 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004306 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004307 ;}
4308 break;
4309
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004310 case 159:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004311#line 1456 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004312 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004313 // Allow but ignore attributes on function types; this permits auto-upgrade.
4314 // FIXME: remove in LLVM 3.0.
Dan Gohmanf4423b12008-04-19 00:24:39 +00004315 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4316 (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
4317 ;}
4318 break;
4319
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004320 case 160:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004321#line 1465 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004322 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004323 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004324 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4325 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004326 GEN_ERROR("LLVM functions cannot return aggregate types");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004327 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4328 ;}
4329 break;
4330
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004331 case 161:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004332#line 1472 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004333 {
4334 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4335 ;}
4336 break;
4337
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004338 case 162:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004339#line 1477 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004340 {
4341 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4342 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
Reid Spencer3da59db2006-11-27 01:05:10 +00004343 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004344 ;}
4345 break;
4346
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004347 case 163:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004348#line 1482 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004349 {
4350 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004351 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004352 ;}
4353 break;
4354
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004355 case 165:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004356#line 1490 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004357 {
4358 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
Reid Spencer18da0722007-04-11 02:44:20 +00004359 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
Reid Spencer41dff5e2007-01-26 08:05:27 +00004360 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004361 (yyval.TypeWithAttrsList)->push_back(TWA);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004362 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004363 ;}
4364 break;
4365
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004366 case 166:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004367#line 1497 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004368 {
4369 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004370 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4371 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004372 (yyval.TypeWithAttrsList)->push_back(TWA);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004373 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004374 ;}
4375 break;
4376
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004377 case 167:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004378#line 1504 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004379 {
4380 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004381 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004382 ;}
4383 break;
4384
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004385 case 168:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004386#line 1512 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004387 {
4388 (yyval.TypeList) = new std::list<PATypeHolder>();
4389 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4390 delete (yyvsp[(1) - (1)].TypeVal);
Reid Spencer3da59db2006-11-27 01:05:10 +00004391 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004392 ;}
4393 break;
4394
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004395 case 169:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004396#line 1518 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004397 {
4398 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4399 delete (yyvsp[(3) - (3)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004400 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004401 ;}
4402 break;
4403
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004404 case 170:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004405#line 1530 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004406 { // Nonempty unsized arr
Reid Spencer14310612006-12-31 05:40:51 +00004407 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004408 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4409 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004410 if (ATy == 0)
Reid Spencer61c83e02006-08-18 08:43:06 +00004411 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004412 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004413 const Type *ETy = ATy->getElementType();
4414 int NumElements = ATy->getNumElements();
4415
4416 // Verify that we have the correct size...
Dan Gohmanf4423b12008-04-19 00:24:39 +00004417 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004418 GEN_ERROR("Type mismatch: constant sized array initialized with " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004419 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Reid Spencerb5334b02007-02-05 10:18:06 +00004420 itostr(NumElements) + "");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004421
4422 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004423 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4424 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004425 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4426 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohmanf4423b12008-04-19 00:24:39 +00004427 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004428 }
4429
Dan Gohmanf4423b12008-04-19 00:24:39 +00004430 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4431 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004432 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004433 ;}
4434 break;
4435
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004436 case 171:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004437#line 1558 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004438 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004439 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004440 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4441 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004442 if (ATy == 0)
4443 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004444 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004445
Andrew Lenharth6353e052006-12-08 18:07:09 +00004446 int NumElements = ATy->getNumElements();
4447 if (NumElements != -1 && NumElements != 0)
4448 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
Reid Spencerb5334b02007-02-05 10:18:06 +00004449 " arguments, but has size of " + itostr(NumElements) +"");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004450 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4451 delete (yyvsp[(1) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00004452 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004453 ;}
4454 break;
4455
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004456 case 172:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004457#line 1574 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004458 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004459 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004460 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4461 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004462 if (ATy == 0)
4463 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004464 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004465
4466 int NumElements = ATy->getNumElements();
4467 const Type *ETy = ATy->getElementType();
Dan Gohmanf4423b12008-04-19 00:24:39 +00004468 if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004469 GEN_ERROR("Can't build string constant of size " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004470 itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) +
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004471 " when array has size " + itostr(NumElements) + "");
4472 std::vector<Constant*> Vals;
4473 if (ETy == Type::Int8Ty) {
Dan Gohmanf4423b12008-04-19 00:24:39 +00004474 for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
4475 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004476 } else {
Dan Gohmanf4423b12008-04-19 00:24:39 +00004477 delete (yyvsp[(3) - (3)].StrVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004478 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4479 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004480 delete (yyvsp[(3) - (3)].StrVal);
4481 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4482 delete (yyvsp[(1) - (3)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004483 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004484 ;}
4485 break;
4486
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004487 case 173:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004488#line 1601 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004489 { // Nonempty unsized arr
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004490 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004491 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4492 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004493 if (PTy == 0)
4494 GEN_ERROR("Cannot make packed constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004495 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004496 const Type *ETy = PTy->getElementType();
4497 int NumElements = PTy->getNumElements();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004498
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004499 // Verify that we have the correct size...
Dan Gohmanf4423b12008-04-19 00:24:39 +00004500 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004501 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004502 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Reid Spencerb5334b02007-02-05 10:18:06 +00004503 itostr(NumElements) + "");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004504
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004505 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004506 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4507 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004508 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4509 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohmanf4423b12008-04-19 00:24:39 +00004510 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004511 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00004512
Dan Gohmanf4423b12008-04-19 00:24:39 +00004513 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4514 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004515 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004516 ;}
4517 break;
4518
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004519 case 174:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004520#line 1629 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004521 {
4522 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004523 if (STy == 0)
4524 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004525 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004526
Dan Gohmanf4423b12008-04-19 00:24:39 +00004527 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004528 GEN_ERROR("Illegal number of initializers for structure type");
4529
4530 // Check to ensure that constants are compatible with the type initializer!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004531 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4532 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004533 GEN_ERROR("Expected type '" +
4534 STy->getElementType(i)->getDescription() +
4535 "' for element #" + utostr(i) +
4536 " of structure initializer");
4537
4538 // Check to ensure that Type is not packed
4539 if (STy->isPacked())
4540 GEN_ERROR("Unpacked Initializer to vector type '" +
4541 STy->getDescription() + "'");
4542
Dan Gohmanf4423b12008-04-19 00:24:39 +00004543 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4544 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004545 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004546 ;}
4547 break;
4548
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004549 case 175:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004550#line 1655 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004551 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004552 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004553 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4554 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004555 if (STy == 0)
4556 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004557 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004558
4559 if (STy->getNumContainedTypes() != 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00004560 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004561
4562 // Check to ensure that Type is not packed
4563 if (STy->isPacked())
Chris Lattner6cdc6822007-04-26 05:31:05 +00004564 GEN_ERROR("Unpacked Initializer to vector type '" +
4565 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004566
Dan Gohmanf4423b12008-04-19 00:24:39 +00004567 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4568 delete (yyvsp[(1) - (3)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004569 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004570 ;}
4571 break;
4572
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004573 case 176:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004574#line 1675 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004575 {
4576 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004577 if (STy == 0)
4578 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004579 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004580
Dan Gohmanf4423b12008-04-19 00:24:39 +00004581 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
Reid Spencerb5334b02007-02-05 10:18:06 +00004582 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004583
4584 // Check to ensure that constants are compatible with the type initializer!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004585 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4586 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
Reid Spencer41dff5e2007-01-26 08:05:27 +00004587 GEN_ERROR("Expected type '" +
4588 STy->getElementType(i)->getDescription() +
4589 "' for element #" + utostr(i) +
Reid Spencerb5334b02007-02-05 10:18:06 +00004590 " of structure initializer");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004591
4592 // Check to ensure that Type is packed
4593 if (!STy->isPacked())
Chris Lattner32980692007-02-19 07:44:24 +00004594 GEN_ERROR("Vector initializer to non-vector type '" +
4595 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004596
Dan Gohmanf4423b12008-04-19 00:24:39 +00004597 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4598 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004599 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004600 ;}
4601 break;
4602
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004603 case 177:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004604#line 1701 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004605 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004606 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004607 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4608 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004609 if (STy == 0)
4610 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004611 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004612
4613 if (STy->getNumContainedTypes() != 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00004614 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004615
4616 // Check to ensure that Type is packed
4617 if (!STy->isPacked())
Chris Lattner32980692007-02-19 07:44:24 +00004618 GEN_ERROR("Vector initializer to non-vector type '" +
4619 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004620
Dan Gohmanf4423b12008-04-19 00:24:39 +00004621 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4622 delete (yyvsp[(1) - (5)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004623 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004624 ;}
4625 break;
4626
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004627 case 178:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004628#line 1721 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004629 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004630 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004631 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4632 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004633 if (PTy == 0)
4634 GEN_ERROR("Cannot make null pointer constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004635 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004636
Dan Gohmanf4423b12008-04-19 00:24:39 +00004637 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4638 delete (yyvsp[(1) - (2)].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004639 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004640 ;}
4641 break;
4642
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004643 case 179:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004644#line 1733 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004645 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004646 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004647 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4648 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4649 delete (yyvsp[(1) - (2)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004650 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004651 ;}
4652 break;
4653
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004654 case 180:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004655#line 1740 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004656 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004657 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004658 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4659 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004660 if (Ty == 0)
Dan Gohmanf4423b12008-04-19 00:24:39 +00004661 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004662
4663 // ConstExprs can exist in the body of a function, thus creating
4664 // GlobalValues whenever they refer to a variable. Because we are in
Reid Spencer93c40032007-03-19 18:40:50 +00004665 // the context of a function, getExistingVal will search the functions
Reid Spencer68a24bd2005-08-27 18:50:39 +00004666 // symbol table instead of the module symbol table for the global symbol,
4667 // which throws things all off. To get around this, we just tell
Reid Spencer93c40032007-03-19 18:40:50 +00004668 // getExistingVal that we are at global scope here.
Reid Spencer68a24bd2005-08-27 18:50:39 +00004669 //
4670 Function *SavedCurFn = CurFun.CurrentFunction;
4671 CurFun.CurrentFunction = 0;
4672
Dan Gohmanf4423b12008-04-19 00:24:39 +00004673 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00004674 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00004675
4676 CurFun.CurrentFunction = SavedCurFn;
4677
4678 // If this is an initializer for a constant pointer, which is referencing a
4679 // (currently) undefined variable, create a stub now that shall be replaced
4680 // in the future with the right type of variable.
4681 //
4682 if (V == 0) {
Reid Spencera9720f52007-02-05 17:04:00 +00004683 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004684 const PointerType *PT = cast<PointerType>(Ty);
4685
4686 // First check to see if the forward references value is already created!
4687 PerModuleInfo::GlobalRefsType::iterator I =
Dan Gohmanf4423b12008-04-19 00:24:39 +00004688 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004689
4690 if (I != CurModule.GlobalRefs.end()) {
4691 V = I->second; // Placeholder already exists, use it...
Dan Gohmanf4423b12008-04-19 00:24:39 +00004692 (yyvsp[(2) - (2)].ValIDVal).destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +00004693 } else {
4694 std::string Name;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004695 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4696 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4697 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
Reid Spencer41dff5e2007-01-26 08:05:27 +00004698 GEN_ERROR("Invalid reference to global");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004699
4700 // Create the forward referenced global.
4701 GlobalValue *GV;
4702 if (const FunctionType *FTy =
4703 dyn_cast<FunctionType>(PT->getElementType())) {
Gabor Greife64d2482008-04-06 23:07:54 +00004704 GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
4705 CurModule.CurrentModule);
Reid Spencer68a24bd2005-08-27 18:50:39 +00004706 } else {
4707 GV = new GlobalVariable(PT->getElementType(), false,
Chris Lattner6cdc6822007-04-26 05:31:05 +00004708 GlobalValue::ExternalWeakLinkage, 0,
Reid Spencer68a24bd2005-08-27 18:50:39 +00004709 Name, CurModule.CurrentModule);
4710 }
4711
4712 // Keep track of the fact that we have a forward ref to recycle it
Dan Gohmanf4423b12008-04-19 00:24:39 +00004713 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004714 V = GV;
4715 }
4716 }
4717
Dan Gohmanf4423b12008-04-19 00:24:39 +00004718 (yyval.ConstVal) = cast<GlobalValue>(V);
4719 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
Reid Spencer61c83e02006-08-18 08:43:06 +00004720 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004721 ;}
4722 break;
4723
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004724 case 181:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004725#line 1806 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004726 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004727 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004728 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4729 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004730 GEN_ERROR("Mismatched types for constant expression: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004731 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4732 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4733 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004734 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004735 ;}
4736 break;
4737
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004738 case 182:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004739#line 1816 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004740 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004741 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004742 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4743 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004744 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4745 GEN_ERROR("Cannot create a null initialized value of this type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004746 (yyval.ConstVal) = Constant::getNullValue(Ty);
4747 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004748 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004749 ;}
4750 break;
4751
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004752 case 183:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004753#line 1826 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004754 { // integral constants
4755 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004756 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004757 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
Reid Spencer38c91a92007-02-28 02:24:54 +00004758 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004759 ;}
4760 break;
4761
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004762 case 184:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004763#line 1832 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004764 { // arbitrary precision integer constants
4765 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4766 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004767 GEN_ERROR("Constant value does not fit in type");
4768 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004769 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4770 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4771 delete (yyvsp[(2) - (2)].APIntVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004772 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004773 ;}
4774 break;
4775
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004776 case 185:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004777#line 1842 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004778 { // integral constants
4779 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004780 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004781 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004782 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004783 ;}
4784 break;
4785
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004786 case 186:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004787#line 1848 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004788 { // arbitrary precision integer constants
4789 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4790 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004791 GEN_ERROR("Constant value does not fit in type");
4792 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004793 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4794 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4795 delete (yyvsp[(2) - (2)].APIntVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004796 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004797 ;}
4798 break;
4799
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004800 case 187:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004801#line 1858 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004802 { // Boolean constants
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004803 if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1)
4804 GEN_ERROR("Constant true must have type i1");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004805 (yyval.ConstVal) = ConstantInt::getTrue();
Reid Spencer38c91a92007-02-28 02:24:54 +00004806 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004807 ;}
4808 break;
4809
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004810 case 188:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004811#line 1864 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004812 { // Boolean constants
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004813 if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1)
4814 GEN_ERROR("Constant false must have type i1");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004815 (yyval.ConstVal) = ConstantInt::getFalse();
Reid Spencer6f407902007-01-13 05:00:46 +00004816 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004817 ;}
4818 break;
4819
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004820 case 189:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004821#line 1870 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004822 { // Floating point constants
4823 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004824 GEN_ERROR("Floating point constant invalid for type");
Dale Johannesenc72cd7e2007-09-11 18:33:39 +00004825 // Lexer has no type info, so builds all float and double FP constants
4826 // as double. Fix this here. Long double is done right.
Dan Gohmanf4423b12008-04-19 00:24:39 +00004827 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4828 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
Chris Lattnerd8eb63f2008-04-20 00:41:19 +00004829 (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal));
Dan Gohmanf4423b12008-04-19 00:24:39 +00004830 delete (yyvsp[(2) - (2)].FPVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004831 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004832 ;}
4833 break;
4834
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004835 case 190:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004836#line 1883 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004837 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004838 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004839 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4840 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4841 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4842 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004843 GEN_ERROR("invalid cast opcode for cast from '" +
4844 Val->getType()->getDescription() + "' to '" +
4845 DestTy->getDescription() + "'");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004846 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4847 delete (yyvsp[(5) - (6)].TypeVal);
4848 ;}
4849 break;
4850
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004851 case 191:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004852#line 1895 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004853 {
4854 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
Reid Spencerb5334b02007-02-05 10:18:06 +00004855 GEN_ERROR("GetElementPtr requires a pointer operand");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004856
4857 const Type *IdxTy =
Dan Gohman041e2eb2008-05-15 19:50:34 +00004858 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004859 if (!IdxTy)
Reid Spencerb5334b02007-02-05 10:18:06 +00004860 GEN_ERROR("Index list invalid for constant getelementptr");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004861
Chris Lattnerf7469af2007-01-31 04:44:08 +00004862 SmallVector<Constant*, 8> IdxVec;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004863 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4864 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004865 IdxVec.push_back(C);
4866 else
Reid Spencerb5334b02007-02-05 10:18:06 +00004867 GEN_ERROR("Indices to constant getelementptr must be constants");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004868
Dan Gohmanf4423b12008-04-19 00:24:39 +00004869 delete (yyvsp[(4) - (5)].ValueList);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004870
Dan Gohmanf4423b12008-04-19 00:24:39 +00004871 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
Andrew Lenharth6353e052006-12-08 18:07:09 +00004872 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004873 ;}
4874 break;
4875
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004876 case 192:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004877#line 1916 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004878 {
4879 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004880 GEN_ERROR("Select condition must be of boolean type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004881 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004882 GEN_ERROR("Select operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004883 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004884 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004885 ;}
4886 break;
4887
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004888 case 193:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004889#line 1924 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004890 {
4891 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004892 GEN_ERROR("Binary operator types must match");
4893 CHECK_FOR_ERROR;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004894 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4895 ;}
4896 break;
4897
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004898 case 194:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004899#line 1930 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004900 {
4901 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004902 GEN_ERROR("Logical operator types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004903 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
4904 if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
4905 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004906 GEN_ERROR("Logical operator requires integral operands");
4907 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004908 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004909 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004910 ;}
4911 break;
4912
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004913 case 195:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004914#line 1941 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004915 {
4916 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004917 GEN_ERROR("icmp operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004918 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4919 ;}
4920 break;
4921
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004922 case 196:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004923#line 1946 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004924 {
4925 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004926 GEN_ERROR("fcmp operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004927 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4928 ;}
4929 break;
4930
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004931 case 197:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004932#line 1951 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00004933 {
4934 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4935 GEN_ERROR("vicmp operand types must match");
4936 (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4937 ;}
4938 break;
4939
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004940 case 198:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004941#line 1956 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00004942 {
4943 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4944 GEN_ERROR("vfcmp operand types must match");
4945 (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4946 ;}
4947 break;
4948
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004949 case 199:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004950#line 1961 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004951 {
4952 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004953 GEN_ERROR("Invalid extractelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004954 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004955 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004956 ;}
4957 break;
4958
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004959 case 200:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004960#line 1967 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004961 {
4962 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004963 GEN_ERROR("Invalid insertelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004964 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004965 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004966 ;}
4967 break;
4968
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004969 case 201:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004970#line 1973 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004971 {
4972 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004973 GEN_ERROR("Invalid shufflevector operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004974 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004975 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004976 ;}
4977 break;
4978
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004979 case 202:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004980#line 1979 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00004981 {
4982 if (!isa<StructType>((yyvsp[(3) - (5)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (5)].ConstVal)->getType()))
4983 GEN_ERROR("ExtractValue requires an aggregate operand");
4984
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004985 (yyval.ConstVal) = ConstantExpr::getExtractValue((yyvsp[(3) - (5)].ConstVal), &(*(yyvsp[(4) - (5)].ConstantList))[0], (yyvsp[(4) - (5)].ConstantList)->size());
4986 delete (yyvsp[(4) - (5)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00004987 CHECK_FOR_ERROR
4988 ;}
4989 break;
4990
4991 case 203:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004992#line 1987 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00004993 {
4994 if (!isa<StructType>((yyvsp[(3) - (7)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (7)].ConstVal)->getType()))
4995 GEN_ERROR("InsertValue requires an aggregate operand");
4996
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004997 (yyval.ConstVal) = ConstantExpr::getInsertValue((yyvsp[(3) - (7)].ConstVal), (yyvsp[(5) - (7)].ConstVal), &(*(yyvsp[(6) - (7)].ConstantList))[0], (yyvsp[(6) - (7)].ConstantList)->size());
4998 delete (yyvsp[(6) - (7)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00004999 CHECK_FOR_ERROR
5000 ;}
5001 break;
5002
5003 case 204:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005004#line 1998 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005005 {
5006 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005007 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005008 ;}
5009 break;
5010
Dan Gohmane4977cf2008-05-23 01:55:30 +00005011 case 205:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005012#line 2002 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005013 {
5014 (yyval.ConstVector) = new std::vector<Constant*>();
5015 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005016 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005017 ;}
5018 break;
5019
Nate Begemanac80ade2008-05-12 19:01:56 +00005020 case 206:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005021#line 2010 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005022 { (yyval.BoolVal) = false; ;}
Nate Begemanac80ade2008-05-12 19:01:56 +00005023 break;
5024
5025 case 207:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005026#line 2010 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005027 { (yyval.BoolVal) = true; ;}
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005028 break;
5029
5030 case 208:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005031#line 2013 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005032 { (yyval.BoolVal) = true; ;}
5033 break;
5034
5035 case 209:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005036#line 2013 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005037 { (yyval.BoolVal) = false; ;}
5038 break;
5039
5040 case 210:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005041#line 2016 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005042 {
5043 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
5044 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
Chris Lattner0275cff2007-08-06 21:00:46 +00005045 CHECK_FOR_ERROR
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005046 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
5047 if (!Aliasee)
5048 GEN_ERROR("Aliases can be created only to global values");
5049
Dan Gohmanf4423b12008-04-19 00:24:39 +00005050 (yyval.ConstVal) = Aliasee;
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005051 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005052 delete (yyvsp[(1) - (2)].TypeVal);
5053 ;}
5054 break;
5055
Dan Gohmane4977cf2008-05-23 01:55:30 +00005056 case 211:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005057#line 2028 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005058 {
5059 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
5060 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
5061 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005062 GEN_ERROR("invalid cast opcode for cast from '" +
5063 Val->getType()->getDescription() + "' to '" +
5064 DestTy->getDescription() + "'");
5065
Dan Gohmanf4423b12008-04-19 00:24:39 +00005066 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005067 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005068 delete (yyvsp[(5) - (6)].TypeVal);
5069 ;}
5070 break;
5071
Dan Gohmane4977cf2008-05-23 01:55:30 +00005072 case 212:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005073#line 2049 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005074 {
5075 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
Dale Johannesen172f3112008-02-20 21:15:43 +00005076 CurModule.ModuleDone();
5077 CHECK_FOR_ERROR;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005078 ;}
5079 break;
5080
Dan Gohmane4977cf2008-05-23 01:55:30 +00005081 case 213:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005082#line 2054 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005083 {
5084 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5085 CurModule.ModuleDone();
5086 CHECK_FOR_ERROR;
5087 ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00005088 break;
5089
Dan Gohmane4977cf2008-05-23 01:55:30 +00005090 case 216:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005091#line 2067 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005092 { CurFun.isDeclare = false; ;}
5093 break;
5094
Dan Gohmane4977cf2008-05-23 01:55:30 +00005095 case 217:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005096#line 2067 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005097 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005098 CurFun.FunctionDone();
5099 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005100 ;}
5101 break;
5102
Dan Gohmane4977cf2008-05-23 01:55:30 +00005103 case 218:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005104#line 2071 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005105 { CurFun.isDeclare = true; ;}
5106 break;
5107
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005108 case 219:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005109#line 2071 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005110 {
5111 CHECK_FOR_ERROR
5112 ;}
5113 break;
5114
5115 case 220:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005116#line 2074 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005117 {
5118 CHECK_FOR_ERROR
5119 ;}
5120 break;
5121
5122 case 221:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005123#line 2077 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005124 {
Reid Spencer14310612006-12-31 05:40:51 +00005125 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005126 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005127 // Eagerly resolve types. This is not an optimization, this is a
5128 // requirement that is due to the fact that we could have this:
5129 //
5130 // %list = type { %list * }
5131 // %list = type { %list * } ; repeated type decl
5132 //
5133 // If types are not resolved eagerly, then the two types will not be
5134 // determined to be the same type!
5135 //
Dan Gohmanf4423b12008-04-19 00:24:39 +00005136 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005137
Dan Gohmanf4423b12008-04-19 00:24:39 +00005138 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Reid Spencer5b7e7532006-09-28 19:28:24 +00005139 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005140 // If this is a named type that is not a redefinition, add it to the slot
5141 // table.
Dan Gohmanf4423b12008-04-19 00:24:39 +00005142 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005143 }
Reid Spencera132e042006-12-03 05:46:11 +00005144
Dan Gohmanf4423b12008-04-19 00:24:39 +00005145 delete (yyvsp[(3) - (3)].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005146 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005147 ;}
5148 break;
Reid Spencerb8f85052007-07-31 03:50:36 +00005149
Dan Gohmane4977cf2008-05-23 01:55:30 +00005150 case 222:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005151#line 2101 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005152 {
5153 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
5154
5155 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005156 CHECK_FOR_ERROR
5157 // If this is a named type that is not a redefinition, add it to the slot
5158 // table.
Dan Gohmanf4423b12008-04-19 00:24:39 +00005159 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005160 }
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005161 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005162 ;}
5163 break;
5164
Dan Gohmane4977cf2008-05-23 01:55:30 +00005165 case 223:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005166#line 2113 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005167 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005168 /* "Externally Visible" Linkage */
Dan Gohmanf4423b12008-04-19 00:24:39 +00005169 if ((yyvsp[(5) - (6)].ConstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005170 GEN_ERROR("Global value initializer is not a constant");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005171 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5172 (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 +00005173 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005174 ;}
5175 break;
5176
Dan Gohmane4977cf2008-05-23 01:55:30 +00005177 case 224:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005178#line 2120 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005179 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005180 CurGV = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005181 ;}
5182 break;
5183
Dan Gohmane4977cf2008-05-23 01:55:30 +00005184 case 225:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005185#line 2124 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005186 {
5187 if ((yyvsp[(6) - (7)].ConstVal) == 0)
Christopher Lambbf3348d2007-12-12 08:45:45 +00005188 GEN_ERROR("Global value initializer is not a constant");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005189 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 +00005190 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005191 ;}
5192 break;
5193
Dan Gohmane4977cf2008-05-23 01:55:30 +00005194 case 226:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005195#line 2129 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005196 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005197 CurGV = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005198 ;}
5199 break;
5200
Dan Gohmane4977cf2008-05-23 01:55:30 +00005201 case 227:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005202#line 2133 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005203 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005204 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005205 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5206 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 +00005207 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005208 delete (yyvsp[(6) - (7)].TypeVal);
5209 ;}
5210 break;
5211
Dan Gohmane4977cf2008-05-23 01:55:30 +00005212 case 228:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005213#line 2139 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005214 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005215 CurGV = 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +00005216 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005217 ;}
5218 break;
5219
Dan Gohmane4977cf2008-05-23 01:55:30 +00005220 case 229:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005221#line 2143 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005222 {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005223 std::string Name;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005224 if ((yyvsp[(1) - (5)].StrVal)) {
5225 Name = *(yyvsp[(1) - (5)].StrVal);
5226 delete (yyvsp[(1) - (5)].StrVal);
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005227 }
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005228 if (Name.empty())
5229 GEN_ERROR("Alias name cannot be empty");
5230
Dan Gohmanf4423b12008-04-19 00:24:39 +00005231 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005232 if (Aliasee == 0)
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005233 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005234
Dan Gohmanf4423b12008-04-19 00:24:39 +00005235 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005236 CurModule.CurrentModule);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005237 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005238 InsertValue(GA, CurModule.Values);
Chris Lattner569f7372007-09-10 23:24:14 +00005239
5240
5241 // If there was a forward reference of this alias, resolve it now.
5242
5243 ValID ID;
5244 if (!Name.empty())
5245 ID = ValID::createGlobalName(Name);
5246 else
5247 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5248
5249 if (GlobalValue *FWGV =
5250 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5251 // Replace uses of the fwdref with the actual alias.
5252 FWGV->replaceAllUsesWith(GA);
5253 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5254 GV->eraseFromParent();
5255 else
5256 cast<Function>(FWGV)->eraseFromParent();
5257 }
5258 ID.destroy();
5259
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005260 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005261 ;}
5262 break;
5263
Dan Gohmane4977cf2008-05-23 01:55:30 +00005264 case 230:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005265#line 2183 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005266 {
Anton Korobeynikov77d0f972007-04-25 14:29:12 +00005267 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005268 ;}
5269 break;
5270
Dan Gohmane4977cf2008-05-23 01:55:30 +00005271 case 231:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005272#line 2186 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005273 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005274 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005275 ;}
5276 break;
5277
Dan Gohmane4977cf2008-05-23 01:55:30 +00005278 case 232:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005279#line 2192 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005280 {
Chris Lattner66316012006-01-24 04:14:29 +00005281 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
Chris Lattner66316012006-01-24 04:14:29 +00005282 if (AsmSoFar.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005283 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
Chris Lattner66316012006-01-24 04:14:29 +00005284 else
Dan Gohmanf4423b12008-04-19 00:24:39 +00005285 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5286 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00005287 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005288;}
5289 break;
5290
Dan Gohmane4977cf2008-05-23 01:55:30 +00005291 case 233:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005292#line 2202 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005293 {
5294 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5295 delete (yyvsp[(3) - (3)].StrVal);
5296 ;}
5297 break;
5298
Dan Gohmane4977cf2008-05-23 01:55:30 +00005299 case 234:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005300#line 2206 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005301 {
5302 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5303 delete (yyvsp[(3) - (3)].StrVal);
5304 ;}
5305 break;
5306
Dan Gohmane4977cf2008-05-23 01:55:30 +00005307 case 236:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005308#line 2213 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005309 {
5310 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5311 delete (yyvsp[(3) - (3)].StrVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00005312 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005313 ;}
5314 break;
5315
Dan Gohmane4977cf2008-05-23 01:55:30 +00005316 case 237:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005317#line 2218 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005318 {
5319 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5320 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer1013b4d2007-07-31 14:41:17 +00005321 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005322 ;}
5323 break;
5324
Dan Gohmane4977cf2008-05-23 01:55:30 +00005325 case 238:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005326#line 2223 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005327 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005328 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005329 ;}
5330 break;
5331
Dan Gohmane4977cf2008-05-23 01:55:30 +00005332 case 239:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005333#line 2232 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005334 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005335 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005336 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005337 if (!(*(yyvsp[(3) - (5)].TypeVal))->isFirstClassType())
5338 GEN_ERROR("Argument types must be first-class");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005339 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5340 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5341 (yyvsp[(1) - (5)].ArgList)->push_back(E);
Reid Spencer6f407902007-01-13 05:00:46 +00005342 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005343 ;}
5344 break;
5345
Dan Gohmane4977cf2008-05-23 01:55:30 +00005346 case 240:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005347#line 2242 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005348 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005349 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005350 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005351 if (!(*(yyvsp[(1) - (3)].TypeVal))->isFirstClassType())
5352 GEN_ERROR("Argument types must be first-class");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005353 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5354 (yyval.ArgList) = new ArgListType;
5355 (yyval.ArgList)->push_back(E);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005356 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005357 ;}
5358 break;
5359
Dan Gohmane4977cf2008-05-23 01:55:30 +00005360 case 241:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005361#line 2253 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005362 {
5363 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005364 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005365 ;}
5366 break;
5367
Dan Gohmane4977cf2008-05-23 01:55:30 +00005368 case 242:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005369#line 2257 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005370 {
5371 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005372 struct ArgListEntry E;
5373 E.Ty = new PATypeHolder(Type::VoidTy);
5374 E.Name = 0;
Reid Spencer18da0722007-04-11 02:44:20 +00005375 E.Attrs = ParamAttr::None;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005376 (yyval.ArgList)->push_back(E);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005377 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005378 ;}
5379 break;
5380
Dan Gohmane4977cf2008-05-23 01:55:30 +00005381 case 243:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005382#line 2266 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005383 {
5384 (yyval.ArgList) = new ArgListType;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005385 struct ArgListEntry E;
5386 E.Ty = new PATypeHolder(Type::VoidTy);
5387 E.Name = 0;
5388 E.Attrs = ParamAttr::None;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005389 (yyval.ArgList)->push_back(E);
Reid Spencer61c83e02006-08-18 08:43:06 +00005390 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005391 ;}
5392 break;
5393
Dan Gohmane4977cf2008-05-23 01:55:30 +00005394 case 244:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005395#line 2275 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005396 {
5397 (yyval.ArgList) = 0;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005398 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005399 ;}
5400 break;
5401
Dan Gohmane4977cf2008-05-23 01:55:30 +00005402 case 245:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005403#line 2281 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005404 {
5405 std::string FunctionName(*(yyvsp[(3) - (10)].StrVal));
5406 delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory!
Reid Spencer68a24bd2005-08-27 18:50:39 +00005407
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005408 // Check the function result for abstractness if this is a define. We should
5409 // have no abstract types at this point
Dan Gohmanf4423b12008-04-19 00:24:39 +00005410 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal)))
5411 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription());
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005412
Chris Lattnera925a142008-04-23 05:37:08 +00005413 if (!FunctionType::isValidReturnType(*(yyvsp[(2) - (10)].TypeVal)))
5414 GEN_ERROR("Invalid result type for LLVM function");
5415
Reid Spencer68a24bd2005-08-27 18:50:39 +00005416 std::vector<const Type*> ParamTypeList;
Chris Lattner58d74912008-03-12 17:45:29 +00005417 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005418 if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None)
5419 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(7) - (10)].ParamAttrs)));
5420 if ((yyvsp[(5) - (10)].ArgList)) { // If there are arguments...
Reid Spencer7b5d4662007-04-09 06:16:21 +00005421 unsigned index = 1;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005422 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); I != (yyvsp[(5) - (10)].ArgList)->end(); ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00005423 const Type* Ty = I->Ty->get();
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005424 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5425 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
Reid Spencer14310612006-12-31 05:40:51 +00005426 ParamTypeList.push_back(Ty);
Chris Lattner58d74912008-03-12 17:45:29 +00005427 if (Ty != Type::VoidTy && I->Attrs != ParamAttr::None)
5428 Attrs.push_back(ParamAttrsWithIndex::get(index, I->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00005429 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005430 }
5431
5432 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5433 if (isVarArg) ParamTypeList.pop_back();
5434
Chris Lattner58d74912008-03-12 17:45:29 +00005435 PAListPtr PAL;
Christopher Lamb5c104242007-04-22 20:09:11 +00005436 if (!Attrs.empty())
Chris Lattner58d74912008-03-12 17:45:29 +00005437 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Reid Spencer7b5d4662007-04-09 06:16:21 +00005438
Dan Gohmanf4423b12008-04-19 00:24:39 +00005439 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00005440 const PointerType *PFT = PointerType::getUnqual(FT);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005441 delete (yyvsp[(2) - (10)].TypeVal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005442
5443 ValID ID;
5444 if (!FunctionName.empty()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005445 ID = ValID::createGlobalName((char*)FunctionName.c_str());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005446 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00005447 ID = ValID::createGlobalID(CurModule.Values.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005448 }
5449
5450 Function *Fn = 0;
5451 // See if this function was forward referenced. If so, recycle the object.
5452 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5453 // Move the function to the end of the list, from whereever it was
5454 // previously inserted.
5455 Fn = cast<Function>(FWRef);
Chris Lattner58d74912008-03-12 17:45:29 +00005456 assert(Fn->getParamAttrs().isEmpty() &&
5457 "Forward reference has parameter attributes!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005458 CurModule.CurrentModule->getFunctionList().remove(Fn);
5459 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5460 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
Reid Spenceref9b9a72007-02-05 20:47:22 +00005461 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
Duncan Sandsdc024672007-11-27 13:23:08 +00005462 if (Fn->getFunctionType() != FT ) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00005463 // The existing function doesn't have the same type. This is an overload
5464 // error.
5465 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Duncan Sandsdc024672007-11-27 13:23:08 +00005466 } else if (Fn->getParamAttrs() != PAL) {
5467 // The existing function doesn't have the same parameter attributes.
5468 // This is an overload error.
5469 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Reid Spenceref9b9a72007-02-05 20:47:22 +00005470 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
Chris Lattner6cdc6822007-04-26 05:31:05 +00005471 // Neither the existing or the current function is a declaration and they
5472 // have the same name and same type. Clearly this is a redefinition.
5473 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
Duncan Sandsdc024672007-11-27 13:23:08 +00005474 } else if (Fn->isDeclaration()) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00005475 // Make sure to strip off any argument names so we can't get conflicts.
Reid Spencer68a24bd2005-08-27 18:50:39 +00005476 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5477 AI != AE; ++AI)
5478 AI->setName("");
Reid Spenceref9b9a72007-02-05 20:47:22 +00005479 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005480 } else { // Not already defined?
Gabor Greife64d2482008-04-06 23:07:54 +00005481 Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5482 CurModule.CurrentModule);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005483 InsertValue(Fn, CurModule.Values);
5484 }
5485
5486 CurFun.FunctionStart(Fn);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00005487
5488 if (CurFun.isDeclare) {
5489 // If we have declaration, always overwrite linkage. This will allow us to
5490 // correctly handle cases, when pointer to function is passed as argument to
5491 // another function.
5492 Fn->setLinkage(CurFun.Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005493 Fn->setVisibility(CurFun.Visibility);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00005494 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00005495 Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal));
Duncan Sandsdc024672007-11-27 13:23:08 +00005496 Fn->setParamAttrs(PAL);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005497 Fn->setAlignment((yyvsp[(9) - (10)].UIntVal));
5498 if ((yyvsp[(8) - (10)].StrVal)) {
5499 Fn->setSection(*(yyvsp[(8) - (10)].StrVal));
5500 delete (yyvsp[(8) - (10)].StrVal);
Gordon Henriksen80a75bf2007-12-10 03:18:06 +00005501 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00005502 if ((yyvsp[(10) - (10)].StrVal)) {
5503 Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str());
5504 delete (yyvsp[(10) - (10)].StrVal);
Chris Lattnere869eef2005-11-12 00:11:49 +00005505 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005506
5507 // Add all of the arguments we parsed to the function...
Dan Gohmanf4423b12008-04-19 00:24:39 +00005508 if ((yyvsp[(5) - (10)].ArgList)) { // Is null if empty...
Reid Spencer68a24bd2005-08-27 18:50:39 +00005509 if (isVarArg) { // Nuke the last entry
Dan Gohmanf4423b12008-04-19 00:24:39 +00005510 assert((yyvsp[(5) - (10)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (10)].ArgList)->back().Name == 0 &&
Reid Spencera9720f52007-02-05 17:04:00 +00005511 "Not a varargs marker!");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005512 delete (yyvsp[(5) - (10)].ArgList)->back().Ty;
5513 (yyvsp[(5) - (10)].ArgList)->pop_back(); // Delete the last entry
Reid Spencer68a24bd2005-08-27 18:50:39 +00005514 }
5515 Function::arg_iterator ArgIt = Fn->arg_begin();
Reid Spenceref9b9a72007-02-05 20:47:22 +00005516 Function::arg_iterator ArgEnd = Fn->arg_end();
Reid Spencer14310612006-12-31 05:40:51 +00005517 unsigned Idx = 1;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005518 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin();
5519 I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
Reid Spencer14310612006-12-31 05:40:51 +00005520 delete I->Ty; // Delete the typeholder...
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005521 setValueName(ArgIt, I->Name); // Insert arg into symtab...
Reid Spencer5b7e7532006-09-28 19:28:24 +00005522 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005523 InsertValue(ArgIt);
Reid Spencer14310612006-12-31 05:40:51 +00005524 Idx++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005525 }
Reid Spencera132e042006-12-03 05:46:11 +00005526
Dan Gohmanf4423b12008-04-19 00:24:39 +00005527 delete (yyvsp[(5) - (10)].ArgList); // We're now done with the argument list
Reid Spencer68a24bd2005-08-27 18:50:39 +00005528 }
Reid Spencer61c83e02006-08-18 08:43:06 +00005529 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005530;}
5531 break;
5532
Dan Gohmane4977cf2008-05-23 01:55:30 +00005533 case 248:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005534#line 2411 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005535 {
5536 (yyval.FunctionVal) = CurFun.CurrentFunction;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005537
5538 // Make sure that we keep track of the linkage type even if there was a
5539 // previous "declare".
Dan Gohmanf4423b12008-04-19 00:24:39 +00005540 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5541 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5542;}
5543 break;
5544
Dan Gohmane4977cf2008-05-23 01:55:30 +00005545 case 251:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005546#line 2422 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005547 {
5548 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005549 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005550;}
5551 break;
5552
Dan Gohmane4977cf2008-05-23 01:55:30 +00005553 case 252:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005554#line 2427 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005555 {
5556 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5557 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5558 (yyval.FunctionVal) = CurFun.CurrentFunction;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005559 CurFun.FunctionDone();
Reid Spencer41dff5e2007-01-26 08:05:27 +00005560 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005561 ;}
5562 break;
5563
Dan Gohmane4977cf2008-05-23 01:55:30 +00005564 case 253:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005565#line 2439 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005566 {
5567 (yyval.BoolVal) = false;
Reid Spencer61c83e02006-08-18 08:43:06 +00005568 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005569 ;}
5570 break;
5571
Dan Gohmane4977cf2008-05-23 01:55:30 +00005572 case 254:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005573#line 2443 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005574 {
5575 (yyval.BoolVal) = true;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005576 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005577 ;}
5578 break;
5579
Dan Gohmane4977cf2008-05-23 01:55:30 +00005580 case 255:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005581#line 2448 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005582 { // A reference to a direct constant
5583 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005584 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005585 ;}
5586 break;
5587
Dan Gohmane4977cf2008-05-23 01:55:30 +00005588 case 256:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005589#line 2452 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005590 {
5591 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005592 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005593 ;}
5594 break;
5595
Dan Gohmane4977cf2008-05-23 01:55:30 +00005596 case 257:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005597#line 2456 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005598 { // Perhaps it's an FP constant?
5599 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00005600 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005601 ;}
5602 break;
5603
Dan Gohmane4977cf2008-05-23 01:55:30 +00005604 case 258:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005605#line 2460 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005606 {
5607 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
Reid Spencere4d87aa2006-12-23 06:05:41 +00005608 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005609 ;}
5610 break;
5611
Dan Gohmane4977cf2008-05-23 01:55:30 +00005612 case 259:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005613#line 2464 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005614 {
5615 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00005616 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005617 ;}
5618 break;
5619
Dan Gohmane4977cf2008-05-23 01:55:30 +00005620 case 260:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005621#line 2468 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005622 {
5623 (yyval.ValIDVal) = ValID::createNull();
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00005624 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005625 ;}
5626 break;
5627
Dan Gohmane4977cf2008-05-23 01:55:30 +00005628 case 261:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005629#line 2472 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005630 {
5631 (yyval.ValIDVal) = ValID::createUndef();
Reid Spencer61c83e02006-08-18 08:43:06 +00005632 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005633 ;}
5634 break;
5635
Dan Gohmane4977cf2008-05-23 01:55:30 +00005636 case 262:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005637#line 2476 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005638 { // A vector zero constant.
5639 (yyval.ValIDVal) = ValID::createZeroInit();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005640 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005641 ;}
5642 break;
5643
Dan Gohmane4977cf2008-05-23 01:55:30 +00005644 case 263:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005645#line 2480 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005646 { // Nonempty unsized packed vector
5647 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5648 int NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005649
5650 if (!ETy->isInteger() && !ETy->isFloatingPoint())
5651 GEN_ERROR("Invalid vector element type: " + ETy->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005652
Reid Spencer9d6565a2007-02-15 02:26:10 +00005653 VectorType* pt = VectorType::get(ETy, NumElements);
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005654 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(pt));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005655
5656 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00005657 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5658 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Reid Spencer61c83e02006-08-18 08:43:06 +00005659 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +00005660 ETy->getDescription() +"' as required!\nIt is of type '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00005661 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005662 }
5663
Dan Gohmanf4423b12008-04-19 00:24:39 +00005664 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5665 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
Reid Spencer832254e2007-02-02 02:16:23 +00005666 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005667 ;}
5668 break;
5669
Dan Gohmane4977cf2008-05-23 01:55:30 +00005670 case 264:
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005671#line 2502 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5672 { // Nonempty unsized arr
5673 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5674 int NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
5675
5676 if (!ETy->isFirstClassType())
5677 GEN_ERROR("Invalid array element type: " + ETy->getDescription());
5678
5679 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5680 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(ATy));
5681
5682 // Verify all elements are correct type!
5683 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5684 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
5685 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5686 ETy->getDescription() +"' as required!\nIt is of type '"+
5687 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5688 }
5689
5690 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, *(yyvsp[(2) - (3)].ConstVector)));
5691 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5692 CHECK_FOR_ERROR
5693 ;}
5694 break;
5695
5696 case 265:
5697#line 2524 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5698 {
5699 (yyval.ValIDVal) = ValID::createUndef();
5700 CHECK_FOR_ERROR
5701 ;}
5702 break;
5703
5704 case 266:
5705#line 2528 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5706 {
5707 int NumElements = (yyvsp[(2) - (2)].StrVal)->length();
5708 const Type *ETy = Type::Int8Ty;
5709
5710 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5711
5712 std::vector<Constant*> Vals;
5713 for (unsigned i = 0; i < (yyvsp[(2) - (2)].StrVal)->length(); ++i)
5714 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(2) - (2)].StrVal))[i]));
5715 delete (yyvsp[(2) - (2)].StrVal);
5716 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, Vals));
5717 CHECK_FOR_ERROR
5718 ;}
5719 break;
5720
5721 case 267:
5722#line 2541 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5723 {
5724 std::vector<const Type*> Elements((yyvsp[(2) - (3)].ConstVector)->size());
5725 for (unsigned i = 0, e = (yyvsp[(2) - (3)].ConstVector)->size(); i != e; ++i)
5726 Elements[i] = (*(yyvsp[(2) - (3)].ConstVector))[i]->getType();
5727
5728 const StructType *STy = StructType::get(Elements);
5729 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5730
5731 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(2) - (3)].ConstVector)));
5732 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5733 CHECK_FOR_ERROR
5734 ;}
5735 break;
5736
5737 case 268:
5738#line 2553 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5739 {
5740 const StructType *STy = StructType::get(std::vector<const Type*>());
5741 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5742 CHECK_FOR_ERROR
5743 ;}
5744 break;
5745
5746 case 269:
5747#line 2558 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5748 {
5749 std::vector<const Type*> Elements((yyvsp[(3) - (5)].ConstVector)->size());
5750 for (unsigned i = 0, e = (yyvsp[(3) - (5)].ConstVector)->size(); i != e; ++i)
5751 Elements[i] = (*(yyvsp[(3) - (5)].ConstVector))[i]->getType();
5752
5753 const StructType *STy = StructType::get(Elements, /*isPacked=*/true);
5754 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5755
5756 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(3) - (5)].ConstVector)));
5757 delete PTy; delete (yyvsp[(3) - (5)].ConstVector);
5758 CHECK_FOR_ERROR
5759 ;}
5760 break;
5761
5762 case 270:
5763#line 2570 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5764 {
5765 const StructType *STy = StructType::get(std::vector<const Type*>(),
5766 /*isPacked=*/true);
5767 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5768 CHECK_FOR_ERROR
5769 ;}
5770 break;
5771
5772 case 271:
5773#line 2576 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005774 {
5775 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
Reid Spencer832254e2007-02-02 02:16:23 +00005776 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005777 ;}
5778 break;
5779
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005780 case 272:
5781#line 2580 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005782 {
5783 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5784 delete (yyvsp[(3) - (5)].StrVal);
5785 delete (yyvsp[(5) - (5)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005786 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005787 ;}
5788 break;
5789
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005790 case 273:
5791#line 2590 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005792 { // Is it an integer reference...?
5793 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005794 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005795 ;}
5796 break;
5797
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005798 case 274:
5799#line 2594 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005800 {
5801 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
Reid Spencer832254e2007-02-02 02:16:23 +00005802 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005803 ;}
5804 break;
5805
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005806 case 275:
5807#line 2598 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005808 { // Is it a named reference...?
5809 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5810 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005811 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005812 ;}
5813 break;
5814
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005815 case 276:
5816#line 2603 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005817 { // Is it a named reference...?
5818 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5819 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005820 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005821 ;}
5822 break;
5823
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005824 case 279:
5825#line 2616 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005826 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005827 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005828 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5829 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5830 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005831 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005832 ;}
5833 break;
5834
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005835 case 280:
5836#line 2625 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005837 {
5838 (yyval.ValueList) = new std::vector<Value *>();
5839 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
Devang Patel7990dc72008-02-20 22:40:23 +00005840 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005841 ;}
5842 break;
5843
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005844 case 281:
5845#line 2630 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005846 {
5847 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
Devang Patel7990dc72008-02-20 22:40:23 +00005848 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005849 ;}
5850 break;
5851
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005852 case 282:
5853#line 2635 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005854 {
5855 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005856 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005857 ;}
5858 break;
5859
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005860 case 283:
5861#line 2639 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005862 { // Do not allow functions with 0 basic blocks
5863 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005864 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005865 ;}
5866 break;
5867
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005868 case 284:
5869#line 2648 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005870 {
5871 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005872 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005873 InsertValue((yyvsp[(3) - (3)].TermInstVal));
5874 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
5875 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005876 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005877 ;}
5878 break;
5879
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005880 case 285:
5881#line 2657 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005882 {
5883 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005884 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5885 if (CI2->getParent() == 0)
Dan Gohmanf4423b12008-04-19 00:24:39 +00005886 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
5887 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
5888 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005889 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005890 ;}
5891 break;
Chris Lattner38905612008-02-19 04:36:25 +00005892
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005893 case 286:
5894#line 2666 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005895 { // Empty space between instruction lists
Chris Lattnercc81d152008-05-04 17:18:47 +00005896 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
Dan Gohmanf4423b12008-04-19 00:24:39 +00005897 CHECK_FOR_ERROR
5898 ;}
5899 break;
5900
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005901 case 287:
5902#line 2670 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnercc81d152008-05-04 17:18:47 +00005903 { // Labelled (named) basic block
5904 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
5905 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005906 CHECK_FOR_ERROR
Chris Lattnercc81d152008-05-04 17:18:47 +00005907
Dan Gohmanf4423b12008-04-19 00:24:39 +00005908 ;}
5909 break;
5910
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005911 case 288:
5912#line 2678 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005913 { // Return with a result...
5914 ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
5915 assert(!VL.empty() && "Invalid ret operands!");
5916 (yyval.TermInstVal) = ReturnInst::Create(&VL[0], VL.size());
5917 delete (yyvsp[(2) - (2)].ValueList);
5918 CHECK_FOR_ERROR
5919 ;}
5920 break;
5921
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005922 case 289:
5923#line 2685 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005924 { // Return with no result...
5925 (yyval.TermInstVal) = ReturnInst::Create();
5926 CHECK_FOR_ERROR
5927 ;}
5928 break;
5929
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005930 case 290:
5931#line 2689 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005932 { // Unconditional Branch...
5933 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
5934 CHECK_FOR_ERROR
5935 (yyval.TermInstVal) = BranchInst::Create(tmpBB);
5936 ;}
5937 break;
5938
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005939 case 291:
5940#line 2694 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005941 {
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005942 if (cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() != 1)
5943 GEN_ERROR("Branch condition must have type i1");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005944 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5945 CHECK_FOR_ERROR
5946 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
5947 CHECK_FOR_ERROR
5948 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
5949 CHECK_FOR_ERROR
5950 (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal);
5951 ;}
5952 break;
5953
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005954 case 292:
5955#line 2705 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005956 {
5957 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
5958 CHECK_FOR_ERROR
5959 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5960 CHECK_FOR_ERROR
5961 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
5962 (yyval.TermInstVal) = S;
5963
5964 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
5965 E = (yyvsp[(8) - (9)].JumpTable)->end();
Reid Spencer68a24bd2005-08-27 18:50:39 +00005966 for (; I != E; ++I) {
5967 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5968 S->addCase(CI, I->second);
5969 else
Reid Spencerb5334b02007-02-05 10:18:06 +00005970 GEN_ERROR("Switch case is constant, but not a simple integer");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005971 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00005972 delete (yyvsp[(8) - (9)].JumpTable);
Reid Spencer61c83e02006-08-18 08:43:06 +00005973 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005974 ;}
5975 break;
5976
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005977 case 293:
5978#line 2724 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005979 {
5980 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005981 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005982 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005983 CHECK_FOR_ERROR
Gabor Greife64d2482008-04-06 23:07:54 +00005984 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005985 (yyval.TermInstVal) = S;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005986 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005987 ;}
5988 break;
5989
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005990 case 294:
5991#line 2734 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005992 {
Reid Spencer3822ff52006-11-08 06:47:33 +00005993
Reid Spencer14310612006-12-31 05:40:51 +00005994 // Handle the short syntax
5995 const PointerType *PFTy = 0;
5996 const FunctionType *Ty = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005997 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
Reid Spencer68a24bd2005-08-27 18:50:39 +00005998 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5999 // Pull out the types of all of the arguments...
6000 std::vector<const Type*> ParamTypes;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006001 ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006002 for (; I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00006003 const Type *Ty = I->Val->getType();
6004 if (Ty == Type::VoidTy)
6005 GEN_ERROR("Short call syntax cannot be used with varargs");
6006 ParamTypes.push_back(Ty);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006007 }
Chris Lattnera925a142008-04-23 05:37:08 +00006008
6009 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (14)].TypeVal)))
6010 GEN_ERROR("Invalid result type for LLVM function");
6011
Dan Gohmanf4423b12008-04-19 00:24:39 +00006012 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00006013 PFTy = PointerType::getUnqual(Ty);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006014 }
6015
Dan Gohmanf4423b12008-04-19 00:24:39 +00006016 delete (yyvsp[(3) - (14)].TypeVal);
Reid Spencer66728ef2007-03-20 01:13:36 +00006017
Dan Gohmanf4423b12008-04-19 00:24:39 +00006018 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00006019 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006020 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006021 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006022 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00006023 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00006024
Chris Lattner58d74912008-03-12 17:45:29 +00006025 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006026 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None)
6027 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (14)].ParamAttrs)));
Duncan Sandsdc024672007-11-27 13:23:08 +00006028
Reid Spencer14310612006-12-31 05:40:51 +00006029 // Check the arguments
6030 ValueList Args;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006031 if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments?
Reid Spencer14310612006-12-31 05:40:51 +00006032 // Make sure no arguments is a good thing!
6033 if (Ty->getNumParams() != 0)
6034 GEN_ERROR("No arguments passed to a function that "
Reid Spencerb5334b02007-02-05 10:18:06 +00006035 "expects arguments");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006036 } else { // Has arguments?
6037 // Loop through FunctionType's arguments and ensure they are specified
6038 // correctly!
Reid Spencer68a24bd2005-08-27 18:50:39 +00006039 FunctionType::param_iterator I = Ty->param_begin();
6040 FunctionType::param_iterator E = Ty->param_end();
Dan Gohmanf4423b12008-04-19 00:24:39 +00006041 ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006042 unsigned index = 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00006043
Duncan Sandsdc024672007-11-27 13:23:08 +00006044 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006045 if (ArgI->Val->getType() != *I)
6046 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00006047 (*I)->getDescription() + "'");
Reid Spencer14310612006-12-31 05:40:51 +00006048 Args.push_back(ArgI->Val);
Chris Lattner58d74912008-03-12 17:45:29 +00006049 if (ArgI->Attrs != ParamAttr::None)
6050 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00006051 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00006052
Reid Spencer14310612006-12-31 05:40:51 +00006053 if (Ty->isVarArg()) {
6054 if (I == E)
Chris Lattner38905612008-02-19 04:36:25 +00006055 for (; ArgI != ArgE; ++ArgI, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006056 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner58d74912008-03-12 17:45:29 +00006057 if (ArgI->Attrs != ParamAttr::None)
6058 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Chris Lattner38905612008-02-19 04:36:25 +00006059 }
Reid Spencer14310612006-12-31 05:40:51 +00006060 } else if (I != E || ArgI != ArgE)
Reid Spencerb5334b02007-02-05 10:18:06 +00006061 GEN_ERROR("Invalid number of parameters detected");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006062 }
Reid Spencer14310612006-12-31 05:40:51 +00006063
Chris Lattner58d74912008-03-12 17:45:29 +00006064 PAListPtr PAL;
Duncan Sandsdc024672007-11-27 13:23:08 +00006065 if (!Attrs.empty())
Chris Lattner58d74912008-03-12 17:45:29 +00006066 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsdc024672007-11-27 13:23:08 +00006067
Reid Spencer14310612006-12-31 05:40:51 +00006068 // Create the InvokeInst
Dan Gohman041e2eb2008-05-15 19:50:34 +00006069 InvokeInst *II = InvokeInst::Create(V, Normal, Except,
6070 Args.begin(), Args.end());
Dan Gohmanf4423b12008-04-19 00:24:39 +00006071 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
Duncan Sandsdc024672007-11-27 13:23:08 +00006072 II->setParamAttrs(PAL);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006073 (yyval.TermInstVal) = II;
6074 delete (yyvsp[(6) - (14)].ParamList);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006075 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006076 ;}
6077 break;
6078
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006079 case 295:
6080#line 2819 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006081 {
6082 (yyval.TermInstVal) = new UnwindInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00006083 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006084 ;}
6085 break;
6086
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006087 case 296:
6088#line 2823 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006089 {
6090 (yyval.TermInstVal) = new UnreachableInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00006091 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006092 ;}
6093 break;
6094
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006095 case 297:
6096#line 2830 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006097 {
6098 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
6099 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006100 CHECK_FOR_ERROR
6101 if (V == 0)
6102 GEN_ERROR("May only switch on a constant pool value");
6103
Dan Gohmanf4423b12008-04-19 00:24:39 +00006104 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006105 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006106 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
6107 ;}
6108 break;
6109
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006110 case 298:
6111#line 2841 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006112 {
6113 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
6114 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006115 CHECK_FOR_ERROR
6116
6117 if (V == 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00006118 GEN_ERROR("May only switch on a constant pool value");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006119
Dan Gohmanf4423b12008-04-19 00:24:39 +00006120 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006121 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006122 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
6123 ;}
6124 break;
6125
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006126 case 299:
6127#line 2854 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006128 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006129 // Is this definition named?? if so, assign the name...
Dan Gohmanf4423b12008-04-19 00:24:39 +00006130 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006131 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006132 InsertValue((yyvsp[(2) - (2)].InstVal));
6133 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006134 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006135 ;}
6136 break;
6137
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006138 case 300:
6139#line 2864 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006140 { // Used for PHI nodes
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006141 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006142 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
6143 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
6144 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
Reid Spencer6f407902007-01-13 05:00:46 +00006145 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006146 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006147 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006148 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6149 delete (yyvsp[(1) - (6)].TypeVal);
6150 ;}
6151 break;
6152
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006153 case 301:
6154#line 2875 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006155 {
6156 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
6157 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006158 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006159 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006160 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006161 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6162 ;}
6163 break;
6164
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006165 case 302:
6166#line 2885 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006167 {
Duncan Sandsdc024672007-11-27 13:23:08 +00006168 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006169 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006170 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006171 // Used for call and invoke instructions
Dan Gohmanf4423b12008-04-19 00:24:39 +00006172 (yyval.ParamList) = new ParamList();
6173 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
6174 (yyval.ParamList)->push_back(E);
6175 delete (yyvsp[(1) - (4)].TypeVal);
Duncan Sandsdc024672007-11-27 13:23:08 +00006176 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006177 ;}
6178 break;
6179
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006180 case 303:
6181#line 2896 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006182 {
Duncan Sandsdc024672007-11-27 13:23:08 +00006183 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dale Johanneseneb57ea72007-11-05 21:20:28 +00006184 // Labels are only valid in ASMs
Dan Gohmanf4423b12008-04-19 00:24:39 +00006185 (yyval.ParamList) = new ParamList();
6186 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
6187 (yyval.ParamList)->push_back(E);
Duncan Sandsdc024672007-11-27 13:23:08 +00006188 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006189 ;}
6190 break;
6191
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006192 case 304:
6193#line 2904 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006194 {
Duncan Sandsdc024672007-11-27 13:23:08 +00006195 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006196 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006197 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6198 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
6199 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
6200 (yyval.ParamList)->push_back(E);
6201 delete (yyvsp[(3) - (6)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006202 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006203 ;}
6204 break;
6205
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006206 case 305:
6207#line 2914 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006208 {
Duncan Sandsdc024672007-11-27 13:23:08 +00006209 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf4423b12008-04-19 00:24:39 +00006210 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
6211 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
6212 (yyval.ParamList)->push_back(E);
Dale Johanneseneb57ea72007-11-05 21:20:28 +00006213 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006214 ;}
6215 break;
6216
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006217 case 306:
6218#line 2921 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006219 { (yyval.ParamList) = new ParamList(); ;}
6220 break;
6221
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006222 case 307:
6223#line 2924 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006224 { (yyval.ValueList) = new std::vector<Value*>(); ;}
6225 break;
6226
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006227 case 308:
6228#line 2925 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006229 {
6230 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
6231 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00006232 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006233 ;}
6234 break;
6235
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006236 case 309:
6237#line 2933 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006238 {
6239 (yyval.ConstantList) = new std::vector<unsigned>();
6240 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
6241 GEN_ERROR("Index " + utostr((yyvsp[(2) - (2)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6242 (yyval.ConstantList)->push_back((yyvsp[(2) - (2)].UInt64Val));
6243 ;}
6244 break;
6245
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006246 case 310:
6247#line 2939 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006248 {
6249 (yyval.ConstantList) = (yyvsp[(1) - (3)].ConstantList);
6250 if ((unsigned)(yyvsp[(3) - (3)].UInt64Val) != (yyvsp[(3) - (3)].UInt64Val))
6251 GEN_ERROR("Index " + utostr((yyvsp[(3) - (3)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6252 (yyval.ConstantList)->push_back((yyvsp[(3) - (3)].UInt64Val));
6253 CHECK_FOR_ERROR
6254 ;}
6255 break;
6256
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006257 case 311:
6258#line 2948 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006259 {
6260 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00006261 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006262 ;}
6263 break;
6264
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006265 case 312:
6266#line 2952 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006267 {
6268 (yyval.BoolVal) = false;
Andrew Lenharth6353e052006-12-08 18:07:09 +00006269 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006270 ;}
6271 break;
6272
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006273 case 313:
6274#line 2957 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006275 {
Reid Spencer14310612006-12-31 05:40:51 +00006276 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006277 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6278 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
6279 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006280 GEN_ERROR(
6281 "Arithmetic operator requires integer, FP, or packed operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006282 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006283 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006284 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006285 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006286 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006287 if ((yyval.InstVal) == 0)
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006288 GEN_ERROR("binary operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006289 delete (yyvsp[(2) - (5)].TypeVal);
6290 ;}
6291 break;
6292
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006293 case 314:
6294#line 2973 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006295 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006296 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006297 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6298 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
6299 if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
6300 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006301 GEN_ERROR("Logical operator requires integral operands");
6302 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006303 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006304 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006305 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006306 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006307 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006308 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006309 GEN_ERROR("binary operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006310 delete (yyvsp[(2) - (5)].TypeVal);
6311 ;}
6312 break;
6313
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006314 case 315:
6315#line 2990 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006316 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006317 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006318 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6319 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006320 GEN_ERROR("Vector types not supported by icmp instruction");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006321 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006322 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006323 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006324 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006325 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006326 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006327 GEN_ERROR("icmp operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006328 delete (yyvsp[(3) - (6)].TypeVal);
6329 ;}
6330 break;
6331
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006332 case 316:
6333#line 3004 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006334 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006335 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006336 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6337 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006338 GEN_ERROR("Vector types not supported by fcmp instruction");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006339 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006340 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006341 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006342 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006343 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006344 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006345 GEN_ERROR("fcmp operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006346 delete (yyvsp[(3) - (6)].TypeVal);
6347 ;}
6348 break;
6349
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006350 case 317:
6351#line 3018 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00006352 {
6353 if (!UpRefs.empty())
6354 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6355 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6356 GEN_ERROR("Scalar types not supported by vicmp instruction");
6357 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6358 CHECK_FOR_ERROR
6359 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6360 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006361 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Nate Begemanac80ade2008-05-12 19:01:56 +00006362 if ((yyval.InstVal) == 0)
6363 GEN_ERROR("icmp operator returned null");
6364 delete (yyvsp[(3) - (6)].TypeVal);
6365 ;}
6366 break;
6367
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006368 case 318:
6369#line 3032 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00006370 {
6371 if (!UpRefs.empty())
6372 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6373 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6374 GEN_ERROR("Scalar types not supported by vfcmp instruction");
6375 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6376 CHECK_FOR_ERROR
6377 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6378 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006379 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Nate Begemanac80ade2008-05-12 19:01:56 +00006380 if ((yyval.InstVal) == 0)
6381 GEN_ERROR("fcmp operator returned null");
6382 delete (yyvsp[(3) - (6)].TypeVal);
6383 ;}
6384 break;
6385
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006386 case 319:
6387#line 3046 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006388 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006389 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006390 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6391 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6392 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6393 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006394 GEN_ERROR("invalid cast opcode for cast from '" +
6395 Val->getType()->getDescription() + "' to '" +
6396 DestTy->getDescription() + "'");
Dan Gohmane4977cf2008-05-23 01:55:30 +00006397 (yyval.InstVal) = CastInst::Create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006398 delete (yyvsp[(4) - (4)].TypeVal);
6399 ;}
6400 break;
6401
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006402 case 320:
6403#line 3058 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006404 {
6405 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006406 GEN_ERROR("select condition must be boolean");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006407 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006408 GEN_ERROR("select value types should match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006409 (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006410 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006411 ;}
6412 break;
6413
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006414 case 321:
6415#line 3066 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006416 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006417 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006418 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6419 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6420 delete (yyvsp[(4) - (4)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006421 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006422 ;}
6423 break;
6424
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006425 case 322:
6426#line 3073 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006427 {
6428 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006429 GEN_ERROR("Invalid extractelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006430 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006431 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006432 ;}
6433 break;
6434
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006435 case 323:
6436#line 3079 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006437 {
6438 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006439 GEN_ERROR("Invalid insertelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006440 (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006441 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006442 ;}
6443 break;
6444
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006445 case 324:
6446#line 3085 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006447 {
6448 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006449 GEN_ERROR("Invalid shufflevector operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006450 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006451 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006452 ;}
6453 break;
6454
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006455 case 325:
6456#line 3091 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006457 {
6458 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006459 if (!Ty->isFirstClassType())
6460 GEN_ERROR("PHI node operands must be of first class type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006461 (yyval.InstVal) = PHINode::Create(Ty);
6462 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6463 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6464 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006465 GEN_ERROR("All elements of a PHI node must be of the same type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006466 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6467 (yyvsp[(2) - (2)].PHIList)->pop_front();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006468 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006469 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006470 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006471 ;}
6472 break;
6473
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006474 case 326:
6475#line 3107 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006476 {
Reid Spencer14310612006-12-31 05:40:51 +00006477
6478 // Handle the short syntax
Andrew Lenharth6353e052006-12-08 18:07:09 +00006479 const PointerType *PFTy = 0;
6480 const FunctionType *Ty = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006481 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
Andrew Lenharth6353e052006-12-08 18:07:09 +00006482 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6483 // Pull out the types of all of the arguments...
6484 std::vector<const Type*> ParamTypes;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006485 ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006486 for (; I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00006487 const Type *Ty = I->Val->getType();
6488 if (Ty == Type::VoidTy)
6489 GEN_ERROR("Short call syntax cannot be used with varargs");
6490 ParamTypes.push_back(Ty);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006491 }
Chris Lattnera925a142008-04-23 05:37:08 +00006492
6493 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (8)].TypeVal)))
6494 GEN_ERROR("Invalid result type for LLVM function");
6495
Dan Gohmanf4423b12008-04-19 00:24:39 +00006496 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00006497 PFTy = PointerType::getUnqual(Ty);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006498 }
Chris Lattner6cdc6822007-04-26 05:31:05 +00006499
Dan Gohmanf4423b12008-04-19 00:24:39 +00006500 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00006501 CHECK_FOR_ERROR
Chris Lattner6cdc6822007-04-26 05:31:05 +00006502
Reid Spencer7780acb2007-04-16 06:56:07 +00006503 // Check for call to invalid intrinsic to avoid crashing later.
6504 if (Function *theF = dyn_cast<Function>(V)) {
Reid Spencered48de22007-04-16 22:02:23 +00006505 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
Reid Spencer36fdde12007-04-16 20:35:38 +00006506 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6507 !theF->getIntrinsicID(true))
Reid Spencer7780acb2007-04-16 06:56:07 +00006508 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6509 theF->getName() + "'");
6510 }
6511
Duncan Sandsdc024672007-11-27 13:23:08 +00006512 // Set up the ParamAttrs for the function
Chris Lattner58d74912008-03-12 17:45:29 +00006513 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006514 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None)
6515 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (8)].ParamAttrs)));
Reid Spencer14310612006-12-31 05:40:51 +00006516 // Check the arguments
6517 ValueList Args;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006518 if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments?
Andrew Lenharth6353e052006-12-08 18:07:09 +00006519 // Make sure no arguments is a good thing!
6520 if (Ty->getNumParams() != 0)
6521 GEN_ERROR("No arguments passed to a function that "
Reid Spencerb5334b02007-02-05 10:18:06 +00006522 "expects arguments");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006523 } else { // Has arguments?
6524 // Loop through FunctionType's arguments and ensure they are specified
Duncan Sandsdc024672007-11-27 13:23:08 +00006525 // correctly. Also, gather any parameter attributes.
Andrew Lenharth6353e052006-12-08 18:07:09 +00006526 FunctionType::param_iterator I = Ty->param_begin();
6527 FunctionType::param_iterator E = Ty->param_end();
Dan Gohmanf4423b12008-04-19 00:24:39 +00006528 ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006529 unsigned index = 1;
Andrew Lenharth6353e052006-12-08 18:07:09 +00006530
Duncan Sandsdc024672007-11-27 13:23:08 +00006531 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006532 if (ArgI->Val->getType() != *I)
6533 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00006534 (*I)->getDescription() + "'");
Reid Spencer14310612006-12-31 05:40:51 +00006535 Args.push_back(ArgI->Val);
Chris Lattner58d74912008-03-12 17:45:29 +00006536 if (ArgI->Attrs != ParamAttr::None)
6537 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00006538 }
6539 if (Ty->isVarArg()) {
6540 if (I == E)
Chris Lattner38905612008-02-19 04:36:25 +00006541 for (; ArgI != ArgE; ++ArgI, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006542 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner58d74912008-03-12 17:45:29 +00006543 if (ArgI->Attrs != ParamAttr::None)
6544 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Chris Lattner38905612008-02-19 04:36:25 +00006545 }
Reid Spencer14310612006-12-31 05:40:51 +00006546 } else if (I != E || ArgI != ArgE)
Reid Spencerb5334b02007-02-05 10:18:06 +00006547 GEN_ERROR("Invalid number of parameters detected");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006548 }
Duncan Sandsdc024672007-11-27 13:23:08 +00006549
6550 // Finish off the ParamAttrs and check them
Chris Lattner58d74912008-03-12 17:45:29 +00006551 PAListPtr PAL;
Duncan Sandsdc024672007-11-27 13:23:08 +00006552 if (!Attrs.empty())
Chris Lattner58d74912008-03-12 17:45:29 +00006553 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsdc024672007-11-27 13:23:08 +00006554
Reid Spencer14310612006-12-31 05:40:51 +00006555 // Create the call node
Gabor Greife64d2482008-04-06 23:07:54 +00006556 CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
Dan Gohmanf4423b12008-04-19 00:24:39 +00006557 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6558 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
Duncan Sandsdc024672007-11-27 13:23:08 +00006559 CI->setParamAttrs(PAL);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006560 (yyval.InstVal) = CI;
6561 delete (yyvsp[(6) - (8)].ParamList);
6562 delete (yyvsp[(3) - (8)].TypeVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00006563 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006564 ;}
6565 break;
6566
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006567 case 327:
6568#line 3196 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006569 {
6570 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00006571 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006572 ;}
6573 break;
6574
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006575 case 328:
6576#line 3201 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006577 {
6578 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00006579 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006580 ;}
6581 break;
6582
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006583 case 329:
6584#line 3205 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006585 {
6586 (yyval.BoolVal) = false;
Reid Spencer61c83e02006-08-18 08:43:06 +00006587 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006588 ;}
6589 break;
6590
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006591 case 330:
6592#line 3212 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006593 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006594 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006595 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6596 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6597 delete (yyvsp[(2) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006598 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006599 ;}
6600 break;
6601
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006602 case 331:
6603#line 3219 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006604 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006605 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006606 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006607 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6608 GEN_ERROR("Malloc array size is not a 32-bit integer!");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006609 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00006610 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006611 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6612 delete (yyvsp[(2) - (6)].TypeVal);
6613 ;}
6614 break;
6615
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006616 case 332:
6617#line 3229 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006618 {
Reid Spencer14310612006-12-31 05:40:51 +00006619 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006620 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6621 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6622 delete (yyvsp[(2) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006623 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006624 ;}
6625 break;
6626
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006627 case 333:
6628#line 3236 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006629 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006630 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006631 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006632 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6633 GEN_ERROR("Alloca array size is not a 32-bit integer!");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006634 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006635 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006636 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6637 delete (yyvsp[(2) - (6)].TypeVal);
6638 ;}
6639 break;
6640
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006641 case 334:
6642#line 3246 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006643 {
6644 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006645 GEN_ERROR("Trying to free nonpointer type " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006646 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6647 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006648 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006649 ;}
6650 break;
6651
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006652 case 335:
6653#line 3254 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006654 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006655 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006656 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6657 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006658 GEN_ERROR("Can't load from nonpointer type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006659 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6660 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006661 GEN_ERROR("Can't load from pointer of non-first-class type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006662 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6663 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006664 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006665 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6666 delete (yyvsp[(3) - (5)].TypeVal);
6667 ;}
6668 break;
6669
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006670 case 336:
6671#line 3268 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006672 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006673 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006674 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6675 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006676 if (!PT)
6677 GEN_ERROR("Can't store to a nonpointer type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006678 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006679 const Type *ElTy = PT->getElementType();
Dan Gohmanf4423b12008-04-19 00:24:39 +00006680 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6681 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006682 "' into space of type '" + ElTy->getDescription() + "'");
6683
Dan Gohmanf4423b12008-04-19 00:24:39 +00006684 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006685 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006686 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6687 delete (yyvsp[(5) - (7)].TypeVal);
6688 ;}
6689 break;
6690
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006691 case 337:
6692#line 3285 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006693 {
6694 Value *TmpVal = getVal((yyvsp[(2) - (5)].TypeVal)->get(), (yyvsp[(3) - (5)].ValIDVal));
6695 if (!GetResultInst::isValidOperands(TmpVal, (yyvsp[(5) - (5)].UInt64Val)))
Devang Patel5a970972008-02-19 22:27:01 +00006696 GEN_ERROR("Invalid getresult operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006697 (yyval.InstVal) = new GetResultInst(TmpVal, (yyvsp[(5) - (5)].UInt64Val));
6698 delete (yyvsp[(2) - (5)].TypeVal);
Devang Patel5a970972008-02-19 22:27:01 +00006699 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006700 ;}
6701 break;
6702
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006703 case 338:
6704#line 3293 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006705 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006706 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006707 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6708 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
Reid Spencerb5334b02007-02-05 10:18:06 +00006709 GEN_ERROR("getelementptr insn requires pointer operand");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006710
Dan Gohman041e2eb2008-05-15 19:50:34 +00006711 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()))
Reid Spencer61c83e02006-08-18 08:43:06 +00006712 GEN_ERROR("Invalid getelementptr indices for type '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006713 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6714 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00006715 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006716 (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6717 delete (yyvsp[(2) - (4)].TypeVal);
6718 delete (yyvsp[(4) - (4)].ValueList);
6719 ;}
6720 break;
Reid Spencer7780acb2007-04-16 06:56:07 +00006721
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006722 case 339:
6723#line 3308 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00006724 {
6725 if (!UpRefs.empty())
6726 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6727 if (!isa<StructType>((yyvsp[(2) - (4)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (4)].TypeVal)->get()))
6728 GEN_ERROR("extractvalue insn requires an aggregate operand");
6729
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006730 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end()))
Dan Gohmane4977cf2008-05-23 01:55:30 +00006731 GEN_ERROR("Invalid extractvalue indices for type '" +
6732 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6733 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6734 CHECK_FOR_ERROR
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006735 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end());
Dan Gohmane4977cf2008-05-23 01:55:30 +00006736 delete (yyvsp[(2) - (4)].TypeVal);
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006737 delete (yyvsp[(4) - (4)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00006738 ;}
6739 break;
6740
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006741 case 340:
6742#line 3323 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00006743 {
6744 if (!UpRefs.empty())
6745 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription());
6746 if (!isa<StructType>((yyvsp[(2) - (7)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (7)].TypeVal)->get()))
6747 GEN_ERROR("extractvalue insn requires an aggregate operand");
6748
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006749 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 +00006750 GEN_ERROR("Invalid insertvalue indices for type '" +
6751 (*(yyvsp[(2) - (7)].TypeVal))->getDescription()+ "'");
6752 Value* aggVal = getVal(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(3) - (7)].ValIDVal));
6753 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
6754 CHECK_FOR_ERROR
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006755 (yyval.InstVal) = InsertValueInst::Create(aggVal, tmpVal, (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end());
Dan Gohmane4977cf2008-05-23 01:55:30 +00006756 delete (yyvsp[(2) - (7)].TypeVal);
6757 delete (yyvsp[(5) - (7)].TypeVal);
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006758 delete (yyvsp[(7) - (7)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00006759 ;}
6760 break;
6761
Dan Gohmanf4423b12008-04-19 00:24:39 +00006762
6763/* Line 1267 of yacc.c. */
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006764#line 6765 "llvmAsmParser.tab.c"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006765 default: break;
Dale Johannesencdd509a2007-09-07 21:07:57 +00006766 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006767 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6768
6769 YYPOPSTACK (yylen);
6770 yylen = 0;
6771 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006772
6773 *++yyvsp = yyval;
6774
6775
Dan Gohmanf4423b12008-04-19 00:24:39 +00006776 /* Now `shift' the result of the reduction. Determine what state
6777 that goes to, based on the state we popped back to and the rule
6778 number reduced by. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00006779
6780 yyn = yyr1[yyn];
6781
Dan Gohmanf4423b12008-04-19 00:24:39 +00006782 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6783 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00006784 yystate = yytable[yystate];
6785 else
Dan Gohmanf4423b12008-04-19 00:24:39 +00006786 yystate = yydefgoto[yyn - YYNTOKENS];
Reid Spencer68a24bd2005-08-27 18:50:39 +00006787
6788 goto yynewstate;
6789
6790
Dan Gohmanf4423b12008-04-19 00:24:39 +00006791/*------------------------------------.
6792| yyerrlab -- here on detecting error |
6793`------------------------------------*/
6794yyerrlab:
6795 /* If not already recovering from an error, report this error. */
6796 if (!yyerrstatus)
Reid Spencer68a24bd2005-08-27 18:50:39 +00006797 {
6798 ++yynerrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006799#if ! YYERROR_VERBOSE
6800 yyerror (YY_("syntax error"));
6801#else
6802 {
6803 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
6804 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
6805 {
6806 YYSIZE_T yyalloc = 2 * yysize;
6807 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
6808 yyalloc = YYSTACK_ALLOC_MAXIMUM;
6809 if (yymsg != yymsgbuf)
6810 YYSTACK_FREE (yymsg);
6811 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
6812 if (yymsg)
6813 yymsg_alloc = yyalloc;
6814 else
6815 {
6816 yymsg = yymsgbuf;
6817 yymsg_alloc = sizeof yymsgbuf;
6818 }
6819 }
Dale Johannesencdd509a2007-09-07 21:07:57 +00006820
Dan Gohmanf4423b12008-04-19 00:24:39 +00006821 if (0 < yysize && yysize <= yymsg_alloc)
6822 {
6823 (void) yysyntax_error (yymsg, yystate, yychar);
6824 yyerror (yymsg);
6825 }
6826 else
6827 {
6828 yyerror (YY_("syntax error"));
6829 if (yysize != 0)
6830 goto yyexhaustedlab;
6831 }
6832 }
6833#endif
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006834 }
6835
Dan Gohmanf4423b12008-04-19 00:24:39 +00006836
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006837
6838 if (yyerrstatus == 3)
6839 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00006840 /* If just tried and failed to reuse look-ahead token after an
6841 error, discard it. */
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006842
Dan Gohmanf4423b12008-04-19 00:24:39 +00006843 if (yychar <= YYEOF)
6844 {
6845 /* Return failure if at end of input. */
6846 if (yychar == YYEOF)
6847 YYABORT;
6848 }
6849 else
6850 {
6851 yydestruct ("Error: discarding",
6852 yytoken, &yylval);
6853 yychar = YYEMPTY;
6854 }
6855 }
6856
6857 /* Else will try to reuse look-ahead token after shifting the error
6858 token. */
6859 goto yyerrlab1;
6860
6861
6862/*---------------------------------------------------.
6863| yyerrorlab -- error raised explicitly by YYERROR. |
6864`---------------------------------------------------*/
6865yyerrorlab:
6866
6867 /* Pacify compilers like GCC when the user code never invokes
6868 YYERROR and the label yyerrorlab therefore never appears in user
6869 code. */
6870 if (/*CONSTCOND*/ 0)
6871 goto yyerrorlab;
6872
6873 /* Do not reclaim the symbols of the rule which action triggered
6874 this YYERROR. */
6875 YYPOPSTACK (yylen);
6876 yylen = 0;
6877 YY_STACK_PRINT (yyss, yyssp);
6878 yystate = *yyssp;
6879 goto yyerrlab1;
6880
6881
6882/*-------------------------------------------------------------.
6883| yyerrlab1 -- common code for both syntax error and YYERROR. |
6884`-------------------------------------------------------------*/
6885yyerrlab1:
6886 yyerrstatus = 3; /* Each real token shifted decrements this. */
6887
6888 for (;;)
6889 {
6890 yyn = yypact[yystate];
6891 if (yyn != YYPACT_NINF)
6892 {
6893 yyn += YYTERROR;
6894 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6895 {
6896 yyn = yytable[yyn];
6897 if (0 < yyn)
6898 break;
6899 }
6900 }
6901
6902 /* Pop the current state because it cannot handle the error token. */
6903 if (yyssp == yyss)
Reid Spencer68a24bd2005-08-27 18:50:39 +00006904 YYABORT;
6905
Dale Johannesencdd509a2007-09-07 21:07:57 +00006906
Dan Gohmanf4423b12008-04-19 00:24:39 +00006907 yydestruct ("Error: popping",
6908 yystos[yystate], yyvsp);
6909 YYPOPSTACK (1);
6910 yystate = *yyssp;
6911 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006912 }
6913
6914 if (yyn == YYFINAL)
6915 YYACCEPT;
6916
Reid Spencer68a24bd2005-08-27 18:50:39 +00006917 *++yyvsp = yylval;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006918
6919
6920 /* Shift the error token. */
6921 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spencerb8f85052007-07-31 03:50:36 +00006922
Reid Spencer68a24bd2005-08-27 18:50:39 +00006923 yystate = yyn;
6924 goto yynewstate;
6925
Gabor Greife64d2482008-04-06 23:07:54 +00006926
Dan Gohmanf4423b12008-04-19 00:24:39 +00006927/*-------------------------------------.
6928| yyacceptlab -- YYACCEPT comes here. |
6929`-------------------------------------*/
6930yyacceptlab:
6931 yyresult = 0;
6932 goto yyreturn;
6933
6934/*-----------------------------------.
6935| yyabortlab -- YYABORT comes here. |
6936`-----------------------------------*/
6937yyabortlab:
6938 yyresult = 1;
6939 goto yyreturn;
6940
6941#ifndef yyoverflow
6942/*-------------------------------------------------.
6943| yyexhaustedlab -- memory exhaustion comes here. |
6944`-------------------------------------------------*/
6945yyexhaustedlab:
6946 yyerror (YY_("memory exhausted"));
6947 yyresult = 2;
6948 /* Fall through. */
Chris Lattner38905612008-02-19 04:36:25 +00006949#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00006950
6951yyreturn:
6952 if (yychar != YYEOF && yychar != YYEMPTY)
6953 yydestruct ("Cleanup: discarding lookahead",
6954 yytoken, &yylval);
6955 /* Do not reclaim the symbols of the rule which action triggered
6956 this YYABORT or YYACCEPT. */
6957 YYPOPSTACK (yylen);
6958 YY_STACK_PRINT (yyss, yyssp);
6959 while (yyssp != yyss)
6960 {
6961 yydestruct ("Cleanup: popping",
6962 yystos[*yyssp], yyvsp);
6963 YYPOPSTACK (1);
Gabor Greife64d2482008-04-06 23:07:54 +00006964 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006965#ifndef yyoverflow
6966 if (yyss != yyssa)
6967 YYSTACK_FREE (yyss);
6968#endif
6969#if YYERROR_VERBOSE
6970 if (yymsg != yymsgbuf)
6971 YYSTACK_FREE (yymsg);
6972#endif
6973 /* Make sure YYID is used. */
6974 return YYID (yyresult);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006975}
Dan Gohmanf4423b12008-04-19 00:24:39 +00006976
6977
Dan Gohmanf910eaa2008-06-09 14:45:02 +00006978#line 3342 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Reid Spencer61c83e02006-08-18 08:43:06 +00006979
6980
Reid Spencer14310612006-12-31 05:40:51 +00006981// common code from the two 'RunVMAsmParser' functions
6982static Module* RunParser(Module * M) {
Reid Spencer14310612006-12-31 05:40:51 +00006983 CurModule.CurrentModule = M;
Reid Spencer14310612006-12-31 05:40:51 +00006984 // Check to make sure the parser succeeded
6985 if (yyparse()) {
6986 if (ParserResult)
6987 delete ParserResult;
6988 return 0;
6989 }
6990
Reid Spencer0d60b5a2007-03-30 01:37:39 +00006991 // Emit an error if there are any unresolved types left.
6992 if (!CurModule.LateResolveTypes.empty()) {
6993 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6994 if (DID.Type == ValID::LocalName) {
6995 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6996 } else {
6997 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
6998 }
6999 if (ParserResult)
7000 delete ParserResult;
7001 return 0;
7002 }
7003
7004 // Emit an error if there are any unresolved values left.
7005 if (!CurModule.LateResolveValues.empty()) {
7006 Value *V = CurModule.LateResolveValues.back();
7007 std::map<Value*, std::pair<ValID, int> >::iterator I =
7008 CurModule.PlaceHolderInfo.find(V);
7009
7010 if (I != CurModule.PlaceHolderInfo.end()) {
7011 ValID &DID = I->second.first;
7012 if (DID.Type == ValID::LocalName) {
7013 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
7014 } else {
7015 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
7016 }
7017 if (ParserResult)
7018 delete ParserResult;
7019 return 0;
7020 }
7021 }
7022
Reid Spencer14310612006-12-31 05:40:51 +00007023 // Check to make sure that parsing produced a result
7024 if (!ParserResult)
7025 return 0;
7026
7027 // Reset ParserResult variable while saving its value for the result.
7028 Module *Result = ParserResult;
7029 ParserResult = 0;
7030
7031 return Result;
7032}
7033
Reid Spencer61c83e02006-08-18 08:43:06 +00007034void llvm::GenerateError(const std::string &message, int LineNo) {
Duncan Sandsdc024672007-11-27 13:23:08 +00007035 if (LineNo == -1) LineNo = LLLgetLineNo();
Reid Spencer61c83e02006-08-18 08:43:06 +00007036 // TODO: column number in exception
7037 if (TheParseError)
Duncan Sandsdc024672007-11-27 13:23:08 +00007038 TheParseError->setError(LLLgetFilename(), message, LineNo);
Reid Spencer61c83e02006-08-18 08:43:06 +00007039 TriggerError = 1;
7040}
Reid Spencer68a24bd2005-08-27 18:50:39 +00007041
7042int yyerror(const char *ErrorMsg) {
Duncan Sandsdc024672007-11-27 13:23:08 +00007043 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
Reid Spenceref9b9a72007-02-05 20:47:22 +00007044 std::string errMsg = where + "error: " + std::string(ErrorMsg);
Duncan Sandsdc024672007-11-27 13:23:08 +00007045 if (yychar != YYEMPTY && yychar != 0) {
7046 errMsg += " while reading token: '";
7047 errMsg += std::string(LLLgetTokenStart(),
7048 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
7049 }
Reid Spencer61c83e02006-08-18 08:43:06 +00007050 GenerateError(errMsg);
Reid Spencer68a24bd2005-08-27 18:50:39 +00007051 return 0;
7052}
Dan Gohmanf4423b12008-04-19 00:24:39 +00007053