blob: c4dd86be980e8c16026ccbff21c47f39f34d8d52 [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}
1399/* Line 193 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_
1463# if defined YYENABLE_NLS && YYENABLE_NLS
1464# 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 Gohman81a0c0b2008-05-31 00:58:22 +00001628#define YYLAST 2191
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 Gohman81a0c0b2008-05-31 00:58:22 +00001635#define YYNRULES 333
Dan Gohmanf4423b12008-04-19 00:24:39 +00001636/* YYNRULES -- Number of states. */
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001637#define YYNSTATES 683
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,
1724 740, 742, 744, 746, 750, 752, 758, 760, 762, 764,
1725 766, 768, 770, 773, 775, 779, 782, 785, 789, 792,
1726 793, 795, 798, 801, 805, 815, 825, 834, 849, 851,
1727 853, 860, 866, 869, 876, 884, 889, 894, 901, 908,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001728 909, 910, 914, 917, 921, 924, 926, 932, 938, 945,
1729 952, 959, 966, 971, 978, 983, 988, 995, 1002, 1005,
1730 1014, 1016, 1018, 1019, 1023, 1030, 1034, 1041, 1044, 1050,
1731 1058, 1064, 1069, 1074
Dan Gohmanf4423b12008-04-19 00:24:39 +00001732};
1733
1734/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1735static const yytype_int16 yyrhs[] =
1736{
Dan Gohmane4977cf2008-05-23 01:55:30 +00001737 216, 0, -1, 75, -1, 76, -1, 77, -1, 78,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001738 -1, 79, -1, 80, -1, 81, -1, 82, -1, 83,
1739 -1, 87, -1, 88, -1, 89, -1, 84, -1, 85,
1740 -1, 86, -1, 120, -1, 121, -1, 122, -1, 123,
1741 -1, 124, -1, 125, -1, 126, -1, 127, -1, 128,
1742 -1, 129, -1, 130, -1, 131, -1, 94, -1, 95,
1743 -1, 96, -1, 97, -1, 98, -1, 99, -1, 100,
1744 -1, 101, -1, 102, -1, 103, -1, 104, -1, 105,
1745 -1, 106, -1, 107, -1, 108, -1, 109, -1, 110,
1746 -1, 111, -1, 112, -1, 113, -1, 100, -1, 101,
1747 -1, 102, -1, 103, -1, 26, -1, 27, -1, 11,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001748 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001749 -1, 19, -1, 22, -1, 24, -1, 178, -1, -1,
1750 55, 156, 4, 157, -1, -1, 178, 158, -1, -1,
1751 20, -1, 23, -1, 184, -1, -1, 182, 158, -1,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001752 42, -1, 44, -1, 43, -1, 45, -1, 47, -1,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001753 49, -1, 46, -1, 48, -1, 51, -1, -1, 153,
1754 -1, 154, -1, 155, -1, -1, 46, -1, 48, -1,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001755 -1, 42, -1, 43, -1, 44, -1, 47, -1, -1,
1756 44, -1, 42, -1, -1, 63, -1, 64, -1, 65,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001757 -1, 66, -1, 67, -1, 62, 4, -1, 142, -1,
1758 121, -1, 141, -1, 122, -1, 144, -1, 145, -1,
1759 147, -1, 148, -1, 149, -1, 54, 4, -1, -1,
1760 193, 192, -1, 143, -1, 146, -1, 142, -1, 141,
1761 -1, 150, -1, 151, -1, -1, 195, 194, -1, -1,
1762 152, 22, -1, -1, 54, 4, -1, -1, 159, 54,
1763 4, -1, 34, 22, -1, -1, 199, -1, -1, 159,
1764 202, 201, -1, 199, -1, 54, 4, -1, 11, -1,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001765 12, -1, 13, -1, 16, -1, 15, -1, 14, -1,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001766 17, -1, 50, -1, 203, -1, 204, 180, 160, -1,
1767 238, -1, 161, 4, -1, 204, 156, 208, 157, 195,
1768 -1, 10, 156, 208, 157, 195, -1, 162, 4, 163,
1769 204, 164, -1, 165, 4, 163, 204, 166, -1, 167,
1770 209, 168, -1, 167, 168, -1, 165, 167, 209, 168,
1771 166, -1, 165, 167, 168, 166, -1, 204, 193, -1,
1772 204, -1, 10, -1, 205, -1, 207, 159, 205, -1,
1773 207, -1, 207, 159, 39, -1, 39, -1, -1, 204,
1774 -1, 209, 159, 204, -1, 204, 162, 212, 164, -1,
1775 204, 162, 164, -1, 204, 169, 22, -1, 204, 165,
1776 212, 166, -1, 204, 167, 212, 168, -1, 204, 167,
1777 168, -1, 204, 165, 167, 212, 168, 166, -1, 204,
1778 165, 167, 168, 166, -1, 204, 40, -1, 204, 41,
1779 -1, 204, 238, -1, 204, 211, -1, 204, 25, -1,
1780 176, 3, -1, 176, 5, -1, 176, 4, -1, 176,
1781 6, -1, 11, 26, -1, 11, 27, -1, 177, 9,
1782 -1, 173, 156, 210, 38, 204, 157, -1, 119, 156,
1783 210, 250, 157, -1, 133, 156, 210, 159, 210, 159,
1784 210, 157, -1, 171, 156, 210, 159, 210, 157, -1,
1785 172, 156, 210, 159, 210, 157, -1, 90, 174, 156,
1786 210, 159, 210, 157, -1, 91, 175, 156, 210, 159,
1787 210, 157, -1, 92, 174, 156, 210, 159, 210, 157,
1788 -1, 93, 175, 156, 210, 159, 210, 157, -1, 135,
1789 156, 210, 159, 210, 157, -1, 136, 156, 210, 159,
1790 210, 159, 210, 157, -1, 137, 156, 210, 159, 210,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001791 159, 210, 157, -1, 139, 156, 210, 251, 157, -1,
1792 140, 156, 210, 159, 210, 251, 157, -1, 212, 159,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001793 210, -1, 210, -1, 32, -1, 33, -1, 37, -1,
1794 -1, 206, 238, -1, 125, 156, 215, 38, 204, 157,
1795 -1, 217, -1, -1, 218, -1, 217, 218, -1, -1,
1796 31, 219, 234, -1, -1, 30, 220, 235, -1, 60,
1797 59, 224, -1, 181, 18, 204, -1, 181, 18, 10,
1798 -1, -1, 183, 187, 214, 213, 210, 180, 221, 201,
1799 -1, -1, 183, 185, 187, 214, 213, 210, 180, 222,
1800 201, -1, -1, 183, 186, 187, 214, 213, 204, 180,
1801 223, 201, -1, 183, 187, 35, 190, 215, -1, 52,
1802 225, -1, 56, 158, 226, -1, 22, -1, 53, 158,
1803 22, -1, 68, 158, 22, -1, 162, 227, 164, -1,
1804 227, 159, 22, -1, 22, -1, -1, 228, 159, 204,
1805 193, 179, -1, 204, 193, 179, -1, 228, -1, 228,
1806 159, 39, -1, 39, -1, -1, 191, 206, 182, 156,
1807 229, 157, 195, 200, 197, 196, -1, 28, -1, 167,
1808 -1, 189, 187, 230, 231, -1, 29, -1, 168, -1,
1809 242, 233, -1, 188, 187, 230, -1, -1, 61, -1,
1810 3, -1, 4, -1, 9, -1, 26, -1, 27, -1,
1811 40, -1, 41, -1, 25, -1, 165, 212, 166, -1,
1812 211, -1, 59, 236, 22, 159, 22, -1, 7, -1,
1813 8, -1, 178, -1, 182, -1, 238, -1, 237, -1,
1814 204, 239, -1, 240, -1, 241, 159, 240, -1, 242,
1815 243, -1, 232, 243, -1, 244, 181, 245, -1, 244,
1816 247, -1, -1, 21, -1, 69, 241, -1, 69, 10,
1817 -1, 70, 17, 239, -1, 70, 11, 239, 159, 17,
1818 239, 159, 17, 239, -1, 71, 176, 239, 159, 17,
1819 239, 162, 246, 164, -1, 71, 176, 239, 159, 17,
1820 239, 162, 164, -1, 72, 191, 206, 239, 156, 249,
1821 157, 195, 38, 17, 239, 73, 17, 239, -1, 73,
1822 -1, 74, -1, 246, 176, 237, 159, 17, 239, -1,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001823 176, 237, 159, 17, 239, -1, 181, 253, -1, 204,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001824 162, 239, 159, 239, 164, -1, 248, 159, 162, 239,
1825 159, 239, 164, -1, 204, 193, 239, 193, -1, 17,
1826 193, 239, 193, -1, 249, 159, 204, 193, 239, 193,
1827 -1, 249, 159, 17, 193, 239, 193, -1, -1, -1,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001828 250, 159, 240, -1, 159, 4, -1, 251, 159, 4,
1829 -1, 58, 57, -1, 57, -1, 171, 204, 239, 159,
1830 239, -1, 172, 204, 239, 159, 239, -1, 90, 174,
1831 204, 239, 159, 239, -1, 91, 175, 204, 239, 159,
1832 239, -1, 92, 174, 204, 239, 159, 239, -1, 93,
1833 175, 204, 239, 159, 239, -1, 173, 240, 38, 204,
1834 -1, 133, 240, 159, 240, 159, 240, -1, 134, 240,
1835 159, 204, -1, 135, 240, 159, 240, -1, 136, 240,
1836 159, 240, 159, 240, -1, 137, 240, 159, 240, 159,
1837 240, -1, 132, 248, -1, 252, 191, 206, 239, 156,
1838 249, 157, 195, -1, 255, -1, 36, -1, -1, 114,
1839 204, 198, -1, 114, 204, 159, 11, 239, 198, -1,
1840 115, 204, 198, -1, 115, 204, 159, 11, 239, 198,
1841 -1, 116, 240, -1, 254, 117, 204, 239, 198, -1,
1842 254, 118, 240, 159, 204, 239, 198, -1, 138, 204,
1843 239, 159, 4, -1, 119, 204, 239, 250, -1, 139,
1844 204, 239, 251, -1, 140, 204, 239, 159, 204, 239,
1845 251, -1
Dan Gohmanf4423b12008-04-19 00:24:39 +00001846};
1847
1848/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1849static const yytype_uint16 yyrline[] =
1850{
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001851 0, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118,
1852 1118, 1119, 1119, 1119, 1119, 1119, 1119, 1120, 1120, 1120,
1853 1120, 1120, 1120, 1121, 1121, 1121, 1121, 1121, 1121, 1124,
1854 1124, 1125, 1125, 1126, 1126, 1127, 1127, 1128, 1128, 1132,
1855 1132, 1133, 1133, 1134, 1134, 1135, 1135, 1136, 1136, 1137,
1856 1137, 1138, 1138, 1139, 1140, 1145, 1146, 1146, 1146, 1146,
1857 1146, 1148, 1148, 1148, 1149, 1149, 1151, 1152, 1156, 1160,
1858 1165, 1165, 1167, 1168, 1173, 1179, 1180, 1181, 1182, 1183,
1859 1184, 1188, 1189, 1190, 1194, 1195, 1196, 1197, 1201, 1202,
1860 1203, 1207, 1208, 1209, 1210, 1211, 1215, 1216, 1217, 1220,
1861 1221, 1222, 1223, 1224, 1225, 1226, 1233, 1234, 1235, 1236,
1862 1237, 1238, 1239, 1240, 1241, 1242, 1246, 1247, 1252, 1253,
1863 1254, 1255, 1256, 1257, 1260, 1261, 1266, 1267, 1274, 1275,
1864 1281, 1282, 1291, 1299, 1300, 1305, 1306, 1307, 1312, 1325,
1865 1325, 1325, 1325, 1325, 1325, 1325, 1328, 1332, 1336, 1343,
1866 1348, 1356, 1385, 1410, 1415, 1425, 1435, 1439, 1449, 1456,
1867 1465, 1472, 1477, 1482, 1489, 1490, 1497, 1504, 1512, 1518,
1868 1530, 1558, 1574, 1601, 1629, 1655, 1675, 1701, 1721, 1733,
1869 1740, 1806, 1816, 1826, 1832, 1842, 1848, 1858, 1864, 1870,
1870 1883, 1895, 1916, 1924, 1930, 1941, 1946, 1951, 1956, 1961,
1871 1967, 1973, 1979, 1987, 1998, 2002, 2010, 2010, 2013, 2013,
1872 2016, 2028, 2049, 2054, 2062, 2063, 2067, 2067, 2071, 2071,
1873 2074, 2077, 2101, 2113, 2112, 2124, 2123, 2133, 2132, 2143,
1874 2183, 2186, 2192, 2202, 2206, 2211, 2213, 2218, 2223, 2232,
1875 2242, 2253, 2257, 2266, 2275, 2280, 2409, 2409, 2411, 2420,
1876 2420, 2422, 2427, 2439, 2443, 2448, 2452, 2456, 2460, 2464,
1877 2468, 2472, 2476, 2480, 2508, 2512, 2522, 2526, 2530, 2535,
1878 2542, 2542, 2548, 2557, 2562, 2567, 2571, 2580, 2589, 2598,
1879 2602, 2610, 2617, 2621, 2626, 2637, 2656, 2665, 2751, 2755,
1880 2762, 2773, 2786, 2796, 2807, 2817, 2828, 2836, 2846, 2853,
1881 2856, 2857, 2865, 2871, 2880, 2884, 2889, 2905, 2922, 2936,
1882 2950, 2964, 2978, 2990, 2998, 3005, 3011, 3017, 3023, 3038,
1883 3128, 3133, 3137, 3144, 3151, 3161, 3168, 3178, 3186, 3200,
1884 3217, 3225, 3240, 3255
Dan Gohmanf4423b12008-04-19 00:24:39 +00001885};
1886#endif
1887
1888#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1889/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1890 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1891static const char *const yytname[] =
1892{
1893 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1894 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1895 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1896 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1897 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1898 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1899 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1900 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001901 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "COMMON", "OPAQUE",
Dan Gohmanf4423b12008-04-19 00:24:39 +00001902 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1903 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1904 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
Chris Lattnercc81d152008-05-04 17:18:47 +00001905 "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE",
1906 "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM",
Nate Begemanac80ade2008-05-12 19:01:56 +00001907 "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "VICMP",
1908 "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1909 "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1910 "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1911 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1912 "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1913 "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
Dan Gohmane4977cf2008-05-23 01:55:30 +00001914 "GETRESULT", "EXTRACTVALUE", "INSERTVALUE", "SIGNEXT", "ZEROEXT",
1915 "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL", "NEST",
1916 "READNONE", "READONLY", "GC", "DEFAULT", "HIDDEN", "PROTECTED", "'('",
1917 "')'", "'='", "','", "'*'", "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'",
1918 "'{'", "'}'", "'c'", "$accept", "ArithmeticOps", "LogicalOps", "CastOps",
1919 "IPredicates", "FPredicates", "IntType", "FPType", "LocalName",
1920 "OptLocalName", "OptAddrSpace", "OptLocalAssign", "GlobalName",
1921 "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
1922 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1923 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr",
1924 "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign",
1925 "OptCAlign", "SectionString", "OptSection", "GlobalVarAttributes",
Dan Gohmanf4423b12008-04-19 00:24:39 +00001926 "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
1927 "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
1928 "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
1929 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1930 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1931 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1932 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1933 "SymbolicValueRef", "ValueRef", "ResolvedVal", "ReturnedVal",
1934 "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst",
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001935 "JumpTable", "Inst", "PHIList", "ParamList", "IndexList",
1936 "ConstantIndexList", "OptTailCall", "InstVal", "OptVolatile",
1937 "MemoryInst", 0
Dan Gohmanf4423b12008-04-19 00:24:39 +00001938};
1939#endif
1940
1941# ifdef YYPRINT
1942/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1943 token YYLEX-NUM. */
1944static const yytype_uint16 yytoknum[] =
1945{
1946 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1947 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1948 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1949 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1950 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1951 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1952 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1953 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1954 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1955 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1956 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1957 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1958 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1959 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1960 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001961 405, 406, 407, 408, 409, 410, 40, 41, 61, 44,
1962 42, 92, 91, 120, 93, 60, 62, 123, 125, 99
Dan Gohmanf4423b12008-04-19 00:24:39 +00001963};
1964# endif
1965
1966/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1967static const yytype_uint8 yyr1[] =
1968{
Dan Gohmane4977cf2008-05-23 01:55:30 +00001969 0, 170, 171, 171, 171, 171, 171, 171, 171, 171,
1970 171, 172, 172, 172, 172, 172, 172, 173, 173, 173,
1971 173, 173, 173, 173, 173, 173, 173, 173, 173, 174,
1972 174, 174, 174, 174, 174, 174, 174, 174, 174, 175,
1973 175, 175, 175, 175, 175, 175, 175, 175, 175, 175,
1974 175, 175, 175, 175, 175, 176, 177, 177, 177, 177,
1975 177, 178, 178, 178, 179, 179, 180, 180, 181, 181,
1976 182, 182, 183, 183, 184, 185, 185, 185, 185, 185,
1977 185, 186, 186, 186, 187, 187, 187, 187, 188, 188,
1978 188, 189, 189, 189, 189, 189, 190, 190, 190, 191,
1979 191, 191, 191, 191, 191, 191, 192, 192, 192, 192,
1980 192, 192, 192, 192, 192, 192, 193, 193, 194, 194,
1981 194, 194, 194, 194, 195, 195, 196, 196, 197, 197,
1982 198, 198, 199, 200, 200, 201, 201, 202, 202, 203,
1983 203, 203, 203, 203, 203, 203, 204, 204, 204, 204,
1984 204, 204, 204, 204, 204, 204, 204, 204, 204, 205,
1985 206, 206, 207, 207, 208, 208, 208, 208, 209, 209,
1986 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
1987 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
1988 211, 211, 211, 211, 211, 211, 211, 211, 211, 211,
1989 211, 211, 211, 211, 212, 212, 213, 213, 214, 214,
1990 215, 215, 216, 216, 217, 217, 219, 218, 220, 218,
1991 218, 218, 218, 221, 218, 222, 218, 223, 218, 218,
1992 218, 218, 224, 225, 225, 226, 227, 227, 227, 228,
1993 228, 229, 229, 229, 229, 230, 231, 231, 232, 233,
1994 233, 234, 235, 236, 236, 237, 237, 237, 237, 237,
1995 237, 237, 237, 237, 237, 237, 238, 238, 238, 238,
1996 239, 239, 240, 241, 241, 242, 242, 243, 244, 244,
1997 244, 245, 245, 245, 245, 245, 245, 245, 245, 245,
1998 246, 246, 247, 248, 248, 249, 249, 249, 249, 249,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001999 250, 250, 251, 251, 252, 252, 253, 253, 253, 253,
2000 253, 253, 253, 253, 253, 253, 253, 253, 253, 253,
2001 253, 254, 254, 255, 255, 255, 255, 255, 255, 255,
2002 255, 255, 255, 255
Dan Gohmanf4423b12008-04-19 00:24:39 +00002003};
2004
2005/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
2006static const yytype_uint8 yyr2[] =
2007{
2008 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
2009 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2010 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2011 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2012 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2013 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2014 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
2015 1, 1, 1, 0, 2, 1, 1, 1, 1, 1,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002016 1, 1, 1, 1, 0, 1, 1, 1, 0, 1,
2017 1, 0, 1, 1, 1, 1, 0, 1, 1, 0,
2018 1, 1, 1, 1, 1, 2, 1, 1, 1, 1,
2019 1, 1, 1, 1, 1, 2, 0, 2, 1, 1,
2020 1, 1, 1, 1, 0, 2, 0, 2, 0, 2,
2021 0, 3, 2, 0, 1, 0, 3, 1, 2, 1,
2022 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
2023 2, 5, 5, 5, 5, 3, 2, 5, 4, 2,
2024 1, 1, 1, 3, 1, 3, 1, 0, 1, 3,
2025 4, 3, 3, 4, 4, 3, 6, 5, 2, 2,
2026 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2027 6, 5, 8, 6, 6, 7, 7, 7, 7, 6,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002028 8, 8, 5, 7, 3, 1, 1, 1, 1, 0,
2029 2, 6, 1, 0, 1, 2, 0, 3, 0, 3,
2030 3, 3, 3, 0, 8, 0, 9, 0, 9, 5,
2031 2, 3, 1, 3, 3, 3, 3, 1, 0, 5,
2032 3, 1, 3, 1, 0, 10, 1, 1, 4, 1,
2033 1, 2, 3, 0, 1, 1, 1, 1, 1, 1,
2034 1, 1, 1, 3, 1, 5, 1, 1, 1, 1,
2035 1, 1, 2, 1, 3, 2, 2, 3, 2, 0,
2036 1, 2, 2, 3, 9, 9, 8, 14, 1, 1,
2037 6, 5, 2, 6, 7, 4, 4, 6, 6, 0,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002038 0, 3, 2, 3, 2, 1, 5, 5, 6, 6,
2039 6, 6, 4, 6, 4, 4, 6, 6, 2, 8,
2040 1, 1, 0, 3, 6, 3, 6, 2, 5, 7,
2041 5, 4, 4, 7
Dan Gohmanf4423b12008-04-19 00:24:39 +00002042};
2043
2044/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2045 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2046 means the default is an error. */
2047static const yytype_uint16 yydefact[] =
2048{
Dan Gohmane4977cf2008-05-23 01:55:30 +00002049 73, 61, 70, 62, 71, 63, 218, 216, 0, 0,
2050 0, 0, 0, 0, 84, 72, 0, 73, 214, 88,
2051 91, 0, 0, 230, 0, 0, 68, 0, 74, 75,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002052 77, 76, 78, 81, 79, 82, 80, 83, 85, 86,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002053 87, 84, 84, 209, 1, 215, 89, 90, 84, 219,
2054 92, 93, 94, 95, 84, 279, 217, 279, 0, 0,
2055 238, 231, 232, 220, 266, 267, 222, 139, 140, 141,
2056 144, 143, 142, 145, 146, 0, 0, 0, 0, 268,
2057 269, 147, 221, 149, 209, 209, 96, 208, 0, 99,
2058 99, 280, 276, 69, 249, 250, 251, 275, 233, 234,
2059 237, 0, 167, 150, 0, 0, 0, 0, 156, 168,
2060 0, 0, 167, 0, 0, 0, 98, 97, 0, 206,
2061 207, 0, 0, 100, 101, 102, 103, 104, 0, 252,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002062 0, 322, 278, 0, 235, 166, 116, 162, 164, 0,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002063 0, 0, 0, 0, 0, 155, 0, 0, 148, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002064 0, 161, 0, 160, 0, 229, 139, 140, 141, 144,
2065 143, 142, 0, 0, 67, 67, 105, 0, 246, 247,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002066 248, 321, 305, 0, 0, 0, 0, 99, 288, 289,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002067 2, 3, 4, 5, 6, 7, 8, 9, 10, 14,
2068 15, 16, 11, 12, 13, 0, 0, 0, 0, 0,
2069 0, 0, 0, 17, 18, 19, 20, 21, 22, 23,
2070 24, 25, 26, 27, 28, 0, 0, 0, 0, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002071 0, 0, 0, 0, 0, 0, 0, 277, 99, 292,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002072 0, 320, 236, 159, 0, 124, 67, 67, 158, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002073 169, 0, 124, 67, 67, 0, 210, 187, 188, 183,
2074 185, 184, 186, 189, 182, 178, 179, 0, 0, 0,
Nate Begemanac80ade2008-05-12 19:01:56 +00002075 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002076 0, 0, 0, 0, 0, 181, 180, 223, 0, 304,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002077 282, 67, 273, 281, 0, 0, 55, 0, 0, 29,
2078 30, 31, 32, 33, 34, 35, 36, 37, 38, 0,
2079 53, 54, 49, 50, 51, 52, 39, 40, 41, 42,
2080 43, 44, 45, 46, 47, 48, 0, 0, 0, 130,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002081 130, 327, 67, 67, 318, 0, 0, 0, 0, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002082 67, 67, 67, 67, 67, 0, 0, 0, 0, 0,
2083 107, 109, 108, 106, 110, 111, 112, 113, 114, 117,
2084 165, 163, 152, 153, 154, 157, 66, 151, 225, 227,
2085 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2086 0, 0, 171, 205, 0, 0, 0, 175, 0, 172,
2087 0, 0, 0, 135, 244, 255, 256, 257, 262, 258,
2088 259, 260, 261, 253, 0, 264, 271, 270, 272, 0,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002089 0, 283, 0, 0, 67, 67, 67, 67, 0, 323,
2090 0, 325, 300, 0, 0, 0, 0, 0, 0, 0,
2091 0, 0, 0, 0, 0, 0, 0, 67, 0, 115,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002092 121, 120, 118, 119, 122, 123, 125, 135, 135, 0,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002093 0, 0, 0, 0, 300, 0, 0, 0, 0, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002094 0, 0, 170, 156, 168, 0, 173, 174, 0, 0,
2095 0, 0, 224, 243, 116, 241, 0, 254, 0, 0,
2096 274, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002097 0, 331, 0, 0, 0, 314, 315, 0, 0, 0,
2098 0, 332, 0, 0, 0, 312, 0, 130, 0, 226,
2099 228, 67, 0, 0, 0, 0, 0, 0, 0, 0,
2100 0, 0, 0, 204, 177, 0, 0, 0, 0, 0,
2101 0, 137, 135, 65, 0, 124, 0, 263, 0, 0,
2102 299, 0, 0, 0, 0, 130, 131, 130, 0, 0,
2103 0, 0, 0, 0, 330, 302, 0, 67, 306, 307,
2104 299, 0, 328, 67, 211, 0, 0, 0, 0, 191,
2105 0, 0, 0, 0, 202, 0, 176, 0, 0, 67,
2106 132, 138, 136, 64, 240, 242, 116, 133, 0, 0,
2107 0, 116, 116, 0, 308, 309, 310, 311, 324, 326,
2108 301, 0, 0, 313, 316, 317, 303, 0, 0, 130,
2109 0, 0, 0, 0, 0, 199, 0, 0, 0, 193,
2110 194, 190, 65, 134, 128, 265, 0, 0, 0, 0,
2111 124, 0, 293, 0, 333, 124, 329, 195, 196, 197,
2112 198, 0, 0, 0, 203, 239, 0, 126, 0, 286,
2113 0, 0, 107, 109, 116, 116, 0, 116, 116, 294,
2114 319, 192, 200, 201, 129, 0, 245, 284, 0, 285,
2115 0, 296, 295, 0, 0, 0, 127, 0, 0, 0,
2116 116, 116, 0, 0, 0, 298, 297, 291, 0, 0,
2117 290, 0, 287
Dan Gohmanf4423b12008-04-19 00:24:39 +00002118};
2119
2120/* YYDEFGOTO[NTERM-NUM]. */
2121static const yytype_int16 yydefgoto[] =
2122{
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002123 -1, 272, 273, 274, 299, 316, 162, 163, 79, 574,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002124 113, 12, 80, 14, 15, 41, 42, 43, 48, 54,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002125 118, 128, 349, 233, 436, 352, 656, 637, 409, 521,
2126 614, 462, 522, 81, 164, 137, 154, 138, 139, 110,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002127 373, 395, 374, 121, 88, 155, 16, 17, 18, 20,
2128 19, 383, 437, 438, 63, 23, 61, 101, 465, 466,
2129 129, 170, 55, 96, 56, 49, 468, 396, 83, 398,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002130 282, 283, 57, 92, 93, 227, 641, 132, 324, 583,
2131 481, 491, 228, 229, 230, 231
Dan Gohmanf4423b12008-04-19 00:24:39 +00002132};
2133
2134/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2135 STATE-NUM. */
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002136#define YYPACT_NINF -611
Dan Gohmanf4423b12008-04-19 00:24:39 +00002137static const yytype_int16 yypact[] =
2138{
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002139 645, -611, -611, -611, -611, -611, -611, -611, -11, -112,
2140 3, -74, 83, -41, 26, -611, 111, 692, -611, -17,
2141 199, -19, 54, -611, 21, 124, -611, 1670, -611, -611,
2142 -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,
2143 -611, 17, 17, 72, -611, -611, -611, -611, 17, -611,
2144 -611, -611, -611, -611, 17, 137, -611, -5, 196, 204,
2145 215, -611, -611, -611, -611, -611, 65, -611, -611, -611,
2146 -611, -611, -611, -611, -611, 262, 265, 2, 322, -611,
2147 -611, -611, -40, -611, 240, 240, 219, -611, 319, 193,
2148 193, -611, -611, 257, -611, -611, -611, -611, -611, -611,
2149 -611, 52, 1252, -611, 120, 131, 671, 65, -611, -40,
2150 -101, 132, 1252, 139, 319, 319, -611, -611, 1359, -611,
2151 -611, 1711, 299, -611, -611, -611, -611, -611, 1772, -611,
2152 -16, 2051, -611, 287, -611, -611, -40, -611, 154, 160,
2153 1831, 1831, 159, -77, 1831, -611, 316, 183, -611, 1711,
2154 1831, 65, 175, -40, 278, -611, 248, 334, 338, 356,
2155 357, 358, 244, 359, 1310, 314, -611, 36, -611, -611,
2156 -611, -611, -611, 313, 1872, 34, 360, 193, -611, -611,
2157 -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,
2158 -611, -611, -611, -611, -611, 324, 522, 324, 522, 1831,
2159 1831, 1831, 1831, -611, -611, -611, -611, -611, -611, -611,
2160 -611, -611, -611, -611, -611, 1831, 1831, 1831, 1831, 1831,
2161 1831, 1831, 1831, 1831, 1831, 1831, 1831, -611, 193, -611,
2162 236, -611, -611, 174, 1548, -611, -12, -23, -611, 208,
2163 -40, 218, -611, 314, -22, 1359, -611, -611, -611, -611,
2164 -611, -611, -611, -611, -611, -611, -611, 324, 522, 324,
2165 522, 220, 221, 222, 224, 227, 229, 230, 1589, 1890,
2166 931, 366, 241, 251, 252, -611, -611, -611, 253, -611,
2167 65, 881, -611, 237, 1025, 1025, -611, 1025, 1772, -611,
2168 -611, -611, -611, -611, -611, -611, -611, -611, -611, 1831,
2169 -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,
2170 -611, -611, -611, -611, -611, -611, 1831, 1831, 1831, -6,
2171 8, -611, 881, -7, 239, 269, 272, 277, 279, 280,
2172 881, 881, 881, 881, 881, 372, 1772, 1831, 1831, 433,
2173 -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,
2174 -611, -611, -47, -611, -611, -611, -611, -47, -611, 139,
2175 403, 286, 288, 289, 290, 1711, 1711, 1711, 1711, 1711,
2176 1711, 1711, -611, -611, 58, 972, -54, -611, 46, -611,
2177 1711, 1711, 1711, 291, 1611, -611, -611, -611, -611, -611,
2178 -611, -611, -611, 386, 1711, -611, -611, -611, -611, 1831,
2179 292, -611, 293, 1025, 881, 881, 881, 881, 24, -611,
2180 25, -611, -611, 1025, 294, 1831, 1831, 1831, 1831, 1831,
2181 296, 303, 304, 305, 306, 1831, 1025, 881, 309, -611,
2182 -611, -611, -611, -611, -611, -611, -611, 291, 291, 1831,
2183 1711, 1711, 1711, 1711, -611, 310, 311, 312, 315, 303,
2184 320, 1711, -611, 307, 1159, 56, -611, -611, 321, 323,
2185 415, 10, -611, -611, -40, 326, 331, -611, 459, -53,
2186 -611, 474, 477, 339, 337, 340, 341, 342, 1025, 493,
2187 1025, 343, 344, 1025, 346, -40, -611, 347, 348, 504,
2188 505, 351, 1831, 1025, 1025, -40, 355, 354, 1831, -611,
2189 -611, 45, 362, 363, 367, 368, -69, 1711, 1711, 1711,
2190 1711, 121, 1711, -611, -611, 352, 1711, 1711, 1831, 492,
2191 521, -611, 291, 123, 1652, -611, 369, -611, 1025, 1025,
2192 1934, 1025, 1025, 1025, 1025, 354, -611, 354, 1831, 1025,
2193 370, 1831, 1831, 1831, -611, -611, 531, 881, -611, -611,
2194 1934, 482, -611, 881, -611, 1711, 1711, 1711, 1711, -611,
2195 378, 381, 382, 387, -611, 303, -611, 393, 398, 53,
2196 -611, -611, -611, -611, -611, -611, -40, -14, 534, 399,
2197 395, 6, -40, 125, -611, -611, -611, -611, -611, -611,
2198 -611, 396, 1025, -611, -611, -611, -611, 303, 167, 354,
2199 402, 404, 405, 406, 1711, -611, 1711, 1711, 191, -611,
2200 -611, -611, 123, -611, 510, -611, 550, -4, 734, 734,
2201 -611, 1952, -611, 407, 351, -611, -611, -611, -611, -611,
2202 -611, 411, 412, 417, -611, -611, 568, 423, 1025, -611,
2203 1455, -3, 420, 421, -611, -611, -20, 6, -40, -611,
2204 -47, -611, -611, -611, -611, 556, -611, -611, 422, -611,
2205 1455, 174, 174, 563, 734, 734, -611, 566, 425, 1025,
2206 -611, -611, 1025, 569, 512, 174, 174, -611, 1025, 570,
2207 -611, 1025, -611
Dan Gohmanf4423b12008-04-19 00:24:39 +00002208};
2209
2210/* YYPGOTO[NTERM-NUM]. */
2211static const yytype_int16 yypgoto[] =
2212{
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002213 -611, 457, 458, 463, -176, -171, -174, -611, 0, -15,
2214 -146, 503, 11, -611, -611, -611, -611, 12, -611, -611,
2215 -611, -143, -611, -441, -611, -238, -611, -611, -310, 22,
2216 -611, -412, -611, -611, -26, 364, -123, -611, 488, 495,
2217 35, -161, -256, 242, 276, 361, -611, -611, 585, -611,
2218 -611, -611, -611, -611, -611, -611, -611, -611, -611, -611,
2219 513, -611, -611, -611, -611, -611, -611, -610, -99, 127,
2220 -179, -611, -611, 547, -611, -611, -611, -611, -611, 59,
2221 164, -440, -611, -611, -611, -611
Dan Gohmanf4423b12008-04-19 00:24:39 +00002222};
2223
2224/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2225 positive, shift that token. If negative, reduce the rule which
2226 number is the opposite. If zero, do what YYDEFACT says.
2227 If YYTABLE_NINF, syntax error. */
Dan Gohmane4977cf2008-05-23 01:55:30 +00002228#define YYTABLE_NINF -214
Dan Gohmanf4423b12008-04-19 00:24:39 +00002229static const yytype_int16 yytable[] =
2230{
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002231 11, 82, 287, 275, 357, 167, 105, 286, 286, 511,
2232 411, 13, 168, 376, 378, 111, 91, 11, 663, 277,
2233 519, 317, 321, 523, 94, 499, 500, 318, 13, 46,
2234 658, 47, 111, 111, 288, 478, 480, 325, 326, 327,
2235 328, 329, 21, 111, 519, 284, 24, 335, 111, 111,
2236 668, 285, 109, 84, 85, 246, 2, 22, 144, 4,
2237 89, -145, 25, 111, 520, 276, 90, 145, 29, 30,
2238 31, 32, 33, 34, 35, 36, 136, 37, 479, 479,
2239 109, 361, 144, 363, 26, 336, 136, 362, 559, 364,
2240 538, 239, 153, 11, 430, 431, 432, 358, 359, 433,
2241 111, 27, 153, 434, 435, 451, 451, 86, 111, 87,
2242 572, 44, 456, 527, 236, 237, 112, 28, 240, 455,
2243 -67, 430, 431, 432, 244, 608, 433, 430, 431, 432,
2244 434, 435, 433, 112, 112, 612, 434, 435, 469, 58,
2245 618, 619, 1, 354, 112, 3, 62, 5, 281, 112,
2246 112, 169, 353, 408, -67, 413, 165, 624, 91, 428,
2247 639, 659, -145, 95, 112, 403, -145, 410, -67, 106,
2248 38, 39, 40, 319, 320, 281, 322, 339, 278, 38,
2249 39, 40, 397, 60, 243, 397, 397, 552, 397, 323,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002250 281, 281, 281, 281, 281, 330, 331, 332, 333, 334,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002251 281, 112, 554, 661, 662, 451, 664, 665, 136, 112,
2252 611, 133, 59, 426, 457, 451, 134, 451, 98, 153,
2253 470, 102, 452, 397, 515, 588, 99, 589, 339, 675,
2254 676, 397, 397, 397, 397, 397, 484, 100, 486, 487,
2255 488, 50, 51, 52, 340, 341, 53, 249, 250, 251,
2256 252, -55, -55, -55, -55, 122, 123, 124, 125, 126,
2257 127, 116, 153, 117, 342, 343, 103, 344, 345, 104,
2258 346, 347, 348, 404, 247, 248, 1, 87, 564, 3,
2259 546, 5, 620, 140, 621, 64, 65, 577, 146, 626,
2260 405, 406, 407, 275, 141, 340, 341, 1, 2, 148,
2261 3, 4, 5, 166, 397, 397, 397, 397, 397, 232,
2262 153, 427, 281, 234, 397, 342, 343, 235, 344, 345,
2263 241, 346, 347, 348, 625, 238, 621, 397, 397, 64,
2264 65, 245, 107, 67, 68, 69, 70, 71, 72, 73,
2265 242, 1, 2, -56, 3, 4, 5, -57, 634, 454,
2266 546, 119, 120, 337, 338, 276, 149, 150, 464, 590,
2267 114, 115, 593, 594, 595, -60, -59, -58, 253, 111,
2268 279, 286, 74, 281, 355, 356, 365, 366, 367, 397,
2269 368, 397, 646, 369, 397, 370, 371, 650, 379, 281,
2270 485, 281, 281, 281, 397, 397, 399, 380, 414, 495,
2271 444, 445, 446, 447, 448, 449, 450, 381, 382, 384,
2272 425, 400, 401, 501, 402, 458, 459, 460, 289, 290,
2273 291, 292, 293, 294, 295, 296, 297, 298, 415, 397,
2274 397, 416, 397, 397, 397, 397, 417, 429, 418, 419,
2275 397, 439, 440, 640, 441, 442, 443, 467, 397, 412,
2276 461, 471, 472, 518, 397, 489, 483, 420, 421, 422,
2277 423, 424, 490, 492, 493, 494, 547, 660, 498, 507,
2278 508, 509, 553, 514, 510, 502, 503, 504, 505, 512,
2279 516, 526, 517, 75, 76, 524, 513, 77, 525, 78,
2280 108, 528, 569, 397, 529, 530, 531, 536, 576, 532,
2281 533, 534, 538, 539, 582, 541, 542, 543, 544, 545,
2282 546, 550, 281, 551, 570, 281, 281, 281, 566, 397,
2283 397, 555, 556, 573, 582, 571, 557, 558, 578, 592,
2284 473, 474, 475, 476, 477, 596, 479, 604, 605, 397,
2285 482, 606, 560, 561, 562, 563, 607, 565, 300, 301,
2286 609, 567, 568, 496, 497, 610, 615, 617, 616, 627,
2287 622, 628, 629, 630, 636, 397, 397, 638, 651, 652,
2288 397, 649, 654, 397, 653, 655, -18, -19, 666, 397,
2289 669, 667, 397, 672, 673, 679, 678, 681, 224, 225,
2290 600, 601, 602, 603, 226, 648, 131, 635, 351, 613,
2291 147, 143, 45, 130, 97, 535, 360, 537, 506, 598,
2292 540, 0, 573, 0, 0, 0, 0, 0, 0, 0,
2293 548, 549, 302, 303, 304, 305, 306, 307, 308, 309,
2294 310, 311, 312, 313, 314, 315, 0, 0, 0, 631,
2295 0, 632, 633, 0, 0, -213, 0, 0, 0, 0,
2296 0, 0, 0, 0, 0, 579, 580, 0, 584, 585,
2297 586, 587, 0, -69, 1, 2, 591, 3, 4, 5,
2298 0, 0, 0, 0, 597, 6, 7, 0, 64, 65,
2299 599, 107, 67, 68, 69, 70, 71, 72, 73, 0,
2300 1, 2, -212, 3, 4, 5, 0, 8, 0, 0,
2301 0, 9, 0, 0, 0, 10, 0, 0, 0, 0,
2302 -69, 1, 2, 0, 3, 4, 5, 0, 0, 623,
2303 0, 74, 6, 7, 0, 0, 0, 0, 0, 0,
2304 0, 0, 0, 0, 0, 0, 0, 385, 386, 0,
2305 0, 64, 65, 387, 8, 644, 645, 0, 9, 0,
2306 0, 0, 10, 1, 2, 0, 3, 4, 5, 388,
2307 389, 390, 0, 0, 0, 657, 0, 0, 0, 0,
2308 0, 0, 0, 0, 391, 392, 0, 0, 0, 0,
2309 0, 0, 0, 0, 0, 0, 0, 0, 339, 0,
2310 0, 670, 671, 393, 0, 0, 674, 0, 0, 677,
2311 0, 0, 0, 0, 0, 680, 0, 0, 682, 180,
2312 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
2313 191, 192, 193, 194, 257, 258, 259, 260, 0, 0,
2314 0, 0, 75, 76, 0, 0, 77, 0, 78, 142,
2315 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2316 0, 0, 0, 261, 203, 642, 643, 206, 207, 208,
2317 209, 210, 211, 212, 213, 214, 0, 262, 0, 263,
2318 264, 265, 0, 266, 267, 342, 343, 0, 344, 345,
2319 0, 346, 347, 348, 385, 386, 0, 0, 64, 65,
2320 387, 0, 0, 0, 0, 0, 0, 0, 0, 394,
2321 1, 2, 0, 3, 4, 5, 388, 389, 390, 0,
2322 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002323 0, 391, 392, 0, 0, 0, 0, 0, 0, 0,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002324 0, 0, 0, 0, 0, 0, 111, 0, 64, 65,
2325 393, 107, 156, 157, 158, 159, 160, 161, 73, 0,
2326 1, 2, 0, 3, 4, 5, 180, 181, 182, 183,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002327 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002328 194, 257, 258, 259, 260, 0, 0, 0, 0, 64,
2329 65, 74, 107, 156, 157, 158, 159, 160, 161, 73,
2330 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002331 261, 203, 204, 205, 206, 207, 208, 209, 210, 211,
2332 212, 213, 214, 0, 262, 0, 263, 264, 265, 0,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002333 266, 267, 74, 0, 0, 0, 0, 0, 385, 386,
2334 0, 0, 64, 65, 387, 0, 0, 112, 0, 0,
2335 0, 0, 0, 0, 1, 2, 394, 3, 4, 5,
2336 388, 389, 390, 0, 0, 0, 0, 0, 0, 0,
2337 0, 0, 0, 0, 0, 391, 392, 0, 0, 0,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002338 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002339 0, 0, 0, 0, 393, 0, 0, 0, 0, 0,
2340 0, 0, 75, 76, 0, 0, 77, 0, 78, 377,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002341 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
2342 190, 191, 192, 193, 194, 257, 258, 259, 260, 0,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002343 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002344 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
2345 453, 0, 0, 0, 261, 203, 204, 205, 206, 207,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002346 208, 209, 210, 211, 212, 213, 214, 0, 262, 0,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002347 263, 264, 265, 0, 266, 267, 64, 65, 0, 0,
2348 0, 0, 0, 0, 0, 0, 0, 0, 1, 2,
2349 0, 3, 4, 5, 254, 0, 0, 0, 0, 0,
2350 394, 0, 0, 0, 0, 0, 0, 0, 0, 255,
2351 256, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2352 0, 0, 0, 0, 111, 0, 0, 0, 0, 0,
2353 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2354 0, 0, 0, 0, 180, 181, 182, 183, 184, 185,
2355 186, 187, 188, 189, 190, 191, 192, 193, 194, 257,
2356 258, 259, 260, 0, 0, 0, 0, 0, 0, 64,
2357 65, 0, 107, 67, 68, 69, 70, 71, 72, 73,
2358 0, 1, 2, 0, 3, 4, 5, 0, 261, 203,
2359 204, 205, 206, 207, 208, 209, 210, 211, 212, 213,
2360 214, 135, 262, 0, 263, 264, 265, 0, 266, 267,
2361 0, 0, 74, 0, 0, 0, 0, 0, 0, 0,
2362 0, 0, 0, 0, 0, 112, 0, 64, 65, -67,
2363 0, 268, 0, 0, 269, 0, 270, 0, 271, 1,
2364 2, 0, 3, 4, 5, 254, 0, 0, 0, 0,
2365 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2366 255, 256, 0, 0, 0, 0, 0, 0, 0, 0,
2367 0, 0, 0, 0, 0, 111, 64, 65, 0, 151,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002368 67, 68, 69, 70, 71, 72, 73, 0, 1, 2,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002369 0, 3, 4, 5, 0, 180, 181, 182, 183, 184,
2370 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
2371 257, 258, 259, 260, 0, 0, 0, 0, 0, 74,
2372 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
2373 0, 0, 0, 0, 0, 0, 0, 0, 0, 261,
2374 203, 204, 205, 206, 207, 208, 209, 210, 211, 212,
2375 213, 214, 0, 262, 0, 263, 264, 265, 0, 266,
2376 267, 0, 0, 0, 0, 0, 0, 0, 385, 386,
2377 0, 0, 0, 0, 387, 0, 112, 0, 0, 0,
2378 0, 0, 268, 0, 0, 269, 0, 270, 0, 271,
2379 388, 389, 390, 0, 152, 0, 0, 0, 0, 0,
2380 0, 0, 0, 0, 0, 391, 392, 0, 0, 0,
2381 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2382 0, 0, 0, 0, 393, 0, 0, 0, 0, 0,
2383 75, 76, 0, 0, 77, 0, 78, 0, 0, 0,
2384 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
2385 190, 191, 192, 193, 194, 257, 258, 259, 260, 0,
2386 0, 0, 0, 0, 0, 64, 65, 0, 107, 67,
2387 68, 69, 70, 71, 72, 73, 0, 1, 2, 0,
2388 3, 4, 5, 0, 261, 203, 204, 205, 206, 207,
2389 208, 209, 210, 211, 212, 213, 214, 350, 262, 0,
2390 263, 264, 265, 0, 266, 267, 64, 65, 74, 107,
2391 156, 157, 158, 159, 160, 161, 73, 0, 1, 2,
2392 0, 3, 4, 5, 0, 0, 0, 0, 64, 65,
2393 394, 107, 67, 68, 69, 70, 71, 72, 73, 0,
2394 1, 2, 0, 3, 4, 5, 0, 0, 0, 74,
2395 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2396 463, 0, 0, 0, 0, 0, 0, 0, 0, 64,
2397 65, 74, 107, 67, 68, 69, 70, 71, 72, 73,
2398 0, 1, 2, 0, 3, 4, 5, 64, 65, 0,
2399 66, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2400 2, 575, 3, 4, 5, 0, 0, 0, 0, 0,
2401 0, 0, 74, 0, 0, 0, 0, 0, 0, 75,
2402 76, 0, 0, 77, 0, 78, 0, 0, 64, 65,
2403 74, 107, 156, 157, 158, 159, 160, 161, 73, 0,
2404 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2405 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2406 75, 76, 0, 372, 77, 0, 78, 0, 0, 0,
2407 0, 74, 0, 0, 0, 0, 0, 0, 0, 0,
2408 0, 0, 75, 76, 0, 0, 77, 0, 78, 64,
2409 65, 0, 151, 67, 68, 69, 70, 71, 72, 73,
Chris Lattnercc81d152008-05-04 17:18:47 +00002410 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2411 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002412 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002413 0, 0, 74, 0, 0, 0, 0, 0, 0, 0,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002414 0, 75, 76, 0, 0, 77, 0, 78, 64, 65,
2415 0, 107, 67, 68, 69, 70, 71, 72, 73, 0,
2416 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2417 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2418 0, 0, 75, 76, 0, 0, 77, 0, 78, 64,
2419 65, 74, 280, 67, 68, 69, 70, 71, 72, 73,
2420 0, 1, 2, 0, 3, 4, 5, 64, 65, 0,
2421 107, 156, 157, 158, 159, 160, 161, 73, 0, 1,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002422 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002423 0, 0, 74, 0, 0, 0, 0, 0, 0, 0,
2424 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
2425 74, 64, 65, 0, 107, 67, 68, 69, 70, 71,
2426 72, 581, 0, 1, 2, 0, 3, 4, 5, 64,
2427 65, 0, 107, 67, 68, 69, 70, 71, 72, 647,
2428 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2429 0, 0, 0, 0, 74, 0, 0, 0, 0, 0,
2430 0, 0, 75, 76, 0, 0, 77, 0, 78, 0,
2431 0, 0, 74, 0, 0, 0, 0, 0, 0, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002432 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnercc81d152008-05-04 17:18:47 +00002433 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002434 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002435 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002436 0, 75, 76, 0, 0, 77, 0, 375, 0, 0,
2437 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2438 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2439 0, 0, 0, 0, 0, 0, 0, 171, 0, 0,
2440 0, 0, 0, 0, 0, 75, 76, 0, 0, 77,
2441 0, 78, 0, 0, 0, 0, 0, 0, 172, 173,
2442 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
2443 174, 175, 176, 177, 178, 179, 180, 181, 182, 183,
2444 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
2445 194, 195, 196, 197, 198, 0, 0, 0, 0, 0,
2446 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2447 0, 0, 0, 0, 0, 199, 200, 201, 0, 0,
2448 202, 203, 204, 205, 206, 207, 208, 209, 210, 211,
2449 212, 213, 214, 215, 216, 217, 218, 219, 220, 221,
2450 222, 223
Dan Gohmanf4423b12008-04-19 00:24:39 +00002451};
2452
2453static const yytype_int16 yycheck[] =
2454{
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002455 0, 27, 176, 164, 242, 128, 4, 11, 11, 449,
2456 320, 0, 28, 269, 270, 55, 21, 17, 38, 165,
2457 34, 197, 201, 464, 29, 437, 438, 198, 17, 46,
2458 640, 48, 55, 55, 177, 11, 11, 216, 217, 218,
2459 219, 220, 53, 55, 34, 11, 158, 226, 55, 55,
2460 660, 17, 78, 41, 42, 154, 20, 68, 159, 23,
2461 48, 55, 59, 55, 54, 164, 54, 168, 42, 43,
2462 44, 45, 46, 47, 48, 49, 102, 51, 54, 54,
2463 106, 257, 159, 259, 158, 228, 112, 258, 157, 260,
2464 159, 168, 118, 93, 141, 142, 143, 243, 244, 146,
2465 55, 18, 128, 150, 151, 159, 159, 35, 55, 37,
2466 522, 0, 166, 166, 140, 141, 156, 158, 144, 375,
2467 160, 141, 142, 143, 150, 565, 146, 141, 142, 143,
2468 150, 151, 146, 156, 156, 576, 150, 151, 394, 158,
2469 581, 582, 19, 166, 156, 22, 22, 24, 174, 156,
2470 156, 167, 164, 159, 160, 162, 121, 597, 21, 338,
2471 164, 164, 156, 168, 156, 288, 160, 159, 160, 167,
2472 153, 154, 155, 199, 200, 201, 202, 54, 167, 153,
2473 154, 155, 281, 162, 149, 284, 285, 497, 287, 215,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002474 216, 217, 218, 219, 220, 221, 222, 223, 224, 225,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002475 226, 156, 157, 644, 645, 159, 647, 648, 234, 156,
2476 157, 159, 158, 336, 168, 159, 164, 159, 22, 245,
2477 399, 156, 164, 322, 168, 535, 22, 537, 54, 670,
2478 671, 330, 331, 332, 333, 334, 415, 22, 417, 418,
2479 419, 42, 43, 44, 121, 122, 47, 3, 4, 5,
2480 6, 3, 4, 5, 6, 62, 63, 64, 65, 66,
2481 67, 42, 288, 44, 141, 142, 4, 144, 145, 4,
2482 147, 148, 149, 299, 26, 27, 19, 37, 157, 22,
2483 159, 24, 157, 163, 159, 7, 8, 525, 156, 599,
2484 316, 317, 318, 454, 163, 121, 122, 19, 20, 160,
2485 22, 23, 24, 4, 403, 404, 405, 406, 407, 22,
2486 336, 337, 338, 159, 413, 141, 142, 157, 144, 145,
2487 4, 147, 148, 149, 157, 166, 159, 426, 427, 7,
2488 8, 156, 10, 11, 12, 13, 14, 15, 16, 17,
2489 157, 19, 20, 9, 22, 23, 24, 9, 157, 375,
2490 159, 32, 33, 117, 118, 454, 114, 115, 384, 538,
2491 84, 85, 541, 542, 543, 9, 9, 9, 9, 55,
2492 57, 11, 50, 399, 166, 157, 156, 156, 156, 478,
2493 156, 480, 620, 156, 483, 156, 156, 625, 22, 415,
2494 416, 417, 418, 419, 493, 494, 159, 156, 159, 425,
2495 365, 366, 367, 368, 369, 370, 371, 156, 156, 156,
2496 38, 284, 285, 439, 287, 380, 381, 382, 94, 95,
2497 96, 97, 98, 99, 100, 101, 102, 103, 159, 528,
2498 529, 159, 531, 532, 533, 534, 159, 4, 159, 159,
2499 539, 38, 156, 617, 156, 156, 156, 61, 547, 322,
2500 159, 159, 159, 38, 553, 159, 162, 330, 331, 332,
2501 333, 334, 159, 159, 159, 159, 492, 641, 159, 159,
2502 159, 159, 498, 166, 159, 440, 441, 442, 443, 159,
2503 159, 22, 159, 161, 162, 159, 451, 165, 157, 167,
2504 168, 17, 518, 592, 17, 156, 159, 4, 524, 159,
2505 159, 159, 159, 159, 530, 159, 159, 159, 4, 4,
2506 159, 156, 538, 159, 22, 541, 542, 543, 166, 618,
2507 619, 159, 159, 523, 550, 4, 159, 159, 159, 159,
2508 403, 404, 405, 406, 407, 4, 54, 159, 157, 638,
2509 413, 159, 507, 508, 509, 510, 159, 512, 26, 27,
2510 157, 516, 517, 426, 427, 157, 22, 162, 159, 157,
2511 164, 157, 157, 157, 54, 664, 665, 17, 157, 157,
2512 669, 164, 4, 672, 157, 152, 156, 156, 22, 678,
2513 17, 159, 681, 17, 159, 73, 17, 17, 131, 131,
2514 555, 556, 557, 558, 131, 621, 93, 612, 234, 577,
2515 112, 106, 17, 90, 57, 478, 245, 480, 444, 550,
2516 483, -1, 612, -1, -1, -1, -1, -1, -1, -1,
2517 493, 494, 100, 101, 102, 103, 104, 105, 106, 107,
2518 108, 109, 110, 111, 112, 113, -1, -1, -1, 604,
2519 -1, 606, 607, -1, -1, 0, -1, -1, -1, -1,
2520 -1, -1, -1, -1, -1, 528, 529, -1, 531, 532,
2521 533, 534, -1, 18, 19, 20, 539, 22, 23, 24,
2522 -1, -1, -1, -1, 547, 30, 31, -1, 7, 8,
2523 553, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2524 19, 20, 0, 22, 23, 24, -1, 52, -1, -1,
2525 -1, 56, -1, -1, -1, 60, -1, -1, -1, -1,
2526 18, 19, 20, -1, 22, 23, 24, -1, -1, 592,
2527 -1, 50, 30, 31, -1, -1, -1, -1, -1, -1,
2528 -1, -1, -1, -1, -1, -1, -1, 3, 4, -1,
2529 -1, 7, 8, 9, 52, 618, 619, -1, 56, -1,
2530 -1, -1, 60, 19, 20, -1, 22, 23, 24, 25,
2531 26, 27, -1, -1, -1, 638, -1, -1, -1, -1,
2532 -1, -1, -1, -1, 40, 41, -1, -1, -1, -1,
2533 -1, -1, -1, -1, -1, -1, -1, -1, 54, -1,
2534 -1, 664, 665, 59, -1, -1, 669, -1, -1, 672,
2535 -1, -1, -1, -1, -1, 678, -1, -1, 681, 75,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002536 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2537 86, 87, 88, 89, 90, 91, 92, 93, -1, -1,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002538 -1, -1, 161, 162, -1, -1, 165, -1, 167, 168,
2539 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2540 -1, -1, -1, 119, 120, 121, 122, 123, 124, 125,
2541 126, 127, 128, 129, 130, 131, -1, 133, -1, 135,
2542 136, 137, -1, 139, 140, 141, 142, -1, 144, 145,
2543 -1, 147, 148, 149, 3, 4, -1, -1, 7, 8,
2544 9, -1, -1, -1, -1, -1, -1, -1, -1, 165,
2545 19, 20, -1, 22, 23, 24, 25, 26, 27, -1,
2546 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2547 -1, 40, 41, -1, -1, -1, -1, -1, -1, -1,
2548 -1, -1, -1, -1, -1, -1, 55, -1, 7, 8,
2549 59, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2550 19, 20, -1, 22, 23, 24, 75, 76, 77, 78,
2551 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2552 89, 90, 91, 92, 93, -1, -1, -1, -1, 7,
2553 8, 50, 10, 11, 12, 13, 14, 15, 16, 17,
2554 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2555 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
2556 129, 130, 131, -1, 133, -1, 135, 136, 137, -1,
2557 139, 140, 50, -1, -1, -1, -1, -1, 3, 4,
2558 -1, -1, 7, 8, 9, -1, -1, 156, -1, -1,
2559 -1, -1, -1, -1, 19, 20, 165, 22, 23, 24,
2560 25, 26, 27, -1, -1, -1, -1, -1, -1, -1,
2561 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
2562 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2563 -1, -1, -1, -1, 59, -1, -1, -1, -1, -1,
2564 -1, -1, 161, 162, -1, -1, 165, -1, 167, 168,
2565 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2566 85, 86, 87, 88, 89, 90, 91, 92, 93, -1,
2567 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2568 -1, -1, -1, 161, 162, -1, -1, 165, -1, 167,
2569 168, -1, -1, -1, 119, 120, 121, 122, 123, 124,
2570 125, 126, 127, 128, 129, 130, 131, -1, 133, -1,
2571 135, 136, 137, -1, 139, 140, 7, 8, -1, -1,
2572 -1, -1, -1, -1, -1, -1, -1, -1, 19, 20,
2573 -1, 22, 23, 24, 25, -1, -1, -1, -1, -1,
2574 165, -1, -1, -1, -1, -1, -1, -1, -1, 40,
2575 41, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2576 -1, -1, -1, -1, 55, -1, -1, -1, -1, -1,
2577 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2578 -1, -1, -1, -1, 75, 76, 77, 78, 79, 80,
2579 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2580 91, 92, 93, -1, -1, -1, -1, -1, -1, 7,
2581 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2582 -1, 19, 20, -1, 22, 23, 24, -1, 119, 120,
2583 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
2584 131, 39, 133, -1, 135, 136, 137, -1, 139, 140,
2585 -1, -1, 50, -1, -1, -1, -1, -1, -1, -1,
2586 -1, -1, -1, -1, -1, 156, -1, 7, 8, 160,
2587 -1, 162, -1, -1, 165, -1, 167, -1, 169, 19,
2588 20, -1, 22, 23, 24, 25, -1, -1, -1, -1,
2589 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2590 40, 41, -1, -1, -1, -1, -1, -1, -1, -1,
2591 -1, -1, -1, -1, -1, 55, 7, 8, -1, 10,
2592 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2593 -1, 22, 23, 24, -1, 75, 76, 77, 78, 79,
2594 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2595 90, 91, 92, 93, -1, -1, -1, -1, -1, 50,
2596 -1, -1, -1, 161, 162, -1, -1, 165, -1, 167,
2597 -1, -1, -1, -1, -1, -1, -1, -1, -1, 119,
2598 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
2599 130, 131, -1, 133, -1, 135, 136, 137, -1, 139,
2600 140, -1, -1, -1, -1, -1, -1, -1, 3, 4,
2601 -1, -1, -1, -1, 9, -1, 156, -1, -1, -1,
2602 -1, -1, 162, -1, -1, 165, -1, 167, -1, 169,
2603 25, 26, 27, -1, 125, -1, -1, -1, -1, -1,
2604 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
2605 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2606 -1, -1, -1, -1, 59, -1, -1, -1, -1, -1,
2607 161, 162, -1, -1, 165, -1, 167, -1, -1, -1,
2608 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2609 85, 86, 87, 88, 89, 90, 91, 92, 93, -1,
2610 -1, -1, -1, -1, -1, 7, 8, -1, 10, 11,
2611 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2612 22, 23, 24, -1, 119, 120, 121, 122, 123, 124,
2613 125, 126, 127, 128, 129, 130, 131, 39, 133, -1,
2614 135, 136, 137, -1, 139, 140, 7, 8, 50, 10,
2615 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2616 -1, 22, 23, 24, -1, -1, -1, -1, 7, 8,
2617 165, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2618 19, 20, -1, 22, 23, 24, -1, -1, -1, 50,
2619 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2620 39, -1, -1, -1, -1, -1, -1, -1, -1, 7,
2621 8, 50, 10, 11, 12, 13, 14, 15, 16, 17,
2622 -1, 19, 20, -1, 22, 23, 24, 7, 8, -1,
2623 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2624 20, 39, 22, 23, 24, -1, -1, -1, -1, -1,
2625 -1, -1, 50, -1, -1, -1, -1, -1, -1, 161,
2626 162, -1, -1, 165, -1, 167, -1, -1, 7, 8,
2627 50, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2628 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
2629 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2630 161, 162, -1, 164, 165, -1, 167, -1, -1, -1,
2631 -1, 50, -1, -1, -1, -1, -1, -1, -1, -1,
2632 -1, -1, 161, 162, -1, -1, 165, -1, 167, 7,
2633 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2634 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2635 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2636 -1, -1, -1, 161, 162, -1, -1, 165, -1, 167,
2637 -1, -1, 50, -1, -1, -1, -1, -1, -1, -1,
2638 -1, 161, 162, -1, -1, 165, -1, 167, 7, 8,
2639 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2640 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
2641 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2642 -1, -1, 161, 162, -1, -1, 165, -1, 167, 7,
2643 8, 50, 10, 11, 12, 13, 14, 15, 16, 17,
2644 -1, 19, 20, -1, 22, 23, 24, 7, 8, -1,
2645 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2646 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2647 -1, -1, 50, -1, -1, -1, -1, -1, -1, -1,
2648 -1, -1, -1, 161, 162, -1, -1, 165, -1, 167,
2649 50, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2650 16, 17, -1, 19, 20, -1, 22, 23, 24, 7,
2651 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2652 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2653 -1, -1, -1, -1, 50, -1, -1, -1, -1, -1,
2654 -1, -1, 161, 162, -1, -1, 165, -1, 167, -1,
2655 -1, -1, 50, -1, -1, -1, -1, -1, -1, -1,
2656 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2657 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2658 -1, -1, -1, 161, 162, -1, -1, 165, -1, 167,
2659 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2660 -1, 161, 162, -1, -1, 165, -1, 167, -1, -1,
2661 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2662 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2663 -1, -1, -1, -1, -1, -1, -1, 36, -1, -1,
2664 -1, -1, -1, -1, -1, 161, 162, -1, -1, 165,
2665 -1, 167, -1, -1, -1, -1, -1, -1, 57, 58,
2666 -1, -1, -1, 161, 162, -1, -1, 165, -1, 167,
2667 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
2668 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2669 89, 90, 91, 92, 93, -1, -1, -1, -1, -1,
2670 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2671 -1, -1, -1, -1, -1, 114, 115, 116, -1, -1,
2672 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
2673 129, 130, 131, 132, 133, 134, 135, 136, 137, 138,
2674 139, 140
Dan Gohmanf4423b12008-04-19 00:24:39 +00002675};
2676
2677/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2678 symbol of state STATE-NUM. */
2679static const yytype_uint8 yystos[] =
2680{
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002681 0, 19, 20, 22, 23, 24, 30, 31, 52, 56,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002682 60, 178, 181, 182, 183, 184, 216, 217, 218, 220,
2683 219, 53, 68, 225, 158, 59, 158, 18, 158, 42,
2684 43, 44, 45, 46, 47, 48, 49, 51, 153, 154,
2685 155, 185, 186, 187, 0, 218, 46, 48, 188, 235,
2686 42, 43, 44, 47, 189, 232, 234, 242, 158, 158,
2687 162, 226, 22, 224, 7, 8, 10, 11, 12, 13,
2688 14, 15, 16, 17, 50, 161, 162, 165, 167, 178,
2689 182, 203, 204, 238, 187, 187, 35, 37, 214, 187,
2690 187, 21, 243, 244, 29, 168, 233, 243, 22, 22,
2691 22, 227, 156, 4, 4, 4, 167, 10, 168, 204,
2692 209, 55, 156, 180, 214, 214, 42, 44, 190, 32,
2693 33, 213, 62, 63, 64, 65, 66, 67, 191, 230,
2694 230, 181, 247, 159, 164, 39, 204, 205, 207, 208,
2695 163, 163, 168, 209, 159, 168, 156, 208, 160, 213,
2696 213, 10, 125, 204, 206, 215, 11, 12, 13, 14,
2697 15, 16, 176, 177, 204, 210, 4, 206, 28, 167,
2698 231, 36, 57, 58, 69, 70, 71, 72, 73, 74,
Chris Lattnercc81d152008-05-04 17:18:47 +00002699 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002700 85, 86, 87, 88, 89, 90, 91, 92, 93, 114,
2701 115, 116, 119, 120, 121, 122, 123, 124, 125, 126,
Nate Begemanac80ade2008-05-12 19:01:56 +00002702 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002703 137, 138, 139, 140, 171, 172, 173, 245, 252, 253,
2704 254, 255, 22, 193, 159, 157, 204, 204, 166, 168,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002705 204, 4, 157, 210, 204, 156, 238, 26, 27, 3,
2706 4, 5, 6, 9, 25, 40, 41, 90, 91, 92,
2707 93, 119, 133, 135, 136, 137, 139, 140, 162, 165,
2708 167, 169, 171, 172, 173, 211, 238, 180, 182, 57,
2709 10, 204, 240, 241, 11, 17, 11, 176, 191, 94,
2710 95, 96, 97, 98, 99, 100, 101, 102, 103, 174,
2711 26, 27, 100, 101, 102, 103, 104, 105, 106, 107,
2712 108, 109, 110, 111, 112, 113, 175, 174, 175, 204,
2713 204, 240, 204, 204, 248, 240, 240, 240, 240, 240,
2714 204, 204, 204, 204, 204, 240, 191, 117, 118, 54,
2715 121, 122, 141, 142, 144, 145, 147, 148, 149, 192,
2716 39, 205, 195, 164, 166, 166, 157, 195, 180, 180,
2717 215, 174, 175, 174, 175, 156, 156, 156, 156, 156,
2718 156, 156, 164, 210, 212, 167, 212, 168, 212, 22,
2719 156, 156, 156, 221, 156, 3, 4, 9, 25, 26,
2720 27, 40, 41, 59, 165, 211, 237, 238, 239, 159,
2721 239, 239, 239, 206, 204, 204, 204, 204, 159, 198,
2722 159, 198, 239, 162, 159, 159, 159, 159, 159, 159,
2723 239, 239, 239, 239, 239, 38, 206, 204, 240, 4,
2724 141, 142, 143, 146, 150, 151, 194, 222, 223, 38,
2725 156, 156, 156, 156, 210, 210, 210, 210, 210, 210,
2726 210, 159, 164, 168, 204, 212, 166, 168, 210, 210,
2727 210, 159, 201, 39, 204, 228, 229, 61, 236, 212,
2728 240, 159, 159, 239, 239, 239, 239, 239, 11, 54,
2729 11, 250, 239, 162, 240, 204, 240, 240, 240, 159,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002730 159, 251, 159, 159, 159, 204, 239, 239, 159, 201,
2731 201, 204, 210, 210, 210, 210, 250, 159, 159, 159,
2732 159, 251, 159, 210, 166, 168, 159, 159, 38, 34,
2733 54, 199, 202, 193, 159, 157, 22, 166, 17, 17,
2734 156, 159, 159, 159, 159, 239, 4, 239, 159, 159,
2735 239, 159, 159, 159, 4, 4, 159, 204, 239, 239,
2736 156, 159, 198, 204, 157, 159, 159, 159, 159, 157,
2737 210, 210, 210, 210, 157, 210, 166, 210, 210, 204,
2738 22, 4, 201, 178, 179, 39, 204, 195, 159, 239,
2739 239, 17, 204, 249, 239, 239, 239, 239, 198, 198,
2740 240, 239, 159, 240, 240, 240, 4, 239, 249, 239,
2741 210, 210, 210, 210, 159, 157, 159, 159, 251, 157,
2742 157, 157, 193, 199, 200, 22, 159, 162, 193, 193,
2743 157, 159, 164, 239, 251, 157, 198, 157, 157, 157,
2744 157, 210, 210, 210, 157, 179, 54, 197, 17, 164,
2745 176, 246, 121, 122, 239, 239, 195, 17, 204, 164,
2746 195, 157, 157, 157, 4, 152, 196, 239, 237, 164,
2747 176, 193, 193, 38, 193, 193, 22, 159, 237, 17,
2748 239, 239, 17, 159, 239, 193, 193, 239, 17, 73,
2749 239, 17, 239
Dan Gohmanf4423b12008-04-19 00:24:39 +00002750};
David Greene718fda32007-08-01 03:59:32 +00002751
Reid Spencer68a24bd2005-08-27 18:50:39 +00002752#define yyerrok (yyerrstatus = 0)
2753#define yyclearin (yychar = YYEMPTY)
Dan Gohmanf4423b12008-04-19 00:24:39 +00002754#define YYEMPTY (-2)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002755#define YYEOF 0
Dan Gohmanf4423b12008-04-19 00:24:39 +00002756
Reid Spencer68a24bd2005-08-27 18:50:39 +00002757#define YYACCEPT goto yyacceptlab
Dan Gohmanf4423b12008-04-19 00:24:39 +00002758#define YYABORT goto yyabortlab
2759#define YYERROR goto yyerrorlab
2760
2761
2762/* Like YYERROR except do call yyerror. This remains here temporarily
2763 to ease the transition to the new meaning of YYERROR, for GCC.
Reid Spencer68a24bd2005-08-27 18:50:39 +00002764 Once GCC version 2 has supplanted version 1, this can go. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00002765
Reid Spencer68a24bd2005-08-27 18:50:39 +00002766#define YYFAIL goto yyerrlab
Dan Gohmanf4423b12008-04-19 00:24:39 +00002767
Reid Spencer68a24bd2005-08-27 18:50:39 +00002768#define YYRECOVERING() (!!yyerrstatus)
Dan Gohmanf4423b12008-04-19 00:24:39 +00002769
2770#define YYBACKUP(Token, Value) \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002771do \
2772 if (yychar == YYEMPTY && yylen == 1) \
Dan Gohmanf4423b12008-04-19 00:24:39 +00002773 { \
2774 yychar = (Token); \
2775 yylval = (Value); \
2776 yytoken = YYTRANSLATE (yychar); \
2777 YYPOPSTACK (1); \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002778 goto yybackup; \
2779 } \
2780 else \
Dan Gohmanf4423b12008-04-19 00:24:39 +00002781 { \
2782 yyerror (YY_("syntax error: cannot back up")); \
2783 YYERROR; \
2784 } \
2785while (YYID (0))
2786
Anton Korobeynikov38e09802007-04-28 13:48:45 +00002787
Reid Spencer68a24bd2005-08-27 18:50:39 +00002788#define YYTERROR 1
2789#define YYERRCODE 256
2790
Dan Gohmanf4423b12008-04-19 00:24:39 +00002791
2792/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2793 If N is 0, then set CURRENT to the empty location which ends
2794 the previous symbol: RHS[0] (always defined). */
2795
2796#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2797#ifndef YYLLOC_DEFAULT
2798# define YYLLOC_DEFAULT(Current, Rhs, N) \
2799 do \
2800 if (YYID (N)) \
2801 { \
2802 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2803 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2804 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2805 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2806 } \
2807 else \
2808 { \
2809 (Current).first_line = (Current).last_line = \
2810 YYRHSLOC (Rhs, 0).last_line; \
2811 (Current).first_column = (Current).last_column = \
2812 YYRHSLOC (Rhs, 0).last_column; \
2813 } \
2814 while (YYID (0))
Reid Spencer68a24bd2005-08-27 18:50:39 +00002815#endif
2816
Dan Gohmanf4423b12008-04-19 00:24:39 +00002817
2818/* YY_LOCATION_PRINT -- Print the location on the stream.
2819 This macro was not mandated originally: define only if we know
2820 we won't break user code: when these are the locations we know. */
2821
2822#ifndef YY_LOCATION_PRINT
2823# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2824# define YY_LOCATION_PRINT(File, Loc) \
2825 fprintf (File, "%d.%d-%d.%d", \
2826 (Loc).first_line, (Loc).first_column, \
2827 (Loc).last_line, (Loc).last_column)
2828# else
2829# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2830# endif
2831#endif
2832
2833
2834/* YYLEX -- calling `yylex' with the right arguments. */
2835
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00002836#ifdef YYLEX_PARAM
Dan Gohmanf4423b12008-04-19 00:24:39 +00002837# define YYLEX yylex (YYLEX_PARAM)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00002838#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00002839# define YYLEX yylex ()
Gabor Greife64d2482008-04-06 23:07:54 +00002840#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002841
2842/* Enable debugging if requested. */
2843#if YYDEBUG
2844
2845# ifndef YYFPRINTF
2846# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2847# define YYFPRINTF fprintf
2848# endif
2849
2850# define YYDPRINTF(Args) \
2851do { \
2852 if (yydebug) \
2853 YYFPRINTF Args; \
2854} while (YYID (0))
2855
2856# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2857do { \
2858 if (yydebug) \
2859 { \
2860 YYFPRINTF (stderr, "%s ", Title); \
2861 yy_symbol_print (stderr, \
2862 Type, Value); \
2863 YYFPRINTF (stderr, "\n"); \
2864 } \
2865} while (YYID (0))
2866
2867
2868/*--------------------------------.
2869| Print this symbol on YYOUTPUT. |
2870`--------------------------------*/
2871
2872/*ARGSUSED*/
2873#if (defined __STDC__ || defined __C99__FUNC__ \
2874 || defined __cplusplus || defined _MSC_VER)
2875static void
2876yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
Gabor Greife64d2482008-04-06 23:07:54 +00002877#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00002878static void
2879yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2880 FILE *yyoutput;
2881 int yytype;
2882 YYSTYPE const * const yyvaluep;
Gabor Greife64d2482008-04-06 23:07:54 +00002883#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002884{
2885 if (!yyvaluep)
2886 return;
2887# ifdef YYPRINT
2888 if (yytype < YYNTOKENS)
2889 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2890# else
2891 YYUSE (yyoutput);
2892# endif
2893 switch (yytype)
2894 {
2895 default:
2896 break;
2897 }
2898}
2899
2900
2901/*--------------------------------.
2902| Print this symbol on YYOUTPUT. |
2903`--------------------------------*/
2904
2905#if (defined __STDC__ || defined __C99__FUNC__ \
2906 || defined __cplusplus || defined _MSC_VER)
2907static void
2908yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2909#else
2910static void
2911yy_symbol_print (yyoutput, yytype, yyvaluep)
2912 FILE *yyoutput;
2913 int yytype;
2914 YYSTYPE const * const yyvaluep;
Scott Michel15dcd8e2008-01-30 03:10:00 +00002915#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002916{
2917 if (yytype < YYNTOKENS)
2918 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2919 else
2920 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
Chris Lattner38905612008-02-19 04:36:25 +00002921
Dan Gohmanf4423b12008-04-19 00:24:39 +00002922 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2923 YYFPRINTF (yyoutput, ")");
2924}
Chris Lattner38905612008-02-19 04:36:25 +00002925
Dan Gohmanf4423b12008-04-19 00:24:39 +00002926/*------------------------------------------------------------------.
2927| yy_stack_print -- Print the state stack from its BOTTOM up to its |
2928| TOP (included). |
2929`------------------------------------------------------------------*/
Chris Lattner38905612008-02-19 04:36:25 +00002930
Dan Gohmanf4423b12008-04-19 00:24:39 +00002931#if (defined __STDC__ || defined __C99__FUNC__ \
2932 || defined __cplusplus || defined _MSC_VER)
2933static void
2934yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
2935#else
2936static void
2937yy_stack_print (bottom, top)
2938 yytype_int16 *bottom;
2939 yytype_int16 *top;
Scott Michel15dcd8e2008-01-30 03:10:00 +00002940#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002941{
2942 YYFPRINTF (stderr, "Stack now");
2943 for (; bottom <= top; ++bottom)
2944 YYFPRINTF (stderr, " %d", *bottom);
2945 YYFPRINTF (stderr, "\n");
2946}
Chris Lattner38905612008-02-19 04:36:25 +00002947
Dan Gohmanf4423b12008-04-19 00:24:39 +00002948# define YY_STACK_PRINT(Bottom, Top) \
2949do { \
2950 if (yydebug) \
2951 yy_stack_print ((Bottom), (Top)); \
2952} while (YYID (0))
Chris Lattner38905612008-02-19 04:36:25 +00002953
Dan Gohmanf4423b12008-04-19 00:24:39 +00002954
2955/*------------------------------------------------.
2956| Report that the YYRULE is going to be reduced. |
2957`------------------------------------------------*/
2958
2959#if (defined __STDC__ || defined __C99__FUNC__ \
2960 || defined __cplusplus || defined _MSC_VER)
2961static void
2962yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
2963#else
2964static void
2965yy_reduce_print (yyvsp, yyrule)
2966 YYSTYPE *yyvsp;
2967 int yyrule;
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00002968#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002969{
2970 int yynrhs = yyr2[yyrule];
2971 int yyi;
2972 unsigned long int yylno = yyrline[yyrule];
2973 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2974 yyrule - 1, yylno);
2975 /* The symbols being reduced. */
2976 for (yyi = 0; yyi < yynrhs; yyi++)
2977 {
2978 fprintf (stderr, " $%d = ", yyi + 1);
2979 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2980 &(yyvsp[(yyi + 1) - (yynrhs)])
2981 );
2982 fprintf (stderr, "\n");
2983 }
2984}
Scott Michel7f9ba9b2008-01-30 02:55:46 +00002985
Dan Gohmanf4423b12008-04-19 00:24:39 +00002986# define YY_REDUCE_PRINT(Rule) \
2987do { \
2988 if (yydebug) \
2989 yy_reduce_print (yyvsp, Rule); \
2990} while (YYID (0))
Scott Michel7f9ba9b2008-01-30 02:55:46 +00002991
Dan Gohmanf4423b12008-04-19 00:24:39 +00002992/* Nonzero means print parse trace. It is left uninitialized so that
2993 multiple parsers can coexist. */
2994int yydebug;
2995#else /* !YYDEBUG */
2996# define YYDPRINTF(Args)
2997# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2998# define YY_STACK_PRINT(Bottom, Top)
2999# define YY_REDUCE_PRINT(Rule)
3000#endif /* !YYDEBUG */
3001
3002
3003/* YYINITDEPTH -- initial size of the parser's stacks. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003004#ifndef YYINITDEPTH
Dan Gohmanf4423b12008-04-19 00:24:39 +00003005# define YYINITDEPTH 200
Reid Spencer68a24bd2005-08-27 18:50:39 +00003006#endif
3007
Dan Gohmanf4423b12008-04-19 00:24:39 +00003008/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
3009 if the built-in stack extension method is used).
Reid Spencer68a24bd2005-08-27 18:50:39 +00003010
Dan Gohmanf4423b12008-04-19 00:24:39 +00003011 Do not make this value too large; the results are undefined if
3012 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
3013 evaluated with infinite-precision integer arithmetic. */
David Greene718fda32007-08-01 03:59:32 +00003014
Reid Spencer68a24bd2005-08-27 18:50:39 +00003015#ifndef YYMAXDEPTH
Dan Gohmanf4423b12008-04-19 00:24:39 +00003016# define YYMAXDEPTH 10000
Reid Spencer68a24bd2005-08-27 18:50:39 +00003017#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003018
Reid Spencer68a24bd2005-08-27 18:50:39 +00003019
3020
Dan Gohmanf4423b12008-04-19 00:24:39 +00003021#if YYERROR_VERBOSE
Reid Spencer68a24bd2005-08-27 18:50:39 +00003022
Dan Gohmanf4423b12008-04-19 00:24:39 +00003023# ifndef yystrlen
3024# if defined __GLIBC__ && defined _STRING_H
3025# define yystrlen strlen
3026# else
3027/* Return the length of YYSTR. */
3028#if (defined __STDC__ || defined __C99__FUNC__ \
3029 || defined __cplusplus || defined _MSC_VER)
3030static YYSIZE_T
3031yystrlen (const char *yystr)
Chris Lattner38905612008-02-19 04:36:25 +00003032#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00003033static YYSIZE_T
3034yystrlen (yystr)
3035 const char *yystr;
3036#endif
3037{
3038 YYSIZE_T yylen;
3039 for (yylen = 0; yystr[yylen]; yylen++)
3040 continue;
3041 return yylen;
3042}
3043# endif
3044# endif
3045
3046# ifndef yystpcpy
3047# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
3048# define yystpcpy stpcpy
3049# else
3050/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
3051 YYDEST. */
3052#if (defined __STDC__ || defined __C99__FUNC__ \
3053 || defined __cplusplus || defined _MSC_VER)
3054static char *
3055yystpcpy (char *yydest, const char *yysrc)
3056#else
3057static char *
3058yystpcpy (yydest, yysrc)
3059 char *yydest;
3060 const char *yysrc;
3061#endif
3062{
3063 char *yyd = yydest;
3064 const char *yys = yysrc;
3065
3066 while ((*yyd++ = *yys++) != '\0')
3067 continue;
3068
3069 return yyd - 1;
3070}
3071# endif
3072# endif
3073
3074# ifndef yytnamerr
3075/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3076 quotes and backslashes, so that it's suitable for yyerror. The
3077 heuristic is that double-quoting is unnecessary unless the string
3078 contains an apostrophe, a comma, or backslash (other than
3079 backslash-backslash). YYSTR is taken from yytname. If YYRES is
3080 null, do not copy; instead, return the length of what the result
3081 would have been. */
3082static YYSIZE_T
3083yytnamerr (char *yyres, const char *yystr)
3084{
3085 if (*yystr == '"')
3086 {
3087 YYSIZE_T yyn = 0;
3088 char const *yyp = yystr;
3089
3090 for (;;)
3091 switch (*++yyp)
3092 {
3093 case '\'':
3094 case ',':
3095 goto do_not_strip_quotes;
3096
3097 case '\\':
3098 if (*++yyp != '\\')
3099 goto do_not_strip_quotes;
3100 /* Fall through. */
3101 default:
3102 if (yyres)
3103 yyres[yyn] = *yyp;
3104 yyn++;
3105 break;
3106
3107 case '"':
3108 if (yyres)
3109 yyres[yyn] = '\0';
3110 return yyn;
3111 }
3112 do_not_strip_quotes: ;
3113 }
3114
3115 if (! yyres)
3116 return yystrlen (yystr);
3117
3118 return yystpcpy (yyres, yystr) - yyres;
3119}
3120# endif
3121
3122/* Copy into YYRESULT an error message about the unexpected token
3123 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3124 including the terminating null byte. If YYRESULT is null, do not
3125 copy anything; just return the number of bytes that would be
3126 copied. As a special case, return 0 if an ordinary "syntax error"
3127 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3128 size calculation. */
3129static YYSIZE_T
3130yysyntax_error (char *yyresult, int yystate, int yychar)
3131{
3132 int yyn = yypact[yystate];
3133
3134 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3135 return 0;
3136 else
3137 {
3138 int yytype = YYTRANSLATE (yychar);
3139 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3140 YYSIZE_T yysize = yysize0;
3141 YYSIZE_T yysize1;
3142 int yysize_overflow = 0;
3143 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3144 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3145 int yyx;
3146
3147# if 0
3148 /* This is so xgettext sees the translatable formats that are
3149 constructed on the fly. */
3150 YY_("syntax error, unexpected %s");
3151 YY_("syntax error, unexpected %s, expecting %s");
3152 YY_("syntax error, unexpected %s, expecting %s or %s");
3153 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3154 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3155# endif
3156 char *yyfmt;
3157 char const *yyf;
3158 static char const yyunexpected[] = "syntax error, unexpected %s";
3159 static char const yyexpecting[] = ", expecting %s";
3160 static char const yyor[] = " or %s";
3161 char yyformat[sizeof yyunexpected
3162 + sizeof yyexpecting - 1
3163 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3164 * (sizeof yyor - 1))];
3165 char const *yyprefix = yyexpecting;
3166
3167 /* Start YYX at -YYN if negative to avoid negative indexes in
3168 YYCHECK. */
3169 int yyxbegin = yyn < 0 ? -yyn : 0;
3170
3171 /* Stay within bounds of both yycheck and yytname. */
3172 int yychecklim = YYLAST - yyn + 1;
3173 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3174 int yycount = 1;
3175
3176 yyarg[0] = yytname[yytype];
3177 yyfmt = yystpcpy (yyformat, yyunexpected);
3178
3179 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3180 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3181 {
3182 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3183 {
3184 yycount = 1;
3185 yysize = yysize0;
3186 yyformat[sizeof yyunexpected - 1] = '\0';
3187 break;
3188 }
3189 yyarg[yycount++] = yytname[yyx];
3190 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3191 yysize_overflow |= (yysize1 < yysize);
3192 yysize = yysize1;
3193 yyfmt = yystpcpy (yyfmt, yyprefix);
3194 yyprefix = yyor;
3195 }
3196
3197 yyf = YY_(yyformat);
3198 yysize1 = yysize + yystrlen (yyf);
3199 yysize_overflow |= (yysize1 < yysize);
3200 yysize = yysize1;
3201
3202 if (yysize_overflow)
3203 return YYSIZE_MAXIMUM;
3204
3205 if (yyresult)
3206 {
3207 /* Avoid sprintf, as that infringes on the user's name space.
3208 Don't have undefined behavior even if the translation
3209 produced a string with the wrong number of "%s"s. */
3210 char *yyp = yyresult;
3211 int yyi = 0;
3212 while ((*yyp = *yyf) != '\0')
3213 {
3214 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3215 {
3216 yyp += yytnamerr (yyp, yyarg[yyi++]);
3217 yyf += 2;
3218 }
3219 else
3220 {
3221 yyp++;
3222 yyf++;
3223 }
3224 }
3225 }
3226 return yysize;
3227 }
3228}
3229#endif /* YYERROR_VERBOSE */
3230
3231
3232/*-----------------------------------------------.
3233| Release the memory associated to this symbol. |
3234`-----------------------------------------------*/
3235
3236/*ARGSUSED*/
3237#if (defined __STDC__ || defined __C99__FUNC__ \
3238 || defined __cplusplus || defined _MSC_VER)
3239static void
3240yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3241#else
3242static void
3243yydestruct (yymsg, yytype, yyvaluep)
3244 const char *yymsg;
3245 int yytype;
3246 YYSTYPE *yyvaluep;
3247#endif
3248{
3249 YYUSE (yyvaluep);
3250
3251 if (!yymsg)
3252 yymsg = "Deleting";
3253 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3254
3255 switch (yytype)
3256 {
3257
3258 default:
3259 break;
3260 }
3261}
3262
3263
3264/* Prevent warnings from -Wmissing-prototypes. */
3265
3266#ifdef YYPARSE_PARAM
3267#if defined __STDC__ || defined __cplusplus
3268int yyparse (void *YYPARSE_PARAM);
3269#else
3270int yyparse ();
3271#endif
3272#else /* ! YYPARSE_PARAM */
3273#if defined __STDC__ || defined __cplusplus
David Greene5fd22a82007-09-04 18:46:50 +00003274int yyparse (void);
Gabor Greife64d2482008-04-06 23:07:54 +00003275#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00003276int yyparse ();
Scott Michel15dcd8e2008-01-30 03:10:00 +00003277#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003278#endif /* ! YYPARSE_PARAM */
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003279
Chris Lattner38905612008-02-19 04:36:25 +00003280
Dan Gohmanf4423b12008-04-19 00:24:39 +00003281
3282/* The look-ahead symbol. */
3283int yychar;
3284
3285/* The semantic value of the look-ahead symbol. */
3286YYSTYPE yylval;
3287
3288/* Number of syntax errors so far. */
3289int yynerrs;
3290
3291
3292
3293/*----------.
3294| yyparse. |
3295`----------*/
3296
3297#ifdef YYPARSE_PARAM
3298#if (defined __STDC__ || defined __C99__FUNC__ \
3299 || defined __cplusplus || defined _MSC_VER)
3300int
3301yyparse (void *YYPARSE_PARAM)
3302#else
3303int
3304yyparse (YYPARSE_PARAM)
3305 void *YYPARSE_PARAM;
3306#endif
3307#else /* ! YYPARSE_PARAM */
3308#if (defined __STDC__ || defined __C99__FUNC__ \
3309 || defined __cplusplus || defined _MSC_VER)
3310int
3311yyparse (void)
3312#else
3313int
3314yyparse ()
3315
Gabor Greife64d2482008-04-06 23:07:54 +00003316#endif
3317#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003318{
3319
3320 int yystate;
3321 int yyn;
3322 int yyresult;
3323 /* Number of tokens to shift before error messages enabled. */
3324 int yyerrstatus;
3325 /* Look-ahead token as an internal (translated) token number. */
3326 int yytoken = 0;
3327#if YYERROR_VERBOSE
3328 /* Buffer for error messages, and its allocated size. */
3329 char yymsgbuf[128];
3330 char *yymsg = yymsgbuf;
3331 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
Gabor Greife64d2482008-04-06 23:07:54 +00003332#endif
Chris Lattner38905612008-02-19 04:36:25 +00003333
Dan Gohmanf4423b12008-04-19 00:24:39 +00003334 /* Three stacks and their tools:
3335 `yyss': related to states,
3336 `yyvs': related to semantic values,
3337 `yyls': related to locations.
3338
3339 Refer to the stacks thru separate pointers, to allow yyoverflow
3340 to reallocate them elsewhere. */
3341
3342 /* The state stack. */
3343 yytype_int16 yyssa[YYINITDEPTH];
3344 yytype_int16 *yyss = yyssa;
3345 yytype_int16 *yyssp;
3346
3347 /* The semantic value stack. */
3348 YYSTYPE yyvsa[YYINITDEPTH];
3349 YYSTYPE *yyvs = yyvsa;
3350 YYSTYPE *yyvsp;
3351
3352
3353
3354#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3355
3356 YYSIZE_T yystacksize = YYINITDEPTH;
3357
3358 /* The variables used to return semantic value and location from the
3359 action routines. */
3360 YYSTYPE yyval;
3361
3362
3363 /* The number of symbols on the RHS of the reduced rule.
3364 Keep to zero when no symbol should be popped. */
3365 int yylen = 0;
3366
3367 YYDPRINTF ((stderr, "Starting parse\n"));
3368
Reid Spencer68a24bd2005-08-27 18:50:39 +00003369 yystate = 0;
3370 yyerrstatus = 0;
3371 yynerrs = 0;
3372 yychar = YYEMPTY; /* Cause a token to be read. */
3373
3374 /* Initialize stack pointers.
3375 Waste one element of value and location stack
3376 so that they stay on the same level as the state stack.
3377 The wasted elements are never initialized. */
3378
Dan Gohmanf4423b12008-04-19 00:24:39 +00003379 yyssp = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003380 yyvsp = yyvs;
3381
Dan Gohmanf4423b12008-04-19 00:24:39 +00003382 goto yysetstate;
Jeff Cohen66c5fd62005-10-23 04:37:20 +00003383
Dan Gohmanf4423b12008-04-19 00:24:39 +00003384/*------------------------------------------------------------.
3385| yynewstate -- Push a new state, which is found in yystate. |
3386`------------------------------------------------------------*/
3387 yynewstate:
3388 /* In all cases, when you get here, the value and location stacks
3389 have just been pushed. So pushing a state here evens the stacks. */
3390 yyssp++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003391
Dan Gohmanf4423b12008-04-19 00:24:39 +00003392 yysetstate:
3393 *yyssp = yystate;
3394
3395 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003396 {
3397 /* Get the current used size of the three stacks, in elements. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003398 YYSIZE_T yysize = yyssp - yyss + 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003399
3400#ifdef yyoverflow
Dan Gohmanf4423b12008-04-19 00:24:39 +00003401 {
3402 /* Give user a chance to reallocate the stack. Use copies of
3403 these so that the &'s don't force the real ones into
3404 memory. */
3405 YYSTYPE *yyvs1 = yyvs;
3406 yytype_int16 *yyss1 = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003407
Dan Gohmanf4423b12008-04-19 00:24:39 +00003408
3409 /* Each stack pointer address is followed by the size of the
3410 data in use in that stack, in bytes. This used to be a
3411 conditional around just the two extra args, but that might
3412 be undefined if yyoverflow is a macro. */
3413 yyoverflow (YY_("memory exhausted"),
3414 &yyss1, yysize * sizeof (*yyssp),
3415 &yyvs1, yysize * sizeof (*yyvsp),
3416
3417 &yystacksize);
3418
3419 yyss = yyss1;
3420 yyvs = yyvs1;
3421 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00003422#else /* no yyoverflow */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003423# ifndef YYSTACK_RELOCATE
3424 goto yyexhaustedlab;
3425# else
Reid Spencer68a24bd2005-08-27 18:50:39 +00003426 /* Extend the stack our own way. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003427 if (YYMAXDEPTH <= yystacksize)
3428 goto yyexhaustedlab;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003429 yystacksize *= 2;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003430 if (YYMAXDEPTH < yystacksize)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003431 yystacksize = YYMAXDEPTH;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003432
3433 {
3434 yytype_int16 *yyss1 = yyss;
3435 union yyalloc *yyptr =
3436 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3437 if (! yyptr)
3438 goto yyexhaustedlab;
3439 YYSTACK_RELOCATE (yyss);
3440 YYSTACK_RELOCATE (yyvs);
3441
3442# undef YYSTACK_RELOCATE
3443 if (yyss1 != yyssa)
3444 YYSTACK_FREE (yyss1);
3445 }
3446# endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00003447#endif /* no yyoverflow */
3448
Dan Gohmanf4423b12008-04-19 00:24:39 +00003449 yyssp = yyss + yysize - 1;
3450 yyvsp = yyvs + yysize - 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003451
3452
Dan Gohmanf4423b12008-04-19 00:24:39 +00003453 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3454 (unsigned long int) yystacksize));
3455
3456 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003457 YYABORT;
3458 }
3459
Dan Gohmanf4423b12008-04-19 00:24:39 +00003460 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003461
3462 goto yybackup;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003463
Dan Gohmanf4423b12008-04-19 00:24:39 +00003464/*-----------.
3465| yybackup. |
3466`-----------*/
3467yybackup:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003468
Dan Gohmanf4423b12008-04-19 00:24:39 +00003469 /* Do appropriate processing given the current state. Read a
3470 look-ahead token if we need one and don't already have one. */
Reid Spencer7780acb2007-04-16 06:56:07 +00003471
Dan Gohmanf4423b12008-04-19 00:24:39 +00003472 /* First try to decide what to do without reference to look-ahead token. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003473 yyn = yypact[yystate];
Dan Gohmanf4423b12008-04-19 00:24:39 +00003474 if (yyn == YYPACT_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003475 goto yydefault;
3476
Dan Gohmanf4423b12008-04-19 00:24:39 +00003477 /* Not known => get a look-ahead token if don't already have one. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003478
Dan Gohmanf4423b12008-04-19 00:24:39 +00003479 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003480 if (yychar == YYEMPTY)
3481 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003482 YYDPRINTF ((stderr, "Reading a token: "));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003483 yychar = YYLEX;
3484 }
3485
Dan Gohmanf4423b12008-04-19 00:24:39 +00003486 if (yychar <= YYEOF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003487 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003488 yychar = yytoken = YYEOF;
3489 YYDPRINTF ((stderr, "Now at end of input.\n"));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003490 }
3491 else
3492 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003493 yytoken = YYTRANSLATE (yychar);
3494 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Reid Spencer68a24bd2005-08-27 18:50:39 +00003495 }
3496
Dan Gohmanf4423b12008-04-19 00:24:39 +00003497 /* If the proper action on seeing token YYTOKEN is to reduce or to
3498 detect an error, take that action. */
3499 yyn += yytoken;
3500 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003501 goto yydefault;
3502 yyn = yytable[yyn];
Dan Gohmanf4423b12008-04-19 00:24:39 +00003503 if (yyn <= 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003504 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003505 if (yyn == 0 || yyn == YYTABLE_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003506 goto yyerrlab;
3507 yyn = -yyn;
3508 goto yyreduce;
3509 }
3510
3511 if (yyn == YYFINAL)
3512 YYACCEPT;
3513
Dan Gohmanf4423b12008-04-19 00:24:39 +00003514 /* Count tokens shifted since error; after three, turn off error
3515 status. */
3516 if (yyerrstatus)
3517 yyerrstatus--;
Dale Johannesencdd509a2007-09-07 21:07:57 +00003518
Dan Gohmanf4423b12008-04-19 00:24:39 +00003519 /* Shift the look-ahead token. */
3520 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003521
Dan Gohmanf4423b12008-04-19 00:24:39 +00003522 /* Discard the shifted token unless it is eof. */
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003523 if (yychar != YYEOF)
3524 yychar = YYEMPTY;
3525
Gabor Greife64d2482008-04-06 23:07:54 +00003526 yystate = yyn;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003527 *++yyvsp = yylval;
3528
Reid Spencer68a24bd2005-08-27 18:50:39 +00003529 goto yynewstate;
3530
Gabor Greife64d2482008-04-06 23:07:54 +00003531
Dan Gohmanf4423b12008-04-19 00:24:39 +00003532/*-----------------------------------------------------------.
3533| yydefault -- do the default action for the current state. |
3534`-----------------------------------------------------------*/
3535yydefault:
Reid Spencer68a24bd2005-08-27 18:50:39 +00003536 yyn = yydefact[yystate];
3537 if (yyn == 0)
3538 goto yyerrlab;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003539 goto yyreduce;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003540
Dan Gohmanf4423b12008-04-19 00:24:39 +00003541
3542/*-----------------------------.
3543| yyreduce -- Do a reduction. |
3544`-----------------------------*/
Reid Spencer68a24bd2005-08-27 18:50:39 +00003545yyreduce:
Dan Gohmanf4423b12008-04-19 00:24:39 +00003546 /* yyn is the number of a rule to reduce with. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003547 yylen = yyr2[yyn];
3548
Dan Gohmanf4423b12008-04-19 00:24:39 +00003549 /* If YYLEN is nonzero, implement the default value of the action:
3550 `$$ = $1'.
3551
3552 Otherwise, the following line sets YYVAL to garbage.
3553 This behavior is undocumented and Bison
3554 users should not rely upon it. Assigning to YYVAL
3555 unconditionally makes the parser a bit smaller, and it avoids a
3556 GCC warning that YYVAL may be used uninitialized. */
3557 yyval = yyvsp[1-yylen];
3558
3559
3560 YY_REDUCE_PRINT (yyn);
3561 switch (yyn)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003562 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003563 case 29:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003564#line 1124 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003565 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3566 break;
Reid Spencer41dff5e2007-01-26 08:05:27 +00003567
Dan Gohmanf4423b12008-04-19 00:24:39 +00003568 case 30:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003569#line 1124 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003570 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3571 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003572
Dan Gohmanf4423b12008-04-19 00:24:39 +00003573 case 31:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003574#line 1125 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003575 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3576 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003577
Dan Gohmanf4423b12008-04-19 00:24:39 +00003578 case 32:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003579#line 1125 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003580 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3581 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003582
Dan Gohmanf4423b12008-04-19 00:24:39 +00003583 case 33:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003584#line 1126 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003585 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3586 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003587
Dan Gohmanf4423b12008-04-19 00:24:39 +00003588 case 34:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003589#line 1126 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003590 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3591 break;
3592
3593 case 35:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003594#line 1127 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003595 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3596 break;
3597
3598 case 36:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003599#line 1127 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003600 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3601 break;
3602
3603 case 37:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003604#line 1128 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003605 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3606 break;
3607
3608 case 38:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003609#line 1128 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003610 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3611 break;
3612
3613 case 39:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003614#line 1132 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003615 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3616 break;
3617
3618 case 40:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003619#line 1132 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003620 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3621 break;
3622
3623 case 41:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003624#line 1133 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003625 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3626 break;
3627
3628 case 42:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003629#line 1133 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003630 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3631 break;
3632
3633 case 43:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003634#line 1134 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003635 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3636 break;
3637
3638 case 44:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003639#line 1134 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003640 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3641 break;
3642
3643 case 45:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003644#line 1135 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003645 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3646 break;
3647
3648 case 46:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003649#line 1135 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003650 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3651 break;
3652
3653 case 47:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003654#line 1136 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003655 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3656 break;
3657
3658 case 48:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003659#line 1136 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003660 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3661 break;
3662
3663 case 49:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003664#line 1137 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003665 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3666 break;
3667
3668 case 50:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003669#line 1137 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003670 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3671 break;
3672
3673 case 51:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003674#line 1138 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003675 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3676 break;
3677
3678 case 52:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003679#line 1138 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003680 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3681 break;
3682
3683 case 53:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003684#line 1139 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003685 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3686 break;
3687
3688 case 54:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003689#line 1140 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003690 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3691 break;
3692
3693 case 65:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003694#line 1149 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003695 { (yyval.StrVal) = 0; ;}
3696 break;
3697
3698 case 66:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003699#line 1151 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003700 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3701 break;
3702
3703 case 67:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003704#line 1152 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003705 { (yyval.UIntVal)=0; ;}
3706 break;
3707
3708 case 68:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003709#line 1156 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003710 {
3711 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003712 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003713 ;}
3714 break;
3715
3716 case 69:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003717#line 1160 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003718 {
3719 (yyval.StrVal) = 0;
Christopher Lambbf3348d2007-12-12 08:45:45 +00003720 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003721 ;}
3722 break;
3723
3724 case 73:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003725#line 1168 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003726 {
3727 (yyval.StrVal) = 0;
Christopher Lambbf3348d2007-12-12 08:45:45 +00003728 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003729 ;}
3730 break;
3731
3732 case 74:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003733#line 1173 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003734 {
3735 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00003736 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003737 ;}
3738 break;
3739
3740 case 75:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003741#line 1179 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003742 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3743 break;
3744
3745 case 76:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003746#line 1180 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003747 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3748 break;
3749
3750 case 77:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003751#line 1181 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003752 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3753 break;
3754
3755 case 78:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003756#line 1182 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003757 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3758 break;
3759
3760 case 79:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003761#line 1183 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003762 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3763 break;
3764
3765 case 80:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003766#line 1184 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003767 { (yyval.Linkage) = GlobalValue::CommonLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003768 break;
3769
3770 case 81:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003771#line 1188 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003772 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003773 break;
3774
3775 case 82:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003776#line 1189 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003777 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003778 break;
3779
3780 case 83:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003781#line 1190 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003782 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003783 break;
3784
3785 case 84:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003786#line 1194 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003787 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3788 break;
3789
3790 case 85:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003791#line 1195 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003792 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003793 break;
3794
3795 case 86:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003796#line 1196 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003797 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003798 break;
3799
3800 case 87:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003801#line 1197 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003802 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003803 break;
3804
3805 case 88:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003806#line 1201 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003807 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3808 break;
3809
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003810 case 89:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003811#line 1202 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003812 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3813 break;
3814
3815 case 90:
3816#line 1203 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3817 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3818 break;
3819
3820 case 91:
3821#line 1207 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3822 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3823 break;
3824
3825 case 92:
3826#line 1208 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003827 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3828 break;
3829
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003830 case 93:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003831#line 1209 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003832 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3833 break;
3834
3835 case 94:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003836#line 1210 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003837 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3838 break;
3839
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003840 case 95:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003841#line 1211 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003842 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3843 break;
3844
3845 case 96:
3846#line 1215 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3847 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3848 break;
3849
3850 case 97:
3851#line 1216 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
3852 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3853 break;
3854
3855 case 98:
3856#line 1217 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003857 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003858 break;
3859
3860 case 99:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003861#line 1220 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003862 { (yyval.UIntVal) = CallingConv::C; ;}
3863 break;
3864
3865 case 100:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003866#line 1221 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003867 { (yyval.UIntVal) = CallingConv::C; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003868 break;
3869
3870 case 101:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003871#line 1222 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003872 { (yyval.UIntVal) = CallingConv::Fast; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003873 break;
3874
3875 case 102:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003876#line 1223 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003877 { (yyval.UIntVal) = CallingConv::Cold; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003878 break;
3879
3880 case 103:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003881#line 1224 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003882 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003883 break;
3884
3885 case 104:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003886#line 1225 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003887 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3888 break;
3889
3890 case 105:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003891#line 1226 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003892 {
3893 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003894 GEN_ERROR("Calling conv too large");
Dan Gohmanf4423b12008-04-19 00:24:39 +00003895 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003896 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003897 ;}
3898 break;
3899
Dan Gohmanf4423b12008-04-19 00:24:39 +00003900 case 106:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003901#line 1233 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003902 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3903 break;
3904
3905 case 107:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003906#line 1234 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003907 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003908 break;
3909
3910 case 108:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003911#line 1235 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003912 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3913 break;
3914
3915 case 109:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003916#line 1236 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003917 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003918 break;
3919
3920 case 110:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003921#line 1237 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003922 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003923 break;
3924
3925 case 111:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003926#line 1238 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003927 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003928 break;
3929
3930 case 112:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003931#line 1239 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003932 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003933 break;
3934
3935 case 113:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003936#line 1240 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003937 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003938 break;
3939
3940 case 114:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003941#line 1241 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003942 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
3943 break;
3944
3945 case 115:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003946#line 1242 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003947 { (yyval.ParamAttrs) =
3948 ParamAttr::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
3949 break;
3950
Dan Gohmanf4423b12008-04-19 00:24:39 +00003951 case 116:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003952#line 1246 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003953 { (yyval.ParamAttrs) = ParamAttr::None; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003954 break;
3955
3956 case 117:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003957#line 1247 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003958 {
3959 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3960 ;}
3961 break;
3962
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003963 case 118:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003964#line 1252 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003965 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
3966 break;
3967
3968 case 119:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003969#line 1253 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003970 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
3971 break;
3972
3973 case 120:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003974#line 1254 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003975 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3976 break;
3977
3978 case 121:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003979#line 1255 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003980 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3981 break;
3982
3983 case 122:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003984#line 1256 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003985 { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
3986 break;
3987
3988 case 123:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003989#line 1257 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003990 { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
3991 break;
3992
3993 case 124:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003994#line 1260 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003995 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3996 break;
3997
Dan Gohmanf4423b12008-04-19 00:24:39 +00003998 case 125:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003999#line 1261 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004000 {
4001 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
4002 ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004003 break;
4004
4005 case 126:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004006#line 1266 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004007 { (yyval.StrVal) = 0; ;}
4008 break;
4009
4010 case 127:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004011#line 1267 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004012 {
4013 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
4014 ;}
4015 break;
4016
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004017 case 128:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004018#line 1274 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004019 { (yyval.UIntVal) = 0; ;}
4020 break;
4021
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004022 case 129:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004023#line 1275 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004024 {
4025 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
4026 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004027 GEN_ERROR("Alignment must be a power of two");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004028 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004029;}
4030 break;
4031
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004032 case 130:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004033#line 1281 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004034 { (yyval.UIntVal) = 0; ;}
4035 break;
4036
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004037 case 131:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004038#line 1282 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004039 {
4040 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
4041 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Christopher Lambbf3348d2007-12-12 08:45:45 +00004042 GEN_ERROR("Alignment must be a power of two");
4043 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004044;}
4045 break;
4046
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004047 case 132:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004048#line 1291 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004049 {
4050 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
4051 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004052 GEN_ERROR("Invalid character in section name");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004053 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004054 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004055;}
4056 break;
4057
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004058 case 133:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004059#line 1299 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004060 { (yyval.StrVal) = 0; ;}
4061 break;
4062
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004063 case 134:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004064#line 1300 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004065 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
4066 break;
4067
Dan Gohmanf4423b12008-04-19 00:24:39 +00004068 case 135:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004069#line 1305 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004070 {;}
4071 break;
4072
4073 case 136:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004074#line 1306 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004075 {;}
4076 break;
4077
4078 case 137:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004079#line 1307 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004080 {
4081 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
4082 delete (yyvsp[(1) - (1)].StrVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004083 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004084 ;}
4085 break;
4086
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004087 case 138:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004088#line 1312 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004089 {
4090 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004091 GEN_ERROR("Alignment must be a power of two");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004092 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004093 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004094 ;}
4095 break;
4096
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004097 case 146:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004098#line 1328 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004099 {
4100 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004101 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004102 ;}
4103 break;
4104
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004105 case 147:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004106#line 1332 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004107 {
4108 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004109 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004110 ;}
4111 break;
4112
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004113 case 148:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004114#line 1336 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004115 { // Pointer type?
4116 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
Christopher Lambbf3348d2007-12-12 08:45:45 +00004117 GEN_ERROR("Cannot form a pointer to a basic block");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004118 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4119 delete (yyvsp[(1) - (3)].TypeVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00004120 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004121 ;}
4122 break;
4123
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004124 case 149:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004125#line 1343 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004126 { // Named types are also simple types...
4127 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00004128 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004129 (yyval.TypeVal) = new PATypeHolder(tmp);
4130 ;}
4131 break;
4132
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004133 case 150:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004134#line 1348 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004135 { // Type UpReference
4136 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004137 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Dan Gohmanf4423b12008-04-19 00:24:39 +00004138 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4139 (yyval.TypeVal) = new PATypeHolder(OT);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004140 UR_OUT("New Upreference!\n");
4141 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004142 ;}
4143 break;
4144
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004145 case 151:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004146#line 1356 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004147 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004148 // Allow but ignore attributes on function types; this permits auto-upgrade.
4149 // FIXME: remove in LLVM 3.0.
Chris Lattnera925a142008-04-23 05:37:08 +00004150 const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal);
4151 if (!FunctionType::isValidReturnType(RetTy))
4152 GEN_ERROR("Invalid result type for LLVM function");
4153
Reid Spencer41dff5e2007-01-26 08:05:27 +00004154 std::vector<const Type*> Params;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004155 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00004156 for (; I != E; ++I ) {
Reid Spencer66728ef2007-03-20 01:13:36 +00004157 const Type *Ty = I->Ty->get();
Reid Spencer66728ef2007-03-20 01:13:36 +00004158 Params.push_back(Ty);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004159 }
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004160
Reid Spencer41dff5e2007-01-26 08:05:27 +00004161 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4162 if (isVarArg) Params.pop_back();
4163
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004164 for (unsigned i = 0; i != Params.size(); ++i)
4165 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4166 GEN_ERROR("Function arguments must be value types!");
4167
4168 CHECK_FOR_ERROR
4169
Anton Korobeynikovc36284e2007-12-03 19:17:47 +00004170 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004171 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4172 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4173 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Reid Spencere4d87aa2006-12-23 06:05:41 +00004174 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004175 ;}
4176 break;
4177
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004178 case 152:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004179#line 1385 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004180 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004181 // Allow but ignore attributes on function types; this permits auto-upgrade.
4182 // FIXME: remove in LLVM 3.0.
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004183 std::vector<const Type*> Params;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004184 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00004185 for ( ; I != E; ++I ) {
Reid Spencer66728ef2007-03-20 01:13:36 +00004186 const Type* Ty = I->Ty->get();
Reid Spencer66728ef2007-03-20 01:13:36 +00004187 Params.push_back(Ty);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004188 }
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004189
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004190 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4191 if (isVarArg) Params.pop_back();
4192
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004193 for (unsigned i = 0; i != Params.size(); ++i)
4194 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4195 GEN_ERROR("Function arguments must be value types!");
4196
4197 CHECK_FOR_ERROR
4198
Dan Gohmanf4423b12008-04-19 00:24:39 +00004199 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4200 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4201 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004202 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004203 ;}
4204 break;
4205
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004206 case 153:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004207#line 1410 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004208 { // Sized array type?
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004209 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (yyvsp[(2) - (5)].UInt64Val))));
Dan Gohmanf4423b12008-04-19 00:24:39 +00004210 delete (yyvsp[(4) - (5)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004211 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004212 ;}
4213 break;
4214
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004215 case 154:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004216#line 1415 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004217 { // Vector type?
4218 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4219 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004220 GEN_ERROR("Unsigned result not equal to signed result");
4221 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4222 GEN_ERROR("Element type of a VectorType must be primitive");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004223 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4224 delete (yyvsp[(4) - (5)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004225 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004226 ;}
4227 break;
4228
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004229 case 155:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004230#line 1425 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004231 { // Structure type?
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004232 std::vector<const Type*> Elements;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004233 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4234 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004235 Elements.push_back(*I);
4236
Dan Gohmanf4423b12008-04-19 00:24:39 +00004237 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4238 delete (yyvsp[(2) - (3)].TypeList);
Reid Spencer14310612006-12-31 05:40:51 +00004239 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004240 ;}
4241 break;
4242
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004243 case 156:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004244#line 1435 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004245 { // Empty structure type?
4246 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Reid Spencer14310612006-12-31 05:40:51 +00004247 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004248 ;}
4249 break;
4250
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004251 case 157:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004252#line 1439 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004253 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004254 std::vector<const Type*> Elements;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004255 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4256 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004257 Elements.push_back(*I);
4258
Dan Gohmanf4423b12008-04-19 00:24:39 +00004259 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4260 delete (yyvsp[(3) - (5)].TypeList);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004261 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004262 ;}
4263 break;
4264
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004265 case 158:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004266#line 1449 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004267 { // Empty structure type?
4268 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004269 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004270 ;}
4271 break;
4272
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004273 case 159:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004274#line 1456 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004275 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004276 // Allow but ignore attributes on function types; this permits auto-upgrade.
4277 // FIXME: remove in LLVM 3.0.
Dan Gohmanf4423b12008-04-19 00:24:39 +00004278 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4279 (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
4280 ;}
4281 break;
4282
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004283 case 160:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004284#line 1465 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004285 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004286 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004287 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4288 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004289 GEN_ERROR("LLVM functions cannot return aggregate types");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004290 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4291 ;}
4292 break;
4293
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004294 case 161:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004295#line 1472 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004296 {
4297 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4298 ;}
4299 break;
4300
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004301 case 162:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004302#line 1477 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004303 {
4304 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4305 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
Reid Spencer3da59db2006-11-27 01:05:10 +00004306 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004307 ;}
4308 break;
4309
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004310 case 163:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004311#line 1482 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004312 {
4313 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004314 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004315 ;}
4316 break;
4317
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004318 case 165:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004319#line 1490 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004320 {
4321 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
Reid Spencer18da0722007-04-11 02:44:20 +00004322 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
Reid Spencer41dff5e2007-01-26 08:05:27 +00004323 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004324 (yyval.TypeWithAttrsList)->push_back(TWA);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004325 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004326 ;}
4327 break;
4328
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004329 case 166:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004330#line 1497 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004331 {
4332 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004333 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4334 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004335 (yyval.TypeWithAttrsList)->push_back(TWA);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004336 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004337 ;}
4338 break;
4339
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004340 case 167:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004341#line 1504 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004342 {
4343 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004344 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004345 ;}
4346 break;
4347
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004348 case 168:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004349#line 1512 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004350 {
4351 (yyval.TypeList) = new std::list<PATypeHolder>();
4352 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4353 delete (yyvsp[(1) - (1)].TypeVal);
Reid Spencer3da59db2006-11-27 01:05:10 +00004354 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004355 ;}
4356 break;
4357
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004358 case 169:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004359#line 1518 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004360 {
4361 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4362 delete (yyvsp[(3) - (3)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004363 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004364 ;}
4365 break;
4366
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004367 case 170:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004368#line 1530 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004369 { // Nonempty unsized arr
Reid Spencer14310612006-12-31 05:40:51 +00004370 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004371 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4372 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004373 if (ATy == 0)
Reid Spencer61c83e02006-08-18 08:43:06 +00004374 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004375 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004376 const Type *ETy = ATy->getElementType();
4377 int NumElements = ATy->getNumElements();
4378
4379 // Verify that we have the correct size...
Dan Gohmanf4423b12008-04-19 00:24:39 +00004380 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004381 GEN_ERROR("Type mismatch: constant sized array initialized with " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004382 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Reid Spencerb5334b02007-02-05 10:18:06 +00004383 itostr(NumElements) + "");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004384
4385 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004386 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4387 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004388 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4389 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohmanf4423b12008-04-19 00:24:39 +00004390 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004391 }
4392
Dan Gohmanf4423b12008-04-19 00:24:39 +00004393 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4394 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004395 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004396 ;}
4397 break;
4398
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004399 case 171:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004400#line 1558 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004401 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004402 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004403 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4404 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004405 if (ATy == 0)
4406 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004407 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004408
Andrew Lenharth6353e052006-12-08 18:07:09 +00004409 int NumElements = ATy->getNumElements();
4410 if (NumElements != -1 && NumElements != 0)
4411 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
Reid Spencerb5334b02007-02-05 10:18:06 +00004412 " arguments, but has size of " + itostr(NumElements) +"");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004413 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4414 delete (yyvsp[(1) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00004415 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004416 ;}
4417 break;
4418
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004419 case 172:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004420#line 1574 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004421 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004422 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004423 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4424 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004425 if (ATy == 0)
4426 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004427 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004428
4429 int NumElements = ATy->getNumElements();
4430 const Type *ETy = ATy->getElementType();
Dan Gohmanf4423b12008-04-19 00:24:39 +00004431 if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004432 GEN_ERROR("Can't build string constant of size " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004433 itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) +
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004434 " when array has size " + itostr(NumElements) + "");
4435 std::vector<Constant*> Vals;
4436 if (ETy == Type::Int8Ty) {
Dan Gohmanf4423b12008-04-19 00:24:39 +00004437 for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
4438 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004439 } else {
Dan Gohmanf4423b12008-04-19 00:24:39 +00004440 delete (yyvsp[(3) - (3)].StrVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004441 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4442 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004443 delete (yyvsp[(3) - (3)].StrVal);
4444 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4445 delete (yyvsp[(1) - (3)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004446 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004447 ;}
4448 break;
4449
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004450 case 173:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004451#line 1601 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004452 { // Nonempty unsized arr
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004453 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004454 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4455 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004456 if (PTy == 0)
4457 GEN_ERROR("Cannot make packed constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004458 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004459 const Type *ETy = PTy->getElementType();
4460 int NumElements = PTy->getNumElements();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004461
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004462 // Verify that we have the correct size...
Dan Gohmanf4423b12008-04-19 00:24:39 +00004463 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004464 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004465 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Reid Spencerb5334b02007-02-05 10:18:06 +00004466 itostr(NumElements) + "");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004467
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004468 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004469 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4470 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004471 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4472 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohmanf4423b12008-04-19 00:24:39 +00004473 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004474 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00004475
Dan Gohmanf4423b12008-04-19 00:24:39 +00004476 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4477 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004478 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004479 ;}
4480 break;
4481
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004482 case 174:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004483#line 1629 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004484 {
4485 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004486 if (STy == 0)
4487 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004488 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004489
Dan Gohmanf4423b12008-04-19 00:24:39 +00004490 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004491 GEN_ERROR("Illegal number of initializers for structure type");
4492
4493 // Check to ensure that constants are compatible with the type initializer!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004494 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4495 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004496 GEN_ERROR("Expected type '" +
4497 STy->getElementType(i)->getDescription() +
4498 "' for element #" + utostr(i) +
4499 " of structure initializer");
4500
4501 // Check to ensure that Type is not packed
4502 if (STy->isPacked())
4503 GEN_ERROR("Unpacked Initializer to vector type '" +
4504 STy->getDescription() + "'");
4505
Dan Gohmanf4423b12008-04-19 00:24:39 +00004506 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4507 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004508 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004509 ;}
4510 break;
4511
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004512 case 175:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004513#line 1655 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004514 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004515 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004516 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4517 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004518 if (STy == 0)
4519 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004520 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004521
4522 if (STy->getNumContainedTypes() != 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00004523 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004524
4525 // Check to ensure that Type is not packed
4526 if (STy->isPacked())
Chris Lattner6cdc6822007-04-26 05:31:05 +00004527 GEN_ERROR("Unpacked Initializer to vector type '" +
4528 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004529
Dan Gohmanf4423b12008-04-19 00:24:39 +00004530 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4531 delete (yyvsp[(1) - (3)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004532 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004533 ;}
4534 break;
4535
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004536 case 176:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004537#line 1675 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004538 {
4539 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004540 if (STy == 0)
4541 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004542 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004543
Dan Gohmanf4423b12008-04-19 00:24:39 +00004544 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
Reid Spencerb5334b02007-02-05 10:18:06 +00004545 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004546
4547 // Check to ensure that constants are compatible with the type initializer!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004548 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4549 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
Reid Spencer41dff5e2007-01-26 08:05:27 +00004550 GEN_ERROR("Expected type '" +
4551 STy->getElementType(i)->getDescription() +
4552 "' for element #" + utostr(i) +
Reid Spencerb5334b02007-02-05 10:18:06 +00004553 " of structure initializer");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004554
4555 // Check to ensure that Type is packed
4556 if (!STy->isPacked())
Chris Lattner32980692007-02-19 07:44:24 +00004557 GEN_ERROR("Vector initializer to non-vector type '" +
4558 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004559
Dan Gohmanf4423b12008-04-19 00:24:39 +00004560 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4561 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004562 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004563 ;}
4564 break;
4565
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004566 case 177:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004567#line 1701 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004568 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004569 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004570 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4571 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004572 if (STy == 0)
4573 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004574 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004575
4576 if (STy->getNumContainedTypes() != 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00004577 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004578
4579 // Check to ensure that Type is packed
4580 if (!STy->isPacked())
Chris Lattner32980692007-02-19 07:44:24 +00004581 GEN_ERROR("Vector initializer to non-vector type '" +
4582 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004583
Dan Gohmanf4423b12008-04-19 00:24:39 +00004584 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4585 delete (yyvsp[(1) - (5)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004586 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004587 ;}
4588 break;
4589
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004590 case 178:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004591#line 1721 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004592 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004593 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004594 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4595 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004596 if (PTy == 0)
4597 GEN_ERROR("Cannot make null pointer constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004598 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004599
Dan Gohmanf4423b12008-04-19 00:24:39 +00004600 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4601 delete (yyvsp[(1) - (2)].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004602 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004603 ;}
4604 break;
4605
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004606 case 179:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004607#line 1733 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004608 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004609 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004610 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4611 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4612 delete (yyvsp[(1) - (2)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004613 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004614 ;}
4615 break;
4616
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004617 case 180:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004618#line 1740 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004619 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004620 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004621 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4622 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004623 if (Ty == 0)
Dan Gohmanf4423b12008-04-19 00:24:39 +00004624 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004625
4626 // ConstExprs can exist in the body of a function, thus creating
4627 // GlobalValues whenever they refer to a variable. Because we are in
Reid Spencer93c40032007-03-19 18:40:50 +00004628 // the context of a function, getExistingVal will search the functions
Reid Spencer68a24bd2005-08-27 18:50:39 +00004629 // symbol table instead of the module symbol table for the global symbol,
4630 // which throws things all off. To get around this, we just tell
Reid Spencer93c40032007-03-19 18:40:50 +00004631 // getExistingVal that we are at global scope here.
Reid Spencer68a24bd2005-08-27 18:50:39 +00004632 //
4633 Function *SavedCurFn = CurFun.CurrentFunction;
4634 CurFun.CurrentFunction = 0;
4635
Dan Gohmanf4423b12008-04-19 00:24:39 +00004636 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00004637 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00004638
4639 CurFun.CurrentFunction = SavedCurFn;
4640
4641 // If this is an initializer for a constant pointer, which is referencing a
4642 // (currently) undefined variable, create a stub now that shall be replaced
4643 // in the future with the right type of variable.
4644 //
4645 if (V == 0) {
Reid Spencera9720f52007-02-05 17:04:00 +00004646 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004647 const PointerType *PT = cast<PointerType>(Ty);
4648
4649 // First check to see if the forward references value is already created!
4650 PerModuleInfo::GlobalRefsType::iterator I =
Dan Gohmanf4423b12008-04-19 00:24:39 +00004651 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004652
4653 if (I != CurModule.GlobalRefs.end()) {
4654 V = I->second; // Placeholder already exists, use it...
Dan Gohmanf4423b12008-04-19 00:24:39 +00004655 (yyvsp[(2) - (2)].ValIDVal).destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +00004656 } else {
4657 std::string Name;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004658 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4659 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4660 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
Reid Spencer41dff5e2007-01-26 08:05:27 +00004661 GEN_ERROR("Invalid reference to global");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004662
4663 // Create the forward referenced global.
4664 GlobalValue *GV;
4665 if (const FunctionType *FTy =
4666 dyn_cast<FunctionType>(PT->getElementType())) {
Gabor Greife64d2482008-04-06 23:07:54 +00004667 GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
4668 CurModule.CurrentModule);
Reid Spencer68a24bd2005-08-27 18:50:39 +00004669 } else {
4670 GV = new GlobalVariable(PT->getElementType(), false,
Chris Lattner6cdc6822007-04-26 05:31:05 +00004671 GlobalValue::ExternalWeakLinkage, 0,
Reid Spencer68a24bd2005-08-27 18:50:39 +00004672 Name, CurModule.CurrentModule);
4673 }
4674
4675 // Keep track of the fact that we have a forward ref to recycle it
Dan Gohmanf4423b12008-04-19 00:24:39 +00004676 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004677 V = GV;
4678 }
4679 }
4680
Dan Gohmanf4423b12008-04-19 00:24:39 +00004681 (yyval.ConstVal) = cast<GlobalValue>(V);
4682 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
Reid Spencer61c83e02006-08-18 08:43:06 +00004683 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004684 ;}
4685 break;
4686
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004687 case 181:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004688#line 1806 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004689 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004690 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004691 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4692 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004693 GEN_ERROR("Mismatched types for constant expression: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004694 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4695 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4696 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004697 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004698 ;}
4699 break;
4700
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004701 case 182:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004702#line 1816 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004703 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004704 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004705 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4706 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004707 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4708 GEN_ERROR("Cannot create a null initialized value of this type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004709 (yyval.ConstVal) = Constant::getNullValue(Ty);
4710 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004711 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004712 ;}
4713 break;
4714
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004715 case 183:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004716#line 1826 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004717 { // integral constants
4718 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004719 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004720 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
Reid Spencer38c91a92007-02-28 02:24:54 +00004721 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004722 ;}
4723 break;
4724
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004725 case 184:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004726#line 1832 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004727 { // arbitrary precision integer constants
4728 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4729 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004730 GEN_ERROR("Constant value does not fit in type");
4731 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004732 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4733 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4734 delete (yyvsp[(2) - (2)].APIntVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004735 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004736 ;}
4737 break;
4738
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004739 case 185:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004740#line 1842 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004741 { // integral constants
4742 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004743 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004744 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004745 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004746 ;}
4747 break;
4748
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004749 case 186:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004750#line 1848 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004751 { // arbitrary precision integer constants
4752 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4753 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004754 GEN_ERROR("Constant value does not fit in type");
4755 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004756 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4757 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4758 delete (yyvsp[(2) - (2)].APIntVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004759 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004760 ;}
4761 break;
4762
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004763 case 187:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004764#line 1858 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004765 { // Boolean constants
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004766 if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1)
4767 GEN_ERROR("Constant true must have type i1");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004768 (yyval.ConstVal) = ConstantInt::getTrue();
Reid Spencer38c91a92007-02-28 02:24:54 +00004769 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004770 ;}
4771 break;
4772
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004773 case 188:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004774#line 1864 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004775 { // Boolean constants
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004776 if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1)
4777 GEN_ERROR("Constant false must have type i1");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004778 (yyval.ConstVal) = ConstantInt::getFalse();
Reid Spencer6f407902007-01-13 05:00:46 +00004779 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004780 ;}
4781 break;
4782
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004783 case 189:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004784#line 1870 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004785 { // Floating point constants
4786 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004787 GEN_ERROR("Floating point constant invalid for type");
Dale Johannesenc72cd7e2007-09-11 18:33:39 +00004788 // Lexer has no type info, so builds all float and double FP constants
4789 // as double. Fix this here. Long double is done right.
Dan Gohmanf4423b12008-04-19 00:24:39 +00004790 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4791 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
Chris Lattnerd8eb63f2008-04-20 00:41:19 +00004792 (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal));
Dan Gohmanf4423b12008-04-19 00:24:39 +00004793 delete (yyvsp[(2) - (2)].FPVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004794 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004795 ;}
4796 break;
4797
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004798 case 190:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004799#line 1883 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004800 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004801 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004802 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4803 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4804 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4805 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004806 GEN_ERROR("invalid cast opcode for cast from '" +
4807 Val->getType()->getDescription() + "' to '" +
4808 DestTy->getDescription() + "'");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004809 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4810 delete (yyvsp[(5) - (6)].TypeVal);
4811 ;}
4812 break;
4813
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004814 case 191:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004815#line 1895 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004816 {
4817 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
Reid Spencerb5334b02007-02-05 10:18:06 +00004818 GEN_ERROR("GetElementPtr requires a pointer operand");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004819
4820 const Type *IdxTy =
Dan Gohman041e2eb2008-05-15 19:50:34 +00004821 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004822 if (!IdxTy)
Reid Spencerb5334b02007-02-05 10:18:06 +00004823 GEN_ERROR("Index list invalid for constant getelementptr");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004824
Chris Lattnerf7469af2007-01-31 04:44:08 +00004825 SmallVector<Constant*, 8> IdxVec;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004826 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4827 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004828 IdxVec.push_back(C);
4829 else
Reid Spencerb5334b02007-02-05 10:18:06 +00004830 GEN_ERROR("Indices to constant getelementptr must be constants");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004831
Dan Gohmanf4423b12008-04-19 00:24:39 +00004832 delete (yyvsp[(4) - (5)].ValueList);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004833
Dan Gohmanf4423b12008-04-19 00:24:39 +00004834 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
Andrew Lenharth6353e052006-12-08 18:07:09 +00004835 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004836 ;}
4837 break;
4838
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004839 case 192:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004840#line 1916 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004841 {
4842 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004843 GEN_ERROR("Select condition must be of boolean type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004844 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004845 GEN_ERROR("Select operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004846 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004847 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004848 ;}
4849 break;
4850
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004851 case 193:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004852#line 1924 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004853 {
4854 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004855 GEN_ERROR("Binary operator types must match");
4856 CHECK_FOR_ERROR;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004857 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4858 ;}
4859 break;
4860
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004861 case 194:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004862#line 1930 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004863 {
4864 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004865 GEN_ERROR("Logical operator types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004866 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
4867 if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
4868 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004869 GEN_ERROR("Logical operator requires integral operands");
4870 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004871 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004872 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004873 ;}
4874 break;
4875
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004876 case 195:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004877#line 1941 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004878 {
4879 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004880 GEN_ERROR("icmp operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004881 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4882 ;}
4883 break;
4884
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004885 case 196:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004886#line 1946 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004887 {
4888 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004889 GEN_ERROR("fcmp operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004890 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4891 ;}
4892 break;
4893
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004894 case 197:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004895#line 1951 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00004896 {
4897 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4898 GEN_ERROR("vicmp operand types must match");
4899 (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4900 ;}
4901 break;
4902
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004903 case 198:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004904#line 1956 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00004905 {
4906 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4907 GEN_ERROR("vfcmp operand types must match");
4908 (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4909 ;}
4910 break;
4911
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004912 case 199:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004913#line 1961 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004914 {
4915 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004916 GEN_ERROR("Invalid extractelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004917 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004918 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004919 ;}
4920 break;
4921
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004922 case 200:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004923#line 1967 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004924 {
4925 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004926 GEN_ERROR("Invalid insertelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004927 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004928 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004929 ;}
4930 break;
4931
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004932 case 201:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004933#line 1973 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004934 {
4935 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004936 GEN_ERROR("Invalid shufflevector operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004937 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004938 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004939 ;}
4940 break;
4941
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004942 case 202:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004943#line 1979 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00004944 {
4945 if (!isa<StructType>((yyvsp[(3) - (5)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (5)].ConstVal)->getType()))
4946 GEN_ERROR("ExtractValue requires an aggregate operand");
4947
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004948 (yyval.ConstVal) = ConstantExpr::getExtractValue((yyvsp[(3) - (5)].ConstVal), &(*(yyvsp[(4) - (5)].ConstantList))[0], (yyvsp[(4) - (5)].ConstantList)->size());
4949 delete (yyvsp[(4) - (5)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00004950 CHECK_FOR_ERROR
4951 ;}
4952 break;
4953
4954 case 203:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004955#line 1987 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00004956 {
4957 if (!isa<StructType>((yyvsp[(3) - (7)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (7)].ConstVal)->getType()))
4958 GEN_ERROR("InsertValue requires an aggregate operand");
4959
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004960 (yyval.ConstVal) = ConstantExpr::getInsertValue((yyvsp[(3) - (7)].ConstVal), (yyvsp[(5) - (7)].ConstVal), &(*(yyvsp[(6) - (7)].ConstantList))[0], (yyvsp[(6) - (7)].ConstantList)->size());
4961 delete (yyvsp[(6) - (7)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00004962 CHECK_FOR_ERROR
4963 ;}
4964 break;
4965
4966 case 204:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004967#line 1998 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004968 {
4969 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004970 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004971 ;}
4972 break;
4973
Dan Gohmane4977cf2008-05-23 01:55:30 +00004974 case 205:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004975#line 2002 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004976 {
4977 (yyval.ConstVector) = new std::vector<Constant*>();
4978 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004979 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004980 ;}
4981 break;
4982
Nate Begemanac80ade2008-05-12 19:01:56 +00004983 case 206:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004984#line 2010 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00004985 { (yyval.BoolVal) = false; ;}
Nate Begemanac80ade2008-05-12 19:01:56 +00004986 break;
4987
4988 case 207:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004989#line 2010 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00004990 { (yyval.BoolVal) = true; ;}
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004991 break;
4992
4993 case 208:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004994#line 2013 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00004995 { (yyval.BoolVal) = true; ;}
4996 break;
4997
4998 case 209:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004999#line 2013 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005000 { (yyval.BoolVal) = false; ;}
5001 break;
5002
5003 case 210:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005004#line 2016 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005005 {
5006 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
5007 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
Chris Lattner0275cff2007-08-06 21:00:46 +00005008 CHECK_FOR_ERROR
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005009 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
5010 if (!Aliasee)
5011 GEN_ERROR("Aliases can be created only to global values");
5012
Dan Gohmanf4423b12008-04-19 00:24:39 +00005013 (yyval.ConstVal) = Aliasee;
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005014 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005015 delete (yyvsp[(1) - (2)].TypeVal);
5016 ;}
5017 break;
5018
Dan Gohmane4977cf2008-05-23 01:55:30 +00005019 case 211:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005020#line 2028 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005021 {
5022 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
5023 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
5024 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005025 GEN_ERROR("invalid cast opcode for cast from '" +
5026 Val->getType()->getDescription() + "' to '" +
5027 DestTy->getDescription() + "'");
5028
Dan Gohmanf4423b12008-04-19 00:24:39 +00005029 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005030 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005031 delete (yyvsp[(5) - (6)].TypeVal);
5032 ;}
5033 break;
5034
Dan Gohmane4977cf2008-05-23 01:55:30 +00005035 case 212:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005036#line 2049 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005037 {
5038 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
Dale Johannesen172f3112008-02-20 21:15:43 +00005039 CurModule.ModuleDone();
5040 CHECK_FOR_ERROR;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005041 ;}
5042 break;
5043
Dan Gohmane4977cf2008-05-23 01:55:30 +00005044 case 213:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005045#line 2054 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005046 {
5047 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5048 CurModule.ModuleDone();
5049 CHECK_FOR_ERROR;
5050 ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00005051 break;
5052
Dan Gohmane4977cf2008-05-23 01:55:30 +00005053 case 216:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005054#line 2067 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005055 { CurFun.isDeclare = false; ;}
5056 break;
5057
Dan Gohmane4977cf2008-05-23 01:55:30 +00005058 case 217:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005059#line 2067 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005060 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005061 CurFun.FunctionDone();
5062 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005063 ;}
5064 break;
5065
Dan Gohmane4977cf2008-05-23 01:55:30 +00005066 case 218:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005067#line 2071 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005068 { CurFun.isDeclare = true; ;}
5069 break;
5070
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005071 case 219:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005072#line 2071 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005073 {
5074 CHECK_FOR_ERROR
5075 ;}
5076 break;
5077
5078 case 220:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005079#line 2074 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005080 {
5081 CHECK_FOR_ERROR
5082 ;}
5083 break;
5084
5085 case 221:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005086#line 2077 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005087 {
Reid Spencer14310612006-12-31 05:40:51 +00005088 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005089 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005090 // Eagerly resolve types. This is not an optimization, this is a
5091 // requirement that is due to the fact that we could have this:
5092 //
5093 // %list = type { %list * }
5094 // %list = type { %list * } ; repeated type decl
5095 //
5096 // If types are not resolved eagerly, then the two types will not be
5097 // determined to be the same type!
5098 //
Dan Gohmanf4423b12008-04-19 00:24:39 +00005099 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005100
Dan Gohmanf4423b12008-04-19 00:24:39 +00005101 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Reid Spencer5b7e7532006-09-28 19:28:24 +00005102 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005103 // If this is a named type that is not a redefinition, add it to the slot
5104 // table.
Dan Gohmanf4423b12008-04-19 00:24:39 +00005105 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005106 }
Reid Spencera132e042006-12-03 05:46:11 +00005107
Dan Gohmanf4423b12008-04-19 00:24:39 +00005108 delete (yyvsp[(3) - (3)].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005109 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005110 ;}
5111 break;
Reid Spencerb8f85052007-07-31 03:50:36 +00005112
Dan Gohmane4977cf2008-05-23 01:55:30 +00005113 case 222:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005114#line 2101 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005115 {
5116 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
5117
5118 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005119 CHECK_FOR_ERROR
5120 // If this is a named type that is not a redefinition, add it to the slot
5121 // table.
Dan Gohmanf4423b12008-04-19 00:24:39 +00005122 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005123 }
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005124 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005125 ;}
5126 break;
5127
Dan Gohmane4977cf2008-05-23 01:55:30 +00005128 case 223:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005129#line 2113 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005130 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005131 /* "Externally Visible" Linkage */
Dan Gohmanf4423b12008-04-19 00:24:39 +00005132 if ((yyvsp[(5) - (6)].ConstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005133 GEN_ERROR("Global value initializer is not a constant");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005134 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5135 (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 +00005136 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005137 ;}
5138 break;
5139
Dan Gohmane4977cf2008-05-23 01:55:30 +00005140 case 224:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005141#line 2120 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005142 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005143 CurGV = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005144 ;}
5145 break;
5146
Dan Gohmane4977cf2008-05-23 01:55:30 +00005147 case 225:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005148#line 2124 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005149 {
5150 if ((yyvsp[(6) - (7)].ConstVal) == 0)
Christopher Lambbf3348d2007-12-12 08:45:45 +00005151 GEN_ERROR("Global value initializer is not a constant");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005152 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 +00005153 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005154 ;}
5155 break;
5156
Dan Gohmane4977cf2008-05-23 01:55:30 +00005157 case 226:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005158#line 2129 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005159 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005160 CurGV = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005161 ;}
5162 break;
5163
Dan Gohmane4977cf2008-05-23 01:55:30 +00005164 case 227:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005165#line 2133 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005166 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005167 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005168 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5169 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 +00005170 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005171 delete (yyvsp[(6) - (7)].TypeVal);
5172 ;}
5173 break;
5174
Dan Gohmane4977cf2008-05-23 01:55:30 +00005175 case 228:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005176#line 2139 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005177 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005178 CurGV = 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +00005179 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005180 ;}
5181 break;
5182
Dan Gohmane4977cf2008-05-23 01:55:30 +00005183 case 229:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005184#line 2143 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005185 {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005186 std::string Name;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005187 if ((yyvsp[(1) - (5)].StrVal)) {
5188 Name = *(yyvsp[(1) - (5)].StrVal);
5189 delete (yyvsp[(1) - (5)].StrVal);
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005190 }
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005191 if (Name.empty())
5192 GEN_ERROR("Alias name cannot be empty");
5193
Dan Gohmanf4423b12008-04-19 00:24:39 +00005194 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005195 if (Aliasee == 0)
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005196 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005197
Dan Gohmanf4423b12008-04-19 00:24:39 +00005198 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005199 CurModule.CurrentModule);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005200 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005201 InsertValue(GA, CurModule.Values);
Chris Lattner569f7372007-09-10 23:24:14 +00005202
5203
5204 // If there was a forward reference of this alias, resolve it now.
5205
5206 ValID ID;
5207 if (!Name.empty())
5208 ID = ValID::createGlobalName(Name);
5209 else
5210 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5211
5212 if (GlobalValue *FWGV =
5213 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5214 // Replace uses of the fwdref with the actual alias.
5215 FWGV->replaceAllUsesWith(GA);
5216 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5217 GV->eraseFromParent();
5218 else
5219 cast<Function>(FWGV)->eraseFromParent();
5220 }
5221 ID.destroy();
5222
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005223 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005224 ;}
5225 break;
5226
Dan Gohmane4977cf2008-05-23 01:55:30 +00005227 case 230:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005228#line 2183 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005229 {
Anton Korobeynikov77d0f972007-04-25 14:29:12 +00005230 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005231 ;}
5232 break;
5233
Dan Gohmane4977cf2008-05-23 01:55:30 +00005234 case 231:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005235#line 2186 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005236 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005237 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005238 ;}
5239 break;
5240
Dan Gohmane4977cf2008-05-23 01:55:30 +00005241 case 232:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005242#line 2192 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005243 {
Chris Lattner66316012006-01-24 04:14:29 +00005244 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
Chris Lattner66316012006-01-24 04:14:29 +00005245 if (AsmSoFar.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005246 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
Chris Lattner66316012006-01-24 04:14:29 +00005247 else
Dan Gohmanf4423b12008-04-19 00:24:39 +00005248 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5249 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00005250 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005251;}
5252 break;
5253
Dan Gohmane4977cf2008-05-23 01:55:30 +00005254 case 233:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005255#line 2202 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005256 {
5257 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5258 delete (yyvsp[(3) - (3)].StrVal);
5259 ;}
5260 break;
5261
Dan Gohmane4977cf2008-05-23 01:55:30 +00005262 case 234:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005263#line 2206 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005264 {
5265 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5266 delete (yyvsp[(3) - (3)].StrVal);
5267 ;}
5268 break;
5269
Dan Gohmane4977cf2008-05-23 01:55:30 +00005270 case 236:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005271#line 2213 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005272 {
5273 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5274 delete (yyvsp[(3) - (3)].StrVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00005275 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005276 ;}
5277 break;
5278
Dan Gohmane4977cf2008-05-23 01:55:30 +00005279 case 237:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005280#line 2218 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005281 {
5282 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5283 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer1013b4d2007-07-31 14:41:17 +00005284 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005285 ;}
5286 break;
5287
Dan Gohmane4977cf2008-05-23 01:55:30 +00005288 case 238:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005289#line 2223 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005290 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005291 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005292 ;}
5293 break;
5294
Dan Gohmane4977cf2008-05-23 01:55:30 +00005295 case 239:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005296#line 2232 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005297 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005298 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005299 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005300 if (!(*(yyvsp[(3) - (5)].TypeVal))->isFirstClassType())
5301 GEN_ERROR("Argument types must be first-class");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005302 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5303 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5304 (yyvsp[(1) - (5)].ArgList)->push_back(E);
Reid Spencer6f407902007-01-13 05:00:46 +00005305 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005306 ;}
5307 break;
5308
Dan Gohmane4977cf2008-05-23 01:55:30 +00005309 case 240:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005310#line 2242 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005311 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005312 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005313 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005314 if (!(*(yyvsp[(1) - (3)].TypeVal))->isFirstClassType())
5315 GEN_ERROR("Argument types must be first-class");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005316 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5317 (yyval.ArgList) = new ArgListType;
5318 (yyval.ArgList)->push_back(E);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005319 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005320 ;}
5321 break;
5322
Dan Gohmane4977cf2008-05-23 01:55:30 +00005323 case 241:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005324#line 2253 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005325 {
5326 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005327 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005328 ;}
5329 break;
5330
Dan Gohmane4977cf2008-05-23 01:55:30 +00005331 case 242:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005332#line 2257 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005333 {
5334 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005335 struct ArgListEntry E;
5336 E.Ty = new PATypeHolder(Type::VoidTy);
5337 E.Name = 0;
Reid Spencer18da0722007-04-11 02:44:20 +00005338 E.Attrs = ParamAttr::None;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005339 (yyval.ArgList)->push_back(E);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005340 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005341 ;}
5342 break;
5343
Dan Gohmane4977cf2008-05-23 01:55:30 +00005344 case 243:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005345#line 2266 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005346 {
5347 (yyval.ArgList) = new ArgListType;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005348 struct ArgListEntry E;
5349 E.Ty = new PATypeHolder(Type::VoidTy);
5350 E.Name = 0;
5351 E.Attrs = ParamAttr::None;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005352 (yyval.ArgList)->push_back(E);
Reid Spencer61c83e02006-08-18 08:43:06 +00005353 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005354 ;}
5355 break;
5356
Dan Gohmane4977cf2008-05-23 01:55:30 +00005357 case 244:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005358#line 2275 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005359 {
5360 (yyval.ArgList) = 0;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005361 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005362 ;}
5363 break;
5364
Dan Gohmane4977cf2008-05-23 01:55:30 +00005365 case 245:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005366#line 2281 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005367 {
5368 std::string FunctionName(*(yyvsp[(3) - (10)].StrVal));
5369 delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory!
Reid Spencer68a24bd2005-08-27 18:50:39 +00005370
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005371 // Check the function result for abstractness if this is a define. We should
5372 // have no abstract types at this point
Dan Gohmanf4423b12008-04-19 00:24:39 +00005373 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal)))
5374 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription());
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005375
Chris Lattnera925a142008-04-23 05:37:08 +00005376 if (!FunctionType::isValidReturnType(*(yyvsp[(2) - (10)].TypeVal)))
5377 GEN_ERROR("Invalid result type for LLVM function");
5378
Reid Spencer68a24bd2005-08-27 18:50:39 +00005379 std::vector<const Type*> ParamTypeList;
Chris Lattner58d74912008-03-12 17:45:29 +00005380 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005381 if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None)
5382 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(7) - (10)].ParamAttrs)));
5383 if ((yyvsp[(5) - (10)].ArgList)) { // If there are arguments...
Reid Spencer7b5d4662007-04-09 06:16:21 +00005384 unsigned index = 1;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005385 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); I != (yyvsp[(5) - (10)].ArgList)->end(); ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00005386 const Type* Ty = I->Ty->get();
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005387 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5388 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
Reid Spencer14310612006-12-31 05:40:51 +00005389 ParamTypeList.push_back(Ty);
Chris Lattner58d74912008-03-12 17:45:29 +00005390 if (Ty != Type::VoidTy && I->Attrs != ParamAttr::None)
5391 Attrs.push_back(ParamAttrsWithIndex::get(index, I->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00005392 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005393 }
5394
5395 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5396 if (isVarArg) ParamTypeList.pop_back();
5397
Chris Lattner58d74912008-03-12 17:45:29 +00005398 PAListPtr PAL;
Christopher Lamb5c104242007-04-22 20:09:11 +00005399 if (!Attrs.empty())
Chris Lattner58d74912008-03-12 17:45:29 +00005400 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Reid Spencer7b5d4662007-04-09 06:16:21 +00005401
Dan Gohmanf4423b12008-04-19 00:24:39 +00005402 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00005403 const PointerType *PFT = PointerType::getUnqual(FT);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005404 delete (yyvsp[(2) - (10)].TypeVal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005405
5406 ValID ID;
5407 if (!FunctionName.empty()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005408 ID = ValID::createGlobalName((char*)FunctionName.c_str());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005409 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00005410 ID = ValID::createGlobalID(CurModule.Values.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005411 }
5412
5413 Function *Fn = 0;
5414 // See if this function was forward referenced. If so, recycle the object.
5415 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5416 // Move the function to the end of the list, from whereever it was
5417 // previously inserted.
5418 Fn = cast<Function>(FWRef);
Chris Lattner58d74912008-03-12 17:45:29 +00005419 assert(Fn->getParamAttrs().isEmpty() &&
5420 "Forward reference has parameter attributes!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005421 CurModule.CurrentModule->getFunctionList().remove(Fn);
5422 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5423 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
Reid Spenceref9b9a72007-02-05 20:47:22 +00005424 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
Duncan Sandsdc024672007-11-27 13:23:08 +00005425 if (Fn->getFunctionType() != FT ) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00005426 // The existing function doesn't have the same type. This is an overload
5427 // error.
5428 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Duncan Sandsdc024672007-11-27 13:23:08 +00005429 } else if (Fn->getParamAttrs() != PAL) {
5430 // The existing function doesn't have the same parameter attributes.
5431 // This is an overload error.
5432 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Reid Spenceref9b9a72007-02-05 20:47:22 +00005433 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
Chris Lattner6cdc6822007-04-26 05:31:05 +00005434 // Neither the existing or the current function is a declaration and they
5435 // have the same name and same type. Clearly this is a redefinition.
5436 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
Duncan Sandsdc024672007-11-27 13:23:08 +00005437 } else if (Fn->isDeclaration()) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00005438 // Make sure to strip off any argument names so we can't get conflicts.
Reid Spencer68a24bd2005-08-27 18:50:39 +00005439 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5440 AI != AE; ++AI)
5441 AI->setName("");
Reid Spenceref9b9a72007-02-05 20:47:22 +00005442 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005443 } else { // Not already defined?
Gabor Greife64d2482008-04-06 23:07:54 +00005444 Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5445 CurModule.CurrentModule);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005446 InsertValue(Fn, CurModule.Values);
5447 }
5448
5449 CurFun.FunctionStart(Fn);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00005450
5451 if (CurFun.isDeclare) {
5452 // If we have declaration, always overwrite linkage. This will allow us to
5453 // correctly handle cases, when pointer to function is passed as argument to
5454 // another function.
5455 Fn->setLinkage(CurFun.Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005456 Fn->setVisibility(CurFun.Visibility);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00005457 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00005458 Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal));
Duncan Sandsdc024672007-11-27 13:23:08 +00005459 Fn->setParamAttrs(PAL);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005460 Fn->setAlignment((yyvsp[(9) - (10)].UIntVal));
5461 if ((yyvsp[(8) - (10)].StrVal)) {
5462 Fn->setSection(*(yyvsp[(8) - (10)].StrVal));
5463 delete (yyvsp[(8) - (10)].StrVal);
Gordon Henriksen80a75bf2007-12-10 03:18:06 +00005464 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00005465 if ((yyvsp[(10) - (10)].StrVal)) {
5466 Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str());
5467 delete (yyvsp[(10) - (10)].StrVal);
Chris Lattnere869eef2005-11-12 00:11:49 +00005468 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005469
5470 // Add all of the arguments we parsed to the function...
Dan Gohmanf4423b12008-04-19 00:24:39 +00005471 if ((yyvsp[(5) - (10)].ArgList)) { // Is null if empty...
Reid Spencer68a24bd2005-08-27 18:50:39 +00005472 if (isVarArg) { // Nuke the last entry
Dan Gohmanf4423b12008-04-19 00:24:39 +00005473 assert((yyvsp[(5) - (10)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (10)].ArgList)->back().Name == 0 &&
Reid Spencera9720f52007-02-05 17:04:00 +00005474 "Not a varargs marker!");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005475 delete (yyvsp[(5) - (10)].ArgList)->back().Ty;
5476 (yyvsp[(5) - (10)].ArgList)->pop_back(); // Delete the last entry
Reid Spencer68a24bd2005-08-27 18:50:39 +00005477 }
5478 Function::arg_iterator ArgIt = Fn->arg_begin();
Reid Spenceref9b9a72007-02-05 20:47:22 +00005479 Function::arg_iterator ArgEnd = Fn->arg_end();
Reid Spencer14310612006-12-31 05:40:51 +00005480 unsigned Idx = 1;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005481 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin();
5482 I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
Reid Spencer14310612006-12-31 05:40:51 +00005483 delete I->Ty; // Delete the typeholder...
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005484 setValueName(ArgIt, I->Name); // Insert arg into symtab...
Reid Spencer5b7e7532006-09-28 19:28:24 +00005485 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005486 InsertValue(ArgIt);
Reid Spencer14310612006-12-31 05:40:51 +00005487 Idx++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005488 }
Reid Spencera132e042006-12-03 05:46:11 +00005489
Dan Gohmanf4423b12008-04-19 00:24:39 +00005490 delete (yyvsp[(5) - (10)].ArgList); // We're now done with the argument list
Reid Spencer68a24bd2005-08-27 18:50:39 +00005491 }
Reid Spencer61c83e02006-08-18 08:43:06 +00005492 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005493;}
5494 break;
5495
Dan Gohmane4977cf2008-05-23 01:55:30 +00005496 case 248:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005497#line 2411 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005498 {
5499 (yyval.FunctionVal) = CurFun.CurrentFunction;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005500
5501 // Make sure that we keep track of the linkage type even if there was a
5502 // previous "declare".
Dan Gohmanf4423b12008-04-19 00:24:39 +00005503 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5504 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5505;}
5506 break;
5507
Dan Gohmane4977cf2008-05-23 01:55:30 +00005508 case 251:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005509#line 2422 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005510 {
5511 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005512 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005513;}
5514 break;
5515
Dan Gohmane4977cf2008-05-23 01:55:30 +00005516 case 252:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005517#line 2427 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005518 {
5519 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5520 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5521 (yyval.FunctionVal) = CurFun.CurrentFunction;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005522 CurFun.FunctionDone();
Reid Spencer41dff5e2007-01-26 08:05:27 +00005523 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005524 ;}
5525 break;
5526
Dan Gohmane4977cf2008-05-23 01:55:30 +00005527 case 253:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005528#line 2439 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005529 {
5530 (yyval.BoolVal) = false;
Reid Spencer61c83e02006-08-18 08:43:06 +00005531 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005532 ;}
5533 break;
5534
Dan Gohmane4977cf2008-05-23 01:55:30 +00005535 case 254:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005536#line 2443 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005537 {
5538 (yyval.BoolVal) = true;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005539 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005540 ;}
5541 break;
5542
Dan Gohmane4977cf2008-05-23 01:55:30 +00005543 case 255:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005544#line 2448 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005545 { // A reference to a direct constant
5546 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005547 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005548 ;}
5549 break;
5550
Dan Gohmane4977cf2008-05-23 01:55:30 +00005551 case 256:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005552#line 2452 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005553 {
5554 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005555 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005556 ;}
5557 break;
5558
Dan Gohmane4977cf2008-05-23 01:55:30 +00005559 case 257:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005560#line 2456 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005561 { // Perhaps it's an FP constant?
5562 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00005563 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005564 ;}
5565 break;
5566
Dan Gohmane4977cf2008-05-23 01:55:30 +00005567 case 258:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005568#line 2460 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005569 {
5570 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
Reid Spencere4d87aa2006-12-23 06:05:41 +00005571 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005572 ;}
5573 break;
5574
Dan Gohmane4977cf2008-05-23 01:55:30 +00005575 case 259:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005576#line 2464 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005577 {
5578 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00005579 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005580 ;}
5581 break;
5582
Dan Gohmane4977cf2008-05-23 01:55:30 +00005583 case 260:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005584#line 2468 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005585 {
5586 (yyval.ValIDVal) = ValID::createNull();
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00005587 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005588 ;}
5589 break;
5590
Dan Gohmane4977cf2008-05-23 01:55:30 +00005591 case 261:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005592#line 2472 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005593 {
5594 (yyval.ValIDVal) = ValID::createUndef();
Reid Spencer61c83e02006-08-18 08:43:06 +00005595 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005596 ;}
5597 break;
5598
Dan Gohmane4977cf2008-05-23 01:55:30 +00005599 case 262:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005600#line 2476 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005601 { // A vector zero constant.
5602 (yyval.ValIDVal) = ValID::createZeroInit();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005603 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005604 ;}
5605 break;
5606
Dan Gohmane4977cf2008-05-23 01:55:30 +00005607 case 263:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005608#line 2480 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005609 { // Nonempty unsized packed vector
5610 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5611 int NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005612
5613 if (!ETy->isInteger() && !ETy->isFloatingPoint())
5614 GEN_ERROR("Invalid vector element type: " + ETy->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005615
Reid Spencer9d6565a2007-02-15 02:26:10 +00005616 VectorType* pt = VectorType::get(ETy, NumElements);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005617 PATypeHolder* PTy = new PATypeHolder(
Reid Spencera132e042006-12-03 05:46:11 +00005618 HandleUpRefs(
Reid Spencer9d6565a2007-02-15 02:26:10 +00005619 VectorType::get(
Reid Spencera132e042006-12-03 05:46:11 +00005620 ETy,
5621 NumElements)
5622 )
5623 );
Reid Spencer68a24bd2005-08-27 18:50:39 +00005624
5625 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00005626 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5627 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Reid Spencer61c83e02006-08-18 08:43:06 +00005628 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +00005629 ETy->getDescription() +"' as required!\nIt is of type '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00005630 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005631 }
5632
Dan Gohmanf4423b12008-04-19 00:24:39 +00005633 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5634 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
Reid Spencer832254e2007-02-02 02:16:23 +00005635 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005636 ;}
5637 break;
5638
Dan Gohmane4977cf2008-05-23 01:55:30 +00005639 case 264:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005640#line 2508 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005641 {
5642 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
Reid Spencer832254e2007-02-02 02:16:23 +00005643 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005644 ;}
5645 break;
5646
Dan Gohmane4977cf2008-05-23 01:55:30 +00005647 case 265:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005648#line 2512 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005649 {
5650 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5651 delete (yyvsp[(3) - (5)].StrVal);
5652 delete (yyvsp[(5) - (5)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005653 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005654 ;}
5655 break;
5656
Dan Gohmane4977cf2008-05-23 01:55:30 +00005657 case 266:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005658#line 2522 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005659 { // Is it an integer reference...?
5660 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005661 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005662 ;}
5663 break;
5664
Dan Gohmane4977cf2008-05-23 01:55:30 +00005665 case 267:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005666#line 2526 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005667 {
5668 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
Reid Spencer832254e2007-02-02 02:16:23 +00005669 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005670 ;}
5671 break;
5672
Dan Gohmane4977cf2008-05-23 01:55:30 +00005673 case 268:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005674#line 2530 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005675 { // Is it a named reference...?
5676 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5677 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005678 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005679 ;}
5680 break;
5681
Dan Gohmane4977cf2008-05-23 01:55:30 +00005682 case 269:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005683#line 2535 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005684 { // Is it a named reference...?
5685 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5686 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005687 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005688 ;}
5689 break;
5690
Dan Gohmane4977cf2008-05-23 01:55:30 +00005691 case 272:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005692#line 2548 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005693 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005694 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005695 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5696 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5697 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005698 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005699 ;}
5700 break;
5701
Dan Gohmane4977cf2008-05-23 01:55:30 +00005702 case 273:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005703#line 2557 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005704 {
5705 (yyval.ValueList) = new std::vector<Value *>();
5706 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
Devang Patel7990dc72008-02-20 22:40:23 +00005707 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005708 ;}
5709 break;
5710
Dan Gohmane4977cf2008-05-23 01:55:30 +00005711 case 274:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005712#line 2562 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005713 {
5714 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
Devang Patel7990dc72008-02-20 22:40:23 +00005715 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005716 ;}
5717 break;
5718
Dan Gohmane4977cf2008-05-23 01:55:30 +00005719 case 275:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005720#line 2567 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005721 {
5722 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005723 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005724 ;}
5725 break;
5726
Dan Gohmane4977cf2008-05-23 01:55:30 +00005727 case 276:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005728#line 2571 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005729 { // Do not allow functions with 0 basic blocks
5730 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005731 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005732 ;}
5733 break;
5734
Dan Gohmane4977cf2008-05-23 01:55:30 +00005735 case 277:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005736#line 2580 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005737 {
5738 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005739 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005740 InsertValue((yyvsp[(3) - (3)].TermInstVal));
5741 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
5742 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005743 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005744 ;}
5745 break;
5746
Dan Gohmane4977cf2008-05-23 01:55:30 +00005747 case 278:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005748#line 2589 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005749 {
5750 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005751 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5752 if (CI2->getParent() == 0)
Dan Gohmanf4423b12008-04-19 00:24:39 +00005753 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
5754 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
5755 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005756 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005757 ;}
5758 break;
Chris Lattner38905612008-02-19 04:36:25 +00005759
Dan Gohmane4977cf2008-05-23 01:55:30 +00005760 case 279:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005761#line 2598 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005762 { // Empty space between instruction lists
Chris Lattnercc81d152008-05-04 17:18:47 +00005763 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
Dan Gohmanf4423b12008-04-19 00:24:39 +00005764 CHECK_FOR_ERROR
5765 ;}
5766 break;
5767
Dan Gohmane4977cf2008-05-23 01:55:30 +00005768 case 280:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005769#line 2602 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnercc81d152008-05-04 17:18:47 +00005770 { // Labelled (named) basic block
5771 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
5772 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005773 CHECK_FOR_ERROR
Chris Lattnercc81d152008-05-04 17:18:47 +00005774
Dan Gohmanf4423b12008-04-19 00:24:39 +00005775 ;}
5776 break;
5777
Dan Gohmane4977cf2008-05-23 01:55:30 +00005778 case 281:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005779#line 2610 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005780 { // Return with a result...
5781 ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
5782 assert(!VL.empty() && "Invalid ret operands!");
5783 (yyval.TermInstVal) = ReturnInst::Create(&VL[0], VL.size());
5784 delete (yyvsp[(2) - (2)].ValueList);
5785 CHECK_FOR_ERROR
5786 ;}
5787 break;
5788
Dan Gohmane4977cf2008-05-23 01:55:30 +00005789 case 282:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005790#line 2617 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005791 { // Return with no result...
5792 (yyval.TermInstVal) = ReturnInst::Create();
5793 CHECK_FOR_ERROR
5794 ;}
5795 break;
5796
Dan Gohmane4977cf2008-05-23 01:55:30 +00005797 case 283:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005798#line 2621 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005799 { // Unconditional Branch...
5800 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
5801 CHECK_FOR_ERROR
5802 (yyval.TermInstVal) = BranchInst::Create(tmpBB);
5803 ;}
5804 break;
5805
Dan Gohmane4977cf2008-05-23 01:55:30 +00005806 case 284:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005807#line 2626 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005808 {
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005809 if (cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() != 1)
5810 GEN_ERROR("Branch condition must have type i1");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005811 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5812 CHECK_FOR_ERROR
5813 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
5814 CHECK_FOR_ERROR
5815 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
5816 CHECK_FOR_ERROR
5817 (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal);
5818 ;}
5819 break;
5820
Dan Gohmane4977cf2008-05-23 01:55:30 +00005821 case 285:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005822#line 2637 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005823 {
5824 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
5825 CHECK_FOR_ERROR
5826 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5827 CHECK_FOR_ERROR
5828 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
5829 (yyval.TermInstVal) = S;
5830
5831 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
5832 E = (yyvsp[(8) - (9)].JumpTable)->end();
Reid Spencer68a24bd2005-08-27 18:50:39 +00005833 for (; I != E; ++I) {
5834 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5835 S->addCase(CI, I->second);
5836 else
Reid Spencerb5334b02007-02-05 10:18:06 +00005837 GEN_ERROR("Switch case is constant, but not a simple integer");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005838 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00005839 delete (yyvsp[(8) - (9)].JumpTable);
Reid Spencer61c83e02006-08-18 08:43:06 +00005840 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005841 ;}
5842 break;
5843
Dan Gohmane4977cf2008-05-23 01:55:30 +00005844 case 286:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005845#line 2656 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005846 {
5847 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005848 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005849 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005850 CHECK_FOR_ERROR
Gabor Greife64d2482008-04-06 23:07:54 +00005851 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005852 (yyval.TermInstVal) = S;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005853 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005854 ;}
5855 break;
5856
Dan Gohmane4977cf2008-05-23 01:55:30 +00005857 case 287:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005858#line 2666 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005859 {
Reid Spencer3822ff52006-11-08 06:47:33 +00005860
Reid Spencer14310612006-12-31 05:40:51 +00005861 // Handle the short syntax
5862 const PointerType *PFTy = 0;
5863 const FunctionType *Ty = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005864 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
Reid Spencer68a24bd2005-08-27 18:50:39 +00005865 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5866 // Pull out the types of all of the arguments...
5867 std::vector<const Type*> ParamTypes;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005868 ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00005869 for (; I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00005870 const Type *Ty = I->Val->getType();
5871 if (Ty == Type::VoidTy)
5872 GEN_ERROR("Short call syntax cannot be used with varargs");
5873 ParamTypes.push_back(Ty);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005874 }
Chris Lattnera925a142008-04-23 05:37:08 +00005875
5876 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (14)].TypeVal)))
5877 GEN_ERROR("Invalid result type for LLVM function");
5878
Dan Gohmanf4423b12008-04-19 00:24:39 +00005879 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00005880 PFTy = PointerType::getUnqual(Ty);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005881 }
5882
Dan Gohmanf4423b12008-04-19 00:24:39 +00005883 delete (yyvsp[(3) - (14)].TypeVal);
Reid Spencer66728ef2007-03-20 01:13:36 +00005884
Dan Gohmanf4423b12008-04-19 00:24:39 +00005885 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00005886 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005887 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005888 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005889 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00005890 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005891
Chris Lattner58d74912008-03-12 17:45:29 +00005892 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005893 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None)
5894 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (14)].ParamAttrs)));
Duncan Sandsdc024672007-11-27 13:23:08 +00005895
Reid Spencer14310612006-12-31 05:40:51 +00005896 // Check the arguments
5897 ValueList Args;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005898 if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments?
Reid Spencer14310612006-12-31 05:40:51 +00005899 // Make sure no arguments is a good thing!
5900 if (Ty->getNumParams() != 0)
5901 GEN_ERROR("No arguments passed to a function that "
Reid Spencerb5334b02007-02-05 10:18:06 +00005902 "expects arguments");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005903 } else { // Has arguments?
5904 // Loop through FunctionType's arguments and ensure they are specified
5905 // correctly!
Reid Spencer68a24bd2005-08-27 18:50:39 +00005906 FunctionType::param_iterator I = Ty->param_begin();
5907 FunctionType::param_iterator E = Ty->param_end();
Dan Gohmanf4423b12008-04-19 00:24:39 +00005908 ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00005909 unsigned index = 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005910
Duncan Sandsdc024672007-11-27 13:23:08 +00005911 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00005912 if (ArgI->Val->getType() != *I)
5913 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00005914 (*I)->getDescription() + "'");
Reid Spencer14310612006-12-31 05:40:51 +00005915 Args.push_back(ArgI->Val);
Chris Lattner58d74912008-03-12 17:45:29 +00005916 if (ArgI->Attrs != ParamAttr::None)
5917 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00005918 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005919
Reid Spencer14310612006-12-31 05:40:51 +00005920 if (Ty->isVarArg()) {
5921 if (I == E)
Chris Lattner38905612008-02-19 04:36:25 +00005922 for (; ArgI != ArgE; ++ArgI, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00005923 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner58d74912008-03-12 17:45:29 +00005924 if (ArgI->Attrs != ParamAttr::None)
5925 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Chris Lattner38905612008-02-19 04:36:25 +00005926 }
Reid Spencer14310612006-12-31 05:40:51 +00005927 } else if (I != E || ArgI != ArgE)
Reid Spencerb5334b02007-02-05 10:18:06 +00005928 GEN_ERROR("Invalid number of parameters detected");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005929 }
Reid Spencer14310612006-12-31 05:40:51 +00005930
Chris Lattner58d74912008-03-12 17:45:29 +00005931 PAListPtr PAL;
Duncan Sandsdc024672007-11-27 13:23:08 +00005932 if (!Attrs.empty())
Chris Lattner58d74912008-03-12 17:45:29 +00005933 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsdc024672007-11-27 13:23:08 +00005934
Reid Spencer14310612006-12-31 05:40:51 +00005935 // Create the InvokeInst
Dan Gohman041e2eb2008-05-15 19:50:34 +00005936 InvokeInst *II = InvokeInst::Create(V, Normal, Except,
5937 Args.begin(), Args.end());
Dan Gohmanf4423b12008-04-19 00:24:39 +00005938 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
Duncan Sandsdc024672007-11-27 13:23:08 +00005939 II->setParamAttrs(PAL);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005940 (yyval.TermInstVal) = II;
5941 delete (yyvsp[(6) - (14)].ParamList);
Andrew Lenharth6353e052006-12-08 18:07:09 +00005942 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005943 ;}
5944 break;
5945
Dan Gohmane4977cf2008-05-23 01:55:30 +00005946 case 288:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005947#line 2751 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005948 {
5949 (yyval.TermInstVal) = new UnwindInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00005950 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005951 ;}
5952 break;
5953
Dan Gohmane4977cf2008-05-23 01:55:30 +00005954 case 289:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005955#line 2755 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005956 {
5957 (yyval.TermInstVal) = new UnreachableInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00005958 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005959 ;}
5960 break;
5961
Dan Gohmane4977cf2008-05-23 01:55:30 +00005962 case 290:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005963#line 2762 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005964 {
5965 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
5966 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005967 CHECK_FOR_ERROR
5968 if (V == 0)
5969 GEN_ERROR("May only switch on a constant pool value");
5970
Dan Gohmanf4423b12008-04-19 00:24:39 +00005971 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005972 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005973 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5974 ;}
5975 break;
5976
Dan Gohmane4977cf2008-05-23 01:55:30 +00005977 case 291:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005978#line 2773 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005979 {
5980 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5981 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005982 CHECK_FOR_ERROR
5983
5984 if (V == 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00005985 GEN_ERROR("May only switch on a constant pool value");
Andrew Lenharth6353e052006-12-08 18:07:09 +00005986
Dan Gohmanf4423b12008-04-19 00:24:39 +00005987 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005988 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005989 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5990 ;}
5991 break;
5992
Dan Gohmane4977cf2008-05-23 01:55:30 +00005993 case 292:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005994#line 2786 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005995 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005996 // Is this definition named?? if so, assign the name...
Dan Gohmanf4423b12008-04-19 00:24:39 +00005997 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005998 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005999 InsertValue((yyvsp[(2) - (2)].InstVal));
6000 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006001 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006002 ;}
6003 break;
6004
Dan Gohmane4977cf2008-05-23 01:55:30 +00006005 case 293:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006006#line 2796 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006007 { // Used for PHI nodes
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006008 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006009 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
6010 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
6011 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
Reid Spencer6f407902007-01-13 05:00:46 +00006012 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006013 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006014 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006015 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6016 delete (yyvsp[(1) - (6)].TypeVal);
6017 ;}
6018 break;
6019
Dan Gohmane4977cf2008-05-23 01:55:30 +00006020 case 294:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006021#line 2807 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006022 {
6023 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
6024 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006025 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006026 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006027 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006028 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6029 ;}
6030 break;
6031
Dan Gohmane4977cf2008-05-23 01:55:30 +00006032 case 295:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006033#line 2817 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006034 {
Duncan Sandsdc024672007-11-27 13:23:08 +00006035 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006036 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006037 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006038 // Used for call and invoke instructions
Dan Gohmanf4423b12008-04-19 00:24:39 +00006039 (yyval.ParamList) = new ParamList();
6040 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
6041 (yyval.ParamList)->push_back(E);
6042 delete (yyvsp[(1) - (4)].TypeVal);
Duncan Sandsdc024672007-11-27 13:23:08 +00006043 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006044 ;}
6045 break;
6046
Dan Gohmane4977cf2008-05-23 01:55:30 +00006047 case 296:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006048#line 2828 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006049 {
Duncan Sandsdc024672007-11-27 13:23:08 +00006050 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dale Johanneseneb57ea72007-11-05 21:20:28 +00006051 // Labels are only valid in ASMs
Dan Gohmanf4423b12008-04-19 00:24:39 +00006052 (yyval.ParamList) = new ParamList();
6053 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
6054 (yyval.ParamList)->push_back(E);
Duncan Sandsdc024672007-11-27 13:23:08 +00006055 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006056 ;}
6057 break;
6058
Dan Gohmane4977cf2008-05-23 01:55:30 +00006059 case 297:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006060#line 2836 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006061 {
Duncan Sandsdc024672007-11-27 13:23:08 +00006062 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006063 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006064 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6065 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
6066 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
6067 (yyval.ParamList)->push_back(E);
6068 delete (yyvsp[(3) - (6)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006069 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006070 ;}
6071 break;
6072
Dan Gohmane4977cf2008-05-23 01:55:30 +00006073 case 298:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006074#line 2846 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006075 {
Duncan Sandsdc024672007-11-27 13:23:08 +00006076 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf4423b12008-04-19 00:24:39 +00006077 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
6078 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
6079 (yyval.ParamList)->push_back(E);
Dale Johanneseneb57ea72007-11-05 21:20:28 +00006080 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006081 ;}
6082 break;
6083
Dan Gohmane4977cf2008-05-23 01:55:30 +00006084 case 299:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006085#line 2853 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006086 { (yyval.ParamList) = new ParamList(); ;}
6087 break;
6088
Dan Gohmane4977cf2008-05-23 01:55:30 +00006089 case 300:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006090#line 2856 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006091 { (yyval.ValueList) = new std::vector<Value*>(); ;}
6092 break;
6093
Dan Gohmane4977cf2008-05-23 01:55:30 +00006094 case 301:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006095#line 2857 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006096 {
6097 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
6098 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00006099 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006100 ;}
6101 break;
6102
Dan Gohmane4977cf2008-05-23 01:55:30 +00006103 case 302:
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006104#line 2865 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6105 {
6106 (yyval.ConstantList) = new std::vector<unsigned>();
6107 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
6108 GEN_ERROR("Index " + utostr((yyvsp[(2) - (2)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6109 (yyval.ConstantList)->push_back((yyvsp[(2) - (2)].UInt64Val));
6110 ;}
6111 break;
6112
6113 case 303:
6114#line 2871 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6115 {
6116 (yyval.ConstantList) = (yyvsp[(1) - (3)].ConstantList);
6117 if ((unsigned)(yyvsp[(3) - (3)].UInt64Val) != (yyvsp[(3) - (3)].UInt64Val))
6118 GEN_ERROR("Index " + utostr((yyvsp[(3) - (3)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6119 (yyval.ConstantList)->push_back((yyvsp[(3) - (3)].UInt64Val));
6120 CHECK_FOR_ERROR
6121 ;}
6122 break;
6123
6124 case 304:
6125#line 2880 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006126 {
6127 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00006128 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006129 ;}
6130 break;
6131
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006132 case 305:
6133#line 2884 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006134 {
6135 (yyval.BoolVal) = false;
Andrew Lenharth6353e052006-12-08 18:07:09 +00006136 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006137 ;}
6138 break;
6139
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006140 case 306:
6141#line 2889 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006142 {
Reid Spencer14310612006-12-31 05:40:51 +00006143 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006144 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6145 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
6146 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006147 GEN_ERROR(
6148 "Arithmetic operator requires integer, FP, or packed operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006149 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006150 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006151 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006152 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006153 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006154 if ((yyval.InstVal) == 0)
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006155 GEN_ERROR("binary operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006156 delete (yyvsp[(2) - (5)].TypeVal);
6157 ;}
6158 break;
6159
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006160 case 307:
6161#line 2905 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006162 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006163 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006164 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6165 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
6166 if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
6167 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006168 GEN_ERROR("Logical operator requires integral operands");
6169 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006170 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006171 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006172 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006173 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006174 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006175 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006176 GEN_ERROR("binary operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006177 delete (yyvsp[(2) - (5)].TypeVal);
6178 ;}
6179 break;
6180
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006181 case 308:
6182#line 2922 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006183 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006184 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006185 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6186 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006187 GEN_ERROR("Vector types not supported by icmp instruction");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006188 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006189 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006190 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006191 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006192 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006193 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006194 GEN_ERROR("icmp operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006195 delete (yyvsp[(3) - (6)].TypeVal);
6196 ;}
6197 break;
6198
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006199 case 309:
6200#line 2936 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006201 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006202 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006203 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6204 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006205 GEN_ERROR("Vector types not supported by fcmp instruction");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006206 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006207 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006208 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006209 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006210 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006211 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006212 GEN_ERROR("fcmp operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006213 delete (yyvsp[(3) - (6)].TypeVal);
6214 ;}
6215 break;
6216
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006217 case 310:
6218#line 2950 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00006219 {
6220 if (!UpRefs.empty())
6221 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6222 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6223 GEN_ERROR("Scalar types not supported by vicmp instruction");
6224 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6225 CHECK_FOR_ERROR
6226 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6227 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006228 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Nate Begemanac80ade2008-05-12 19:01:56 +00006229 if ((yyval.InstVal) == 0)
6230 GEN_ERROR("icmp operator returned null");
6231 delete (yyvsp[(3) - (6)].TypeVal);
6232 ;}
6233 break;
6234
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006235 case 311:
6236#line 2964 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00006237 {
6238 if (!UpRefs.empty())
6239 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6240 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6241 GEN_ERROR("Scalar types not supported by vfcmp instruction");
6242 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6243 CHECK_FOR_ERROR
6244 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6245 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006246 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Nate Begemanac80ade2008-05-12 19:01:56 +00006247 if ((yyval.InstVal) == 0)
6248 GEN_ERROR("fcmp operator returned null");
6249 delete (yyvsp[(3) - (6)].TypeVal);
6250 ;}
6251 break;
6252
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006253 case 312:
6254#line 2978 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006255 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006256 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006257 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6258 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6259 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6260 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006261 GEN_ERROR("invalid cast opcode for cast from '" +
6262 Val->getType()->getDescription() + "' to '" +
6263 DestTy->getDescription() + "'");
Dan Gohmane4977cf2008-05-23 01:55:30 +00006264 (yyval.InstVal) = CastInst::Create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006265 delete (yyvsp[(4) - (4)].TypeVal);
6266 ;}
6267 break;
6268
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006269 case 313:
6270#line 2990 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006271 {
6272 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006273 GEN_ERROR("select condition must be boolean");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006274 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006275 GEN_ERROR("select value types should match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006276 (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006277 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006278 ;}
6279 break;
6280
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006281 case 314:
6282#line 2998 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006283 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006284 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006285 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6286 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6287 delete (yyvsp[(4) - (4)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006288 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006289 ;}
6290 break;
6291
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006292 case 315:
6293#line 3005 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006294 {
6295 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006296 GEN_ERROR("Invalid extractelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006297 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006298 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006299 ;}
6300 break;
6301
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006302 case 316:
6303#line 3011 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006304 {
6305 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006306 GEN_ERROR("Invalid insertelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006307 (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006308 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006309 ;}
6310 break;
6311
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006312 case 317:
6313#line 3017 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006314 {
6315 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006316 GEN_ERROR("Invalid shufflevector operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006317 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006318 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006319 ;}
6320 break;
6321
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006322 case 318:
6323#line 3023 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006324 {
6325 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006326 if (!Ty->isFirstClassType())
6327 GEN_ERROR("PHI node operands must be of first class type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006328 (yyval.InstVal) = PHINode::Create(Ty);
6329 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6330 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6331 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006332 GEN_ERROR("All elements of a PHI node must be of the same type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006333 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6334 (yyvsp[(2) - (2)].PHIList)->pop_front();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006335 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006336 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006337 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006338 ;}
6339 break;
6340
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006341 case 319:
6342#line 3039 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006343 {
Reid Spencer14310612006-12-31 05:40:51 +00006344
6345 // Handle the short syntax
Andrew Lenharth6353e052006-12-08 18:07:09 +00006346 const PointerType *PFTy = 0;
6347 const FunctionType *Ty = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006348 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
Andrew Lenharth6353e052006-12-08 18:07:09 +00006349 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6350 // Pull out the types of all of the arguments...
6351 std::vector<const Type*> ParamTypes;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006352 ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006353 for (; I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00006354 const Type *Ty = I->Val->getType();
6355 if (Ty == Type::VoidTy)
6356 GEN_ERROR("Short call syntax cannot be used with varargs");
6357 ParamTypes.push_back(Ty);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006358 }
Chris Lattnera925a142008-04-23 05:37:08 +00006359
6360 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (8)].TypeVal)))
6361 GEN_ERROR("Invalid result type for LLVM function");
6362
Dan Gohmanf4423b12008-04-19 00:24:39 +00006363 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00006364 PFTy = PointerType::getUnqual(Ty);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006365 }
Chris Lattner6cdc6822007-04-26 05:31:05 +00006366
Dan Gohmanf4423b12008-04-19 00:24:39 +00006367 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00006368 CHECK_FOR_ERROR
Chris Lattner6cdc6822007-04-26 05:31:05 +00006369
Reid Spencer7780acb2007-04-16 06:56:07 +00006370 // Check for call to invalid intrinsic to avoid crashing later.
6371 if (Function *theF = dyn_cast<Function>(V)) {
Reid Spencered48de22007-04-16 22:02:23 +00006372 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
Reid Spencer36fdde12007-04-16 20:35:38 +00006373 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6374 !theF->getIntrinsicID(true))
Reid Spencer7780acb2007-04-16 06:56:07 +00006375 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6376 theF->getName() + "'");
6377 }
6378
Duncan Sandsdc024672007-11-27 13:23:08 +00006379 // Set up the ParamAttrs for the function
Chris Lattner58d74912008-03-12 17:45:29 +00006380 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006381 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None)
6382 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (8)].ParamAttrs)));
Reid Spencer14310612006-12-31 05:40:51 +00006383 // Check the arguments
6384 ValueList Args;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006385 if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments?
Andrew Lenharth6353e052006-12-08 18:07:09 +00006386 // Make sure no arguments is a good thing!
6387 if (Ty->getNumParams() != 0)
6388 GEN_ERROR("No arguments passed to a function that "
Reid Spencerb5334b02007-02-05 10:18:06 +00006389 "expects arguments");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006390 } else { // Has arguments?
6391 // Loop through FunctionType's arguments and ensure they are specified
Duncan Sandsdc024672007-11-27 13:23:08 +00006392 // correctly. Also, gather any parameter attributes.
Andrew Lenharth6353e052006-12-08 18:07:09 +00006393 FunctionType::param_iterator I = Ty->param_begin();
6394 FunctionType::param_iterator E = Ty->param_end();
Dan Gohmanf4423b12008-04-19 00:24:39 +00006395 ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006396 unsigned index = 1;
Andrew Lenharth6353e052006-12-08 18:07:09 +00006397
Duncan Sandsdc024672007-11-27 13:23:08 +00006398 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006399 if (ArgI->Val->getType() != *I)
6400 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00006401 (*I)->getDescription() + "'");
Reid Spencer14310612006-12-31 05:40:51 +00006402 Args.push_back(ArgI->Val);
Chris Lattner58d74912008-03-12 17:45:29 +00006403 if (ArgI->Attrs != ParamAttr::None)
6404 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00006405 }
6406 if (Ty->isVarArg()) {
6407 if (I == E)
Chris Lattner38905612008-02-19 04:36:25 +00006408 for (; ArgI != ArgE; ++ArgI, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006409 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner58d74912008-03-12 17:45:29 +00006410 if (ArgI->Attrs != ParamAttr::None)
6411 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Chris Lattner38905612008-02-19 04:36:25 +00006412 }
Reid Spencer14310612006-12-31 05:40:51 +00006413 } else if (I != E || ArgI != ArgE)
Reid Spencerb5334b02007-02-05 10:18:06 +00006414 GEN_ERROR("Invalid number of parameters detected");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006415 }
Duncan Sandsdc024672007-11-27 13:23:08 +00006416
6417 // Finish off the ParamAttrs and check them
Chris Lattner58d74912008-03-12 17:45:29 +00006418 PAListPtr PAL;
Duncan Sandsdc024672007-11-27 13:23:08 +00006419 if (!Attrs.empty())
Chris Lattner58d74912008-03-12 17:45:29 +00006420 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsdc024672007-11-27 13:23:08 +00006421
Reid Spencer14310612006-12-31 05:40:51 +00006422 // Create the call node
Gabor Greife64d2482008-04-06 23:07:54 +00006423 CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
Dan Gohmanf4423b12008-04-19 00:24:39 +00006424 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6425 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
Duncan Sandsdc024672007-11-27 13:23:08 +00006426 CI->setParamAttrs(PAL);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006427 (yyval.InstVal) = CI;
6428 delete (yyvsp[(6) - (8)].ParamList);
6429 delete (yyvsp[(3) - (8)].TypeVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00006430 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006431 ;}
6432 break;
6433
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006434 case 320:
6435#line 3128 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006436 {
6437 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00006438 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006439 ;}
6440 break;
6441
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006442 case 321:
6443#line 3133 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006444 {
6445 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00006446 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006447 ;}
6448 break;
6449
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006450 case 322:
6451#line 3137 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006452 {
6453 (yyval.BoolVal) = false;
Reid Spencer61c83e02006-08-18 08:43:06 +00006454 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006455 ;}
6456 break;
6457
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006458 case 323:
6459#line 3144 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006460 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006461 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006462 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6463 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6464 delete (yyvsp[(2) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006465 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006466 ;}
6467 break;
6468
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006469 case 324:
6470#line 3151 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006471 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006472 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006473 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006474 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6475 GEN_ERROR("Malloc array size is not a 32-bit integer!");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006476 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00006477 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006478 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6479 delete (yyvsp[(2) - (6)].TypeVal);
6480 ;}
6481 break;
6482
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006483 case 325:
6484#line 3161 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006485 {
Reid Spencer14310612006-12-31 05:40:51 +00006486 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006487 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6488 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6489 delete (yyvsp[(2) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006490 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006491 ;}
6492 break;
6493
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006494 case 326:
6495#line 3168 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006496 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006497 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006498 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006499 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6500 GEN_ERROR("Alloca array size is not a 32-bit integer!");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006501 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006502 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006503 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6504 delete (yyvsp[(2) - (6)].TypeVal);
6505 ;}
6506 break;
6507
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006508 case 327:
6509#line 3178 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006510 {
6511 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006512 GEN_ERROR("Trying to free nonpointer type " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006513 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6514 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006515 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006516 ;}
6517 break;
6518
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006519 case 328:
6520#line 3186 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006521 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006522 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006523 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6524 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006525 GEN_ERROR("Can't load from nonpointer type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006526 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6527 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006528 GEN_ERROR("Can't load from pointer of non-first-class type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006529 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6530 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006531 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006532 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6533 delete (yyvsp[(3) - (5)].TypeVal);
6534 ;}
6535 break;
6536
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006537 case 329:
6538#line 3200 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006539 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006540 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006541 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6542 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006543 if (!PT)
6544 GEN_ERROR("Can't store to a nonpointer type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006545 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006546 const Type *ElTy = PT->getElementType();
Dan Gohmanf4423b12008-04-19 00:24:39 +00006547 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6548 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006549 "' into space of type '" + ElTy->getDescription() + "'");
6550
Dan Gohmanf4423b12008-04-19 00:24:39 +00006551 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006552 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006553 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6554 delete (yyvsp[(5) - (7)].TypeVal);
6555 ;}
6556 break;
6557
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006558 case 330:
6559#line 3217 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006560 {
6561 Value *TmpVal = getVal((yyvsp[(2) - (5)].TypeVal)->get(), (yyvsp[(3) - (5)].ValIDVal));
6562 if (!GetResultInst::isValidOperands(TmpVal, (yyvsp[(5) - (5)].UInt64Val)))
Devang Patel5a970972008-02-19 22:27:01 +00006563 GEN_ERROR("Invalid getresult operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006564 (yyval.InstVal) = new GetResultInst(TmpVal, (yyvsp[(5) - (5)].UInt64Val));
6565 delete (yyvsp[(2) - (5)].TypeVal);
Devang Patel5a970972008-02-19 22:27:01 +00006566 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006567 ;}
6568 break;
6569
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006570 case 331:
6571#line 3225 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006572 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006573 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006574 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6575 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
Reid Spencerb5334b02007-02-05 10:18:06 +00006576 GEN_ERROR("getelementptr insn requires pointer operand");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006577
Dan Gohman041e2eb2008-05-15 19:50:34 +00006578 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()))
Reid Spencer61c83e02006-08-18 08:43:06 +00006579 GEN_ERROR("Invalid getelementptr indices for type '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006580 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6581 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00006582 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006583 (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6584 delete (yyvsp[(2) - (4)].TypeVal);
6585 delete (yyvsp[(4) - (4)].ValueList);
6586 ;}
6587 break;
Reid Spencer7780acb2007-04-16 06:56:07 +00006588
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006589 case 332:
6590#line 3240 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00006591 {
6592 if (!UpRefs.empty())
6593 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6594 if (!isa<StructType>((yyvsp[(2) - (4)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (4)].TypeVal)->get()))
6595 GEN_ERROR("extractvalue insn requires an aggregate operand");
6596
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006597 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end()))
Dan Gohmane4977cf2008-05-23 01:55:30 +00006598 GEN_ERROR("Invalid extractvalue indices for type '" +
6599 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6600 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6601 CHECK_FOR_ERROR
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006602 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end());
Dan Gohmane4977cf2008-05-23 01:55:30 +00006603 delete (yyvsp[(2) - (4)].TypeVal);
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006604 delete (yyvsp[(4) - (4)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00006605 ;}
6606 break;
6607
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006608 case 333:
6609#line 3255 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00006610 {
6611 if (!UpRefs.empty())
6612 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription());
6613 if (!isa<StructType>((yyvsp[(2) - (7)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (7)].TypeVal)->get()))
6614 GEN_ERROR("extractvalue insn requires an aggregate operand");
6615
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006616 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 +00006617 GEN_ERROR("Invalid insertvalue indices for type '" +
6618 (*(yyvsp[(2) - (7)].TypeVal))->getDescription()+ "'");
6619 Value* aggVal = getVal(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(3) - (7)].ValIDVal));
6620 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
6621 CHECK_FOR_ERROR
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006622 (yyval.InstVal) = InsertValueInst::Create(aggVal, tmpVal, (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end());
Dan Gohmane4977cf2008-05-23 01:55:30 +00006623 delete (yyvsp[(2) - (7)].TypeVal);
6624 delete (yyvsp[(5) - (7)].TypeVal);
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006625 delete (yyvsp[(7) - (7)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00006626 ;}
6627 break;
6628
Dan Gohmanf4423b12008-04-19 00:24:39 +00006629
6630/* Line 1267 of yacc.c. */
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006631#line 6632 "llvmAsmParser.tab.c"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006632 default: break;
Dale Johannesencdd509a2007-09-07 21:07:57 +00006633 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006634 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6635
6636 YYPOPSTACK (yylen);
6637 yylen = 0;
6638 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006639
6640 *++yyvsp = yyval;
6641
6642
Dan Gohmanf4423b12008-04-19 00:24:39 +00006643 /* Now `shift' the result of the reduction. Determine what state
6644 that goes to, based on the state we popped back to and the rule
6645 number reduced by. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00006646
6647 yyn = yyr1[yyn];
6648
Dan Gohmanf4423b12008-04-19 00:24:39 +00006649 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6650 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00006651 yystate = yytable[yystate];
6652 else
Dan Gohmanf4423b12008-04-19 00:24:39 +00006653 yystate = yydefgoto[yyn - YYNTOKENS];
Reid Spencer68a24bd2005-08-27 18:50:39 +00006654
6655 goto yynewstate;
6656
6657
Dan Gohmanf4423b12008-04-19 00:24:39 +00006658/*------------------------------------.
6659| yyerrlab -- here on detecting error |
6660`------------------------------------*/
6661yyerrlab:
6662 /* If not already recovering from an error, report this error. */
6663 if (!yyerrstatus)
Reid Spencer68a24bd2005-08-27 18:50:39 +00006664 {
6665 ++yynerrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006666#if ! YYERROR_VERBOSE
6667 yyerror (YY_("syntax error"));
6668#else
6669 {
6670 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
6671 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
6672 {
6673 YYSIZE_T yyalloc = 2 * yysize;
6674 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
6675 yyalloc = YYSTACK_ALLOC_MAXIMUM;
6676 if (yymsg != yymsgbuf)
6677 YYSTACK_FREE (yymsg);
6678 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
6679 if (yymsg)
6680 yymsg_alloc = yyalloc;
6681 else
6682 {
6683 yymsg = yymsgbuf;
6684 yymsg_alloc = sizeof yymsgbuf;
6685 }
6686 }
Dale Johannesencdd509a2007-09-07 21:07:57 +00006687
Dan Gohmanf4423b12008-04-19 00:24:39 +00006688 if (0 < yysize && yysize <= yymsg_alloc)
6689 {
6690 (void) yysyntax_error (yymsg, yystate, yychar);
6691 yyerror (yymsg);
6692 }
6693 else
6694 {
6695 yyerror (YY_("syntax error"));
6696 if (yysize != 0)
6697 goto yyexhaustedlab;
6698 }
6699 }
6700#endif
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006701 }
6702
Dan Gohmanf4423b12008-04-19 00:24:39 +00006703
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006704
6705 if (yyerrstatus == 3)
6706 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00006707 /* If just tried and failed to reuse look-ahead token after an
6708 error, discard it. */
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006709
Dan Gohmanf4423b12008-04-19 00:24:39 +00006710 if (yychar <= YYEOF)
6711 {
6712 /* Return failure if at end of input. */
6713 if (yychar == YYEOF)
6714 YYABORT;
6715 }
6716 else
6717 {
6718 yydestruct ("Error: discarding",
6719 yytoken, &yylval);
6720 yychar = YYEMPTY;
6721 }
6722 }
6723
6724 /* Else will try to reuse look-ahead token after shifting the error
6725 token. */
6726 goto yyerrlab1;
6727
6728
6729/*---------------------------------------------------.
6730| yyerrorlab -- error raised explicitly by YYERROR. |
6731`---------------------------------------------------*/
6732yyerrorlab:
6733
6734 /* Pacify compilers like GCC when the user code never invokes
6735 YYERROR and the label yyerrorlab therefore never appears in user
6736 code. */
6737 if (/*CONSTCOND*/ 0)
6738 goto yyerrorlab;
6739
6740 /* Do not reclaim the symbols of the rule which action triggered
6741 this YYERROR. */
6742 YYPOPSTACK (yylen);
6743 yylen = 0;
6744 YY_STACK_PRINT (yyss, yyssp);
6745 yystate = *yyssp;
6746 goto yyerrlab1;
6747
6748
6749/*-------------------------------------------------------------.
6750| yyerrlab1 -- common code for both syntax error and YYERROR. |
6751`-------------------------------------------------------------*/
6752yyerrlab1:
6753 yyerrstatus = 3; /* Each real token shifted decrements this. */
6754
6755 for (;;)
6756 {
6757 yyn = yypact[yystate];
6758 if (yyn != YYPACT_NINF)
6759 {
6760 yyn += YYTERROR;
6761 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6762 {
6763 yyn = yytable[yyn];
6764 if (0 < yyn)
6765 break;
6766 }
6767 }
6768
6769 /* Pop the current state because it cannot handle the error token. */
6770 if (yyssp == yyss)
Reid Spencer68a24bd2005-08-27 18:50:39 +00006771 YYABORT;
6772
Dale Johannesencdd509a2007-09-07 21:07:57 +00006773
Dan Gohmanf4423b12008-04-19 00:24:39 +00006774 yydestruct ("Error: popping",
6775 yystos[yystate], yyvsp);
6776 YYPOPSTACK (1);
6777 yystate = *yyssp;
6778 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006779 }
6780
6781 if (yyn == YYFINAL)
6782 YYACCEPT;
6783
Reid Spencer68a24bd2005-08-27 18:50:39 +00006784 *++yyvsp = yylval;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006785
6786
6787 /* Shift the error token. */
6788 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spencerb8f85052007-07-31 03:50:36 +00006789
Reid Spencer68a24bd2005-08-27 18:50:39 +00006790 yystate = yyn;
6791 goto yynewstate;
6792
Gabor Greife64d2482008-04-06 23:07:54 +00006793
Dan Gohmanf4423b12008-04-19 00:24:39 +00006794/*-------------------------------------.
6795| yyacceptlab -- YYACCEPT comes here. |
6796`-------------------------------------*/
6797yyacceptlab:
6798 yyresult = 0;
6799 goto yyreturn;
6800
6801/*-----------------------------------.
6802| yyabortlab -- YYABORT comes here. |
6803`-----------------------------------*/
6804yyabortlab:
6805 yyresult = 1;
6806 goto yyreturn;
6807
6808#ifndef yyoverflow
6809/*-------------------------------------------------.
6810| yyexhaustedlab -- memory exhaustion comes here. |
6811`-------------------------------------------------*/
6812yyexhaustedlab:
6813 yyerror (YY_("memory exhausted"));
6814 yyresult = 2;
6815 /* Fall through. */
Chris Lattner38905612008-02-19 04:36:25 +00006816#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00006817
6818yyreturn:
6819 if (yychar != YYEOF && yychar != YYEMPTY)
6820 yydestruct ("Cleanup: discarding lookahead",
6821 yytoken, &yylval);
6822 /* Do not reclaim the symbols of the rule which action triggered
6823 this YYABORT or YYACCEPT. */
6824 YYPOPSTACK (yylen);
6825 YY_STACK_PRINT (yyss, yyssp);
6826 while (yyssp != yyss)
6827 {
6828 yydestruct ("Cleanup: popping",
6829 yystos[*yyssp], yyvsp);
6830 YYPOPSTACK (1);
Gabor Greife64d2482008-04-06 23:07:54 +00006831 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006832#ifndef yyoverflow
6833 if (yyss != yyssa)
6834 YYSTACK_FREE (yyss);
6835#endif
6836#if YYERROR_VERBOSE
6837 if (yymsg != yymsgbuf)
6838 YYSTACK_FREE (yymsg);
6839#endif
6840 /* Make sure YYID is used. */
6841 return YYID (yyresult);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006842}
Dan Gohmanf4423b12008-04-19 00:24:39 +00006843
6844
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006845#line 3274 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Reid Spencer61c83e02006-08-18 08:43:06 +00006846
6847
Reid Spencer14310612006-12-31 05:40:51 +00006848// common code from the two 'RunVMAsmParser' functions
6849static Module* RunParser(Module * M) {
Reid Spencer14310612006-12-31 05:40:51 +00006850 CurModule.CurrentModule = M;
Reid Spencer14310612006-12-31 05:40:51 +00006851 // Check to make sure the parser succeeded
6852 if (yyparse()) {
6853 if (ParserResult)
6854 delete ParserResult;
6855 return 0;
6856 }
6857
Reid Spencer0d60b5a2007-03-30 01:37:39 +00006858 // Emit an error if there are any unresolved types left.
6859 if (!CurModule.LateResolveTypes.empty()) {
6860 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6861 if (DID.Type == ValID::LocalName) {
6862 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6863 } else {
6864 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
6865 }
6866 if (ParserResult)
6867 delete ParserResult;
6868 return 0;
6869 }
6870
6871 // Emit an error if there are any unresolved values left.
6872 if (!CurModule.LateResolveValues.empty()) {
6873 Value *V = CurModule.LateResolveValues.back();
6874 std::map<Value*, std::pair<ValID, int> >::iterator I =
6875 CurModule.PlaceHolderInfo.find(V);
6876
6877 if (I != CurModule.PlaceHolderInfo.end()) {
6878 ValID &DID = I->second.first;
6879 if (DID.Type == ValID::LocalName) {
6880 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
6881 } else {
6882 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
6883 }
6884 if (ParserResult)
6885 delete ParserResult;
6886 return 0;
6887 }
6888 }
6889
Reid Spencer14310612006-12-31 05:40:51 +00006890 // Check to make sure that parsing produced a result
6891 if (!ParserResult)
6892 return 0;
6893
6894 // Reset ParserResult variable while saving its value for the result.
6895 Module *Result = ParserResult;
6896 ParserResult = 0;
6897
6898 return Result;
6899}
6900
Reid Spencer61c83e02006-08-18 08:43:06 +00006901void llvm::GenerateError(const std::string &message, int LineNo) {
Duncan Sandsdc024672007-11-27 13:23:08 +00006902 if (LineNo == -1) LineNo = LLLgetLineNo();
Reid Spencer61c83e02006-08-18 08:43:06 +00006903 // TODO: column number in exception
6904 if (TheParseError)
Duncan Sandsdc024672007-11-27 13:23:08 +00006905 TheParseError->setError(LLLgetFilename(), message, LineNo);
Reid Spencer61c83e02006-08-18 08:43:06 +00006906 TriggerError = 1;
6907}
Reid Spencer68a24bd2005-08-27 18:50:39 +00006908
6909int yyerror(const char *ErrorMsg) {
Duncan Sandsdc024672007-11-27 13:23:08 +00006910 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
Reid Spenceref9b9a72007-02-05 20:47:22 +00006911 std::string errMsg = where + "error: " + std::string(ErrorMsg);
Duncan Sandsdc024672007-11-27 13:23:08 +00006912 if (yychar != YYEMPTY && yychar != 0) {
6913 errMsg += " while reading token: '";
6914 errMsg += std::string(LLLgetTokenStart(),
6915 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
6916 }
Reid Spencer61c83e02006-08-18 08:43:06 +00006917 GenerateError(errMsg);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006918 return 0;
6919}
Dan Gohmanf4423b12008-04-19 00:24:39 +00006920