blob: 78bd21881dddc3f347179c12c00d1de5b8e880e9 [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 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001112
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001113 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001114
1115 std::string Name;
1116 if (NameStr) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001117 Name = *NameStr; // Copy string
1118 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001119 }
1120
1121 // See if this global value was forward referenced. If so, recycle the
1122 // object.
1123 ValID ID;
1124 if (!Name.empty()) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001125 ID = ValID::createGlobalName(Name);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001126 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00001127 ID = ValID::createGlobalID(CurModule.Values.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00001128 }
1129
1130 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1131 // Move the global to the end of the list, from whereever it was
1132 // previously inserted.
1133 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1134 CurModule.CurrentModule->getGlobalList().remove(GV);
1135 CurModule.CurrentModule->getGlobalList().push_back(GV);
1136 GV->setInitializer(Initializer);
1137 GV->setLinkage(Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001138 GV->setVisibility(Visibility);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001139 GV->setConstant(isConstantGlobal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00001140 GV->setThreadLocal(IsThreadLocal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001141 InsertValue(GV, CurModule.Values);
Chris Lattnerb475c422005-11-12 18:22:38 +00001142 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001143 }
1144
Reid Spenceref9b9a72007-02-05 20:47:22 +00001145 // If this global has a name
Reid Spencer68a24bd2005-08-27 18:50:39 +00001146 if (!Name.empty()) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00001147 // if the global we're parsing has an initializer (is a definition) and
1148 // has external linkage.
1149 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1150 // If there is already a global with external linkage with this name
1151 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1152 // If we allow this GVar to get created, it will be renamed in the
1153 // symbol table because it conflicts with an existing GVar. We can't
1154 // allow redefinition of GVars whose linking indicates that their name
1155 // must stay the same. Issue the error.
1156 GenerateError("Redefinition of global variable named '" + Name +
1157 "' of type '" + Ty->getDescription() + "'");
1158 return 0;
1159 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001160 }
1161
1162 // Otherwise there is no existing GV to use, create one now.
1163 GlobalVariable *GV =
1164 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001165 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001166 GV->setVisibility(Visibility);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001167 InsertValue(GV, CurModule.Values);
Chris Lattnerb475c422005-11-12 18:22:38 +00001168 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001169}
1170
1171// setTypeName - Set the specified type to the name given. The name may be
1172// null potentially, in which case this is a noop. The string passed in is
1173// assumed to be a malloc'd string buffer, and is freed by this function.
1174//
1175// This function returns true if the type has already been defined, but is
1176// allowed to be redefined in the specified context. If the name is a new name
1177// for the type plane, it is inserted and false is returned.
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001178static bool setTypeName(const Type *T, std::string *NameStr) {
Reid Spencera9720f52007-02-05 17:04:00 +00001179 assert(!inFunctionScope() && "Can't give types function-local names!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001180 if (NameStr == 0) return false;
1181
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001182 std::string Name(*NameStr); // Copy string
1183 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001184
1185 // We don't allow assigning names to void type
Reid Spencer5b7e7532006-09-28 19:28:24 +00001186 if (T == Type::VoidTy) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001187 GenerateError("Can't assign name '" + Name + "' to the void type");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001188 return false;
1189 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001190
1191 // Set the type name, checking for conflicts as we do so.
1192 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1193
1194 if (AlreadyExists) { // Inserting a name that is already defined???
1195 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
Reid Spencera9720f52007-02-05 17:04:00 +00001196 assert(Existing && "Conflict but no matching type?!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001197
1198 // There is only one case where this is allowed: when we are refining an
1199 // opaque type. In this case, Existing will be an opaque type.
1200 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1201 // We ARE replacing an opaque type!
1202 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1203 return true;
1204 }
1205
1206 // Otherwise, this is an attempt to redefine a type. That's okay if
1207 // the redefinition is identical to the original. This will be so if
1208 // Existing and T point to the same Type object. In this one case we
1209 // allow the equivalent redefinition.
1210 if (Existing == T) return true; // Yes, it's equal.
1211
1212 // Any other kind of (non-equivalent) redefinition is an error.
Reid Spencer63c34452007-01-05 21:51:07 +00001213 GenerateError("Redefinition of type named '" + Name + "' of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00001214 T->getDescription() + "'");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001215 }
1216
1217 return false;
1218}
1219
1220//===----------------------------------------------------------------------===//
1221// Code for handling upreferences in type names...
1222//
1223
1224// TypeContains - Returns true if Ty directly contains E in it.
1225//
1226static bool TypeContains(const Type *Ty, const Type *E) {
1227 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1228 E) != Ty->subtype_end();
1229}
1230
1231namespace {
1232 struct UpRefRecord {
1233 // NestingLevel - The number of nesting levels that need to be popped before
1234 // this type is resolved.
1235 unsigned NestingLevel;
1236
1237 // LastContainedTy - This is the type at the current binding level for the
1238 // type. Every time we reduce the nesting level, this gets updated.
1239 const Type *LastContainedTy;
1240
1241 // UpRefTy - This is the actual opaque type that the upreference is
1242 // represented with.
1243 OpaqueType *UpRefTy;
1244
1245 UpRefRecord(unsigned NL, OpaqueType *URTy)
1246 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1247 };
1248}
1249
1250// UpRefs - A list of the outstanding upreferences that need to be resolved.
1251static std::vector<UpRefRecord> UpRefs;
1252
1253/// HandleUpRefs - Every time we finish a new layer of types, this function is
1254/// called. It loops through the UpRefs vector, which is a list of the
1255/// currently active types. For each type, if the up reference is contained in
1256/// the newly completed type, we decrement the level count. When the level
1257/// count reaches zero, the upreferenced type is the type that is passed in:
1258/// thus we can complete the cycle.
1259///
1260static PATypeHolder HandleUpRefs(const Type *ty) {
Chris Lattner224f84f2006-08-18 17:34:45 +00001261 // If Ty isn't abstract, or if there are no up-references in it, then there is
1262 // nothing to resolve here.
1263 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1264
Reid Spencer68a24bd2005-08-27 18:50:39 +00001265 PATypeHolder Ty(ty);
1266 UR_OUT("Type '" << Ty->getDescription() <<
1267 "' newly formed. Resolving upreferences.\n" <<
1268 UpRefs.size() << " upreferences active!\n");
1269
1270 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1271 // to zero), we resolve them all together before we resolve them to Ty. At
1272 // the end of the loop, if there is anything to resolve to Ty, it will be in
1273 // this variable.
1274 OpaqueType *TypeToResolve = 0;
1275
1276 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1277 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1278 << UpRefs[i].second->getDescription() << ") = "
1279 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1280 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1281 // Decrement level of upreference
1282 unsigned Level = --UpRefs[i].NestingLevel;
1283 UpRefs[i].LastContainedTy = Ty;
1284 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1285 if (Level == 0) { // Upreference should be resolved!
1286 if (!TypeToResolve) {
1287 TypeToResolve = UpRefs[i].UpRefTy;
1288 } else {
1289 UR_OUT(" * Resolving upreference for "
1290 << UpRefs[i].second->getDescription() << "\n";
1291 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1292 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1293 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1294 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1295 }
1296 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1297 --i; // Do not skip the next element...
1298 }
1299 }
1300 }
1301
1302 if (TypeToResolve) {
1303 UR_OUT(" * Resolving upreference for "
1304 << UpRefs[i].second->getDescription() << "\n";
1305 std::string OldName = TypeToResolve->getDescription());
1306 TypeToResolve->refineAbstractTypeTo(Ty);
1307 }
1308
1309 return Ty;
1310}
1311
Reid Spencer68a24bd2005-08-27 18:50:39 +00001312//===----------------------------------------------------------------------===//
1313// RunVMAsmParser - Define an interface to this parser
1314//===----------------------------------------------------------------------===//
1315//
Reid Spencer14310612006-12-31 05:40:51 +00001316static Module* RunParser(Module * M);
1317
Duncan Sandsdc024672007-11-27 13:23:08 +00001318Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1319 InitLLLexer(MB);
1320 Module *M = RunParser(new Module(LLLgetFilename()));
1321 FreeLexer();
1322 return M;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001323}
1324
1325
Dan Gohmanf4423b12008-04-19 00:24:39 +00001326
1327/* Enabling traces. */
1328#ifndef YYDEBUG
1329# define YYDEBUG 0
1330#endif
1331
1332/* Enabling verbose error messages. */
1333#ifdef YYERROR_VERBOSE
1334# undef YYERROR_VERBOSE
1335# define YYERROR_VERBOSE 1
1336#else
1337# define YYERROR_VERBOSE 0
1338#endif
1339
1340/* Enabling the token table. */
1341#ifndef YYTOKEN_TABLE
1342# define YYTOKEN_TABLE 0
1343#endif
1344
1345#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1346typedef union YYSTYPE
Dan Gohmane4977cf2008-05-23 01:55:30 +00001347#line 949 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00001348{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001349 llvm::Module *ModuleVal;
1350 llvm::Function *FunctionVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001351 llvm::BasicBlock *BasicBlockVal;
1352 llvm::TerminatorInst *TermInstVal;
1353 llvm::Instruction *InstVal;
Reid Spencera132e042006-12-03 05:46:11 +00001354 llvm::Constant *ConstVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001355
Reid Spencera132e042006-12-03 05:46:11 +00001356 const llvm::Type *PrimType;
Reid Spencer14310612006-12-31 05:40:51 +00001357 std::list<llvm::PATypeHolder> *TypeList;
Reid Spencera132e042006-12-03 05:46:11 +00001358 llvm::PATypeHolder *TypeVal;
1359 llvm::Value *ValueVal;
Reid Spencera132e042006-12-03 05:46:11 +00001360 std::vector<llvm::Value*> *ValueList;
Reid Spencer14310612006-12-31 05:40:51 +00001361 llvm::ArgListType *ArgList;
1362 llvm::TypeWithAttrs TypeWithAttrs;
1363 llvm::TypeWithAttrsList *TypeWithAttrsList;
Dale Johanneseneb57ea72007-11-05 21:20:28 +00001364 llvm::ParamList *ParamList;
Reid Spencer14310612006-12-31 05:40:51 +00001365
Reid Spencer68a24bd2005-08-27 18:50:39 +00001366 // Represent the RHS of PHI node
Reid Spencera132e042006-12-03 05:46:11 +00001367 std::list<std::pair<llvm::Value*,
1368 llvm::BasicBlock*> > *PHIList;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001369 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
Reid Spencera132e042006-12-03 05:46:11 +00001370 std::vector<llvm::Constant*> *ConstVector;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001371
1372 llvm::GlobalValue::LinkageTypes Linkage;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001373 llvm::GlobalValue::VisibilityTypes Visibility;
Dale Johannesen222ebf72008-02-19 21:40:51 +00001374 llvm::ParameterAttributes ParamAttrs;
Reid Spencer38c91a92007-02-28 02:24:54 +00001375 llvm::APInt *APIntVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001376 int64_t SInt64Val;
1377 uint64_t UInt64Val;
1378 int SIntVal;
1379 unsigned UIntVal;
Dale Johannesencdd509a2007-09-07 21:07:57 +00001380 llvm::APFloat *FPVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001381 bool BoolVal;
1382
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001383 std::string *StrVal; // This memory must be deleted
1384 llvm::ValID ValIDVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001385
Reid Spencera132e042006-12-03 05:46:11 +00001386 llvm::Instruction::BinaryOps BinaryOpVal;
1387 llvm::Instruction::TermOps TermOpVal;
1388 llvm::Instruction::MemoryOps MemOpVal;
1389 llvm::Instruction::CastOps CastOpVal;
1390 llvm::Instruction::OtherOps OtherOpVal;
Reid Spencera132e042006-12-03 05:46:11 +00001391 llvm::ICmpInst::Predicate IPredicate;
1392 llvm::FCmpInst::Predicate FPredicate;
Dan Gohmanf4423b12008-04-19 00:24:39 +00001393}
1394/* Line 193 of yacc.c. */
Dan Gohmane4977cf2008-05-23 01:55:30 +00001395#line 1396 "llvmAsmParser.tab.c"
Dan Gohmanf4423b12008-04-19 00:24:39 +00001396 YYSTYPE;
1397# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1398# define YYSTYPE_IS_DECLARED 1
1399# define YYSTYPE_IS_TRIVIAL 1
Reid Spencer68a24bd2005-08-27 18:50:39 +00001400#endif
1401
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001402
Reid Spencer68a24bd2005-08-27 18:50:39 +00001403
Dan Gohmanf4423b12008-04-19 00:24:39 +00001404/* Copy the second part of user declarations. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001405
1406
Dan Gohmanf4423b12008-04-19 00:24:39 +00001407/* Line 216 of yacc.c. */
Dan Gohmane4977cf2008-05-23 01:55:30 +00001408#line 1409 "llvmAsmParser.tab.c"
Reid Spencerb8f85052007-07-31 03:50:36 +00001409
Dan Gohmanf4423b12008-04-19 00:24:39 +00001410#ifdef short
1411# undef short
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001412#endif
1413
Dan Gohmanf4423b12008-04-19 00:24:39 +00001414#ifdef YYTYPE_UINT8
1415typedef YYTYPE_UINT8 yytype_uint8;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001416#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00001417typedef unsigned char yytype_uint8;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001418#endif
1419
Dan Gohmanf4423b12008-04-19 00:24:39 +00001420#ifdef YYTYPE_INT8
1421typedef YYTYPE_INT8 yytype_int8;
1422#elif (defined __STDC__ || defined __C99__FUNC__ \
1423 || defined __cplusplus || defined _MSC_VER)
1424typedef signed char yytype_int8;
1425#else
1426typedef short int yytype_int8;
1427#endif
1428
1429#ifdef YYTYPE_UINT16
1430typedef YYTYPE_UINT16 yytype_uint16;
1431#else
1432typedef unsigned short int yytype_uint16;
1433#endif
1434
1435#ifdef YYTYPE_INT16
1436typedef YYTYPE_INT16 yytype_int16;
1437#else
1438typedef short int yytype_int16;
1439#endif
1440
1441#ifndef YYSIZE_T
1442# ifdef __SIZE_TYPE__
1443# define YYSIZE_T __SIZE_TYPE__
1444# elif defined size_t
1445# define YYSIZE_T size_t
1446# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1447 || defined __cplusplus || defined _MSC_VER)
1448# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1449# define YYSIZE_T size_t
1450# else
1451# define YYSIZE_T unsigned int
1452# endif
1453#endif
1454
1455#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1456
1457#ifndef YY_
1458# if defined YYENABLE_NLS && YYENABLE_NLS
1459# if ENABLE_NLS
1460# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1461# define YY_(msgid) dgettext ("bison-runtime", msgid)
1462# endif
1463# endif
1464# ifndef YY_
1465# define YY_(msgid) msgid
1466# endif
1467#endif
1468
1469/* Suppress unused-variable warnings by "using" E. */
1470#if ! defined lint || defined __GNUC__
1471# define YYUSE(e) ((void) (e))
1472#else
1473# define YYUSE(e) /* empty */
1474#endif
1475
1476/* Identity function, used to suppress warnings about constant conditions. */
1477#ifndef lint
1478# define YYID(n) (n)
1479#else
1480#if (defined __STDC__ || defined __C99__FUNC__ \
1481 || defined __cplusplus || defined _MSC_VER)
1482static int
1483YYID (int i)
1484#else
1485static int
1486YYID (i)
1487 int i;
1488#endif
1489{
1490 return i;
1491}
1492#endif
1493
1494#if ! defined yyoverflow || YYERROR_VERBOSE
1495
1496/* The parser invokes alloca or malloc; define the necessary symbols. */
1497
1498# ifdef YYSTACK_USE_ALLOCA
1499# if YYSTACK_USE_ALLOCA
1500# ifdef __GNUC__
1501# define YYSTACK_ALLOC __builtin_alloca
1502# elif defined __BUILTIN_VA_ARG_INCR
1503# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1504# elif defined _AIX
1505# define YYSTACK_ALLOC __alloca
1506# elif defined _MSC_VER
1507# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1508# define alloca _alloca
1509# else
1510# define YYSTACK_ALLOC alloca
1511# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1512 || defined __cplusplus || defined _MSC_VER)
1513# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1514# ifndef _STDLIB_H
1515# define _STDLIB_H 1
1516# endif
1517# endif
1518# endif
1519# endif
1520# endif
1521
1522# ifdef YYSTACK_ALLOC
1523 /* Pacify GCC's `empty if-body' warning. */
1524# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1525# ifndef YYSTACK_ALLOC_MAXIMUM
1526 /* The OS might guarantee only one guard page at the bottom of the stack,
1527 and a page size can be as small as 4096 bytes. So we cannot safely
1528 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1529 to allow for a few compiler-allocated temporary stack slots. */
1530# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1531# endif
1532# else
1533# define YYSTACK_ALLOC YYMALLOC
1534# define YYSTACK_FREE YYFREE
1535# ifndef YYSTACK_ALLOC_MAXIMUM
1536# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1537# endif
1538# if (defined __cplusplus && ! defined _STDLIB_H \
1539 && ! ((defined YYMALLOC || defined malloc) \
1540 && (defined YYFREE || defined free)))
1541# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1542# ifndef _STDLIB_H
1543# define _STDLIB_H 1
1544# endif
1545# endif
1546# ifndef YYMALLOC
1547# define YYMALLOC malloc
1548# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1549 || defined __cplusplus || defined _MSC_VER)
1550void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1551# endif
1552# endif
1553# ifndef YYFREE
1554# define YYFREE free
1555# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1556 || defined __cplusplus || defined _MSC_VER)
1557void free (void *); /* INFRINGES ON USER NAME SPACE */
1558# endif
1559# endif
1560# endif
1561#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1562
1563
1564#if (! defined yyoverflow \
1565 && (! defined __cplusplus \
1566 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1567
1568/* A type that is properly aligned for any stack member. */
1569union yyalloc
1570{
1571 yytype_int16 yyss;
1572 YYSTYPE yyvs;
1573 };
1574
1575/* The size of the maximum gap between one aligned stack and the next. */
1576# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1577
1578/* The size of an array large to enough to hold all stacks, each with
1579 N elements. */
1580# define YYSTACK_BYTES(N) \
1581 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1582 + YYSTACK_GAP_MAXIMUM)
1583
1584/* Copy COUNT objects from FROM to TO. The source and destination do
1585 not overlap. */
1586# ifndef YYCOPY
1587# if defined __GNUC__ && 1 < __GNUC__
1588# define YYCOPY(To, From, Count) \
1589 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1590# else
1591# define YYCOPY(To, From, Count) \
1592 do \
1593 { \
1594 YYSIZE_T yyi; \
1595 for (yyi = 0; yyi < (Count); yyi++) \
1596 (To)[yyi] = (From)[yyi]; \
1597 } \
1598 while (YYID (0))
1599# endif
1600# endif
1601
1602/* Relocate STACK from its old location to the new one. The
1603 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1604 elements in the stack, and YYPTR gives the new location of the
1605 stack. Advance YYPTR to a properly aligned location for the next
1606 stack. */
1607# define YYSTACK_RELOCATE(Stack) \
1608 do \
1609 { \
1610 YYSIZE_T yynewbytes; \
1611 YYCOPY (&yyptr->Stack, Stack, yysize); \
1612 Stack = &yyptr->Stack; \
1613 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1614 yyptr += yynewbytes / sizeof (*yyptr); \
1615 } \
1616 while (YYID (0))
1617
1618#endif
1619
1620/* YYFINAL -- State number of the termination state. */
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001621#define YYFINAL 44
Dan Gohmanf4423b12008-04-19 00:24:39 +00001622/* YYLAST -- Last index in YYTABLE. */
Dan Gohmane4977cf2008-05-23 01:55:30 +00001623#define YYLAST 2144
Dan Gohmanf4423b12008-04-19 00:24:39 +00001624
1625/* YYNTOKENS -- Number of terminals. */
Dan Gohmane4977cf2008-05-23 01:55:30 +00001626#define YYNTOKENS 170
Dan Gohmanf4423b12008-04-19 00:24:39 +00001627/* YYNNTS -- Number of nonterminals. */
1628#define YYNNTS 85
1629/* YYNRULES -- Number of rules. */
Dan Gohmane4977cf2008-05-23 01:55:30 +00001630#define YYNRULES 331
Dan Gohmanf4423b12008-04-19 00:24:39 +00001631/* YYNRULES -- Number of states. */
Dan Gohmane4977cf2008-05-23 01:55:30 +00001632#define YYNSTATES 679
Dan Gohmanf4423b12008-04-19 00:24:39 +00001633
1634/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1635#define YYUNDEFTOK 2
Dan Gohmane4977cf2008-05-23 01:55:30 +00001636#define YYMAXUTOK 410
Dan Gohmanf4423b12008-04-19 00:24:39 +00001637
1638#define YYTRANSLATE(YYX) \
1639 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1640
1641/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1642static const yytype_uint8 yytranslate[] =
1643{
1644 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1645 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1646 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1647 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001648 156, 157, 160, 2, 159, 2, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001649 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001650 165, 158, 166, 2, 2, 2, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001651 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 2, 162, 161, 164, 2, 2, 2, 2, 2, 169,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001654 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1655 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001656 163, 2, 2, 167, 2, 168, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001657 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1658 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1659 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1660 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1661 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1662 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, 1, 2, 3, 4,
1670 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1671 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1672 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1673 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1674 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1675 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1676 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1677 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1678 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1679 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1680 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1681 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1682 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1683 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001684 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
1685 155
Dan Gohmanf4423b12008-04-19 00:24:39 +00001686};
1687
1688#if YYDEBUG
1689/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1690 YYRHS. */
1691static const yytype_uint16 yyprhs[] =
1692{
1693 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1694 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1695 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1696 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1697 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1698 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1699 119, 121, 123, 125, 127, 129, 130, 135, 136, 139,
1700 140, 142, 144, 146, 147, 150, 152, 154, 156, 158,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001701 160, 162, 164, 166, 168, 169, 171, 173, 175, 176,
1702 178, 180, 181, 183, 185, 187, 189, 190, 192, 194,
1703 195, 197, 199, 201, 203, 205, 208, 210, 212, 214,
1704 216, 218, 220, 222, 224, 226, 229, 230, 233, 235,
1705 237, 239, 241, 243, 245, 246, 249, 250, 253, 254,
1706 257, 258, 262, 265, 266, 268, 269, 273, 275, 278,
1707 280, 282, 284, 286, 288, 290, 292, 294, 296, 300,
1708 302, 305, 311, 317, 323, 329, 333, 336, 342, 347,
1709 350, 352, 354, 356, 360, 362, 366, 368, 369, 371,
1710 375, 380, 384, 388, 393, 398, 402, 409, 415, 418,
1711 421, 424, 427, 430, 433, 436, 439, 442, 445, 448,
1712 451, 458, 464, 473, 480, 487, 495, 503, 511, 519,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001713 526, 535, 544, 550, 558, 562, 564, 566, 568, 570,
1714 571, 574, 581, 583, 584, 586, 589, 590, 594, 595,
1715 599, 603, 607, 611, 612, 621, 622, 632, 633, 643,
1716 649, 652, 656, 658, 662, 666, 670, 674, 676, 677,
1717 683, 687, 689, 693, 695, 696, 707, 709, 711, 716,
1718 718, 720, 723, 727, 728, 730, 732, 734, 736, 738,
1719 740, 742, 744, 746, 750, 752, 758, 760, 762, 764,
1720 766, 768, 770, 773, 775, 779, 782, 785, 789, 792,
1721 793, 795, 798, 801, 805, 815, 825, 834, 849, 851,
1722 853, 860, 866, 869, 876, 884, 889, 894, 901, 908,
1723 909, 910, 914, 917, 919, 925, 931, 938, 945, 952,
1724 959, 964, 971, 976, 981, 988, 995, 998, 1007, 1009,
1725 1011, 1012, 1016, 1023, 1027, 1034, 1037, 1043, 1051, 1057,
1726 1062, 1067
Dan Gohmanf4423b12008-04-19 00:24:39 +00001727};
1728
1729/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1730static const yytype_int16 yyrhs[] =
1731{
Dan Gohmane4977cf2008-05-23 01:55:30 +00001732 216, 0, -1, 75, -1, 76, -1, 77, -1, 78,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001733 -1, 79, -1, 80, -1, 81, -1, 82, -1, 83,
1734 -1, 87, -1, 88, -1, 89, -1, 84, -1, 85,
1735 -1, 86, -1, 120, -1, 121, -1, 122, -1, 123,
1736 -1, 124, -1, 125, -1, 126, -1, 127, -1, 128,
1737 -1, 129, -1, 130, -1, 131, -1, 94, -1, 95,
1738 -1, 96, -1, 97, -1, 98, -1, 99, -1, 100,
1739 -1, 101, -1, 102, -1, 103, -1, 104, -1, 105,
1740 -1, 106, -1, 107, -1, 108, -1, 109, -1, 110,
1741 -1, 111, -1, 112, -1, 113, -1, 100, -1, 101,
1742 -1, 102, -1, 103, -1, 26, -1, 27, -1, 11,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001743 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001744 -1, 19, -1, 22, -1, 24, -1, 178, -1, -1,
1745 55, 156, 4, 157, -1, -1, 178, 158, -1, -1,
1746 20, -1, 23, -1, 184, -1, -1, 182, 158, -1,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001747 42, -1, 44, -1, 43, -1, 45, -1, 47, -1,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001748 49, -1, 46, -1, 48, -1, 51, -1, -1, 153,
1749 -1, 154, -1, 155, -1, -1, 46, -1, 48, -1,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001750 -1, 42, -1, 43, -1, 44, -1, 47, -1, -1,
1751 44, -1, 42, -1, -1, 63, -1, 64, -1, 65,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001752 -1, 66, -1, 67, -1, 62, 4, -1, 142, -1,
1753 121, -1, 141, -1, 122, -1, 144, -1, 145, -1,
1754 147, -1, 148, -1, 149, -1, 54, 4, -1, -1,
1755 193, 192, -1, 143, -1, 146, -1, 142, -1, 141,
1756 -1, 150, -1, 151, -1, -1, 195, 194, -1, -1,
1757 152, 22, -1, -1, 54, 4, -1, -1, 159, 54,
1758 4, -1, 34, 22, -1, -1, 199, -1, -1, 159,
1759 202, 201, -1, 199, -1, 54, 4, -1, 11, -1,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001760 12, -1, 13, -1, 16, -1, 15, -1, 14, -1,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001761 17, -1, 50, -1, 203, -1, 204, 180, 160, -1,
1762 238, -1, 161, 4, -1, 204, 156, 208, 157, 195,
1763 -1, 10, 156, 208, 157, 195, -1, 162, 4, 163,
1764 204, 164, -1, 165, 4, 163, 204, 166, -1, 167,
1765 209, 168, -1, 167, 168, -1, 165, 167, 209, 168,
1766 166, -1, 165, 167, 168, 166, -1, 204, 193, -1,
1767 204, -1, 10, -1, 205, -1, 207, 159, 205, -1,
1768 207, -1, 207, 159, 39, -1, 39, -1, -1, 204,
1769 -1, 209, 159, 204, -1, 204, 162, 212, 164, -1,
1770 204, 162, 164, -1, 204, 169, 22, -1, 204, 165,
1771 212, 166, -1, 204, 167, 212, 168, -1, 204, 167,
1772 168, -1, 204, 165, 167, 212, 168, 166, -1, 204,
1773 165, 167, 168, 166, -1, 204, 40, -1, 204, 41,
1774 -1, 204, 238, -1, 204, 211, -1, 204, 25, -1,
1775 176, 3, -1, 176, 5, -1, 176, 4, -1, 176,
1776 6, -1, 11, 26, -1, 11, 27, -1, 177, 9,
1777 -1, 173, 156, 210, 38, 204, 157, -1, 119, 156,
1778 210, 250, 157, -1, 133, 156, 210, 159, 210, 159,
1779 210, 157, -1, 171, 156, 210, 159, 210, 157, -1,
1780 172, 156, 210, 159, 210, 157, -1, 90, 174, 156,
1781 210, 159, 210, 157, -1, 91, 175, 156, 210, 159,
1782 210, 157, -1, 92, 174, 156, 210, 159, 210, 157,
1783 -1, 93, 175, 156, 210, 159, 210, 157, -1, 135,
1784 156, 210, 159, 210, 157, -1, 136, 156, 210, 159,
1785 210, 159, 210, 157, -1, 137, 156, 210, 159, 210,
1786 159, 210, 157, -1, 139, 156, 210, 250, 157, -1,
1787 140, 156, 210, 159, 210, 250, 157, -1, 212, 159,
1788 210, -1, 210, -1, 32, -1, 33, -1, 37, -1,
1789 -1, 206, 238, -1, 125, 156, 215, 38, 204, 157,
1790 -1, 217, -1, -1, 218, -1, 217, 218, -1, -1,
1791 31, 219, 234, -1, -1, 30, 220, 235, -1, 60,
1792 59, 224, -1, 181, 18, 204, -1, 181, 18, 10,
1793 -1, -1, 183, 187, 214, 213, 210, 180, 221, 201,
1794 -1, -1, 183, 185, 187, 214, 213, 210, 180, 222,
1795 201, -1, -1, 183, 186, 187, 214, 213, 204, 180,
1796 223, 201, -1, 183, 187, 35, 190, 215, -1, 52,
1797 225, -1, 56, 158, 226, -1, 22, -1, 53, 158,
1798 22, -1, 68, 158, 22, -1, 162, 227, 164, -1,
1799 227, 159, 22, -1, 22, -1, -1, 228, 159, 204,
1800 193, 179, -1, 204, 193, 179, -1, 228, -1, 228,
1801 159, 39, -1, 39, -1, -1, 191, 206, 182, 156,
1802 229, 157, 195, 200, 197, 196, -1, 28, -1, 167,
1803 -1, 189, 187, 230, 231, -1, 29, -1, 168, -1,
1804 242, 233, -1, 188, 187, 230, -1, -1, 61, -1,
1805 3, -1, 4, -1, 9, -1, 26, -1, 27, -1,
1806 40, -1, 41, -1, 25, -1, 165, 212, 166, -1,
1807 211, -1, 59, 236, 22, 159, 22, -1, 7, -1,
1808 8, -1, 178, -1, 182, -1, 238, -1, 237, -1,
1809 204, 239, -1, 240, -1, 241, 159, 240, -1, 242,
1810 243, -1, 232, 243, -1, 244, 181, 245, -1, 244,
1811 247, -1, -1, 21, -1, 69, 241, -1, 69, 10,
1812 -1, 70, 17, 239, -1, 70, 11, 239, 159, 17,
1813 239, 159, 17, 239, -1, 71, 176, 239, 159, 17,
1814 239, 162, 246, 164, -1, 71, 176, 239, 159, 17,
1815 239, 162, 164, -1, 72, 191, 206, 239, 156, 249,
1816 157, 195, 38, 17, 239, 73, 17, 239, -1, 73,
1817 -1, 74, -1, 246, 176, 237, 159, 17, 239, -1,
1818 176, 237, 159, 17, 239, -1, 181, 252, -1, 204,
1819 162, 239, 159, 239, 164, -1, 248, 159, 162, 239,
1820 159, 239, 164, -1, 204, 193, 239, 193, -1, 17,
1821 193, 239, 193, -1, 249, 159, 204, 193, 239, 193,
1822 -1, 249, 159, 17, 193, 239, 193, -1, -1, -1,
1823 250, 159, 240, -1, 58, 57, -1, 57, -1, 171,
1824 204, 239, 159, 239, -1, 172, 204, 239, 159, 239,
1825 -1, 90, 174, 204, 239, 159, 239, -1, 91, 175,
1826 204, 239, 159, 239, -1, 92, 174, 204, 239, 159,
1827 239, -1, 93, 175, 204, 239, 159, 239, -1, 173,
1828 240, 38, 204, -1, 133, 240, 159, 240, 159, 240,
1829 -1, 134, 240, 159, 204, -1, 135, 240, 159, 240,
1830 -1, 136, 240, 159, 240, 159, 240, -1, 137, 240,
1831 159, 240, 159, 240, -1, 132, 248, -1, 251, 191,
1832 206, 239, 156, 249, 157, 195, -1, 254, -1, 36,
1833 -1, -1, 114, 204, 198, -1, 114, 204, 159, 11,
1834 239, 198, -1, 115, 204, 198, -1, 115, 204, 159,
1835 11, 239, 198, -1, 116, 240, -1, 253, 117, 204,
1836 239, 198, -1, 253, 118, 240, 159, 204, 239, 198,
1837 -1, 138, 204, 239, 159, 4, -1, 119, 204, 239,
1838 250, -1, 139, 204, 239, 250, -1, 140, 204, 239,
1839 159, 204, 239, 250, -1
Dan Gohmanf4423b12008-04-19 00:24:39 +00001840};
1841
1842/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1843static const yytype_uint16 yyrline[] =
1844{
Dan Gohmane4977cf2008-05-23 01:55:30 +00001845 0, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112,
1846 1112, 1113, 1113, 1113, 1113, 1113, 1113, 1114, 1114, 1114,
1847 1114, 1114, 1114, 1115, 1115, 1115, 1115, 1115, 1115, 1118,
1848 1118, 1119, 1119, 1120, 1120, 1121, 1121, 1122, 1122, 1126,
1849 1126, 1127, 1127, 1128, 1128, 1129, 1129, 1130, 1130, 1131,
1850 1131, 1132, 1132, 1133, 1134, 1139, 1140, 1140, 1140, 1140,
1851 1140, 1142, 1142, 1142, 1143, 1143, 1145, 1146, 1150, 1154,
1852 1159, 1159, 1161, 1162, 1167, 1173, 1174, 1175, 1176, 1177,
1853 1178, 1182, 1183, 1184, 1188, 1189, 1190, 1191, 1195, 1196,
1854 1197, 1201, 1202, 1203, 1204, 1205, 1209, 1210, 1211, 1214,
1855 1215, 1216, 1217, 1218, 1219, 1220, 1227, 1228, 1229, 1230,
1856 1231, 1232, 1233, 1234, 1235, 1236, 1240, 1241, 1246, 1247,
1857 1248, 1249, 1250, 1251, 1254, 1255, 1260, 1261, 1268, 1269,
1858 1275, 1276, 1285, 1293, 1294, 1299, 1300, 1301, 1306, 1319,
1859 1319, 1319, 1319, 1319, 1319, 1319, 1322, 1326, 1330, 1337,
1860 1342, 1350, 1379, 1404, 1409, 1419, 1429, 1433, 1443, 1450,
1861 1459, 1466, 1471, 1476, 1483, 1484, 1491, 1498, 1506, 1512,
1862 1524, 1552, 1568, 1595, 1623, 1649, 1669, 1695, 1715, 1727,
1863 1734, 1800, 1810, 1820, 1826, 1836, 1842, 1852, 1857, 1862,
1864 1875, 1887, 1908, 1916, 1922, 1933, 1938, 1943, 1948, 1953,
1865 1959, 1965, 1971, 1992, 2016, 2020, 2028, 2028, 2031, 2031,
1866 2034, 2046, 2067, 2072, 2080, 2081, 2085, 2085, 2089, 2089,
1867 2092, 2095, 2119, 2131, 2130, 2142, 2141, 2151, 2150, 2161,
1868 2201, 2204, 2210, 2220, 2224, 2229, 2231, 2236, 2241, 2250,
1869 2260, 2271, 2275, 2284, 2293, 2298, 2427, 2427, 2429, 2438,
1870 2438, 2440, 2445, 2457, 2461, 2466, 2470, 2474, 2478, 2482,
1871 2486, 2490, 2494, 2498, 2523, 2527, 2537, 2541, 2545, 2550,
1872 2557, 2557, 2563, 2572, 2577, 2582, 2586, 2595, 2604, 2613,
1873 2617, 2625, 2632, 2636, 2641, 2651, 2670, 2679, 2765, 2769,
1874 2776, 2787, 2800, 2810, 2821, 2831, 2842, 2850, 2860, 2867,
1875 2870, 2871, 2878, 2882, 2887, 2903, 2920, 2934, 2948, 2962,
1876 2976, 2988, 2996, 3003, 3009, 3015, 3021, 3036, 3126, 3131,
1877 3135, 3142, 3149, 3157, 3164, 3172, 3180, 3194, 3211, 3219,
1878 3234, 3249
Dan Gohmanf4423b12008-04-19 00:24:39 +00001879};
1880#endif
1881
1882#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1883/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1884 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1885static const char *const yytname[] =
1886{
1887 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1888 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1889 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1890 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1891 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1892 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1893 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1894 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001895 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "COMMON", "OPAQUE",
Dan Gohmanf4423b12008-04-19 00:24:39 +00001896 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1897 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1898 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
Chris Lattnercc81d152008-05-04 17:18:47 +00001899 "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE",
1900 "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM",
Nate Begemanac80ade2008-05-12 19:01:56 +00001901 "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "VICMP",
1902 "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
1903 "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1904 "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1905 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1906 "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1907 "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
Dan Gohmane4977cf2008-05-23 01:55:30 +00001908 "GETRESULT", "EXTRACTVALUE", "INSERTVALUE", "SIGNEXT", "ZEROEXT",
1909 "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL", "NEST",
1910 "READNONE", "READONLY", "GC", "DEFAULT", "HIDDEN", "PROTECTED", "'('",
1911 "')'", "'='", "','", "'*'", "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'",
1912 "'{'", "'}'", "'c'", "$accept", "ArithmeticOps", "LogicalOps", "CastOps",
1913 "IPredicates", "FPredicates", "IntType", "FPType", "LocalName",
1914 "OptLocalName", "OptAddrSpace", "OptLocalAssign", "GlobalName",
1915 "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
1916 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1917 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr",
1918 "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign",
1919 "OptCAlign", "SectionString", "OptSection", "GlobalVarAttributes",
Dan Gohmanf4423b12008-04-19 00:24:39 +00001920 "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
1921 "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
1922 "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
1923 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1924 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1925 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1926 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1927 "SymbolicValueRef", "ValueRef", "ResolvedVal", "ReturnedVal",
1928 "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst",
1929 "JumpTable", "Inst", "PHIList", "ParamList", "IndexList", "OptTailCall",
1930 "InstVal", "OptVolatile", "MemoryInst", 0
1931};
1932#endif
1933
1934# ifdef YYPRINT
1935/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1936 token YYLEX-NUM. */
1937static const yytype_uint16 yytoknum[] =
1938{
1939 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1940 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1941 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1942 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1943 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1944 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1945 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1946 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1947 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1948 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1949 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1950 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1951 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1952 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1953 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001954 405, 406, 407, 408, 409, 410, 40, 41, 61, 44,
1955 42, 92, 91, 120, 93, 60, 62, 123, 125, 99
Dan Gohmanf4423b12008-04-19 00:24:39 +00001956};
1957# endif
1958
1959/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1960static const yytype_uint8 yyr1[] =
1961{
Dan Gohmane4977cf2008-05-23 01:55:30 +00001962 0, 170, 171, 171, 171, 171, 171, 171, 171, 171,
1963 171, 172, 172, 172, 172, 172, 172, 173, 173, 173,
1964 173, 173, 173, 173, 173, 173, 173, 173, 173, 174,
1965 174, 174, 174, 174, 174, 174, 174, 174, 174, 175,
1966 175, 175, 175, 175, 175, 175, 175, 175, 175, 175,
1967 175, 175, 175, 175, 175, 176, 177, 177, 177, 177,
1968 177, 178, 178, 178, 179, 179, 180, 180, 181, 181,
1969 182, 182, 183, 183, 184, 185, 185, 185, 185, 185,
1970 185, 186, 186, 186, 187, 187, 187, 187, 188, 188,
1971 188, 189, 189, 189, 189, 189, 190, 190, 190, 191,
1972 191, 191, 191, 191, 191, 191, 192, 192, 192, 192,
1973 192, 192, 192, 192, 192, 192, 193, 193, 194, 194,
1974 194, 194, 194, 194, 195, 195, 196, 196, 197, 197,
1975 198, 198, 199, 200, 200, 201, 201, 202, 202, 203,
1976 203, 203, 203, 203, 203, 203, 204, 204, 204, 204,
1977 204, 204, 204, 204, 204, 204, 204, 204, 204, 205,
1978 206, 206, 207, 207, 208, 208, 208, 208, 209, 209,
1979 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
1980 210, 210, 210, 210, 210, 210, 210, 210, 210, 210,
1981 211, 211, 211, 211, 211, 211, 211, 211, 211, 211,
1982 211, 211, 211, 211, 212, 212, 213, 213, 214, 214,
1983 215, 215, 216, 216, 217, 217, 219, 218, 220, 218,
1984 218, 218, 218, 221, 218, 222, 218, 223, 218, 218,
1985 218, 218, 224, 225, 225, 226, 227, 227, 227, 228,
1986 228, 229, 229, 229, 229, 230, 231, 231, 232, 233,
1987 233, 234, 235, 236, 236, 237, 237, 237, 237, 237,
1988 237, 237, 237, 237, 237, 237, 238, 238, 238, 238,
1989 239, 239, 240, 241, 241, 242, 242, 243, 244, 244,
1990 244, 245, 245, 245, 245, 245, 245, 245, 245, 245,
1991 246, 246, 247, 248, 248, 249, 249, 249, 249, 249,
1992 250, 250, 251, 251, 252, 252, 252, 252, 252, 252,
1993 252, 252, 252, 252, 252, 252, 252, 252, 252, 253,
1994 253, 254, 254, 254, 254, 254, 254, 254, 254, 254,
1995 254, 254
Dan Gohmanf4423b12008-04-19 00:24:39 +00001996};
1997
1998/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1999static const yytype_uint8 yyr2[] =
2000{
2001 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
2002 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2003 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2004 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2005 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2006 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2007 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
2008 1, 1, 1, 0, 2, 1, 1, 1, 1, 1,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002009 1, 1, 1, 1, 0, 1, 1, 1, 0, 1,
2010 1, 0, 1, 1, 1, 1, 0, 1, 1, 0,
2011 1, 1, 1, 1, 1, 2, 1, 1, 1, 1,
2012 1, 1, 1, 1, 1, 2, 0, 2, 1, 1,
2013 1, 1, 1, 1, 0, 2, 0, 2, 0, 2,
2014 0, 3, 2, 0, 1, 0, 3, 1, 2, 1,
2015 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
2016 2, 5, 5, 5, 5, 3, 2, 5, 4, 2,
2017 1, 1, 1, 3, 1, 3, 1, 0, 1, 3,
2018 4, 3, 3, 4, 4, 3, 6, 5, 2, 2,
2019 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2020 6, 5, 8, 6, 6, 7, 7, 7, 7, 6,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002021 8, 8, 5, 7, 3, 1, 1, 1, 1, 0,
2022 2, 6, 1, 0, 1, 2, 0, 3, 0, 3,
2023 3, 3, 3, 0, 8, 0, 9, 0, 9, 5,
2024 2, 3, 1, 3, 3, 3, 3, 1, 0, 5,
2025 3, 1, 3, 1, 0, 10, 1, 1, 4, 1,
2026 1, 2, 3, 0, 1, 1, 1, 1, 1, 1,
2027 1, 1, 1, 3, 1, 5, 1, 1, 1, 1,
2028 1, 1, 2, 1, 3, 2, 2, 3, 2, 0,
2029 1, 2, 2, 3, 9, 9, 8, 14, 1, 1,
2030 6, 5, 2, 6, 7, 4, 4, 6, 6, 0,
2031 0, 3, 2, 1, 5, 5, 6, 6, 6, 6,
2032 4, 6, 4, 4, 6, 6, 2, 8, 1, 1,
2033 0, 3, 6, 3, 6, 2, 5, 7, 5, 4,
2034 4, 7
Dan Gohmanf4423b12008-04-19 00:24:39 +00002035};
2036
2037/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2038 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2039 means the default is an error. */
2040static const yytype_uint16 yydefact[] =
2041{
Dan Gohmane4977cf2008-05-23 01:55:30 +00002042 73, 61, 70, 62, 71, 63, 218, 216, 0, 0,
2043 0, 0, 0, 0, 84, 72, 0, 73, 214, 88,
2044 91, 0, 0, 230, 0, 0, 68, 0, 74, 75,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002045 77, 76, 78, 81, 79, 82, 80, 83, 85, 86,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002046 87, 84, 84, 209, 1, 215, 89, 90, 84, 219,
2047 92, 93, 94, 95, 84, 279, 217, 279, 0, 0,
2048 238, 231, 232, 220, 266, 267, 222, 139, 140, 141,
2049 144, 143, 142, 145, 146, 0, 0, 0, 0, 268,
2050 269, 147, 221, 149, 209, 209, 96, 208, 0, 99,
2051 99, 280, 276, 69, 249, 250, 251, 275, 233, 234,
2052 237, 0, 167, 150, 0, 0, 0, 0, 156, 168,
2053 0, 0, 167, 0, 0, 0, 98, 97, 0, 206,
2054 207, 0, 0, 100, 101, 102, 103, 104, 0, 252,
2055 0, 320, 278, 0, 235, 166, 116, 162, 164, 0,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002056 0, 0, 0, 0, 0, 155, 0, 0, 148, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002057 0, 161, 0, 160, 0, 229, 139, 140, 141, 144,
2058 143, 142, 0, 0, 67, 67, 105, 0, 246, 247,
2059 248, 319, 303, 0, 0, 0, 0, 99, 288, 289,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002060 2, 3, 4, 5, 6, 7, 8, 9, 10, 14,
2061 15, 16, 11, 12, 13, 0, 0, 0, 0, 0,
2062 0, 0, 0, 17, 18, 19, 20, 21, 22, 23,
2063 24, 25, 26, 27, 28, 0, 0, 0, 0, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002064 0, 0, 0, 0, 0, 0, 0, 277, 99, 292,
2065 0, 318, 236, 159, 0, 124, 67, 67, 158, 0,
2066 169, 0, 124, 67, 67, 0, 210, 187, 188, 183,
2067 185, 184, 186, 189, 182, 178, 179, 0, 0, 0,
Nate Begemanac80ade2008-05-12 19:01:56 +00002068 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002069 0, 0, 0, 0, 0, 181, 180, 223, 0, 302,
2070 282, 67, 273, 281, 0, 0, 55, 0, 0, 29,
2071 30, 31, 32, 33, 34, 35, 36, 37, 38, 0,
2072 53, 54, 49, 50, 51, 52, 39, 40, 41, 42,
2073 43, 44, 45, 46, 47, 48, 0, 0, 0, 130,
2074 130, 325, 67, 67, 316, 0, 0, 0, 0, 0,
2075 67, 67, 67, 67, 67, 0, 0, 0, 0, 0,
2076 107, 109, 108, 106, 110, 111, 112, 113, 114, 117,
2077 165, 163, 152, 153, 154, 157, 66, 151, 225, 227,
2078 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2079 0, 0, 171, 205, 0, 0, 0, 175, 0, 172,
2080 0, 0, 0, 135, 244, 255, 256, 257, 262, 258,
2081 259, 260, 261, 253, 0, 264, 271, 270, 272, 0,
2082 0, 283, 0, 0, 67, 67, 67, 67, 0, 321,
2083 0, 323, 300, 0, 0, 0, 0, 0, 0, 0,
2084 0, 300, 0, 0, 0, 0, 0, 67, 0, 115,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002085 121, 120, 118, 119, 122, 123, 125, 135, 135, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002086 0, 0, 0, 0, 300, 0, 0, 0, 0, 300,
2087 0, 0, 170, 156, 168, 0, 173, 174, 0, 0,
2088 0, 0, 224, 243, 116, 241, 0, 254, 0, 0,
2089 274, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2090 0, 329, 0, 0, 0, 312, 313, 0, 0, 0,
2091 330, 0, 0, 0, 310, 0, 130, 0, 226, 228,
2092 67, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2093 0, 0, 204, 177, 0, 0, 0, 0, 0, 0,
2094 137, 135, 65, 0, 124, 0, 263, 0, 0, 299,
2095 0, 0, 0, 0, 130, 131, 130, 0, 0, 0,
2096 0, 0, 0, 328, 67, 304, 305, 299, 0, 326,
2097 67, 211, 0, 0, 0, 0, 191, 0, 0, 0,
2098 0, 202, 300, 176, 0, 0, 67, 132, 138, 136,
2099 64, 240, 242, 116, 133, 0, 0, 0, 116, 116,
2100 0, 306, 307, 308, 309, 322, 324, 301, 0, 0,
2101 311, 314, 315, 300, 0, 130, 0, 0, 0, 0,
2102 0, 199, 0, 0, 0, 193, 194, 190, 65, 134,
2103 128, 265, 0, 0, 0, 0, 124, 0, 293, 0,
2104 331, 124, 327, 195, 196, 197, 198, 0, 0, 0,
2105 203, 239, 0, 126, 0, 286, 0, 0, 107, 109,
2106 116, 116, 0, 116, 116, 294, 317, 192, 200, 201,
2107 129, 0, 245, 284, 0, 285, 0, 296, 295, 0,
2108 0, 0, 127, 0, 0, 0, 116, 116, 0, 0,
2109 0, 298, 297, 291, 0, 0, 290, 0, 287
Dan Gohmanf4423b12008-04-19 00:24:39 +00002110};
2111
2112/* YYDEFGOTO[NTERM-NUM]. */
2113static const yytype_int16 yydefgoto[] =
2114{
Dan Gohmane4977cf2008-05-23 01:55:30 +00002115 -1, 272, 273, 274, 299, 316, 162, 163, 79, 571,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002116 113, 12, 80, 14, 15, 41, 42, 43, 48, 54,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002117 118, 128, 349, 233, 436, 352, 652, 633, 409, 520,
2118 610, 462, 521, 81, 164, 137, 154, 138, 139, 110,
2119 373, 395, 374, 121, 88, 155, 16, 17, 18, 20,
2120 19, 383, 437, 438, 63, 23, 61, 101, 465, 466,
2121 129, 170, 55, 96, 56, 49, 468, 396, 83, 398,
2122 282, 283, 57, 92, 93, 227, 637, 132, 324, 580,
2123 481, 228, 229, 230, 231
Dan Gohmanf4423b12008-04-19 00:24:39 +00002124};
2125
2126/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2127 STATE-NUM. */
Dan Gohmane4977cf2008-05-23 01:55:30 +00002128#define YYPACT_NINF -578
Dan Gohmanf4423b12008-04-19 00:24:39 +00002129static const yytype_int16 yypact[] =
2130{
Dan Gohmane4977cf2008-05-23 01:55:30 +00002131 348, -578, -578, -578, -578, -578, -578, -578, 42, -145,
2132 -8, -70, 59, -15, -2, -578, 154, 1288, -578, 155,
2133 317, 4, 24, -578, -4, 157, -578, 1678, -578, -578,
2134 -578, -578, -578, -578, -578, -578, -578, -578, -578, -578,
2135 -578, 133, 133, 203, -578, -578, -578, -578, 133, -578,
2136 -578, -578, -578, -578, 133, 183, -578, -5, 191, 194,
2137 204, -578, -578, -578, -578, -578, 73, -578, -578, -578,
2138 -578, -578, -578, -578, -578, 235, 238, 11, 244, -578,
2139 -578, -578, 87, -578, 212, 212, 261, -578, 100, 321,
2140 321, -578, -578, 250, -578, -578, -578, -578, -578, -578,
2141 -578, -47, 50, -578, 102, 107, 787, 73, -578, 87,
2142 -81, 141, 50, 129, 100, 100, -578, -578, 1362, -578,
2143 -578, 1722, 303, -578, -578, -578, -578, -578, 1780, -578,
2144 -17, 2004, -578, 302, -578, -578, 87, -578, 173, 189,
2145 1840, 1840, 181, -61, 1840, -578, 346, 200, -578, 1722,
2146 1840, 73, 195, 87, 294, -578, 79, 360, 365, 371,
2147 372, 385, 272, 388, 1425, 343, -578, 30, -578, -578,
2148 -578, -578, -578, 344, 1858, 220, 391, 321, -578, -578,
2149 -578, -578, -578, -578, -578, -578, -578, -578, -578, -578,
2150 -578, -578, -578, -578, -578, 668, 443, 668, 443, 1840,
2151 1840, 1840, 1840, -578, -578, -578, -578, -578, -578, -578,
2152 -578, -578, -578, -578, -578, 1840, 1840, 1840, 1840, 1840,
2153 1840, 1840, 1840, 1840, 1840, 1840, 1840, -578, 321, -578,
2154 53, -578, -578, 178, 1560, -578, -20, -27, -578, 241,
2155 87, 253, -578, 343, 16, 1362, -578, -578, -578, -578,
2156 -578, -578, -578, -578, -578, -578, -578, 668, 443, 668,
2157 443, 258, 264, 268, 275, 278, 280, 281, 1601, 1887,
2158 1046, 395, 282, 284, 287, -578, -578, -578, 288, -578,
2159 73, 996, -578, 266, 1140, 1140, -578, 1140, 1780, -578,
2160 -578, -578, -578, -578, -578, -578, -578, -578, -578, 1840,
2161 -578, -578, -578, -578, -578, -578, -578, -578, -578, -578,
2162 -578, -578, -578, -578, -578, -578, 1840, 1840, 1840, 68,
2163 85, -578, 996, -25, 271, 286, 289, 290, 291, 299,
2164 996, 996, 996, 996, 996, 408, 1780, 1840, 1840, 455,
2165 -578, -578, -578, -578, -578, -578, -578, -578, -578, -578,
2166 -578, -578, 188, -578, -578, -578, -578, 188, -578, 129,
2167 409, 304, 305, 306, 308, 1722, 1722, 1722, 1722, 1722,
2168 1722, 1722, -578, -578, 89, 1087, -58, -578, -48, -578,
2169 1722, 1722, 1722, 313, 1619, -578, -578, -578, -578, -578,
2170 -578, -578, -578, 412, 1722, -578, -578, -578, -578, 1840,
2171 315, -578, 316, 1140, 996, 996, 996, 996, 27, -578,
2172 37, -578, -578, 1140, 322, 1840, 1840, 1840, 1840, 1840,
2173 319, -578, 324, 326, 327, 1840, 1140, 996, 329, -578,
2174 -578, -578, -578, -578, -578, -578, -578, 313, 313, 1840,
2175 1722, 1722, 1722, 1722, -578, 330, 331, 333, 335, -578,
2176 336, 1722, -578, 332, 1274, -40, -578, -578, 337, 341,
2177 463, 21, -578, -578, 87, 345, 349, -578, 480, 22,
2178 -578, 488, 490, 352, 350, 351, 353, 354, 1140, 513,
2179 1140, 359, 361, 1140, 364, 87, -578, 366, 373, 515,
2180 359, 1840, 1140, 1140, 87, 368, 375, 1840, -578, -578,
2181 -1, 376, 377, 380, 381, 147, 1722, 1722, 1722, 1722,
2182 176, 1722, -578, -578, 392, 1722, 1722, 1840, 519, 538,
2183 -578, 313, 274, 1660, -578, 398, -578, 1140, 1140, 1905,
2184 1140, 1140, 1140, 1140, 375, -578, 375, 1840, 1140, 400,
2185 1840, 1840, 1840, -578, 996, -578, -578, 1905, 506, -578,
2186 996, -578, 1722, 1722, 1722, 1722, -578, 402, 405, 406,
2187 407, -578, -578, -578, 410, 413, 49, -578, -578, -578,
2188 -578, -578, -578, 87, -16, 547, 414, 419, 90, 87,
2189 206, -578, -578, -578, -578, -578, -578, -578, 411, 1140,
2190 -578, -578, -578, -578, 269, 375, 415, 417, 425, 427,
2191 1722, -578, 1722, 1722, 276, -578, -578, -578, 274, -578,
2192 517, -578, 568, 1, 849, 849, -578, 1946, -578, 422,
2193 359, -578, -578, -578, -578, -578, -578, 430, 431, 432,
2194 -578, -578, 586, 444, 1140, -578, 621, 3, 442, 447,
2195 -578, -578, 18, 90, 87, -578, 188, -578, -578, -578,
2196 -578, 577, -578, -578, 441, -578, 621, 178, 178, 587,
2197 849, 849, -578, 588, 448, 1140, -578, -578, 1140, 589,
2198 539, 178, 178, -578, 1140, 594, -578, 1140, -578
Dan Gohmanf4423b12008-04-19 00:24:39 +00002199};
2200
2201/* YYPGOTO[NTERM-NUM]. */
2202static const yytype_int16 yypgoto[] =
2203{
Dan Gohmane4977cf2008-05-23 01:55:30 +00002204 -578, 482, 484, 485, -163, -161, -174, -578, 0, 12,
2205 -97, 525, 10, -578, -578, -578, -578, 267, -578, -578,
2206 -578, -138, -578, -457, -578, -239, -578, -578, -311, 45,
2207 -578, -412, -578, -578, -26, 387, -122, -578, 510, 521,
2208 86, -159, -237, 222, 257, 383, -578, -578, 612, -578,
2209 -578, -578, -578, -578, -578, -578, -578, -578, -578, -578,
2210 541, -578, -578, -578, -578, -578, -578, -577, -51, 246,
2211 -197, -578, -578, 575, -578, -578, -578, -578, -578, 88,
2212 -413, -578, -578, -578, -578
Dan Gohmanf4423b12008-04-19 00:24:39 +00002213};
2214
2215/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2216 positive, shift that token. If negative, reduce the rule which
2217 number is the opposite. If zero, do what YYDEFACT says.
2218 If YYTABLE_NINF, syntax error. */
Dan Gohmane4977cf2008-05-23 01:55:30 +00002219#define YYTABLE_NINF -214
Dan Gohmanf4423b12008-04-19 00:24:39 +00002220static const yytype_int16 yytable[] =
2221{
Dan Gohmane4977cf2008-05-23 01:55:30 +00002222 11, 82, 287, 357, 321, 275, 167, 522, 490, 411,
2223 13, 168, 286, 24, 286, 105, 91, 11, 518, 325,
2224 326, 327, 328, 329, 94, 498, 499, 13, 111, 335,
2225 111, 505, 376, 378, 317, 111, 510, 318, 478, 288,
2226 29, 30, 31, 32, 33, 34, 35, 36, 480, 37,
2227 2, 25, 109, 4, 111, 518, 659, 64, 65, 654,
2228 107, 67, 68, 69, 70, 71, 72, 73, 277, 1,
2229 2, 111, 3, 4, 5, 519, 136, 27, 144, 664,
2230 109, 479, -55, -55, -55, -55, 136, 145, 26, 135,
2231 336, 479, 153, 11, 361, 21, 363, 362, 144, 364,
2232 74, 451, 153, 246, 111, 247, 248, 239, 456, 569,
2233 22, 451, 133, 276, 236, 237, 608, 134, 240, 451,
2234 457, 614, 615, 111, 244, 430, 431, 432, 514, 112,
2235 433, 112, 119, 120, 434, 435, 112, 413, 455, 354,
2236 111, 428, 111, 28, 353, -145, 358, 359, 281, 604,
2237 169, 38, 39, 40, 44, 112, 551, 469, 60, 430,
2238 431, 432, 58, 95, 433, 635, 403, 655, 434, 435,
2239 337, 338, 112, 319, 320, 281, 322, 278, 106, 62,
2240 620, 451, 59, 657, 658, 549, 660, 661, 526, 323,
2241 281, 281, 281, 281, 281, 330, 331, 332, 333, 334,
2242 281, 46, 470, 47, 91, 112, 607, 165, 136, 671,
2243 672, 75, 76, 98, 426, 77, 99, 78, 484, 153,
2244 486, 487, 488, 585, 112, 586, 100, 408, -67, 102,
2245 397, 284, 339, 397, 397, 243, 397, 285, 86, 103,
2246 87, 112, 104, 112, 410, -67, -145, -67, 451, 87,
2247 -145, 64, 65, 452, 107, 67, 68, 69, 70, 71,
2248 72, 73, 153, 1, 2, 140, 3, 4, 5, 1,
2249 141, 397, 3, 404, 5, 249, 250, 251, 252, 397,
2250 397, 397, 397, 397, 622, 574, 38, 39, 40, 148,
2251 405, 406, 407, 1, 74, 275, 3, 146, 5, 340,
2252 341, 64, 65, 116, 556, 117, 537, 166, 84, 85,
2253 153, 427, 281, 1, 2, 89, 3, 4, 5, 342,
2254 343, 90, 344, 345, 232, 346, 347, 348, 339, 430,
2255 431, 432, 234, 561, 433, 537, 149, 150, 434, 435,
2256 587, 114, 115, 590, 591, 592, 235, 238, -213, 454,
2257 241, 245, 397, 397, 397, 397, 397, 242, 464, 50,
2258 51, 52, 397, 616, 53, 617, -69, 1, 2, -56,
2259 3, 4, 5, 281, -57, 397, 397, 642, 6, 7,
2260 -60, -59, 646, 122, 123, 124, 125, 126, 127, 281,
2261 485, 281, 281, 281, -58, 340, 341, 253, 111, 494,
2262 8, 279, 286, 276, 9, 75, 76, 355, 10, 77,
2263 356, 78, 108, 500, 365, 342, 343, 379, 344, 345,
2264 366, 346, 347, 348, 367, 399, 621, 397, 617, 397,
2265 414, 368, 397, 630, 369, 537, 370, 371, 380, 636,
2266 381, 397, 397, 382, 384, 415, 425, 439, 416, 417,
2267 418, 444, 445, 446, 447, 448, 449, 450, 419, 429,
2268 440, 441, 442, 656, 443, 544, 458, 459, 460, 300,
2269 301, 550, 461, 467, 471, 472, 397, 397, 489, 397,
2270 397, 397, 397, 491, 483, 492, 493, 397, 497, 506,
2271 507, 566, 508, 397, 509, 511, 515, 573, 513, 397,
2272 516, 517, 525, 579, 523, 527, 524, 528, 529, 530,
2273 531, 281, 532, 533, 281, 281, 281, 535, 537, 543,
2274 538, 579, 570, 540, 547, 541, 501, 502, 503, 504,
2275 400, 401, 542, 402, 548, 552, 553, 512, 397, 554,
2276 555, 567, 568, 302, 303, 304, 305, 306, 307, 308,
2277 309, 310, 311, 312, 313, 314, 315, 575, 563, 589,
2278 479, 600, 601, 397, 397, 602, 603, 605, 412, 611,
2279 606, 632, 623, 612, 624, 618, 420, 421, 422, 423,
2280 424, 613, 625, 397, 626, 634, 645, 647, 648, 649,
2281 650, 644, 557, 558, 559, 560, 651, 562, -18, 662,
2282 663, 564, 565, -19, 665, 668, 674, 669, 570, 397,
2283 397, 677, 675, 224, 397, 225, 226, 397, 131, 609,
2284 631, 351, 147, 397, 385, 386, 397, 143, 360, 45,
2285 387, 130, 97, 0, 0, 594, 0, 0, 596, 597,
2286 598, 599, 0, 0, 0, 0, 388, 389, 390, 473,
2287 474, 475, 476, 477, 0, 0, 0, 0, 0, 482,
2288 0, 391, 392, 0, 0, 0, 0, 0, 0, 0,
2289 0, 0, 495, 496, 0, 0, 0, 0, 0, 0,
2290 393, 0, 0, 0, 0, 0, 627, 0, 628, 629,
2291 0, 0, 0, 0, 0, 0, 180, 181, 182, 183,
2292 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
2293 194, 257, 258, 259, 260, 0, 0, 0, 0, 0,
2294 0, 0, 0, 0, 534, 0, 536, 0, 0, 539,
2295 0, 0, 0, 0, 0, 0, 0, 0, 545, 546,
2296 261, 203, 204, 205, 206, 207, 208, 209, 210, 211,
2297 212, 213, 214, 0, 262, 0, 263, 264, 265, 0,
2298 266, 267, 289, 290, 291, 292, 293, 294, 295, 296,
2299 297, 298, 0, 576, 577, 0, 581, 582, 583, 584,
2300 0, 0, 0, 0, 588, 0, 394, 0, 0, 0,
2301 593, 0, 0, 0, 64, 65, 595, 107, 67, 68,
2302 69, 70, 71, 72, 73, 0, 1, 2, 0, 3,
2303 4, 5, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002304 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002305 0, 0, 0, 0, 0, 619, 0, 74, 0, 0,
Nate Begemanac80ade2008-05-12 19:01:56 +00002306 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002307 0, 0, 385, 386, 0, 0, 64, 65, 387, 0,
2308 640, 641, 0, 0, 0, 0, 0, 0, 1, 2,
2309 0, 3, 4, 5, 388, 389, 390, 0, 0, 0,
2310 653, 0, 0, 0, 0, 0, 0, 0, 0, 391,
2311 392, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2312 0, 0, 0, 339, 0, 0, 666, 667, 393, 0,
2313 0, 670, 0, 0, 673, 0, 0, 0, 0, 0,
2314 676, 0, 0, 678, 180, 181, 182, 183, 184, 185,
2315 186, 187, 188, 189, 190, 191, 192, 193, 194, 257,
2316 258, 259, 260, 0, 0, 0, 0, 0, 75, 76,
2317 0, 0, 77, 0, 78, 142, 0, 0, 0, 0,
2318 0, 0, 0, 0, 0, 0, 0, 0, 261, 203,
2319 638, 639, 206, 207, 208, 209, 210, 211, 212, 213,
2320 214, 0, 262, 0, 263, 264, 265, 0, 266, 267,
2321 342, 343, 0, 344, 345, 0, 346, 347, 348, 385,
2322 386, 0, 0, 64, 65, 387, 0, 0, 0, 0,
2323 0, 0, 0, 0, 394, 1, 2, 0, 3, 4,
2324 5, 388, 389, 390, 0, 0, 0, 0, 0, 0,
2325 0, 0, 0, 0, 0, 0, 391, 392, 0, 0,
2326 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2327 0, 111, 0, 64, 65, 393, 107, 156, 157, 158,
2328 159, 160, 161, 73, 0, 1, 2, 0, 3, 4,
2329 5, 180, 181, 182, 183, 184, 185, 186, 187, 188,
2330 189, 190, 191, 192, 193, 194, 257, 258, 259, 260,
2331 0, 0, 0, 0, 64, 65, 74, 107, 156, 157,
2332 158, 159, 160, 161, 73, 0, 1, 2, 0, 3,
2333 4, 5, 0, 0, 0, 261, 203, 204, 205, 206,
2334 207, 208, 209, 210, 211, 212, 213, 214, 0, 262,
2335 0, 263, 264, 265, 0, 266, 267, 74, 0, 0,
2336 0, 0, 0, 385, 386, 0, 0, 64, 65, 387,
2337 0, 0, 112, 0, 0, 0, 0, 0, 0, 1,
2338 2, 394, 3, 4, 5, 388, 389, 390, 0, 0,
2339 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2340 391, 392, 0, 0, 0, 0, 0, 0, 0, 0,
2341 0, 0, 0, 0, 0, 0, 0, 0, 0, 393,
2342 0, 0, 0, 0, 0, 0, 0, 75, 76, 0,
2343 0, 77, 0, 78, 377, 180, 181, 182, 183, 184,
2344 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
2345 257, 258, 259, 260, 0, 0, 0, 0, 0, 0,
2346 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2347 0, 0, 77, 0, 78, 453, 0, 0, 0, 261,
2348 203, 204, 205, 206, 207, 208, 209, 210, 211, 212,
2349 213, 214, 0, 262, 0, 263, 264, 265, 0, 266,
2350 267, 64, 65, 0, 0, 0, 0, 0, -212, 0,
2351 0, 0, 0, 1, 2, 0, 3, 4, 5, 254,
2352 0, 0, 0, 0, 0, 394, -69, 1, 2, 0,
2353 3, 4, 5, 0, 255, 256, 0, 0, 6, 7,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002354 0, 0, 0, 0, 0, 0, 0, 0, 0, 111,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002355 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2356 8, 0, 0, 0, 9, 0, 0, 0, 10, 180,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002357 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002358 191, 192, 193, 194, 257, 258, 259, 260, 0, 64,
2359 65, 0, 151, 67, 68, 69, 70, 71, 72, 73,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002360 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002361 0, 0, 0, 261, 203, 204, 205, 206, 207, 208,
2362 209, 210, 211, 212, 213, 214, 0, 262, 0, 263,
2363 264, 265, 74, 266, 267, 0, 0, 0, 0, 0,
Nate Begemanac80ade2008-05-12 19:01:56 +00002364 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002365 112, 0, 64, 65, -67, 0, 268, 0, 0, 269,
2366 0, 270, 0, 271, 1, 2, 0, 3, 4, 5,
2367 254, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2368 0, 0, 0, 0, 0, 255, 256, 0, 0, 0,
Chris Lattnercc81d152008-05-04 17:18:47 +00002369 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002370 111, 0, 0, 0, 0, 0, 0, 152, 0, 0,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002371 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002372 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
2373 190, 191, 192, 193, 194, 257, 258, 259, 260, 0,
2374 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002375 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002376 0, 0, 0, 0, 261, 203, 204, 205, 206, 207,
2377 208, 209, 210, 211, 212, 213, 214, 0, 262, 0,
2378 263, 264, 265, 0, 266, 267, 0, 64, 65, 0,
2379 107, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2380 2, 112, 3, 4, 5, 0, 0, 268, 0, 0,
2381 269, 0, 270, 0, 271, 0, 0, 0, 0, 350,
2382 0, 0, 0, 0, 0, 0, 0, 0, 64, 65,
2383 74, 107, 156, 157, 158, 159, 160, 161, 73, 0,
2384 1, 2, 0, 3, 4, 5, 64, 65, 0, 107,
2385 67, 68, 69, 70, 71, 72, 73, 0, 1, 2,
2386 0, 3, 4, 5, 0, 0, 0, 0, 0, 0,
2387 0, 74, 0, 0, 0, 0, 0, 0, 463, 0,
2388 0, 0, 0, 0, 0, 0, 0, 64, 65, 74,
2389 107, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2390 2, 0, 3, 4, 5, 64, 65, 0, 66, 67,
2391 68, 69, 70, 71, 72, 73, 0, 1, 2, 572,
2392 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
2393 74, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2394 0, 75, 76, 0, 0, 77, 0, 78, 74, 64,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002395 65, 0, 107, 156, 157, 158, 159, 160, 161, 73,
Chris Lattnercc81d152008-05-04 17:18:47 +00002396 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2397 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002398 0, 0, 75, 76, 0, 372, 77, 0, 78, 0,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002399 0, 0, 74, 0, 0, 0, 0, 0, 0, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002400 75, 76, 0, 0, 77, 0, 78, 64, 65, 0,
2401 151, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2402 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2403 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2404 0, 75, 76, 0, 0, 77, 0, 78, 0, 0,
2405 74, 0, 0, 0, 0, 0, 0, 0, 0, 75,
2406 76, 0, 0, 77, 0, 78, 0, 64, 65, 0,
2407 107, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2408 2, 0, 3, 4, 5, 64, 65, 0, 280, 67,
2409 68, 69, 70, 71, 72, 73, 0, 1, 2, 0,
2410 3, 4, 5, 75, 76, 0, 0, 77, 0, 78,
2411 74, 0, 0, 0, 64, 65, 0, 107, 156, 157,
2412 158, 159, 160, 161, 73, 0, 1, 2, 74, 3,
2413 4, 5, 64, 65, 0, 107, 67, 68, 69, 70,
2414 71, 72, 578, 0, 1, 2, 0, 3, 4, 5,
2415 0, 0, 0, 0, 0, 0, 0, 74, 0, 0,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002416 0, 75, 76, 0, 0, 77, 0, 78, 0, 0,
2417 0, 0, 0, 64, 65, 74, 107, 67, 68, 69,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002418 70, 71, 72, 643, 0, 1, 2, 0, 3, 4,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002419 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattnercc81d152008-05-04 17:18:47 +00002420 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002421 0, 0, 0, 0, 0, 0, 74, 0, 0, 0,
2422 0, 75, 76, 0, 0, 77, 0, 78, 0, 0,
2423 0, 0, 0, 0, 0, 0, 0, 0, 0, 75,
2424 76, 0, 0, 77, 0, 78, 0, 0, 0, 0,
2425 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2426 171, 0, 0, 0, 0, 0, 0, 0, 75, 76,
2427 0, 0, 77, 0, 375, 0, 0, 0, 0, 0,
2428 0, 172, 173, 0, 0, 0, 75, 76, 0, 0,
2429 77, 0, 78, 174, 175, 176, 177, 178, 179, 180,
2430 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
2431 191, 192, 193, 194, 195, 196, 197, 198, 0, 0,
2432 0, 0, 0, 0, 0, 0, 0, 75, 76, 0,
2433 0, 77, 0, 78, 0, 0, 0, 0, 199, 200,
2434 201, 0, 0, 202, 203, 204, 205, 206, 207, 208,
2435 209, 210, 211, 212, 213, 214, 215, 216, 217, 218,
2436 219, 220, 221, 222, 223
Dan Gohmanf4423b12008-04-19 00:24:39 +00002437};
2438
2439static const yytype_int16 yycheck[] =
2440{
Dan Gohmane4977cf2008-05-23 01:55:30 +00002441 0, 27, 176, 242, 201, 164, 128, 464, 421, 320,
2442 0, 28, 11, 158, 11, 4, 21, 17, 34, 216,
2443 217, 218, 219, 220, 29, 437, 438, 17, 55, 226,
2444 55, 444, 269, 270, 197, 55, 449, 198, 11, 177,
2445 42, 43, 44, 45, 46, 47, 48, 49, 11, 51,
2446 20, 59, 78, 23, 55, 34, 38, 7, 8, 636,
2447 10, 11, 12, 13, 14, 15, 16, 17, 165, 19,
2448 20, 55, 22, 23, 24, 54, 102, 18, 159, 656,
2449 106, 54, 3, 4, 5, 6, 112, 168, 158, 39,
2450 228, 54, 118, 93, 257, 53, 259, 258, 159, 260,
2451 50, 159, 128, 154, 55, 26, 27, 168, 166, 521,
2452 68, 159, 159, 164, 140, 141, 573, 164, 144, 159,
2453 168, 578, 579, 55, 150, 141, 142, 143, 168, 156,
2454 146, 156, 32, 33, 150, 151, 156, 162, 375, 166,
2455 55, 338, 55, 158, 164, 55, 243, 244, 174, 562,
2456 167, 153, 154, 155, 0, 156, 157, 394, 162, 141,
2457 142, 143, 158, 168, 146, 164, 288, 164, 150, 151,
2458 117, 118, 156, 199, 200, 201, 202, 167, 167, 22,
2459 593, 159, 158, 640, 641, 496, 643, 644, 166, 215,
2460 216, 217, 218, 219, 220, 221, 222, 223, 224, 225,
2461 226, 46, 399, 48, 21, 156, 157, 121, 234, 666,
2462 667, 161, 162, 22, 336, 165, 22, 167, 415, 245,
2463 417, 418, 419, 534, 156, 536, 22, 159, 160, 156,
2464 281, 11, 54, 284, 285, 149, 287, 17, 35, 4,
2465 37, 156, 4, 156, 159, 160, 156, 160, 159, 37,
2466 160, 7, 8, 164, 10, 11, 12, 13, 14, 15,
2467 16, 17, 288, 19, 20, 163, 22, 23, 24, 19,
2468 163, 322, 22, 299, 24, 3, 4, 5, 6, 330,
2469 331, 332, 333, 334, 595, 524, 153, 154, 155, 160,
2470 316, 317, 318, 19, 50, 454, 22, 156, 24, 121,
2471 122, 7, 8, 42, 157, 44, 159, 4, 41, 42,
2472 336, 337, 338, 19, 20, 48, 22, 23, 24, 141,
2473 142, 54, 144, 145, 22, 147, 148, 149, 54, 141,
2474 142, 143, 159, 157, 146, 159, 114, 115, 150, 151,
2475 537, 84, 85, 540, 541, 542, 157, 166, 0, 375,
2476 4, 156, 403, 404, 405, 406, 407, 157, 384, 42,
2477 43, 44, 413, 157, 47, 159, 18, 19, 20, 9,
2478 22, 23, 24, 399, 9, 426, 427, 616, 30, 31,
2479 9, 9, 621, 62, 63, 64, 65, 66, 67, 415,
2480 416, 417, 418, 419, 9, 121, 122, 9, 55, 425,
2481 52, 57, 11, 454, 56, 161, 162, 166, 60, 165,
2482 157, 167, 168, 439, 156, 141, 142, 22, 144, 145,
2483 156, 147, 148, 149, 156, 159, 157, 478, 159, 480,
2484 159, 156, 483, 157, 156, 159, 156, 156, 156, 613,
2485 156, 492, 493, 156, 156, 159, 38, 38, 159, 159,
2486 159, 365, 366, 367, 368, 369, 370, 371, 159, 4,
2487 156, 156, 156, 637, 156, 491, 380, 381, 382, 26,
2488 27, 497, 159, 61, 159, 159, 527, 528, 159, 530,
2489 531, 532, 533, 159, 162, 159, 159, 538, 159, 159,
2490 159, 517, 159, 544, 159, 159, 159, 523, 166, 550,
2491 159, 38, 22, 529, 159, 17, 157, 17, 156, 159,
2492 159, 537, 159, 159, 540, 541, 542, 4, 159, 4,
2493 159, 547, 522, 159, 156, 159, 440, 441, 442, 443,
2494 284, 285, 159, 287, 159, 159, 159, 451, 589, 159,
2495 159, 22, 4, 100, 101, 102, 103, 104, 105, 106,
2496 107, 108, 109, 110, 111, 112, 113, 159, 166, 159,
2497 54, 159, 157, 614, 615, 159, 159, 157, 322, 22,
2498 157, 54, 157, 159, 157, 164, 330, 331, 332, 333,
2499 334, 162, 157, 634, 157, 17, 164, 157, 157, 157,
2500 4, 617, 506, 507, 508, 509, 152, 511, 156, 22,
2501 159, 515, 516, 156, 17, 17, 17, 159, 608, 660,
2502 661, 17, 73, 131, 665, 131, 131, 668, 93, 574,
2503 608, 234, 112, 674, 3, 4, 677, 106, 245, 17,
2504 9, 90, 57, -1, -1, 547, -1, -1, 552, 553,
2505 554, 555, -1, -1, -1, -1, 25, 26, 27, 403,
2506 404, 405, 406, 407, -1, -1, -1, -1, -1, 413,
2507 -1, 40, 41, -1, -1, -1, -1, -1, -1, -1,
2508 -1, -1, 426, 427, -1, -1, -1, -1, -1, -1,
2509 59, -1, -1, -1, -1, -1, 600, -1, 602, 603,
2510 -1, -1, -1, -1, -1, -1, 75, 76, 77, 78,
2511 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2512 89, 90, 91, 92, 93, -1, -1, -1, -1, -1,
2513 -1, -1, -1, -1, 478, -1, 480, -1, -1, 483,
2514 -1, -1, -1, -1, -1, -1, -1, -1, 492, 493,
2515 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
2516 129, 130, 131, -1, 133, -1, 135, 136, 137, -1,
2517 139, 140, 94, 95, 96, 97, 98, 99, 100, 101,
2518 102, 103, -1, 527, 528, -1, 530, 531, 532, 533,
2519 -1, -1, -1, -1, 538, -1, 165, -1, -1, -1,
2520 544, -1, -1, -1, 7, 8, 550, 10, 11, 12,
2521 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2522 23, 24, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002523 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002524 -1, -1, -1, -1, -1, 589, -1, 50, -1, -1,
2525 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2526 -1, -1, 3, 4, -1, -1, 7, 8, 9, -1,
2527 614, 615, -1, -1, -1, -1, -1, -1, 19, 20,
2528 -1, 22, 23, 24, 25, 26, 27, -1, -1, -1,
2529 634, -1, -1, -1, -1, -1, -1, -1, -1, 40,
2530 41, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2531 -1, -1, -1, 54, -1, -1, 660, 661, 59, -1,
2532 -1, 665, -1, -1, 668, -1, -1, -1, -1, -1,
2533 674, -1, -1, 677, 75, 76, 77, 78, 79, 80,
2534 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2535 91, 92, 93, -1, -1, -1, -1, -1, 161, 162,
2536 -1, -1, 165, -1, 167, 168, -1, -1, -1, -1,
2537 -1, -1, -1, -1, -1, -1, -1, -1, 119, 120,
2538 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
2539 131, -1, 133, -1, 135, 136, 137, -1, 139, 140,
2540 141, 142, -1, 144, 145, -1, 147, 148, 149, 3,
2541 4, -1, -1, 7, 8, 9, -1, -1, -1, -1,
2542 -1, -1, -1, -1, 165, 19, 20, -1, 22, 23,
2543 24, 25, 26, 27, -1, -1, -1, -1, -1, -1,
2544 -1, -1, -1, -1, -1, -1, 40, 41, -1, -1,
2545 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2546 -1, 55, -1, 7, 8, 59, 10, 11, 12, 13,
2547 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2548 24, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2549 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
2550 -1, -1, -1, -1, 7, 8, 50, 10, 11, 12,
2551 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2552 23, 24, -1, -1, -1, 119, 120, 121, 122, 123,
2553 124, 125, 126, 127, 128, 129, 130, 131, -1, 133,
2554 -1, 135, 136, 137, -1, 139, 140, 50, -1, -1,
2555 -1, -1, -1, 3, 4, -1, -1, 7, 8, 9,
2556 -1, -1, 156, -1, -1, -1, -1, -1, -1, 19,
2557 20, 165, 22, 23, 24, 25, 26, 27, -1, -1,
2558 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2559 40, 41, -1, -1, -1, -1, -1, -1, -1, -1,
2560 -1, -1, -1, -1, -1, -1, -1, -1, -1, 59,
2561 -1, -1, -1, -1, -1, -1, -1, 161, 162, -1,
2562 -1, 165, -1, 167, 168, 75, 76, 77, 78, 79,
2563 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2564 90, 91, 92, 93, -1, -1, -1, -1, -1, -1,
2565 -1, -1, -1, -1, -1, -1, -1, -1, 161, 162,
2566 -1, -1, 165, -1, 167, 168, -1, -1, -1, 119,
2567 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
2568 130, 131, -1, 133, -1, 135, 136, 137, -1, 139,
2569 140, 7, 8, -1, -1, -1, -1, -1, 0, -1,
2570 -1, -1, -1, 19, 20, -1, 22, 23, 24, 25,
2571 -1, -1, -1, -1, -1, 165, 18, 19, 20, -1,
2572 22, 23, 24, -1, 40, 41, -1, -1, 30, 31,
2573 -1, -1, -1, -1, -1, -1, -1, -1, -1, 55,
2574 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2575 52, -1, -1, -1, 56, -1, -1, -1, 60, 75,
Nate Begemanac80ade2008-05-12 19:01:56 +00002576 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002577 86, 87, 88, 89, 90, 91, 92, 93, -1, 7,
2578 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2579 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002580 -1, -1, -1, 119, 120, 121, 122, 123, 124, 125,
2581 126, 127, 128, 129, 130, 131, -1, 133, -1, 135,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002582 136, 137, 50, 139, 140, -1, -1, -1, -1, -1,
2583 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2584 156, -1, 7, 8, 160, -1, 162, -1, -1, 165,
2585 -1, 167, -1, 169, 19, 20, -1, 22, 23, 24,
2586 25, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnercc81d152008-05-04 17:18:47 +00002587 -1, -1, -1, -1, -1, 40, 41, -1, -1, -1,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002588 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2589 55, -1, -1, -1, -1, -1, -1, 125, -1, -1,
2590 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnercc81d152008-05-04 17:18:47 +00002591 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002592 85, 86, 87, 88, 89, 90, 91, 92, 93, -1,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002593 -1, -1, -1, 161, 162, -1, -1, 165, -1, 167,
2594 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002595 -1, -1, -1, -1, 119, 120, 121, 122, 123, 124,
2596 125, 126, 127, 128, 129, 130, 131, -1, 133, -1,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002597 135, 136, 137, -1, 139, 140, -1, 7, 8, -1,
Nate Begemanac80ade2008-05-12 19:01:56 +00002598 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002599 20, 156, 22, 23, 24, -1, -1, 162, -1, -1,
2600 165, -1, 167, -1, 169, -1, -1, -1, -1, 39,
2601 -1, -1, -1, -1, -1, -1, -1, -1, 7, 8,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002602 50, 10, 11, 12, 13, 14, 15, 16, 17, -1,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002603 19, 20, -1, 22, 23, 24, 7, 8, -1, 10,
2604 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2605 -1, 22, 23, 24, -1, -1, -1, -1, -1, -1,
2606 -1, 50, -1, -1, -1, -1, -1, -1, 39, -1,
2607 -1, -1, -1, -1, -1, -1, -1, 7, 8, 50,
2608 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2609 20, -1, 22, 23, 24, 7, 8, -1, 10, 11,
2610 12, 13, 14, 15, 16, 17, -1, 19, 20, 39,
2611 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
2612 50, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2613 -1, 161, 162, -1, -1, 165, -1, 167, 50, 7,
Chris Lattnercc81d152008-05-04 17:18:47 +00002614 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2615 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2616 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002617 -1, -1, 161, 162, -1, 164, 165, -1, 167, -1,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002618 -1, -1, 50, -1, -1, -1, -1, -1, -1, -1,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002619 161, 162, -1, -1, 165, -1, 167, 7, 8, -1,
2620 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2621 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2622 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2623 -1, 161, 162, -1, -1, 165, -1, 167, -1, -1,
2624 50, -1, -1, -1, -1, -1, -1, -1, -1, 161,
2625 162, -1, -1, 165, -1, 167, -1, 7, 8, -1,
2626 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2627 20, -1, 22, 23, 24, 7, 8, -1, 10, 11,
2628 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2629 22, 23, 24, 161, 162, -1, -1, 165, -1, 167,
2630 50, -1, -1, -1, 7, 8, -1, 10, 11, 12,
2631 13, 14, 15, 16, 17, -1, 19, 20, 50, 22,
2632 23, 24, 7, 8, -1, 10, 11, 12, 13, 14,
2633 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2634 -1, -1, -1, -1, -1, -1, -1, 50, -1, -1,
2635 -1, 161, 162, -1, -1, 165, -1, 167, -1, -1,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002636 -1, -1, -1, 7, 8, 50, 10, 11, 12, 13,
2637 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2638 24, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattnercc81d152008-05-04 17:18:47 +00002639 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002640 -1, -1, -1, -1, -1, -1, 50, -1, -1, -1,
2641 -1, 161, 162, -1, -1, 165, -1, 167, -1, -1,
2642 -1, -1, -1, -1, -1, -1, -1, -1, -1, 161,
2643 162, -1, -1, 165, -1, 167, -1, -1, -1, -1,
2644 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2645 36, -1, -1, -1, -1, -1, -1, -1, 161, 162,
2646 -1, -1, 165, -1, 167, -1, -1, -1, -1, -1,
2647 -1, 57, 58, -1, -1, -1, 161, 162, -1, -1,
2648 165, -1, 167, 69, 70, 71, 72, 73, 74, 75,
2649 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2650 86, 87, 88, 89, 90, 91, 92, 93, -1, -1,
2651 -1, -1, -1, -1, -1, -1, -1, 161, 162, -1,
2652 -1, 165, -1, 167, -1, -1, -1, -1, 114, 115,
2653 116, -1, -1, 119, 120, 121, 122, 123, 124, 125,
2654 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
2655 136, 137, 138, 139, 140
Dan Gohmanf4423b12008-04-19 00:24:39 +00002656};
2657
2658/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2659 symbol of state STATE-NUM. */
2660static const yytype_uint8 yystos[] =
2661{
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002662 0, 19, 20, 22, 23, 24, 30, 31, 52, 56,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002663 60, 178, 181, 182, 183, 184, 216, 217, 218, 220,
2664 219, 53, 68, 225, 158, 59, 158, 18, 158, 42,
2665 43, 44, 45, 46, 47, 48, 49, 51, 153, 154,
2666 155, 185, 186, 187, 0, 218, 46, 48, 188, 235,
2667 42, 43, 44, 47, 189, 232, 234, 242, 158, 158,
2668 162, 226, 22, 224, 7, 8, 10, 11, 12, 13,
2669 14, 15, 16, 17, 50, 161, 162, 165, 167, 178,
2670 182, 203, 204, 238, 187, 187, 35, 37, 214, 187,
2671 187, 21, 243, 244, 29, 168, 233, 243, 22, 22,
2672 22, 227, 156, 4, 4, 4, 167, 10, 168, 204,
2673 209, 55, 156, 180, 214, 214, 42, 44, 190, 32,
2674 33, 213, 62, 63, 64, 65, 66, 67, 191, 230,
2675 230, 181, 247, 159, 164, 39, 204, 205, 207, 208,
2676 163, 163, 168, 209, 159, 168, 156, 208, 160, 213,
2677 213, 10, 125, 204, 206, 215, 11, 12, 13, 14,
2678 15, 16, 176, 177, 204, 210, 4, 206, 28, 167,
2679 231, 36, 57, 58, 69, 70, 71, 72, 73, 74,
Chris Lattnercc81d152008-05-04 17:18:47 +00002680 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002681 85, 86, 87, 88, 89, 90, 91, 92, 93, 114,
2682 115, 116, 119, 120, 121, 122, 123, 124, 125, 126,
Nate Begemanac80ade2008-05-12 19:01:56 +00002683 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002684 137, 138, 139, 140, 171, 172, 173, 245, 251, 252,
2685 253, 254, 22, 193, 159, 157, 204, 204, 166, 168,
2686 204, 4, 157, 210, 204, 156, 238, 26, 27, 3,
2687 4, 5, 6, 9, 25, 40, 41, 90, 91, 92,
2688 93, 119, 133, 135, 136, 137, 139, 140, 162, 165,
2689 167, 169, 171, 172, 173, 211, 238, 180, 182, 57,
2690 10, 204, 240, 241, 11, 17, 11, 176, 191, 94,
2691 95, 96, 97, 98, 99, 100, 101, 102, 103, 174,
2692 26, 27, 100, 101, 102, 103, 104, 105, 106, 107,
2693 108, 109, 110, 111, 112, 113, 175, 174, 175, 204,
2694 204, 240, 204, 204, 248, 240, 240, 240, 240, 240,
2695 204, 204, 204, 204, 204, 240, 191, 117, 118, 54,
2696 121, 122, 141, 142, 144, 145, 147, 148, 149, 192,
2697 39, 205, 195, 164, 166, 166, 157, 195, 180, 180,
2698 215, 174, 175, 174, 175, 156, 156, 156, 156, 156,
2699 156, 156, 164, 210, 212, 167, 212, 168, 212, 22,
2700 156, 156, 156, 221, 156, 3, 4, 9, 25, 26,
2701 27, 40, 41, 59, 165, 211, 237, 238, 239, 159,
2702 239, 239, 239, 206, 204, 204, 204, 204, 159, 198,
2703 159, 198, 239, 162, 159, 159, 159, 159, 159, 159,
2704 239, 239, 239, 239, 239, 38, 206, 204, 240, 4,
2705 141, 142, 143, 146, 150, 151, 194, 222, 223, 38,
2706 156, 156, 156, 156, 210, 210, 210, 210, 210, 210,
2707 210, 159, 164, 168, 204, 212, 166, 168, 210, 210,
2708 210, 159, 201, 39, 204, 228, 229, 61, 236, 212,
2709 240, 159, 159, 239, 239, 239, 239, 239, 11, 54,
2710 11, 250, 239, 162, 240, 204, 240, 240, 240, 159,
2711 250, 159, 159, 159, 204, 239, 239, 159, 201, 201,
2712 204, 210, 210, 210, 210, 250, 159, 159, 159, 159,
2713 250, 159, 210, 166, 168, 159, 159, 38, 34, 54,
2714 199, 202, 193, 159, 157, 22, 166, 17, 17, 156,
2715 159, 159, 159, 159, 239, 4, 239, 159, 159, 239,
2716 159, 159, 159, 4, 204, 239, 239, 156, 159, 198,
2717 204, 157, 159, 159, 159, 159, 157, 210, 210, 210,
2718 210, 157, 210, 166, 210, 210, 204, 22, 4, 201,
2719 178, 179, 39, 204, 195, 159, 239, 239, 17, 204,
2720 249, 239, 239, 239, 239, 198, 198, 240, 239, 159,
2721 240, 240, 240, 239, 249, 239, 210, 210, 210, 210,
2722 159, 157, 159, 159, 250, 157, 157, 157, 193, 199,
2723 200, 22, 159, 162, 193, 193, 157, 159, 164, 239,
2724 250, 157, 198, 157, 157, 157, 157, 210, 210, 210,
2725 157, 179, 54, 197, 17, 164, 176, 246, 121, 122,
2726 239, 239, 195, 17, 204, 164, 195, 157, 157, 157,
2727 4, 152, 196, 239, 237, 164, 176, 193, 193, 38,
2728 193, 193, 22, 159, 237, 17, 239, 239, 17, 159,
2729 239, 193, 193, 239, 17, 73, 239, 17, 239
Dan Gohmanf4423b12008-04-19 00:24:39 +00002730};
David Greene718fda32007-08-01 03:59:32 +00002731
Reid Spencer68a24bd2005-08-27 18:50:39 +00002732#define yyerrok (yyerrstatus = 0)
2733#define yyclearin (yychar = YYEMPTY)
Dan Gohmanf4423b12008-04-19 00:24:39 +00002734#define YYEMPTY (-2)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002735#define YYEOF 0
Dan Gohmanf4423b12008-04-19 00:24:39 +00002736
Reid Spencer68a24bd2005-08-27 18:50:39 +00002737#define YYACCEPT goto yyacceptlab
Dan Gohmanf4423b12008-04-19 00:24:39 +00002738#define YYABORT goto yyabortlab
2739#define YYERROR goto yyerrorlab
2740
2741
2742/* Like YYERROR except do call yyerror. This remains here temporarily
2743 to ease the transition to the new meaning of YYERROR, for GCC.
Reid Spencer68a24bd2005-08-27 18:50:39 +00002744 Once GCC version 2 has supplanted version 1, this can go. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00002745
Reid Spencer68a24bd2005-08-27 18:50:39 +00002746#define YYFAIL goto yyerrlab
Dan Gohmanf4423b12008-04-19 00:24:39 +00002747
Reid Spencer68a24bd2005-08-27 18:50:39 +00002748#define YYRECOVERING() (!!yyerrstatus)
Dan Gohmanf4423b12008-04-19 00:24:39 +00002749
2750#define YYBACKUP(Token, Value) \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002751do \
2752 if (yychar == YYEMPTY && yylen == 1) \
Dan Gohmanf4423b12008-04-19 00:24:39 +00002753 { \
2754 yychar = (Token); \
2755 yylval = (Value); \
2756 yytoken = YYTRANSLATE (yychar); \
2757 YYPOPSTACK (1); \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002758 goto yybackup; \
2759 } \
2760 else \
Dan Gohmanf4423b12008-04-19 00:24:39 +00002761 { \
2762 yyerror (YY_("syntax error: cannot back up")); \
2763 YYERROR; \
2764 } \
2765while (YYID (0))
2766
Anton Korobeynikov38e09802007-04-28 13:48:45 +00002767
Reid Spencer68a24bd2005-08-27 18:50:39 +00002768#define YYTERROR 1
2769#define YYERRCODE 256
2770
Dan Gohmanf4423b12008-04-19 00:24:39 +00002771
2772/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2773 If N is 0, then set CURRENT to the empty location which ends
2774 the previous symbol: RHS[0] (always defined). */
2775
2776#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2777#ifndef YYLLOC_DEFAULT
2778# define YYLLOC_DEFAULT(Current, Rhs, N) \
2779 do \
2780 if (YYID (N)) \
2781 { \
2782 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2783 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2784 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2785 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2786 } \
2787 else \
2788 { \
2789 (Current).first_line = (Current).last_line = \
2790 YYRHSLOC (Rhs, 0).last_line; \
2791 (Current).first_column = (Current).last_column = \
2792 YYRHSLOC (Rhs, 0).last_column; \
2793 } \
2794 while (YYID (0))
Reid Spencer68a24bd2005-08-27 18:50:39 +00002795#endif
2796
Dan Gohmanf4423b12008-04-19 00:24:39 +00002797
2798/* YY_LOCATION_PRINT -- Print the location on the stream.
2799 This macro was not mandated originally: define only if we know
2800 we won't break user code: when these are the locations we know. */
2801
2802#ifndef YY_LOCATION_PRINT
2803# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2804# define YY_LOCATION_PRINT(File, Loc) \
2805 fprintf (File, "%d.%d-%d.%d", \
2806 (Loc).first_line, (Loc).first_column, \
2807 (Loc).last_line, (Loc).last_column)
2808# else
2809# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2810# endif
2811#endif
2812
2813
2814/* YYLEX -- calling `yylex' with the right arguments. */
2815
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00002816#ifdef YYLEX_PARAM
Dan Gohmanf4423b12008-04-19 00:24:39 +00002817# define YYLEX yylex (YYLEX_PARAM)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00002818#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00002819# define YYLEX yylex ()
Gabor Greife64d2482008-04-06 23:07:54 +00002820#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002821
2822/* Enable debugging if requested. */
2823#if YYDEBUG
2824
2825# ifndef YYFPRINTF
2826# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2827# define YYFPRINTF fprintf
2828# endif
2829
2830# define YYDPRINTF(Args) \
2831do { \
2832 if (yydebug) \
2833 YYFPRINTF Args; \
2834} while (YYID (0))
2835
2836# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2837do { \
2838 if (yydebug) \
2839 { \
2840 YYFPRINTF (stderr, "%s ", Title); \
2841 yy_symbol_print (stderr, \
2842 Type, Value); \
2843 YYFPRINTF (stderr, "\n"); \
2844 } \
2845} while (YYID (0))
2846
2847
2848/*--------------------------------.
2849| Print this symbol on YYOUTPUT. |
2850`--------------------------------*/
2851
2852/*ARGSUSED*/
2853#if (defined __STDC__ || defined __C99__FUNC__ \
2854 || defined __cplusplus || defined _MSC_VER)
2855static void
2856yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
Gabor Greife64d2482008-04-06 23:07:54 +00002857#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00002858static void
2859yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2860 FILE *yyoutput;
2861 int yytype;
2862 YYSTYPE const * const yyvaluep;
Gabor Greife64d2482008-04-06 23:07:54 +00002863#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002864{
2865 if (!yyvaluep)
2866 return;
2867# ifdef YYPRINT
2868 if (yytype < YYNTOKENS)
2869 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2870# else
2871 YYUSE (yyoutput);
2872# endif
2873 switch (yytype)
2874 {
2875 default:
2876 break;
2877 }
2878}
2879
2880
2881/*--------------------------------.
2882| Print this symbol on YYOUTPUT. |
2883`--------------------------------*/
2884
2885#if (defined __STDC__ || defined __C99__FUNC__ \
2886 || defined __cplusplus || defined _MSC_VER)
2887static void
2888yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2889#else
2890static void
2891yy_symbol_print (yyoutput, yytype, yyvaluep)
2892 FILE *yyoutput;
2893 int yytype;
2894 YYSTYPE const * const yyvaluep;
Scott Michel15dcd8e2008-01-30 03:10:00 +00002895#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002896{
2897 if (yytype < YYNTOKENS)
2898 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2899 else
2900 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
Chris Lattner38905612008-02-19 04:36:25 +00002901
Dan Gohmanf4423b12008-04-19 00:24:39 +00002902 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2903 YYFPRINTF (yyoutput, ")");
2904}
Chris Lattner38905612008-02-19 04:36:25 +00002905
Dan Gohmanf4423b12008-04-19 00:24:39 +00002906/*------------------------------------------------------------------.
2907| yy_stack_print -- Print the state stack from its BOTTOM up to its |
2908| TOP (included). |
2909`------------------------------------------------------------------*/
Chris Lattner38905612008-02-19 04:36:25 +00002910
Dan Gohmanf4423b12008-04-19 00:24:39 +00002911#if (defined __STDC__ || defined __C99__FUNC__ \
2912 || defined __cplusplus || defined _MSC_VER)
2913static void
2914yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
2915#else
2916static void
2917yy_stack_print (bottom, top)
2918 yytype_int16 *bottom;
2919 yytype_int16 *top;
Scott Michel15dcd8e2008-01-30 03:10:00 +00002920#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002921{
2922 YYFPRINTF (stderr, "Stack now");
2923 for (; bottom <= top; ++bottom)
2924 YYFPRINTF (stderr, " %d", *bottom);
2925 YYFPRINTF (stderr, "\n");
2926}
Chris Lattner38905612008-02-19 04:36:25 +00002927
Dan Gohmanf4423b12008-04-19 00:24:39 +00002928# define YY_STACK_PRINT(Bottom, Top) \
2929do { \
2930 if (yydebug) \
2931 yy_stack_print ((Bottom), (Top)); \
2932} while (YYID (0))
Chris Lattner38905612008-02-19 04:36:25 +00002933
Dan Gohmanf4423b12008-04-19 00:24:39 +00002934
2935/*------------------------------------------------.
2936| Report that the YYRULE is going to be reduced. |
2937`------------------------------------------------*/
2938
2939#if (defined __STDC__ || defined __C99__FUNC__ \
2940 || defined __cplusplus || defined _MSC_VER)
2941static void
2942yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
2943#else
2944static void
2945yy_reduce_print (yyvsp, yyrule)
2946 YYSTYPE *yyvsp;
2947 int yyrule;
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00002948#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002949{
2950 int yynrhs = yyr2[yyrule];
2951 int yyi;
2952 unsigned long int yylno = yyrline[yyrule];
2953 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2954 yyrule - 1, yylno);
2955 /* The symbols being reduced. */
2956 for (yyi = 0; yyi < yynrhs; yyi++)
2957 {
2958 fprintf (stderr, " $%d = ", yyi + 1);
2959 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2960 &(yyvsp[(yyi + 1) - (yynrhs)])
2961 );
2962 fprintf (stderr, "\n");
2963 }
2964}
Scott Michel7f9ba9b2008-01-30 02:55:46 +00002965
Dan Gohmanf4423b12008-04-19 00:24:39 +00002966# define YY_REDUCE_PRINT(Rule) \
2967do { \
2968 if (yydebug) \
2969 yy_reduce_print (yyvsp, Rule); \
2970} while (YYID (0))
Scott Michel7f9ba9b2008-01-30 02:55:46 +00002971
Dan Gohmanf4423b12008-04-19 00:24:39 +00002972/* Nonzero means print parse trace. It is left uninitialized so that
2973 multiple parsers can coexist. */
2974int yydebug;
2975#else /* !YYDEBUG */
2976# define YYDPRINTF(Args)
2977# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2978# define YY_STACK_PRINT(Bottom, Top)
2979# define YY_REDUCE_PRINT(Rule)
2980#endif /* !YYDEBUG */
2981
2982
2983/* YYINITDEPTH -- initial size of the parser's stacks. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002984#ifndef YYINITDEPTH
Dan Gohmanf4423b12008-04-19 00:24:39 +00002985# define YYINITDEPTH 200
Reid Spencer68a24bd2005-08-27 18:50:39 +00002986#endif
2987
Dan Gohmanf4423b12008-04-19 00:24:39 +00002988/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2989 if the built-in stack extension method is used).
Reid Spencer68a24bd2005-08-27 18:50:39 +00002990
Dan Gohmanf4423b12008-04-19 00:24:39 +00002991 Do not make this value too large; the results are undefined if
2992 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2993 evaluated with infinite-precision integer arithmetic. */
David Greene718fda32007-08-01 03:59:32 +00002994
Reid Spencer68a24bd2005-08-27 18:50:39 +00002995#ifndef YYMAXDEPTH
Dan Gohmanf4423b12008-04-19 00:24:39 +00002996# define YYMAXDEPTH 10000
Reid Spencer68a24bd2005-08-27 18:50:39 +00002997#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002998
Reid Spencer68a24bd2005-08-27 18:50:39 +00002999
3000
Dan Gohmanf4423b12008-04-19 00:24:39 +00003001#if YYERROR_VERBOSE
Reid Spencer68a24bd2005-08-27 18:50:39 +00003002
Dan Gohmanf4423b12008-04-19 00:24:39 +00003003# ifndef yystrlen
3004# if defined __GLIBC__ && defined _STRING_H
3005# define yystrlen strlen
3006# else
3007/* Return the length of YYSTR. */
3008#if (defined __STDC__ || defined __C99__FUNC__ \
3009 || defined __cplusplus || defined _MSC_VER)
3010static YYSIZE_T
3011yystrlen (const char *yystr)
Chris Lattner38905612008-02-19 04:36:25 +00003012#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00003013static YYSIZE_T
3014yystrlen (yystr)
3015 const char *yystr;
3016#endif
3017{
3018 YYSIZE_T yylen;
3019 for (yylen = 0; yystr[yylen]; yylen++)
3020 continue;
3021 return yylen;
3022}
3023# endif
3024# endif
3025
3026# ifndef yystpcpy
3027# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
3028# define yystpcpy stpcpy
3029# else
3030/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
3031 YYDEST. */
3032#if (defined __STDC__ || defined __C99__FUNC__ \
3033 || defined __cplusplus || defined _MSC_VER)
3034static char *
3035yystpcpy (char *yydest, const char *yysrc)
3036#else
3037static char *
3038yystpcpy (yydest, yysrc)
3039 char *yydest;
3040 const char *yysrc;
3041#endif
3042{
3043 char *yyd = yydest;
3044 const char *yys = yysrc;
3045
3046 while ((*yyd++ = *yys++) != '\0')
3047 continue;
3048
3049 return yyd - 1;
3050}
3051# endif
3052# endif
3053
3054# ifndef yytnamerr
3055/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3056 quotes and backslashes, so that it's suitable for yyerror. The
3057 heuristic is that double-quoting is unnecessary unless the string
3058 contains an apostrophe, a comma, or backslash (other than
3059 backslash-backslash). YYSTR is taken from yytname. If YYRES is
3060 null, do not copy; instead, return the length of what the result
3061 would have been. */
3062static YYSIZE_T
3063yytnamerr (char *yyres, const char *yystr)
3064{
3065 if (*yystr == '"')
3066 {
3067 YYSIZE_T yyn = 0;
3068 char const *yyp = yystr;
3069
3070 for (;;)
3071 switch (*++yyp)
3072 {
3073 case '\'':
3074 case ',':
3075 goto do_not_strip_quotes;
3076
3077 case '\\':
3078 if (*++yyp != '\\')
3079 goto do_not_strip_quotes;
3080 /* Fall through. */
3081 default:
3082 if (yyres)
3083 yyres[yyn] = *yyp;
3084 yyn++;
3085 break;
3086
3087 case '"':
3088 if (yyres)
3089 yyres[yyn] = '\0';
3090 return yyn;
3091 }
3092 do_not_strip_quotes: ;
3093 }
3094
3095 if (! yyres)
3096 return yystrlen (yystr);
3097
3098 return yystpcpy (yyres, yystr) - yyres;
3099}
3100# endif
3101
3102/* Copy into YYRESULT an error message about the unexpected token
3103 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3104 including the terminating null byte. If YYRESULT is null, do not
3105 copy anything; just return the number of bytes that would be
3106 copied. As a special case, return 0 if an ordinary "syntax error"
3107 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3108 size calculation. */
3109static YYSIZE_T
3110yysyntax_error (char *yyresult, int yystate, int yychar)
3111{
3112 int yyn = yypact[yystate];
3113
3114 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3115 return 0;
3116 else
3117 {
3118 int yytype = YYTRANSLATE (yychar);
3119 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3120 YYSIZE_T yysize = yysize0;
3121 YYSIZE_T yysize1;
3122 int yysize_overflow = 0;
3123 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3124 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3125 int yyx;
3126
3127# if 0
3128 /* This is so xgettext sees the translatable formats that are
3129 constructed on the fly. */
3130 YY_("syntax error, unexpected %s");
3131 YY_("syntax error, unexpected %s, expecting %s");
3132 YY_("syntax error, unexpected %s, expecting %s or %s");
3133 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3134 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3135# endif
3136 char *yyfmt;
3137 char const *yyf;
3138 static char const yyunexpected[] = "syntax error, unexpected %s";
3139 static char const yyexpecting[] = ", expecting %s";
3140 static char const yyor[] = " or %s";
3141 char yyformat[sizeof yyunexpected
3142 + sizeof yyexpecting - 1
3143 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3144 * (sizeof yyor - 1))];
3145 char const *yyprefix = yyexpecting;
3146
3147 /* Start YYX at -YYN if negative to avoid negative indexes in
3148 YYCHECK. */
3149 int yyxbegin = yyn < 0 ? -yyn : 0;
3150
3151 /* Stay within bounds of both yycheck and yytname. */
3152 int yychecklim = YYLAST - yyn + 1;
3153 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3154 int yycount = 1;
3155
3156 yyarg[0] = yytname[yytype];
3157 yyfmt = yystpcpy (yyformat, yyunexpected);
3158
3159 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3160 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3161 {
3162 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3163 {
3164 yycount = 1;
3165 yysize = yysize0;
3166 yyformat[sizeof yyunexpected - 1] = '\0';
3167 break;
3168 }
3169 yyarg[yycount++] = yytname[yyx];
3170 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3171 yysize_overflow |= (yysize1 < yysize);
3172 yysize = yysize1;
3173 yyfmt = yystpcpy (yyfmt, yyprefix);
3174 yyprefix = yyor;
3175 }
3176
3177 yyf = YY_(yyformat);
3178 yysize1 = yysize + yystrlen (yyf);
3179 yysize_overflow |= (yysize1 < yysize);
3180 yysize = yysize1;
3181
3182 if (yysize_overflow)
3183 return YYSIZE_MAXIMUM;
3184
3185 if (yyresult)
3186 {
3187 /* Avoid sprintf, as that infringes on the user's name space.
3188 Don't have undefined behavior even if the translation
3189 produced a string with the wrong number of "%s"s. */
3190 char *yyp = yyresult;
3191 int yyi = 0;
3192 while ((*yyp = *yyf) != '\0')
3193 {
3194 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3195 {
3196 yyp += yytnamerr (yyp, yyarg[yyi++]);
3197 yyf += 2;
3198 }
3199 else
3200 {
3201 yyp++;
3202 yyf++;
3203 }
3204 }
3205 }
3206 return yysize;
3207 }
3208}
3209#endif /* YYERROR_VERBOSE */
3210
3211
3212/*-----------------------------------------------.
3213| Release the memory associated to this symbol. |
3214`-----------------------------------------------*/
3215
3216/*ARGSUSED*/
3217#if (defined __STDC__ || defined __C99__FUNC__ \
3218 || defined __cplusplus || defined _MSC_VER)
3219static void
3220yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3221#else
3222static void
3223yydestruct (yymsg, yytype, yyvaluep)
3224 const char *yymsg;
3225 int yytype;
3226 YYSTYPE *yyvaluep;
3227#endif
3228{
3229 YYUSE (yyvaluep);
3230
3231 if (!yymsg)
3232 yymsg = "Deleting";
3233 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3234
3235 switch (yytype)
3236 {
3237
3238 default:
3239 break;
3240 }
3241}
3242
3243
3244/* Prevent warnings from -Wmissing-prototypes. */
3245
3246#ifdef YYPARSE_PARAM
3247#if defined __STDC__ || defined __cplusplus
3248int yyparse (void *YYPARSE_PARAM);
3249#else
3250int yyparse ();
3251#endif
3252#else /* ! YYPARSE_PARAM */
3253#if defined __STDC__ || defined __cplusplus
David Greene5fd22a82007-09-04 18:46:50 +00003254int yyparse (void);
Gabor Greife64d2482008-04-06 23:07:54 +00003255#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00003256int yyparse ();
Scott Michel15dcd8e2008-01-30 03:10:00 +00003257#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003258#endif /* ! YYPARSE_PARAM */
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003259
Chris Lattner38905612008-02-19 04:36:25 +00003260
Dan Gohmanf4423b12008-04-19 00:24:39 +00003261
3262/* The look-ahead symbol. */
3263int yychar;
3264
3265/* The semantic value of the look-ahead symbol. */
3266YYSTYPE yylval;
3267
3268/* Number of syntax errors so far. */
3269int yynerrs;
3270
3271
3272
3273/*----------.
3274| yyparse. |
3275`----------*/
3276
3277#ifdef YYPARSE_PARAM
3278#if (defined __STDC__ || defined __C99__FUNC__ \
3279 || defined __cplusplus || defined _MSC_VER)
3280int
3281yyparse (void *YYPARSE_PARAM)
3282#else
3283int
3284yyparse (YYPARSE_PARAM)
3285 void *YYPARSE_PARAM;
3286#endif
3287#else /* ! YYPARSE_PARAM */
3288#if (defined __STDC__ || defined __C99__FUNC__ \
3289 || defined __cplusplus || defined _MSC_VER)
3290int
3291yyparse (void)
3292#else
3293int
3294yyparse ()
3295
Gabor Greife64d2482008-04-06 23:07:54 +00003296#endif
3297#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003298{
3299
3300 int yystate;
3301 int yyn;
3302 int yyresult;
3303 /* Number of tokens to shift before error messages enabled. */
3304 int yyerrstatus;
3305 /* Look-ahead token as an internal (translated) token number. */
3306 int yytoken = 0;
3307#if YYERROR_VERBOSE
3308 /* Buffer for error messages, and its allocated size. */
3309 char yymsgbuf[128];
3310 char *yymsg = yymsgbuf;
3311 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
Gabor Greife64d2482008-04-06 23:07:54 +00003312#endif
Chris Lattner38905612008-02-19 04:36:25 +00003313
Dan Gohmanf4423b12008-04-19 00:24:39 +00003314 /* Three stacks and their tools:
3315 `yyss': related to states,
3316 `yyvs': related to semantic values,
3317 `yyls': related to locations.
3318
3319 Refer to the stacks thru separate pointers, to allow yyoverflow
3320 to reallocate them elsewhere. */
3321
3322 /* The state stack. */
3323 yytype_int16 yyssa[YYINITDEPTH];
3324 yytype_int16 *yyss = yyssa;
3325 yytype_int16 *yyssp;
3326
3327 /* The semantic value stack. */
3328 YYSTYPE yyvsa[YYINITDEPTH];
3329 YYSTYPE *yyvs = yyvsa;
3330 YYSTYPE *yyvsp;
3331
3332
3333
3334#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3335
3336 YYSIZE_T yystacksize = YYINITDEPTH;
3337
3338 /* The variables used to return semantic value and location from the
3339 action routines. */
3340 YYSTYPE yyval;
3341
3342
3343 /* The number of symbols on the RHS of the reduced rule.
3344 Keep to zero when no symbol should be popped. */
3345 int yylen = 0;
3346
3347 YYDPRINTF ((stderr, "Starting parse\n"));
3348
Reid Spencer68a24bd2005-08-27 18:50:39 +00003349 yystate = 0;
3350 yyerrstatus = 0;
3351 yynerrs = 0;
3352 yychar = YYEMPTY; /* Cause a token to be read. */
3353
3354 /* Initialize stack pointers.
3355 Waste one element of value and location stack
3356 so that they stay on the same level as the state stack.
3357 The wasted elements are never initialized. */
3358
Dan Gohmanf4423b12008-04-19 00:24:39 +00003359 yyssp = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003360 yyvsp = yyvs;
3361
Dan Gohmanf4423b12008-04-19 00:24:39 +00003362 goto yysetstate;
Jeff Cohen66c5fd62005-10-23 04:37:20 +00003363
Dan Gohmanf4423b12008-04-19 00:24:39 +00003364/*------------------------------------------------------------.
3365| yynewstate -- Push a new state, which is found in yystate. |
3366`------------------------------------------------------------*/
3367 yynewstate:
3368 /* In all cases, when you get here, the value and location stacks
3369 have just been pushed. So pushing a state here evens the stacks. */
3370 yyssp++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003371
Dan Gohmanf4423b12008-04-19 00:24:39 +00003372 yysetstate:
3373 *yyssp = yystate;
3374
3375 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003376 {
3377 /* Get the current used size of the three stacks, in elements. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003378 YYSIZE_T yysize = yyssp - yyss + 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003379
3380#ifdef yyoverflow
Dan Gohmanf4423b12008-04-19 00:24:39 +00003381 {
3382 /* Give user a chance to reallocate the stack. Use copies of
3383 these so that the &'s don't force the real ones into
3384 memory. */
3385 YYSTYPE *yyvs1 = yyvs;
3386 yytype_int16 *yyss1 = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003387
Dan Gohmanf4423b12008-04-19 00:24:39 +00003388
3389 /* Each stack pointer address is followed by the size of the
3390 data in use in that stack, in bytes. This used to be a
3391 conditional around just the two extra args, but that might
3392 be undefined if yyoverflow is a macro. */
3393 yyoverflow (YY_("memory exhausted"),
3394 &yyss1, yysize * sizeof (*yyssp),
3395 &yyvs1, yysize * sizeof (*yyvsp),
3396
3397 &yystacksize);
3398
3399 yyss = yyss1;
3400 yyvs = yyvs1;
3401 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00003402#else /* no yyoverflow */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003403# ifndef YYSTACK_RELOCATE
3404 goto yyexhaustedlab;
3405# else
Reid Spencer68a24bd2005-08-27 18:50:39 +00003406 /* Extend the stack our own way. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003407 if (YYMAXDEPTH <= yystacksize)
3408 goto yyexhaustedlab;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003409 yystacksize *= 2;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003410 if (YYMAXDEPTH < yystacksize)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003411 yystacksize = YYMAXDEPTH;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003412
3413 {
3414 yytype_int16 *yyss1 = yyss;
3415 union yyalloc *yyptr =
3416 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3417 if (! yyptr)
3418 goto yyexhaustedlab;
3419 YYSTACK_RELOCATE (yyss);
3420 YYSTACK_RELOCATE (yyvs);
3421
3422# undef YYSTACK_RELOCATE
3423 if (yyss1 != yyssa)
3424 YYSTACK_FREE (yyss1);
3425 }
3426# endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00003427#endif /* no yyoverflow */
3428
Dan Gohmanf4423b12008-04-19 00:24:39 +00003429 yyssp = yyss + yysize - 1;
3430 yyvsp = yyvs + yysize - 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003431
3432
Dan Gohmanf4423b12008-04-19 00:24:39 +00003433 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3434 (unsigned long int) yystacksize));
3435
3436 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003437 YYABORT;
3438 }
3439
Dan Gohmanf4423b12008-04-19 00:24:39 +00003440 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003441
3442 goto yybackup;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003443
Dan Gohmanf4423b12008-04-19 00:24:39 +00003444/*-----------.
3445| yybackup. |
3446`-----------*/
3447yybackup:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003448
Dan Gohmanf4423b12008-04-19 00:24:39 +00003449 /* Do appropriate processing given the current state. Read a
3450 look-ahead token if we need one and don't already have one. */
Reid Spencer7780acb2007-04-16 06:56:07 +00003451
Dan Gohmanf4423b12008-04-19 00:24:39 +00003452 /* First try to decide what to do without reference to look-ahead token. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003453 yyn = yypact[yystate];
Dan Gohmanf4423b12008-04-19 00:24:39 +00003454 if (yyn == YYPACT_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003455 goto yydefault;
3456
Dan Gohmanf4423b12008-04-19 00:24:39 +00003457 /* Not known => get a look-ahead token if don't already have one. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003458
Dan Gohmanf4423b12008-04-19 00:24:39 +00003459 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003460 if (yychar == YYEMPTY)
3461 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003462 YYDPRINTF ((stderr, "Reading a token: "));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003463 yychar = YYLEX;
3464 }
3465
Dan Gohmanf4423b12008-04-19 00:24:39 +00003466 if (yychar <= YYEOF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003467 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003468 yychar = yytoken = YYEOF;
3469 YYDPRINTF ((stderr, "Now at end of input.\n"));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003470 }
3471 else
3472 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003473 yytoken = YYTRANSLATE (yychar);
3474 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Reid Spencer68a24bd2005-08-27 18:50:39 +00003475 }
3476
Dan Gohmanf4423b12008-04-19 00:24:39 +00003477 /* If the proper action on seeing token YYTOKEN is to reduce or to
3478 detect an error, take that action. */
3479 yyn += yytoken;
3480 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003481 goto yydefault;
3482 yyn = yytable[yyn];
Dan Gohmanf4423b12008-04-19 00:24:39 +00003483 if (yyn <= 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003484 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003485 if (yyn == 0 || yyn == YYTABLE_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003486 goto yyerrlab;
3487 yyn = -yyn;
3488 goto yyreduce;
3489 }
3490
3491 if (yyn == YYFINAL)
3492 YYACCEPT;
3493
Dan Gohmanf4423b12008-04-19 00:24:39 +00003494 /* Count tokens shifted since error; after three, turn off error
3495 status. */
3496 if (yyerrstatus)
3497 yyerrstatus--;
Dale Johannesencdd509a2007-09-07 21:07:57 +00003498
Dan Gohmanf4423b12008-04-19 00:24:39 +00003499 /* Shift the look-ahead token. */
3500 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003501
Dan Gohmanf4423b12008-04-19 00:24:39 +00003502 /* Discard the shifted token unless it is eof. */
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003503 if (yychar != YYEOF)
3504 yychar = YYEMPTY;
3505
Gabor Greife64d2482008-04-06 23:07:54 +00003506 yystate = yyn;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003507 *++yyvsp = yylval;
3508
Reid Spencer68a24bd2005-08-27 18:50:39 +00003509 goto yynewstate;
3510
Gabor Greife64d2482008-04-06 23:07:54 +00003511
Dan Gohmanf4423b12008-04-19 00:24:39 +00003512/*-----------------------------------------------------------.
3513| yydefault -- do the default action for the current state. |
3514`-----------------------------------------------------------*/
3515yydefault:
Reid Spencer68a24bd2005-08-27 18:50:39 +00003516 yyn = yydefact[yystate];
3517 if (yyn == 0)
3518 goto yyerrlab;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003519 goto yyreduce;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003520
Dan Gohmanf4423b12008-04-19 00:24:39 +00003521
3522/*-----------------------------.
3523| yyreduce -- Do a reduction. |
3524`-----------------------------*/
Reid Spencer68a24bd2005-08-27 18:50:39 +00003525yyreduce:
Dan Gohmanf4423b12008-04-19 00:24:39 +00003526 /* yyn is the number of a rule to reduce with. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003527 yylen = yyr2[yyn];
3528
Dan Gohmanf4423b12008-04-19 00:24:39 +00003529 /* If YYLEN is nonzero, implement the default value of the action:
3530 `$$ = $1'.
3531
3532 Otherwise, the following line sets YYVAL to garbage.
3533 This behavior is undocumented and Bison
3534 users should not rely upon it. Assigning to YYVAL
3535 unconditionally makes the parser a bit smaller, and it avoids a
3536 GCC warning that YYVAL may be used uninitialized. */
3537 yyval = yyvsp[1-yylen];
3538
3539
3540 YY_REDUCE_PRINT (yyn);
3541 switch (yyn)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003542 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003543 case 29:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003544#line 1118 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003545 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3546 break;
Reid Spencer41dff5e2007-01-26 08:05:27 +00003547
Dan Gohmanf4423b12008-04-19 00:24:39 +00003548 case 30:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003549#line 1118 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003550 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3551 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003552
Dan Gohmanf4423b12008-04-19 00:24:39 +00003553 case 31:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003554#line 1119 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003555 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3556 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003557
Dan Gohmanf4423b12008-04-19 00:24:39 +00003558 case 32:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003559#line 1119 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003560 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3561 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003562
Dan Gohmanf4423b12008-04-19 00:24:39 +00003563 case 33:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003564#line 1120 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003565 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3566 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003567
Dan Gohmanf4423b12008-04-19 00:24:39 +00003568 case 34:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003569#line 1120 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003570 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3571 break;
3572
3573 case 35:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003574#line 1121 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003575 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3576 break;
3577
3578 case 36:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003579#line 1121 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003580 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3581 break;
3582
3583 case 37:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003584#line 1122 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003585 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3586 break;
3587
3588 case 38:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003589#line 1122 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003590 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3591 break;
3592
3593 case 39:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003594#line 1126 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003595 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3596 break;
3597
3598 case 40:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003599#line 1126 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003600 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3601 break;
3602
3603 case 41:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003604#line 1127 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003605 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3606 break;
3607
3608 case 42:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003609#line 1127 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003610 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3611 break;
3612
3613 case 43:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003614#line 1128 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003615 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3616 break;
3617
3618 case 44:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003619#line 1128 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003620 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3621 break;
3622
3623 case 45:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003624#line 1129 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003625 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3626 break;
3627
3628 case 46:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003629#line 1129 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003630 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3631 break;
3632
3633 case 47:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003634#line 1130 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003635 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3636 break;
3637
3638 case 48:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003639#line 1130 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003640 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3641 break;
3642
3643 case 49:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003644#line 1131 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003645 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3646 break;
3647
3648 case 50:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003649#line 1131 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003650 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3651 break;
3652
3653 case 51:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003654#line 1132 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003655 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3656 break;
3657
3658 case 52:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003659#line 1132 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003660 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3661 break;
3662
3663 case 53:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003664#line 1133 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003665 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3666 break;
3667
3668 case 54:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003669#line 1134 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003670 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3671 break;
3672
3673 case 65:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003674#line 1143 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003675 { (yyval.StrVal) = 0; ;}
3676 break;
3677
3678 case 66:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003679#line 1145 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003680 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3681 break;
3682
3683 case 67:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003684#line 1146 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003685 { (yyval.UIntVal)=0; ;}
3686 break;
3687
3688 case 68:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003689#line 1150 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003690 {
3691 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003692 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003693 ;}
3694 break;
3695
3696 case 69:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003697#line 1154 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003698 {
3699 (yyval.StrVal) = 0;
Christopher Lambbf3348d2007-12-12 08:45:45 +00003700 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003701 ;}
3702 break;
3703
3704 case 73:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003705#line 1162 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003706 {
3707 (yyval.StrVal) = 0;
Christopher Lambbf3348d2007-12-12 08:45:45 +00003708 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003709 ;}
3710 break;
3711
3712 case 74:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003713#line 1167 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003714 {
3715 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00003716 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003717 ;}
3718 break;
3719
3720 case 75:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003721#line 1173 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003722 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3723 break;
3724
3725 case 76:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003726#line 1174 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003727 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3728 break;
3729
3730 case 77:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003731#line 1175 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003732 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3733 break;
3734
3735 case 78:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003736#line 1176 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003737 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3738 break;
3739
3740 case 79:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003741#line 1177 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003742 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3743 break;
3744
3745 case 80:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003746#line 1178 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003747 { (yyval.Linkage) = GlobalValue::CommonLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003748 break;
3749
3750 case 81:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003751#line 1182 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003752 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003753 break;
3754
3755 case 82:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003756#line 1183 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003757 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003758 break;
3759
3760 case 83:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003761#line 1184 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003762 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003763 break;
3764
3765 case 84:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003766#line 1188 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003767 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3768 break;
3769
3770 case 85:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003771#line 1189 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003772 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003773 break;
3774
3775 case 86:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003776#line 1190 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003777 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003778 break;
3779
3780 case 87:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003781#line 1191 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003782 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003783 break;
3784
3785 case 88:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003786#line 1195 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003787 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003788 break;
3789
3790 case 89:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003791#line 1196 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003792 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003793 break;
3794
3795 case 90:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003796#line 1197 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003797 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003798 break;
3799
3800 case 91:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003801#line 1201 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003802 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3803 break;
3804
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003805 case 92:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003806#line 1202 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003807 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3808 break;
3809
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003810 case 93:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003811#line 1203 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003812 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3813 break;
3814
3815 case 94:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003816#line 1204 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003817 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3818 break;
3819
3820 case 95:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003821#line 1205 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003822 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3823 break;
3824
3825 case 96:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003826#line 1209 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003827 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3828 break;
3829
3830 case 97:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003831#line 1210 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003832 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3833 break;
3834
Dan Gohmanf4423b12008-04-19 00:24:39 +00003835 case 98:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003836#line 1211 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003837 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003838 break;
3839
3840 case 99:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003841#line 1214 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003842 { (yyval.UIntVal) = CallingConv::C; ;}
3843 break;
3844
3845 case 100:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003846#line 1215 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003847 { (yyval.UIntVal) = CallingConv::C; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003848 break;
3849
3850 case 101:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003851#line 1216 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003852 { (yyval.UIntVal) = CallingConv::Fast; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003853 break;
3854
3855 case 102:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003856#line 1217 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003857 { (yyval.UIntVal) = CallingConv::Cold; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003858 break;
3859
3860 case 103:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003861#line 1218 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003862 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003863 break;
3864
3865 case 104:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003866#line 1219 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003867 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3868 break;
3869
3870 case 105:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003871#line 1220 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003872 {
3873 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003874 GEN_ERROR("Calling conv too large");
Dan Gohmanf4423b12008-04-19 00:24:39 +00003875 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003876 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003877 ;}
3878 break;
3879
Dan Gohmanf4423b12008-04-19 00:24:39 +00003880 case 106:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003881#line 1227 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003882 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3883 break;
3884
3885 case 107:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003886#line 1228 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003887 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003888 break;
3889
3890 case 108:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003891#line 1229 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003892 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3893 break;
3894
3895 case 109:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003896#line 1230 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003897 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003898 break;
3899
3900 case 110:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003901#line 1231 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003902 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003903 break;
3904
3905 case 111:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003906#line 1232 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003907 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003908 break;
3909
3910 case 112:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003911#line 1233 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003912 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003913 break;
3914
3915 case 113:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003916#line 1234 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003917 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003918 break;
3919
3920 case 114:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003921#line 1235 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003922 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
3923 break;
3924
3925 case 115:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003926#line 1236 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003927 { (yyval.ParamAttrs) =
3928 ParamAttr::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
3929 break;
3930
Dan Gohmanf4423b12008-04-19 00:24:39 +00003931 case 116:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003932#line 1240 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003933 { (yyval.ParamAttrs) = ParamAttr::None; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003934 break;
3935
3936 case 117:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003937#line 1241 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003938 {
3939 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3940 ;}
3941 break;
3942
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003943 case 118:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003944#line 1246 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003945 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
3946 break;
3947
3948 case 119:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003949#line 1247 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003950 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
3951 break;
3952
3953 case 120:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003954#line 1248 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003955 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3956 break;
3957
3958 case 121:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003959#line 1249 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003960 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3961 break;
3962
3963 case 122:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003964#line 1250 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003965 { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
3966 break;
3967
3968 case 123:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003969#line 1251 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003970 { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
3971 break;
3972
3973 case 124:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003974#line 1254 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003975 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3976 break;
3977
Dan Gohmanf4423b12008-04-19 00:24:39 +00003978 case 125:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003979#line 1255 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003980 {
3981 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3982 ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003983 break;
3984
3985 case 126:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003986#line 1260 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003987 { (yyval.StrVal) = 0; ;}
3988 break;
3989
3990 case 127:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003991#line 1261 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003992 {
3993 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3994 ;}
3995 break;
3996
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003997 case 128:
Dan Gohmane4977cf2008-05-23 01:55:30 +00003998#line 1268 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003999 { (yyval.UIntVal) = 0; ;}
4000 break;
4001
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004002 case 129:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004003#line 1269 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004004 {
4005 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
4006 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004007 GEN_ERROR("Alignment must be a power of two");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004008 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004009;}
4010 break;
4011
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004012 case 130:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004013#line 1275 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004014 { (yyval.UIntVal) = 0; ;}
4015 break;
4016
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004017 case 131:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004018#line 1276 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004019 {
4020 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
4021 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Christopher Lambbf3348d2007-12-12 08:45:45 +00004022 GEN_ERROR("Alignment must be a power of two");
4023 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004024;}
4025 break;
4026
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004027 case 132:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004028#line 1285 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004029 {
4030 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
4031 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004032 GEN_ERROR("Invalid character in section name");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004033 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004034 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004035;}
4036 break;
4037
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004038 case 133:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004039#line 1293 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004040 { (yyval.StrVal) = 0; ;}
4041 break;
4042
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004043 case 134:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004044#line 1294 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004045 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
4046 break;
4047
Dan Gohmanf4423b12008-04-19 00:24:39 +00004048 case 135:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004049#line 1299 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004050 {;}
4051 break;
4052
4053 case 136:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004054#line 1300 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004055 {;}
4056 break;
4057
4058 case 137:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004059#line 1301 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004060 {
4061 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
4062 delete (yyvsp[(1) - (1)].StrVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004063 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004064 ;}
4065 break;
4066
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004067 case 138:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004068#line 1306 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004069 {
4070 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004071 GEN_ERROR("Alignment must be a power of two");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004072 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004073 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004074 ;}
4075 break;
4076
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004077 case 146:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004078#line 1322 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004079 {
4080 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004081 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004082 ;}
4083 break;
4084
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004085 case 147:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004086#line 1326 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004087 {
4088 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004089 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004090 ;}
4091 break;
4092
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004093 case 148:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004094#line 1330 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004095 { // Pointer type?
4096 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
Christopher Lambbf3348d2007-12-12 08:45:45 +00004097 GEN_ERROR("Cannot form a pointer to a basic block");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004098 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4099 delete (yyvsp[(1) - (3)].TypeVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00004100 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004101 ;}
4102 break;
4103
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004104 case 149:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004105#line 1337 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004106 { // Named types are also simple types...
4107 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00004108 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004109 (yyval.TypeVal) = new PATypeHolder(tmp);
4110 ;}
4111 break;
4112
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004113 case 150:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004114#line 1342 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004115 { // Type UpReference
4116 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004117 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Dan Gohmanf4423b12008-04-19 00:24:39 +00004118 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4119 (yyval.TypeVal) = new PATypeHolder(OT);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004120 UR_OUT("New Upreference!\n");
4121 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004122 ;}
4123 break;
4124
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004125 case 151:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004126#line 1350 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004127 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004128 // Allow but ignore attributes on function types; this permits auto-upgrade.
4129 // FIXME: remove in LLVM 3.0.
Chris Lattnera925a142008-04-23 05:37:08 +00004130 const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal);
4131 if (!FunctionType::isValidReturnType(RetTy))
4132 GEN_ERROR("Invalid result type for LLVM function");
4133
Reid Spencer41dff5e2007-01-26 08:05:27 +00004134 std::vector<const Type*> Params;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004135 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00004136 for (; I != E; ++I ) {
Reid Spencer66728ef2007-03-20 01:13:36 +00004137 const Type *Ty = I->Ty->get();
Reid Spencer66728ef2007-03-20 01:13:36 +00004138 Params.push_back(Ty);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004139 }
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004140
Reid Spencer41dff5e2007-01-26 08:05:27 +00004141 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4142 if (isVarArg) Params.pop_back();
4143
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004144 for (unsigned i = 0; i != Params.size(); ++i)
4145 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4146 GEN_ERROR("Function arguments must be value types!");
4147
4148 CHECK_FOR_ERROR
4149
Anton Korobeynikovc36284e2007-12-03 19:17:47 +00004150 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004151 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4152 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4153 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Reid Spencere4d87aa2006-12-23 06:05:41 +00004154 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004155 ;}
4156 break;
4157
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004158 case 152:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004159#line 1379 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004160 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004161 // Allow but ignore attributes on function types; this permits auto-upgrade.
4162 // FIXME: remove in LLVM 3.0.
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004163 std::vector<const Type*> Params;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004164 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00004165 for ( ; I != E; ++I ) {
Reid Spencer66728ef2007-03-20 01:13:36 +00004166 const Type* Ty = I->Ty->get();
Reid Spencer66728ef2007-03-20 01:13:36 +00004167 Params.push_back(Ty);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004168 }
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004169
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004170 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4171 if (isVarArg) Params.pop_back();
4172
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004173 for (unsigned i = 0; i != Params.size(); ++i)
4174 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4175 GEN_ERROR("Function arguments must be value types!");
4176
4177 CHECK_FOR_ERROR
4178
Dan Gohmanf4423b12008-04-19 00:24:39 +00004179 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4180 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4181 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004182 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004183 ;}
4184 break;
4185
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004186 case 153:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004187#line 1404 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004188 { // Sized array type?
4189 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4190 delete (yyvsp[(4) - (5)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004191 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004192 ;}
4193 break;
4194
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004195 case 154:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004196#line 1409 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004197 { // Vector type?
4198 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4199 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004200 GEN_ERROR("Unsigned result not equal to signed result");
4201 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4202 GEN_ERROR("Element type of a VectorType must be primitive");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004203 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4204 delete (yyvsp[(4) - (5)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004205 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004206 ;}
4207 break;
4208
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004209 case 155:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004210#line 1419 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004211 { // Structure type?
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004212 std::vector<const Type*> Elements;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004213 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4214 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004215 Elements.push_back(*I);
4216
Dan Gohmanf4423b12008-04-19 00:24:39 +00004217 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4218 delete (yyvsp[(2) - (3)].TypeList);
Reid Spencer14310612006-12-31 05:40:51 +00004219 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004220 ;}
4221 break;
4222
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004223 case 156:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004224#line 1429 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004225 { // Empty structure type?
4226 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Reid Spencer14310612006-12-31 05:40:51 +00004227 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004228 ;}
4229 break;
4230
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004231 case 157:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004232#line 1433 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004233 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004234 std::vector<const Type*> Elements;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004235 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4236 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004237 Elements.push_back(*I);
4238
Dan Gohmanf4423b12008-04-19 00:24:39 +00004239 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4240 delete (yyvsp[(3) - (5)].TypeList);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004241 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004242 ;}
4243 break;
4244
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004245 case 158:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004246#line 1443 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004247 { // Empty structure type?
4248 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004249 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004250 ;}
4251 break;
4252
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004253 case 159:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004254#line 1450 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004255 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004256 // Allow but ignore attributes on function types; this permits auto-upgrade.
4257 // FIXME: remove in LLVM 3.0.
Dan Gohmanf4423b12008-04-19 00:24:39 +00004258 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4259 (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
4260 ;}
4261 break;
4262
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004263 case 160:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004264#line 1459 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004265 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004266 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004267 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4268 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004269 GEN_ERROR("LLVM functions cannot return aggregate types");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004270 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4271 ;}
4272 break;
4273
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004274 case 161:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004275#line 1466 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004276 {
4277 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4278 ;}
4279 break;
4280
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004281 case 162:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004282#line 1471 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004283 {
4284 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4285 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
Reid Spencer3da59db2006-11-27 01:05:10 +00004286 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004287 ;}
4288 break;
4289
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004290 case 163:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004291#line 1476 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004292 {
4293 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004294 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004295 ;}
4296 break;
4297
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004298 case 165:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004299#line 1484 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004300 {
4301 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
Reid Spencer18da0722007-04-11 02:44:20 +00004302 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
Reid Spencer41dff5e2007-01-26 08:05:27 +00004303 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004304 (yyval.TypeWithAttrsList)->push_back(TWA);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004305 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004306 ;}
4307 break;
4308
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004309 case 166:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004310#line 1491 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004311 {
4312 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004313 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4314 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004315 (yyval.TypeWithAttrsList)->push_back(TWA);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004316 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004317 ;}
4318 break;
4319
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004320 case 167:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004321#line 1498 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004322 {
4323 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004324 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004325 ;}
4326 break;
4327
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004328 case 168:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004329#line 1506 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004330 {
4331 (yyval.TypeList) = new std::list<PATypeHolder>();
4332 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4333 delete (yyvsp[(1) - (1)].TypeVal);
Reid Spencer3da59db2006-11-27 01:05:10 +00004334 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004335 ;}
4336 break;
4337
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004338 case 169:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004339#line 1512 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004340 {
4341 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4342 delete (yyvsp[(3) - (3)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004343 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004344 ;}
4345 break;
4346
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004347 case 170:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004348#line 1524 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004349 { // Nonempty unsized arr
Reid Spencer14310612006-12-31 05:40:51 +00004350 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004351 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4352 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004353 if (ATy == 0)
Reid Spencer61c83e02006-08-18 08:43:06 +00004354 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004355 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004356 const Type *ETy = ATy->getElementType();
4357 int NumElements = ATy->getNumElements();
4358
4359 // Verify that we have the correct size...
Dan Gohmanf4423b12008-04-19 00:24:39 +00004360 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004361 GEN_ERROR("Type mismatch: constant sized array initialized with " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004362 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Reid Spencerb5334b02007-02-05 10:18:06 +00004363 itostr(NumElements) + "");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004364
4365 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004366 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4367 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004368 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4369 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohmanf4423b12008-04-19 00:24:39 +00004370 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004371 }
4372
Dan Gohmanf4423b12008-04-19 00:24:39 +00004373 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4374 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004375 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004376 ;}
4377 break;
4378
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004379 case 171:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004380#line 1552 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004381 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004382 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004383 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4384 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004385 if (ATy == 0)
4386 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004387 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004388
Andrew Lenharth6353e052006-12-08 18:07:09 +00004389 int NumElements = ATy->getNumElements();
4390 if (NumElements != -1 && NumElements != 0)
4391 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
Reid Spencerb5334b02007-02-05 10:18:06 +00004392 " arguments, but has size of " + itostr(NumElements) +"");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004393 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4394 delete (yyvsp[(1) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00004395 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004396 ;}
4397 break;
4398
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004399 case 172:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004400#line 1568 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004401 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +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 Korobeynikovf52e6082007-04-29 18:38:24 +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() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004408
4409 int NumElements = ATy->getNumElements();
4410 const Type *ETy = ATy->getElementType();
Dan Gohmanf4423b12008-04-19 00:24:39 +00004411 if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004412 GEN_ERROR("Can't build string constant of size " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004413 itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) +
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004414 " when array has size " + itostr(NumElements) + "");
4415 std::vector<Constant*> Vals;
4416 if (ETy == Type::Int8Ty) {
Dan Gohmanf4423b12008-04-19 00:24:39 +00004417 for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
4418 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004419 } else {
Dan Gohmanf4423b12008-04-19 00:24:39 +00004420 delete (yyvsp[(3) - (3)].StrVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004421 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4422 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004423 delete (yyvsp[(3) - (3)].StrVal);
4424 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4425 delete (yyvsp[(1) - (3)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004426 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004427 ;}
4428 break;
4429
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004430 case 173:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004431#line 1595 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004432 { // Nonempty unsized arr
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004433 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004434 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4435 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004436 if (PTy == 0)
4437 GEN_ERROR("Cannot make packed constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004438 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004439 const Type *ETy = PTy->getElementType();
4440 int NumElements = PTy->getNumElements();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004441
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004442 // Verify that we have the correct size...
Dan Gohmanf4423b12008-04-19 00:24:39 +00004443 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004444 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004445 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Reid Spencerb5334b02007-02-05 10:18:06 +00004446 itostr(NumElements) + "");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004447
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004448 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004449 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4450 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004451 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4452 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohmanf4423b12008-04-19 00:24:39 +00004453 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004454 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00004455
Dan Gohmanf4423b12008-04-19 00:24:39 +00004456 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4457 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004458 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004459 ;}
4460 break;
4461
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004462 case 174:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004463#line 1623 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004464 {
4465 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004466 if (STy == 0)
4467 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004468 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004469
Dan Gohmanf4423b12008-04-19 00:24:39 +00004470 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004471 GEN_ERROR("Illegal number of initializers for structure type");
4472
4473 // Check to ensure that constants are compatible with the type initializer!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004474 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4475 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004476 GEN_ERROR("Expected type '" +
4477 STy->getElementType(i)->getDescription() +
4478 "' for element #" + utostr(i) +
4479 " of structure initializer");
4480
4481 // Check to ensure that Type is not packed
4482 if (STy->isPacked())
4483 GEN_ERROR("Unpacked Initializer to vector type '" +
4484 STy->getDescription() + "'");
4485
Dan Gohmanf4423b12008-04-19 00:24:39 +00004486 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4487 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004488 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004489 ;}
4490 break;
4491
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004492 case 175:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004493#line 1649 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004494 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004495 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004496 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4497 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004498 if (STy == 0)
4499 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004500 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004501
4502 if (STy->getNumContainedTypes() != 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00004503 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004504
4505 // Check to ensure that Type is not packed
4506 if (STy->isPacked())
Chris Lattner6cdc6822007-04-26 05:31:05 +00004507 GEN_ERROR("Unpacked Initializer to vector type '" +
4508 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004509
Dan Gohmanf4423b12008-04-19 00:24:39 +00004510 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4511 delete (yyvsp[(1) - (3)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004512 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004513 ;}
4514 break;
4515
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004516 case 176:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004517#line 1669 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004518 {
4519 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004520 if (STy == 0)
4521 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004522 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004523
Dan Gohmanf4423b12008-04-19 00:24:39 +00004524 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
Reid Spencerb5334b02007-02-05 10:18:06 +00004525 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004526
4527 // Check to ensure that constants are compatible with the type initializer!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004528 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4529 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
Reid Spencer41dff5e2007-01-26 08:05:27 +00004530 GEN_ERROR("Expected type '" +
4531 STy->getElementType(i)->getDescription() +
4532 "' for element #" + utostr(i) +
Reid Spencerb5334b02007-02-05 10:18:06 +00004533 " of structure initializer");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004534
4535 // Check to ensure that Type is packed
4536 if (!STy->isPacked())
Chris Lattner32980692007-02-19 07:44:24 +00004537 GEN_ERROR("Vector initializer to non-vector type '" +
4538 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004539
Dan Gohmanf4423b12008-04-19 00:24:39 +00004540 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4541 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004542 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004543 ;}
4544 break;
4545
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004546 case 177:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004547#line 1695 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004548 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004549 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004550 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4551 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004552 if (STy == 0)
4553 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004554 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004555
4556 if (STy->getNumContainedTypes() != 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00004557 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004558
4559 // Check to ensure that Type is packed
4560 if (!STy->isPacked())
Chris Lattner32980692007-02-19 07:44:24 +00004561 GEN_ERROR("Vector initializer to non-vector type '" +
4562 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004563
Dan Gohmanf4423b12008-04-19 00:24:39 +00004564 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4565 delete (yyvsp[(1) - (5)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004566 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004567 ;}
4568 break;
4569
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004570 case 178:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004571#line 1715 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004572 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004573 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004574 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4575 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004576 if (PTy == 0)
4577 GEN_ERROR("Cannot make null pointer constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004578 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004579
Dan Gohmanf4423b12008-04-19 00:24:39 +00004580 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4581 delete (yyvsp[(1) - (2)].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004582 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004583 ;}
4584 break;
4585
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004586 case 179:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004587#line 1727 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004588 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004589 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004590 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4591 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4592 delete (yyvsp[(1) - (2)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004593 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004594 ;}
4595 break;
4596
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004597 case 180:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004598#line 1734 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004599 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004600 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004601 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4602 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004603 if (Ty == 0)
Dan Gohmanf4423b12008-04-19 00:24:39 +00004604 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004605
4606 // ConstExprs can exist in the body of a function, thus creating
4607 // GlobalValues whenever they refer to a variable. Because we are in
Reid Spencer93c40032007-03-19 18:40:50 +00004608 // the context of a function, getExistingVal will search the functions
Reid Spencer68a24bd2005-08-27 18:50:39 +00004609 // symbol table instead of the module symbol table for the global symbol,
4610 // which throws things all off. To get around this, we just tell
Reid Spencer93c40032007-03-19 18:40:50 +00004611 // getExistingVal that we are at global scope here.
Reid Spencer68a24bd2005-08-27 18:50:39 +00004612 //
4613 Function *SavedCurFn = CurFun.CurrentFunction;
4614 CurFun.CurrentFunction = 0;
4615
Dan Gohmanf4423b12008-04-19 00:24:39 +00004616 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00004617 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00004618
4619 CurFun.CurrentFunction = SavedCurFn;
4620
4621 // If this is an initializer for a constant pointer, which is referencing a
4622 // (currently) undefined variable, create a stub now that shall be replaced
4623 // in the future with the right type of variable.
4624 //
4625 if (V == 0) {
Reid Spencera9720f52007-02-05 17:04:00 +00004626 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004627 const PointerType *PT = cast<PointerType>(Ty);
4628
4629 // First check to see if the forward references value is already created!
4630 PerModuleInfo::GlobalRefsType::iterator I =
Dan Gohmanf4423b12008-04-19 00:24:39 +00004631 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004632
4633 if (I != CurModule.GlobalRefs.end()) {
4634 V = I->second; // Placeholder already exists, use it...
Dan Gohmanf4423b12008-04-19 00:24:39 +00004635 (yyvsp[(2) - (2)].ValIDVal).destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +00004636 } else {
4637 std::string Name;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004638 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4639 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4640 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
Reid Spencer41dff5e2007-01-26 08:05:27 +00004641 GEN_ERROR("Invalid reference to global");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004642
4643 // Create the forward referenced global.
4644 GlobalValue *GV;
4645 if (const FunctionType *FTy =
4646 dyn_cast<FunctionType>(PT->getElementType())) {
Gabor Greife64d2482008-04-06 23:07:54 +00004647 GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
4648 CurModule.CurrentModule);
Reid Spencer68a24bd2005-08-27 18:50:39 +00004649 } else {
4650 GV = new GlobalVariable(PT->getElementType(), false,
Chris Lattner6cdc6822007-04-26 05:31:05 +00004651 GlobalValue::ExternalWeakLinkage, 0,
Reid Spencer68a24bd2005-08-27 18:50:39 +00004652 Name, CurModule.CurrentModule);
4653 }
4654
4655 // Keep track of the fact that we have a forward ref to recycle it
Dan Gohmanf4423b12008-04-19 00:24:39 +00004656 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004657 V = GV;
4658 }
4659 }
4660
Dan Gohmanf4423b12008-04-19 00:24:39 +00004661 (yyval.ConstVal) = cast<GlobalValue>(V);
4662 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
Reid Spencer61c83e02006-08-18 08:43:06 +00004663 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004664 ;}
4665 break;
4666
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004667 case 181:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004668#line 1800 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004669 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004670 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004671 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4672 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004673 GEN_ERROR("Mismatched types for constant expression: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004674 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4675 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4676 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004677 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004678 ;}
4679 break;
4680
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004681 case 182:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004682#line 1810 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004683 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004684 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004685 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4686 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004687 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4688 GEN_ERROR("Cannot create a null initialized value of this type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004689 (yyval.ConstVal) = Constant::getNullValue(Ty);
4690 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004691 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004692 ;}
4693 break;
4694
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004695 case 183:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004696#line 1820 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004697 { // integral constants
4698 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004699 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004700 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
Reid Spencer38c91a92007-02-28 02:24:54 +00004701 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004702 ;}
4703 break;
4704
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004705 case 184:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004706#line 1826 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004707 { // arbitrary precision integer constants
4708 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4709 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004710 GEN_ERROR("Constant value does not fit in type");
4711 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004712 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4713 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4714 delete (yyvsp[(2) - (2)].APIntVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004715 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004716 ;}
4717 break;
4718
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004719 case 185:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004720#line 1836 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004721 { // integral constants
4722 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004723 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004724 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004725 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004726 ;}
4727 break;
4728
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004729 case 186:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004730#line 1842 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004731 { // arbitrary precision integer constants
4732 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4733 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004734 GEN_ERROR("Constant value does not fit in type");
4735 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004736 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4737 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4738 delete (yyvsp[(2) - (2)].APIntVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004739 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004740 ;}
4741 break;
4742
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004743 case 187:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004744#line 1852 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004745 { // Boolean constants
4746 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4747 (yyval.ConstVal) = ConstantInt::getTrue();
Reid Spencer38c91a92007-02-28 02:24:54 +00004748 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004749 ;}
4750 break;
4751
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004752 case 188:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004753#line 1857 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004754 { // Boolean constants
4755 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4756 (yyval.ConstVal) = ConstantInt::getFalse();
Reid Spencer6f407902007-01-13 05:00:46 +00004757 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004758 ;}
4759 break;
4760
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004761 case 189:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004762#line 1862 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004763 { // Floating point constants
4764 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004765 GEN_ERROR("Floating point constant invalid for type");
Dale Johannesenc72cd7e2007-09-11 18:33:39 +00004766 // Lexer has no type info, so builds all float and double FP constants
4767 // as double. Fix this here. Long double is done right.
Dan Gohmanf4423b12008-04-19 00:24:39 +00004768 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4769 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
Chris Lattnerd8eb63f2008-04-20 00:41:19 +00004770 (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal));
Dan Gohmanf4423b12008-04-19 00:24:39 +00004771 delete (yyvsp[(2) - (2)].FPVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004772 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004773 ;}
4774 break;
4775
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004776 case 190:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004777#line 1875 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004778 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004779 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004780 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4781 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4782 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4783 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004784 GEN_ERROR("invalid cast opcode for cast from '" +
4785 Val->getType()->getDescription() + "' to '" +
4786 DestTy->getDescription() + "'");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004787 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4788 delete (yyvsp[(5) - (6)].TypeVal);
4789 ;}
4790 break;
4791
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004792 case 191:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004793#line 1887 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004794 {
4795 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
Reid Spencerb5334b02007-02-05 10:18:06 +00004796 GEN_ERROR("GetElementPtr requires a pointer operand");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004797
4798 const Type *IdxTy =
Dan Gohman041e2eb2008-05-15 19:50:34 +00004799 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004800 if (!IdxTy)
Reid Spencerb5334b02007-02-05 10:18:06 +00004801 GEN_ERROR("Index list invalid for constant getelementptr");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004802
Chris Lattnerf7469af2007-01-31 04:44:08 +00004803 SmallVector<Constant*, 8> IdxVec;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004804 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4805 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004806 IdxVec.push_back(C);
4807 else
Reid Spencerb5334b02007-02-05 10:18:06 +00004808 GEN_ERROR("Indices to constant getelementptr must be constants");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004809
Dan Gohmanf4423b12008-04-19 00:24:39 +00004810 delete (yyvsp[(4) - (5)].ValueList);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004811
Dan Gohmanf4423b12008-04-19 00:24:39 +00004812 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
Andrew Lenharth6353e052006-12-08 18:07:09 +00004813 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004814 ;}
4815 break;
4816
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004817 case 192:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004818#line 1908 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004819 {
4820 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004821 GEN_ERROR("Select condition must be of boolean type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004822 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004823 GEN_ERROR("Select operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004824 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004825 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004826 ;}
4827 break;
4828
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004829 case 193:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004830#line 1916 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004831 {
4832 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004833 GEN_ERROR("Binary operator types must match");
4834 CHECK_FOR_ERROR;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004835 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4836 ;}
4837 break;
4838
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004839 case 194:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004840#line 1922 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004841 {
4842 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004843 GEN_ERROR("Logical operator types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004844 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
4845 if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
4846 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004847 GEN_ERROR("Logical operator requires integral operands");
4848 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004849 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004850 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004851 ;}
4852 break;
4853
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004854 case 195:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004855#line 1933 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004856 {
4857 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004858 GEN_ERROR("icmp operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004859 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4860 ;}
4861 break;
4862
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004863 case 196:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004864#line 1938 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004865 {
4866 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004867 GEN_ERROR("fcmp operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004868 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4869 ;}
4870 break;
4871
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004872 case 197:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004873#line 1943 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00004874 {
4875 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4876 GEN_ERROR("vicmp operand types must match");
4877 (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4878 ;}
4879 break;
4880
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004881 case 198:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004882#line 1948 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00004883 {
4884 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4885 GEN_ERROR("vfcmp operand types must match");
4886 (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4887 ;}
4888 break;
4889
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004890 case 199:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004891#line 1953 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004892 {
4893 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004894 GEN_ERROR("Invalid extractelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004895 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004896 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004897 ;}
4898 break;
4899
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004900 case 200:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004901#line 1959 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004902 {
4903 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004904 GEN_ERROR("Invalid insertelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004905 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004906 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004907 ;}
4908 break;
4909
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004910 case 201:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004911#line 1965 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004912 {
4913 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004914 GEN_ERROR("Invalid shufflevector operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004915 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004916 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004917 ;}
4918 break;
4919
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004920 case 202:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004921#line 1971 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4922 {
4923 if (!isa<StructType>((yyvsp[(3) - (5)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (5)].ConstVal)->getType()))
4924 GEN_ERROR("ExtractValue requires an aggregate operand");
4925
4926 const Type *IdxTy =
4927 ExtractValueInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end());
4928 if (!IdxTy)
4929 GEN_ERROR("Index list invalid for constant extractvalue");
4930
4931 SmallVector<Constant*, 8> IdxVec;
4932 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4933 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
4934 IdxVec.push_back(C);
4935 else
4936 GEN_ERROR("Indices to constant extractvalue must be constants");
4937
4938 delete (yyvsp[(4) - (5)].ValueList);
4939
4940 (yyval.ConstVal) = ConstantExpr::getExtractValue((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
4941 CHECK_FOR_ERROR
4942 ;}
4943 break;
4944
4945 case 203:
4946#line 1992 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4947 {
4948 if (!isa<StructType>((yyvsp[(3) - (7)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (7)].ConstVal)->getType()))
4949 GEN_ERROR("InsertValue requires an aggregate operand");
4950
4951 const Type *IdxTy =
4952 ExtractValueInst::getIndexedType((yyvsp[(3) - (7)].ConstVal)->getType(), (yyvsp[(6) - (7)].ValueList)->begin(), (yyvsp[(6) - (7)].ValueList)->end());
4953 if (IdxTy != (yyvsp[(5) - (7)].ConstVal)->getType())
4954 GEN_ERROR("Index list invalid for constant insertvalue");
4955
4956 SmallVector<Constant*, 8> IdxVec;
4957 for (unsigned i = 0, e = (yyvsp[(6) - (7)].ValueList)->size(); i != e; ++i)
4958 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(6) - (7)].ValueList))[i]))
4959 IdxVec.push_back(C);
4960 else
4961 GEN_ERROR("Indices to constant insertvalue must be constants");
4962
4963 delete (yyvsp[(6) - (7)].ValueList);
4964
4965 (yyval.ConstVal) = ConstantExpr::getInsertValue((yyvsp[(3) - (7)].ConstVal), (yyvsp[(5) - (7)].ConstVal), &IdxVec[0], IdxVec.size());
4966 CHECK_FOR_ERROR
4967 ;}
4968 break;
4969
4970 case 204:
4971#line 2016 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004972 {
4973 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004974 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004975 ;}
4976 break;
4977
Dan Gohmane4977cf2008-05-23 01:55:30 +00004978 case 205:
4979#line 2020 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004980 {
4981 (yyval.ConstVector) = new std::vector<Constant*>();
4982 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004983 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004984 ;}
4985 break;
4986
Nate Begemanac80ade2008-05-12 19:01:56 +00004987 case 206:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004988#line 2028 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4989 { (yyval.BoolVal) = false; ;}
Nate Begemanac80ade2008-05-12 19:01:56 +00004990 break;
4991
4992 case 207:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004993#line 2028 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4994 { (yyval.BoolVal) = true; ;}
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004995 break;
4996
4997 case 208:
Dan Gohmane4977cf2008-05-23 01:55:30 +00004998#line 2031 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
4999 { (yyval.BoolVal) = true; ;}
5000 break;
5001
5002 case 209:
5003#line 2031 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5004 { (yyval.BoolVal) = false; ;}
5005 break;
5006
5007 case 210:
5008#line 2034 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005009 {
5010 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
5011 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
Chris Lattner0275cff2007-08-06 21:00:46 +00005012 CHECK_FOR_ERROR
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005013 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
5014 if (!Aliasee)
5015 GEN_ERROR("Aliases can be created only to global values");
5016
Dan Gohmanf4423b12008-04-19 00:24:39 +00005017 (yyval.ConstVal) = Aliasee;
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005018 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005019 delete (yyvsp[(1) - (2)].TypeVal);
5020 ;}
5021 break;
5022
Dan Gohmane4977cf2008-05-23 01:55:30 +00005023 case 211:
5024#line 2046 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005025 {
5026 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
5027 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
5028 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005029 GEN_ERROR("invalid cast opcode for cast from '" +
5030 Val->getType()->getDescription() + "' to '" +
5031 DestTy->getDescription() + "'");
5032
Dan Gohmanf4423b12008-04-19 00:24:39 +00005033 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005034 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005035 delete (yyvsp[(5) - (6)].TypeVal);
5036 ;}
5037 break;
5038
Dan Gohmane4977cf2008-05-23 01:55:30 +00005039 case 212:
5040#line 2067 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005041 {
5042 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
Dale Johannesen172f3112008-02-20 21:15:43 +00005043 CurModule.ModuleDone();
5044 CHECK_FOR_ERROR;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005045 ;}
5046 break;
5047
Dan Gohmane4977cf2008-05-23 01:55:30 +00005048 case 213:
5049#line 2072 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005050 {
5051 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5052 CurModule.ModuleDone();
5053 CHECK_FOR_ERROR;
5054 ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00005055 break;
5056
Dan Gohmane4977cf2008-05-23 01:55:30 +00005057 case 216:
5058#line 2085 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005059 { CurFun.isDeclare = false; ;}
5060 break;
5061
Dan Gohmane4977cf2008-05-23 01:55:30 +00005062 case 217:
5063#line 2085 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005064 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005065 CurFun.FunctionDone();
5066 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005067 ;}
5068 break;
5069
Dan Gohmane4977cf2008-05-23 01:55:30 +00005070 case 218:
5071#line 2089 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005072 { CurFun.isDeclare = true; ;}
5073 break;
5074
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005075 case 219:
Dan Gohmane4977cf2008-05-23 01:55:30 +00005076#line 2089 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5077 {
5078 CHECK_FOR_ERROR
5079 ;}
5080 break;
5081
5082 case 220:
5083#line 2092 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
5084 {
5085 CHECK_FOR_ERROR
5086 ;}
5087 break;
5088
5089 case 221:
5090#line 2095 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005091 {
Reid Spencer14310612006-12-31 05:40:51 +00005092 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005093 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005094 // Eagerly resolve types. This is not an optimization, this is a
5095 // requirement that is due to the fact that we could have this:
5096 //
5097 // %list = type { %list * }
5098 // %list = type { %list * } ; repeated type decl
5099 //
5100 // If types are not resolved eagerly, then the two types will not be
5101 // determined to be the same type!
5102 //
Dan Gohmanf4423b12008-04-19 00:24:39 +00005103 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005104
Dan Gohmanf4423b12008-04-19 00:24:39 +00005105 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Reid Spencer5b7e7532006-09-28 19:28:24 +00005106 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005107 // If this is a named type that is not a redefinition, add it to the slot
5108 // table.
Dan Gohmanf4423b12008-04-19 00:24:39 +00005109 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005110 }
Reid Spencera132e042006-12-03 05:46:11 +00005111
Dan Gohmanf4423b12008-04-19 00:24:39 +00005112 delete (yyvsp[(3) - (3)].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005113 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005114 ;}
5115 break;
Reid Spencerb8f85052007-07-31 03:50:36 +00005116
Dan Gohmane4977cf2008-05-23 01:55:30 +00005117 case 222:
5118#line 2119 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005119 {
5120 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
5121
5122 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005123 CHECK_FOR_ERROR
5124 // If this is a named type that is not a redefinition, add it to the slot
5125 // table.
Dan Gohmanf4423b12008-04-19 00:24:39 +00005126 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005127 }
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005128 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005129 ;}
5130 break;
5131
Dan Gohmane4977cf2008-05-23 01:55:30 +00005132 case 223:
5133#line 2131 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005134 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005135 /* "Externally Visible" Linkage */
Dan Gohmanf4423b12008-04-19 00:24:39 +00005136 if ((yyvsp[(5) - (6)].ConstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005137 GEN_ERROR("Global value initializer is not a constant");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005138 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5139 (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 +00005140 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005141 ;}
5142 break;
5143
Dan Gohmane4977cf2008-05-23 01:55:30 +00005144 case 224:
5145#line 2138 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005146 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005147 CurGV = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005148 ;}
5149 break;
5150
Dan Gohmane4977cf2008-05-23 01:55:30 +00005151 case 225:
5152#line 2142 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005153 {
5154 if ((yyvsp[(6) - (7)].ConstVal) == 0)
Christopher Lambbf3348d2007-12-12 08:45:45 +00005155 GEN_ERROR("Global value initializer is not a constant");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005156 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 +00005157 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005158 ;}
5159 break;
5160
Dan Gohmane4977cf2008-05-23 01:55:30 +00005161 case 226:
5162#line 2147 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005163 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005164 CurGV = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005165 ;}
5166 break;
5167
Dan Gohmane4977cf2008-05-23 01:55:30 +00005168 case 227:
5169#line 2151 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005170 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005171 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005172 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5173 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 +00005174 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005175 delete (yyvsp[(6) - (7)].TypeVal);
5176 ;}
5177 break;
5178
Dan Gohmane4977cf2008-05-23 01:55:30 +00005179 case 228:
5180#line 2157 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005181 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005182 CurGV = 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +00005183 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005184 ;}
5185 break;
5186
Dan Gohmane4977cf2008-05-23 01:55:30 +00005187 case 229:
5188#line 2161 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005189 {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005190 std::string Name;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005191 if ((yyvsp[(1) - (5)].StrVal)) {
5192 Name = *(yyvsp[(1) - (5)].StrVal);
5193 delete (yyvsp[(1) - (5)].StrVal);
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005194 }
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005195 if (Name.empty())
5196 GEN_ERROR("Alias name cannot be empty");
5197
Dan Gohmanf4423b12008-04-19 00:24:39 +00005198 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005199 if (Aliasee == 0)
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005200 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005201
Dan Gohmanf4423b12008-04-19 00:24:39 +00005202 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005203 CurModule.CurrentModule);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005204 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005205 InsertValue(GA, CurModule.Values);
Chris Lattner569f7372007-09-10 23:24:14 +00005206
5207
5208 // If there was a forward reference of this alias, resolve it now.
5209
5210 ValID ID;
5211 if (!Name.empty())
5212 ID = ValID::createGlobalName(Name);
5213 else
5214 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5215
5216 if (GlobalValue *FWGV =
5217 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5218 // Replace uses of the fwdref with the actual alias.
5219 FWGV->replaceAllUsesWith(GA);
5220 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5221 GV->eraseFromParent();
5222 else
5223 cast<Function>(FWGV)->eraseFromParent();
5224 }
5225 ID.destroy();
5226
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005227 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005228 ;}
5229 break;
5230
Dan Gohmane4977cf2008-05-23 01:55:30 +00005231 case 230:
5232#line 2201 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005233 {
Anton Korobeynikov77d0f972007-04-25 14:29:12 +00005234 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005235 ;}
5236 break;
5237
Dan Gohmane4977cf2008-05-23 01:55:30 +00005238 case 231:
5239#line 2204 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005240 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005241 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005242 ;}
5243 break;
5244
Dan Gohmane4977cf2008-05-23 01:55:30 +00005245 case 232:
5246#line 2210 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005247 {
Chris Lattner66316012006-01-24 04:14:29 +00005248 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
Chris Lattner66316012006-01-24 04:14:29 +00005249 if (AsmSoFar.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005250 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
Chris Lattner66316012006-01-24 04:14:29 +00005251 else
Dan Gohmanf4423b12008-04-19 00:24:39 +00005252 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5253 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00005254 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005255;}
5256 break;
5257
Dan Gohmane4977cf2008-05-23 01:55:30 +00005258 case 233:
5259#line 2220 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005260 {
5261 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5262 delete (yyvsp[(3) - (3)].StrVal);
5263 ;}
5264 break;
5265
Dan Gohmane4977cf2008-05-23 01:55:30 +00005266 case 234:
5267#line 2224 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005268 {
5269 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5270 delete (yyvsp[(3) - (3)].StrVal);
5271 ;}
5272 break;
5273
Dan Gohmane4977cf2008-05-23 01:55:30 +00005274 case 236:
5275#line 2231 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005276 {
5277 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5278 delete (yyvsp[(3) - (3)].StrVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00005279 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005280 ;}
5281 break;
5282
Dan Gohmane4977cf2008-05-23 01:55:30 +00005283 case 237:
5284#line 2236 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005285 {
5286 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5287 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer1013b4d2007-07-31 14:41:17 +00005288 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005289 ;}
5290 break;
5291
Dan Gohmane4977cf2008-05-23 01:55:30 +00005292 case 238:
5293#line 2241 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005294 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005295 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005296 ;}
5297 break;
5298
Dan Gohmane4977cf2008-05-23 01:55:30 +00005299 case 239:
5300#line 2250 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005301 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005302 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005303 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
5304 if (*(yyvsp[(3) - (5)].TypeVal) == Type::VoidTy)
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005305 GEN_ERROR("void typed arguments are invalid");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005306 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5307 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5308 (yyvsp[(1) - (5)].ArgList)->push_back(E);
Reid Spencer6f407902007-01-13 05:00:46 +00005309 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005310 ;}
5311 break;
5312
Dan Gohmane4977cf2008-05-23 01:55:30 +00005313 case 240:
5314#line 2260 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005315 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005316 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005317 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
5318 if (*(yyvsp[(1) - (3)].TypeVal) == Type::VoidTy)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005319 GEN_ERROR("void typed arguments are invalid");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005320 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5321 (yyval.ArgList) = new ArgListType;
5322 (yyval.ArgList)->push_back(E);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005323 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005324 ;}
5325 break;
5326
Dan Gohmane4977cf2008-05-23 01:55:30 +00005327 case 241:
5328#line 2271 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005329 {
5330 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005331 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005332 ;}
5333 break;
5334
Dan Gohmane4977cf2008-05-23 01:55:30 +00005335 case 242:
5336#line 2275 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005337 {
5338 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005339 struct ArgListEntry E;
5340 E.Ty = new PATypeHolder(Type::VoidTy);
5341 E.Name = 0;
Reid Spencer18da0722007-04-11 02:44:20 +00005342 E.Attrs = ParamAttr::None;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005343 (yyval.ArgList)->push_back(E);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005344 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005345 ;}
5346 break;
5347
Dan Gohmane4977cf2008-05-23 01:55:30 +00005348 case 243:
5349#line 2284 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005350 {
5351 (yyval.ArgList) = new ArgListType;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005352 struct ArgListEntry E;
5353 E.Ty = new PATypeHolder(Type::VoidTy);
5354 E.Name = 0;
5355 E.Attrs = ParamAttr::None;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005356 (yyval.ArgList)->push_back(E);
Reid Spencer61c83e02006-08-18 08:43:06 +00005357 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005358 ;}
5359 break;
5360
Dan Gohmane4977cf2008-05-23 01:55:30 +00005361 case 244:
5362#line 2293 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005363 {
5364 (yyval.ArgList) = 0;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005365 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005366 ;}
5367 break;
5368
Dan Gohmane4977cf2008-05-23 01:55:30 +00005369 case 245:
5370#line 2299 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005371 {
5372 std::string FunctionName(*(yyvsp[(3) - (10)].StrVal));
5373 delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory!
Reid Spencer68a24bd2005-08-27 18:50:39 +00005374
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005375 // Check the function result for abstractness if this is a define. We should
5376 // have no abstract types at this point
Dan Gohmanf4423b12008-04-19 00:24:39 +00005377 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal)))
5378 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription());
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005379
Chris Lattnera925a142008-04-23 05:37:08 +00005380 if (!FunctionType::isValidReturnType(*(yyvsp[(2) - (10)].TypeVal)))
5381 GEN_ERROR("Invalid result type for LLVM function");
5382
Reid Spencer68a24bd2005-08-27 18:50:39 +00005383 std::vector<const Type*> ParamTypeList;
Chris Lattner58d74912008-03-12 17:45:29 +00005384 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005385 if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None)
5386 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(7) - (10)].ParamAttrs)));
5387 if ((yyvsp[(5) - (10)].ArgList)) { // If there are arguments...
Reid Spencer7b5d4662007-04-09 06:16:21 +00005388 unsigned index = 1;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005389 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); I != (yyvsp[(5) - (10)].ArgList)->end(); ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00005390 const Type* Ty = I->Ty->get();
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005391 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5392 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
Reid Spencer14310612006-12-31 05:40:51 +00005393 ParamTypeList.push_back(Ty);
Chris Lattner58d74912008-03-12 17:45:29 +00005394 if (Ty != Type::VoidTy && I->Attrs != ParamAttr::None)
5395 Attrs.push_back(ParamAttrsWithIndex::get(index, I->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00005396 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005397 }
5398
5399 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5400 if (isVarArg) ParamTypeList.pop_back();
5401
Chris Lattner58d74912008-03-12 17:45:29 +00005402 PAListPtr PAL;
Christopher Lamb5c104242007-04-22 20:09:11 +00005403 if (!Attrs.empty())
Chris Lattner58d74912008-03-12 17:45:29 +00005404 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Reid Spencer7b5d4662007-04-09 06:16:21 +00005405
Dan Gohmanf4423b12008-04-19 00:24:39 +00005406 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00005407 const PointerType *PFT = PointerType::getUnqual(FT);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005408 delete (yyvsp[(2) - (10)].TypeVal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005409
5410 ValID ID;
5411 if (!FunctionName.empty()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005412 ID = ValID::createGlobalName((char*)FunctionName.c_str());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005413 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00005414 ID = ValID::createGlobalID(CurModule.Values.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005415 }
5416
5417 Function *Fn = 0;
5418 // See if this function was forward referenced. If so, recycle the object.
5419 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5420 // Move the function to the end of the list, from whereever it was
5421 // previously inserted.
5422 Fn = cast<Function>(FWRef);
Chris Lattner58d74912008-03-12 17:45:29 +00005423 assert(Fn->getParamAttrs().isEmpty() &&
5424 "Forward reference has parameter attributes!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005425 CurModule.CurrentModule->getFunctionList().remove(Fn);
5426 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5427 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
Reid Spenceref9b9a72007-02-05 20:47:22 +00005428 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
Duncan Sandsdc024672007-11-27 13:23:08 +00005429 if (Fn->getFunctionType() != FT ) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00005430 // The existing function doesn't have the same type. This is an overload
5431 // error.
5432 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Duncan Sandsdc024672007-11-27 13:23:08 +00005433 } else if (Fn->getParamAttrs() != PAL) {
5434 // The existing function doesn't have the same parameter attributes.
5435 // This is an overload error.
5436 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Reid Spenceref9b9a72007-02-05 20:47:22 +00005437 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
Chris Lattner6cdc6822007-04-26 05:31:05 +00005438 // Neither the existing or the current function is a declaration and they
5439 // have the same name and same type. Clearly this is a redefinition.
5440 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
Duncan Sandsdc024672007-11-27 13:23:08 +00005441 } else if (Fn->isDeclaration()) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00005442 // Make sure to strip off any argument names so we can't get conflicts.
Reid Spencer68a24bd2005-08-27 18:50:39 +00005443 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5444 AI != AE; ++AI)
5445 AI->setName("");
Reid Spenceref9b9a72007-02-05 20:47:22 +00005446 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005447 } else { // Not already defined?
Gabor Greife64d2482008-04-06 23:07:54 +00005448 Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5449 CurModule.CurrentModule);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005450 InsertValue(Fn, CurModule.Values);
5451 }
5452
5453 CurFun.FunctionStart(Fn);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00005454
5455 if (CurFun.isDeclare) {
5456 // If we have declaration, always overwrite linkage. This will allow us to
5457 // correctly handle cases, when pointer to function is passed as argument to
5458 // another function.
5459 Fn->setLinkage(CurFun.Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005460 Fn->setVisibility(CurFun.Visibility);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00005461 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00005462 Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal));
Duncan Sandsdc024672007-11-27 13:23:08 +00005463 Fn->setParamAttrs(PAL);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005464 Fn->setAlignment((yyvsp[(9) - (10)].UIntVal));
5465 if ((yyvsp[(8) - (10)].StrVal)) {
5466 Fn->setSection(*(yyvsp[(8) - (10)].StrVal));
5467 delete (yyvsp[(8) - (10)].StrVal);
Gordon Henriksen80a75bf2007-12-10 03:18:06 +00005468 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00005469 if ((yyvsp[(10) - (10)].StrVal)) {
5470 Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str());
5471 delete (yyvsp[(10) - (10)].StrVal);
Chris Lattnere869eef2005-11-12 00:11:49 +00005472 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005473
5474 // Add all of the arguments we parsed to the function...
Dan Gohmanf4423b12008-04-19 00:24:39 +00005475 if ((yyvsp[(5) - (10)].ArgList)) { // Is null if empty...
Reid Spencer68a24bd2005-08-27 18:50:39 +00005476 if (isVarArg) { // Nuke the last entry
Dan Gohmanf4423b12008-04-19 00:24:39 +00005477 assert((yyvsp[(5) - (10)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (10)].ArgList)->back().Name == 0 &&
Reid Spencera9720f52007-02-05 17:04:00 +00005478 "Not a varargs marker!");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005479 delete (yyvsp[(5) - (10)].ArgList)->back().Ty;
5480 (yyvsp[(5) - (10)].ArgList)->pop_back(); // Delete the last entry
Reid Spencer68a24bd2005-08-27 18:50:39 +00005481 }
5482 Function::arg_iterator ArgIt = Fn->arg_begin();
Reid Spenceref9b9a72007-02-05 20:47:22 +00005483 Function::arg_iterator ArgEnd = Fn->arg_end();
Reid Spencer14310612006-12-31 05:40:51 +00005484 unsigned Idx = 1;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005485 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin();
5486 I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
Reid Spencer14310612006-12-31 05:40:51 +00005487 delete I->Ty; // Delete the typeholder...
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005488 setValueName(ArgIt, I->Name); // Insert arg into symtab...
Reid Spencer5b7e7532006-09-28 19:28:24 +00005489 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005490 InsertValue(ArgIt);
Reid Spencer14310612006-12-31 05:40:51 +00005491 Idx++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005492 }
Reid Spencera132e042006-12-03 05:46:11 +00005493
Dan Gohmanf4423b12008-04-19 00:24:39 +00005494 delete (yyvsp[(5) - (10)].ArgList); // We're now done with the argument list
Reid Spencer68a24bd2005-08-27 18:50:39 +00005495 }
Reid Spencer61c83e02006-08-18 08:43:06 +00005496 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005497;}
5498 break;
5499
Dan Gohmane4977cf2008-05-23 01:55:30 +00005500 case 248:
5501#line 2429 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005502 {
5503 (yyval.FunctionVal) = CurFun.CurrentFunction;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005504
5505 // Make sure that we keep track of the linkage type even if there was a
5506 // previous "declare".
Dan Gohmanf4423b12008-04-19 00:24:39 +00005507 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5508 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5509;}
5510 break;
5511
Dan Gohmane4977cf2008-05-23 01:55:30 +00005512 case 251:
5513#line 2440 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005514 {
5515 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005516 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005517;}
5518 break;
5519
Dan Gohmane4977cf2008-05-23 01:55:30 +00005520 case 252:
5521#line 2445 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005522 {
5523 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5524 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5525 (yyval.FunctionVal) = CurFun.CurrentFunction;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005526 CurFun.FunctionDone();
Reid Spencer41dff5e2007-01-26 08:05:27 +00005527 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005528 ;}
5529 break;
5530
Dan Gohmane4977cf2008-05-23 01:55:30 +00005531 case 253:
5532#line 2457 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005533 {
5534 (yyval.BoolVal) = false;
Reid Spencer61c83e02006-08-18 08:43:06 +00005535 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005536 ;}
5537 break;
5538
Dan Gohmane4977cf2008-05-23 01:55:30 +00005539 case 254:
5540#line 2461 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005541 {
5542 (yyval.BoolVal) = true;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005543 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005544 ;}
5545 break;
5546
Dan Gohmane4977cf2008-05-23 01:55:30 +00005547 case 255:
5548#line 2466 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005549 { // A reference to a direct constant
5550 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005551 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005552 ;}
5553 break;
5554
Dan Gohmane4977cf2008-05-23 01:55:30 +00005555 case 256:
5556#line 2470 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005557 {
5558 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005559 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005560 ;}
5561 break;
5562
Dan Gohmane4977cf2008-05-23 01:55:30 +00005563 case 257:
5564#line 2474 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005565 { // Perhaps it's an FP constant?
5566 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00005567 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005568 ;}
5569 break;
5570
Dan Gohmane4977cf2008-05-23 01:55:30 +00005571 case 258:
5572#line 2478 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005573 {
5574 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
Reid Spencere4d87aa2006-12-23 06:05:41 +00005575 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005576 ;}
5577 break;
5578
Dan Gohmane4977cf2008-05-23 01:55:30 +00005579 case 259:
5580#line 2482 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005581 {
5582 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00005583 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005584 ;}
5585 break;
5586
Dan Gohmane4977cf2008-05-23 01:55:30 +00005587 case 260:
5588#line 2486 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005589 {
5590 (yyval.ValIDVal) = ValID::createNull();
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00005591 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005592 ;}
5593 break;
5594
Dan Gohmane4977cf2008-05-23 01:55:30 +00005595 case 261:
5596#line 2490 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005597 {
5598 (yyval.ValIDVal) = ValID::createUndef();
Reid Spencer61c83e02006-08-18 08:43:06 +00005599 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005600 ;}
5601 break;
5602
Dan Gohmane4977cf2008-05-23 01:55:30 +00005603 case 262:
5604#line 2494 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005605 { // A vector zero constant.
5606 (yyval.ValIDVal) = ValID::createZeroInit();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005607 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005608 ;}
5609 break;
5610
Dan Gohmane4977cf2008-05-23 01:55:30 +00005611 case 263:
5612#line 2498 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005613 { // Nonempty unsized packed vector
5614 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5615 int NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Reid Spencer68a24bd2005-08-27 18:50:39 +00005616
Reid Spencer9d6565a2007-02-15 02:26:10 +00005617 VectorType* pt = VectorType::get(ETy, NumElements);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005618 PATypeHolder* PTy = new PATypeHolder(
Reid Spencera132e042006-12-03 05:46:11 +00005619 HandleUpRefs(
Reid Spencer9d6565a2007-02-15 02:26:10 +00005620 VectorType::get(
Reid Spencera132e042006-12-03 05:46:11 +00005621 ETy,
5622 NumElements)
5623 )
5624 );
Reid Spencer68a24bd2005-08-27 18:50:39 +00005625
5626 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00005627 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5628 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Reid Spencer61c83e02006-08-18 08:43:06 +00005629 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +00005630 ETy->getDescription() +"' as required!\nIt is of type '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00005631 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005632 }
5633
Dan Gohmanf4423b12008-04-19 00:24:39 +00005634 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5635 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
Reid Spencer832254e2007-02-02 02:16:23 +00005636 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005637 ;}
5638 break;
5639
Dan Gohmane4977cf2008-05-23 01:55:30 +00005640 case 264:
5641#line 2523 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005642 {
5643 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
Reid Spencer832254e2007-02-02 02:16:23 +00005644 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005645 ;}
5646 break;
5647
Dan Gohmane4977cf2008-05-23 01:55:30 +00005648 case 265:
5649#line 2527 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005650 {
5651 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5652 delete (yyvsp[(3) - (5)].StrVal);
5653 delete (yyvsp[(5) - (5)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005654 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005655 ;}
5656 break;
5657
Dan Gohmane4977cf2008-05-23 01:55:30 +00005658 case 266:
5659#line 2537 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005660 { // Is it an integer reference...?
5661 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005662 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005663 ;}
5664 break;
5665
Dan Gohmane4977cf2008-05-23 01:55:30 +00005666 case 267:
5667#line 2541 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005668 {
5669 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
Reid Spencer832254e2007-02-02 02:16:23 +00005670 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005671 ;}
5672 break;
5673
Dan Gohmane4977cf2008-05-23 01:55:30 +00005674 case 268:
5675#line 2545 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005676 { // Is it a named reference...?
5677 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5678 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005679 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005680 ;}
5681 break;
5682
Dan Gohmane4977cf2008-05-23 01:55:30 +00005683 case 269:
5684#line 2550 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005685 { // Is it a named reference...?
5686 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5687 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005688 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005689 ;}
5690 break;
5691
Dan Gohmane4977cf2008-05-23 01:55:30 +00005692 case 272:
5693#line 2563 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005694 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005695 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005696 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5697 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5698 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005699 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005700 ;}
5701 break;
5702
Dan Gohmane4977cf2008-05-23 01:55:30 +00005703 case 273:
5704#line 2572 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005705 {
5706 (yyval.ValueList) = new std::vector<Value *>();
5707 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
Devang Patel7990dc72008-02-20 22:40:23 +00005708 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005709 ;}
5710 break;
5711
Dan Gohmane4977cf2008-05-23 01:55:30 +00005712 case 274:
5713#line 2577 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005714 {
5715 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
Devang Patel7990dc72008-02-20 22:40:23 +00005716 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005717 ;}
5718 break;
5719
Dan Gohmane4977cf2008-05-23 01:55:30 +00005720 case 275:
5721#line 2582 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005722 {
5723 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005724 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005725 ;}
5726 break;
5727
Dan Gohmane4977cf2008-05-23 01:55:30 +00005728 case 276:
5729#line 2586 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005730 { // Do not allow functions with 0 basic blocks
5731 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005732 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005733 ;}
5734 break;
5735
Dan Gohmane4977cf2008-05-23 01:55:30 +00005736 case 277:
5737#line 2595 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005738 {
5739 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005740 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005741 InsertValue((yyvsp[(3) - (3)].TermInstVal));
5742 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
5743 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005744 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005745 ;}
5746 break;
5747
Dan Gohmane4977cf2008-05-23 01:55:30 +00005748 case 278:
5749#line 2604 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005750 {
5751 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005752 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5753 if (CI2->getParent() == 0)
Dan Gohmanf4423b12008-04-19 00:24:39 +00005754 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
5755 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
5756 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005757 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005758 ;}
5759 break;
Chris Lattner38905612008-02-19 04:36:25 +00005760
Dan Gohmane4977cf2008-05-23 01:55:30 +00005761 case 279:
5762#line 2613 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005763 { // Empty space between instruction lists
Chris Lattnercc81d152008-05-04 17:18:47 +00005764 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
Dan Gohmanf4423b12008-04-19 00:24:39 +00005765 CHECK_FOR_ERROR
5766 ;}
5767 break;
5768
Dan Gohmane4977cf2008-05-23 01:55:30 +00005769 case 280:
5770#line 2617 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnercc81d152008-05-04 17:18:47 +00005771 { // Labelled (named) basic block
5772 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
5773 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005774 CHECK_FOR_ERROR
Chris Lattnercc81d152008-05-04 17:18:47 +00005775
Dan Gohmanf4423b12008-04-19 00:24:39 +00005776 ;}
5777 break;
5778
Dan Gohmane4977cf2008-05-23 01:55:30 +00005779 case 281:
5780#line 2625 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005781 { // Return with a result...
5782 ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
5783 assert(!VL.empty() && "Invalid ret operands!");
5784 (yyval.TermInstVal) = ReturnInst::Create(&VL[0], VL.size());
5785 delete (yyvsp[(2) - (2)].ValueList);
5786 CHECK_FOR_ERROR
5787 ;}
5788 break;
5789
Dan Gohmane4977cf2008-05-23 01:55:30 +00005790 case 282:
5791#line 2632 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005792 { // Return with no result...
5793 (yyval.TermInstVal) = ReturnInst::Create();
5794 CHECK_FOR_ERROR
5795 ;}
5796 break;
5797
Dan Gohmane4977cf2008-05-23 01:55:30 +00005798 case 283:
5799#line 2636 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005800 { // Unconditional Branch...
5801 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
5802 CHECK_FOR_ERROR
5803 (yyval.TermInstVal) = BranchInst::Create(tmpBB);
5804 ;}
5805 break;
5806
Dan Gohmane4977cf2008-05-23 01:55:30 +00005807 case 284:
5808#line 2641 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005809 {
5810 assert(cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?");
5811 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:
5822#line 2651 "/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:
5845#line 2670 "/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:
5858#line 2680 "/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:
5947#line 2765 "/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:
5955#line 2769 "/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:
5963#line 2776 "/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:
5978#line 2787 "/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:
5994#line 2800 "/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:
6006#line 2810 "/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:
6021#line 2821 "/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:
6033#line 2831 "/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:
6048#line 2842 "/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:
6060#line 2850 "/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:
6074#line 2860 "/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:
6085#line 2867 "/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:
6090#line 2870 "/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:
6095#line 2871 "/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:
6104#line 2878 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006105 {
6106 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00006107 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006108 ;}
6109 break;
6110
Dan Gohmane4977cf2008-05-23 01:55:30 +00006111 case 303:
6112#line 2882 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006113 {
6114 (yyval.BoolVal) = false;
Andrew Lenharth6353e052006-12-08 18:07:09 +00006115 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006116 ;}
6117 break;
6118
Dan Gohmane4977cf2008-05-23 01:55:30 +00006119 case 304:
6120#line 2887 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006121 {
Reid Spencer14310612006-12-31 05:40:51 +00006122 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006123 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6124 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
6125 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006126 GEN_ERROR(
6127 "Arithmetic operator requires integer, FP, or packed operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006128 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006129 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006130 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006131 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006132 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006133 if ((yyval.InstVal) == 0)
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006134 GEN_ERROR("binary operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006135 delete (yyvsp[(2) - (5)].TypeVal);
6136 ;}
6137 break;
6138
Dan Gohmane4977cf2008-05-23 01:55:30 +00006139 case 305:
6140#line 2903 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006141 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006142 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006143 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6144 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
6145 if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
6146 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006147 GEN_ERROR("Logical operator requires integral operands");
6148 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006149 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006150 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006151 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006152 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006153 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006154 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +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 Gohmane4977cf2008-05-23 01:55:30 +00006160 case 306:
6161#line 2920 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006162 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006163 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006164 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6165 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006166 GEN_ERROR("Vector types not supported by icmp instruction");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006167 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006168 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006169 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006170 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006171 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006172 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006173 GEN_ERROR("icmp operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006174 delete (yyvsp[(3) - (6)].TypeVal);
6175 ;}
6176 break;
6177
Dan Gohmane4977cf2008-05-23 01:55:30 +00006178 case 307:
6179#line 2934 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006180 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006181 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006182 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6183 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006184 GEN_ERROR("Vector types not supported by fcmp instruction");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006185 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006186 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006187 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006188 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006189 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006190 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006191 GEN_ERROR("fcmp operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006192 delete (yyvsp[(3) - (6)].TypeVal);
6193 ;}
6194 break;
6195
Dan Gohmane4977cf2008-05-23 01:55:30 +00006196 case 308:
6197#line 2948 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00006198 {
6199 if (!UpRefs.empty())
6200 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6201 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6202 GEN_ERROR("Scalar types not supported by vicmp instruction");
6203 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6204 CHECK_FOR_ERROR
6205 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6206 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006207 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Nate Begemanac80ade2008-05-12 19:01:56 +00006208 if ((yyval.InstVal) == 0)
6209 GEN_ERROR("icmp operator returned null");
6210 delete (yyvsp[(3) - (6)].TypeVal);
6211 ;}
6212 break;
6213
Dan Gohmane4977cf2008-05-23 01:55:30 +00006214 case 309:
6215#line 2962 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00006216 {
6217 if (!UpRefs.empty())
6218 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6219 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6220 GEN_ERROR("Scalar types not supported by vfcmp instruction");
6221 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6222 CHECK_FOR_ERROR
6223 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6224 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006225 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Nate Begemanac80ade2008-05-12 19:01:56 +00006226 if ((yyval.InstVal) == 0)
6227 GEN_ERROR("fcmp operator returned null");
6228 delete (yyvsp[(3) - (6)].TypeVal);
6229 ;}
6230 break;
6231
Dan Gohmane4977cf2008-05-23 01:55:30 +00006232 case 310:
6233#line 2976 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006234 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006235 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006236 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6237 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6238 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6239 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006240 GEN_ERROR("invalid cast opcode for cast from '" +
6241 Val->getType()->getDescription() + "' to '" +
6242 DestTy->getDescription() + "'");
Dan Gohmane4977cf2008-05-23 01:55:30 +00006243 (yyval.InstVal) = CastInst::Create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006244 delete (yyvsp[(4) - (4)].TypeVal);
6245 ;}
6246 break;
6247
Dan Gohmane4977cf2008-05-23 01:55:30 +00006248 case 311:
6249#line 2988 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006250 {
6251 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006252 GEN_ERROR("select condition must be boolean");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006253 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006254 GEN_ERROR("select value types should match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006255 (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006256 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006257 ;}
6258 break;
6259
Dan Gohmane4977cf2008-05-23 01:55:30 +00006260 case 312:
6261#line 2996 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006262 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006263 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006264 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6265 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6266 delete (yyvsp[(4) - (4)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006267 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006268 ;}
6269 break;
6270
Dan Gohmane4977cf2008-05-23 01:55:30 +00006271 case 313:
6272#line 3003 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006273 {
6274 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006275 GEN_ERROR("Invalid extractelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006276 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006277 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006278 ;}
6279 break;
6280
Dan Gohmane4977cf2008-05-23 01:55:30 +00006281 case 314:
6282#line 3009 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006283 {
6284 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006285 GEN_ERROR("Invalid insertelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006286 (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006287 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006288 ;}
6289 break;
6290
Dan Gohmane4977cf2008-05-23 01:55:30 +00006291 case 315:
6292#line 3015 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006293 {
6294 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006295 GEN_ERROR("Invalid shufflevector operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006296 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006297 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006298 ;}
6299 break;
6300
Dan Gohmane4977cf2008-05-23 01:55:30 +00006301 case 316:
6302#line 3021 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006303 {
6304 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006305 if (!Ty->isFirstClassType())
6306 GEN_ERROR("PHI node operands must be of first class type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006307 (yyval.InstVal) = PHINode::Create(Ty);
6308 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6309 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6310 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006311 GEN_ERROR("All elements of a PHI node must be of the same type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006312 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6313 (yyvsp[(2) - (2)].PHIList)->pop_front();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006314 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006315 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006316 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006317 ;}
6318 break;
6319
Dan Gohmane4977cf2008-05-23 01:55:30 +00006320 case 317:
6321#line 3037 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006322 {
Reid Spencer14310612006-12-31 05:40:51 +00006323
6324 // Handle the short syntax
Andrew Lenharth6353e052006-12-08 18:07:09 +00006325 const PointerType *PFTy = 0;
6326 const FunctionType *Ty = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006327 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
Andrew Lenharth6353e052006-12-08 18:07:09 +00006328 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6329 // Pull out the types of all of the arguments...
6330 std::vector<const Type*> ParamTypes;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006331 ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006332 for (; I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00006333 const Type *Ty = I->Val->getType();
6334 if (Ty == Type::VoidTy)
6335 GEN_ERROR("Short call syntax cannot be used with varargs");
6336 ParamTypes.push_back(Ty);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006337 }
Chris Lattnera925a142008-04-23 05:37:08 +00006338
6339 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (8)].TypeVal)))
6340 GEN_ERROR("Invalid result type for LLVM function");
6341
Dan Gohmanf4423b12008-04-19 00:24:39 +00006342 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00006343 PFTy = PointerType::getUnqual(Ty);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006344 }
Chris Lattner6cdc6822007-04-26 05:31:05 +00006345
Dan Gohmanf4423b12008-04-19 00:24:39 +00006346 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00006347 CHECK_FOR_ERROR
Chris Lattner6cdc6822007-04-26 05:31:05 +00006348
Reid Spencer7780acb2007-04-16 06:56:07 +00006349 // Check for call to invalid intrinsic to avoid crashing later.
6350 if (Function *theF = dyn_cast<Function>(V)) {
Reid Spencered48de22007-04-16 22:02:23 +00006351 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
Reid Spencer36fdde12007-04-16 20:35:38 +00006352 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6353 !theF->getIntrinsicID(true))
Reid Spencer7780acb2007-04-16 06:56:07 +00006354 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6355 theF->getName() + "'");
6356 }
6357
Duncan Sandsdc024672007-11-27 13:23:08 +00006358 // Set up the ParamAttrs for the function
Chris Lattner58d74912008-03-12 17:45:29 +00006359 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006360 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None)
6361 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (8)].ParamAttrs)));
Reid Spencer14310612006-12-31 05:40:51 +00006362 // Check the arguments
6363 ValueList Args;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006364 if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments?
Andrew Lenharth6353e052006-12-08 18:07:09 +00006365 // Make sure no arguments is a good thing!
6366 if (Ty->getNumParams() != 0)
6367 GEN_ERROR("No arguments passed to a function that "
Reid Spencerb5334b02007-02-05 10:18:06 +00006368 "expects arguments");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006369 } else { // Has arguments?
6370 // Loop through FunctionType's arguments and ensure they are specified
Duncan Sandsdc024672007-11-27 13:23:08 +00006371 // correctly. Also, gather any parameter attributes.
Andrew Lenharth6353e052006-12-08 18:07:09 +00006372 FunctionType::param_iterator I = Ty->param_begin();
6373 FunctionType::param_iterator E = Ty->param_end();
Dan Gohmanf4423b12008-04-19 00:24:39 +00006374 ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006375 unsigned index = 1;
Andrew Lenharth6353e052006-12-08 18:07:09 +00006376
Duncan Sandsdc024672007-11-27 13:23:08 +00006377 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006378 if (ArgI->Val->getType() != *I)
6379 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00006380 (*I)->getDescription() + "'");
Reid Spencer14310612006-12-31 05:40:51 +00006381 Args.push_back(ArgI->Val);
Chris Lattner58d74912008-03-12 17:45:29 +00006382 if (ArgI->Attrs != ParamAttr::None)
6383 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00006384 }
6385 if (Ty->isVarArg()) {
6386 if (I == E)
Chris Lattner38905612008-02-19 04:36:25 +00006387 for (; ArgI != ArgE; ++ArgI, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006388 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner58d74912008-03-12 17:45:29 +00006389 if (ArgI->Attrs != ParamAttr::None)
6390 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Chris Lattner38905612008-02-19 04:36:25 +00006391 }
Reid Spencer14310612006-12-31 05:40:51 +00006392 } else if (I != E || ArgI != ArgE)
Reid Spencerb5334b02007-02-05 10:18:06 +00006393 GEN_ERROR("Invalid number of parameters detected");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006394 }
Duncan Sandsdc024672007-11-27 13:23:08 +00006395
6396 // Finish off the ParamAttrs and check them
Chris Lattner58d74912008-03-12 17:45:29 +00006397 PAListPtr PAL;
Duncan Sandsdc024672007-11-27 13:23:08 +00006398 if (!Attrs.empty())
Chris Lattner58d74912008-03-12 17:45:29 +00006399 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsdc024672007-11-27 13:23:08 +00006400
Reid Spencer14310612006-12-31 05:40:51 +00006401 // Create the call node
Gabor Greife64d2482008-04-06 23:07:54 +00006402 CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
Dan Gohmanf4423b12008-04-19 00:24:39 +00006403 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6404 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
Duncan Sandsdc024672007-11-27 13:23:08 +00006405 CI->setParamAttrs(PAL);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006406 (yyval.InstVal) = CI;
6407 delete (yyvsp[(6) - (8)].ParamList);
6408 delete (yyvsp[(3) - (8)].TypeVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00006409 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006410 ;}
6411 break;
6412
Dan Gohmane4977cf2008-05-23 01:55:30 +00006413 case 318:
6414#line 3126 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006415 {
6416 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00006417 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006418 ;}
6419 break;
6420
Dan Gohmane4977cf2008-05-23 01:55:30 +00006421 case 319:
6422#line 3131 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006423 {
6424 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00006425 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006426 ;}
6427 break;
6428
Dan Gohmane4977cf2008-05-23 01:55:30 +00006429 case 320:
6430#line 3135 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006431 {
6432 (yyval.BoolVal) = false;
Reid Spencer61c83e02006-08-18 08:43:06 +00006433 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006434 ;}
6435 break;
6436
Dan Gohmane4977cf2008-05-23 01:55:30 +00006437 case 321:
6438#line 3142 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006439 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006440 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006441 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6442 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6443 delete (yyvsp[(2) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006444 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006445 ;}
6446 break;
6447
Dan Gohmane4977cf2008-05-23 01:55:30 +00006448 case 322:
6449#line 3149 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006450 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006451 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006452 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6453 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00006454 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006455 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6456 delete (yyvsp[(2) - (6)].TypeVal);
6457 ;}
6458 break;
6459
Dan Gohmane4977cf2008-05-23 01:55:30 +00006460 case 323:
6461#line 3157 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006462 {
Reid Spencer14310612006-12-31 05:40:51 +00006463 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006464 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6465 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6466 delete (yyvsp[(2) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006467 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006468 ;}
6469 break;
6470
Dan Gohmane4977cf2008-05-23 01:55:30 +00006471 case 324:
6472#line 3164 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006473 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006474 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006475 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6476 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006477 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006478 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6479 delete (yyvsp[(2) - (6)].TypeVal);
6480 ;}
6481 break;
6482
Dan Gohmane4977cf2008-05-23 01:55:30 +00006483 case 325:
6484#line 3172 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006485 {
6486 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006487 GEN_ERROR("Trying to free nonpointer type " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006488 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6489 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006490 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006491 ;}
6492 break;
6493
Dan Gohmane4977cf2008-05-23 01:55:30 +00006494 case 326:
6495#line 3180 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006496 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006497 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006498 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6499 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006500 GEN_ERROR("Can't load from nonpointer type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006501 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6502 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006503 GEN_ERROR("Can't load from pointer of non-first-class type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006504 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6505 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006506 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006507 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6508 delete (yyvsp[(3) - (5)].TypeVal);
6509 ;}
6510 break;
6511
Dan Gohmane4977cf2008-05-23 01:55:30 +00006512 case 327:
6513#line 3194 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006514 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006515 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006516 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6517 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006518 if (!PT)
6519 GEN_ERROR("Can't store to a nonpointer type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006520 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006521 const Type *ElTy = PT->getElementType();
Dan Gohmanf4423b12008-04-19 00:24:39 +00006522 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6523 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006524 "' into space of type '" + ElTy->getDescription() + "'");
6525
Dan Gohmanf4423b12008-04-19 00:24:39 +00006526 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006527 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006528 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6529 delete (yyvsp[(5) - (7)].TypeVal);
6530 ;}
6531 break;
6532
Dan Gohmane4977cf2008-05-23 01:55:30 +00006533 case 328:
6534#line 3211 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006535 {
6536 Value *TmpVal = getVal((yyvsp[(2) - (5)].TypeVal)->get(), (yyvsp[(3) - (5)].ValIDVal));
6537 if (!GetResultInst::isValidOperands(TmpVal, (yyvsp[(5) - (5)].UInt64Val)))
Devang Patel5a970972008-02-19 22:27:01 +00006538 GEN_ERROR("Invalid getresult operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006539 (yyval.InstVal) = new GetResultInst(TmpVal, (yyvsp[(5) - (5)].UInt64Val));
6540 delete (yyvsp[(2) - (5)].TypeVal);
Devang Patel5a970972008-02-19 22:27:01 +00006541 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006542 ;}
6543 break;
6544
Dan Gohmane4977cf2008-05-23 01:55:30 +00006545 case 329:
6546#line 3219 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006547 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006548 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006549 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6550 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
Reid Spencerb5334b02007-02-05 10:18:06 +00006551 GEN_ERROR("getelementptr insn requires pointer operand");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006552
Dan Gohman041e2eb2008-05-15 19:50:34 +00006553 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()))
Reid Spencer61c83e02006-08-18 08:43:06 +00006554 GEN_ERROR("Invalid getelementptr indices for type '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006555 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6556 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00006557 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006558 (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6559 delete (yyvsp[(2) - (4)].TypeVal);
6560 delete (yyvsp[(4) - (4)].ValueList);
6561 ;}
6562 break;
Reid Spencer7780acb2007-04-16 06:56:07 +00006563
Dan Gohmane4977cf2008-05-23 01:55:30 +00006564 case 330:
6565#line 3234 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6566 {
6567 if (!UpRefs.empty())
6568 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6569 if (!isa<StructType>((yyvsp[(2) - (4)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (4)].TypeVal)->get()))
6570 GEN_ERROR("extractvalue insn requires an aggregate operand");
6571
6572 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()))
6573 GEN_ERROR("Invalid extractvalue indices for type '" +
6574 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6575 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6576 CHECK_FOR_ERROR
6577 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6578 delete (yyvsp[(2) - (4)].TypeVal);
6579 delete (yyvsp[(4) - (4)].ValueList);
6580 ;}
6581 break;
6582
6583 case 331:
6584#line 3249 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
6585 {
6586 if (!UpRefs.empty())
6587 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription());
6588 if (!isa<StructType>((yyvsp[(2) - (7)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (7)].TypeVal)->get()))
6589 GEN_ERROR("extractvalue insn requires an aggregate operand");
6590
6591 if (ExtractValueInst::getIndexedType(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(7) - (7)].ValueList)->begin(), (yyvsp[(7) - (7)].ValueList)->end()) != (yyvsp[(5) - (7)].TypeVal)->get())
6592 GEN_ERROR("Invalid insertvalue indices for type '" +
6593 (*(yyvsp[(2) - (7)].TypeVal))->getDescription()+ "'");
6594 Value* aggVal = getVal(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(3) - (7)].ValIDVal));
6595 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
6596 CHECK_FOR_ERROR
6597 (yyval.InstVal) = InsertValueInst::Create(aggVal, tmpVal, (yyvsp[(7) - (7)].ValueList)->begin(), (yyvsp[(7) - (7)].ValueList)->end());
6598 delete (yyvsp[(2) - (7)].TypeVal);
6599 delete (yyvsp[(5) - (7)].TypeVal);
6600 delete (yyvsp[(7) - (7)].ValueList);
6601 ;}
6602 break;
6603
Dan Gohmanf4423b12008-04-19 00:24:39 +00006604
6605/* Line 1267 of yacc.c. */
Dan Gohmane4977cf2008-05-23 01:55:30 +00006606#line 6607 "llvmAsmParser.tab.c"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006607 default: break;
Dale Johannesencdd509a2007-09-07 21:07:57 +00006608 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006609 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6610
6611 YYPOPSTACK (yylen);
6612 yylen = 0;
6613 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006614
6615 *++yyvsp = yyval;
6616
6617
Dan Gohmanf4423b12008-04-19 00:24:39 +00006618 /* Now `shift' the result of the reduction. Determine what state
6619 that goes to, based on the state we popped back to and the rule
6620 number reduced by. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00006621
6622 yyn = yyr1[yyn];
6623
Dan Gohmanf4423b12008-04-19 00:24:39 +00006624 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6625 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00006626 yystate = yytable[yystate];
6627 else
Dan Gohmanf4423b12008-04-19 00:24:39 +00006628 yystate = yydefgoto[yyn - YYNTOKENS];
Reid Spencer68a24bd2005-08-27 18:50:39 +00006629
6630 goto yynewstate;
6631
6632
Dan Gohmanf4423b12008-04-19 00:24:39 +00006633/*------------------------------------.
6634| yyerrlab -- here on detecting error |
6635`------------------------------------*/
6636yyerrlab:
6637 /* If not already recovering from an error, report this error. */
6638 if (!yyerrstatus)
Reid Spencer68a24bd2005-08-27 18:50:39 +00006639 {
6640 ++yynerrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006641#if ! YYERROR_VERBOSE
6642 yyerror (YY_("syntax error"));
6643#else
6644 {
6645 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
6646 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
6647 {
6648 YYSIZE_T yyalloc = 2 * yysize;
6649 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
6650 yyalloc = YYSTACK_ALLOC_MAXIMUM;
6651 if (yymsg != yymsgbuf)
6652 YYSTACK_FREE (yymsg);
6653 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
6654 if (yymsg)
6655 yymsg_alloc = yyalloc;
6656 else
6657 {
6658 yymsg = yymsgbuf;
6659 yymsg_alloc = sizeof yymsgbuf;
6660 }
6661 }
Dale Johannesencdd509a2007-09-07 21:07:57 +00006662
Dan Gohmanf4423b12008-04-19 00:24:39 +00006663 if (0 < yysize && yysize <= yymsg_alloc)
6664 {
6665 (void) yysyntax_error (yymsg, yystate, yychar);
6666 yyerror (yymsg);
6667 }
6668 else
6669 {
6670 yyerror (YY_("syntax error"));
6671 if (yysize != 0)
6672 goto yyexhaustedlab;
6673 }
6674 }
6675#endif
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006676 }
6677
Dan Gohmanf4423b12008-04-19 00:24:39 +00006678
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006679
6680 if (yyerrstatus == 3)
6681 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00006682 /* If just tried and failed to reuse look-ahead token after an
6683 error, discard it. */
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006684
Dan Gohmanf4423b12008-04-19 00:24:39 +00006685 if (yychar <= YYEOF)
6686 {
6687 /* Return failure if at end of input. */
6688 if (yychar == YYEOF)
6689 YYABORT;
6690 }
6691 else
6692 {
6693 yydestruct ("Error: discarding",
6694 yytoken, &yylval);
6695 yychar = YYEMPTY;
6696 }
6697 }
6698
6699 /* Else will try to reuse look-ahead token after shifting the error
6700 token. */
6701 goto yyerrlab1;
6702
6703
6704/*---------------------------------------------------.
6705| yyerrorlab -- error raised explicitly by YYERROR. |
6706`---------------------------------------------------*/
6707yyerrorlab:
6708
6709 /* Pacify compilers like GCC when the user code never invokes
6710 YYERROR and the label yyerrorlab therefore never appears in user
6711 code. */
6712 if (/*CONSTCOND*/ 0)
6713 goto yyerrorlab;
6714
6715 /* Do not reclaim the symbols of the rule which action triggered
6716 this YYERROR. */
6717 YYPOPSTACK (yylen);
6718 yylen = 0;
6719 YY_STACK_PRINT (yyss, yyssp);
6720 yystate = *yyssp;
6721 goto yyerrlab1;
6722
6723
6724/*-------------------------------------------------------------.
6725| yyerrlab1 -- common code for both syntax error and YYERROR. |
6726`-------------------------------------------------------------*/
6727yyerrlab1:
6728 yyerrstatus = 3; /* Each real token shifted decrements this. */
6729
6730 for (;;)
6731 {
6732 yyn = yypact[yystate];
6733 if (yyn != YYPACT_NINF)
6734 {
6735 yyn += YYTERROR;
6736 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6737 {
6738 yyn = yytable[yyn];
6739 if (0 < yyn)
6740 break;
6741 }
6742 }
6743
6744 /* Pop the current state because it cannot handle the error token. */
6745 if (yyssp == yyss)
Reid Spencer68a24bd2005-08-27 18:50:39 +00006746 YYABORT;
6747
Dale Johannesencdd509a2007-09-07 21:07:57 +00006748
Dan Gohmanf4423b12008-04-19 00:24:39 +00006749 yydestruct ("Error: popping",
6750 yystos[yystate], yyvsp);
6751 YYPOPSTACK (1);
6752 yystate = *yyssp;
6753 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006754 }
6755
6756 if (yyn == YYFINAL)
6757 YYACCEPT;
6758
Reid Spencer68a24bd2005-08-27 18:50:39 +00006759 *++yyvsp = yylval;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006760
6761
6762 /* Shift the error token. */
6763 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spencerb8f85052007-07-31 03:50:36 +00006764
Reid Spencer68a24bd2005-08-27 18:50:39 +00006765 yystate = yyn;
6766 goto yynewstate;
6767
Gabor Greife64d2482008-04-06 23:07:54 +00006768
Dan Gohmanf4423b12008-04-19 00:24:39 +00006769/*-------------------------------------.
6770| yyacceptlab -- YYACCEPT comes here. |
6771`-------------------------------------*/
6772yyacceptlab:
6773 yyresult = 0;
6774 goto yyreturn;
6775
6776/*-----------------------------------.
6777| yyabortlab -- YYABORT comes here. |
6778`-----------------------------------*/
6779yyabortlab:
6780 yyresult = 1;
6781 goto yyreturn;
6782
6783#ifndef yyoverflow
6784/*-------------------------------------------------.
6785| yyexhaustedlab -- memory exhaustion comes here. |
6786`-------------------------------------------------*/
6787yyexhaustedlab:
6788 yyerror (YY_("memory exhausted"));
6789 yyresult = 2;
6790 /* Fall through. */
Chris Lattner38905612008-02-19 04:36:25 +00006791#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00006792
6793yyreturn:
6794 if (yychar != YYEOF && yychar != YYEMPTY)
6795 yydestruct ("Cleanup: discarding lookahead",
6796 yytoken, &yylval);
6797 /* Do not reclaim the symbols of the rule which action triggered
6798 this YYABORT or YYACCEPT. */
6799 YYPOPSTACK (yylen);
6800 YY_STACK_PRINT (yyss, yyssp);
6801 while (yyssp != yyss)
6802 {
6803 yydestruct ("Cleanup: popping",
6804 yystos[*yyssp], yyvsp);
6805 YYPOPSTACK (1);
Gabor Greife64d2482008-04-06 23:07:54 +00006806 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006807#ifndef yyoverflow
6808 if (yyss != yyssa)
6809 YYSTACK_FREE (yyss);
6810#endif
6811#if YYERROR_VERBOSE
6812 if (yymsg != yymsgbuf)
6813 YYSTACK_FREE (yymsg);
6814#endif
6815 /* Make sure YYID is used. */
6816 return YYID (yyresult);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006817}
Dan Gohmanf4423b12008-04-19 00:24:39 +00006818
6819
Dan Gohmane4977cf2008-05-23 01:55:30 +00006820#line 3268 "/Users/gohman/LLVM/llvm/lib/AsmParser/llvmAsmParser.y"
Reid Spencer61c83e02006-08-18 08:43:06 +00006821
6822
Reid Spencer14310612006-12-31 05:40:51 +00006823// common code from the two 'RunVMAsmParser' functions
6824static Module* RunParser(Module * M) {
Reid Spencer14310612006-12-31 05:40:51 +00006825 CurModule.CurrentModule = M;
Reid Spencer14310612006-12-31 05:40:51 +00006826 // Check to make sure the parser succeeded
6827 if (yyparse()) {
6828 if (ParserResult)
6829 delete ParserResult;
6830 return 0;
6831 }
6832
Reid Spencer0d60b5a2007-03-30 01:37:39 +00006833 // Emit an error if there are any unresolved types left.
6834 if (!CurModule.LateResolveTypes.empty()) {
6835 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6836 if (DID.Type == ValID::LocalName) {
6837 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6838 } else {
6839 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
6840 }
6841 if (ParserResult)
6842 delete ParserResult;
6843 return 0;
6844 }
6845
6846 // Emit an error if there are any unresolved values left.
6847 if (!CurModule.LateResolveValues.empty()) {
6848 Value *V = CurModule.LateResolveValues.back();
6849 std::map<Value*, std::pair<ValID, int> >::iterator I =
6850 CurModule.PlaceHolderInfo.find(V);
6851
6852 if (I != CurModule.PlaceHolderInfo.end()) {
6853 ValID &DID = I->second.first;
6854 if (DID.Type == ValID::LocalName) {
6855 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
6856 } else {
6857 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
6858 }
6859 if (ParserResult)
6860 delete ParserResult;
6861 return 0;
6862 }
6863 }
6864
Reid Spencer14310612006-12-31 05:40:51 +00006865 // Check to make sure that parsing produced a result
6866 if (!ParserResult)
6867 return 0;
6868
6869 // Reset ParserResult variable while saving its value for the result.
6870 Module *Result = ParserResult;
6871 ParserResult = 0;
6872
6873 return Result;
6874}
6875
Reid Spencer61c83e02006-08-18 08:43:06 +00006876void llvm::GenerateError(const std::string &message, int LineNo) {
Duncan Sandsdc024672007-11-27 13:23:08 +00006877 if (LineNo == -1) LineNo = LLLgetLineNo();
Reid Spencer61c83e02006-08-18 08:43:06 +00006878 // TODO: column number in exception
6879 if (TheParseError)
Duncan Sandsdc024672007-11-27 13:23:08 +00006880 TheParseError->setError(LLLgetFilename(), message, LineNo);
Reid Spencer61c83e02006-08-18 08:43:06 +00006881 TriggerError = 1;
6882}
Reid Spencer68a24bd2005-08-27 18:50:39 +00006883
6884int yyerror(const char *ErrorMsg) {
Duncan Sandsdc024672007-11-27 13:23:08 +00006885 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
Reid Spenceref9b9a72007-02-05 20:47:22 +00006886 std::string errMsg = where + "error: " + std::string(ErrorMsg);
Duncan Sandsdc024672007-11-27 13:23:08 +00006887 if (yychar != YYEMPTY && yychar != 0) {
6888 errMsg += " while reading token: '";
6889 errMsg += std::string(LLLgetTokenStart(),
6890 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
6891 }
Reid Spencer61c83e02006-08-18 08:43:06 +00006892 GenerateError(errMsg);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006893 return 0;
6894}
Dan Gohmanf4423b12008-04-19 00:24:39 +00006895