blob: 26ed4400b7424ab6850c84ff79eb05e597068b46 [file] [log] [blame]
Dan Gohmanf4423b12008-04-19 00:24:39 +00001/* A Bison parser, made by GNU Bison 2.3. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002
Dan Gohmanf4423b12008-04-19 00:24:39 +00003/* Skeleton implementation for Bison's Yacc-like parsers in C
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004
Dan Gohmanf4423b12008-04-19 00:24:39 +00005 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
Anton Korobeynikov178a3522007-01-12 19:22:51 +00007
Dan Gohmanf4423b12008-04-19 00:24:39 +00008 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
22
23/* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
32
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
35
36/* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
38
39/* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
45
46/* Identify Bison output. */
47#define YYBISON 1
48
49/* Bison version. */
50#define YYBISON_VERSION "2.3"
51
52/* Skeleton name. */
53#define YYSKELETON_NAME "yacc.c"
54
55/* Pure parsers. */
56#define YYPURE 0
57
58/* Using locations. */
59#define YYLSP_NEEDED 0
60
61/* Substitute the variable and function names. */
Reid Spencer68a24bd2005-08-27 18:50:39 +000062#define yyparse llvmAsmparse
Dan Gohmanf4423b12008-04-19 00:24:39 +000063#define yylex llvmAsmlex
Reid Spencer68a24bd2005-08-27 18:50:39 +000064#define yyerror llvmAsmerror
Dan Gohmanf4423b12008-04-19 00:24:39 +000065#define yylval llvmAsmlval
66#define yychar llvmAsmchar
Reid Spencer68a24bd2005-08-27 18:50:39 +000067#define yydebug llvmAsmdebug
68#define yynerrs llvmAsmnerrs
69
Dan Gohmanf4423b12008-04-19 00:24:39 +000070
71/* Tokens. */
72#ifndef YYTOKENTYPE
73# define YYTOKENTYPE
74 /* Put the tokens into the symbol table, so that GDB and other debuggers
75 know about them. */
76 enum yytokentype {
77 ESINT64VAL = 258,
78 EUINT64VAL = 259,
79 ESAPINTVAL = 260,
80 EUAPINTVAL = 261,
81 LOCALVAL_ID = 262,
82 GLOBALVAL_ID = 263,
83 FPVAL = 264,
84 VOID = 265,
85 INTTYPE = 266,
86 FLOAT = 267,
87 DOUBLE = 268,
88 X86_FP80 = 269,
89 FP128 = 270,
90 PPC_FP128 = 271,
91 LABEL = 272,
92 TYPE = 273,
93 LOCALVAR = 274,
94 GLOBALVAR = 275,
95 LABELSTR = 276,
96 STRINGCONSTANT = 277,
97 ATSTRINGCONSTANT = 278,
98 PCTSTRINGCONSTANT = 279,
99 ZEROINITIALIZER = 280,
100 TRUETOK = 281,
101 FALSETOK = 282,
102 BEGINTOK = 283,
103 ENDTOK = 284,
104 DECLARE = 285,
105 DEFINE = 286,
106 GLOBAL = 287,
107 CONSTANT = 288,
108 SECTION = 289,
109 ALIAS = 290,
110 VOLATILE = 291,
111 THREAD_LOCAL = 292,
112 TO = 293,
113 DOTDOTDOT = 294,
114 NULL_TOK = 295,
115 UNDEF = 296,
116 INTERNAL = 297,
117 LINKONCE = 298,
118 WEAK = 299,
119 APPENDING = 300,
120 DLLIMPORT = 301,
121 DLLEXPORT = 302,
122 EXTERN_WEAK = 303,
Dale Johannesenc7071cc2008-05-14 20:13:36 +0000123 COMMON = 304,
124 OPAQUE = 305,
125 EXTERNAL = 306,
126 TARGET = 307,
127 TRIPLE = 308,
128 ALIGN = 309,
129 ADDRSPACE = 310,
130 DEPLIBS = 311,
131 CALL = 312,
132 TAIL = 313,
133 ASM_TOK = 314,
134 MODULE = 315,
135 SIDEEFFECT = 316,
136 CC_TOK = 317,
137 CCC_TOK = 318,
138 FASTCC_TOK = 319,
139 COLDCC_TOK = 320,
140 X86_STDCALLCC_TOK = 321,
141 X86_FASTCALLCC_TOK = 322,
Dale Johannesen20ab78b2008-08-13 18:41:46 +0000142 X86_SSECALLCC_TOK = 323,
143 DATALAYOUT = 324,
144 RET = 325,
145 BR = 326,
146 SWITCH = 327,
147 INVOKE = 328,
148 UNWIND = 329,
149 UNREACHABLE = 330,
150 ADD = 331,
151 SUB = 332,
152 MUL = 333,
153 UDIV = 334,
154 SDIV = 335,
155 FDIV = 336,
156 UREM = 337,
157 SREM = 338,
158 FREM = 339,
159 AND = 340,
160 OR = 341,
161 XOR = 342,
162 SHL = 343,
163 LSHR = 344,
164 ASHR = 345,
165 ICMP = 346,
166 FCMP = 347,
167 VICMP = 348,
168 VFCMP = 349,
169 EQ = 350,
170 NE = 351,
171 SLT = 352,
172 SGT = 353,
173 SLE = 354,
174 SGE = 355,
175 ULT = 356,
176 UGT = 357,
177 ULE = 358,
178 UGE = 359,
179 OEQ = 360,
180 ONE = 361,
181 OLT = 362,
182 OGT = 363,
183 OLE = 364,
184 OGE = 365,
185 ORD = 366,
186 UNO = 367,
187 UEQ = 368,
188 UNE = 369,
189 MALLOC = 370,
190 ALLOCA = 371,
191 FREE = 372,
192 LOAD = 373,
193 STORE = 374,
194 GETELEMENTPTR = 375,
195 TRUNC = 376,
196 ZEXT = 377,
197 SEXT = 378,
198 FPTRUNC = 379,
199 FPEXT = 380,
200 BITCAST = 381,
201 UITOFP = 382,
202 SITOFP = 383,
203 FPTOUI = 384,
204 FPTOSI = 385,
205 INTTOPTR = 386,
206 PTRTOINT = 387,
207 PHI_TOK = 388,
208 SELECT = 389,
209 VAARG = 390,
210 EXTRACTELEMENT = 391,
211 INSERTELEMENT = 392,
212 SHUFFLEVECTOR = 393,
213 GETRESULT = 394,
214 EXTRACTVALUE = 395,
215 INSERTVALUE = 396,
216 SIGNEXT = 397,
217 ZEROEXT = 398,
218 NORETURN = 399,
219 INREG = 400,
220 SRET = 401,
221 NOUNWIND = 402,
222 NOALIAS = 403,
223 BYVAL = 404,
224 NEST = 405,
225 READNONE = 406,
226 READONLY = 407,
227 GC = 408,
228 DEFAULT = 409,
229 HIDDEN = 410,
230 PROTECTED = 411
Dan Gohmanf4423b12008-04-19 00:24:39 +0000231 };
232#endif
233/* Tokens. */
234#define ESINT64VAL 258
235#define EUINT64VAL 259
236#define ESAPINTVAL 260
237#define EUAPINTVAL 261
238#define LOCALVAL_ID 262
239#define GLOBALVAL_ID 263
240#define FPVAL 264
241#define VOID 265
242#define INTTYPE 266
243#define FLOAT 267
244#define DOUBLE 268
245#define X86_FP80 269
246#define FP128 270
247#define PPC_FP128 271
248#define LABEL 272
249#define TYPE 273
250#define LOCALVAR 274
251#define GLOBALVAR 275
252#define LABELSTR 276
253#define STRINGCONSTANT 277
254#define ATSTRINGCONSTANT 278
255#define PCTSTRINGCONSTANT 279
256#define ZEROINITIALIZER 280
257#define TRUETOK 281
258#define FALSETOK 282
259#define BEGINTOK 283
260#define ENDTOK 284
261#define DECLARE 285
262#define DEFINE 286
263#define GLOBAL 287
264#define CONSTANT 288
265#define SECTION 289
266#define ALIAS 290
267#define VOLATILE 291
268#define THREAD_LOCAL 292
269#define TO 293
270#define DOTDOTDOT 294
271#define NULL_TOK 295
272#define UNDEF 296
273#define INTERNAL 297
274#define LINKONCE 298
275#define WEAK 299
276#define APPENDING 300
277#define DLLIMPORT 301
278#define DLLEXPORT 302
279#define EXTERN_WEAK 303
Dale Johannesenc7071cc2008-05-14 20:13:36 +0000280#define COMMON 304
281#define OPAQUE 305
282#define EXTERNAL 306
283#define TARGET 307
284#define TRIPLE 308
285#define ALIGN 309
286#define ADDRSPACE 310
287#define DEPLIBS 311
288#define CALL 312
289#define TAIL 313
290#define ASM_TOK 314
291#define MODULE 315
292#define SIDEEFFECT 316
293#define CC_TOK 317
294#define CCC_TOK 318
295#define FASTCC_TOK 319
296#define COLDCC_TOK 320
297#define X86_STDCALLCC_TOK 321
298#define X86_FASTCALLCC_TOK 322
Dale Johannesen20ab78b2008-08-13 18:41:46 +0000299#define X86_SSECALLCC_TOK 323
300#define DATALAYOUT 324
301#define RET 325
302#define BR 326
303#define SWITCH 327
304#define INVOKE 328
305#define UNWIND 329
306#define UNREACHABLE 330
307#define ADD 331
308#define SUB 332
309#define MUL 333
310#define UDIV 334
311#define SDIV 335
312#define FDIV 336
313#define UREM 337
314#define SREM 338
315#define FREM 339
316#define AND 340
317#define OR 341
318#define XOR 342
319#define SHL 343
320#define LSHR 344
321#define ASHR 345
322#define ICMP 346
323#define FCMP 347
324#define VICMP 348
325#define VFCMP 349
326#define EQ 350
327#define NE 351
328#define SLT 352
329#define SGT 353
330#define SLE 354
331#define SGE 355
332#define ULT 356
333#define UGT 357
334#define ULE 358
335#define UGE 359
336#define OEQ 360
337#define ONE 361
338#define OLT 362
339#define OGT 363
340#define OLE 364
341#define OGE 365
342#define ORD 366
343#define UNO 367
344#define UEQ 368
345#define UNE 369
346#define MALLOC 370
347#define ALLOCA 371
348#define FREE 372
349#define LOAD 373
350#define STORE 374
351#define GETELEMENTPTR 375
352#define TRUNC 376
353#define ZEXT 377
354#define SEXT 378
355#define FPTRUNC 379
356#define FPEXT 380
357#define BITCAST 381
358#define UITOFP 382
359#define SITOFP 383
360#define FPTOUI 384
361#define FPTOSI 385
362#define INTTOPTR 386
363#define PTRTOINT 387
364#define PHI_TOK 388
365#define SELECT 389
366#define VAARG 390
367#define EXTRACTELEMENT 391
368#define INSERTELEMENT 392
369#define SHUFFLEVECTOR 393
370#define GETRESULT 394
371#define EXTRACTVALUE 395
372#define INSERTVALUE 396
373#define SIGNEXT 397
374#define ZEROEXT 398
375#define NORETURN 399
376#define INREG 400
377#define SRET 401
378#define NOUNWIND 402
379#define NOALIAS 403
380#define BYVAL 404
381#define NEST 405
382#define READNONE 406
383#define READONLY 407
384#define GC 408
385#define DEFAULT 409
386#define HIDDEN 410
387#define PROTECTED 411
Dan Gohmanf4423b12008-04-19 00:24:39 +0000388
389
390
391
392/* Copy the first part of user declarations. */
Dale Johannesen20ab78b2008-08-13 18:41:46 +0000393#line 14 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000394
395#include "ParserInternals.h"
396#include "llvm/CallingConv.h"
Chris Lattner0e9c3762006-01-25 22:27:16 +0000397#include "llvm/InlineAsm.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000398#include "llvm/Instructions.h"
399#include "llvm/Module.h"
Reid Spenceref9b9a72007-02-05 20:47:22 +0000400#include "llvm/ValueSymbolTable.h"
Chandler Carruth02202192007-08-04 01:56:21 +0000401#include "llvm/AutoUpgrade.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000402#include "llvm/Support/GetElementPtrTypeIterator.h"
Reid Spencer14310612006-12-31 05:40:51 +0000403#include "llvm/Support/CommandLine.h"
Chris Lattnerf7469af2007-01-31 04:44:08 +0000404#include "llvm/ADT/SmallVector.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000405#include "llvm/ADT/STLExtras.h"
Chris Lattner0019bbe2005-11-06 06:46:53 +0000406#include "llvm/Support/MathExtras.h"
Reid Spencer481169e2006-12-01 00:33:46 +0000407#include "llvm/Support/Streams.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000408#include <algorithm>
Reid Spencer68a24bd2005-08-27 18:50:39 +0000409#include <list>
Chris Lattner8adde282007-02-11 21:40:10 +0000410#include <map>
Reid Spencer68a24bd2005-08-27 18:50:39 +0000411#include <utility>
412
Reid Spencere4f47592006-08-18 17:32:55 +0000413// The following is a gross hack. In order to rid the libAsmParser library of
414// exceptions, we have to have a way of getting the yyparse function to go into
415// an error situation. So, whenever we want an error to occur, the GenerateError
416// function (see bottom of file) sets TriggerError. Then, at the end of each
417// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
418// (a goto) to put YACC in error state. Furthermore, several calls to
419// GenerateError are made from inside productions and they must simulate the
420// previous exception behavior by exiting the production immediately. We have
421// replaced these with the GEN_ERROR macro which calls GeneratError and then
422// immediately invokes YYERROR. This would be so much cleaner if it was a
423// recursive descent parser.
Reid Spencer61c83e02006-08-18 08:43:06 +0000424static bool TriggerError = false;
Reid Spencerf63697d2006-10-09 17:36:59 +0000425#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
Reid Spencer61c83e02006-08-18 08:43:06 +0000426#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
427
Reid Spencer68a24bd2005-08-27 18:50:39 +0000428int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
429int yylex(); // declaration" of xxx warnings.
430int yyparse();
Reid Spencer68a24bd2005-08-27 18:50:39 +0000431using namespace llvm;
432
433static Module *ParserResult;
434
435// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
436// relating to upreferences in the input stream.
437//
438//#define DEBUG_UPREFS 1
439#ifdef DEBUG_UPREFS
Bill Wendlinge8156192006-12-07 01:30:32 +0000440#define UR_OUT(X) cerr << X
Reid Spencer68a24bd2005-08-27 18:50:39 +0000441#else
442#define UR_OUT(X)
443#endif
444
445#define YYERROR_VERBOSE 1
446
Chris Lattnerb475c422005-11-12 18:22:38 +0000447static GlobalVariable *CurGV;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000448
449
450// This contains info used when building the body of a function. It is
451// destroyed when the function is completed.
452//
453typedef std::vector<Value *> ValueList; // Numbered defs
Reid Spencer14310612006-12-31 05:40:51 +0000454
Reid Spencer68a24bd2005-08-27 18:50:39 +0000455static void
Reid Spencer93c40032007-03-19 18:40:50 +0000456ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000457
458static struct PerModuleInfo {
459 Module *CurrentModule;
Reid Spencer93c40032007-03-19 18:40:50 +0000460 ValueList Values; // Module level numbered definitions
461 ValueList LateResolveValues;
Reid Spencer861d9d62006-11-28 07:29:44 +0000462 std::vector<PATypeHolder> Types;
463 std::map<ValID, PATypeHolder> LateResolveTypes;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000464
465 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
Chris Lattner0ad19702006-06-21 16:53:00 +0000466 /// how they were referenced and on which line of the input they came from so
Reid Spencer68a24bd2005-08-27 18:50:39 +0000467 /// that we can resolve them later and print error messages as appropriate.
468 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
469
470 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
471 // references to global values. Global values may be referenced before they
472 // are defined, and if so, the temporary object that they represent is held
473 // here. This is used for forward references of GlobalValues.
474 //
475 typedef std::map<std::pair<const PointerType *,
476 ValID>, GlobalValue*> GlobalRefsType;
477 GlobalRefsType GlobalRefs;
478
479 void ModuleDone() {
480 // If we could not resolve some functions at function compilation time
481 // (calls to functions before they are defined), resolve them now... Types
482 // are resolved when the constant pool has been completely parsed.
483 //
484 ResolveDefinitions(LateResolveValues);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000485 if (TriggerError)
486 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000487
488 // Check to make sure that all global value forward references have been
489 // resolved!
490 //
491 if (!GlobalRefs.empty()) {
492 std::string UndefinedReferences = "Unresolved global references exist:\n";
493
494 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
495 I != E; ++I) {
496 UndefinedReferences += " " + I->first.first->getDescription() + " " +
497 I->first.second.getName() + "\n";
498 }
Reid Spencer61c83e02006-08-18 08:43:06 +0000499 GenerateError(UndefinedReferences);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000500 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000501 }
502
Chandler Carruth02202192007-08-04 01:56:21 +0000503 // Look for intrinsic functions and CallInst that need to be upgraded
504 for (Module::iterator FI = CurrentModule->begin(),
505 FE = CurrentModule->end(); FI != FE; )
506 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
507
Reid Spencer68a24bd2005-08-27 18:50:39 +0000508 Values.clear(); // Clear out function local definitions
509 Types.clear();
510 CurrentModule = 0;
511 }
512
Reid Spencer68a24bd2005-08-27 18:50:39 +0000513 // GetForwardRefForGlobal - Check to see if there is a forward reference
514 // for this global. If so, remove it from the GlobalRefs map and return it.
515 // If not, just return null.
516 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
517 // Check to see if there is a forward reference to this global variable...
518 // if there is, eliminate it and patch the reference to use the new def'n.
519 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
520 GlobalValue *Ret = 0;
521 if (I != GlobalRefs.end()) {
522 Ret = I->second;
523 GlobalRefs.erase(I);
524 }
525 return Ret;
526 }
Reid Spencer8c8a2dc2007-01-02 21:54:12 +0000527
528 bool TypeIsUnresolved(PATypeHolder* PATy) {
529 // If it isn't abstract, its resolved
530 const Type* Ty = PATy->get();
531 if (!Ty->isAbstract())
532 return false;
533 // Traverse the type looking for abstract types. If it isn't abstract then
534 // we don't need to traverse that leg of the type.
535 std::vector<const Type*> WorkList, SeenList;
536 WorkList.push_back(Ty);
537 while (!WorkList.empty()) {
538 const Type* Ty = WorkList.back();
539 SeenList.push_back(Ty);
540 WorkList.pop_back();
541 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
542 // Check to see if this is an unresolved type
543 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
544 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
545 for ( ; I != E; ++I) {
546 if (I->second.get() == OpTy)
547 return true;
548 }
549 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
550 const Type* TheTy = SeqTy->getElementType();
551 if (TheTy->isAbstract() && TheTy != Ty) {
552 std::vector<const Type*>::iterator I = SeenList.begin(),
553 E = SeenList.end();
554 for ( ; I != E; ++I)
555 if (*I == TheTy)
556 break;
557 if (I == E)
558 WorkList.push_back(TheTy);
559 }
560 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
561 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
562 const Type* TheTy = StrTy->getElementType(i);
563 if (TheTy->isAbstract() && TheTy != Ty) {
564 std::vector<const Type*>::iterator I = SeenList.begin(),
565 E = SeenList.end();
566 for ( ; I != E; ++I)
567 if (*I == TheTy)
568 break;
569 if (I == E)
570 WorkList.push_back(TheTy);
571 }
572 }
573 }
574 }
575 return false;
576 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000577} CurModule;
578
579static struct PerFunctionInfo {
580 Function *CurrentFunction; // Pointer to current function being created
581
Reid Spencer93c40032007-03-19 18:40:50 +0000582 ValueList Values; // Keep track of #'d definitions
583 unsigned NextValNum;
584 ValueList LateResolveValues;
Reid Spenceref9b9a72007-02-05 20:47:22 +0000585 bool isDeclare; // Is this function a forward declararation?
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000586 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000587 GlobalValue::VisibilityTypes Visibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000588
589 /// BBForwardRefs - When we see forward references to basic blocks, keep
590 /// track of them here.
Reid Spencer93c40032007-03-19 18:40:50 +0000591 std::map<ValID, BasicBlock*> BBForwardRefs;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000592
593 inline PerFunctionInfo() {
594 CurrentFunction = 0;
595 isDeclare = false;
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000596 Linkage = GlobalValue::ExternalLinkage;
597 Visibility = GlobalValue::DefaultVisibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000598 }
599
600 inline void FunctionStart(Function *M) {
601 CurrentFunction = M;
Reid Spencer93c40032007-03-19 18:40:50 +0000602 NextValNum = 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000603 }
604
605 void FunctionDone() {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000606 // Any forward referenced blocks left?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000607 if (!BBForwardRefs.empty()) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000608 GenerateError("Undefined reference to label " +
Reid Spencer93c40032007-03-19 18:40:50 +0000609 BBForwardRefs.begin()->second->getName());
Reid Spencer5b7e7532006-09-28 19:28:24 +0000610 return;
611 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000612
613 // Resolve all forward references now.
614 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
615
616 Values.clear(); // Clear out function local definitions
Reid Spencer93c40032007-03-19 18:40:50 +0000617 BBForwardRefs.clear();
Reid Spencer68a24bd2005-08-27 18:50:39 +0000618 CurrentFunction = 0;
619 isDeclare = false;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000620 Linkage = GlobalValue::ExternalLinkage;
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000621 Visibility = GlobalValue::DefaultVisibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000622 }
623} CurFun; // Info for the current function...
624
625static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
626
627
628//===----------------------------------------------------------------------===//
629// Code to handle definitions of all the types
630//===----------------------------------------------------------------------===//
631
Reid Spencer93c40032007-03-19 18:40:50 +0000632static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
633 // Things that have names or are void typed don't get slot numbers
634 if (V->hasName() || (V->getType() == Type::VoidTy))
635 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000636
Reid Spencer93c40032007-03-19 18:40:50 +0000637 // In the case of function values, we have to allow for the forward reference
638 // of basic blocks, which are included in the numbering. Consequently, we keep
639 // track of the next insertion location with NextValNum. When a BB gets
640 // inserted, it could change the size of the CurFun.Values vector.
641 if (&ValueTab == &CurFun.Values) {
642 if (ValueTab.size() <= CurFun.NextValNum)
643 ValueTab.resize(CurFun.NextValNum+1);
644 ValueTab[CurFun.NextValNum++] = V;
645 return;
646 }
647 // For all other lists, its okay to just tack it on the back of the vector.
648 ValueTab.push_back(V);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000649}
650
651static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
652 switch (D.Type) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000653 case ValID::LocalID: // Is it a numbered definition?
Reid Spencer68a24bd2005-08-27 18:50:39 +0000654 // Module constants occupy the lowest numbered slots...
Reid Spencer41dff5e2007-01-26 08:05:27 +0000655 if (D.Num < CurModule.Types.size())
656 return CurModule.Types[D.Num];
Reid Spencer68a24bd2005-08-27 18:50:39 +0000657 break;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000658 case ValID::LocalName: // Is it a named definition?
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000659 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000660 D.destroy(); // Free old strdup'd memory...
661 return N;
662 }
663 break;
664 default:
Reid Spencerb5334b02007-02-05 10:18:06 +0000665 GenerateError("Internal parser error: Invalid symbol type reference");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000666 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000667 }
668
669 // If we reached here, we referenced either a symbol that we don't know about
670 // or an id number that hasn't been read yet. We may be referencing something
671 // forward, so just create an entry to be resolved later and get to it...
672 //
673 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
674
675
676 if (inFunctionScope()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000677 if (D.Type == ValID::LocalName) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000678 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000679 return 0;
680 } else {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000681 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
Reid Spencer5b7e7532006-09-28 19:28:24 +0000682 return 0;
683 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000684 }
685
Reid Spencer861d9d62006-11-28 07:29:44 +0000686 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000687 if (I != CurModule.LateResolveTypes.end())
Reid Spencer861d9d62006-11-28 07:29:44 +0000688 return I->second;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000689
Reid Spencer861d9d62006-11-28 07:29:44 +0000690 Type *Typ = OpaqueType::get();
691 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
692 return Typ;
Reid Spencera132e042006-12-03 05:46:11 +0000693 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000694
Reid Spencer93c40032007-03-19 18:40:50 +0000695// getExistingVal - Look up the value specified by the provided type and
Reid Spencer68a24bd2005-08-27 18:50:39 +0000696// the provided ValID. If the value exists and has already been defined, return
697// it. Otherwise return null.
698//
Reid Spencer93c40032007-03-19 18:40:50 +0000699static Value *getExistingVal(const Type *Ty, const ValID &D) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000700 if (isa<FunctionType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000701 GenerateError("Functions are not values and "
Reid Spencer68a24bd2005-08-27 18:50:39 +0000702 "must be referenced as pointers");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000703 return 0;
704 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000705
706 switch (D.Type) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000707 case ValID::LocalID: { // Is it a numbered definition?
Reid Spencer41dff5e2007-01-26 08:05:27 +0000708 // Check that the number is within bounds.
Reid Spencer93c40032007-03-19 18:40:50 +0000709 if (D.Num >= CurFun.Values.size())
710 return 0;
711 Value *Result = CurFun.Values[D.Num];
712 if (Ty != Result->getType()) {
713 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
714 Result->getType()->getDescription() + "' does not match "
715 "expected type, '" + Ty->getDescription() + "'");
716 return 0;
717 }
718 return Result;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000719 }
720 case ValID::GlobalID: { // Is it a numbered definition?
Reid Spencer93c40032007-03-19 18:40:50 +0000721 if (D.Num >= CurModule.Values.size())
Reid Spenceref9b9a72007-02-05 20:47:22 +0000722 return 0;
Reid Spencer93c40032007-03-19 18:40:50 +0000723 Value *Result = CurModule.Values[D.Num];
724 if (Ty != Result->getType()) {
725 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
726 Result->getType()->getDescription() + "' does not match "
727 "expected type, '" + Ty->getDescription() + "'");
Reid Spenceref9b9a72007-02-05 20:47:22 +0000728 return 0;
Reid Spencer93c40032007-03-19 18:40:50 +0000729 }
730 return Result;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000731 }
Reid Spencer41dff5e2007-01-26 08:05:27 +0000732
733 case ValID::LocalName: { // Is it a named definition?
Reid Spenceref9b9a72007-02-05 20:47:22 +0000734 if (!inFunctionScope())
735 return 0;
736 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000737 Value *N = SymTab.lookup(D.getName());
Reid Spenceref9b9a72007-02-05 20:47:22 +0000738 if (N == 0)
739 return 0;
740 if (N->getType() != Ty)
741 return 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000742
743 D.destroy(); // Free old strdup'd memory...
744 return N;
745 }
746 case ValID::GlobalName: { // Is it a named definition?
Reid Spenceref9b9a72007-02-05 20:47:22 +0000747 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000748 Value *N = SymTab.lookup(D.getName());
Reid Spenceref9b9a72007-02-05 20:47:22 +0000749 if (N == 0)
750 return 0;
751 if (N->getType() != Ty)
752 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000753
754 D.destroy(); // Free old strdup'd memory...
755 return N;
756 }
757
758 // Check to make sure that "Ty" is an integral type, and that our
759 // value will fit into the specified type...
760 case ValID::ConstSIntVal: // Is it a constant pool reference??
Chris Lattner38905612008-02-19 04:36:25 +0000761 if (!isa<IntegerType>(Ty) ||
762 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000763 GenerateError("Signed integral constant '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000764 itostr(D.ConstPool64) + "' is invalid for type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +0000765 Ty->getDescription() + "'");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000766 return 0;
767 }
Reid Spencer49d273e2007-03-19 20:40:51 +0000768 return ConstantInt::get(Ty, D.ConstPool64, true);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000769
770 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
Chris Lattner38905612008-02-19 04:36:25 +0000771 if (isa<IntegerType>(Ty) &&
772 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
Reid Spencerb83eb642006-10-20 07:07:24 +0000773 return ConstantInt::get(Ty, D.UConstPool64);
Chris Lattner38905612008-02-19 04:36:25 +0000774
775 if (!isa<IntegerType>(Ty) ||
776 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
777 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
778 "' is invalid or out of range for type '" +
779 Ty->getDescription() + "'");
780 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000781 }
Chris Lattner38905612008-02-19 04:36:25 +0000782 // This is really a signed reference. Transmogrify.
783 return ConstantInt::get(Ty, D.ConstPool64, true);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000784
Chris Lattner1913b942008-07-11 00:30:39 +0000785 case ValID::ConstAPInt: // Is it an unsigned const pool reference?
786 if (!isa<IntegerType>(Ty)) {
787 GenerateError("Integral constant '" + D.getName() +
788 "' is invalid or out of range for type '" +
789 Ty->getDescription() + "'");
790 return 0;
791 }
792
793 {
794 APSInt Tmp = *D.ConstPoolInt;
795 Tmp.extOrTrunc(Ty->getPrimitiveSizeInBits());
796 return ConstantInt::get(Tmp);
797 }
798
Reid Spencer68a24bd2005-08-27 18:50:39 +0000799 case ValID::ConstFPVal: // Is it a floating point const pool reference?
Chris Lattner38905612008-02-19 04:36:25 +0000800 if (!Ty->isFloatingPoint() ||
801 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000802 GenerateError("FP constant invalid for type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000803 return 0;
804 }
Chris Lattnerd8eb63f2008-04-20 00:41:19 +0000805 // Lexer has no type info, so builds all float and double FP constants
Dale Johannesenc72cd7e2007-09-11 18:33:39 +0000806 // as double. Fix this here. Long double does not need this.
807 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
808 Ty==Type::FloatTy)
Dale Johannesencdd509a2007-09-07 21:07:57 +0000809 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
Chris Lattnerd8eb63f2008-04-20 00:41:19 +0000810 return ConstantFP::get(*D.ConstPoolFP);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000811
812 case ValID::ConstNullVal: // Is it a null value?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000813 if (!isa<PointerType>(Ty)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000814 GenerateError("Cannot create a a non pointer null");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000815 return 0;
816 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000817 return ConstantPointerNull::get(cast<PointerType>(Ty));
818
819 case ValID::ConstUndefVal: // Is it an undef value?
820 return UndefValue::get(Ty);
821
Chris Lattner7aa61892005-12-21 17:53:23 +0000822 case ValID::ConstZeroVal: // Is it a zero value?
823 return Constant::getNullValue(Ty);
824
Reid Spencer68a24bd2005-08-27 18:50:39 +0000825 case ValID::ConstantVal: // Fully resolved constant?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000826 if (D.ConstantValue->getType() != Ty) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000827 GenerateError("Constant expression type different from required type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000828 return 0;
829 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000830 return D.ConstantValue;
831
Chris Lattner0e9c3762006-01-25 22:27:16 +0000832 case ValID::InlineAsmVal: { // Inline asm expression
833 const PointerType *PTy = dyn_cast<PointerType>(Ty);
834 const FunctionType *FTy =
835 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000836 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000837 GenerateError("Invalid type for asm constraint string");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000838 return 0;
839 }
Chris Lattner0e9c3762006-01-25 22:27:16 +0000840 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
841 D.IAD->HasSideEffects);
842 D.destroy(); // Free InlineAsmDescriptor.
843 return IA;
844 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000845 default:
Reid Spencera9720f52007-02-05 17:04:00 +0000846 assert(0 && "Unhandled case!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000847 return 0;
848 } // End of switch
849
Reid Spencera9720f52007-02-05 17:04:00 +0000850 assert(0 && "Unhandled case!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000851 return 0;
852}
853
Reid Spencer93c40032007-03-19 18:40:50 +0000854// getVal - This function is identical to getExistingVal, except that if a
Reid Spencer68a24bd2005-08-27 18:50:39 +0000855// value is not already defined, it "improvises" by creating a placeholder var
856// that looks and acts just like the requested variable. When the value is
857// defined later, all uses of the placeholder variable are replaced with the
858// real thing.
859//
860static Value *getVal(const Type *Ty, const ValID &ID) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000861 if (Ty == Type::LabelTy) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000862 GenerateError("Cannot use a basic block here");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000863 return 0;
864 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000865
866 // See if the value has already been defined.
Reid Spencer93c40032007-03-19 18:40:50 +0000867 Value *V = getExistingVal(Ty, ID);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000868 if (V) return V;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000869 if (TriggerError) return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000870
Reid Spencer5b7e7532006-09-28 19:28:24 +0000871 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
Dan Gohmane4977cf2008-05-23 01:55:30 +0000872 GenerateError("Invalid use of a non-first-class type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000873 return 0;
874 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000875
876 // If we reached here, we referenced either a symbol that we don't know about
877 // or an id number that hasn't been read yet. We may be referencing something
878 // forward, so just create an entry to be resolved later and get to it...
879 //
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000880 switch (ID.Type) {
881 case ValID::GlobalName:
Reid Spencer9c9b63a2007-04-28 16:07:31 +0000882 case ValID::GlobalID: {
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000883 const PointerType *PTy = dyn_cast<PointerType>(Ty);
884 if (!PTy) {
885 GenerateError("Invalid type for reference to global" );
886 return 0;
887 }
888 const Type* ElTy = PTy->getElementType();
889 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
Gabor Greife64d2482008-04-06 23:07:54 +0000890 V = Function::Create(FTy, GlobalValue::ExternalLinkage);
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000891 else
Christopher Lamba8ed9bf2007-12-11 09:02:08 +0000892 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
893 (Module*)0, false, PTy->getAddressSpace());
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000894 break;
Reid Spencer9c9b63a2007-04-28 16:07:31 +0000895 }
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000896 default:
897 V = new Argument(Ty);
898 }
899
Reid Spencer68a24bd2005-08-27 18:50:39 +0000900 // Remember where this forward reference came from. FIXME, shouldn't we try
901 // to recycle these things??
902 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
Duncan Sandsdc024672007-11-27 13:23:08 +0000903 LLLgetLineNo())));
Reid Spencer68a24bd2005-08-27 18:50:39 +0000904
905 if (inFunctionScope())
906 InsertValue(V, CurFun.LateResolveValues);
907 else
908 InsertValue(V, CurModule.LateResolveValues);
909 return V;
910}
911
Reid Spencer93c40032007-03-19 18:40:50 +0000912/// defineBBVal - This is a definition of a new basic block with the specified
913/// identifier which must be the same as CurFun.NextValNum, if its numeric.
Chris Lattnercc81d152008-05-04 17:18:47 +0000914static BasicBlock *defineBBVal(const ValID &ID) {
Reid Spencera9720f52007-02-05 17:04:00 +0000915 assert(inFunctionScope() && "Can't get basic block at global scope!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000916
Reid Spencer68a24bd2005-08-27 18:50:39 +0000917 BasicBlock *BB = 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000918
Reid Spencer93c40032007-03-19 18:40:50 +0000919 // First, see if this was forward referenced
Reid Spencer68a24bd2005-08-27 18:50:39 +0000920
Reid Spencer93c40032007-03-19 18:40:50 +0000921 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
922 if (BBI != CurFun.BBForwardRefs.end()) {
923 BB = BBI->second;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000924 // The forward declaration could have been inserted anywhere in the
925 // function: insert it into the correct place now.
926 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
927 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
Reid Spencer93c40032007-03-19 18:40:50 +0000928
Reid Spencer66728ef2007-03-20 01:13:36 +0000929 // We're about to erase the entry, save the key so we can clean it up.
930 ValID Tmp = BBI->first;
931
Reid Spencer93c40032007-03-19 18:40:50 +0000932 // Erase the forward ref from the map as its no longer "forward"
933 CurFun.BBForwardRefs.erase(ID);
934
Reid Spencer66728ef2007-03-20 01:13:36 +0000935 // The key has been removed from the map but so we don't want to leave
936 // strdup'd memory around so destroy it too.
937 Tmp.destroy();
938
Reid Spencer93c40032007-03-19 18:40:50 +0000939 // If its a numbered definition, bump the number and set the BB value.
940 if (ID.Type == ValID::LocalID) {
941 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
942 InsertValue(BB);
943 }
Devang Patel67909432008-03-03 18:58:47 +0000944 } else {
945 // We haven't seen this BB before and its first mention is a definition.
946 // Just create it and return it.
947 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
Gabor Greife64d2482008-04-06 23:07:54 +0000948 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Devang Patel67909432008-03-03 18:58:47 +0000949 if (ID.Type == ValID::LocalID) {
950 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
951 InsertValue(BB);
952 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000953 }
Reid Spencer93c40032007-03-19 18:40:50 +0000954
Devang Patel67909432008-03-03 18:58:47 +0000955 ID.destroy();
Reid Spencer93c40032007-03-19 18:40:50 +0000956 return BB;
957}
958
959/// getBBVal - get an existing BB value or create a forward reference for it.
960///
961static BasicBlock *getBBVal(const ValID &ID) {
962 assert(inFunctionScope() && "Can't get basic block at global scope!");
963
964 BasicBlock *BB = 0;
965
966 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
967 if (BBI != CurFun.BBForwardRefs.end()) {
968 BB = BBI->second;
969 } if (ID.Type == ValID::LocalName) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000970 std::string Name = ID.getName();
Reid Spencer93c40032007-03-19 18:40:50 +0000971 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
Anton Korobeynikovc70d7732008-02-20 12:10:37 +0000972 if (N) {
Reid Spencer93c40032007-03-19 18:40:50 +0000973 if (N->getType()->getTypeID() == Type::LabelTyID)
974 BB = cast<BasicBlock>(N);
975 else
976 GenerateError("Reference to label '" + Name + "' is actually of type '"+
977 N->getType()->getDescription() + "'");
Anton Korobeynikovc70d7732008-02-20 12:10:37 +0000978 }
Reid Spencer93c40032007-03-19 18:40:50 +0000979 } else if (ID.Type == ValID::LocalID) {
980 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
981 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
982 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
983 else
984 GenerateError("Reference to label '%" + utostr(ID.Num) +
985 "' is actually of type '"+
986 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
987 }
988 } else {
989 GenerateError("Illegal label reference " + ID.getName());
990 return 0;
991 }
992
993 // If its already been defined, return it now.
994 if (BB) {
995 ID.destroy(); // Free strdup'd memory.
996 return BB;
997 }
998
999 // Otherwise, this block has not been seen before, create it.
1000 std::string Name;
1001 if (ID.Type == ValID::LocalName)
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001002 Name = ID.getName();
Gabor Greife64d2482008-04-06 23:07:54 +00001003 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Reid Spencer93c40032007-03-19 18:40:50 +00001004
1005 // Insert it in the forward refs map.
1006 CurFun.BBForwardRefs[ID] = BB;
1007
Reid Spencer68a24bd2005-08-27 18:50:39 +00001008 return BB;
1009}
1010
1011
1012//===----------------------------------------------------------------------===//
1013// Code to handle forward references in instructions
1014//===----------------------------------------------------------------------===//
1015//
1016// This code handles the late binding needed with statements that reference
1017// values not defined yet... for example, a forward branch, or the PHI node for
1018// a loop body.
1019//
1020// This keeps a table (CurFun.LateResolveValues) of all such forward references
1021// and back patchs after we are done.
1022//
1023
1024// ResolveDefinitions - If we could not resolve some defs at parsing
1025// time (forward branches, phi functions for loops, etc...) resolve the
1026// defs now...
1027//
1028static void
Reid Spencer93c40032007-03-19 18:40:50 +00001029ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001030 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
Reid Spencer93c40032007-03-19 18:40:50 +00001031 while (!LateResolvers.empty()) {
1032 Value *V = LateResolvers.back();
1033 LateResolvers.pop_back();
Reid Spencer68a24bd2005-08-27 18:50:39 +00001034
Reid Spencer93c40032007-03-19 18:40:50 +00001035 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1036 CurModule.PlaceHolderInfo.find(V);
1037 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001038
Reid Spencer93c40032007-03-19 18:40:50 +00001039 ValID &DID = PHI->second.first;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001040
Reid Spencer93c40032007-03-19 18:40:50 +00001041 Value *TheRealValue = getExistingVal(V->getType(), DID);
1042 if (TriggerError)
1043 return;
1044 if (TheRealValue) {
1045 V->replaceAllUsesWith(TheRealValue);
1046 delete V;
1047 CurModule.PlaceHolderInfo.erase(PHI);
1048 } else if (FutureLateResolvers) {
1049 // Functions have their unresolved items forwarded to the module late
1050 // resolver table
1051 InsertValue(V, *FutureLateResolvers);
1052 } else {
1053 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1054 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1055 "' of type '" + V->getType()->getDescription() + "'",
1056 PHI->second.second);
Reid Spencer5b7e7532006-09-28 19:28:24 +00001057 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001058 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00001059 GenerateError("Reference to an invalid definition: #" +
1060 itostr(DID.Num) + " of type '" +
1061 V->getType()->getDescription() + "'",
1062 PHI->second.second);
1063 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001064 }
1065 }
1066 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001067 LateResolvers.clear();
1068}
1069
1070// ResolveTypeTo - A brand new type was just declared. This means that (if
1071// name is not null) things referencing Name can be resolved. Otherwise, things
1072// refering to the number can be resolved. Do this now.
1073//
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001074static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001075 ValID D;
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001076 if (Name)
1077 D = ValID::createLocalName(*Name);
1078 else
1079 D = ValID::createLocalID(CurModule.Types.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00001080
Reid Spencer861d9d62006-11-28 07:29:44 +00001081 std::map<ValID, PATypeHolder>::iterator I =
Reid Spencer68a24bd2005-08-27 18:50:39 +00001082 CurModule.LateResolveTypes.find(D);
1083 if (I != CurModule.LateResolveTypes.end()) {
Reid Spencer861d9d62006-11-28 07:29:44 +00001084 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001085 CurModule.LateResolveTypes.erase(I);
1086 }
1087}
1088
1089// setValueName - Set the specified value to the name given. The name may be
1090// null potentially, in which case this is a noop. The string passed in is
1091// assumed to be a malloc'd string buffer, and is free'd by this function.
1092//
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001093static void setValueName(Value *V, std::string *NameStr) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00001094 if (!NameStr) return;
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001095 std::string Name(*NameStr); // Copy string
1096 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001097
Reid Spencer41dff5e2007-01-26 08:05:27 +00001098 if (V->getType() == Type::VoidTy) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001099 GenerateError("Can't assign name '" + Name+"' to value with void type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00001100 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001101 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00001102
Reid Spencera9720f52007-02-05 17:04:00 +00001103 assert(inFunctionScope() && "Must be in function scope!");
Reid Spenceref9b9a72007-02-05 20:47:22 +00001104 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1105 if (ST.lookup(Name)) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00001106 GenerateError("Redefinition of value '" + Name + "' of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00001107 V->getType()->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00001108 return;
1109 }
1110
1111 // Set the name.
1112 V->setName(Name);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001113}
1114
1115/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1116/// this is a declaration, otherwise it is a definition.
Chris Lattnerb475c422005-11-12 18:22:38 +00001117static GlobalVariable *
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001118ParseGlobalVariable(std::string *NameStr,
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001119 GlobalValue::LinkageTypes Linkage,
1120 GlobalValue::VisibilityTypes Visibility,
Chris Lattnerb475c422005-11-12 18:22:38 +00001121 bool isConstantGlobal, const Type *Ty,
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001122 Constant *Initializer, bool IsThreadLocal,
1123 unsigned AddressSpace = 0) {
Reid Spencer5b7e7532006-09-28 19:28:24 +00001124 if (isa<FunctionType>(Ty)) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001125 GenerateError("Cannot declare global vars of function type");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001126 return 0;
1127 }
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001128 if (Ty == Type::LabelTy) {
1129 GenerateError("Cannot declare global vars of label type");
1130 return 0;
1131 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001132
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001133 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001134
1135 std::string Name;
1136 if (NameStr) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001137 Name = *NameStr; // Copy string
1138 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001139 }
1140
1141 // See if this global value was forward referenced. If so, recycle the
1142 // object.
1143 ValID ID;
1144 if (!Name.empty()) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001145 ID = ValID::createGlobalName(Name);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001146 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00001147 ID = ValID::createGlobalID(CurModule.Values.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00001148 }
1149
1150 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1151 // Move the global to the end of the list, from whereever it was
1152 // previously inserted.
1153 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1154 CurModule.CurrentModule->getGlobalList().remove(GV);
1155 CurModule.CurrentModule->getGlobalList().push_back(GV);
1156 GV->setInitializer(Initializer);
1157 GV->setLinkage(Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001158 GV->setVisibility(Visibility);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001159 GV->setConstant(isConstantGlobal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00001160 GV->setThreadLocal(IsThreadLocal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001161 InsertValue(GV, CurModule.Values);
Chris Lattnerb475c422005-11-12 18:22:38 +00001162 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001163 }
1164
Reid Spenceref9b9a72007-02-05 20:47:22 +00001165 // If this global has a name
Reid Spencer68a24bd2005-08-27 18:50:39 +00001166 if (!Name.empty()) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00001167 // if the global we're parsing has an initializer (is a definition) and
1168 // has external linkage.
1169 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1170 // If there is already a global with external linkage with this name
1171 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1172 // If we allow this GVar to get created, it will be renamed in the
1173 // symbol table because it conflicts with an existing GVar. We can't
1174 // allow redefinition of GVars whose linking indicates that their name
1175 // must stay the same. Issue the error.
1176 GenerateError("Redefinition of global variable named '" + Name +
1177 "' of type '" + Ty->getDescription() + "'");
1178 return 0;
1179 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001180 }
1181
1182 // Otherwise there is no existing GV to use, create one now.
1183 GlobalVariable *GV =
1184 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001185 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001186 GV->setVisibility(Visibility);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001187 InsertValue(GV, CurModule.Values);
Chris Lattnerb475c422005-11-12 18:22:38 +00001188 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001189}
1190
1191// setTypeName - Set the specified type to the name given. The name may be
1192// null potentially, in which case this is a noop. The string passed in is
1193// assumed to be a malloc'd string buffer, and is freed by this function.
1194//
1195// This function returns true if the type has already been defined, but is
1196// allowed to be redefined in the specified context. If the name is a new name
1197// for the type plane, it is inserted and false is returned.
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001198static bool setTypeName(const Type *T, std::string *NameStr) {
Reid Spencera9720f52007-02-05 17:04:00 +00001199 assert(!inFunctionScope() && "Can't give types function-local names!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001200 if (NameStr == 0) return false;
1201
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001202 std::string Name(*NameStr); // Copy string
1203 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001204
1205 // We don't allow assigning names to void type
Reid Spencer5b7e7532006-09-28 19:28:24 +00001206 if (T == Type::VoidTy) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001207 GenerateError("Can't assign name '" + Name + "' to the void type");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001208 return false;
1209 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001210
1211 // Set the type name, checking for conflicts as we do so.
1212 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1213
1214 if (AlreadyExists) { // Inserting a name that is already defined???
1215 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
Reid Spencera9720f52007-02-05 17:04:00 +00001216 assert(Existing && "Conflict but no matching type?!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001217
1218 // There is only one case where this is allowed: when we are refining an
1219 // opaque type. In this case, Existing will be an opaque type.
1220 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1221 // We ARE replacing an opaque type!
1222 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1223 return true;
1224 }
1225
1226 // Otherwise, this is an attempt to redefine a type. That's okay if
1227 // the redefinition is identical to the original. This will be so if
1228 // Existing and T point to the same Type object. In this one case we
1229 // allow the equivalent redefinition.
1230 if (Existing == T) return true; // Yes, it's equal.
1231
1232 // Any other kind of (non-equivalent) redefinition is an error.
Reid Spencer63c34452007-01-05 21:51:07 +00001233 GenerateError("Redefinition of type named '" + Name + "' of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00001234 T->getDescription() + "'");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001235 }
1236
1237 return false;
1238}
1239
1240//===----------------------------------------------------------------------===//
1241// Code for handling upreferences in type names...
1242//
1243
1244// TypeContains - Returns true if Ty directly contains E in it.
1245//
1246static bool TypeContains(const Type *Ty, const Type *E) {
1247 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1248 E) != Ty->subtype_end();
1249}
1250
1251namespace {
1252 struct UpRefRecord {
1253 // NestingLevel - The number of nesting levels that need to be popped before
1254 // this type is resolved.
1255 unsigned NestingLevel;
1256
1257 // LastContainedTy - This is the type at the current binding level for the
1258 // type. Every time we reduce the nesting level, this gets updated.
1259 const Type *LastContainedTy;
1260
1261 // UpRefTy - This is the actual opaque type that the upreference is
1262 // represented with.
1263 OpaqueType *UpRefTy;
1264
1265 UpRefRecord(unsigned NL, OpaqueType *URTy)
1266 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1267 };
1268}
1269
1270// UpRefs - A list of the outstanding upreferences that need to be resolved.
1271static std::vector<UpRefRecord> UpRefs;
1272
1273/// HandleUpRefs - Every time we finish a new layer of types, this function is
1274/// called. It loops through the UpRefs vector, which is a list of the
1275/// currently active types. For each type, if the up reference is contained in
1276/// the newly completed type, we decrement the level count. When the level
1277/// count reaches zero, the upreferenced type is the type that is passed in:
1278/// thus we can complete the cycle.
1279///
1280static PATypeHolder HandleUpRefs(const Type *ty) {
Chris Lattner224f84f2006-08-18 17:34:45 +00001281 // If Ty isn't abstract, or if there are no up-references in it, then there is
1282 // nothing to resolve here.
1283 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1284
Reid Spencer68a24bd2005-08-27 18:50:39 +00001285 PATypeHolder Ty(ty);
1286 UR_OUT("Type '" << Ty->getDescription() <<
1287 "' newly formed. Resolving upreferences.\n" <<
1288 UpRefs.size() << " upreferences active!\n");
1289
1290 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1291 // to zero), we resolve them all together before we resolve them to Ty. At
1292 // the end of the loop, if there is anything to resolve to Ty, it will be in
1293 // this variable.
1294 OpaqueType *TypeToResolve = 0;
1295
1296 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1297 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1298 << UpRefs[i].second->getDescription() << ") = "
1299 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1300 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1301 // Decrement level of upreference
1302 unsigned Level = --UpRefs[i].NestingLevel;
1303 UpRefs[i].LastContainedTy = Ty;
1304 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1305 if (Level == 0) { // Upreference should be resolved!
1306 if (!TypeToResolve) {
1307 TypeToResolve = UpRefs[i].UpRefTy;
1308 } else {
1309 UR_OUT(" * Resolving upreference for "
1310 << UpRefs[i].second->getDescription() << "\n";
1311 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1312 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1313 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1314 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1315 }
1316 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1317 --i; // Do not skip the next element...
1318 }
1319 }
1320 }
1321
1322 if (TypeToResolve) {
1323 UR_OUT(" * Resolving upreference for "
1324 << UpRefs[i].second->getDescription() << "\n";
1325 std::string OldName = TypeToResolve->getDescription());
1326 TypeToResolve->refineAbstractTypeTo(Ty);
1327 }
1328
1329 return Ty;
1330}
1331
Reid Spencer68a24bd2005-08-27 18:50:39 +00001332//===----------------------------------------------------------------------===//
1333// RunVMAsmParser - Define an interface to this parser
1334//===----------------------------------------------------------------------===//
1335//
Reid Spencer14310612006-12-31 05:40:51 +00001336static Module* RunParser(Module * M);
1337
Duncan Sandsdc024672007-11-27 13:23:08 +00001338Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1339 InitLLLexer(MB);
1340 Module *M = RunParser(new Module(LLLgetFilename()));
1341 FreeLexer();
1342 return M;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001343}
1344
1345
Dan Gohmanf4423b12008-04-19 00:24:39 +00001346
1347/* Enabling traces. */
1348#ifndef YYDEBUG
1349# define YYDEBUG 0
1350#endif
1351
1352/* Enabling verbose error messages. */
1353#ifdef YYERROR_VERBOSE
1354# undef YYERROR_VERBOSE
1355# define YYERROR_VERBOSE 1
1356#else
1357# define YYERROR_VERBOSE 0
1358#endif
1359
1360/* Enabling the token table. */
1361#ifndef YYTOKEN_TABLE
1362# define YYTOKEN_TABLE 0
1363#endif
1364
1365#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1366typedef union YYSTYPE
Dale Johannesen20ab78b2008-08-13 18:41:46 +00001367#line 967 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00001368{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001369 llvm::Module *ModuleVal;
1370 llvm::Function *FunctionVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001371 llvm::BasicBlock *BasicBlockVal;
1372 llvm::TerminatorInst *TermInstVal;
1373 llvm::Instruction *InstVal;
Reid Spencera132e042006-12-03 05:46:11 +00001374 llvm::Constant *ConstVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001375
Reid Spencera132e042006-12-03 05:46:11 +00001376 const llvm::Type *PrimType;
Reid Spencer14310612006-12-31 05:40:51 +00001377 std::list<llvm::PATypeHolder> *TypeList;
Reid Spencera132e042006-12-03 05:46:11 +00001378 llvm::PATypeHolder *TypeVal;
1379 llvm::Value *ValueVal;
Reid Spencera132e042006-12-03 05:46:11 +00001380 std::vector<llvm::Value*> *ValueList;
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001381 std::vector<unsigned> *ConstantList;
Reid Spencer14310612006-12-31 05:40:51 +00001382 llvm::ArgListType *ArgList;
1383 llvm::TypeWithAttrs TypeWithAttrs;
1384 llvm::TypeWithAttrsList *TypeWithAttrsList;
Dale Johanneseneb57ea72007-11-05 21:20:28 +00001385 llvm::ParamList *ParamList;
Reid Spencer14310612006-12-31 05:40:51 +00001386
Reid Spencer68a24bd2005-08-27 18:50:39 +00001387 // Represent the RHS of PHI node
Reid Spencera132e042006-12-03 05:46:11 +00001388 std::list<std::pair<llvm::Value*,
1389 llvm::BasicBlock*> > *PHIList;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001390 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
Reid Spencera132e042006-12-03 05:46:11 +00001391 std::vector<llvm::Constant*> *ConstVector;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001392
1393 llvm::GlobalValue::LinkageTypes Linkage;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001394 llvm::GlobalValue::VisibilityTypes Visibility;
Dale Johannesen222ebf72008-02-19 21:40:51 +00001395 llvm::ParameterAttributes ParamAttrs;
Reid Spencer38c91a92007-02-28 02:24:54 +00001396 llvm::APInt *APIntVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001397 int64_t SInt64Val;
1398 uint64_t UInt64Val;
1399 int SIntVal;
1400 unsigned UIntVal;
Dale Johannesencdd509a2007-09-07 21:07:57 +00001401 llvm::APFloat *FPVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001402 bool BoolVal;
1403
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001404 std::string *StrVal; // This memory must be deleted
1405 llvm::ValID ValIDVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001406
Reid Spencera132e042006-12-03 05:46:11 +00001407 llvm::Instruction::BinaryOps BinaryOpVal;
1408 llvm::Instruction::TermOps TermOpVal;
1409 llvm::Instruction::MemoryOps MemOpVal;
1410 llvm::Instruction::CastOps CastOpVal;
1411 llvm::Instruction::OtherOps OtherOpVal;
Reid Spencera132e042006-12-03 05:46:11 +00001412 llvm::ICmpInst::Predicate IPredicate;
1413 llvm::FCmpInst::Predicate FPredicate;
Dan Gohmanf4423b12008-04-19 00:24:39 +00001414}
Dan Gohman180c1692008-06-23 18:43:26 +00001415/* Line 193 of yacc.c. */
Dale Johannesen20ab78b2008-08-13 18:41:46 +00001416#line 1417 "llvmAsmParser.tab.c"
Dan Gohmanf4423b12008-04-19 00:24:39 +00001417 YYSTYPE;
1418# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1419# define YYSTYPE_IS_DECLARED 1
1420# define YYSTYPE_IS_TRIVIAL 1
Reid Spencer68a24bd2005-08-27 18:50:39 +00001421#endif
1422
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001423
Reid Spencer68a24bd2005-08-27 18:50:39 +00001424
Dan Gohmanf4423b12008-04-19 00:24:39 +00001425/* Copy the second part of user declarations. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001426
1427
Dan Gohmanf4423b12008-04-19 00:24:39 +00001428/* Line 216 of yacc.c. */
Dale Johannesen20ab78b2008-08-13 18:41:46 +00001429#line 1430 "llvmAsmParser.tab.c"
Reid Spencerb8f85052007-07-31 03:50:36 +00001430
Dan Gohmanf4423b12008-04-19 00:24:39 +00001431#ifdef short
1432# undef short
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001433#endif
1434
Dan Gohmanf4423b12008-04-19 00:24:39 +00001435#ifdef YYTYPE_UINT8
1436typedef YYTYPE_UINT8 yytype_uint8;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001437#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00001438typedef unsigned char yytype_uint8;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001439#endif
1440
Dan Gohmanf4423b12008-04-19 00:24:39 +00001441#ifdef YYTYPE_INT8
1442typedef YYTYPE_INT8 yytype_int8;
1443#elif (defined __STDC__ || defined __C99__FUNC__ \
1444 || defined __cplusplus || defined _MSC_VER)
1445typedef signed char yytype_int8;
1446#else
1447typedef short int yytype_int8;
1448#endif
1449
1450#ifdef YYTYPE_UINT16
1451typedef YYTYPE_UINT16 yytype_uint16;
1452#else
1453typedef unsigned short int yytype_uint16;
1454#endif
1455
1456#ifdef YYTYPE_INT16
1457typedef YYTYPE_INT16 yytype_int16;
1458#else
1459typedef short int yytype_int16;
1460#endif
1461
1462#ifndef YYSIZE_T
1463# ifdef __SIZE_TYPE__
1464# define YYSIZE_T __SIZE_TYPE__
1465# elif defined size_t
1466# define YYSIZE_T size_t
1467# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1468 || defined __cplusplus || defined _MSC_VER)
1469# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1470# define YYSIZE_T size_t
1471# else
1472# define YYSIZE_T unsigned int
1473# endif
1474#endif
1475
1476#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1477
1478#ifndef YY_
Dan Gohman180c1692008-06-23 18:43:26 +00001479# if defined YYENABLE_NLS && YYENABLE_NLS
Dan Gohmanf4423b12008-04-19 00:24:39 +00001480# if ENABLE_NLS
1481# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1482# define YY_(msgid) dgettext ("bison-runtime", msgid)
1483# endif
1484# endif
1485# ifndef YY_
1486# define YY_(msgid) msgid
1487# endif
1488#endif
1489
1490/* Suppress unused-variable warnings by "using" E. */
1491#if ! defined lint || defined __GNUC__
1492# define YYUSE(e) ((void) (e))
1493#else
1494# define YYUSE(e) /* empty */
1495#endif
1496
1497/* Identity function, used to suppress warnings about constant conditions. */
1498#ifndef lint
1499# define YYID(n) (n)
1500#else
1501#if (defined __STDC__ || defined __C99__FUNC__ \
1502 || defined __cplusplus || defined _MSC_VER)
1503static int
1504YYID (int i)
1505#else
1506static int
1507YYID (i)
1508 int i;
1509#endif
1510{
1511 return i;
1512}
1513#endif
1514
1515#if ! defined yyoverflow || YYERROR_VERBOSE
1516
1517/* The parser invokes alloca or malloc; define the necessary symbols. */
1518
1519# ifdef YYSTACK_USE_ALLOCA
1520# if YYSTACK_USE_ALLOCA
1521# ifdef __GNUC__
1522# define YYSTACK_ALLOC __builtin_alloca
1523# elif defined __BUILTIN_VA_ARG_INCR
1524# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1525# elif defined _AIX
1526# define YYSTACK_ALLOC __alloca
1527# elif defined _MSC_VER
1528# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1529# define alloca _alloca
1530# else
1531# define YYSTACK_ALLOC alloca
1532# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1533 || defined __cplusplus || defined _MSC_VER)
1534# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1535# ifndef _STDLIB_H
1536# define _STDLIB_H 1
1537# endif
1538# endif
1539# endif
1540# endif
1541# endif
1542
1543# ifdef YYSTACK_ALLOC
1544 /* Pacify GCC's `empty if-body' warning. */
1545# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1546# ifndef YYSTACK_ALLOC_MAXIMUM
1547 /* The OS might guarantee only one guard page at the bottom of the stack,
1548 and a page size can be as small as 4096 bytes. So we cannot safely
1549 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1550 to allow for a few compiler-allocated temporary stack slots. */
1551# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1552# endif
1553# else
1554# define YYSTACK_ALLOC YYMALLOC
1555# define YYSTACK_FREE YYFREE
1556# ifndef YYSTACK_ALLOC_MAXIMUM
1557# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1558# endif
1559# if (defined __cplusplus && ! defined _STDLIB_H \
1560 && ! ((defined YYMALLOC || defined malloc) \
1561 && (defined YYFREE || defined free)))
1562# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1563# ifndef _STDLIB_H
1564# define _STDLIB_H 1
1565# endif
1566# endif
1567# ifndef YYMALLOC
1568# define YYMALLOC malloc
1569# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1570 || defined __cplusplus || defined _MSC_VER)
1571void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1572# endif
1573# endif
1574# ifndef YYFREE
1575# define YYFREE free
1576# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1577 || defined __cplusplus || defined _MSC_VER)
1578void free (void *); /* INFRINGES ON USER NAME SPACE */
1579# endif
1580# endif
1581# endif
1582#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1583
1584
1585#if (! defined yyoverflow \
1586 && (! defined __cplusplus \
1587 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1588
1589/* A type that is properly aligned for any stack member. */
1590union yyalloc
1591{
1592 yytype_int16 yyss;
1593 YYSTYPE yyvs;
1594 };
1595
1596/* The size of the maximum gap between one aligned stack and the next. */
1597# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1598
1599/* The size of an array large to enough to hold all stacks, each with
1600 N elements. */
1601# define YYSTACK_BYTES(N) \
1602 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1603 + YYSTACK_GAP_MAXIMUM)
1604
1605/* Copy COUNT objects from FROM to TO. The source and destination do
1606 not overlap. */
1607# ifndef YYCOPY
1608# if defined __GNUC__ && 1 < __GNUC__
1609# define YYCOPY(To, From, Count) \
1610 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1611# else
1612# define YYCOPY(To, From, Count) \
1613 do \
1614 { \
1615 YYSIZE_T yyi; \
1616 for (yyi = 0; yyi < (Count); yyi++) \
1617 (To)[yyi] = (From)[yyi]; \
1618 } \
1619 while (YYID (0))
1620# endif
1621# endif
1622
1623/* Relocate STACK from its old location to the new one. The
1624 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1625 elements in the stack, and YYPTR gives the new location of the
1626 stack. Advance YYPTR to a properly aligned location for the next
1627 stack. */
1628# define YYSTACK_RELOCATE(Stack) \
1629 do \
1630 { \
1631 YYSIZE_T yynewbytes; \
1632 YYCOPY (&yyptr->Stack, Stack, yysize); \
1633 Stack = &yyptr->Stack; \
1634 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1635 yyptr += yynewbytes / sizeof (*yyptr); \
1636 } \
1637 while (YYID (0))
1638
1639#endif
1640
1641/* YYFINAL -- State number of the termination state. */
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001642#define YYFINAL 44
Dan Gohmanf4423b12008-04-19 00:24:39 +00001643/* YYLAST -- Last index in YYTABLE. */
Dale Johannesen20ab78b2008-08-13 18:41:46 +00001644#define YYLAST 2381
Dan Gohmanf4423b12008-04-19 00:24:39 +00001645
1646/* YYNTOKENS -- Number of terminals. */
Dale Johannesen20ab78b2008-08-13 18:41:46 +00001647#define YYNTOKENS 171
Dan Gohmanf4423b12008-04-19 00:24:39 +00001648/* YYNNTS -- Number of nonterminals. */
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001649#define YYNNTS 86
Dan Gohmanf4423b12008-04-19 00:24:39 +00001650/* YYNRULES -- Number of rules. */
Dale Johannesen20ab78b2008-08-13 18:41:46 +00001651#define YYNRULES 343
Dan Gohmanf4423b12008-04-19 00:24:39 +00001652/* YYNRULES -- Number of states. */
Dale Johannesen20ab78b2008-08-13 18:41:46 +00001653#define YYNSTATES 702
Dan Gohmanf4423b12008-04-19 00:24:39 +00001654
1655/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1656#define YYUNDEFTOK 2
Dale Johannesen20ab78b2008-08-13 18:41:46 +00001657#define YYMAXUTOK 411
Dan Gohmanf4423b12008-04-19 00:24:39 +00001658
1659#define YYTRANSLATE(YYX) \
1660 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1661
1662/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1663static const yytype_uint8 yytranslate[] =
1664{
1665 0, 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,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00001669 157, 158, 161, 2, 160, 2, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001670 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00001671 166, 159, 167, 2, 2, 2, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001672 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1673 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00001674 2, 163, 162, 165, 2, 2, 2, 2, 2, 170,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001675 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1676 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00001677 164, 2, 2, 168, 2, 169, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001678 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1679 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1680 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1681 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1682 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1683 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1684 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1685 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1686 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1687 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1688 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1689 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1690 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1691 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1692 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1693 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1694 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1695 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1696 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1697 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1698 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1699 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1700 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1701 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1702 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1703 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1704 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001705 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00001706 155, 156
Dan Gohmanf4423b12008-04-19 00:24:39 +00001707};
1708
1709#if YYDEBUG
1710/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1711 YYRHS. */
1712static const yytype_uint16 yyprhs[] =
1713{
1714 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1715 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1716 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1717 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1718 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1719 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1720 119, 121, 123, 125, 127, 129, 130, 135, 136, 139,
1721 140, 142, 144, 146, 147, 150, 152, 154, 156, 158,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001722 160, 162, 164, 166, 168, 169, 171, 173, 175, 176,
1723 178, 180, 181, 183, 185, 187, 189, 190, 192, 194,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00001724 195, 197, 199, 201, 203, 205, 207, 210, 212, 214,
1725 216, 218, 220, 222, 224, 226, 228, 231, 232, 235,
1726 237, 239, 241, 243, 245, 247, 248, 251, 252, 255,
1727 256, 259, 260, 264, 267, 268, 270, 271, 275, 277,
1728 280, 282, 284, 286, 288, 290, 292, 294, 296, 298,
1729 302, 304, 307, 313, 319, 325, 331, 335, 338, 344,
1730 349, 352, 354, 356, 358, 362, 364, 368, 370, 371,
1731 373, 377, 382, 386, 390, 395, 400, 404, 411, 417,
1732 420, 423, 426, 429, 432, 435, 438, 441, 444, 447,
1733 450, 453, 460, 466, 475, 482, 489, 497, 505, 513,
1734 521, 528, 537, 546, 552, 560, 564, 566, 568, 570,
1735 572, 573, 576, 583, 585, 586, 588, 591, 592, 596,
1736 597, 601, 605, 609, 613, 614, 623, 624, 634, 635,
1737 645, 651, 654, 658, 660, 664, 668, 672, 676, 678,
1738 679, 685, 689, 691, 695, 697, 698, 709, 711, 713,
1739 718, 720, 722, 725, 729, 730, 732, 734, 736, 738,
1740 740, 742, 744, 746, 748, 750, 752, 756, 760, 763,
1741 766, 770, 773, 779, 784, 786, 792, 794, 796, 798,
1742 800, 802, 804, 807, 809, 813, 816, 819, 823, 826,
1743 827, 829, 832, 835, 839, 849, 859, 868, 883, 885,
1744 887, 894, 900, 903, 910, 918, 923, 928, 935, 942,
1745 943, 944, 948, 951, 955, 958, 960, 966, 972, 979,
1746 986, 993, 1000, 1005, 1012, 1017, 1022, 1029, 1036, 1039,
1747 1048, 1050, 1052, 1053, 1057, 1064, 1068, 1075, 1078, 1084,
1748 1092, 1098, 1103, 1108
Dan Gohmanf4423b12008-04-19 00:24:39 +00001749};
1750
1751/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1752static const yytype_int16 yyrhs[] =
1753{
Dale Johannesen20ab78b2008-08-13 18:41:46 +00001754 217, 0, -1, 76, -1, 77, -1, 78, -1, 79,
1755 -1, 80, -1, 81, -1, 82, -1, 83, -1, 84,
1756 -1, 88, -1, 89, -1, 90, -1, 85, -1, 86,
1757 -1, 87, -1, 121, -1, 122, -1, 123, -1, 124,
1758 -1, 125, -1, 126, -1, 127, -1, 128, -1, 129,
1759 -1, 130, -1, 131, -1, 132, -1, 95, -1, 96,
1760 -1, 97, -1, 98, -1, 99, -1, 100, -1, 101,
1761 -1, 102, -1, 103, -1, 104, -1, 105, -1, 106,
1762 -1, 107, -1, 108, -1, 109, -1, 110, -1, 111,
1763 -1, 112, -1, 113, -1, 114, -1, 101, -1, 102,
1764 -1, 103, -1, 104, -1, 26, -1, 27, -1, 11,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001765 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00001766 -1, 19, -1, 22, -1, 24, -1, 179, -1, -1,
1767 55, 157, 4, 158, -1, -1, 179, 159, -1, -1,
1768 20, -1, 23, -1, 185, -1, -1, 183, 159, -1,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001769 42, -1, 44, -1, 43, -1, 45, -1, 47, -1,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00001770 49, -1, 46, -1, 48, -1, 51, -1, -1, 154,
1771 -1, 155, -1, 156, -1, -1, 46, -1, 48, -1,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001772 -1, 42, -1, 43, -1, 44, -1, 47, -1, -1,
1773 44, -1, 42, -1, -1, 63, -1, 64, -1, 65,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00001774 -1, 66, -1, 67, -1, 68, -1, 62, 4, -1,
1775 143, -1, 122, -1, 142, -1, 123, -1, 145, -1,
1776 146, -1, 148, -1, 149, -1, 150, -1, 54, 4,
1777 -1, -1, 194, 193, -1, 144, -1, 147, -1, 143,
1778 -1, 142, -1, 151, -1, 152, -1, -1, 196, 195,
1779 -1, -1, 153, 22, -1, -1, 54, 4, -1, -1,
1780 160, 54, 4, -1, 34, 22, -1, -1, 200, -1,
1781 -1, 160, 203, 202, -1, 200, -1, 54, 4, -1,
1782 11, -1, 12, -1, 13, -1, 16, -1, 15, -1,
1783 14, -1, 17, -1, 50, -1, 204, -1, 205, 181,
1784 161, -1, 239, -1, 162, 4, -1, 205, 157, 209,
1785 158, 196, -1, 10, 157, 209, 158, 196, -1, 163,
1786 4, 164, 205, 165, -1, 166, 4, 164, 205, 167,
1787 -1, 168, 210, 169, -1, 168, 169, -1, 166, 168,
1788 210, 169, 167, -1, 166, 168, 169, 167, -1, 205,
1789 194, -1, 205, -1, 10, -1, 206, -1, 208, 160,
1790 206, -1, 208, -1, 208, 160, 39, -1, 39, -1,
1791 -1, 205, -1, 210, 160, 205, -1, 205, 163, 213,
1792 165, -1, 205, 163, 165, -1, 205, 170, 22, -1,
1793 205, 166, 213, 167, -1, 205, 168, 213, 169, -1,
1794 205, 168, 169, -1, 205, 166, 168, 213, 169, 167,
1795 -1, 205, 166, 168, 169, 167, -1, 205, 40, -1,
1796 205, 41, -1, 205, 239, -1, 205, 212, -1, 205,
1797 25, -1, 177, 3, -1, 177, 5, -1, 177, 4,
1798 -1, 177, 6, -1, 11, 26, -1, 11, 27, -1,
1799 178, 9, -1, 174, 157, 211, 38, 205, 158, -1,
1800 120, 157, 211, 251, 158, -1, 134, 157, 211, 160,
1801 211, 160, 211, 158, -1, 172, 157, 211, 160, 211,
1802 158, -1, 173, 157, 211, 160, 211, 158, -1, 91,
1803 175, 157, 211, 160, 211, 158, -1, 92, 176, 157,
1804 211, 160, 211, 158, -1, 93, 175, 157, 211, 160,
1805 211, 158, -1, 94, 176, 157, 211, 160, 211, 158,
1806 -1, 136, 157, 211, 160, 211, 158, -1, 137, 157,
1807 211, 160, 211, 160, 211, 158, -1, 138, 157, 211,
1808 160, 211, 160, 211, 158, -1, 140, 157, 211, 252,
1809 158, -1, 141, 157, 211, 160, 211, 252, 158, -1,
1810 213, 160, 211, -1, 211, -1, 32, -1, 33, -1,
1811 37, -1, -1, 207, 239, -1, 126, 157, 216, 38,
1812 205, 158, -1, 218, -1, -1, 219, -1, 218, 219,
1813 -1, -1, 31, 220, 235, -1, -1, 30, 221, 236,
1814 -1, 60, 59, 225, -1, 182, 18, 205, -1, 182,
1815 18, 10, -1, -1, 184, 188, 215, 214, 211, 181,
1816 222, 202, -1, -1, 184, 186, 188, 215, 214, 211,
1817 181, 223, 202, -1, -1, 184, 187, 188, 215, 214,
1818 205, 181, 224, 202, -1, 184, 188, 35, 191, 216,
1819 -1, 52, 226, -1, 56, 159, 227, -1, 22, -1,
1820 53, 159, 22, -1, 69, 159, 22, -1, 163, 228,
1821 165, -1, 228, 160, 22, -1, 22, -1, -1, 229,
1822 160, 205, 194, 180, -1, 205, 194, 180, -1, 229,
1823 -1, 229, 160, 39, -1, 39, -1, -1, 192, 207,
1824 183, 157, 230, 158, 196, 201, 198, 197, -1, 28,
1825 -1, 168, -1, 190, 188, 231, 232, -1, 29, -1,
1826 169, -1, 243, 234, -1, 189, 188, 231, -1, -1,
1827 61, -1, 3, -1, 4, -1, 5, -1, 6, -1,
1828 9, -1, 26, -1, 27, -1, 40, -1, 41, -1,
1829 25, -1, 166, 213, 167, -1, 163, 213, 165, -1,
1830 163, 165, -1, 170, 22, -1, 168, 213, 169, -1,
1831 168, 169, -1, 166, 168, 213, 169, 167, -1, 166,
1832 168, 169, 167, -1, 212, -1, 59, 237, 22, 160,
1833 22, -1, 7, -1, 8, -1, 179, -1, 183, -1,
1834 239, -1, 238, -1, 205, 240, -1, 241, -1, 242,
1835 160, 241, -1, 243, 244, -1, 233, 244, -1, 245,
1836 182, 246, -1, 245, 248, -1, -1, 21, -1, 70,
1837 242, -1, 70, 10, -1, 71, 17, 240, -1, 71,
1838 11, 240, 160, 17, 240, 160, 17, 240, -1, 72,
1839 177, 240, 160, 17, 240, 163, 247, 165, -1, 72,
1840 177, 240, 160, 17, 240, 163, 165, -1, 73, 192,
1841 207, 240, 157, 250, 158, 196, 38, 17, 240, 74,
1842 17, 240, -1, 74, -1, 75, -1, 247, 177, 238,
1843 160, 17, 240, -1, 177, 238, 160, 17, 240, -1,
1844 182, 254, -1, 205, 163, 240, 160, 240, 165, -1,
1845 249, 160, 163, 240, 160, 240, 165, -1, 205, 194,
1846 240, 194, -1, 17, 194, 240, 194, -1, 250, 160,
1847 205, 194, 240, 194, -1, 250, 160, 17, 194, 240,
1848 194, -1, -1, -1, 251, 160, 241, -1, 160, 4,
1849 -1, 252, 160, 4, -1, 58, 57, -1, 57, -1,
1850 172, 205, 240, 160, 240, -1, 173, 205, 240, 160,
1851 240, -1, 91, 175, 205, 240, 160, 240, -1, 92,
1852 176, 205, 240, 160, 240, -1, 93, 175, 205, 240,
1853 160, 240, -1, 94, 176, 205, 240, 160, 240, -1,
1854 174, 241, 38, 205, -1, 134, 241, 160, 241, 160,
1855 241, -1, 135, 241, 160, 205, -1, 136, 241, 160,
1856 241, -1, 137, 241, 160, 241, 160, 241, -1, 138,
1857 241, 160, 241, 160, 241, -1, 133, 249, -1, 253,
1858 192, 207, 240, 157, 250, 158, 196, -1, 256, -1,
1859 36, -1, -1, 115, 205, 199, -1, 115, 205, 160,
1860 11, 240, 199, -1, 116, 205, 199, -1, 116, 205,
1861 160, 11, 240, 199, -1, 117, 241, -1, 255, 118,
1862 205, 240, 199, -1, 255, 119, 241, 160, 205, 240,
1863 199, -1, 139, 205, 240, 160, 4, -1, 120, 205,
1864 240, 251, -1, 140, 205, 240, 252, -1, 141, 205,
1865 240, 160, 205, 240, 252, -1
Dan Gohmanf4423b12008-04-19 00:24:39 +00001866};
1867
1868/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1869static const yytype_uint16 yyrline[] =
1870{
Dale Johannesen20ab78b2008-08-13 18:41:46 +00001871 0, 1133, 1133, 1133, 1133, 1133, 1133, 1133, 1133, 1133,
1872 1133, 1134, 1134, 1134, 1134, 1134, 1134, 1135, 1135, 1135,
1873 1135, 1135, 1135, 1136, 1136, 1136, 1136, 1136, 1136, 1139,
1874 1139, 1140, 1140, 1141, 1141, 1142, 1142, 1143, 1143, 1147,
1875 1147, 1148, 1148, 1149, 1149, 1150, 1150, 1151, 1151, 1152,
1876 1152, 1153, 1153, 1154, 1155, 1160, 1161, 1161, 1161, 1161,
1877 1161, 1163, 1163, 1163, 1164, 1164, 1166, 1167, 1171, 1175,
1878 1180, 1180, 1182, 1183, 1188, 1194, 1195, 1196, 1197, 1198,
1879 1199, 1203, 1204, 1205, 1209, 1210, 1211, 1212, 1216, 1217,
1880 1218, 1222, 1223, 1224, 1225, 1226, 1230, 1231, 1232, 1235,
1881 1236, 1237, 1238, 1239, 1240, 1241, 1242, 1249, 1250, 1251,
1882 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1262, 1263, 1268,
1883 1269, 1270, 1271, 1272, 1273, 1276, 1277, 1282, 1283, 1290,
1884 1291, 1297, 1298, 1307, 1315, 1316, 1321, 1322, 1323, 1328,
1885 1341, 1341, 1341, 1341, 1341, 1341, 1341, 1344, 1348, 1352,
1886 1359, 1364, 1372, 1401, 1426, 1431, 1441, 1451, 1455, 1465,
1887 1472, 1481, 1488, 1493, 1498, 1505, 1506, 1513, 1520, 1528,
1888 1534, 1546, 1574, 1590, 1617, 1645, 1671, 1691, 1717, 1737,
1889 1749, 1756, 1822, 1832, 1842, 1848, 1858, 1864, 1874, 1880,
1890 1886, 1899, 1911, 1932, 1940, 1946, 1957, 1962, 1967, 1972,
1891 1977, 1983, 1989, 1995, 2003, 2014, 2018, 2026, 2026, 2029,
1892 2029, 2032, 2044, 2065, 2070, 2078, 2079, 2083, 2083, 2087,
1893 2087, 2090, 2093, 2117, 2129, 2128, 2140, 2139, 2149, 2148,
1894 2159, 2199, 2202, 2208, 2218, 2222, 2227, 2229, 2234, 2239,
1895 2248, 2258, 2269, 2273, 2282, 2291, 2296, 2425, 2425, 2427,
1896 2436, 2436, 2438, 2443, 2455, 2459, 2464, 2468, 2472, 2477,
1897 2482, 2486, 2490, 2494, 2498, 2502, 2506, 2528, 2550, 2556,
1898 2569, 2581, 2586, 2598, 2604, 2608, 2618, 2622, 2626, 2631,
1899 2638, 2638, 2644, 2653, 2658, 2663, 2667, 2676, 2685, 2694,
1900 2698, 2706, 2726, 2730, 2735, 2746, 2765, 2774, 2860, 2864,
1901 2871, 2882, 2895, 2905, 2916, 2926, 2937, 2945, 2955, 2962,
1902 2965, 2966, 2974, 2980, 2989, 2993, 2998, 3014, 3031, 3045,
1903 3059, 3073, 3087, 3099, 3107, 3114, 3120, 3126, 3132, 3147,
1904 3237, 3242, 3246, 3253, 3260, 3270, 3277, 3287, 3295, 3309,
1905 3326, 3340, 3355, 3370
Dan Gohmanf4423b12008-04-19 00:24:39 +00001906};
1907#endif
1908
1909#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1910/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1911 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1912static const char *const yytname[] =
1913{
1914 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1915 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1916 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1917 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1918 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1919 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1920 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1921 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001922 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "COMMON", "OPAQUE",
Dan Gohmanf4423b12008-04-19 00:24:39 +00001923 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1924 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1925 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
Dale Johannesen20ab78b2008-08-13 18:41:46 +00001926 "X86_SSECALLCC_TOK", "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE",
1927 "UNWIND", "UNREACHABLE", "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV",
1928 "UREM", "SREM", "FREM", "AND", "OR", "XOR", "SHL", "LSHR", "ASHR",
1929 "ICMP", "FCMP", "VICMP", "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE",
1930 "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE",
1931 "ORD", "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE",
1932 "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST",
1933 "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT",
1934 "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT",
1935 "SHUFFLEVECTOR", "GETRESULT", "EXTRACTVALUE", "INSERTVALUE", "SIGNEXT",
1936 "ZEROEXT", "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL",
1937 "NEST", "READNONE", "READONLY", "GC", "DEFAULT", "HIDDEN", "PROTECTED",
1938 "'('", "')'", "'='", "','", "'*'", "'\\\\'", "'['", "'x'", "']'", "'<'",
1939 "'>'", "'{'", "'}'", "'c'", "$accept", "ArithmeticOps", "LogicalOps",
1940 "CastOps", "IPredicates", "FPredicates", "IntType", "FPType",
1941 "LocalName", "OptLocalName", "OptAddrSpace", "OptLocalAssign",
1942 "GlobalName", "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
Dan Gohmane4977cf2008-05-23 01:55:30 +00001943 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1944 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr",
1945 "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign",
1946 "OptCAlign", "SectionString", "OptSection", "GlobalVarAttributes",
Dan Gohmanf4423b12008-04-19 00:24:39 +00001947 "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
1948 "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
1949 "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
1950 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1951 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1952 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1953 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1954 "SymbolicValueRef", "ValueRef", "ResolvedVal", "ReturnedVal",
1955 "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst",
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001956 "JumpTable", "Inst", "PHIList", "ParamList", "IndexList",
1957 "ConstantIndexList", "OptTailCall", "InstVal", "OptVolatile",
1958 "MemoryInst", 0
Dan Gohmanf4423b12008-04-19 00:24:39 +00001959};
1960#endif
1961
1962# ifdef YYPRINT
1963/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1964 token YYLEX-NUM. */
1965static const yytype_uint16 yytoknum[] =
1966{
1967 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1968 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1969 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1970 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1971 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1972 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1973 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1974 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1975 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1976 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1977 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1978 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1979 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1980 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1981 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00001982 405, 406, 407, 408, 409, 410, 411, 40, 41, 61,
1983 44, 42, 92, 91, 120, 93, 60, 62, 123, 125,
1984 99
Dan Gohmanf4423b12008-04-19 00:24:39 +00001985};
1986# endif
1987
1988/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
Dale Johannesen20ab78b2008-08-13 18:41:46 +00001989static const yytype_uint16 yyr1[] =
Dan Gohmanf4423b12008-04-19 00:24:39 +00001990{
Dale Johannesen20ab78b2008-08-13 18:41:46 +00001991 0, 171, 172, 172, 172, 172, 172, 172, 172, 172,
1992 172, 173, 173, 173, 173, 173, 173, 174, 174, 174,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001993 174, 174, 174, 174, 174, 174, 174, 174, 174, 175,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00001994 175, 175, 175, 175, 175, 175, 175, 175, 175, 176,
1995 176, 176, 176, 176, 176, 176, 176, 176, 176, 176,
1996 176, 176, 176, 176, 176, 177, 178, 178, 178, 178,
1997 178, 179, 179, 179, 180, 180, 181, 181, 182, 182,
1998 183, 183, 184, 184, 185, 186, 186, 186, 186, 186,
1999 186, 187, 187, 187, 188, 188, 188, 188, 189, 189,
2000 189, 190, 190, 190, 190, 190, 191, 191, 191, 192,
2001 192, 192, 192, 192, 192, 192, 192, 193, 193, 193,
2002 193, 193, 193, 193, 193, 193, 193, 194, 194, 195,
2003 195, 195, 195, 195, 195, 196, 196, 197, 197, 198,
2004 198, 199, 199, 200, 201, 201, 202, 202, 203, 203,
2005 204, 204, 204, 204, 204, 204, 204, 205, 205, 205,
2006 205, 205, 205, 205, 205, 205, 205, 205, 205, 205,
2007 206, 207, 207, 208, 208, 209, 209, 209, 209, 210,
2008 210, 211, 211, 211, 211, 211, 211, 211, 211, 211,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002009 211, 211, 211, 211, 211, 211, 211, 211, 211, 211,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002010 211, 212, 212, 212, 212, 212, 212, 212, 212, 212,
2011 212, 212, 212, 212, 212, 213, 213, 214, 214, 215,
2012 215, 216, 216, 217, 217, 218, 218, 220, 219, 221,
2013 219, 219, 219, 219, 222, 219, 223, 219, 224, 219,
2014 219, 219, 219, 225, 226, 226, 227, 228, 228, 228,
2015 229, 229, 230, 230, 230, 230, 231, 232, 232, 233,
2016 234, 234, 235, 236, 237, 237, 238, 238, 238, 238,
2017 238, 238, 238, 238, 238, 238, 238, 238, 238, 238,
2018 238, 238, 238, 238, 238, 238, 239, 239, 239, 239,
2019 240, 240, 241, 242, 242, 243, 243, 244, 245, 245,
2020 245, 246, 246, 246, 246, 246, 246, 246, 246, 246,
2021 247, 247, 248, 249, 249, 250, 250, 250, 250, 250,
2022 251, 251, 252, 252, 253, 253, 254, 254, 254, 254,
2023 254, 254, 254, 254, 254, 254, 254, 254, 254, 254,
2024 254, 255, 255, 256, 256, 256, 256, 256, 256, 256,
2025 256, 256, 256, 256
Dan Gohmanf4423b12008-04-19 00:24:39 +00002026};
2027
2028/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
2029static const yytype_uint8 yyr2[] =
2030{
2031 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
2032 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2033 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2034 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2035 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2036 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2037 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
2038 1, 1, 1, 0, 2, 1, 1, 1, 1, 1,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002039 1, 1, 1, 1, 0, 1, 1, 1, 0, 1,
2040 1, 0, 1, 1, 1, 1, 0, 1, 1, 0,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002041 1, 1, 1, 1, 1, 1, 2, 1, 1, 1,
2042 1, 1, 1, 1, 1, 1, 2, 0, 2, 1,
2043 1, 1, 1, 1, 1, 0, 2, 0, 2, 0,
2044 2, 0, 3, 2, 0, 1, 0, 3, 1, 2,
2045 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
2046 1, 2, 5, 5, 5, 5, 3, 2, 5, 4,
2047 2, 1, 1, 1, 3, 1, 3, 1, 0, 1,
2048 3, 4, 3, 3, 4, 4, 3, 6, 5, 2,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002049 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002050 2, 6, 5, 8, 6, 6, 7, 7, 7, 7,
2051 6, 8, 8, 5, 7, 3, 1, 1, 1, 1,
2052 0, 2, 6, 1, 0, 1, 2, 0, 3, 0,
2053 3, 3, 3, 3, 0, 8, 0, 9, 0, 9,
2054 5, 2, 3, 1, 3, 3, 3, 3, 1, 0,
2055 5, 3, 1, 3, 1, 0, 10, 1, 1, 4,
2056 1, 1, 2, 3, 0, 1, 1, 1, 1, 1,
2057 1, 1, 1, 1, 1, 1, 3, 3, 2, 2,
2058 3, 2, 5, 4, 1, 5, 1, 1, 1, 1,
2059 1, 1, 2, 1, 3, 2, 2, 3, 2, 0,
2060 1, 2, 2, 3, 9, 9, 8, 14, 1, 1,
2061 6, 5, 2, 6, 7, 4, 4, 6, 6, 0,
2062 0, 3, 2, 3, 2, 1, 5, 5, 6, 6,
2063 6, 6, 4, 6, 4, 4, 6, 6, 2, 8,
2064 1, 1, 0, 3, 6, 3, 6, 2, 5, 7,
2065 5, 4, 4, 7
Dan Gohmanf4423b12008-04-19 00:24:39 +00002066};
2067
2068/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2069 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2070 means the default is an error. */
2071static const yytype_uint16 yydefact[] =
2072{
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002073 73, 61, 70, 62, 71, 63, 219, 217, 0, 0,
2074 0, 0, 0, 0, 84, 72, 0, 73, 215, 88,
2075 91, 0, 0, 231, 0, 0, 68, 0, 74, 75,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002076 77, 76, 78, 81, 79, 82, 80, 83, 85, 86,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002077 87, 84, 84, 210, 1, 216, 89, 90, 84, 220,
2078 92, 93, 94, 95, 84, 289, 218, 289, 0, 0,
2079 239, 232, 233, 221, 276, 277, 223, 140, 141, 142,
2080 145, 144, 143, 146, 147, 0, 0, 0, 0, 278,
2081 279, 148, 222, 150, 210, 210, 96, 209, 0, 99,
2082 99, 290, 286, 69, 250, 251, 252, 285, 234, 235,
2083 238, 0, 168, 151, 0, 0, 0, 0, 157, 169,
2084 0, 0, 168, 0, 0, 0, 98, 97, 0, 207,
2085 208, 0, 0, 100, 101, 102, 103, 104, 105, 0,
2086 253, 0, 332, 288, 0, 236, 167, 117, 163, 165,
2087 0, 0, 0, 0, 0, 0, 156, 0, 0, 149,
2088 0, 0, 162, 0, 161, 0, 230, 140, 141, 142,
2089 145, 144, 143, 0, 0, 67, 67, 106, 0, 247,
2090 248, 249, 331, 315, 0, 0, 0, 0, 99, 298,
2091 299, 2, 3, 4, 5, 6, 7, 8, 9, 10,
2092 14, 15, 16, 11, 12, 13, 0, 0, 0, 0,
2093 0, 0, 0, 0, 17, 18, 19, 20, 21, 22,
2094 23, 24, 25, 26, 27, 28, 0, 0, 0, 0,
2095 0, 0, 0, 0, 0, 0, 0, 0, 287, 99,
2096 302, 0, 330, 237, 160, 0, 125, 67, 67, 159,
2097 0, 170, 0, 125, 67, 67, 0, 211, 188, 189,
2098 184, 186, 185, 187, 190, 183, 179, 180, 0, 0,
Nate Begemanac80ade2008-05-12 19:01:56 +00002099 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002100 0, 0, 0, 0, 0, 0, 182, 181, 224, 0,
2101 314, 292, 67, 283, 291, 0, 0, 55, 0, 0,
2102 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
2103 0, 53, 54, 49, 50, 51, 52, 39, 40, 41,
2104 42, 43, 44, 45, 46, 47, 48, 0, 0, 0,
2105 131, 131, 337, 67, 67, 328, 0, 0, 0, 0,
2106 0, 67, 67, 67, 67, 67, 0, 0, 0, 0,
2107 0, 108, 110, 109, 107, 111, 112, 113, 114, 115,
2108 118, 166, 164, 153, 154, 155, 158, 66, 152, 226,
2109 228, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2110 0, 0, 0, 172, 206, 0, 0, 0, 176, 0,
2111 173, 0, 0, 0, 136, 245, 256, 257, 258, 259,
2112 260, 265, 261, 262, 263, 264, 254, 0, 0, 0,
2113 0, 274, 281, 280, 282, 0, 0, 293, 0, 0,
2114 67, 67, 67, 67, 0, 333, 0, 335, 310, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002115 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002116 0, 0, 0, 67, 0, 116, 122, 121, 119, 120,
2117 123, 124, 126, 136, 136, 0, 0, 0, 0, 0,
2118 310, 0, 0, 0, 0, 0, 0, 0, 171, 157,
2119 169, 0, 174, 175, 0, 0, 0, 0, 225, 244,
2120 117, 242, 0, 255, 0, 268, 0, 0, 0, 271,
2121 0, 269, 284, 0, 0, 0, 0, 0, 0, 0,
2122 0, 0, 0, 341, 0, 0, 0, 324, 325, 0,
2123 0, 0, 0, 342, 0, 0, 0, 322, 0, 131,
2124 0, 227, 229, 67, 0, 0, 0, 0, 0, 0,
2125 0, 0, 0, 0, 0, 205, 178, 0, 0, 0,
2126 0, 0, 0, 138, 136, 65, 0, 125, 0, 267,
2127 157, 0, 266, 270, 0, 0, 309, 0, 0, 0,
2128 0, 131, 132, 131, 0, 0, 0, 0, 0, 0,
2129 340, 312, 0, 67, 316, 317, 309, 0, 338, 67,
2130 212, 0, 0, 0, 0, 192, 0, 0, 0, 0,
2131 203, 0, 177, 0, 0, 67, 133, 139, 137, 64,
2132 241, 243, 117, 134, 0, 273, 0, 0, 0, 117,
2133 117, 0, 318, 319, 320, 321, 334, 336, 311, 0,
2134 0, 323, 326, 327, 313, 0, 0, 131, 0, 0,
2135 0, 0, 0, 200, 0, 0, 0, 194, 195, 191,
2136 65, 135, 129, 275, 272, 0, 0, 0, 0, 125,
2137 0, 303, 0, 343, 125, 339, 196, 197, 198, 199,
2138 0, 0, 0, 204, 240, 0, 127, 0, 296, 0,
2139 0, 108, 110, 117, 117, 0, 117, 117, 304, 329,
2140 193, 201, 202, 130, 0, 246, 294, 0, 295, 0,
2141 306, 305, 0, 0, 0, 128, 0, 0, 0, 117,
2142 117, 0, 0, 0, 308, 307, 301, 0, 0, 300,
2143 0, 297
Dan Gohmanf4423b12008-04-19 00:24:39 +00002144};
2145
2146/* YYDEFGOTO[NTERM-NUM]. */
2147static const yytype_int16 yydefgoto[] =
2148{
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002149 -1, 273, 274, 275, 300, 317, 163, 164, 79, 590,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002150 113, 12, 80, 14, 15, 41, 42, 43, 48, 54,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002151 118, 129, 350, 234, 442, 353, 675, 656, 415, 533,
2152 632, 468, 534, 81, 165, 138, 155, 139, 140, 110,
2153 374, 401, 375, 121, 88, 156, 16, 17, 18, 20,
2154 19, 384, 443, 444, 63, 23, 61, 101, 471, 472,
2155 130, 171, 55, 96, 56, 49, 474, 402, 83, 404,
2156 283, 284, 57, 92, 93, 228, 660, 133, 325, 601,
2157 493, 503, 229, 230, 231, 232
Dan Gohmanf4423b12008-04-19 00:24:39 +00002158};
2159
2160/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2161 STATE-NUM. */
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002162#define YYPACT_NINF -623
Dan Gohmanf4423b12008-04-19 00:24:39 +00002163static const yytype_int16 yypact[] =
2164{
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002165 493, -623, -623, -623, -623, -623, -623, -623, 18, -104,
2166 15, -100, 70, -57, -3, -623, 148, 542, -623, 191,
2167 228, -29, 9, -623, 44, 159, -623, 1927, -623, -623,
2168 -623, -623, -623, -623, -623, -623, -623, -623, -623, -623,
2169 -623, 33, 33, 222, -623, -623, -623, -623, 33, -623,
2170 -623, -623, -623, -623, 33, 196, -623, -10, 201, 208,
2171 218, -623, -623, -623, -623, -623, 93, -623, -623, -623,
2172 -623, -623, -623, -623, -623, 256, 262, 2, 624, -623,
2173 -623, -623, 10, -623, 250, 250, 235, -623, 78, 310,
2174 310, -623, -623, 254, -623, -623, -623, -623, -623, -623,
2175 -623, -32, 1645, -623, 125, 139, 806, 93, -623, 10,
2176 -109, 137, 1645, 153, 78, 78, -623, -623, 1686, -623,
2177 -623, 1945, 314, -623, -623, -623, -623, -623, -623, 1974,
2178 -623, -12, 2208, -623, 301, -623, -623, 10, -623, 167,
2179 177, 1992, 1992, 170, -107, 1992, -623, 334, 193, -623,
2180 1945, 1992, 93, 197, 10, 205, -623, 63, 346, 347,
2181 348, 349, 355, 243, 357, 1509, 312, -623, 122, -623,
2182 -623, -623, -623, -623, 324, 2033, 129, 371, 310, -623,
2183 -623, -623, -623, -623, -623, -623, -623, -623, -623, -623,
2184 -623, -623, -623, -623, -623, -623, 245, 548, 245, 548,
2185 1992, 1992, 1992, 1992, -623, -623, -623, -623, -623, -623,
2186 -623, -623, -623, -623, -623, -623, 1992, 1992, 1992, 1992,
2187 1992, 1992, 1992, 1992, 1992, 1992, 1992, 1992, -623, 310,
2188 -623, 39, -623, -623, 331, 1704, -623, -31, -28, -623,
2189 216, 10, 226, -623, 312, 8, 1686, -623, -623, -623,
2190 -623, -623, -623, -623, -623, -623, -623, -623, 245, 548,
2191 245, 548, 229, 230, 231, 232, 233, 234, 236, 1745,
2192 2051, 1126, 370, 237, 246, 247, -623, -623, -623, 251,
2193 -623, 93, 908, -623, 240, 1076, 1076, -623, 1076, 1974,
2194 -623, -623, -623, -623, -623, -623, -623, -623, -623, -623,
2195 1992, -623, -623, -623, -623, -623, -623, -623, -623, -623,
2196 -623, -623, -623, -623, -623, -623, -623, 1992, 1992, 1992,
2197 -40, 22, -623, 908, 6, 242, 249, 253, 257, 258,
2198 260, 908, 908, 908, 908, 908, 369, 1974, 1992, 1992,
2199 407, -623, -623, -623, -623, -623, -623, -623, -623, -623,
2200 -623, -623, -623, 158, -623, -623, -623, -623, 158, -623,
2201 153, 376, 259, 264, 265, 266, 1945, 1945, 1945, 1945,
2202 1945, 1945, 1945, -623, -623, 66, 1170, -111, -623, -88,
2203 -623, 1945, 1945, 1945, 267, 1764, -623, -623, -623, -623,
2204 -623, -623, -623, -623, -623, -623, 363, 1808, 2107, 1403,
2205 406, -623, -623, -623, -623, 1992, 269, -623, 270, 1076,
2206 908, 908, 908, 908, 25, -623, 43, -623, -623, 1076,
2207 268, 1992, 1992, 1992, 1992, 1992, 272, 277, 279, 280,
2208 281, 1992, 1076, 908, 284, -623, -623, -623, -623, -623,
2209 -623, -623, -623, 267, 267, 1992, 1945, 1945, 1945, 1945,
2210 -623, 285, 286, 287, 288, 277, 289, 1945, -623, 283,
2211 1357, -87, -623, -623, 292, 295, 418, 16, -623, -623,
2212 10, 297, 300, -623, 439, -623, 73, 1449, -59, -623,
2213 -69, -623, -623, 446, 454, 315, 322, 332, 335, 336,
2214 1076, 487, 1076, 338, 339, 1076, 340, 10, -623, 341,
2215 342, 490, 499, 354, 1992, 1076, 1076, 10, 361, 359,
2216 1992, -623, -623, 3, 362, 365, 366, 367, 130, 1945,
2217 1945, 1945, 1945, 146, 1945, -623, -623, 374, 1945, 1945,
2218 1992, 507, 517, -623, 267, 119, 1866, -623, 377, -623,
2219 379, -65, -623, -623, 1076, 1076, 2154, 1076, 1076, 1076,
2220 1076, 359, -623, 359, 1992, 1076, 383, 1992, 1992, 1992,
2221 -623, -623, 530, 908, -623, -623, 2154, 494, -623, 908,
2222 -623, 1945, 1945, 1945, 1945, -623, 384, 389, 390, 391,
2223 -623, 277, -623, 394, 396, 28, -623, -623, -623, -623,
2224 -623, -623, 10, -20, 533, -623, 392, 403, 393, 23,
2225 10, 161, -623, -623, -623, -623, -623, -623, -623, 402,
2226 1076, -623, -623, -623, -623, 277, 168, 359, 410, 411,
2227 412, 413, 1945, -623, 1945, 1945, 176, -623, -623, -623,
2228 119, -623, 522, -623, -623, 561, -1, 756, 756, -623,
2229 2213, -623, 414, 354, -623, -623, -623, -623, -623, -623,
2230 422, 423, 424, -623, -623, 584, 436, 1076, -623, 1222,
2231 1, 433, 434, -623, -623, 173, 23, 10, -623, 158,
2232 -623, -623, -623, -623, 570, -623, -623, 435, -623, 1222,
2233 331, 331, 579, 756, 756, -623, 580, 440, 1076, -623,
2234 -623, 1076, 582, 527, 331, 331, -623, 1076, 588, -623,
2235 1076, -623
Dan Gohmanf4423b12008-04-19 00:24:39 +00002236};
2237
2238/* YYPGOTO[NTERM-NUM]. */
2239static const yytype_int16 yypgoto[] =
2240{
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002241 -623, 477, 478, 480, -164, -152, -170, -623, 0, -17,
2242 -146, 523, 4, -623, -623, -623, -623, 64, -623, -623,
2243 -623, -145, -623, -445, -623, -238, -623, -623, -295, 26,
2244 -623, -421, -623, -623, -26, 380, -127, -623, 506, 515,
2245 -86, -162, -262, 89, 223, 378, -623, -623, 605, -623,
2246 -623, -623, -623, -623, -623, -623, -623, -623, -623, -623,
2247 535, -623, -623, -623, -623, -623, -623, -622, -80, 174,
2248 -189, -623, -623, 566, -623, -623, -623, -623, -623, 60,
2249 178, -437, -623, -623, -623, -623
Dan Gohmanf4423b12008-04-19 00:24:39 +00002250};
2251
2252/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2253 positive, shift that token. If negative, reduce the rule which
2254 number is the opposite. If zero, do what YYDEFACT says.
2255 If YYTABLE_NINF, syntax error. */
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002256#define YYTABLE_NINF -215
Dan Gohmanf4423b12008-04-19 00:24:39 +00002257static const yytype_int16 yytable[] =
2258{
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002259 11, 82, 168, 276, 13, 358, 105, 288, 377, 379,
2260 287, 91, 287, 322, 531, 111, 169, 11, 523, 94,
2261 278, 13, 511, 512, 111, 535, 417, 111, 326, 327,
2262 328, 329, 330, 289, 318, 166, 490, 677, 336, 29,
2263 30, 31, 32, 33, 34, 35, 36, 319, 37, 457,
2264 531, 145, 109, 145, 492, 24, 462, 687, 111, 26,
2265 146, 111, 240, 111, 244, 111, -55, -55, -55, -55,
2266 532, 21, 457, 457, 25, 247, 137, 111, -146, 491,
2267 109, 463, 527, 111, 337, 277, 137, 22, 27, 248,
2268 249, 457, 154, 11, 362, 457, 364, 491, 359, 360,
2269 543, 457, 28, 154, 596, 84, 85, 363, 542, 365,
2270 119, 120, 89, 588, 461, 237, 238, 112, 90, 241,
2271 414, -67, 436, 437, 438, 245, 112, 439, 134, 112,
2272 58, 440, 441, 135, 354, 476, 478, 480, 1, 355,
2273 285, 3, 2, 5, 626, 4, 286, 630, 44, 282,
2274 434, 38, 39, 40, 637, 638, 170, 338, 339, 95,
2275 112, 570, 409, 112, 658, 112, 678, 112, 59, 419,
2276 106, -67, 279, 340, 320, 321, 282, 323, 643, 112,
2277 -146, 62, 416, -67, -146, 112, 629, 38, 39, 40,
2278 324, 282, 282, 282, 282, 282, 331, 332, 333, 334,
2279 335, 282, 403, 150, 151, 403, 403, 60, 403, 137,
2280 432, 682, 64, 65, 568, 541, 482, 91, 680, 681,
2281 154, 683, 684, 98, 1, 2, 457, 3, 4, 5,
2282 99, 458, 496, 457, 498, 499, 500, 46, 539, 47,
2283 100, 341, 342, 403, 694, 695, 250, 251, 252, 253,
2284 102, 403, 403, 403, 403, 403, 606, 86, 607, 87,
2285 103, 343, 344, 154, 345, 346, 104, 347, 348, 349,
2286 50, 51, 52, 1, 410, 53, 3, 116, 5, 117,
2287 450, 451, 452, 453, 454, 455, 456, 87, 575, 141,
2288 554, 411, 412, 413, 147, 464, 465, 466, 276, 593,
2289 436, 437, 438, 142, 580, 439, 562, 114, 115, 440,
2290 441, 154, 433, 282, 149, 436, 437, 438, 167, 639,
2291 439, 640, 645, 233, 440, 441, 644, 235, 640, 403,
2292 403, 403, 403, 403, 653, 236, 562, 239, 242, 403,
2293 290, 291, 292, 293, 294, 295, 296, 297, 298, 299,
2294 460, 243, 403, 403, 246, -56, -57, -60, -59, 470,
2295 514, 515, 516, 517, -58, 608, 254, 111, 611, 612,
2296 613, 525, 122, 123, 124, 125, 126, 127, 128, 282,
2297 277, 280, 287, 356, 357, 340, 366, 367, 368, 369,
2298 370, 371, 380, 372, 381, 282, 497, 282, 282, 282,
2299 405, 665, 420, 382, 383, 507, 669, 431, 385, 421,
2300 403, 435, 403, 422, 445, 403, 446, 423, 424, 513,
2301 425, 447, 448, 449, 473, 403, 403, 467, 481, 483,
2302 484, 495, 501, 576, 577, 578, 579, 502, 581, 504,
2303 505, 506, 583, 584, 510, 519, 520, 521, 522, 524,
2304 526, 460, 528, 341, 342, 529, 530, 536, 537, 406,
2305 407, 538, 408, 544, 403, 403, 659, 403, 403, 403,
2306 403, 545, 546, 343, 344, 403, 345, 346, 563, 347,
2307 348, 349, 547, 403, 569, 618, 619, 620, 621, 403,
2308 679, 552, 548, -214, 560, 549, 550, 418, 554, 555,
2309 557, 558, 559, 561, 585, 426, 427, 428, 429, 430,
2310 592, -69, 1, 2, 562, 3, 4, 5, 566, 567,
2311 600, 587, 571, 6, 7, 572, 573, 574, 282, 586,
2312 403, 282, 282, 282, 614, 589, 650, 594, 651, 652,
2313 600, 582, -213, 610, 622, 8, 595, 623, 491, 9,
2314 624, 625, 627, 10, 628, 633, 636, 403, 403, 634,
2315 -69, 1, 2, 635, 3, 4, 5, 641, 646, 647,
2316 648, 649, 6, 7, 301, 302, 655, 403, 657, 668,
2317 670, 671, 672, 485, 486, 487, 488, 489, 673, 674,
2318 -18, -19, 685, 494, 8, 686, 688, 691, 9, 697,
2319 692, 698, 10, 403, 403, 700, 508, 509, 403, 225,
2320 226, 403, 227, 654, 667, 352, 132, 403, 148, 631,
2321 403, 144, 45, 97, 361, 131, 616, 0, 518, 0,
2322 589, 64, 65, 0, 107, 67, 68, 69, 70, 71,
2323 72, 73, 0, 1, 2, 0, 3, 4, 5, 303,
2324 304, 305, 306, 307, 308, 309, 310, 311, 312, 313,
2325 314, 315, 316, 0, 551, 0, 553, 0, 0, 556,
2326 0, 0, 0, 0, 74, 0, 0, 0, 0, 564,
2327 565, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2328 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2329 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2330 0, 0, 0, 0, 0, 0, 0, 0, 597, 598,
2331 0, 602, 603, 604, 605, 0, 0, 0, 0, 609,
2332 0, 0, 0, 0, 0, 0, 0, 615, 0, 0,
2333 0, 0, 0, 617, 0, 0, 0, 0, 0, 0,
2334 0, 0, 0, 0, 0, 0, 0, 0, 0, 386,
2335 387, 388, 389, 64, 65, 390, 0, 0, 0, 0,
2336 0, 0, 0, 0, 0, 1, 2, 0, 3, 4,
2337 5, 391, 392, 393, 642, 0, 75, 76, 0, 0,
2338 77, 0, 78, 108, 0, 0, 394, 395, 0, 0,
2339 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2340 340, 663, 664, 64, 65, 396, 107, 67, 68, 69,
2341 70, 71, 72, 73, 0, 1, 2, 0, 3, 4,
2342 5, 676, 181, 182, 183, 184, 185, 186, 187, 188,
2343 189, 190, 191, 192, 193, 194, 195, 258, 259, 260,
2344 261, 0, 0, 0, 0, 0, 74, 689, 690, 0,
2345 0, 0, 693, 0, 0, 696, 0, 0, 0, 0,
2346 0, 699, 0, 0, 701, 0, 262, 204, 661, 662,
2347 207, 208, 209, 210, 211, 212, 213, 214, 215, 0,
2348 263, 0, 264, 265, 266, 0, 267, 268, 343, 344,
2349 0, 345, 346, 0, 347, 348, 349, 0, 0, 0,
2350 0, 386, 387, 388, 389, 64, 65, 390, 0, 397,
2351 0, 0, 398, 0, 399, 0, 400, 1, 2, 0,
2352 3, 4, 5, 391, 392, 393, 0, 0, 0, 0,
2353 0, 0, 0, 0, 0, 0, 0, 0, 394, 395,
2354 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2355 0, 0, 0, 111, 0, 0, 0, 396, 75, 76,
2356 0, 0, 77, 0, 78, 143, 0, 0, 0, 0,
2357 0, 0, 0, 0, 181, 182, 183, 184, 185, 186,
2358 187, 188, 189, 190, 191, 192, 193, 194, 195, 258,
2359 259, 260, 261, 0, 0, 0, 0, 0, 0, 0,
2360 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2361 0, 0, 0, 0, 0, 0, 0, 0, 262, 204,
Chris Lattner1913b942008-07-11 00:30:39 +00002362 205, 206, 207, 208, 209, 210, 211, 212, 213, 214,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002363 215, 0, 263, 0, 264, 265, 266, 0, 267, 268,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002364 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002365 0, 0, 0, 0, 0, 112, 0, 0, 0, 0,
2366 0, 397, 0, 0, 398, 0, 399, 0, 400, 386,
2367 387, 388, 389, 64, 65, 390, 0, 0, 0, 0,
2368 0, 0, 0, 0, 0, 1, 2, 0, 3, 4,
2369 5, 391, 392, 393, 0, 0, 0, 0, 0, 0,
2370 0, 0, 0, 0, 0, 0, 394, 395, 0, 0,
Chris Lattner1913b942008-07-11 00:30:39 +00002371 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002372 0, 0, 0, 64, 65, 396, 107, 157, 158, 159,
2373 160, 161, 162, 73, 0, 1, 2, 0, 3, 4,
2374 5, 0, 181, 182, 183, 184, 185, 186, 187, 188,
2375 189, 190, 191, 192, 193, 194, 195, 258, 259, 260,
2376 261, 0, 0, 0, 0, 0, 74, 64, 65, 0,
2377 107, 157, 158, 159, 160, 161, 162, 73, 0, 1,
2378 2, 0, 3, 4, 5, 0, 262, 204, 205, 206,
2379 207, 208, 209, 210, 211, 212, 213, 214, 215, 0,
2380 263, 0, 264, 265, 266, 0, 267, 268, 0, 0,
2381 74, 0, 0, 0, 0, 386, 387, 388, 389, 0,
2382 0, 390, 0, 0, 0, 0, 0, 0, 0, 397,
2383 0, 0, 398, 0, 399, 0, 400, 391, 392, 393,
2384 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2385 0, 0, 394, 395, 0, 0, 0, 0, 0, 0,
2386 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2387 0, 396, 0, 0, 0, 0, 0, 0, 75, 76,
2388 0, 0, 77, 0, 78, 378, 0, 0, 181, 182,
Chris Lattner1913b942008-07-11 00:30:39 +00002389 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002390 193, 194, 195, 258, 259, 260, 261, 0, 0, 0,
Chris Lattner1913b942008-07-11 00:30:39 +00002391 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002392 0, 0, 75, 76, 0, 0, 77, 0, 78, 459,
2393 0, 0, 262, 204, 205, 206, 207, 208, 209, 210,
2394 211, 212, 213, 214, 215, 0, 263, 0, 264, 265,
2395 266, 0, 267, 268, 64, 65, 0, 0, 0, 0,
2396 0, 0, 0, 0, 0, 0, 1, 2, 0, 3,
2397 4, 5, 255, 0, 0, 397, 0, 0, 398, 0,
2398 399, 0, 400, 0, 0, 0, 0, 256, 257, 0,
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002399 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002400 64, 65, 111, 107, 157, 158, 159, 160, 161, 162,
2401 73, 0, 1, 2, 0, 3, 4, 5, 0, 0,
2402 0, 0, 0, 181, 182, 183, 184, 185, 186, 187,
2403 188, 189, 190, 191, 192, 193, 194, 195, 258, 259,
2404 260, 261, 0, 74, 0, 0, 64, 65, 0, 107,
2405 157, 158, 159, 160, 161, 162, 73, 0, 1, 2,
2406 0, 3, 4, 5, 0, 0, 0, 262, 204, 205,
2407 206, 207, 208, 209, 210, 211, 212, 213, 214, 215,
2408 0, 263, 0, 264, 265, 266, 0, 267, 268, 74,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002409 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002410 0, 0, 0, 0, 112, 0, 64, 65, -67, 0,
2411 269, 0, 0, 270, 0, 271, 0, 272, 1, 2,
2412 0, 3, 4, 5, 255, 0, 0, 0, 0, 0,
2413 0, 0, 0, 0, 0, 0, 0, 0, 0, 256,
2414 257, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2415 0, 0, 0, 0, 111, 75, 76, 0, 0, 77,
2416 0, 78, 479, 0, 0, 0, 0, 0, 0, 0,
2417 0, 0, 0, 0, 0, 181, 182, 183, 184, 185,
2418 186, 187, 188, 189, 190, 191, 192, 193, 194, 195,
2419 258, 259, 260, 261, 0, 0, 0, 0, 0, 0,
2420 0, 75, 76, 0, 0, 77, 0, 78, 540, 0,
2421 0, 0, 0, 0, 0, 0, 0, 0, 0, 262,
2422 204, 205, 206, 207, 208, 209, 210, 211, 212, 213,
2423 214, 215, 0, 263, 0, 264, 265, 266, 0, 267,
2424 268, 0, 64, 65, 0, 107, 67, 68, 69, 70,
2425 71, 72, 73, 0, 1, 2, 112, 3, 4, 5,
2426 0, 0, 269, 0, 0, 270, 0, 271, 0, 272,
2427 0, 0, 0, 0, 136, 0, 0, 0, 0, 0,
2428 0, 0, 0, 64, 65, 74, 152, 67, 68, 69,
2429 70, 71, 72, 73, 0, 1, 2, 0, 3, 4,
2430 5, 64, 65, 0, 107, 67, 68, 69, 70, 71,
2431 72, 73, 0, 1, 2, 0, 3, 4, 5, 0,
2432 0, 0, 0, 0, 0, 0, 74, 0, 0, 0,
2433 0, 0, 0, 351, 0, 0, 0, 0, 0, 0,
2434 0, 0, 64, 65, 74, 107, 157, 158, 159, 160,
2435 161, 162, 73, 0, 1, 2, 0, 3, 4, 5,
2436 0, 64, 65, 0, 107, 67, 68, 69, 70, 71,
2437 72, 73, 0, 1, 2, 0, 3, 4, 5, 0,
2438 0, 0, 0, 0, 0, 74, 0, 0, 0, 0,
2439 0, 0, 0, 469, 0, 0, 0, 75, 76, 0,
2440 0, 77, 153, 78, 74, 64, 65, 0, 107, 157,
2441 158, 159, 160, 161, 162, 73, 0, 1, 2, 0,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002442 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002443 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002444 0, 0, 77, 0, 78, 0, 0, 0, 74, 0,
2445 0, 0, 0, 0, 0, 0, 75, 76, 0, 0,
2446 77, 0, 78, 64, 65, 0, 107, 67, 68, 69,
2447 70, 71, 72, 73, 0, 1, 2, 0, 3, 4,
2448 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2449 0, 0, 0, 0, 0, 591, 0, 75, 76, 0,
2450 373, 77, 0, 78, 0, 0, 74, 0, 0, 0,
2451 0, 0, 0, 0, 0, 0, 75, 76, 0, 0,
2452 77, 0, 78, 0, 64, 65, 0, 66, 67, 68,
2453 69, 70, 71, 72, 73, 0, 1, 2, 0, 3,
2454 4, 5, 64, 65, 0, 107, 157, 158, 159, 160,
2455 161, 162, 73, 0, 1, 2, 0, 3, 4, 5,
2456 75, 76, 0, 475, 77, 0, 78, 74, 0, 0,
2457 0, 64, 65, 0, 152, 67, 68, 69, 70, 71,
2458 72, 73, 0, 1, 2, 74, 3, 4, 5, 64,
2459 65, 0, 107, 67, 68, 69, 70, 71, 72, 73,
2460 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
2461 0, 0, 0, 0, 74, 0, 0, 0, 75, 76,
2462 0, 0, 77, 0, 78, 0, 0, 0, 0, 0,
2463 64, 65, 74, 281, 67, 68, 69, 70, 71, 72,
2464 73, 0, 1, 2, 0, 3, 4, 5, 64, 65,
2465 0, 107, 157, 158, 159, 160, 161, 162, 73, 0,
Chris Lattner1913b942008-07-11 00:30:39 +00002466 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002467 0, 0, 0, 74, 0, 0, 0, 0, 0, 75,
Chris Lattner1913b942008-07-11 00:30:39 +00002468 76, 0, 0, 77, 0, 78, 0, 0, 0, 0,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002469 0, 74, 0, 0, 0, 0, 0, 75, 76, 0,
2470 0, 77, 0, 78, 64, 65, 0, 107, 157, 158,
2471 159, 160, 161, 162, 73, 0, 1, 2, 0, 3,
2472 4, 5, 0, 0, 0, 0, 75, 76, 0, 0,
2473 77, 0, 78, 0, 0, 0, 0, 0, 0, 0,
2474 0, 0, 0, 0, 75, 76, 0, 74, 77, 0,
2475 78, 64, 65, 0, 107, 67, 68, 69, 70, 71,
2476 72, 599, 0, 1, 2, 0, 3, 4, 5, 0,
Chris Lattner1913b942008-07-11 00:30:39 +00002477 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002478 0, 0, 0, 0, 0, 75, 76, 0, 0, 77,
2479 0, 78, 0, 0, 74, 0, 0, 0, 0, 0,
2480 0, 0, 0, 75, 76, 0, 0, 77, 0, 376,
2481 64, 65, 0, 107, 67, 68, 69, 70, 71, 72,
2482 666, 0, 1, 2, 0, 3, 4, 5, 0, 0,
2483 0, 0, 0, 0, 172, 0, 0, 0, 0, 0,
2484 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2485 0, 0, 0, 74, 0, 173, 174, 0, 0, 75,
2486 76, 0, 0, 77, 0, 477, 0, 0, 175, 176,
2487 177, 178, 179, 180, 181, 182, 183, 184, 185, 186,
2488 187, 188, 189, 190, 191, 192, 193, 194, 195, 196,
2489 197, 198, 199, 0, 0, 0, 0, 0, 0, 0,
2490 0, 0, 0, 0, 0, 0, 75, 76, 0, 0,
2491 77, 0, 78, 200, 201, 202, 0, 0, 203, 204,
2492 205, 206, 207, 208, 209, 210, 211, 212, 213, 214,
2493 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
2494 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2495 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2496 0, 0, 0, 0, 0, 75, 76, 0, 0, 77,
2497 0, 78
Dan Gohmanf4423b12008-04-19 00:24:39 +00002498};
2499
2500static const yytype_int16 yycheck[] =
2501{
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002502 0, 27, 129, 165, 0, 243, 4, 177, 270, 271,
2503 11, 21, 11, 202, 34, 55, 28, 17, 455, 29,
2504 166, 17, 443, 444, 55, 470, 321, 55, 217, 218,
2505 219, 220, 221, 178, 198, 121, 11, 659, 227, 42,
2506 43, 44, 45, 46, 47, 48, 49, 199, 51, 160,
2507 34, 160, 78, 160, 11, 159, 167, 679, 55, 159,
2508 169, 55, 169, 55, 150, 55, 3, 4, 5, 6,
2509 54, 53, 160, 160, 59, 155, 102, 55, 55, 54,
2510 106, 169, 169, 55, 229, 165, 112, 69, 18, 26,
2511 27, 160, 118, 93, 258, 160, 260, 54, 244, 245,
2512 169, 160, 159, 129, 169, 41, 42, 259, 167, 261,
2513 32, 33, 48, 534, 376, 141, 142, 157, 54, 145,
2514 160, 161, 142, 143, 144, 151, 157, 147, 160, 157,
2515 159, 151, 152, 165, 165, 397, 398, 399, 19, 167,
2516 11, 22, 20, 24, 581, 23, 17, 592, 0, 175,
2517 339, 154, 155, 156, 599, 600, 168, 118, 119, 169,
2518 157, 158, 289, 157, 165, 157, 165, 157, 159, 163,
2519 168, 161, 168, 54, 200, 201, 202, 203, 615, 157,
2520 157, 22, 160, 161, 161, 157, 158, 154, 155, 156,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002521 216, 217, 218, 219, 220, 221, 222, 223, 224, 225,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002522 226, 227, 282, 114, 115, 285, 286, 163, 288, 235,
2523 337, 38, 7, 8, 509, 477, 405, 21, 663, 664,
2524 246, 666, 667, 22, 19, 20, 160, 22, 23, 24,
2525 22, 165, 421, 160, 423, 424, 425, 46, 165, 48,
2526 22, 122, 123, 323, 689, 690, 3, 4, 5, 6,
2527 157, 331, 332, 333, 334, 335, 551, 35, 553, 37,
2528 4, 142, 143, 289, 145, 146, 4, 148, 149, 150,
2529 42, 43, 44, 19, 300, 47, 22, 42, 24, 44,
2530 366, 367, 368, 369, 370, 371, 372, 37, 158, 164,
2531 160, 317, 318, 319, 157, 381, 382, 383, 460, 537,
2532 142, 143, 144, 164, 158, 147, 160, 84, 85, 151,
2533 152, 337, 338, 339, 161, 142, 143, 144, 4, 158,
2534 147, 160, 617, 22, 151, 152, 158, 160, 160, 409,
2535 410, 411, 412, 413, 158, 158, 160, 167, 4, 419,
2536 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
2537 376, 158, 432, 433, 157, 9, 9, 9, 9, 385,
2538 446, 447, 448, 449, 9, 554, 9, 55, 557, 558,
2539 559, 457, 62, 63, 64, 65, 66, 67, 68, 405,
2540 460, 57, 11, 167, 158, 54, 157, 157, 157, 157,
2541 157, 157, 22, 157, 157, 421, 422, 423, 424, 425,
2542 160, 639, 160, 157, 157, 431, 644, 38, 157, 160,
2543 490, 4, 492, 160, 38, 495, 157, 160, 160, 445,
2544 160, 157, 157, 157, 61, 505, 506, 160, 22, 160,
2545 160, 163, 160, 519, 520, 521, 522, 160, 524, 160,
2546 160, 160, 528, 529, 160, 160, 160, 160, 160, 160,
2547 167, 477, 160, 122, 123, 160, 38, 160, 158, 285,
2548 286, 22, 288, 17, 544, 545, 636, 547, 548, 549,
2549 550, 17, 157, 142, 143, 555, 145, 146, 504, 148,
2550 149, 150, 160, 563, 510, 571, 572, 573, 574, 569,
2551 660, 4, 160, 0, 4, 160, 160, 323, 160, 160,
2552 160, 160, 160, 4, 530, 331, 332, 333, 334, 335,
2553 536, 18, 19, 20, 160, 22, 23, 24, 157, 160,
2554 546, 4, 160, 30, 31, 160, 160, 160, 554, 22,
2555 610, 557, 558, 559, 4, 535, 622, 160, 624, 625,
2556 566, 167, 0, 160, 160, 52, 167, 158, 54, 56,
2557 160, 160, 158, 60, 158, 22, 163, 637, 638, 167,
2558 18, 19, 20, 160, 22, 23, 24, 165, 158, 158,
2559 158, 158, 30, 31, 26, 27, 54, 657, 17, 165,
2560 158, 158, 158, 409, 410, 411, 412, 413, 4, 153,
2561 157, 157, 22, 419, 52, 160, 17, 17, 56, 17,
2562 160, 74, 60, 683, 684, 17, 432, 433, 688, 132,
2563 132, 691, 132, 630, 640, 235, 93, 697, 112, 593,
2564 700, 106, 17, 57, 246, 90, 566, -1, 450, -1,
2565 630, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2566 16, 17, -1, 19, 20, -1, 22, 23, 24, 101,
2567 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
2568 112, 113, 114, -1, 490, -1, 492, -1, -1, 495,
2569 -1, -1, -1, -1, 50, -1, -1, -1, -1, 505,
2570 506, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattner1913b942008-07-11 00:30:39 +00002571 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002572 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2573 -1, -1, -1, -1, -1, -1, -1, -1, 544, 545,
2574 -1, 547, 548, 549, 550, -1, -1, -1, -1, 555,
2575 -1, -1, -1, -1, -1, -1, -1, 563, -1, -1,
2576 -1, -1, -1, 569, -1, -1, -1, -1, -1, -1,
2577 -1, -1, -1, -1, -1, -1, -1, -1, -1, 3,
2578 4, 5, 6, 7, 8, 9, -1, -1, -1, -1,
2579 -1, -1, -1, -1, -1, 19, 20, -1, 22, 23,
2580 24, 25, 26, 27, 610, -1, 162, 163, -1, -1,
2581 166, -1, 168, 169, -1, -1, 40, 41, -1, -1,
2582 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2583 54, 637, 638, 7, 8, 59, 10, 11, 12, 13,
2584 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2585 24, 657, 76, 77, 78, 79, 80, 81, 82, 83,
2586 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
2587 94, -1, -1, -1, -1, -1, 50, 683, 684, -1,
2588 -1, -1, 688, -1, -1, 691, -1, -1, -1, -1,
2589 -1, 697, -1, -1, 700, -1, 120, 121, 122, 123,
2590 124, 125, 126, 127, 128, 129, 130, 131, 132, -1,
2591 134, -1, 136, 137, 138, -1, 140, 141, 142, 143,
2592 -1, 145, 146, -1, 148, 149, 150, -1, -1, -1,
2593 -1, 3, 4, 5, 6, 7, 8, 9, -1, 163,
2594 -1, -1, 166, -1, 168, -1, 170, 19, 20, -1,
2595 22, 23, 24, 25, 26, 27, -1, -1, -1, -1,
2596 -1, -1, -1, -1, -1, -1, -1, -1, 40, 41,
2597 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2598 -1, -1, -1, 55, -1, -1, -1, 59, 162, 163,
2599 -1, -1, 166, -1, 168, 169, -1, -1, -1, -1,
2600 -1, -1, -1, -1, 76, 77, 78, 79, 80, 81,
2601 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
2602 92, 93, 94, -1, -1, -1, -1, -1, -1, -1,
2603 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2604 -1, -1, -1, -1, -1, -1, -1, -1, 120, 121,
2605 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
2606 132, -1, 134, -1, 136, 137, 138, -1, 140, 141,
2607 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2608 -1, -1, -1, -1, -1, 157, -1, -1, -1, -1,
2609 -1, 163, -1, -1, 166, -1, 168, -1, 170, 3,
2610 4, 5, 6, 7, 8, 9, -1, -1, -1, -1,
2611 -1, -1, -1, -1, -1, 19, 20, -1, 22, 23,
2612 24, 25, 26, 27, -1, -1, -1, -1, -1, -1,
2613 -1, -1, -1, -1, -1, -1, 40, 41, -1, -1,
2614 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2615 -1, -1, -1, 7, 8, 59, 10, 11, 12, 13,
2616 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2617 24, -1, 76, 77, 78, 79, 80, 81, 82, 83,
2618 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
2619 94, -1, -1, -1, -1, -1, 50, 7, 8, -1,
2620 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2621 20, -1, 22, 23, 24, -1, 120, 121, 122, 123,
2622 124, 125, 126, 127, 128, 129, 130, 131, 132, -1,
2623 134, -1, 136, 137, 138, -1, 140, 141, -1, -1,
2624 50, -1, -1, -1, -1, 3, 4, 5, 6, -1,
2625 -1, 9, -1, -1, -1, -1, -1, -1, -1, 163,
2626 -1, -1, 166, -1, 168, -1, 170, 25, 26, 27,
Chris Lattner1913b942008-07-11 00:30:39 +00002627 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2628 -1, -1, 40, 41, -1, -1, -1, -1, -1, -1,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002629 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2630 -1, 59, -1, -1, -1, -1, -1, -1, 162, 163,
2631 -1, -1, 166, -1, 168, 169, -1, -1, 76, 77,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002632 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002633 88, 89, 90, 91, 92, 93, 94, -1, -1, -1,
Chris Lattner1913b942008-07-11 00:30:39 +00002634 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002635 -1, -1, 162, 163, -1, -1, 166, -1, 168, 169,
2636 -1, -1, 120, 121, 122, 123, 124, 125, 126, 127,
2637 128, 129, 130, 131, 132, -1, 134, -1, 136, 137,
2638 138, -1, 140, 141, 7, 8, -1, -1, -1, -1,
2639 -1, -1, -1, -1, -1, -1, 19, 20, -1, 22,
2640 23, 24, 25, -1, -1, 163, -1, -1, 166, -1,
2641 168, -1, 170, -1, -1, -1, -1, 40, 41, -1,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002642 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002643 7, 8, 55, 10, 11, 12, 13, 14, 15, 16,
2644 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
2645 -1, -1, -1, 76, 77, 78, 79, 80, 81, 82,
2646 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
2647 93, 94, -1, 50, -1, -1, 7, 8, -1, 10,
Chris Lattner1913b942008-07-11 00:30:39 +00002648 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002649 -1, 22, 23, 24, -1, -1, -1, 120, 121, 122,
2650 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
2651 -1, 134, -1, 136, 137, 138, -1, 140, 141, 50,
2652 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2653 -1, -1, -1, -1, 157, -1, 7, 8, 161, -1,
2654 163, -1, -1, 166, -1, 168, -1, 170, 19, 20,
2655 -1, 22, 23, 24, 25, -1, -1, -1, -1, -1,
2656 -1, -1, -1, -1, -1, -1, -1, -1, -1, 40,
2657 41, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2658 -1, -1, -1, -1, 55, 162, 163, -1, -1, 166,
2659 -1, 168, 169, -1, -1, -1, -1, -1, -1, -1,
2660 -1, -1, -1, -1, -1, 76, 77, 78, 79, 80,
2661 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2662 91, 92, 93, 94, -1, -1, -1, -1, -1, -1,
2663 -1, 162, 163, -1, -1, 166, -1, 168, 169, -1,
2664 -1, -1, -1, -1, -1, -1, -1, -1, -1, 120,
2665 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
2666 131, 132, -1, 134, -1, 136, 137, 138, -1, 140,
2667 141, -1, 7, 8, -1, 10, 11, 12, 13, 14,
2668 15, 16, 17, -1, 19, 20, 157, 22, 23, 24,
2669 -1, -1, 163, -1, -1, 166, -1, 168, -1, 170,
2670 -1, -1, -1, -1, 39, -1, -1, -1, -1, -1,
2671 -1, -1, -1, 7, 8, 50, 10, 11, 12, 13,
2672 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2673 24, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2674 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2675 -1, -1, -1, -1, -1, -1, 50, -1, -1, -1,
2676 -1, -1, -1, 39, -1, -1, -1, -1, -1, -1,
2677 -1, -1, 7, 8, 50, 10, 11, 12, 13, 14,
2678 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2679 -1, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2680 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2681 -1, -1, -1, -1, -1, 50, -1, -1, -1, -1,
2682 -1, -1, -1, 39, -1, -1, -1, 162, 163, -1,
2683 -1, 166, 126, 168, 50, 7, 8, -1, 10, 11,
2684 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002685 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002686 -1, -1, -1, -1, -1, -1, -1, -1, 162, 163,
2687 -1, -1, 166, -1, 168, -1, -1, -1, 50, -1,
2688 -1, -1, -1, -1, -1, -1, 162, 163, -1, -1,
2689 166, -1, 168, 7, 8, -1, 10, 11, 12, 13,
2690 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2691 24, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2692 -1, -1, -1, -1, -1, 39, -1, 162, 163, -1,
2693 165, 166, -1, 168, -1, -1, 50, -1, -1, -1,
2694 -1, -1, -1, -1, -1, -1, 162, 163, -1, -1,
2695 166, -1, 168, -1, 7, 8, -1, 10, 11, 12,
2696 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2697 23, 24, 7, 8, -1, 10, 11, 12, 13, 14,
Chris Lattner1913b942008-07-11 00:30:39 +00002698 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002699 162, 163, -1, 165, 166, -1, 168, 50, -1, -1,
2700 -1, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2701 16, 17, -1, 19, 20, 50, 22, 23, 24, 7,
2702 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2703 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
2704 -1, -1, -1, -1, 50, -1, -1, -1, 162, 163,
2705 -1, -1, 166, -1, 168, -1, -1, -1, -1, -1,
2706 7, 8, 50, 10, 11, 12, 13, 14, 15, 16,
2707 17, -1, 19, 20, -1, 22, 23, 24, 7, 8,
Chris Lattner1913b942008-07-11 00:30:39 +00002708 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2709 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002710 -1, -1, -1, 50, -1, -1, -1, -1, -1, 162,
2711 163, -1, -1, 166, -1, 168, -1, -1, -1, -1,
2712 -1, 50, -1, -1, -1, -1, -1, 162, 163, -1,
2713 -1, 166, -1, 168, 7, 8, -1, 10, 11, 12,
2714 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2715 23, 24, -1, -1, -1, -1, 162, 163, -1, -1,
2716 166, -1, 168, -1, -1, -1, -1, -1, -1, -1,
2717 -1, -1, -1, -1, 162, 163, -1, 50, 166, -1,
2718 168, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2719 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2720 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2721 -1, -1, -1, -1, -1, 162, 163, -1, -1, 166,
2722 -1, 168, -1, -1, 50, -1, -1, -1, -1, -1,
2723 -1, -1, -1, 162, 163, -1, -1, 166, -1, 168,
Chris Lattner1913b942008-07-11 00:30:39 +00002724 7, 8, -1, 10, 11, 12, 13, 14, 15, 16,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002725 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
2726 -1, -1, -1, -1, 36, -1, -1, -1, -1, -1,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002727 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002728 -1, -1, -1, 50, -1, 57, 58, -1, -1, 162,
2729 163, -1, -1, 166, -1, 168, -1, -1, 70, 71,
2730 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
2731 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
2732 92, 93, 94, -1, -1, -1, -1, -1, -1, -1,
2733 -1, -1, -1, -1, -1, -1, 162, 163, -1, -1,
2734 166, -1, 168, 115, 116, 117, -1, -1, 120, 121,
2735 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
2736 132, 133, 134, 135, 136, 137, 138, 139, 140, 141,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002737 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2738 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002739 -1, -1, -1, -1, -1, 162, 163, -1, -1, 166,
2740 -1, 168
Dan Gohmanf4423b12008-04-19 00:24:39 +00002741};
2742
2743/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2744 symbol of state STATE-NUM. */
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002745static const yytype_uint16 yystos[] =
Dan Gohmanf4423b12008-04-19 00:24:39 +00002746{
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002747 0, 19, 20, 22, 23, 24, 30, 31, 52, 56,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002748 60, 179, 182, 183, 184, 185, 217, 218, 219, 221,
2749 220, 53, 69, 226, 159, 59, 159, 18, 159, 42,
2750 43, 44, 45, 46, 47, 48, 49, 51, 154, 155,
2751 156, 186, 187, 188, 0, 219, 46, 48, 189, 236,
2752 42, 43, 44, 47, 190, 233, 235, 243, 159, 159,
2753 163, 227, 22, 225, 7, 8, 10, 11, 12, 13,
2754 14, 15, 16, 17, 50, 162, 163, 166, 168, 179,
2755 183, 204, 205, 239, 188, 188, 35, 37, 215, 188,
2756 188, 21, 244, 245, 29, 169, 234, 244, 22, 22,
2757 22, 228, 157, 4, 4, 4, 168, 10, 169, 205,
2758 210, 55, 157, 181, 215, 215, 42, 44, 191, 32,
2759 33, 214, 62, 63, 64, 65, 66, 67, 68, 192,
2760 231, 231, 182, 248, 160, 165, 39, 205, 206, 208,
2761 209, 164, 164, 169, 210, 160, 169, 157, 209, 161,
2762 214, 214, 10, 126, 205, 207, 216, 11, 12, 13,
2763 14, 15, 16, 177, 178, 205, 211, 4, 207, 28,
2764 168, 232, 36, 57, 58, 70, 71, 72, 73, 74,
Chris Lattnercc81d152008-05-04 17:18:47 +00002765 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002766 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
2767 115, 116, 117, 120, 121, 122, 123, 124, 125, 126,
Nate Begemanac80ade2008-05-12 19:01:56 +00002768 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002769 137, 138, 139, 140, 141, 172, 173, 174, 246, 253,
2770 254, 255, 256, 22, 194, 160, 158, 205, 205, 167,
2771 169, 205, 4, 158, 211, 205, 157, 239, 26, 27,
2772 3, 4, 5, 6, 9, 25, 40, 41, 91, 92,
2773 93, 94, 120, 134, 136, 137, 138, 140, 141, 163,
2774 166, 168, 170, 172, 173, 174, 212, 239, 181, 183,
2775 57, 10, 205, 241, 242, 11, 17, 11, 177, 192,
2776 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
2777 175, 26, 27, 101, 102, 103, 104, 105, 106, 107,
2778 108, 109, 110, 111, 112, 113, 114, 176, 175, 176,
2779 205, 205, 241, 205, 205, 249, 241, 241, 241, 241,
2780 241, 205, 205, 205, 205, 205, 241, 192, 118, 119,
2781 54, 122, 123, 142, 143, 145, 146, 148, 149, 150,
2782 193, 39, 206, 196, 165, 167, 167, 158, 196, 181,
2783 181, 216, 175, 176, 175, 176, 157, 157, 157, 157,
2784 157, 157, 157, 165, 211, 213, 168, 213, 169, 213,
2785 22, 157, 157, 157, 222, 157, 3, 4, 5, 6,
2786 9, 25, 26, 27, 40, 41, 59, 163, 166, 168,
2787 170, 212, 238, 239, 240, 160, 240, 240, 240, 207,
2788 205, 205, 205, 205, 160, 199, 160, 199, 240, 163,
2789 160, 160, 160, 160, 160, 160, 240, 240, 240, 240,
2790 240, 38, 207, 205, 241, 4, 142, 143, 144, 147,
2791 151, 152, 195, 223, 224, 38, 157, 157, 157, 157,
2792 211, 211, 211, 211, 211, 211, 211, 160, 165, 169,
2793 205, 213, 167, 169, 211, 211, 211, 160, 202, 39,
2794 205, 229, 230, 61, 237, 165, 213, 168, 213, 169,
2795 213, 22, 241, 160, 160, 240, 240, 240, 240, 240,
2796 11, 54, 11, 251, 240, 163, 241, 205, 241, 241,
2797 241, 160, 160, 252, 160, 160, 160, 205, 240, 240,
2798 160, 202, 202, 205, 211, 211, 211, 211, 251, 160,
2799 160, 160, 160, 252, 160, 211, 167, 169, 160, 160,
2800 38, 34, 54, 200, 203, 194, 160, 158, 22, 165,
2801 169, 213, 167, 169, 17, 17, 157, 160, 160, 160,
2802 160, 240, 4, 240, 160, 160, 240, 160, 160, 160,
2803 4, 4, 160, 205, 240, 240, 157, 160, 199, 205,
2804 158, 160, 160, 160, 160, 158, 211, 211, 211, 211,
2805 158, 211, 167, 211, 211, 205, 22, 4, 202, 179,
2806 180, 39, 205, 196, 160, 167, 169, 240, 240, 17,
2807 205, 250, 240, 240, 240, 240, 199, 199, 241, 240,
2808 160, 241, 241, 241, 4, 240, 250, 240, 211, 211,
2809 211, 211, 160, 158, 160, 160, 252, 158, 158, 158,
2810 194, 200, 201, 22, 167, 160, 163, 194, 194, 158,
2811 160, 165, 240, 252, 158, 199, 158, 158, 158, 158,
2812 211, 211, 211, 158, 180, 54, 198, 17, 165, 177,
2813 247, 122, 123, 240, 240, 196, 17, 205, 165, 196,
2814 158, 158, 158, 4, 153, 197, 240, 238, 165, 177,
2815 194, 194, 38, 194, 194, 22, 160, 238, 17, 240,
2816 240, 17, 160, 240, 194, 194, 240, 17, 74, 240,
2817 17, 240
Dan Gohmanf4423b12008-04-19 00:24:39 +00002818};
David Greene718fda32007-08-01 03:59:32 +00002819
Reid Spencer68a24bd2005-08-27 18:50:39 +00002820#define yyerrok (yyerrstatus = 0)
2821#define yyclearin (yychar = YYEMPTY)
Dan Gohmanf4423b12008-04-19 00:24:39 +00002822#define YYEMPTY (-2)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002823#define YYEOF 0
Dan Gohmanf4423b12008-04-19 00:24:39 +00002824
Reid Spencer68a24bd2005-08-27 18:50:39 +00002825#define YYACCEPT goto yyacceptlab
Dan Gohmanf4423b12008-04-19 00:24:39 +00002826#define YYABORT goto yyabortlab
2827#define YYERROR goto yyerrorlab
2828
2829
2830/* Like YYERROR except do call yyerror. This remains here temporarily
2831 to ease the transition to the new meaning of YYERROR, for GCC.
Reid Spencer68a24bd2005-08-27 18:50:39 +00002832 Once GCC version 2 has supplanted version 1, this can go. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00002833
Reid Spencer68a24bd2005-08-27 18:50:39 +00002834#define YYFAIL goto yyerrlab
Dan Gohmanf4423b12008-04-19 00:24:39 +00002835
Reid Spencer68a24bd2005-08-27 18:50:39 +00002836#define YYRECOVERING() (!!yyerrstatus)
Dan Gohmanf4423b12008-04-19 00:24:39 +00002837
2838#define YYBACKUP(Token, Value) \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002839do \
2840 if (yychar == YYEMPTY && yylen == 1) \
Dan Gohmanf4423b12008-04-19 00:24:39 +00002841 { \
2842 yychar = (Token); \
2843 yylval = (Value); \
2844 yytoken = YYTRANSLATE (yychar); \
2845 YYPOPSTACK (1); \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002846 goto yybackup; \
2847 } \
2848 else \
Dan Gohmanf4423b12008-04-19 00:24:39 +00002849 { \
2850 yyerror (YY_("syntax error: cannot back up")); \
2851 YYERROR; \
2852 } \
2853while (YYID (0))
2854
Anton Korobeynikov38e09802007-04-28 13:48:45 +00002855
Reid Spencer68a24bd2005-08-27 18:50:39 +00002856#define YYTERROR 1
2857#define YYERRCODE 256
2858
Dan Gohmanf4423b12008-04-19 00:24:39 +00002859
2860/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2861 If N is 0, then set CURRENT to the empty location which ends
2862 the previous symbol: RHS[0] (always defined). */
2863
2864#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2865#ifndef YYLLOC_DEFAULT
2866# define YYLLOC_DEFAULT(Current, Rhs, N) \
2867 do \
2868 if (YYID (N)) \
2869 { \
2870 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2871 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2872 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2873 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2874 } \
2875 else \
2876 { \
2877 (Current).first_line = (Current).last_line = \
2878 YYRHSLOC (Rhs, 0).last_line; \
2879 (Current).first_column = (Current).last_column = \
2880 YYRHSLOC (Rhs, 0).last_column; \
2881 } \
2882 while (YYID (0))
Reid Spencer68a24bd2005-08-27 18:50:39 +00002883#endif
2884
Dan Gohmanf4423b12008-04-19 00:24:39 +00002885
2886/* YY_LOCATION_PRINT -- Print the location on the stream.
2887 This macro was not mandated originally: define only if we know
2888 we won't break user code: when these are the locations we know. */
2889
2890#ifndef YY_LOCATION_PRINT
Dan Gohman180c1692008-06-23 18:43:26 +00002891# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
Dan Gohmanf4423b12008-04-19 00:24:39 +00002892# define YY_LOCATION_PRINT(File, Loc) \
2893 fprintf (File, "%d.%d-%d.%d", \
2894 (Loc).first_line, (Loc).first_column, \
2895 (Loc).last_line, (Loc).last_column)
2896# else
2897# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2898# endif
2899#endif
2900
2901
2902/* YYLEX -- calling `yylex' with the right arguments. */
2903
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00002904#ifdef YYLEX_PARAM
Dan Gohmanf4423b12008-04-19 00:24:39 +00002905# define YYLEX yylex (YYLEX_PARAM)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00002906#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00002907# define YYLEX yylex ()
Gabor Greife64d2482008-04-06 23:07:54 +00002908#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002909
2910/* Enable debugging if requested. */
2911#if YYDEBUG
2912
2913# ifndef YYFPRINTF
2914# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2915# define YYFPRINTF fprintf
2916# endif
2917
2918# define YYDPRINTF(Args) \
2919do { \
2920 if (yydebug) \
2921 YYFPRINTF Args; \
2922} while (YYID (0))
2923
2924# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2925do { \
2926 if (yydebug) \
2927 { \
2928 YYFPRINTF (stderr, "%s ", Title); \
2929 yy_symbol_print (stderr, \
2930 Type, Value); \
2931 YYFPRINTF (stderr, "\n"); \
2932 } \
2933} while (YYID (0))
2934
2935
2936/*--------------------------------.
2937| Print this symbol on YYOUTPUT. |
2938`--------------------------------*/
2939
2940/*ARGSUSED*/
2941#if (defined __STDC__ || defined __C99__FUNC__ \
2942 || defined __cplusplus || defined _MSC_VER)
2943static void
2944yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
Gabor Greife64d2482008-04-06 23:07:54 +00002945#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00002946static void
2947yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2948 FILE *yyoutput;
2949 int yytype;
2950 YYSTYPE const * const yyvaluep;
Gabor Greife64d2482008-04-06 23:07:54 +00002951#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002952{
2953 if (!yyvaluep)
2954 return;
2955# ifdef YYPRINT
2956 if (yytype < YYNTOKENS)
2957 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2958# else
2959 YYUSE (yyoutput);
2960# endif
2961 switch (yytype)
2962 {
2963 default:
2964 break;
2965 }
2966}
2967
2968
2969/*--------------------------------.
2970| Print this symbol on YYOUTPUT. |
2971`--------------------------------*/
2972
2973#if (defined __STDC__ || defined __C99__FUNC__ \
2974 || defined __cplusplus || defined _MSC_VER)
2975static void
2976yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2977#else
2978static void
2979yy_symbol_print (yyoutput, yytype, yyvaluep)
2980 FILE *yyoutput;
2981 int yytype;
2982 YYSTYPE const * const yyvaluep;
Scott Michel15dcd8e2008-01-30 03:10:00 +00002983#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002984{
2985 if (yytype < YYNTOKENS)
2986 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2987 else
2988 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
Chris Lattner38905612008-02-19 04:36:25 +00002989
Dan Gohmanf4423b12008-04-19 00:24:39 +00002990 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2991 YYFPRINTF (yyoutput, ")");
2992}
Chris Lattner38905612008-02-19 04:36:25 +00002993
Dan Gohmanf4423b12008-04-19 00:24:39 +00002994/*------------------------------------------------------------------.
2995| yy_stack_print -- Print the state stack from its BOTTOM up to its |
2996| TOP (included). |
2997`------------------------------------------------------------------*/
Chris Lattner38905612008-02-19 04:36:25 +00002998
Dan Gohmanf4423b12008-04-19 00:24:39 +00002999#if (defined __STDC__ || defined __C99__FUNC__ \
3000 || defined __cplusplus || defined _MSC_VER)
3001static void
3002yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
3003#else
3004static void
3005yy_stack_print (bottom, top)
3006 yytype_int16 *bottom;
3007 yytype_int16 *top;
Scott Michel15dcd8e2008-01-30 03:10:00 +00003008#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003009{
3010 YYFPRINTF (stderr, "Stack now");
3011 for (; bottom <= top; ++bottom)
3012 YYFPRINTF (stderr, " %d", *bottom);
3013 YYFPRINTF (stderr, "\n");
3014}
Chris Lattner38905612008-02-19 04:36:25 +00003015
Dan Gohmanf4423b12008-04-19 00:24:39 +00003016# define YY_STACK_PRINT(Bottom, Top) \
3017do { \
3018 if (yydebug) \
3019 yy_stack_print ((Bottom), (Top)); \
3020} while (YYID (0))
Chris Lattner38905612008-02-19 04:36:25 +00003021
Dan Gohmanf4423b12008-04-19 00:24:39 +00003022
3023/*------------------------------------------------.
3024| Report that the YYRULE is going to be reduced. |
3025`------------------------------------------------*/
3026
3027#if (defined __STDC__ || defined __C99__FUNC__ \
3028 || defined __cplusplus || defined _MSC_VER)
3029static void
3030yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
3031#else
3032static void
3033yy_reduce_print (yyvsp, yyrule)
3034 YYSTYPE *yyvsp;
3035 int yyrule;
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00003036#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003037{
3038 int yynrhs = yyr2[yyrule];
3039 int yyi;
3040 unsigned long int yylno = yyrline[yyrule];
3041 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
3042 yyrule - 1, yylno);
3043 /* The symbols being reduced. */
3044 for (yyi = 0; yyi < yynrhs; yyi++)
3045 {
3046 fprintf (stderr, " $%d = ", yyi + 1);
3047 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
3048 &(yyvsp[(yyi + 1) - (yynrhs)])
3049 );
3050 fprintf (stderr, "\n");
3051 }
3052}
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003053
Dan Gohmanf4423b12008-04-19 00:24:39 +00003054# define YY_REDUCE_PRINT(Rule) \
3055do { \
3056 if (yydebug) \
3057 yy_reduce_print (yyvsp, Rule); \
3058} while (YYID (0))
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003059
Dan Gohmanf4423b12008-04-19 00:24:39 +00003060/* Nonzero means print parse trace. It is left uninitialized so that
3061 multiple parsers can coexist. */
3062int yydebug;
3063#else /* !YYDEBUG */
3064# define YYDPRINTF(Args)
3065# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
3066# define YY_STACK_PRINT(Bottom, Top)
3067# define YY_REDUCE_PRINT(Rule)
3068#endif /* !YYDEBUG */
3069
3070
3071/* YYINITDEPTH -- initial size of the parser's stacks. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003072#ifndef YYINITDEPTH
Dan Gohmanf4423b12008-04-19 00:24:39 +00003073# define YYINITDEPTH 200
Reid Spencer68a24bd2005-08-27 18:50:39 +00003074#endif
3075
Dan Gohmanf4423b12008-04-19 00:24:39 +00003076/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
3077 if the built-in stack extension method is used).
Reid Spencer68a24bd2005-08-27 18:50:39 +00003078
Dan Gohmanf4423b12008-04-19 00:24:39 +00003079 Do not make this value too large; the results are undefined if
3080 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
3081 evaluated with infinite-precision integer arithmetic. */
David Greene718fda32007-08-01 03:59:32 +00003082
Reid Spencer68a24bd2005-08-27 18:50:39 +00003083#ifndef YYMAXDEPTH
Dan Gohmanf4423b12008-04-19 00:24:39 +00003084# define YYMAXDEPTH 10000
Reid Spencer68a24bd2005-08-27 18:50:39 +00003085#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003086
Reid Spencer68a24bd2005-08-27 18:50:39 +00003087
3088
Dan Gohmanf4423b12008-04-19 00:24:39 +00003089#if YYERROR_VERBOSE
Reid Spencer68a24bd2005-08-27 18:50:39 +00003090
Dan Gohmanf4423b12008-04-19 00:24:39 +00003091# ifndef yystrlen
3092# if defined __GLIBC__ && defined _STRING_H
3093# define yystrlen strlen
3094# else
3095/* Return the length of YYSTR. */
3096#if (defined __STDC__ || defined __C99__FUNC__ \
3097 || defined __cplusplus || defined _MSC_VER)
3098static YYSIZE_T
3099yystrlen (const char *yystr)
Chris Lattner38905612008-02-19 04:36:25 +00003100#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00003101static YYSIZE_T
3102yystrlen (yystr)
3103 const char *yystr;
3104#endif
3105{
3106 YYSIZE_T yylen;
3107 for (yylen = 0; yystr[yylen]; yylen++)
3108 continue;
3109 return yylen;
3110}
3111# endif
3112# endif
3113
3114# ifndef yystpcpy
3115# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
3116# define yystpcpy stpcpy
3117# else
3118/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
3119 YYDEST. */
3120#if (defined __STDC__ || defined __C99__FUNC__ \
3121 || defined __cplusplus || defined _MSC_VER)
3122static char *
3123yystpcpy (char *yydest, const char *yysrc)
3124#else
3125static char *
3126yystpcpy (yydest, yysrc)
3127 char *yydest;
3128 const char *yysrc;
3129#endif
3130{
3131 char *yyd = yydest;
3132 const char *yys = yysrc;
3133
3134 while ((*yyd++ = *yys++) != '\0')
3135 continue;
3136
3137 return yyd - 1;
3138}
3139# endif
3140# endif
3141
3142# ifndef yytnamerr
3143/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3144 quotes and backslashes, so that it's suitable for yyerror. The
3145 heuristic is that double-quoting is unnecessary unless the string
3146 contains an apostrophe, a comma, or backslash (other than
3147 backslash-backslash). YYSTR is taken from yytname. If YYRES is
3148 null, do not copy; instead, return the length of what the result
3149 would have been. */
3150static YYSIZE_T
3151yytnamerr (char *yyres, const char *yystr)
3152{
3153 if (*yystr == '"')
3154 {
3155 YYSIZE_T yyn = 0;
3156 char const *yyp = yystr;
3157
3158 for (;;)
3159 switch (*++yyp)
3160 {
3161 case '\'':
3162 case ',':
3163 goto do_not_strip_quotes;
3164
3165 case '\\':
3166 if (*++yyp != '\\')
3167 goto do_not_strip_quotes;
3168 /* Fall through. */
3169 default:
3170 if (yyres)
3171 yyres[yyn] = *yyp;
3172 yyn++;
3173 break;
3174
3175 case '"':
3176 if (yyres)
3177 yyres[yyn] = '\0';
3178 return yyn;
3179 }
3180 do_not_strip_quotes: ;
3181 }
3182
3183 if (! yyres)
3184 return yystrlen (yystr);
3185
3186 return yystpcpy (yyres, yystr) - yyres;
3187}
3188# endif
3189
3190/* Copy into YYRESULT an error message about the unexpected token
3191 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3192 including the terminating null byte. If YYRESULT is null, do not
3193 copy anything; just return the number of bytes that would be
3194 copied. As a special case, return 0 if an ordinary "syntax error"
3195 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3196 size calculation. */
3197static YYSIZE_T
3198yysyntax_error (char *yyresult, int yystate, int yychar)
3199{
3200 int yyn = yypact[yystate];
3201
3202 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3203 return 0;
3204 else
3205 {
3206 int yytype = YYTRANSLATE (yychar);
3207 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3208 YYSIZE_T yysize = yysize0;
3209 YYSIZE_T yysize1;
3210 int yysize_overflow = 0;
3211 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3212 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3213 int yyx;
3214
3215# if 0
3216 /* This is so xgettext sees the translatable formats that are
3217 constructed on the fly. */
3218 YY_("syntax error, unexpected %s");
3219 YY_("syntax error, unexpected %s, expecting %s");
3220 YY_("syntax error, unexpected %s, expecting %s or %s");
3221 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3222 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3223# endif
3224 char *yyfmt;
3225 char const *yyf;
3226 static char const yyunexpected[] = "syntax error, unexpected %s";
3227 static char const yyexpecting[] = ", expecting %s";
3228 static char const yyor[] = " or %s";
3229 char yyformat[sizeof yyunexpected
3230 + sizeof yyexpecting - 1
3231 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3232 * (sizeof yyor - 1))];
3233 char const *yyprefix = yyexpecting;
3234
3235 /* Start YYX at -YYN if negative to avoid negative indexes in
3236 YYCHECK. */
3237 int yyxbegin = yyn < 0 ? -yyn : 0;
3238
3239 /* Stay within bounds of both yycheck and yytname. */
3240 int yychecklim = YYLAST - yyn + 1;
3241 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3242 int yycount = 1;
3243
3244 yyarg[0] = yytname[yytype];
3245 yyfmt = yystpcpy (yyformat, yyunexpected);
3246
3247 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3248 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3249 {
3250 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3251 {
3252 yycount = 1;
3253 yysize = yysize0;
3254 yyformat[sizeof yyunexpected - 1] = '\0';
3255 break;
3256 }
3257 yyarg[yycount++] = yytname[yyx];
3258 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3259 yysize_overflow |= (yysize1 < yysize);
3260 yysize = yysize1;
3261 yyfmt = yystpcpy (yyfmt, yyprefix);
3262 yyprefix = yyor;
3263 }
3264
3265 yyf = YY_(yyformat);
3266 yysize1 = yysize + yystrlen (yyf);
3267 yysize_overflow |= (yysize1 < yysize);
3268 yysize = yysize1;
3269
3270 if (yysize_overflow)
3271 return YYSIZE_MAXIMUM;
3272
3273 if (yyresult)
3274 {
3275 /* Avoid sprintf, as that infringes on the user's name space.
3276 Don't have undefined behavior even if the translation
3277 produced a string with the wrong number of "%s"s. */
3278 char *yyp = yyresult;
3279 int yyi = 0;
3280 while ((*yyp = *yyf) != '\0')
3281 {
3282 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3283 {
3284 yyp += yytnamerr (yyp, yyarg[yyi++]);
3285 yyf += 2;
3286 }
3287 else
3288 {
3289 yyp++;
3290 yyf++;
3291 }
3292 }
3293 }
3294 return yysize;
3295 }
3296}
3297#endif /* YYERROR_VERBOSE */
3298
3299
3300/*-----------------------------------------------.
3301| Release the memory associated to this symbol. |
3302`-----------------------------------------------*/
3303
3304/*ARGSUSED*/
3305#if (defined __STDC__ || defined __C99__FUNC__ \
3306 || defined __cplusplus || defined _MSC_VER)
3307static void
3308yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3309#else
3310static void
3311yydestruct (yymsg, yytype, yyvaluep)
3312 const char *yymsg;
3313 int yytype;
3314 YYSTYPE *yyvaluep;
3315#endif
3316{
3317 YYUSE (yyvaluep);
3318
3319 if (!yymsg)
3320 yymsg = "Deleting";
3321 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3322
3323 switch (yytype)
3324 {
3325
3326 default:
3327 break;
3328 }
3329}
3330
3331
3332/* Prevent warnings from -Wmissing-prototypes. */
3333
3334#ifdef YYPARSE_PARAM
3335#if defined __STDC__ || defined __cplusplus
3336int yyparse (void *YYPARSE_PARAM);
3337#else
3338int yyparse ();
3339#endif
3340#else /* ! YYPARSE_PARAM */
3341#if defined __STDC__ || defined __cplusplus
David Greene5fd22a82007-09-04 18:46:50 +00003342int yyparse (void);
Gabor Greife64d2482008-04-06 23:07:54 +00003343#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00003344int yyparse ();
Scott Michel15dcd8e2008-01-30 03:10:00 +00003345#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003346#endif /* ! YYPARSE_PARAM */
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003347
Chris Lattner38905612008-02-19 04:36:25 +00003348
Dan Gohmanf4423b12008-04-19 00:24:39 +00003349
3350/* The look-ahead symbol. */
3351int yychar;
3352
3353/* The semantic value of the look-ahead symbol. */
3354YYSTYPE yylval;
3355
3356/* Number of syntax errors so far. */
3357int yynerrs;
3358
3359
3360
3361/*----------.
3362| yyparse. |
3363`----------*/
3364
3365#ifdef YYPARSE_PARAM
3366#if (defined __STDC__ || defined __C99__FUNC__ \
3367 || defined __cplusplus || defined _MSC_VER)
3368int
3369yyparse (void *YYPARSE_PARAM)
3370#else
3371int
3372yyparse (YYPARSE_PARAM)
3373 void *YYPARSE_PARAM;
3374#endif
3375#else /* ! YYPARSE_PARAM */
3376#if (defined __STDC__ || defined __C99__FUNC__ \
3377 || defined __cplusplus || defined _MSC_VER)
3378int
3379yyparse (void)
3380#else
3381int
3382yyparse ()
3383
Gabor Greife64d2482008-04-06 23:07:54 +00003384#endif
3385#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003386{
3387
3388 int yystate;
3389 int yyn;
3390 int yyresult;
3391 /* Number of tokens to shift before error messages enabled. */
3392 int yyerrstatus;
3393 /* Look-ahead token as an internal (translated) token number. */
3394 int yytoken = 0;
3395#if YYERROR_VERBOSE
3396 /* Buffer for error messages, and its allocated size. */
3397 char yymsgbuf[128];
3398 char *yymsg = yymsgbuf;
3399 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
Gabor Greife64d2482008-04-06 23:07:54 +00003400#endif
Chris Lattner38905612008-02-19 04:36:25 +00003401
Dan Gohmanf4423b12008-04-19 00:24:39 +00003402 /* Three stacks and their tools:
3403 `yyss': related to states,
3404 `yyvs': related to semantic values,
3405 `yyls': related to locations.
3406
3407 Refer to the stacks thru separate pointers, to allow yyoverflow
3408 to reallocate them elsewhere. */
3409
3410 /* The state stack. */
3411 yytype_int16 yyssa[YYINITDEPTH];
3412 yytype_int16 *yyss = yyssa;
3413 yytype_int16 *yyssp;
3414
3415 /* The semantic value stack. */
3416 YYSTYPE yyvsa[YYINITDEPTH];
3417 YYSTYPE *yyvs = yyvsa;
3418 YYSTYPE *yyvsp;
3419
3420
3421
3422#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3423
3424 YYSIZE_T yystacksize = YYINITDEPTH;
3425
3426 /* The variables used to return semantic value and location from the
3427 action routines. */
3428 YYSTYPE yyval;
3429
3430
3431 /* The number of symbols on the RHS of the reduced rule.
3432 Keep to zero when no symbol should be popped. */
3433 int yylen = 0;
3434
3435 YYDPRINTF ((stderr, "Starting parse\n"));
3436
Reid Spencer68a24bd2005-08-27 18:50:39 +00003437 yystate = 0;
3438 yyerrstatus = 0;
3439 yynerrs = 0;
3440 yychar = YYEMPTY; /* Cause a token to be read. */
3441
3442 /* Initialize stack pointers.
3443 Waste one element of value and location stack
3444 so that they stay on the same level as the state stack.
3445 The wasted elements are never initialized. */
3446
Dan Gohmanf4423b12008-04-19 00:24:39 +00003447 yyssp = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003448 yyvsp = yyvs;
3449
Dan Gohmanf4423b12008-04-19 00:24:39 +00003450 goto yysetstate;
Jeff Cohen66c5fd62005-10-23 04:37:20 +00003451
Dan Gohmanf4423b12008-04-19 00:24:39 +00003452/*------------------------------------------------------------.
3453| yynewstate -- Push a new state, which is found in yystate. |
3454`------------------------------------------------------------*/
3455 yynewstate:
3456 /* In all cases, when you get here, the value and location stacks
3457 have just been pushed. So pushing a state here evens the stacks. */
3458 yyssp++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003459
Dan Gohmanf4423b12008-04-19 00:24:39 +00003460 yysetstate:
3461 *yyssp = yystate;
3462
3463 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003464 {
3465 /* Get the current used size of the three stacks, in elements. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003466 YYSIZE_T yysize = yyssp - yyss + 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003467
3468#ifdef yyoverflow
Dan Gohmanf4423b12008-04-19 00:24:39 +00003469 {
3470 /* Give user a chance to reallocate the stack. Use copies of
3471 these so that the &'s don't force the real ones into
3472 memory. */
3473 YYSTYPE *yyvs1 = yyvs;
3474 yytype_int16 *yyss1 = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003475
Dan Gohmanf4423b12008-04-19 00:24:39 +00003476
3477 /* Each stack pointer address is followed by the size of the
3478 data in use in that stack, in bytes. This used to be a
3479 conditional around just the two extra args, but that might
3480 be undefined if yyoverflow is a macro. */
3481 yyoverflow (YY_("memory exhausted"),
3482 &yyss1, yysize * sizeof (*yyssp),
3483 &yyvs1, yysize * sizeof (*yyvsp),
3484
3485 &yystacksize);
3486
3487 yyss = yyss1;
3488 yyvs = yyvs1;
3489 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00003490#else /* no yyoverflow */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003491# ifndef YYSTACK_RELOCATE
3492 goto yyexhaustedlab;
3493# else
Reid Spencer68a24bd2005-08-27 18:50:39 +00003494 /* Extend the stack our own way. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003495 if (YYMAXDEPTH <= yystacksize)
3496 goto yyexhaustedlab;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003497 yystacksize *= 2;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003498 if (YYMAXDEPTH < yystacksize)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003499 yystacksize = YYMAXDEPTH;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003500
3501 {
3502 yytype_int16 *yyss1 = yyss;
3503 union yyalloc *yyptr =
3504 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3505 if (! yyptr)
3506 goto yyexhaustedlab;
3507 YYSTACK_RELOCATE (yyss);
3508 YYSTACK_RELOCATE (yyvs);
3509
3510# undef YYSTACK_RELOCATE
3511 if (yyss1 != yyssa)
3512 YYSTACK_FREE (yyss1);
3513 }
3514# endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00003515#endif /* no yyoverflow */
3516
Dan Gohmanf4423b12008-04-19 00:24:39 +00003517 yyssp = yyss + yysize - 1;
3518 yyvsp = yyvs + yysize - 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003519
3520
Dan Gohmanf4423b12008-04-19 00:24:39 +00003521 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3522 (unsigned long int) yystacksize));
3523
3524 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003525 YYABORT;
3526 }
3527
Dan Gohmanf4423b12008-04-19 00:24:39 +00003528 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003529
3530 goto yybackup;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003531
Dan Gohmanf4423b12008-04-19 00:24:39 +00003532/*-----------.
3533| yybackup. |
3534`-----------*/
3535yybackup:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003536
Dan Gohmanf4423b12008-04-19 00:24:39 +00003537 /* Do appropriate processing given the current state. Read a
3538 look-ahead token if we need one and don't already have one. */
Reid Spencer7780acb2007-04-16 06:56:07 +00003539
Dan Gohmanf4423b12008-04-19 00:24:39 +00003540 /* First try to decide what to do without reference to look-ahead token. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003541 yyn = yypact[yystate];
Dan Gohmanf4423b12008-04-19 00:24:39 +00003542 if (yyn == YYPACT_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003543 goto yydefault;
3544
Dan Gohmanf4423b12008-04-19 00:24:39 +00003545 /* Not known => get a look-ahead token if don't already have one. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003546
Dan Gohmanf4423b12008-04-19 00:24:39 +00003547 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003548 if (yychar == YYEMPTY)
3549 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003550 YYDPRINTF ((stderr, "Reading a token: "));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003551 yychar = YYLEX;
3552 }
3553
Dan Gohmanf4423b12008-04-19 00:24:39 +00003554 if (yychar <= YYEOF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003555 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003556 yychar = yytoken = YYEOF;
3557 YYDPRINTF ((stderr, "Now at end of input.\n"));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003558 }
3559 else
3560 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003561 yytoken = YYTRANSLATE (yychar);
3562 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Reid Spencer68a24bd2005-08-27 18:50:39 +00003563 }
3564
Dan Gohmanf4423b12008-04-19 00:24:39 +00003565 /* If the proper action on seeing token YYTOKEN is to reduce or to
3566 detect an error, take that action. */
3567 yyn += yytoken;
3568 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003569 goto yydefault;
3570 yyn = yytable[yyn];
Dan Gohmanf4423b12008-04-19 00:24:39 +00003571 if (yyn <= 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003572 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003573 if (yyn == 0 || yyn == YYTABLE_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003574 goto yyerrlab;
3575 yyn = -yyn;
3576 goto yyreduce;
3577 }
3578
3579 if (yyn == YYFINAL)
3580 YYACCEPT;
3581
Dan Gohmanf4423b12008-04-19 00:24:39 +00003582 /* Count tokens shifted since error; after three, turn off error
3583 status. */
3584 if (yyerrstatus)
3585 yyerrstatus--;
Dale Johannesencdd509a2007-09-07 21:07:57 +00003586
Dan Gohmanf4423b12008-04-19 00:24:39 +00003587 /* Shift the look-ahead token. */
3588 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003589
Dan Gohmanf4423b12008-04-19 00:24:39 +00003590 /* Discard the shifted token unless it is eof. */
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003591 if (yychar != YYEOF)
3592 yychar = YYEMPTY;
3593
Gabor Greife64d2482008-04-06 23:07:54 +00003594 yystate = yyn;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003595 *++yyvsp = yylval;
3596
Reid Spencer68a24bd2005-08-27 18:50:39 +00003597 goto yynewstate;
3598
Gabor Greife64d2482008-04-06 23:07:54 +00003599
Dan Gohmanf4423b12008-04-19 00:24:39 +00003600/*-----------------------------------------------------------.
3601| yydefault -- do the default action for the current state. |
3602`-----------------------------------------------------------*/
3603yydefault:
Reid Spencer68a24bd2005-08-27 18:50:39 +00003604 yyn = yydefact[yystate];
3605 if (yyn == 0)
3606 goto yyerrlab;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003607 goto yyreduce;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003608
Dan Gohmanf4423b12008-04-19 00:24:39 +00003609
3610/*-----------------------------.
3611| yyreduce -- Do a reduction. |
3612`-----------------------------*/
Reid Spencer68a24bd2005-08-27 18:50:39 +00003613yyreduce:
Dan Gohmanf4423b12008-04-19 00:24:39 +00003614 /* yyn is the number of a rule to reduce with. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003615 yylen = yyr2[yyn];
3616
Dan Gohmanf4423b12008-04-19 00:24:39 +00003617 /* If YYLEN is nonzero, implement the default value of the action:
3618 `$$ = $1'.
3619
3620 Otherwise, the following line sets YYVAL to garbage.
3621 This behavior is undocumented and Bison
3622 users should not rely upon it. Assigning to YYVAL
3623 unconditionally makes the parser a bit smaller, and it avoids a
3624 GCC warning that YYVAL may be used uninitialized. */
3625 yyval = yyvsp[1-yylen];
3626
3627
3628 YY_REDUCE_PRINT (yyn);
3629 switch (yyn)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003630 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003631 case 29:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003632#line 1139 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003633 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3634 break;
Reid Spencer41dff5e2007-01-26 08:05:27 +00003635
Dan Gohmanf4423b12008-04-19 00:24:39 +00003636 case 30:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003637#line 1139 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003638 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3639 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003640
Dan Gohmanf4423b12008-04-19 00:24:39 +00003641 case 31:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003642#line 1140 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003643 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3644 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003645
Dan Gohmanf4423b12008-04-19 00:24:39 +00003646 case 32:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003647#line 1140 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003648 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3649 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003650
Dan Gohmanf4423b12008-04-19 00:24:39 +00003651 case 33:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003652#line 1141 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003653 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3654 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003655
Dan Gohmanf4423b12008-04-19 00:24:39 +00003656 case 34:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003657#line 1141 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003658 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3659 break;
3660
3661 case 35:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003662#line 1142 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003663 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3664 break;
3665
3666 case 36:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003667#line 1142 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003668 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3669 break;
3670
3671 case 37:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003672#line 1143 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003673 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3674 break;
3675
3676 case 38:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003677#line 1143 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003678 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3679 break;
3680
3681 case 39:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003682#line 1147 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003683 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3684 break;
3685
3686 case 40:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003687#line 1147 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003688 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3689 break;
3690
3691 case 41:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003692#line 1148 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003693 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3694 break;
3695
3696 case 42:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003697#line 1148 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003698 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3699 break;
3700
3701 case 43:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003702#line 1149 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003703 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3704 break;
3705
3706 case 44:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003707#line 1149 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003708 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3709 break;
3710
3711 case 45:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003712#line 1150 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003713 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3714 break;
3715
3716 case 46:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003717#line 1150 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003718 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3719 break;
3720
3721 case 47:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003722#line 1151 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003723 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3724 break;
3725
3726 case 48:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003727#line 1151 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003728 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3729 break;
3730
3731 case 49:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003732#line 1152 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003733 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3734 break;
3735
3736 case 50:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003737#line 1152 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003738 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3739 break;
3740
3741 case 51:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003742#line 1153 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003743 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3744 break;
3745
3746 case 52:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003747#line 1153 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003748 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3749 break;
3750
3751 case 53:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003752#line 1154 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003753 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3754 break;
3755
3756 case 54:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003757#line 1155 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003758 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3759 break;
3760
3761 case 65:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003762#line 1164 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003763 { (yyval.StrVal) = 0; ;}
3764 break;
3765
3766 case 66:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003767#line 1166 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003768 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3769 break;
3770
3771 case 67:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003772#line 1167 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003773 { (yyval.UIntVal)=0; ;}
3774 break;
3775
3776 case 68:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003777#line 1171 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003778 {
3779 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003780 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003781 ;}
3782 break;
3783
3784 case 69:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003785#line 1175 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003786 {
3787 (yyval.StrVal) = 0;
Christopher Lambbf3348d2007-12-12 08:45:45 +00003788 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003789 ;}
3790 break;
3791
3792 case 73:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003793#line 1183 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003794 {
3795 (yyval.StrVal) = 0;
Christopher Lambbf3348d2007-12-12 08:45:45 +00003796 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003797 ;}
3798 break;
3799
3800 case 74:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003801#line 1188 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003802 {
3803 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00003804 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003805 ;}
3806 break;
3807
3808 case 75:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003809#line 1194 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003810 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3811 break;
3812
3813 case 76:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003814#line 1195 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003815 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3816 break;
3817
3818 case 77:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003819#line 1196 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003820 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3821 break;
3822
3823 case 78:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003824#line 1197 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003825 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3826 break;
3827
3828 case 79:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003829#line 1198 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003830 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3831 break;
3832
3833 case 80:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003834#line 1199 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003835 { (yyval.Linkage) = GlobalValue::CommonLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003836 break;
3837
3838 case 81:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003839#line 1203 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003840 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003841 break;
3842
3843 case 82:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003844#line 1204 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003845 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003846 break;
3847
3848 case 83:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003849#line 1205 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003850 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003851 break;
3852
3853 case 84:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003854#line 1209 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003855 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3856 break;
3857
3858 case 85:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003859#line 1210 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003860 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003861 break;
3862
3863 case 86:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003864#line 1211 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003865 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003866 break;
3867
3868 case 87:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003869#line 1212 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003870 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003871 break;
3872
3873 case 88:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003874#line 1216 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003875 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3876 break;
3877
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003878 case 89:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003879#line 1217 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003880 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3881 break;
3882
3883 case 90:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003884#line 1218 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003885 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3886 break;
3887
3888 case 91:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003889#line 1222 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003890 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3891 break;
3892
3893 case 92:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003894#line 1223 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003895 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3896 break;
3897
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003898 case 93:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003899#line 1224 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003900 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3901 break;
3902
3903 case 94:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003904#line 1225 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003905 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3906 break;
3907
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003908 case 95:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003909#line 1226 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003910 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3911 break;
3912
3913 case 96:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003914#line 1230 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003915 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3916 break;
3917
3918 case 97:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003919#line 1231 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003920 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3921 break;
3922
3923 case 98:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003924#line 1232 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003925 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003926 break;
3927
3928 case 99:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003929#line 1235 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003930 { (yyval.UIntVal) = CallingConv::C; ;}
3931 break;
3932
3933 case 100:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003934#line 1236 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003935 { (yyval.UIntVal) = CallingConv::C; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003936 break;
3937
3938 case 101:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003939#line 1237 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003940 { (yyval.UIntVal) = CallingConv::Fast; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003941 break;
3942
3943 case 102:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003944#line 1238 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003945 { (yyval.UIntVal) = CallingConv::Cold; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003946 break;
3947
3948 case 103:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003949#line 1239 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003950 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003951 break;
3952
3953 case 104:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003954#line 1240 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003955 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3956 break;
3957
3958 case 105:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003959#line 1241 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3960 { (yyval.UIntVal) = CallingConv::X86_SSECall; ;}
3961 break;
3962
3963 case 106:
3964#line 1242 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003965 {
3966 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003967 GEN_ERROR("Calling conv too large");
Dan Gohmanf4423b12008-04-19 00:24:39 +00003968 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003969 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003970 ;}
3971 break;
3972
Dan Gohmanf4423b12008-04-19 00:24:39 +00003973 case 107:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003974#line 1249 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003975 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003976 break;
3977
3978 case 108:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003979#line 1250 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3980 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003981 break;
3982
3983 case 109:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003984#line 1251 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003985 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003986 break;
3987
3988 case 110:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003989#line 1252 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3990 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003991 break;
3992
3993 case 111:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003994#line 1253 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
3995 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003996 break;
3997
3998 case 112:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003999#line 1254 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4000 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004001 break;
4002
4003 case 113:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004004#line 1255 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4005 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004006 break;
4007
4008 case 114:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004009#line 1256 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4010 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004011 break;
4012
4013 case 115:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004014#line 1257 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4015 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
4016 break;
4017
4018 case 116:
4019#line 1258 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004020 { (yyval.ParamAttrs) =
4021 ParamAttr::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
4022 break;
4023
Dan Gohmanf4423b12008-04-19 00:24:39 +00004024 case 117:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004025#line 1262 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4026 { (yyval.ParamAttrs) = ParamAttr::None; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004027 break;
4028
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004029 case 118:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004030#line 1263 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004031 {
4032 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
4033 ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004034 break;
4035
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004036 case 119:
4037#line 1268 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4038 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
4039 break;
4040
4041 case 120:
4042#line 1269 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4043 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
4044 break;
4045
4046 case 121:
4047#line 1270 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4048 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
4049 break;
4050
4051 case 122:
4052#line 1271 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4053 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
4054 break;
4055
4056 case 123:
4057#line 1272 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4058 { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
4059 break;
4060
4061 case 124:
4062#line 1273 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4063 { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
4064 break;
4065
4066 case 125:
4067#line 1276 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4068 { (yyval.ParamAttrs) = ParamAttr::None; ;}
4069 break;
4070
Dan Gohmanf4423b12008-04-19 00:24:39 +00004071 case 126:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004072#line 1277 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4073 {
4074 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
4075 ;}
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004076 break;
4077
4078 case 127:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004079#line 1282 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4080 { (yyval.StrVal) = 0; ;}
4081 break;
4082
4083 case 128:
4084#line 1283 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004085 {
4086 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
4087 ;}
4088 break;
4089
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004090 case 129:
4091#line 1290 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004092 { (yyval.UIntVal) = 0; ;}
4093 break;
4094
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004095 case 130:
4096#line 1291 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004097 {
4098 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
4099 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004100 GEN_ERROR("Alignment must be a power of two");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004101 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004102;}
4103 break;
4104
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004105 case 131:
4106#line 1297 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004107 { (yyval.UIntVal) = 0; ;}
4108 break;
4109
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004110 case 132:
4111#line 1298 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004112 {
4113 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
4114 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Christopher Lambbf3348d2007-12-12 08:45:45 +00004115 GEN_ERROR("Alignment must be a power of two");
4116 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004117;}
4118 break;
4119
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004120 case 133:
4121#line 1307 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004122 {
4123 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
4124 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004125 GEN_ERROR("Invalid character in section name");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004126 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004127 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004128;}
4129 break;
4130
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004131 case 134:
4132#line 1315 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004133 { (yyval.StrVal) = 0; ;}
4134 break;
4135
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004136 case 135:
4137#line 1316 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004138 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
4139 break;
4140
Dan Gohmanf4423b12008-04-19 00:24:39 +00004141 case 136:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004142#line 1321 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004143 {;}
4144 break;
4145
4146 case 137:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004147#line 1322 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
4148 {;}
4149 break;
4150
4151 case 138:
4152#line 1323 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004153 {
4154 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
4155 delete (yyvsp[(1) - (1)].StrVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004156 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004157 ;}
4158 break;
4159
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004160 case 139:
4161#line 1328 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004162 {
4163 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004164 GEN_ERROR("Alignment must be a power of two");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004165 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004166 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004167 ;}
4168 break;
4169
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004170 case 147:
4171#line 1344 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004172 {
4173 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004174 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004175 ;}
4176 break;
4177
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004178 case 148:
4179#line 1348 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004180 {
4181 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004182 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004183 ;}
4184 break;
4185
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004186 case 149:
4187#line 1352 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004188 { // Pointer type?
4189 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
Christopher Lambbf3348d2007-12-12 08:45:45 +00004190 GEN_ERROR("Cannot form a pointer to a basic block");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004191 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4192 delete (yyvsp[(1) - (3)].TypeVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00004193 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004194 ;}
4195 break;
4196
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004197 case 150:
4198#line 1359 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004199 { // Named types are also simple types...
4200 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00004201 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004202 (yyval.TypeVal) = new PATypeHolder(tmp);
4203 ;}
4204 break;
4205
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004206 case 151:
4207#line 1364 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004208 { // Type UpReference
4209 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004210 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Dan Gohmanf4423b12008-04-19 00:24:39 +00004211 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4212 (yyval.TypeVal) = new PATypeHolder(OT);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004213 UR_OUT("New Upreference!\n");
4214 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004215 ;}
4216 break;
4217
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004218 case 152:
4219#line 1372 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004220 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004221 // Allow but ignore attributes on function types; this permits auto-upgrade.
4222 // FIXME: remove in LLVM 3.0.
Chris Lattnera925a142008-04-23 05:37:08 +00004223 const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal);
4224 if (!FunctionType::isValidReturnType(RetTy))
4225 GEN_ERROR("Invalid result type for LLVM function");
4226
Reid Spencer41dff5e2007-01-26 08:05:27 +00004227 std::vector<const Type*> Params;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004228 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00004229 for (; I != E; ++I ) {
Reid Spencer66728ef2007-03-20 01:13:36 +00004230 const Type *Ty = I->Ty->get();
Reid Spencer66728ef2007-03-20 01:13:36 +00004231 Params.push_back(Ty);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004232 }
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004233
Reid Spencer41dff5e2007-01-26 08:05:27 +00004234 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4235 if (isVarArg) Params.pop_back();
4236
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004237 for (unsigned i = 0; i != Params.size(); ++i)
4238 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4239 GEN_ERROR("Function arguments must be value types!");
4240
4241 CHECK_FOR_ERROR
4242
Anton Korobeynikovc36284e2007-12-03 19:17:47 +00004243 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004244 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4245 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4246 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Reid Spencere4d87aa2006-12-23 06:05:41 +00004247 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004248 ;}
4249 break;
4250
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004251 case 153:
4252#line 1401 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004253 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004254 // Allow but ignore attributes on function types; this permits auto-upgrade.
4255 // FIXME: remove in LLVM 3.0.
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004256 std::vector<const Type*> Params;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004257 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00004258 for ( ; I != E; ++I ) {
Reid Spencer66728ef2007-03-20 01:13:36 +00004259 const Type* Ty = I->Ty->get();
Reid Spencer66728ef2007-03-20 01:13:36 +00004260 Params.push_back(Ty);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004261 }
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004262
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004263 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4264 if (isVarArg) Params.pop_back();
4265
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004266 for (unsigned i = 0; i != Params.size(); ++i)
4267 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4268 GEN_ERROR("Function arguments must be value types!");
4269
4270 CHECK_FOR_ERROR
4271
Dan Gohmanf4423b12008-04-19 00:24:39 +00004272 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4273 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4274 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004275 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004276 ;}
4277 break;
4278
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004279 case 154:
4280#line 1426 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004281 { // Sized array type?
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004282 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (yyvsp[(2) - (5)].UInt64Val))));
Dan Gohmanf4423b12008-04-19 00:24:39 +00004283 delete (yyvsp[(4) - (5)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004284 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004285 ;}
4286 break;
4287
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004288 case 155:
4289#line 1431 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004290 { // Vector type?
4291 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4292 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004293 GEN_ERROR("Unsigned result not equal to signed result");
4294 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4295 GEN_ERROR("Element type of a VectorType must be primitive");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004296 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4297 delete (yyvsp[(4) - (5)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004298 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004299 ;}
4300 break;
4301
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004302 case 156:
4303#line 1441 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004304 { // Structure type?
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004305 std::vector<const Type*> Elements;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004306 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4307 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004308 Elements.push_back(*I);
4309
Dan Gohmanf4423b12008-04-19 00:24:39 +00004310 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4311 delete (yyvsp[(2) - (3)].TypeList);
Reid Spencer14310612006-12-31 05:40:51 +00004312 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004313 ;}
4314 break;
4315
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004316 case 157:
4317#line 1451 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004318 { // Empty structure type?
4319 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Reid Spencer14310612006-12-31 05:40:51 +00004320 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004321 ;}
4322 break;
4323
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004324 case 158:
4325#line 1455 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004326 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004327 std::vector<const Type*> Elements;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004328 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4329 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004330 Elements.push_back(*I);
4331
Dan Gohmanf4423b12008-04-19 00:24:39 +00004332 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4333 delete (yyvsp[(3) - (5)].TypeList);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004334 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004335 ;}
4336 break;
4337
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004338 case 159:
4339#line 1465 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004340 { // Empty structure type?
4341 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004342 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004343 ;}
4344 break;
4345
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004346 case 160:
4347#line 1472 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004348 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004349 // Allow but ignore attributes on function types; this permits auto-upgrade.
4350 // FIXME: remove in LLVM 3.0.
Dan Gohmanf4423b12008-04-19 00:24:39 +00004351 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4352 (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
4353 ;}
4354 break;
4355
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004356 case 161:
4357#line 1481 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004358 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004359 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004360 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4361 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004362 GEN_ERROR("LLVM functions cannot return aggregate types");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004363 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4364 ;}
4365 break;
4366
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004367 case 162:
4368#line 1488 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004369 {
4370 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4371 ;}
4372 break;
4373
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004374 case 163:
4375#line 1493 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004376 {
4377 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4378 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
Reid Spencer3da59db2006-11-27 01:05:10 +00004379 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004380 ;}
4381 break;
4382
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004383 case 164:
4384#line 1498 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004385 {
4386 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004387 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004388 ;}
4389 break;
4390
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004391 case 166:
4392#line 1506 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004393 {
4394 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
Reid Spencer18da0722007-04-11 02:44:20 +00004395 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
Reid Spencer41dff5e2007-01-26 08:05:27 +00004396 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004397 (yyval.TypeWithAttrsList)->push_back(TWA);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004398 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004399 ;}
4400 break;
4401
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004402 case 167:
4403#line 1513 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004404 {
4405 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004406 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4407 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004408 (yyval.TypeWithAttrsList)->push_back(TWA);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004409 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004410 ;}
4411 break;
4412
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004413 case 168:
4414#line 1520 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004415 {
4416 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004417 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004418 ;}
4419 break;
4420
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004421 case 169:
4422#line 1528 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004423 {
4424 (yyval.TypeList) = new std::list<PATypeHolder>();
4425 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4426 delete (yyvsp[(1) - (1)].TypeVal);
Reid Spencer3da59db2006-11-27 01:05:10 +00004427 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004428 ;}
4429 break;
4430
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004431 case 170:
4432#line 1534 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004433 {
4434 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4435 delete (yyvsp[(3) - (3)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004436 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004437 ;}
4438 break;
4439
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004440 case 171:
4441#line 1546 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004442 { // Nonempty unsized arr
Reid Spencer14310612006-12-31 05:40:51 +00004443 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004444 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4445 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004446 if (ATy == 0)
Reid Spencer61c83e02006-08-18 08:43:06 +00004447 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004448 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004449 const Type *ETy = ATy->getElementType();
Dan Gohman180c1692008-06-23 18:43:26 +00004450 uint64_t NumElements = ATy->getNumElements();
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004451
4452 // Verify that we have the correct size...
Mon P Wang28873102008-06-25 08:15:39 +00004453 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (4)].ConstVector)->size())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004454 GEN_ERROR("Type mismatch: constant sized array initialized with " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004455 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Mon P Wang28873102008-06-25 08:15:39 +00004456 utostr(NumElements) + "");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004457
4458 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004459 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4460 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004461 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4462 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohmanf4423b12008-04-19 00:24:39 +00004463 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004464 }
4465
Dan Gohmanf4423b12008-04-19 00:24:39 +00004466 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4467 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004468 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004469 ;}
4470 break;
4471
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004472 case 172:
4473#line 1574 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004474 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004475 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004476 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4477 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004478 if (ATy == 0)
4479 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004480 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004481
Dan Gohman180c1692008-06-23 18:43:26 +00004482 uint64_t NumElements = ATy->getNumElements();
Mon P Wang28873102008-06-25 08:15:39 +00004483 if (NumElements != uint64_t(-1) && NumElements != 0)
Andrew Lenharth6353e052006-12-08 18:07:09 +00004484 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
Mon P Wang28873102008-06-25 08:15:39 +00004485 " arguments, but has size of " + utostr(NumElements) +"");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004486 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4487 delete (yyvsp[(1) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00004488 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004489 ;}
4490 break;
4491
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004492 case 173:
4493#line 1590 "/Volumes/MacOS9/gcc/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 ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004498 if (ATy == 0)
4499 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004500 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004501
Dan Gohman180c1692008-06-23 18:43:26 +00004502 uint64_t NumElements = ATy->getNumElements();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004503 const Type *ETy = ATy->getElementType();
Mon P Wang28873102008-06-25 08:15:39 +00004504 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (3)].StrVal)->length())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004505 GEN_ERROR("Can't build string constant of size " +
Mon P Wang28873102008-06-25 08:15:39 +00004506 utostr((yyvsp[(3) - (3)].StrVal)->length()) +
4507 " when array has size " + utostr(NumElements) + "");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004508 std::vector<Constant*> Vals;
4509 if (ETy == Type::Int8Ty) {
Mon P Wang28873102008-06-25 08:15:39 +00004510 for (uint64_t i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
Dan Gohmanf4423b12008-04-19 00:24:39 +00004511 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004512 } else {
Dan Gohmanf4423b12008-04-19 00:24:39 +00004513 delete (yyvsp[(3) - (3)].StrVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004514 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4515 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004516 delete (yyvsp[(3) - (3)].StrVal);
4517 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4518 delete (yyvsp[(1) - (3)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004519 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004520 ;}
4521 break;
4522
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004523 case 174:
4524#line 1617 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004525 { // Nonempty unsized arr
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004526 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004527 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4528 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004529 if (PTy == 0)
4530 GEN_ERROR("Cannot make packed constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004531 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004532 const Type *ETy = PTy->getElementType();
Dan Gohman180c1692008-06-23 18:43:26 +00004533 unsigned NumElements = PTy->getNumElements();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004534
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004535 // Verify that we have the correct size...
Mon P Wang28873102008-06-25 08:15:39 +00004536 if (NumElements != unsigned(-1) && NumElements != (unsigned)(yyvsp[(3) - (4)].ConstVector)->size())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004537 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004538 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Mon P Wang28873102008-06-25 08:15:39 +00004539 utostr(NumElements) + "");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004540
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004541 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004542 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4543 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004544 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4545 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohmanf4423b12008-04-19 00:24:39 +00004546 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004547 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00004548
Dan Gohmanf4423b12008-04-19 00:24:39 +00004549 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4550 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004551 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004552 ;}
4553 break;
4554
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004555 case 175:
4556#line 1645 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004557 {
4558 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004559 if (STy == 0)
4560 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004561 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004562
Dan Gohmanf4423b12008-04-19 00:24:39 +00004563 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004564 GEN_ERROR("Illegal number of initializers for structure type");
4565
4566 // Check to ensure that constants are compatible with the type initializer!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004567 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4568 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004569 GEN_ERROR("Expected type '" +
4570 STy->getElementType(i)->getDescription() +
4571 "' for element #" + utostr(i) +
4572 " of structure initializer");
4573
4574 // Check to ensure that Type is not packed
4575 if (STy->isPacked())
4576 GEN_ERROR("Unpacked Initializer to vector type '" +
4577 STy->getDescription() + "'");
4578
Dan Gohmanf4423b12008-04-19 00:24:39 +00004579 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4580 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004581 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004582 ;}
4583 break;
4584
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004585 case 176:
4586#line 1671 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004587 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004588 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004589 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4590 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004591 if (STy == 0)
4592 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004593 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004594
4595 if (STy->getNumContainedTypes() != 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00004596 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004597
4598 // Check to ensure that Type is not packed
4599 if (STy->isPacked())
Chris Lattner6cdc6822007-04-26 05:31:05 +00004600 GEN_ERROR("Unpacked Initializer to vector type '" +
4601 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004602
Dan Gohmanf4423b12008-04-19 00:24:39 +00004603 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4604 delete (yyvsp[(1) - (3)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004605 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004606 ;}
4607 break;
4608
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004609 case 177:
4610#line 1691 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004611 {
4612 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004613 if (STy == 0)
4614 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004615 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004616
Dan Gohmanf4423b12008-04-19 00:24:39 +00004617 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
Reid Spencerb5334b02007-02-05 10:18:06 +00004618 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004619
4620 // Check to ensure that constants are compatible with the type initializer!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004621 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4622 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
Reid Spencer41dff5e2007-01-26 08:05:27 +00004623 GEN_ERROR("Expected type '" +
4624 STy->getElementType(i)->getDescription() +
4625 "' for element #" + utostr(i) +
Reid Spencerb5334b02007-02-05 10:18:06 +00004626 " of structure initializer");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004627
4628 // Check to ensure that Type is packed
4629 if (!STy->isPacked())
Chris Lattner32980692007-02-19 07:44:24 +00004630 GEN_ERROR("Vector initializer to non-vector type '" +
4631 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004632
Dan Gohmanf4423b12008-04-19 00:24:39 +00004633 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4634 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004635 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004636 ;}
4637 break;
4638
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004639 case 178:
4640#line 1717 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004641 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004642 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004643 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4644 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004645 if (STy == 0)
4646 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004647 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004648
4649 if (STy->getNumContainedTypes() != 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00004650 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004651
4652 // Check to ensure that Type is packed
4653 if (!STy->isPacked())
Chris Lattner32980692007-02-19 07:44:24 +00004654 GEN_ERROR("Vector initializer to non-vector type '" +
4655 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004656
Dan Gohmanf4423b12008-04-19 00:24:39 +00004657 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4658 delete (yyvsp[(1) - (5)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004659 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004660 ;}
4661 break;
4662
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004663 case 179:
4664#line 1737 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004665 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004666 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004667 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4668 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004669 if (PTy == 0)
4670 GEN_ERROR("Cannot make null pointer constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004671 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004672
Dan Gohmanf4423b12008-04-19 00:24:39 +00004673 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4674 delete (yyvsp[(1) - (2)].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004675 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004676 ;}
4677 break;
4678
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004679 case 180:
4680#line 1749 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004681 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004682 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004683 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4684 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4685 delete (yyvsp[(1) - (2)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004686 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004687 ;}
4688 break;
4689
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004690 case 181:
4691#line 1756 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004692 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004693 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004694 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4695 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004696 if (Ty == 0)
Dan Gohmanf4423b12008-04-19 00:24:39 +00004697 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004698
4699 // ConstExprs can exist in the body of a function, thus creating
4700 // GlobalValues whenever they refer to a variable. Because we are in
Reid Spencer93c40032007-03-19 18:40:50 +00004701 // the context of a function, getExistingVal will search the functions
Reid Spencer68a24bd2005-08-27 18:50:39 +00004702 // symbol table instead of the module symbol table for the global symbol,
4703 // which throws things all off. To get around this, we just tell
Reid Spencer93c40032007-03-19 18:40:50 +00004704 // getExistingVal that we are at global scope here.
Reid Spencer68a24bd2005-08-27 18:50:39 +00004705 //
4706 Function *SavedCurFn = CurFun.CurrentFunction;
4707 CurFun.CurrentFunction = 0;
4708
Dan Gohmanf4423b12008-04-19 00:24:39 +00004709 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00004710 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00004711
4712 CurFun.CurrentFunction = SavedCurFn;
4713
4714 // If this is an initializer for a constant pointer, which is referencing a
4715 // (currently) undefined variable, create a stub now that shall be replaced
4716 // in the future with the right type of variable.
4717 //
4718 if (V == 0) {
Reid Spencera9720f52007-02-05 17:04:00 +00004719 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004720 const PointerType *PT = cast<PointerType>(Ty);
4721
4722 // First check to see if the forward references value is already created!
4723 PerModuleInfo::GlobalRefsType::iterator I =
Dan Gohmanf4423b12008-04-19 00:24:39 +00004724 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004725
4726 if (I != CurModule.GlobalRefs.end()) {
4727 V = I->second; // Placeholder already exists, use it...
Dan Gohmanf4423b12008-04-19 00:24:39 +00004728 (yyvsp[(2) - (2)].ValIDVal).destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +00004729 } else {
4730 std::string Name;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004731 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4732 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4733 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
Reid Spencer41dff5e2007-01-26 08:05:27 +00004734 GEN_ERROR("Invalid reference to global");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004735
4736 // Create the forward referenced global.
4737 GlobalValue *GV;
4738 if (const FunctionType *FTy =
4739 dyn_cast<FunctionType>(PT->getElementType())) {
Gabor Greife64d2482008-04-06 23:07:54 +00004740 GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
4741 CurModule.CurrentModule);
Reid Spencer68a24bd2005-08-27 18:50:39 +00004742 } else {
4743 GV = new GlobalVariable(PT->getElementType(), false,
Chris Lattner6cdc6822007-04-26 05:31:05 +00004744 GlobalValue::ExternalWeakLinkage, 0,
Reid Spencer68a24bd2005-08-27 18:50:39 +00004745 Name, CurModule.CurrentModule);
4746 }
4747
4748 // Keep track of the fact that we have a forward ref to recycle it
Dan Gohmanf4423b12008-04-19 00:24:39 +00004749 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004750 V = GV;
4751 }
4752 }
4753
Dan Gohmanf4423b12008-04-19 00:24:39 +00004754 (yyval.ConstVal) = cast<GlobalValue>(V);
4755 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
Reid Spencer61c83e02006-08-18 08:43:06 +00004756 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004757 ;}
4758 break;
4759
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004760 case 182:
4761#line 1822 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004762 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004763 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004764 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4765 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004766 GEN_ERROR("Mismatched types for constant expression: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004767 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4768 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4769 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004770 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004771 ;}
4772 break;
4773
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004774 case 183:
4775#line 1832 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004776 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004777 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004778 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4779 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004780 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4781 GEN_ERROR("Cannot create a null initialized value of this type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004782 (yyval.ConstVal) = Constant::getNullValue(Ty);
4783 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004784 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004785 ;}
4786 break;
4787
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004788 case 184:
4789#line 1842 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004790 { // integral constants
4791 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004792 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004793 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
Reid Spencer38c91a92007-02-28 02:24:54 +00004794 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004795 ;}
4796 break;
4797
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004798 case 185:
4799#line 1848 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004800 { // arbitrary precision integer constants
4801 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4802 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004803 GEN_ERROR("Constant value does not fit in type");
4804 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004805 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4806 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4807 delete (yyvsp[(2) - (2)].APIntVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004808 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004809 ;}
4810 break;
4811
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004812 case 186:
4813#line 1858 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004814 { // integral constants
4815 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004816 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004817 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004818 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004819 ;}
4820 break;
4821
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004822 case 187:
4823#line 1864 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004824 { // arbitrary precision integer constants
4825 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4826 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004827 GEN_ERROR("Constant value does not fit in type");
4828 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004829 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4830 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4831 delete (yyvsp[(2) - (2)].APIntVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004832 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004833 ;}
4834 break;
4835
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004836 case 188:
4837#line 1874 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004838 { // Boolean constants
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004839 if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1)
4840 GEN_ERROR("Constant true must have type i1");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004841 (yyval.ConstVal) = ConstantInt::getTrue();
Reid Spencer38c91a92007-02-28 02:24:54 +00004842 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004843 ;}
4844 break;
4845
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004846 case 189:
4847#line 1880 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004848 { // Boolean constants
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004849 if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1)
4850 GEN_ERROR("Constant false must have type i1");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004851 (yyval.ConstVal) = ConstantInt::getFalse();
Reid Spencer6f407902007-01-13 05:00:46 +00004852 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004853 ;}
4854 break;
4855
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004856 case 190:
4857#line 1886 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004858 { // Floating point constants
4859 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004860 GEN_ERROR("Floating point constant invalid for type");
Dale Johannesenc72cd7e2007-09-11 18:33:39 +00004861 // Lexer has no type info, so builds all float and double FP constants
4862 // as double. Fix this here. Long double is done right.
Dan Gohmanf4423b12008-04-19 00:24:39 +00004863 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4864 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
Chris Lattnerd8eb63f2008-04-20 00:41:19 +00004865 (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal));
Dan Gohmanf4423b12008-04-19 00:24:39 +00004866 delete (yyvsp[(2) - (2)].FPVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004867 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004868 ;}
4869 break;
4870
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004871 case 191:
4872#line 1899 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004873 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004874 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004875 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4876 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4877 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4878 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004879 GEN_ERROR("invalid cast opcode for cast from '" +
4880 Val->getType()->getDescription() + "' to '" +
4881 DestTy->getDescription() + "'");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004882 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4883 delete (yyvsp[(5) - (6)].TypeVal);
4884 ;}
4885 break;
4886
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004887 case 192:
4888#line 1911 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004889 {
4890 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
Reid Spencerb5334b02007-02-05 10:18:06 +00004891 GEN_ERROR("GetElementPtr requires a pointer operand");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004892
4893 const Type *IdxTy =
Dan Gohman041e2eb2008-05-15 19:50:34 +00004894 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004895 if (!IdxTy)
Reid Spencerb5334b02007-02-05 10:18:06 +00004896 GEN_ERROR("Index list invalid for constant getelementptr");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004897
Chris Lattnerf7469af2007-01-31 04:44:08 +00004898 SmallVector<Constant*, 8> IdxVec;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004899 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4900 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004901 IdxVec.push_back(C);
4902 else
Reid Spencerb5334b02007-02-05 10:18:06 +00004903 GEN_ERROR("Indices to constant getelementptr must be constants");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004904
Dan Gohmanf4423b12008-04-19 00:24:39 +00004905 delete (yyvsp[(4) - (5)].ValueList);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004906
Dan Gohmanf4423b12008-04-19 00:24:39 +00004907 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
Andrew Lenharth6353e052006-12-08 18:07:09 +00004908 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004909 ;}
4910 break;
4911
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004912 case 193:
4913#line 1932 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004914 {
4915 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004916 GEN_ERROR("Select condition must be of boolean type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004917 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004918 GEN_ERROR("Select operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004919 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004920 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004921 ;}
4922 break;
4923
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004924 case 194:
4925#line 1940 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004926 {
4927 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004928 GEN_ERROR("Binary operator types must match");
4929 CHECK_FOR_ERROR;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004930 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4931 ;}
4932 break;
4933
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004934 case 195:
4935#line 1946 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004936 {
4937 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004938 GEN_ERROR("Logical operator types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004939 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
Nate Begeman5bc1ea02008-07-29 15:49:41 +00004940 if (!isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
Dan Gohmanf4423b12008-04-19 00:24:39 +00004941 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004942 GEN_ERROR("Logical operator requires integral operands");
4943 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004944 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004945 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004946 ;}
4947 break;
4948
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004949 case 196:
4950#line 1957 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004951 {
4952 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004953 GEN_ERROR("icmp operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004954 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4955 ;}
4956 break;
4957
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004958 case 197:
4959#line 1962 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004960 {
4961 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004962 GEN_ERROR("fcmp operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004963 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4964 ;}
4965 break;
4966
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004967 case 198:
4968#line 1967 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00004969 {
4970 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4971 GEN_ERROR("vicmp operand types must match");
4972 (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4973 ;}
4974 break;
4975
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004976 case 199:
4977#line 1972 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00004978 {
4979 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4980 GEN_ERROR("vfcmp operand types must match");
4981 (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4982 ;}
4983 break;
4984
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004985 case 200:
4986#line 1977 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004987 {
4988 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004989 GEN_ERROR("Invalid extractelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004990 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004991 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004992 ;}
4993 break;
4994
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004995 case 201:
4996#line 1983 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004997 {
4998 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004999 GEN_ERROR("Invalid insertelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005000 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00005001 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005002 ;}
5003 break;
5004
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005005 case 202:
5006#line 1989 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005007 {
5008 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005009 GEN_ERROR("Invalid shufflevector operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005010 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00005011 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005012 ;}
5013 break;
5014
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005015 case 203:
5016#line 1995 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005017 {
5018 if (!isa<StructType>((yyvsp[(3) - (5)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (5)].ConstVal)->getType()))
5019 GEN_ERROR("ExtractValue requires an aggregate operand");
5020
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005021 (yyval.ConstVal) = ConstantExpr::getExtractValue((yyvsp[(3) - (5)].ConstVal), &(*(yyvsp[(4) - (5)].ConstantList))[0], (yyvsp[(4) - (5)].ConstantList)->size());
5022 delete (yyvsp[(4) - (5)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00005023 CHECK_FOR_ERROR
5024 ;}
5025 break;
5026
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005027 case 204:
5028#line 2003 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005029 {
5030 if (!isa<StructType>((yyvsp[(3) - (7)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (7)].ConstVal)->getType()))
5031 GEN_ERROR("InsertValue requires an aggregate operand");
5032
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005033 (yyval.ConstVal) = ConstantExpr::getInsertValue((yyvsp[(3) - (7)].ConstVal), (yyvsp[(5) - (7)].ConstVal), &(*(yyvsp[(6) - (7)].ConstantList))[0], (yyvsp[(6) - (7)].ConstantList)->size());
5034 delete (yyvsp[(6) - (7)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00005035 CHECK_FOR_ERROR
5036 ;}
5037 break;
5038
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005039 case 205:
5040#line 2014 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005041 {
5042 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005043 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005044 ;}
5045 break;
5046
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005047 case 206:
5048#line 2018 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005049 {
5050 (yyval.ConstVector) = new std::vector<Constant*>();
5051 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005052 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005053 ;}
5054 break;
5055
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005056 case 207:
5057#line 2026 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005058 { (yyval.BoolVal) = false; ;}
Nate Begemanac80ade2008-05-12 19:01:56 +00005059 break;
5060
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005061 case 208:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005062#line 2026 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005063 { (yyval.BoolVal) = true; ;}
5064 break;
5065
5066 case 209:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005067#line 2029 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
5068 { (yyval.BoolVal) = true; ;}
Dan Gohmane4977cf2008-05-23 01:55:30 +00005069 break;
5070
5071 case 210:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005072#line 2029 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
5073 { (yyval.BoolVal) = false; ;}
5074 break;
5075
5076 case 211:
5077#line 2032 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005078 {
5079 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
5080 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
Chris Lattner0275cff2007-08-06 21:00:46 +00005081 CHECK_FOR_ERROR
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005082 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
5083 if (!Aliasee)
5084 GEN_ERROR("Aliases can be created only to global values");
5085
Dan Gohmanf4423b12008-04-19 00:24:39 +00005086 (yyval.ConstVal) = Aliasee;
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005087 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005088 delete (yyvsp[(1) - (2)].TypeVal);
5089 ;}
5090 break;
5091
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005092 case 212:
5093#line 2044 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005094 {
5095 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
5096 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
5097 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005098 GEN_ERROR("invalid cast opcode for cast from '" +
5099 Val->getType()->getDescription() + "' to '" +
5100 DestTy->getDescription() + "'");
5101
Dan Gohmanf4423b12008-04-19 00:24:39 +00005102 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005103 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005104 delete (yyvsp[(5) - (6)].TypeVal);
5105 ;}
5106 break;
5107
Dan Gohmane4977cf2008-05-23 01:55:30 +00005108 case 213:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005109#line 2065 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005110 {
5111 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5112 CurModule.ModuleDone();
5113 CHECK_FOR_ERROR;
5114 ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00005115 break;
5116
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005117 case 214:
5118#line 2070 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
5119 {
5120 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5121 CurModule.ModuleDone();
5122 CHECK_FOR_ERROR;
5123 ;}
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005124 break;
5125
Dan Gohmane4977cf2008-05-23 01:55:30 +00005126 case 217:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005127#line 2083 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
5128 { CurFun.isDeclare = false; ;}
5129 break;
5130
5131 case 218:
5132#line 2083 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005133 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005134 CurFun.FunctionDone();
5135 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005136 ;}
5137 break;
5138
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005139 case 219:
5140#line 2087 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005141 { CurFun.isDeclare = true; ;}
5142 break;
5143
Dan Gohmane4977cf2008-05-23 01:55:30 +00005144 case 220:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005145#line 2087 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005146 {
5147 CHECK_FOR_ERROR
5148 ;}
5149 break;
5150
5151 case 221:
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005152#line 2090 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
5153 {
5154 CHECK_FOR_ERROR
5155 ;}
5156 break;
5157
5158 case 222:
5159#line 2093 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005160 {
Reid Spencer14310612006-12-31 05:40:51 +00005161 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005162 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005163 // Eagerly resolve types. This is not an optimization, this is a
5164 // requirement that is due to the fact that we could have this:
5165 //
5166 // %list = type { %list * }
5167 // %list = type { %list * } ; repeated type decl
5168 //
5169 // If types are not resolved eagerly, then the two types will not be
5170 // determined to be the same type!
5171 //
Dan Gohmanf4423b12008-04-19 00:24:39 +00005172 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005173
Dan Gohmanf4423b12008-04-19 00:24:39 +00005174 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Reid Spencer5b7e7532006-09-28 19:28:24 +00005175 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005176 // If this is a named type that is not a redefinition, add it to the slot
5177 // table.
Dan Gohmanf4423b12008-04-19 00:24:39 +00005178 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005179 }
Reid Spencera132e042006-12-03 05:46:11 +00005180
Dan Gohmanf4423b12008-04-19 00:24:39 +00005181 delete (yyvsp[(3) - (3)].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005182 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005183 ;}
5184 break;
Reid Spencerb8f85052007-07-31 03:50:36 +00005185
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005186 case 223:
5187#line 2117 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005188 {
5189 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
5190
5191 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005192 CHECK_FOR_ERROR
5193 // If this is a named type that is not a redefinition, add it to the slot
5194 // table.
Dan Gohmanf4423b12008-04-19 00:24:39 +00005195 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005196 }
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005197 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005198 ;}
5199 break;
5200
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005201 case 224:
5202#line 2129 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005203 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005204 /* "Externally Visible" Linkage */
Dan Gohmanf4423b12008-04-19 00:24:39 +00005205 if ((yyvsp[(5) - (6)].ConstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005206 GEN_ERROR("Global value initializer is not a constant");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005207 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5208 (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 +00005209 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005210 ;}
5211 break;
5212
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005213 case 225:
5214#line 2136 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005215 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005216 CurGV = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005217 ;}
5218 break;
5219
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005220 case 226:
5221#line 2140 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005222 {
5223 if ((yyvsp[(6) - (7)].ConstVal) == 0)
Christopher Lambbf3348d2007-12-12 08:45:45 +00005224 GEN_ERROR("Global value initializer is not a constant");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005225 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 +00005226 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005227 ;}
5228 break;
5229
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005230 case 227:
5231#line 2145 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005232 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005233 CurGV = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005234 ;}
5235 break;
5236
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005237 case 228:
5238#line 2149 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005239 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005240 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005241 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5242 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 +00005243 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005244 delete (yyvsp[(6) - (7)].TypeVal);
5245 ;}
5246 break;
5247
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005248 case 229:
5249#line 2155 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005250 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005251 CurGV = 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +00005252 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005253 ;}
5254 break;
5255
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005256 case 230:
5257#line 2159 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005258 {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005259 std::string Name;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005260 if ((yyvsp[(1) - (5)].StrVal)) {
5261 Name = *(yyvsp[(1) - (5)].StrVal);
5262 delete (yyvsp[(1) - (5)].StrVal);
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005263 }
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005264 if (Name.empty())
5265 GEN_ERROR("Alias name cannot be empty");
5266
Dan Gohmanf4423b12008-04-19 00:24:39 +00005267 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005268 if (Aliasee == 0)
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005269 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005270
Dan Gohmanf4423b12008-04-19 00:24:39 +00005271 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005272 CurModule.CurrentModule);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005273 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005274 InsertValue(GA, CurModule.Values);
Chris Lattner569f7372007-09-10 23:24:14 +00005275
5276
5277 // If there was a forward reference of this alias, resolve it now.
5278
5279 ValID ID;
5280 if (!Name.empty())
5281 ID = ValID::createGlobalName(Name);
5282 else
5283 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5284
5285 if (GlobalValue *FWGV =
5286 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5287 // Replace uses of the fwdref with the actual alias.
5288 FWGV->replaceAllUsesWith(GA);
5289 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5290 GV->eraseFromParent();
5291 else
5292 cast<Function>(FWGV)->eraseFromParent();
5293 }
5294 ID.destroy();
5295
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005296 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005297 ;}
5298 break;
5299
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005300 case 231:
5301#line 2199 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005302 {
Anton Korobeynikov77d0f972007-04-25 14:29:12 +00005303 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005304 ;}
5305 break;
5306
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005307 case 232:
5308#line 2202 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005309 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005310 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005311 ;}
5312 break;
5313
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005314 case 233:
5315#line 2208 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005316 {
Chris Lattner66316012006-01-24 04:14:29 +00005317 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
Chris Lattner66316012006-01-24 04:14:29 +00005318 if (AsmSoFar.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005319 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
Chris Lattner66316012006-01-24 04:14:29 +00005320 else
Dan Gohmanf4423b12008-04-19 00:24:39 +00005321 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5322 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00005323 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005324;}
5325 break;
5326
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005327 case 234:
5328#line 2218 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005329 {
5330 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5331 delete (yyvsp[(3) - (3)].StrVal);
5332 ;}
5333 break;
5334
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005335 case 235:
5336#line 2222 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005337 {
5338 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5339 delete (yyvsp[(3) - (3)].StrVal);
5340 ;}
5341 break;
5342
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005343 case 237:
5344#line 2229 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005345 {
5346 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5347 delete (yyvsp[(3) - (3)].StrVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00005348 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005349 ;}
5350 break;
5351
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005352 case 238:
5353#line 2234 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005354 {
5355 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5356 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer1013b4d2007-07-31 14:41:17 +00005357 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005358 ;}
5359 break;
5360
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005361 case 239:
5362#line 2239 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005363 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005364 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005365 ;}
5366 break;
5367
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005368 case 240:
5369#line 2248 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005370 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005371 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005372 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005373 if (!(*(yyvsp[(3) - (5)].TypeVal))->isFirstClassType())
5374 GEN_ERROR("Argument types must be first-class");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005375 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5376 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5377 (yyvsp[(1) - (5)].ArgList)->push_back(E);
Reid Spencer6f407902007-01-13 05:00:46 +00005378 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005379 ;}
5380 break;
5381
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005382 case 241:
5383#line 2258 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005384 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005385 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005386 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005387 if (!(*(yyvsp[(1) - (3)].TypeVal))->isFirstClassType())
5388 GEN_ERROR("Argument types must be first-class");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005389 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5390 (yyval.ArgList) = new ArgListType;
5391 (yyval.ArgList)->push_back(E);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005392 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005393 ;}
5394 break;
5395
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005396 case 242:
5397#line 2269 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005398 {
5399 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005400 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005401 ;}
5402 break;
5403
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005404 case 243:
5405#line 2273 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005406 {
5407 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005408 struct ArgListEntry E;
5409 E.Ty = new PATypeHolder(Type::VoidTy);
5410 E.Name = 0;
Reid Spencer18da0722007-04-11 02:44:20 +00005411 E.Attrs = ParamAttr::None;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005412 (yyval.ArgList)->push_back(E);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005413 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005414 ;}
5415 break;
5416
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005417 case 244:
5418#line 2282 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005419 {
5420 (yyval.ArgList) = new ArgListType;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005421 struct ArgListEntry E;
5422 E.Ty = new PATypeHolder(Type::VoidTy);
5423 E.Name = 0;
5424 E.Attrs = ParamAttr::None;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005425 (yyval.ArgList)->push_back(E);
Reid Spencer61c83e02006-08-18 08:43:06 +00005426 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005427 ;}
5428 break;
5429
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005430 case 245:
5431#line 2291 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005432 {
5433 (yyval.ArgList) = 0;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005434 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005435 ;}
5436 break;
5437
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005438 case 246:
5439#line 2297 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005440 {
5441 std::string FunctionName(*(yyvsp[(3) - (10)].StrVal));
5442 delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory!
Reid Spencer68a24bd2005-08-27 18:50:39 +00005443
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005444 // Check the function result for abstractness if this is a define. We should
5445 // have no abstract types at this point
Dan Gohmanf4423b12008-04-19 00:24:39 +00005446 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal)))
5447 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription());
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005448
Chris Lattnera925a142008-04-23 05:37:08 +00005449 if (!FunctionType::isValidReturnType(*(yyvsp[(2) - (10)].TypeVal)))
5450 GEN_ERROR("Invalid result type for LLVM function");
5451
Reid Spencer68a24bd2005-08-27 18:50:39 +00005452 std::vector<const Type*> ParamTypeList;
Chris Lattner58d74912008-03-12 17:45:29 +00005453 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005454 if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None)
5455 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(7) - (10)].ParamAttrs)));
5456 if ((yyvsp[(5) - (10)].ArgList)) { // If there are arguments...
Reid Spencer7b5d4662007-04-09 06:16:21 +00005457 unsigned index = 1;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005458 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); I != (yyvsp[(5) - (10)].ArgList)->end(); ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00005459 const Type* Ty = I->Ty->get();
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005460 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5461 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
Reid Spencer14310612006-12-31 05:40:51 +00005462 ParamTypeList.push_back(Ty);
Chris Lattner58d74912008-03-12 17:45:29 +00005463 if (Ty != Type::VoidTy && I->Attrs != ParamAttr::None)
5464 Attrs.push_back(ParamAttrsWithIndex::get(index, I->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00005465 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005466 }
5467
5468 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5469 if (isVarArg) ParamTypeList.pop_back();
5470
Chris Lattner58d74912008-03-12 17:45:29 +00005471 PAListPtr PAL;
Christopher Lamb5c104242007-04-22 20:09:11 +00005472 if (!Attrs.empty())
Chris Lattner58d74912008-03-12 17:45:29 +00005473 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Reid Spencer7b5d4662007-04-09 06:16:21 +00005474
Dan Gohmanf4423b12008-04-19 00:24:39 +00005475 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00005476 const PointerType *PFT = PointerType::getUnqual(FT);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005477 delete (yyvsp[(2) - (10)].TypeVal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005478
5479 ValID ID;
5480 if (!FunctionName.empty()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005481 ID = ValID::createGlobalName((char*)FunctionName.c_str());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005482 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00005483 ID = ValID::createGlobalID(CurModule.Values.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005484 }
5485
5486 Function *Fn = 0;
5487 // See if this function was forward referenced. If so, recycle the object.
5488 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5489 // Move the function to the end of the list, from whereever it was
5490 // previously inserted.
5491 Fn = cast<Function>(FWRef);
Chris Lattner58d74912008-03-12 17:45:29 +00005492 assert(Fn->getParamAttrs().isEmpty() &&
5493 "Forward reference has parameter attributes!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005494 CurModule.CurrentModule->getFunctionList().remove(Fn);
5495 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5496 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
Reid Spenceref9b9a72007-02-05 20:47:22 +00005497 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
Duncan Sandsdc024672007-11-27 13:23:08 +00005498 if (Fn->getFunctionType() != FT ) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00005499 // The existing function doesn't have the same type. This is an overload
5500 // error.
5501 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Duncan Sandsdc024672007-11-27 13:23:08 +00005502 } else if (Fn->getParamAttrs() != PAL) {
5503 // The existing function doesn't have the same parameter attributes.
5504 // This is an overload error.
5505 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Reid Spenceref9b9a72007-02-05 20:47:22 +00005506 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
Chris Lattner6cdc6822007-04-26 05:31:05 +00005507 // Neither the existing or the current function is a declaration and they
5508 // have the same name and same type. Clearly this is a redefinition.
5509 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
Duncan Sandsdc024672007-11-27 13:23:08 +00005510 } else if (Fn->isDeclaration()) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00005511 // Make sure to strip off any argument names so we can't get conflicts.
Reid Spencer68a24bd2005-08-27 18:50:39 +00005512 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5513 AI != AE; ++AI)
5514 AI->setName("");
Reid Spenceref9b9a72007-02-05 20:47:22 +00005515 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005516 } else { // Not already defined?
Gabor Greife64d2482008-04-06 23:07:54 +00005517 Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5518 CurModule.CurrentModule);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005519 InsertValue(Fn, CurModule.Values);
5520 }
5521
5522 CurFun.FunctionStart(Fn);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00005523
5524 if (CurFun.isDeclare) {
5525 // If we have declaration, always overwrite linkage. This will allow us to
5526 // correctly handle cases, when pointer to function is passed as argument to
5527 // another function.
5528 Fn->setLinkage(CurFun.Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005529 Fn->setVisibility(CurFun.Visibility);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00005530 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00005531 Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal));
Duncan Sandsdc024672007-11-27 13:23:08 +00005532 Fn->setParamAttrs(PAL);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005533 Fn->setAlignment((yyvsp[(9) - (10)].UIntVal));
5534 if ((yyvsp[(8) - (10)].StrVal)) {
5535 Fn->setSection(*(yyvsp[(8) - (10)].StrVal));
5536 delete (yyvsp[(8) - (10)].StrVal);
Gordon Henriksen80a75bf2007-12-10 03:18:06 +00005537 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00005538 if ((yyvsp[(10) - (10)].StrVal)) {
5539 Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str());
5540 delete (yyvsp[(10) - (10)].StrVal);
Chris Lattnere869eef2005-11-12 00:11:49 +00005541 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005542
5543 // Add all of the arguments we parsed to the function...
Dan Gohmanf4423b12008-04-19 00:24:39 +00005544 if ((yyvsp[(5) - (10)].ArgList)) { // Is null if empty...
Reid Spencer68a24bd2005-08-27 18:50:39 +00005545 if (isVarArg) { // Nuke the last entry
Dan Gohmanf4423b12008-04-19 00:24:39 +00005546 assert((yyvsp[(5) - (10)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (10)].ArgList)->back().Name == 0 &&
Reid Spencera9720f52007-02-05 17:04:00 +00005547 "Not a varargs marker!");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005548 delete (yyvsp[(5) - (10)].ArgList)->back().Ty;
5549 (yyvsp[(5) - (10)].ArgList)->pop_back(); // Delete the last entry
Reid Spencer68a24bd2005-08-27 18:50:39 +00005550 }
5551 Function::arg_iterator ArgIt = Fn->arg_begin();
Reid Spenceref9b9a72007-02-05 20:47:22 +00005552 Function::arg_iterator ArgEnd = Fn->arg_end();
Reid Spencer14310612006-12-31 05:40:51 +00005553 unsigned Idx = 1;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005554 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin();
5555 I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
Reid Spencer14310612006-12-31 05:40:51 +00005556 delete I->Ty; // Delete the typeholder...
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005557 setValueName(ArgIt, I->Name); // Insert arg into symtab...
Reid Spencer5b7e7532006-09-28 19:28:24 +00005558 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005559 InsertValue(ArgIt);
Reid Spencer14310612006-12-31 05:40:51 +00005560 Idx++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005561 }
Reid Spencera132e042006-12-03 05:46:11 +00005562
Dan Gohmanf4423b12008-04-19 00:24:39 +00005563 delete (yyvsp[(5) - (10)].ArgList); // We're now done with the argument list
Reid Spencer68a24bd2005-08-27 18:50:39 +00005564 }
Reid Spencer61c83e02006-08-18 08:43:06 +00005565 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005566;}
5567 break;
5568
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005569 case 249:
5570#line 2427 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005571 {
5572 (yyval.FunctionVal) = CurFun.CurrentFunction;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005573
5574 // Make sure that we keep track of the linkage type even if there was a
5575 // previous "declare".
Dan Gohmanf4423b12008-04-19 00:24:39 +00005576 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5577 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5578;}
5579 break;
5580
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005581 case 252:
5582#line 2438 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005583 {
5584 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005585 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005586;}
5587 break;
5588
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005589 case 253:
5590#line 2443 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005591 {
5592 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5593 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5594 (yyval.FunctionVal) = CurFun.CurrentFunction;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005595 CurFun.FunctionDone();
Reid Spencer41dff5e2007-01-26 08:05:27 +00005596 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005597 ;}
5598 break;
5599
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005600 case 254:
5601#line 2455 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005602 {
5603 (yyval.BoolVal) = false;
Reid Spencer61c83e02006-08-18 08:43:06 +00005604 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005605 ;}
5606 break;
5607
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005608 case 255:
5609#line 2459 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005610 {
5611 (yyval.BoolVal) = true;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005612 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005613 ;}
5614 break;
5615
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005616 case 256:
5617#line 2464 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005618 { // A reference to a direct constant
5619 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005620 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005621 ;}
5622 break;
5623
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005624 case 257:
5625#line 2468 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005626 {
5627 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005628 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005629 ;}
5630 break;
5631
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005632 case 258:
5633#line 2472 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner1913b942008-07-11 00:30:39 +00005634 { // arbitrary precision integer constants
5635 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), true);
5636 delete (yyvsp[(1) - (1)].APIntVal);
5637 CHECK_FOR_ERROR
5638 ;}
5639 break;
5640
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005641 case 259:
5642#line 2477 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner1913b942008-07-11 00:30:39 +00005643 { // arbitrary precision integer constants
5644 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), false);
5645 delete (yyvsp[(1) - (1)].APIntVal);
5646 CHECK_FOR_ERROR
5647 ;}
5648 break;
5649
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005650 case 260:
5651#line 2482 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005652 { // Perhaps it's an FP constant?
5653 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00005654 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005655 ;}
5656 break;
5657
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005658 case 261:
5659#line 2486 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005660 {
5661 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
Reid Spencere4d87aa2006-12-23 06:05:41 +00005662 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005663 ;}
5664 break;
5665
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005666 case 262:
5667#line 2490 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005668 {
5669 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00005670 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005671 ;}
5672 break;
5673
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005674 case 263:
5675#line 2494 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005676 {
5677 (yyval.ValIDVal) = ValID::createNull();
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00005678 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005679 ;}
5680 break;
5681
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005682 case 264:
5683#line 2498 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005684 {
5685 (yyval.ValIDVal) = ValID::createUndef();
Reid Spencer61c83e02006-08-18 08:43:06 +00005686 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005687 ;}
5688 break;
5689
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005690 case 265:
5691#line 2502 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005692 { // A vector zero constant.
5693 (yyval.ValIDVal) = ValID::createZeroInit();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005694 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005695 ;}
5696 break;
5697
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005698 case 266:
5699#line 2506 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005700 { // Nonempty unsized packed vector
5701 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
Dan Gohman180c1692008-06-23 18:43:26 +00005702 unsigned NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005703
5704 if (!ETy->isInteger() && !ETy->isFloatingPoint())
5705 GEN_ERROR("Invalid vector element type: " + ETy->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005706
Reid Spencer9d6565a2007-02-15 02:26:10 +00005707 VectorType* pt = VectorType::get(ETy, NumElements);
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005708 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(pt));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005709
5710 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00005711 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5712 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Reid Spencer61c83e02006-08-18 08:43:06 +00005713 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +00005714 ETy->getDescription() +"' as required!\nIt is of type '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00005715 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005716 }
5717
Dan Gohmanf4423b12008-04-19 00:24:39 +00005718 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5719 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
Reid Spencer832254e2007-02-02 02:16:23 +00005720 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005721 ;}
5722 break;
5723
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005724 case 267:
5725#line 2528 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005726 { // Nonempty unsized arr
5727 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
Dan Gohman180c1692008-06-23 18:43:26 +00005728 uint64_t NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005729
5730 if (!ETy->isFirstClassType())
5731 GEN_ERROR("Invalid array element type: " + ETy->getDescription());
5732
5733 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5734 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(ATy));
5735
5736 // Verify all elements are correct type!
5737 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5738 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
5739 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5740 ETy->getDescription() +"' as required!\nIt is of type '"+
5741 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5742 }
5743
5744 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, *(yyvsp[(2) - (3)].ConstVector)));
5745 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5746 CHECK_FOR_ERROR
5747 ;}
5748 break;
5749
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005750 case 268:
5751#line 2550 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005752 {
Dan Gohman180c1692008-06-23 18:43:26 +00005753 // Use undef instead of an array because it's inconvenient to determine
5754 // the element type at this point, there being no elements to examine.
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005755 (yyval.ValIDVal) = ValID::createUndef();
5756 CHECK_FOR_ERROR
5757 ;}
5758 break;
5759
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005760 case 269:
5761#line 2556 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005762 {
Dan Gohman180c1692008-06-23 18:43:26 +00005763 uint64_t NumElements = (yyvsp[(2) - (2)].StrVal)->length();
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005764 const Type *ETy = Type::Int8Ty;
5765
5766 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5767
5768 std::vector<Constant*> Vals;
5769 for (unsigned i = 0; i < (yyvsp[(2) - (2)].StrVal)->length(); ++i)
5770 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(2) - (2)].StrVal))[i]));
5771 delete (yyvsp[(2) - (2)].StrVal);
5772 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, Vals));
5773 CHECK_FOR_ERROR
5774 ;}
5775 break;
5776
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005777 case 270:
5778#line 2569 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005779 {
5780 std::vector<const Type*> Elements((yyvsp[(2) - (3)].ConstVector)->size());
5781 for (unsigned i = 0, e = (yyvsp[(2) - (3)].ConstVector)->size(); i != e; ++i)
5782 Elements[i] = (*(yyvsp[(2) - (3)].ConstVector))[i]->getType();
5783
5784 const StructType *STy = StructType::get(Elements);
5785 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5786
5787 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(2) - (3)].ConstVector)));
5788 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5789 CHECK_FOR_ERROR
5790 ;}
5791 break;
5792
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005793 case 271:
5794#line 2581 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005795 {
5796 const StructType *STy = StructType::get(std::vector<const Type*>());
5797 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5798 CHECK_FOR_ERROR
5799 ;}
5800 break;
5801
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005802 case 272:
5803#line 2586 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005804 {
5805 std::vector<const Type*> Elements((yyvsp[(3) - (5)].ConstVector)->size());
5806 for (unsigned i = 0, e = (yyvsp[(3) - (5)].ConstVector)->size(); i != e; ++i)
5807 Elements[i] = (*(yyvsp[(3) - (5)].ConstVector))[i]->getType();
5808
5809 const StructType *STy = StructType::get(Elements, /*isPacked=*/true);
5810 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5811
5812 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(3) - (5)].ConstVector)));
5813 delete PTy; delete (yyvsp[(3) - (5)].ConstVector);
5814 CHECK_FOR_ERROR
5815 ;}
5816 break;
5817
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005818 case 273:
5819#line 2598 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005820 {
5821 const StructType *STy = StructType::get(std::vector<const Type*>(),
5822 /*isPacked=*/true);
5823 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5824 CHECK_FOR_ERROR
5825 ;}
5826 break;
5827
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005828 case 274:
5829#line 2604 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005830 {
5831 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
Reid Spencer832254e2007-02-02 02:16:23 +00005832 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005833 ;}
5834 break;
5835
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005836 case 275:
5837#line 2608 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005838 {
5839 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5840 delete (yyvsp[(3) - (5)].StrVal);
5841 delete (yyvsp[(5) - (5)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005842 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005843 ;}
5844 break;
5845
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005846 case 276:
5847#line 2618 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005848 { // Is it an integer reference...?
5849 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005850 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005851 ;}
5852 break;
5853
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005854 case 277:
5855#line 2622 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005856 {
5857 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
Reid Spencer832254e2007-02-02 02:16:23 +00005858 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005859 ;}
5860 break;
5861
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005862 case 278:
5863#line 2626 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005864 { // Is it a named reference...?
5865 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5866 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005867 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005868 ;}
5869 break;
5870
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005871 case 279:
5872#line 2631 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005873 { // Is it a named reference...?
5874 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5875 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005876 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005877 ;}
5878 break;
5879
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005880 case 282:
5881#line 2644 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005882 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005883 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005884 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5885 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5886 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005887 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005888 ;}
5889 break;
5890
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005891 case 283:
5892#line 2653 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005893 {
5894 (yyval.ValueList) = new std::vector<Value *>();
5895 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
Devang Patel7990dc72008-02-20 22:40:23 +00005896 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005897 ;}
5898 break;
5899
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005900 case 284:
5901#line 2658 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005902 {
5903 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
Devang Patel7990dc72008-02-20 22:40:23 +00005904 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005905 ;}
5906 break;
5907
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005908 case 285:
5909#line 2663 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005910 {
5911 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005912 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005913 ;}
5914 break;
5915
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005916 case 286:
5917#line 2667 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005918 { // Do not allow functions with 0 basic blocks
5919 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005920 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005921 ;}
5922 break;
5923
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005924 case 287:
5925#line 2676 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005926 {
5927 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005928 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005929 InsertValue((yyvsp[(3) - (3)].TermInstVal));
5930 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
5931 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005932 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005933 ;}
5934 break;
5935
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005936 case 288:
5937#line 2685 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005938 {
5939 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005940 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5941 if (CI2->getParent() == 0)
Dan Gohmanf4423b12008-04-19 00:24:39 +00005942 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
5943 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
5944 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005945 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005946 ;}
5947 break;
Chris Lattner38905612008-02-19 04:36:25 +00005948
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005949 case 289:
5950#line 2694 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005951 { // Empty space between instruction lists
Chris Lattnercc81d152008-05-04 17:18:47 +00005952 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
Dan Gohmanf4423b12008-04-19 00:24:39 +00005953 CHECK_FOR_ERROR
5954 ;}
5955 break;
5956
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005957 case 290:
5958#line 2698 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnercc81d152008-05-04 17:18:47 +00005959 { // Labelled (named) basic block
5960 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
5961 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005962 CHECK_FOR_ERROR
Chris Lattnercc81d152008-05-04 17:18:47 +00005963
Dan Gohmanf4423b12008-04-19 00:24:39 +00005964 ;}
5965 break;
5966
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005967 case 291:
5968#line 2706 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005969 { // Return with a result...
5970 ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
5971 assert(!VL.empty() && "Invalid ret operands!");
Dan Gohman1a570242008-07-23 00:54:54 +00005972 const Type *ReturnType = CurFun.CurrentFunction->getReturnType();
5973 if (VL.size() > 1 ||
5974 (isa<StructType>(ReturnType) &&
5975 (VL.empty() || VL[0]->getType() != ReturnType))) {
5976 Value *RV = UndefValue::get(ReturnType);
5977 for (unsigned i = 0, e = VL.size(); i != e; ++i) {
5978 Instruction *I = InsertValueInst::Create(RV, VL[i], i, "mrv");
5979 ((yyvsp[(-1) - (2)].BasicBlockVal))->getInstList().push_back(I);
5980 RV = I;
5981 }
5982 (yyval.TermInstVal) = ReturnInst::Create(RV);
5983 } else {
5984 (yyval.TermInstVal) = ReturnInst::Create(VL[0]);
5985 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00005986 delete (yyvsp[(2) - (2)].ValueList);
5987 CHECK_FOR_ERROR
5988 ;}
5989 break;
5990
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005991 case 292:
5992#line 2726 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005993 { // Return with no result...
5994 (yyval.TermInstVal) = ReturnInst::Create();
5995 CHECK_FOR_ERROR
5996 ;}
5997 break;
5998
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005999 case 293:
6000#line 2730 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006001 { // Unconditional Branch...
6002 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
6003 CHECK_FOR_ERROR
6004 (yyval.TermInstVal) = BranchInst::Create(tmpBB);
6005 ;}
6006 break;
6007
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006008 case 294:
6009#line 2735 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006010 {
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006011 if (cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() != 1)
6012 GEN_ERROR("Branch condition must have type i1");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006013 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6014 CHECK_FOR_ERROR
6015 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
6016 CHECK_FOR_ERROR
6017 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
6018 CHECK_FOR_ERROR
6019 (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal);
6020 ;}
6021 break;
6022
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006023 case 295:
6024#line 2746 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006025 {
6026 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
6027 CHECK_FOR_ERROR
6028 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6029 CHECK_FOR_ERROR
6030 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
6031 (yyval.TermInstVal) = S;
6032
6033 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
6034 E = (yyvsp[(8) - (9)].JumpTable)->end();
Reid Spencer68a24bd2005-08-27 18:50:39 +00006035 for (; I != E; ++I) {
6036 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
6037 S->addCase(CI, I->second);
6038 else
Reid Spencerb5334b02007-02-05 10:18:06 +00006039 GEN_ERROR("Switch case is constant, but not a simple integer");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006040 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006041 delete (yyvsp[(8) - (9)].JumpTable);
Reid Spencer61c83e02006-08-18 08:43:06 +00006042 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006043 ;}
6044 break;
6045
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006046 case 296:
6047#line 2765 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006048 {
6049 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006050 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006051 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006052 CHECK_FOR_ERROR
Gabor Greife64d2482008-04-06 23:07:54 +00006053 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006054 (yyval.TermInstVal) = S;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006055 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006056 ;}
6057 break;
6058
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006059 case 297:
6060#line 2775 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006061 {
Reid Spencer3822ff52006-11-08 06:47:33 +00006062
Reid Spencer14310612006-12-31 05:40:51 +00006063 // Handle the short syntax
6064 const PointerType *PFTy = 0;
6065 const FunctionType *Ty = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006066 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
Reid Spencer68a24bd2005-08-27 18:50:39 +00006067 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6068 // Pull out the types of all of the arguments...
6069 std::vector<const Type*> ParamTypes;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006070 ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006071 for (; I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00006072 const Type *Ty = I->Val->getType();
6073 if (Ty == Type::VoidTy)
6074 GEN_ERROR("Short call syntax cannot be used with varargs");
6075 ParamTypes.push_back(Ty);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006076 }
Chris Lattnera925a142008-04-23 05:37:08 +00006077
6078 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (14)].TypeVal)))
6079 GEN_ERROR("Invalid result type for LLVM function");
6080
Dan Gohmanf4423b12008-04-19 00:24:39 +00006081 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00006082 PFTy = PointerType::getUnqual(Ty);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006083 }
6084
Dan Gohmanf4423b12008-04-19 00:24:39 +00006085 delete (yyvsp[(3) - (14)].TypeVal);
Reid Spencer66728ef2007-03-20 01:13:36 +00006086
Dan Gohmanf4423b12008-04-19 00:24:39 +00006087 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00006088 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006089 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006090 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006091 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00006092 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00006093
Chris Lattner58d74912008-03-12 17:45:29 +00006094 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006095 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None)
6096 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (14)].ParamAttrs)));
Duncan Sandsdc024672007-11-27 13:23:08 +00006097
Reid Spencer14310612006-12-31 05:40:51 +00006098 // Check the arguments
6099 ValueList Args;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006100 if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments?
Reid Spencer14310612006-12-31 05:40:51 +00006101 // Make sure no arguments is a good thing!
6102 if (Ty->getNumParams() != 0)
6103 GEN_ERROR("No arguments passed to a function that "
Reid Spencerb5334b02007-02-05 10:18:06 +00006104 "expects arguments");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006105 } else { // Has arguments?
6106 // Loop through FunctionType's arguments and ensure they are specified
6107 // correctly!
Reid Spencer68a24bd2005-08-27 18:50:39 +00006108 FunctionType::param_iterator I = Ty->param_begin();
6109 FunctionType::param_iterator E = Ty->param_end();
Dan Gohmanf4423b12008-04-19 00:24:39 +00006110 ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006111 unsigned index = 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00006112
Duncan Sandsdc024672007-11-27 13:23:08 +00006113 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006114 if (ArgI->Val->getType() != *I)
6115 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00006116 (*I)->getDescription() + "'");
Reid Spencer14310612006-12-31 05:40:51 +00006117 Args.push_back(ArgI->Val);
Chris Lattner58d74912008-03-12 17:45:29 +00006118 if (ArgI->Attrs != ParamAttr::None)
6119 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00006120 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00006121
Reid Spencer14310612006-12-31 05:40:51 +00006122 if (Ty->isVarArg()) {
6123 if (I == E)
Chris Lattner38905612008-02-19 04:36:25 +00006124 for (; ArgI != ArgE; ++ArgI, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006125 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner58d74912008-03-12 17:45:29 +00006126 if (ArgI->Attrs != ParamAttr::None)
6127 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Chris Lattner38905612008-02-19 04:36:25 +00006128 }
Reid Spencer14310612006-12-31 05:40:51 +00006129 } else if (I != E || ArgI != ArgE)
Reid Spencerb5334b02007-02-05 10:18:06 +00006130 GEN_ERROR("Invalid number of parameters detected");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006131 }
Reid Spencer14310612006-12-31 05:40:51 +00006132
Chris Lattner58d74912008-03-12 17:45:29 +00006133 PAListPtr PAL;
Duncan Sandsdc024672007-11-27 13:23:08 +00006134 if (!Attrs.empty())
Chris Lattner58d74912008-03-12 17:45:29 +00006135 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsdc024672007-11-27 13:23:08 +00006136
Reid Spencer14310612006-12-31 05:40:51 +00006137 // Create the InvokeInst
Dan Gohman041e2eb2008-05-15 19:50:34 +00006138 InvokeInst *II = InvokeInst::Create(V, Normal, Except,
6139 Args.begin(), Args.end());
Dan Gohmanf4423b12008-04-19 00:24:39 +00006140 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
Duncan Sandsdc024672007-11-27 13:23:08 +00006141 II->setParamAttrs(PAL);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006142 (yyval.TermInstVal) = II;
6143 delete (yyvsp[(6) - (14)].ParamList);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006144 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006145 ;}
6146 break;
6147
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006148 case 298:
6149#line 2860 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006150 {
6151 (yyval.TermInstVal) = new UnwindInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00006152 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006153 ;}
6154 break;
6155
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006156 case 299:
6157#line 2864 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006158 {
6159 (yyval.TermInstVal) = new UnreachableInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00006160 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006161 ;}
6162 break;
6163
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006164 case 300:
6165#line 2871 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006166 {
6167 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
6168 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006169 CHECK_FOR_ERROR
6170 if (V == 0)
6171 GEN_ERROR("May only switch on a constant pool value");
6172
Dan Gohmanf4423b12008-04-19 00:24:39 +00006173 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006174 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006175 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
6176 ;}
6177 break;
6178
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006179 case 301:
6180#line 2882 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006181 {
6182 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
6183 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006184 CHECK_FOR_ERROR
6185
6186 if (V == 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00006187 GEN_ERROR("May only switch on a constant pool value");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006188
Dan Gohmanf4423b12008-04-19 00:24:39 +00006189 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006190 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006191 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
6192 ;}
6193 break;
6194
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006195 case 302:
6196#line 2895 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006197 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006198 // Is this definition named?? if so, assign the name...
Dan Gohmanf4423b12008-04-19 00:24:39 +00006199 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006200 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006201 InsertValue((yyvsp[(2) - (2)].InstVal));
6202 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006203 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006204 ;}
6205 break;
6206
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006207 case 303:
6208#line 2905 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006209 { // Used for PHI nodes
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006210 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006211 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
6212 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
6213 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
Reid Spencer6f407902007-01-13 05:00:46 +00006214 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006215 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006216 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006217 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6218 delete (yyvsp[(1) - (6)].TypeVal);
6219 ;}
6220 break;
6221
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006222 case 304:
6223#line 2916 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006224 {
6225 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
6226 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006227 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006228 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006229 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006230 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6231 ;}
6232 break;
6233
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006234 case 305:
6235#line 2926 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006236 {
Duncan Sandsdc024672007-11-27 13:23:08 +00006237 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006238 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006239 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006240 // Used for call and invoke instructions
Dan Gohmanf4423b12008-04-19 00:24:39 +00006241 (yyval.ParamList) = new ParamList();
6242 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
6243 (yyval.ParamList)->push_back(E);
6244 delete (yyvsp[(1) - (4)].TypeVal);
Duncan Sandsdc024672007-11-27 13:23:08 +00006245 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006246 ;}
6247 break;
6248
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006249 case 306:
6250#line 2937 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006251 {
Duncan Sandsdc024672007-11-27 13:23:08 +00006252 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dale Johanneseneb57ea72007-11-05 21:20:28 +00006253 // Labels are only valid in ASMs
Dan Gohmanf4423b12008-04-19 00:24:39 +00006254 (yyval.ParamList) = new ParamList();
6255 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
6256 (yyval.ParamList)->push_back(E);
Duncan Sandsdc024672007-11-27 13:23:08 +00006257 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006258 ;}
6259 break;
6260
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006261 case 307:
6262#line 2945 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006263 {
Duncan Sandsdc024672007-11-27 13:23:08 +00006264 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006265 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006266 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6267 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
6268 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
6269 (yyval.ParamList)->push_back(E);
6270 delete (yyvsp[(3) - (6)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006271 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006272 ;}
6273 break;
6274
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006275 case 308:
6276#line 2955 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006277 {
Duncan Sandsdc024672007-11-27 13:23:08 +00006278 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf4423b12008-04-19 00:24:39 +00006279 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
6280 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
6281 (yyval.ParamList)->push_back(E);
Dale Johanneseneb57ea72007-11-05 21:20:28 +00006282 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006283 ;}
6284 break;
6285
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006286 case 309:
6287#line 2962 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006288 { (yyval.ParamList) = new ParamList(); ;}
6289 break;
6290
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006291 case 310:
6292#line 2965 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006293 { (yyval.ValueList) = new std::vector<Value*>(); ;}
6294 break;
6295
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006296 case 311:
6297#line 2966 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006298 {
6299 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
6300 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00006301 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006302 ;}
6303 break;
6304
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006305 case 312:
6306#line 2974 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006307 {
6308 (yyval.ConstantList) = new std::vector<unsigned>();
6309 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
6310 GEN_ERROR("Index " + utostr((yyvsp[(2) - (2)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6311 (yyval.ConstantList)->push_back((yyvsp[(2) - (2)].UInt64Val));
6312 ;}
6313 break;
6314
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006315 case 313:
6316#line 2980 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006317 {
6318 (yyval.ConstantList) = (yyvsp[(1) - (3)].ConstantList);
6319 if ((unsigned)(yyvsp[(3) - (3)].UInt64Val) != (yyvsp[(3) - (3)].UInt64Val))
6320 GEN_ERROR("Index " + utostr((yyvsp[(3) - (3)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6321 (yyval.ConstantList)->push_back((yyvsp[(3) - (3)].UInt64Val));
6322 CHECK_FOR_ERROR
6323 ;}
6324 break;
6325
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006326 case 314:
6327#line 2989 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006328 {
6329 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00006330 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006331 ;}
6332 break;
6333
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006334 case 315:
6335#line 2993 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006336 {
6337 (yyval.BoolVal) = false;
Andrew Lenharth6353e052006-12-08 18:07:09 +00006338 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006339 ;}
6340 break;
6341
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006342 case 316:
6343#line 2998 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006344 {
Reid Spencer14310612006-12-31 05:40:51 +00006345 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006346 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6347 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
6348 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006349 GEN_ERROR(
6350 "Arithmetic operator requires integer, FP, or packed operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006351 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006352 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006353 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006354 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006355 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006356 if ((yyval.InstVal) == 0)
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006357 GEN_ERROR("binary operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006358 delete (yyvsp[(2) - (5)].TypeVal);
6359 ;}
6360 break;
6361
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006362 case 317:
6363#line 3014 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006364 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006365 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006366 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6367 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006368 if (!isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
Dan Gohmanf4423b12008-04-19 00:24:39 +00006369 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006370 GEN_ERROR("Logical operator requires integral operands");
6371 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006372 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006373 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006374 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006375 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006376 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006377 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006378 GEN_ERROR("binary operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006379 delete (yyvsp[(2) - (5)].TypeVal);
6380 ;}
6381 break;
6382
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006383 case 318:
6384#line 3031 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006385 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006386 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006387 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6388 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006389 GEN_ERROR("Vector types not supported by icmp instruction");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006390 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006391 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006392 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006393 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006394 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006395 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006396 GEN_ERROR("icmp operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006397 delete (yyvsp[(3) - (6)].TypeVal);
6398 ;}
6399 break;
6400
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006401 case 319:
6402#line 3045 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006403 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006404 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006405 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6406 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006407 GEN_ERROR("Vector types not supported by fcmp instruction");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006408 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006409 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006410 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006411 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006412 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006413 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006414 GEN_ERROR("fcmp operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006415 delete (yyvsp[(3) - (6)].TypeVal);
6416 ;}
6417 break;
6418
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006419 case 320:
6420#line 3059 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00006421 {
6422 if (!UpRefs.empty())
6423 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6424 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6425 GEN_ERROR("Scalar types not supported by vicmp instruction");
6426 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6427 CHECK_FOR_ERROR
6428 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6429 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006430 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Nate Begemanac80ade2008-05-12 19:01:56 +00006431 if ((yyval.InstVal) == 0)
6432 GEN_ERROR("icmp operator returned null");
6433 delete (yyvsp[(3) - (6)].TypeVal);
6434 ;}
6435 break;
6436
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006437 case 321:
6438#line 3073 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00006439 {
6440 if (!UpRefs.empty())
6441 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6442 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6443 GEN_ERROR("Scalar types not supported by vfcmp instruction");
6444 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6445 CHECK_FOR_ERROR
6446 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6447 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006448 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Nate Begemanac80ade2008-05-12 19:01:56 +00006449 if ((yyval.InstVal) == 0)
6450 GEN_ERROR("fcmp operator returned null");
6451 delete (yyvsp[(3) - (6)].TypeVal);
6452 ;}
6453 break;
6454
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006455 case 322:
6456#line 3087 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006457 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006458 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006459 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6460 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6461 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6462 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006463 GEN_ERROR("invalid cast opcode for cast from '" +
6464 Val->getType()->getDescription() + "' to '" +
6465 DestTy->getDescription() + "'");
Dan Gohmane4977cf2008-05-23 01:55:30 +00006466 (yyval.InstVal) = CastInst::Create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006467 delete (yyvsp[(4) - (4)].TypeVal);
6468 ;}
6469 break;
6470
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006471 case 323:
6472#line 3099 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006473 {
6474 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006475 GEN_ERROR("select condition must be boolean");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006476 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006477 GEN_ERROR("select value types should match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006478 (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006479 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006480 ;}
6481 break;
6482
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006483 case 324:
6484#line 3107 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006485 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006486 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006487 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6488 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6489 delete (yyvsp[(4) - (4)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006490 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006491 ;}
6492 break;
6493
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006494 case 325:
6495#line 3114 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006496 {
6497 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006498 GEN_ERROR("Invalid extractelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006499 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006500 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006501 ;}
6502 break;
6503
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006504 case 326:
6505#line 3120 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006506 {
6507 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006508 GEN_ERROR("Invalid insertelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006509 (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006510 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006511 ;}
6512 break;
6513
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006514 case 327:
6515#line 3126 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006516 {
6517 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006518 GEN_ERROR("Invalid shufflevector operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006519 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006520 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006521 ;}
6522 break;
6523
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006524 case 328:
6525#line 3132 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006526 {
6527 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006528 if (!Ty->isFirstClassType())
6529 GEN_ERROR("PHI node operands must be of first class type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006530 (yyval.InstVal) = PHINode::Create(Ty);
6531 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6532 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6533 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006534 GEN_ERROR("All elements of a PHI node must be of the same type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006535 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6536 (yyvsp[(2) - (2)].PHIList)->pop_front();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006537 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006538 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006539 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006540 ;}
6541 break;
6542
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006543 case 329:
6544#line 3148 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006545 {
Reid Spencer14310612006-12-31 05:40:51 +00006546
6547 // Handle the short syntax
Andrew Lenharth6353e052006-12-08 18:07:09 +00006548 const PointerType *PFTy = 0;
6549 const FunctionType *Ty = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006550 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
Andrew Lenharth6353e052006-12-08 18:07:09 +00006551 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6552 // Pull out the types of all of the arguments...
6553 std::vector<const Type*> ParamTypes;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006554 ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006555 for (; I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00006556 const Type *Ty = I->Val->getType();
6557 if (Ty == Type::VoidTy)
6558 GEN_ERROR("Short call syntax cannot be used with varargs");
6559 ParamTypes.push_back(Ty);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006560 }
Chris Lattnera925a142008-04-23 05:37:08 +00006561
6562 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (8)].TypeVal)))
6563 GEN_ERROR("Invalid result type for LLVM function");
6564
Dan Gohmanf4423b12008-04-19 00:24:39 +00006565 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00006566 PFTy = PointerType::getUnqual(Ty);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006567 }
Chris Lattner6cdc6822007-04-26 05:31:05 +00006568
Dan Gohmanf4423b12008-04-19 00:24:39 +00006569 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00006570 CHECK_FOR_ERROR
Chris Lattner6cdc6822007-04-26 05:31:05 +00006571
Reid Spencer7780acb2007-04-16 06:56:07 +00006572 // Check for call to invalid intrinsic to avoid crashing later.
6573 if (Function *theF = dyn_cast<Function>(V)) {
Reid Spencered48de22007-04-16 22:02:23 +00006574 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
Reid Spencer36fdde12007-04-16 20:35:38 +00006575 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6576 !theF->getIntrinsicID(true))
Reid Spencer7780acb2007-04-16 06:56:07 +00006577 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6578 theF->getName() + "'");
6579 }
6580
Duncan Sandsdc024672007-11-27 13:23:08 +00006581 // Set up the ParamAttrs for the function
Chris Lattner58d74912008-03-12 17:45:29 +00006582 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006583 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None)
6584 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (8)].ParamAttrs)));
Reid Spencer14310612006-12-31 05:40:51 +00006585 // Check the arguments
6586 ValueList Args;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006587 if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments?
Andrew Lenharth6353e052006-12-08 18:07:09 +00006588 // Make sure no arguments is a good thing!
6589 if (Ty->getNumParams() != 0)
6590 GEN_ERROR("No arguments passed to a function that "
Reid Spencerb5334b02007-02-05 10:18:06 +00006591 "expects arguments");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006592 } else { // Has arguments?
6593 // Loop through FunctionType's arguments and ensure they are specified
Duncan Sandsdc024672007-11-27 13:23:08 +00006594 // correctly. Also, gather any parameter attributes.
Andrew Lenharth6353e052006-12-08 18:07:09 +00006595 FunctionType::param_iterator I = Ty->param_begin();
6596 FunctionType::param_iterator E = Ty->param_end();
Dan Gohmanf4423b12008-04-19 00:24:39 +00006597 ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006598 unsigned index = 1;
Andrew Lenharth6353e052006-12-08 18:07:09 +00006599
Duncan Sandsdc024672007-11-27 13:23:08 +00006600 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006601 if (ArgI->Val->getType() != *I)
6602 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00006603 (*I)->getDescription() + "'");
Reid Spencer14310612006-12-31 05:40:51 +00006604 Args.push_back(ArgI->Val);
Chris Lattner58d74912008-03-12 17:45:29 +00006605 if (ArgI->Attrs != ParamAttr::None)
6606 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00006607 }
6608 if (Ty->isVarArg()) {
6609 if (I == E)
Chris Lattner38905612008-02-19 04:36:25 +00006610 for (; ArgI != ArgE; ++ArgI, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006611 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner58d74912008-03-12 17:45:29 +00006612 if (ArgI->Attrs != ParamAttr::None)
6613 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Chris Lattner38905612008-02-19 04:36:25 +00006614 }
Reid Spencer14310612006-12-31 05:40:51 +00006615 } else if (I != E || ArgI != ArgE)
Reid Spencerb5334b02007-02-05 10:18:06 +00006616 GEN_ERROR("Invalid number of parameters detected");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006617 }
Duncan Sandsdc024672007-11-27 13:23:08 +00006618
6619 // Finish off the ParamAttrs and check them
Chris Lattner58d74912008-03-12 17:45:29 +00006620 PAListPtr PAL;
Duncan Sandsdc024672007-11-27 13:23:08 +00006621 if (!Attrs.empty())
Chris Lattner58d74912008-03-12 17:45:29 +00006622 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsdc024672007-11-27 13:23:08 +00006623
Reid Spencer14310612006-12-31 05:40:51 +00006624 // Create the call node
Gabor Greife64d2482008-04-06 23:07:54 +00006625 CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
Dan Gohmanf4423b12008-04-19 00:24:39 +00006626 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6627 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
Duncan Sandsdc024672007-11-27 13:23:08 +00006628 CI->setParamAttrs(PAL);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006629 (yyval.InstVal) = CI;
6630 delete (yyvsp[(6) - (8)].ParamList);
6631 delete (yyvsp[(3) - (8)].TypeVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00006632 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006633 ;}
6634 break;
6635
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006636 case 330:
6637#line 3237 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006638 {
6639 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00006640 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006641 ;}
6642 break;
6643
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006644 case 331:
6645#line 3242 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006646 {
6647 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00006648 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006649 ;}
6650 break;
6651
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006652 case 332:
6653#line 3246 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006654 {
6655 (yyval.BoolVal) = false;
Reid Spencer61c83e02006-08-18 08:43:06 +00006656 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006657 ;}
6658 break;
6659
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006660 case 333:
6661#line 3253 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006662 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006663 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006664 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6665 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6666 delete (yyvsp[(2) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006667 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006668 ;}
6669 break;
6670
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006671 case 334:
6672#line 3260 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006673 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006674 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006675 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006676 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6677 GEN_ERROR("Malloc array size is not a 32-bit integer!");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006678 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00006679 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006680 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6681 delete (yyvsp[(2) - (6)].TypeVal);
6682 ;}
6683 break;
6684
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006685 case 335:
6686#line 3270 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006687 {
Reid Spencer14310612006-12-31 05:40:51 +00006688 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006689 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6690 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6691 delete (yyvsp[(2) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006692 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006693 ;}
6694 break;
6695
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006696 case 336:
6697#line 3277 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006698 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006699 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006700 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006701 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6702 GEN_ERROR("Alloca array size is not a 32-bit integer!");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006703 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006704 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006705 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6706 delete (yyvsp[(2) - (6)].TypeVal);
6707 ;}
6708 break;
6709
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006710 case 337:
6711#line 3287 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006712 {
6713 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006714 GEN_ERROR("Trying to free nonpointer type " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006715 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6716 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006717 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006718 ;}
6719 break;
6720
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006721 case 338:
6722#line 3295 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006723 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006724 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006725 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6726 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006727 GEN_ERROR("Can't load from nonpointer type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006728 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6729 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006730 GEN_ERROR("Can't load from pointer of non-first-class type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006731 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6732 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006733 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006734 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6735 delete (yyvsp[(3) - (5)].TypeVal);
6736 ;}
6737 break;
6738
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006739 case 339:
6740#line 3309 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006741 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006742 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006743 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6744 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006745 if (!PT)
6746 GEN_ERROR("Can't store to a nonpointer type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006747 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006748 const Type *ElTy = PT->getElementType();
Dan Gohmanf4423b12008-04-19 00:24:39 +00006749 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6750 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006751 "' into space of type '" + ElTy->getDescription() + "'");
6752
Dan Gohmanf4423b12008-04-19 00:24:39 +00006753 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006754 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006755 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6756 delete (yyvsp[(5) - (7)].TypeVal);
6757 ;}
6758 break;
6759
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006760 case 340:
6761#line 3326 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006762 {
Dan Gohman1a570242008-07-23 00:54:54 +00006763 if (!UpRefs.empty())
6764 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6765 if (!isa<StructType>((yyvsp[(2) - (5)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (5)].TypeVal)->get()))
6766 GEN_ERROR("getresult insn requires an aggregate operand");
6767 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].UInt64Val)))
6768 GEN_ERROR("Invalid getresult index for type '" +
6769 (*(yyvsp[(2) - (5)].TypeVal))->getDescription()+ "'");
6770
6771 Value *tmpVal = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Devang Patel5a970972008-02-19 22:27:01 +00006772 CHECK_FOR_ERROR
Dan Gohman1a570242008-07-23 00:54:54 +00006773 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(5) - (5)].UInt64Val));
6774 delete (yyvsp[(2) - (5)].TypeVal);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006775 ;}
6776 break;
6777
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006778 case 341:
6779#line 3340 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006780 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006781 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006782 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6783 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
Reid Spencerb5334b02007-02-05 10:18:06 +00006784 GEN_ERROR("getelementptr insn requires pointer operand");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006785
Dan Gohman041e2eb2008-05-15 19:50:34 +00006786 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()))
Reid Spencer61c83e02006-08-18 08:43:06 +00006787 GEN_ERROR("Invalid getelementptr indices for type '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006788 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6789 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00006790 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006791 (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6792 delete (yyvsp[(2) - (4)].TypeVal);
6793 delete (yyvsp[(4) - (4)].ValueList);
6794 ;}
6795 break;
Reid Spencer7780acb2007-04-16 06:56:07 +00006796
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006797 case 342:
6798#line 3355 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00006799 {
6800 if (!UpRefs.empty())
6801 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6802 if (!isa<StructType>((yyvsp[(2) - (4)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (4)].TypeVal)->get()))
6803 GEN_ERROR("extractvalue insn requires an aggregate operand");
6804
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006805 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end()))
Dan Gohmane4977cf2008-05-23 01:55:30 +00006806 GEN_ERROR("Invalid extractvalue indices for type '" +
6807 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6808 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6809 CHECK_FOR_ERROR
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006810 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end());
Dan Gohmane4977cf2008-05-23 01:55:30 +00006811 delete (yyvsp[(2) - (4)].TypeVal);
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006812 delete (yyvsp[(4) - (4)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00006813 ;}
6814 break;
6815
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006816 case 343:
6817#line 3370 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00006818 {
6819 if (!UpRefs.empty())
6820 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription());
6821 if (!isa<StructType>((yyvsp[(2) - (7)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (7)].TypeVal)->get()))
6822 GEN_ERROR("extractvalue insn requires an aggregate operand");
6823
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006824 if (ExtractValueInst::getIndexedType(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end()) != (yyvsp[(5) - (7)].TypeVal)->get())
Dan Gohmane4977cf2008-05-23 01:55:30 +00006825 GEN_ERROR("Invalid insertvalue indices for type '" +
6826 (*(yyvsp[(2) - (7)].TypeVal))->getDescription()+ "'");
6827 Value* aggVal = getVal(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(3) - (7)].ValIDVal));
6828 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
6829 CHECK_FOR_ERROR
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006830 (yyval.InstVal) = InsertValueInst::Create(aggVal, tmpVal, (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end());
Dan Gohmane4977cf2008-05-23 01:55:30 +00006831 delete (yyvsp[(2) - (7)].TypeVal);
6832 delete (yyvsp[(5) - (7)].TypeVal);
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006833 delete (yyvsp[(7) - (7)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00006834 ;}
6835 break;
6836
Dan Gohmanf4423b12008-04-19 00:24:39 +00006837
6838/* Line 1267 of yacc.c. */
Dale Johannesen20ab78b2008-08-13 18:41:46 +00006839#line 6840 "llvmAsmParser.tab.c"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006840 default: break;
Dale Johannesencdd509a2007-09-07 21:07:57 +00006841 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006842 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6843
6844 YYPOPSTACK (yylen);
6845 yylen = 0;
6846 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006847
6848 *++yyvsp = yyval;
6849
6850
Dan Gohmanf4423b12008-04-19 00:24:39 +00006851 /* Now `shift' the result of the reduction. Determine what state
6852 that goes to, based on the state we popped back to and the rule
6853 number reduced by. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00006854
6855 yyn = yyr1[yyn];
6856
Dan Gohmanf4423b12008-04-19 00:24:39 +00006857 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6858 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00006859 yystate = yytable[yystate];
6860 else
Dan Gohmanf4423b12008-04-19 00:24:39 +00006861 yystate = yydefgoto[yyn - YYNTOKENS];
Reid Spencer68a24bd2005-08-27 18:50:39 +00006862
6863 goto yynewstate;
6864
6865
Dan Gohmanf4423b12008-04-19 00:24:39 +00006866/*------------------------------------.
6867| yyerrlab -- here on detecting error |
6868`------------------------------------*/
6869yyerrlab:
6870 /* If not already recovering from an error, report this error. */
6871 if (!yyerrstatus)
Reid Spencer68a24bd2005-08-27 18:50:39 +00006872 {
6873 ++yynerrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006874#if ! YYERROR_VERBOSE
6875 yyerror (YY_("syntax error"));
6876#else
6877 {
6878 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
6879 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
6880 {
6881 YYSIZE_T yyalloc = 2 * yysize;
6882 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
6883 yyalloc = YYSTACK_ALLOC_MAXIMUM;
6884 if (yymsg != yymsgbuf)
6885 YYSTACK_FREE (yymsg);
6886 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
6887 if (yymsg)
6888 yymsg_alloc = yyalloc;
6889 else
6890 {
6891 yymsg = yymsgbuf;
6892 yymsg_alloc = sizeof yymsgbuf;
6893 }
6894 }
Dale Johannesencdd509a2007-09-07 21:07:57 +00006895
Dan Gohmanf4423b12008-04-19 00:24:39 +00006896 if (0 < yysize && yysize <= yymsg_alloc)
6897 {
6898 (void) yysyntax_error (yymsg, yystate, yychar);
6899 yyerror (yymsg);
6900 }
6901 else
6902 {
6903 yyerror (YY_("syntax error"));
6904 if (yysize != 0)
6905 goto yyexhaustedlab;
6906 }
6907 }
6908#endif
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006909 }
6910
Dan Gohmanf4423b12008-04-19 00:24:39 +00006911
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006912
6913 if (yyerrstatus == 3)
6914 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00006915 /* If just tried and failed to reuse look-ahead token after an
6916 error, discard it. */
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006917
Dan Gohmanf4423b12008-04-19 00:24:39 +00006918 if (yychar <= YYEOF)
6919 {
6920 /* Return failure if at end of input. */
6921 if (yychar == YYEOF)
6922 YYABORT;
6923 }
6924 else
6925 {
6926 yydestruct ("Error: discarding",
6927 yytoken, &yylval);
6928 yychar = YYEMPTY;
6929 }
6930 }
6931
6932 /* Else will try to reuse look-ahead token after shifting the error
6933 token. */
6934 goto yyerrlab1;
6935
6936
6937/*---------------------------------------------------.
6938| yyerrorlab -- error raised explicitly by YYERROR. |
6939`---------------------------------------------------*/
6940yyerrorlab:
6941
6942 /* Pacify compilers like GCC when the user code never invokes
6943 YYERROR and the label yyerrorlab therefore never appears in user
6944 code. */
6945 if (/*CONSTCOND*/ 0)
6946 goto yyerrorlab;
6947
6948 /* Do not reclaim the symbols of the rule which action triggered
6949 this YYERROR. */
6950 YYPOPSTACK (yylen);
6951 yylen = 0;
6952 YY_STACK_PRINT (yyss, yyssp);
6953 yystate = *yyssp;
6954 goto yyerrlab1;
6955
6956
6957/*-------------------------------------------------------------.
6958| yyerrlab1 -- common code for both syntax error and YYERROR. |
6959`-------------------------------------------------------------*/
6960yyerrlab1:
6961 yyerrstatus = 3; /* Each real token shifted decrements this. */
6962
6963 for (;;)
6964 {
6965 yyn = yypact[yystate];
6966 if (yyn != YYPACT_NINF)
6967 {
6968 yyn += YYTERROR;
6969 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6970 {
6971 yyn = yytable[yyn];
6972 if (0 < yyn)
6973 break;
6974 }
6975 }
6976
6977 /* Pop the current state because it cannot handle the error token. */
6978 if (yyssp == yyss)
Reid Spencer68a24bd2005-08-27 18:50:39 +00006979 YYABORT;
6980
Dale Johannesencdd509a2007-09-07 21:07:57 +00006981
Dan Gohmanf4423b12008-04-19 00:24:39 +00006982 yydestruct ("Error: popping",
6983 yystos[yystate], yyvsp);
6984 YYPOPSTACK (1);
6985 yystate = *yyssp;
6986 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006987 }
6988
6989 if (yyn == YYFINAL)
6990 YYACCEPT;
6991
Reid Spencer68a24bd2005-08-27 18:50:39 +00006992 *++yyvsp = yylval;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006993
6994
6995 /* Shift the error token. */
6996 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spencerb8f85052007-07-31 03:50:36 +00006997
Reid Spencer68a24bd2005-08-27 18:50:39 +00006998 yystate = yyn;
6999 goto yynewstate;
7000
Gabor Greife64d2482008-04-06 23:07:54 +00007001
Dan Gohmanf4423b12008-04-19 00:24:39 +00007002/*-------------------------------------.
7003| yyacceptlab -- YYACCEPT comes here. |
7004`-------------------------------------*/
7005yyacceptlab:
7006 yyresult = 0;
7007 goto yyreturn;
7008
7009/*-----------------------------------.
7010| yyabortlab -- YYABORT comes here. |
7011`-----------------------------------*/
7012yyabortlab:
7013 yyresult = 1;
7014 goto yyreturn;
7015
7016#ifndef yyoverflow
7017/*-------------------------------------------------.
7018| yyexhaustedlab -- memory exhaustion comes here. |
7019`-------------------------------------------------*/
7020yyexhaustedlab:
7021 yyerror (YY_("memory exhausted"));
7022 yyresult = 2;
7023 /* Fall through. */
Chris Lattner38905612008-02-19 04:36:25 +00007024#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00007025
7026yyreturn:
7027 if (yychar != YYEOF && yychar != YYEMPTY)
7028 yydestruct ("Cleanup: discarding lookahead",
7029 yytoken, &yylval);
7030 /* Do not reclaim the symbols of the rule which action triggered
7031 this YYABORT or YYACCEPT. */
7032 YYPOPSTACK (yylen);
7033 YY_STACK_PRINT (yyss, yyssp);
7034 while (yyssp != yyss)
7035 {
7036 yydestruct ("Cleanup: popping",
7037 yystos[*yyssp], yyvsp);
7038 YYPOPSTACK (1);
Gabor Greife64d2482008-04-06 23:07:54 +00007039 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00007040#ifndef yyoverflow
7041 if (yyss != yyssa)
7042 YYSTACK_FREE (yyss);
7043#endif
7044#if YYERROR_VERBOSE
7045 if (yymsg != yymsgbuf)
7046 YYSTACK_FREE (yymsg);
7047#endif
7048 /* Make sure YYID is used. */
7049 return YYID (yyresult);
Reid Spencer68a24bd2005-08-27 18:50:39 +00007050}
Dan Gohmanf4423b12008-04-19 00:24:39 +00007051
7052
Dale Johannesen20ab78b2008-08-13 18:41:46 +00007053#line 3389 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y"
Reid Spencer61c83e02006-08-18 08:43:06 +00007054
7055
Reid Spencer14310612006-12-31 05:40:51 +00007056// common code from the two 'RunVMAsmParser' functions
7057static Module* RunParser(Module * M) {
Reid Spencer14310612006-12-31 05:40:51 +00007058 CurModule.CurrentModule = M;
Reid Spencer14310612006-12-31 05:40:51 +00007059 // Check to make sure the parser succeeded
7060 if (yyparse()) {
7061 if (ParserResult)
7062 delete ParserResult;
7063 return 0;
7064 }
7065
Reid Spencer0d60b5a2007-03-30 01:37:39 +00007066 // Emit an error if there are any unresolved types left.
7067 if (!CurModule.LateResolveTypes.empty()) {
7068 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
7069 if (DID.Type == ValID::LocalName) {
7070 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
7071 } else {
7072 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
7073 }
7074 if (ParserResult)
7075 delete ParserResult;
7076 return 0;
7077 }
7078
7079 // Emit an error if there are any unresolved values left.
7080 if (!CurModule.LateResolveValues.empty()) {
7081 Value *V = CurModule.LateResolveValues.back();
7082 std::map<Value*, std::pair<ValID, int> >::iterator I =
7083 CurModule.PlaceHolderInfo.find(V);
7084
7085 if (I != CurModule.PlaceHolderInfo.end()) {
7086 ValID &DID = I->second.first;
7087 if (DID.Type == ValID::LocalName) {
7088 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
7089 } else {
7090 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
7091 }
7092 if (ParserResult)
7093 delete ParserResult;
7094 return 0;
7095 }
7096 }
7097
Reid Spencer14310612006-12-31 05:40:51 +00007098 // Check to make sure that parsing produced a result
7099 if (!ParserResult)
7100 return 0;
7101
7102 // Reset ParserResult variable while saving its value for the result.
7103 Module *Result = ParserResult;
7104 ParserResult = 0;
7105
7106 return Result;
7107}
7108
Reid Spencer61c83e02006-08-18 08:43:06 +00007109void llvm::GenerateError(const std::string &message, int LineNo) {
Duncan Sandsdc024672007-11-27 13:23:08 +00007110 if (LineNo == -1) LineNo = LLLgetLineNo();
Reid Spencer61c83e02006-08-18 08:43:06 +00007111 // TODO: column number in exception
7112 if (TheParseError)
Duncan Sandsdc024672007-11-27 13:23:08 +00007113 TheParseError->setError(LLLgetFilename(), message, LineNo);
Reid Spencer61c83e02006-08-18 08:43:06 +00007114 TriggerError = 1;
7115}
Reid Spencer68a24bd2005-08-27 18:50:39 +00007116
7117int yyerror(const char *ErrorMsg) {
Duncan Sandsdc024672007-11-27 13:23:08 +00007118 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
Reid Spenceref9b9a72007-02-05 20:47:22 +00007119 std::string errMsg = where + "error: " + std::string(ErrorMsg);
Duncan Sandsdc024672007-11-27 13:23:08 +00007120 if (yychar != YYEMPTY && yychar != 0) {
7121 errMsg += " while reading token: '";
7122 errMsg += std::string(LLLgetTokenStart(),
7123 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
7124 }
Reid Spencer61c83e02006-08-18 08:43:06 +00007125 GenerateError(errMsg);
Reid Spencer68a24bd2005-08-27 18:50:39 +00007126 return 0;
7127}
Dan Gohmanf4423b12008-04-19 00:24:39 +00007128