blob: 80d105908585da86ca4d1841d34513d45ef5c4f2 [file] [log] [blame]
Dan Gohmanf4423b12008-04-19 00:24:39 +00001/* A Bison parser, made by GNU Bison 2.3. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002
Dan Gohmanf4423b12008-04-19 00:24:39 +00003/* Skeleton implementation for Bison's Yacc-like parsers in C
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004
Dan Gohmanf4423b12008-04-19 00:24:39 +00005 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
Anton Korobeynikov178a3522007-01-12 19:22:51 +00007
Dan Gohmanf4423b12008-04-19 00:24:39 +00008 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
22
23/* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
32
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
35
36/* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
38
39/* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
45
46/* Identify Bison output. */
47#define YYBISON 1
48
49/* Bison version. */
50#define YYBISON_VERSION "2.3"
51
52/* Skeleton name. */
53#define YYSKELETON_NAME "yacc.c"
54
55/* Pure parsers. */
56#define YYPURE 0
57
58/* Using locations. */
59#define YYLSP_NEEDED 0
60
61/* Substitute the variable and function names. */
Reid Spencer68a24bd2005-08-27 18:50:39 +000062#define yyparse llvmAsmparse
Dan Gohmanf4423b12008-04-19 00:24:39 +000063#define yylex llvmAsmlex
Reid Spencer68a24bd2005-08-27 18:50:39 +000064#define yyerror llvmAsmerror
Dan Gohmanf4423b12008-04-19 00:24:39 +000065#define yylval llvmAsmlval
66#define yychar llvmAsmchar
Reid Spencer68a24bd2005-08-27 18:50:39 +000067#define yydebug llvmAsmdebug
68#define yynerrs llvmAsmnerrs
69
Dan Gohmanf4423b12008-04-19 00:24:39 +000070
71/* Tokens. */
72#ifndef YYTOKENTYPE
73# define YYTOKENTYPE
74 /* Put the tokens into the symbol table, so that GDB and other debuggers
75 know about them. */
76 enum yytokentype {
77 ESINT64VAL = 258,
78 EUINT64VAL = 259,
79 ESAPINTVAL = 260,
80 EUAPINTVAL = 261,
81 LOCALVAL_ID = 262,
82 GLOBALVAL_ID = 263,
83 FPVAL = 264,
84 VOID = 265,
85 INTTYPE = 266,
86 FLOAT = 267,
87 DOUBLE = 268,
88 X86_FP80 = 269,
89 FP128 = 270,
90 PPC_FP128 = 271,
91 LABEL = 272,
92 TYPE = 273,
93 LOCALVAR = 274,
94 GLOBALVAR = 275,
95 LABELSTR = 276,
96 STRINGCONSTANT = 277,
97 ATSTRINGCONSTANT = 278,
98 PCTSTRINGCONSTANT = 279,
99 ZEROINITIALIZER = 280,
100 TRUETOK = 281,
101 FALSETOK = 282,
102 BEGINTOK = 283,
103 ENDTOK = 284,
104 DECLARE = 285,
105 DEFINE = 286,
106 GLOBAL = 287,
107 CONSTANT = 288,
108 SECTION = 289,
109 ALIAS = 290,
110 VOLATILE = 291,
111 THREAD_LOCAL = 292,
112 TO = 293,
113 DOTDOTDOT = 294,
114 NULL_TOK = 295,
115 UNDEF = 296,
116 INTERNAL = 297,
117 LINKONCE = 298,
118 WEAK = 299,
119 APPENDING = 300,
120 DLLIMPORT = 301,
121 DLLEXPORT = 302,
122 EXTERN_WEAK = 303,
Dale Johannesenc7071cc2008-05-14 20:13:36 +0000123 COMMON = 304,
124 OPAQUE = 305,
125 EXTERNAL = 306,
126 TARGET = 307,
127 TRIPLE = 308,
128 ALIGN = 309,
129 ADDRSPACE = 310,
130 DEPLIBS = 311,
131 CALL = 312,
132 TAIL = 313,
133 ASM_TOK = 314,
134 MODULE = 315,
135 SIDEEFFECT = 316,
136 CC_TOK = 317,
137 CCC_TOK = 318,
138 FASTCC_TOK = 319,
139 COLDCC_TOK = 320,
140 X86_STDCALLCC_TOK = 321,
141 X86_FASTCALLCC_TOK = 322,
Dale Johannesen20ab78b2008-08-13 18:41:46 +0000142 X86_SSECALLCC_TOK = 323,
143 DATALAYOUT = 324,
144 RET = 325,
145 BR = 326,
146 SWITCH = 327,
147 INVOKE = 328,
148 UNWIND = 329,
149 UNREACHABLE = 330,
150 ADD = 331,
151 SUB = 332,
152 MUL = 333,
153 UDIV = 334,
154 SDIV = 335,
155 FDIV = 336,
156 UREM = 337,
157 SREM = 338,
158 FREM = 339,
159 AND = 340,
160 OR = 341,
161 XOR = 342,
162 SHL = 343,
163 LSHR = 344,
164 ASHR = 345,
165 ICMP = 346,
166 FCMP = 347,
167 VICMP = 348,
168 VFCMP = 349,
169 EQ = 350,
170 NE = 351,
171 SLT = 352,
172 SGT = 353,
173 SLE = 354,
174 SGE = 355,
175 ULT = 356,
176 UGT = 357,
177 ULE = 358,
178 UGE = 359,
179 OEQ = 360,
180 ONE = 361,
181 OLT = 362,
182 OGT = 363,
183 OLE = 364,
184 OGE = 365,
185 ORD = 366,
186 UNO = 367,
187 UEQ = 368,
188 UNE = 369,
189 MALLOC = 370,
190 ALLOCA = 371,
191 FREE = 372,
192 LOAD = 373,
193 STORE = 374,
194 GETELEMENTPTR = 375,
195 TRUNC = 376,
196 ZEXT = 377,
197 SEXT = 378,
198 FPTRUNC = 379,
199 FPEXT = 380,
200 BITCAST = 381,
201 UITOFP = 382,
202 SITOFP = 383,
203 FPTOUI = 384,
204 FPTOSI = 385,
205 INTTOPTR = 386,
206 PTRTOINT = 387,
207 PHI_TOK = 388,
208 SELECT = 389,
209 VAARG = 390,
210 EXTRACTELEMENT = 391,
211 INSERTELEMENT = 392,
212 SHUFFLEVECTOR = 393,
213 GETRESULT = 394,
214 EXTRACTVALUE = 395,
215 INSERTVALUE = 396,
216 SIGNEXT = 397,
217 ZEROEXT = 398,
218 NORETURN = 399,
219 INREG = 400,
220 SRET = 401,
221 NOUNWIND = 402,
222 NOALIAS = 403,
223 BYVAL = 404,
224 NEST = 405,
225 READNONE = 406,
226 READONLY = 407,
227 GC = 408,
Devang Pateld4980812008-09-02 20:52:40 +0000228 FNNOTE = 409,
229 INLINE = 410,
230 ALWAYS = 411,
231 NEVER = 412,
232 OPTIMIZEFORSIZE = 413,
233 DEFAULT = 414,
234 HIDDEN = 415,
235 PROTECTED = 416
Dan Gohmanf4423b12008-04-19 00:24:39 +0000236 };
237#endif
238/* Tokens. */
239#define ESINT64VAL 258
240#define EUINT64VAL 259
241#define ESAPINTVAL 260
242#define EUAPINTVAL 261
243#define LOCALVAL_ID 262
244#define GLOBALVAL_ID 263
245#define FPVAL 264
246#define VOID 265
247#define INTTYPE 266
248#define FLOAT 267
249#define DOUBLE 268
250#define X86_FP80 269
251#define FP128 270
252#define PPC_FP128 271
253#define LABEL 272
254#define TYPE 273
255#define LOCALVAR 274
256#define GLOBALVAR 275
257#define LABELSTR 276
258#define STRINGCONSTANT 277
259#define ATSTRINGCONSTANT 278
260#define PCTSTRINGCONSTANT 279
261#define ZEROINITIALIZER 280
262#define TRUETOK 281
263#define FALSETOK 282
264#define BEGINTOK 283
265#define ENDTOK 284
266#define DECLARE 285
267#define DEFINE 286
268#define GLOBAL 287
269#define CONSTANT 288
270#define SECTION 289
271#define ALIAS 290
272#define VOLATILE 291
273#define THREAD_LOCAL 292
274#define TO 293
275#define DOTDOTDOT 294
276#define NULL_TOK 295
277#define UNDEF 296
278#define INTERNAL 297
279#define LINKONCE 298
280#define WEAK 299
281#define APPENDING 300
282#define DLLIMPORT 301
283#define DLLEXPORT 302
284#define EXTERN_WEAK 303
Dale Johannesenc7071cc2008-05-14 20:13:36 +0000285#define COMMON 304
286#define OPAQUE 305
287#define EXTERNAL 306
288#define TARGET 307
289#define TRIPLE 308
290#define ALIGN 309
291#define ADDRSPACE 310
292#define DEPLIBS 311
293#define CALL 312
294#define TAIL 313
295#define ASM_TOK 314
296#define MODULE 315
297#define SIDEEFFECT 316
298#define CC_TOK 317
299#define CCC_TOK 318
300#define FASTCC_TOK 319
301#define COLDCC_TOK 320
302#define X86_STDCALLCC_TOK 321
303#define X86_FASTCALLCC_TOK 322
Dale Johannesen20ab78b2008-08-13 18:41:46 +0000304#define X86_SSECALLCC_TOK 323
305#define DATALAYOUT 324
306#define RET 325
307#define BR 326
308#define SWITCH 327
309#define INVOKE 328
310#define UNWIND 329
311#define UNREACHABLE 330
312#define ADD 331
313#define SUB 332
314#define MUL 333
315#define UDIV 334
316#define SDIV 335
317#define FDIV 336
318#define UREM 337
319#define SREM 338
320#define FREM 339
321#define AND 340
322#define OR 341
323#define XOR 342
324#define SHL 343
325#define LSHR 344
326#define ASHR 345
327#define ICMP 346
328#define FCMP 347
329#define VICMP 348
330#define VFCMP 349
331#define EQ 350
332#define NE 351
333#define SLT 352
334#define SGT 353
335#define SLE 354
336#define SGE 355
337#define ULT 356
338#define UGT 357
339#define ULE 358
340#define UGE 359
341#define OEQ 360
342#define ONE 361
343#define OLT 362
344#define OGT 363
345#define OLE 364
346#define OGE 365
347#define ORD 366
348#define UNO 367
349#define UEQ 368
350#define UNE 369
351#define MALLOC 370
352#define ALLOCA 371
353#define FREE 372
354#define LOAD 373
355#define STORE 374
356#define GETELEMENTPTR 375
357#define TRUNC 376
358#define ZEXT 377
359#define SEXT 378
360#define FPTRUNC 379
361#define FPEXT 380
362#define BITCAST 381
363#define UITOFP 382
364#define SITOFP 383
365#define FPTOUI 384
366#define FPTOSI 385
367#define INTTOPTR 386
368#define PTRTOINT 387
369#define PHI_TOK 388
370#define SELECT 389
371#define VAARG 390
372#define EXTRACTELEMENT 391
373#define INSERTELEMENT 392
374#define SHUFFLEVECTOR 393
375#define GETRESULT 394
376#define EXTRACTVALUE 395
377#define INSERTVALUE 396
378#define SIGNEXT 397
379#define ZEROEXT 398
380#define NORETURN 399
381#define INREG 400
382#define SRET 401
383#define NOUNWIND 402
384#define NOALIAS 403
385#define BYVAL 404
386#define NEST 405
387#define READNONE 406
388#define READONLY 407
389#define GC 408
Devang Pateld4980812008-09-02 20:52:40 +0000390#define FNNOTE 409
391#define INLINE 410
392#define ALWAYS 411
393#define NEVER 412
394#define OPTIMIZEFORSIZE 413
395#define DEFAULT 414
396#define HIDDEN 415
397#define PROTECTED 416
Dan Gohmanf4423b12008-04-19 00:24:39 +0000398
399
400
401
402/* Copy the first part of user declarations. */
Devang Pateld4980812008-09-02 20:52:40 +0000403#line 14 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000404
405#include "ParserInternals.h"
406#include "llvm/CallingConv.h"
Chris Lattner0e9c3762006-01-25 22:27:16 +0000407#include "llvm/InlineAsm.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000408#include "llvm/Instructions.h"
409#include "llvm/Module.h"
Reid Spenceref9b9a72007-02-05 20:47:22 +0000410#include "llvm/ValueSymbolTable.h"
Chandler Carruth02202192007-08-04 01:56:21 +0000411#include "llvm/AutoUpgrade.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000412#include "llvm/Support/GetElementPtrTypeIterator.h"
Reid Spencer14310612006-12-31 05:40:51 +0000413#include "llvm/Support/CommandLine.h"
Chris Lattnerf7469af2007-01-31 04:44:08 +0000414#include "llvm/ADT/SmallVector.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000415#include "llvm/ADT/STLExtras.h"
Chris Lattner0019bbe2005-11-06 06:46:53 +0000416#include "llvm/Support/MathExtras.h"
Reid Spencer481169e2006-12-01 00:33:46 +0000417#include "llvm/Support/Streams.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000418#include <algorithm>
Reid Spencer68a24bd2005-08-27 18:50:39 +0000419#include <list>
Chris Lattner8adde282007-02-11 21:40:10 +0000420#include <map>
Reid Spencer68a24bd2005-08-27 18:50:39 +0000421#include <utility>
422
Reid Spencere4f47592006-08-18 17:32:55 +0000423// The following is a gross hack. In order to rid the libAsmParser library of
424// exceptions, we have to have a way of getting the yyparse function to go into
425// an error situation. So, whenever we want an error to occur, the GenerateError
426// function (see bottom of file) sets TriggerError. Then, at the end of each
427// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
428// (a goto) to put YACC in error state. Furthermore, several calls to
429// GenerateError are made from inside productions and they must simulate the
430// previous exception behavior by exiting the production immediately. We have
431// replaced these with the GEN_ERROR macro which calls GeneratError and then
432// immediately invokes YYERROR. This would be so much cleaner if it was a
433// recursive descent parser.
Reid Spencer61c83e02006-08-18 08:43:06 +0000434static bool TriggerError = false;
Reid Spencerf63697d2006-10-09 17:36:59 +0000435#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
Reid Spencer61c83e02006-08-18 08:43:06 +0000436#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
437
Reid Spencer68a24bd2005-08-27 18:50:39 +0000438int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
439int yylex(); // declaration" of xxx warnings.
440int yyparse();
Reid Spencer68a24bd2005-08-27 18:50:39 +0000441using namespace llvm;
442
443static Module *ParserResult;
444
445// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
446// relating to upreferences in the input stream.
447//
448//#define DEBUG_UPREFS 1
449#ifdef DEBUG_UPREFS
Bill Wendlinge8156192006-12-07 01:30:32 +0000450#define UR_OUT(X) cerr << X
Reid Spencer68a24bd2005-08-27 18:50:39 +0000451#else
452#define UR_OUT(X)
453#endif
454
455#define YYERROR_VERBOSE 1
456
Chris Lattnerb475c422005-11-12 18:22:38 +0000457static GlobalVariable *CurGV;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000458
459
460// This contains info used when building the body of a function. It is
461// destroyed when the function is completed.
462//
463typedef std::vector<Value *> ValueList; // Numbered defs
Reid Spencer14310612006-12-31 05:40:51 +0000464
Reid Spencer68a24bd2005-08-27 18:50:39 +0000465static void
Reid Spencer93c40032007-03-19 18:40:50 +0000466ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000467
468static struct PerModuleInfo {
469 Module *CurrentModule;
Reid Spencer93c40032007-03-19 18:40:50 +0000470 ValueList Values; // Module level numbered definitions
471 ValueList LateResolveValues;
Reid Spencer861d9d62006-11-28 07:29:44 +0000472 std::vector<PATypeHolder> Types;
473 std::map<ValID, PATypeHolder> LateResolveTypes;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000474
475 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
Chris Lattner0ad19702006-06-21 16:53:00 +0000476 /// how they were referenced and on which line of the input they came from so
Reid Spencer68a24bd2005-08-27 18:50:39 +0000477 /// that we can resolve them later and print error messages as appropriate.
478 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
479
480 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
481 // references to global values. Global values may be referenced before they
482 // are defined, and if so, the temporary object that they represent is held
483 // here. This is used for forward references of GlobalValues.
484 //
485 typedef std::map<std::pair<const PointerType *,
486 ValID>, GlobalValue*> GlobalRefsType;
487 GlobalRefsType GlobalRefs;
488
489 void ModuleDone() {
490 // If we could not resolve some functions at function compilation time
491 // (calls to functions before they are defined), resolve them now... Types
492 // are resolved when the constant pool has been completely parsed.
493 //
494 ResolveDefinitions(LateResolveValues);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000495 if (TriggerError)
496 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000497
498 // Check to make sure that all global value forward references have been
499 // resolved!
500 //
501 if (!GlobalRefs.empty()) {
502 std::string UndefinedReferences = "Unresolved global references exist:\n";
503
504 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
505 I != E; ++I) {
506 UndefinedReferences += " " + I->first.first->getDescription() + " " +
507 I->first.second.getName() + "\n";
508 }
Reid Spencer61c83e02006-08-18 08:43:06 +0000509 GenerateError(UndefinedReferences);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000510 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000511 }
512
Chandler Carruth02202192007-08-04 01:56:21 +0000513 // Look for intrinsic functions and CallInst that need to be upgraded
514 for (Module::iterator FI = CurrentModule->begin(),
515 FE = CurrentModule->end(); FI != FE; )
516 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
517
Reid Spencer68a24bd2005-08-27 18:50:39 +0000518 Values.clear(); // Clear out function local definitions
519 Types.clear();
520 CurrentModule = 0;
521 }
522
Reid Spencer68a24bd2005-08-27 18:50:39 +0000523 // GetForwardRefForGlobal - Check to see if there is a forward reference
524 // for this global. If so, remove it from the GlobalRefs map and return it.
525 // If not, just return null.
526 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
527 // Check to see if there is a forward reference to this global variable...
528 // if there is, eliminate it and patch the reference to use the new def'n.
529 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
530 GlobalValue *Ret = 0;
531 if (I != GlobalRefs.end()) {
532 Ret = I->second;
533 GlobalRefs.erase(I);
534 }
535 return Ret;
536 }
Reid Spencer8c8a2dc2007-01-02 21:54:12 +0000537
538 bool TypeIsUnresolved(PATypeHolder* PATy) {
539 // If it isn't abstract, its resolved
540 const Type* Ty = PATy->get();
541 if (!Ty->isAbstract())
542 return false;
543 // Traverse the type looking for abstract types. If it isn't abstract then
544 // we don't need to traverse that leg of the type.
545 std::vector<const Type*> WorkList, SeenList;
546 WorkList.push_back(Ty);
547 while (!WorkList.empty()) {
548 const Type* Ty = WorkList.back();
549 SeenList.push_back(Ty);
550 WorkList.pop_back();
551 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
552 // Check to see if this is an unresolved type
553 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
554 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
555 for ( ; I != E; ++I) {
556 if (I->second.get() == OpTy)
557 return true;
558 }
559 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
560 const Type* TheTy = SeqTy->getElementType();
561 if (TheTy->isAbstract() && TheTy != Ty) {
562 std::vector<const Type*>::iterator I = SeenList.begin(),
563 E = SeenList.end();
564 for ( ; I != E; ++I)
565 if (*I == TheTy)
566 break;
567 if (I == E)
568 WorkList.push_back(TheTy);
569 }
570 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
571 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
572 const Type* TheTy = StrTy->getElementType(i);
573 if (TheTy->isAbstract() && TheTy != Ty) {
574 std::vector<const Type*>::iterator I = SeenList.begin(),
575 E = SeenList.end();
576 for ( ; I != E; ++I)
577 if (*I == TheTy)
578 break;
579 if (I == E)
580 WorkList.push_back(TheTy);
581 }
582 }
583 }
584 }
585 return false;
586 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000587} CurModule;
588
589static struct PerFunctionInfo {
590 Function *CurrentFunction; // Pointer to current function being created
591
Reid Spencer93c40032007-03-19 18:40:50 +0000592 ValueList Values; // Keep track of #'d definitions
593 unsigned NextValNum;
594 ValueList LateResolveValues;
Reid Spenceref9b9a72007-02-05 20:47:22 +0000595 bool isDeclare; // Is this function a forward declararation?
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000596 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000597 GlobalValue::VisibilityTypes Visibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000598
599 /// BBForwardRefs - When we see forward references to basic blocks, keep
600 /// track of them here.
Reid Spencer93c40032007-03-19 18:40:50 +0000601 std::map<ValID, BasicBlock*> BBForwardRefs;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000602
603 inline PerFunctionInfo() {
604 CurrentFunction = 0;
605 isDeclare = false;
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000606 Linkage = GlobalValue::ExternalLinkage;
607 Visibility = GlobalValue::DefaultVisibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000608 }
609
610 inline void FunctionStart(Function *M) {
611 CurrentFunction = M;
Reid Spencer93c40032007-03-19 18:40:50 +0000612 NextValNum = 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000613 }
614
615 void FunctionDone() {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000616 // Any forward referenced blocks left?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000617 if (!BBForwardRefs.empty()) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000618 GenerateError("Undefined reference to label " +
Reid Spencer93c40032007-03-19 18:40:50 +0000619 BBForwardRefs.begin()->second->getName());
Reid Spencer5b7e7532006-09-28 19:28:24 +0000620 return;
621 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000622
623 // Resolve all forward references now.
624 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
625
626 Values.clear(); // Clear out function local definitions
Reid Spencer93c40032007-03-19 18:40:50 +0000627 BBForwardRefs.clear();
Reid Spencer68a24bd2005-08-27 18:50:39 +0000628 CurrentFunction = 0;
629 isDeclare = false;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000630 Linkage = GlobalValue::ExternalLinkage;
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000631 Visibility = GlobalValue::DefaultVisibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000632 }
633} CurFun; // Info for the current function...
634
635static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
636
637
638//===----------------------------------------------------------------------===//
639// Code to handle definitions of all the types
640//===----------------------------------------------------------------------===//
641
Chris Lattner15bd0952008-08-29 17:20:18 +0000642/// InsertValue - Insert a value into the value table. If it is named, this
643/// returns -1, otherwise it returns the slot number for the value.
644static int InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
Reid Spencer93c40032007-03-19 18:40:50 +0000645 // Things that have names or are void typed don't get slot numbers
646 if (V->hasName() || (V->getType() == Type::VoidTy))
Chris Lattner15bd0952008-08-29 17:20:18 +0000647 return -1;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000648
Reid Spencer93c40032007-03-19 18:40:50 +0000649 // In the case of function values, we have to allow for the forward reference
650 // of basic blocks, which are included in the numbering. Consequently, we keep
651 // track of the next insertion location with NextValNum. When a BB gets
652 // inserted, it could change the size of the CurFun.Values vector.
653 if (&ValueTab == &CurFun.Values) {
654 if (ValueTab.size() <= CurFun.NextValNum)
655 ValueTab.resize(CurFun.NextValNum+1);
656 ValueTab[CurFun.NextValNum++] = V;
Chris Lattner15bd0952008-08-29 17:20:18 +0000657 return CurFun.NextValNum-1;
Reid Spencer93c40032007-03-19 18:40:50 +0000658 }
659 // For all other lists, its okay to just tack it on the back of the vector.
660 ValueTab.push_back(V);
Chris Lattner15bd0952008-08-29 17:20:18 +0000661 return ValueTab.size()-1;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000662}
663
664static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
665 switch (D.Type) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000666 case ValID::LocalID: // Is it a numbered definition?
Reid Spencer68a24bd2005-08-27 18:50:39 +0000667 // Module constants occupy the lowest numbered slots...
Reid Spencer41dff5e2007-01-26 08:05:27 +0000668 if (D.Num < CurModule.Types.size())
669 return CurModule.Types[D.Num];
Reid Spencer68a24bd2005-08-27 18:50:39 +0000670 break;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000671 case ValID::LocalName: // Is it a named definition?
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000672 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000673 D.destroy(); // Free old strdup'd memory...
674 return N;
675 }
676 break;
677 default:
Reid Spencerb5334b02007-02-05 10:18:06 +0000678 GenerateError("Internal parser error: Invalid symbol type reference");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000679 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000680 }
681
682 // If we reached here, we referenced either a symbol that we don't know about
683 // or an id number that hasn't been read yet. We may be referencing something
684 // forward, so just create an entry to be resolved later and get to it...
685 //
686 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
687
688
689 if (inFunctionScope()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000690 if (D.Type == ValID::LocalName) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000691 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000692 return 0;
693 } else {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000694 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
Reid Spencer5b7e7532006-09-28 19:28:24 +0000695 return 0;
696 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000697 }
698
Reid Spencer861d9d62006-11-28 07:29:44 +0000699 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000700 if (I != CurModule.LateResolveTypes.end())
Reid Spencer861d9d62006-11-28 07:29:44 +0000701 return I->second;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000702
Reid Spencer861d9d62006-11-28 07:29:44 +0000703 Type *Typ = OpaqueType::get();
704 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
705 return Typ;
Reid Spencera132e042006-12-03 05:46:11 +0000706 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000707
Reid Spencer93c40032007-03-19 18:40:50 +0000708// getExistingVal - Look up the value specified by the provided type and
Reid Spencer68a24bd2005-08-27 18:50:39 +0000709// the provided ValID. If the value exists and has already been defined, return
710// it. Otherwise return null.
711//
Reid Spencer93c40032007-03-19 18:40:50 +0000712static Value *getExistingVal(const Type *Ty, const ValID &D) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000713 if (isa<FunctionType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000714 GenerateError("Functions are not values and "
Reid Spencer68a24bd2005-08-27 18:50:39 +0000715 "must be referenced as pointers");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000716 return 0;
717 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000718
719 switch (D.Type) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000720 case ValID::LocalID: { // Is it a numbered definition?
Reid Spencer41dff5e2007-01-26 08:05:27 +0000721 // Check that the number is within bounds.
Reid Spencer93c40032007-03-19 18:40:50 +0000722 if (D.Num >= CurFun.Values.size())
723 return 0;
724 Value *Result = CurFun.Values[D.Num];
725 if (Ty != Result->getType()) {
726 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
727 Result->getType()->getDescription() + "' does not match "
728 "expected type, '" + Ty->getDescription() + "'");
729 return 0;
730 }
731 return Result;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000732 }
733 case ValID::GlobalID: { // Is it a numbered definition?
Reid Spencer93c40032007-03-19 18:40:50 +0000734 if (D.Num >= CurModule.Values.size())
Reid Spenceref9b9a72007-02-05 20:47:22 +0000735 return 0;
Reid Spencer93c40032007-03-19 18:40:50 +0000736 Value *Result = CurModule.Values[D.Num];
737 if (Ty != Result->getType()) {
738 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
739 Result->getType()->getDescription() + "' does not match "
740 "expected type, '" + Ty->getDescription() + "'");
Reid Spenceref9b9a72007-02-05 20:47:22 +0000741 return 0;
Reid Spencer93c40032007-03-19 18:40:50 +0000742 }
743 return Result;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000744 }
Reid Spencer41dff5e2007-01-26 08:05:27 +0000745
746 case ValID::LocalName: { // Is it a named definition?
Reid Spenceref9b9a72007-02-05 20:47:22 +0000747 if (!inFunctionScope())
748 return 0;
749 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000750 Value *N = SymTab.lookup(D.getName());
Reid Spenceref9b9a72007-02-05 20:47:22 +0000751 if (N == 0)
752 return 0;
753 if (N->getType() != Ty)
754 return 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000755
756 D.destroy(); // Free old strdup'd memory...
757 return N;
758 }
759 case ValID::GlobalName: { // Is it a named definition?
Reid Spenceref9b9a72007-02-05 20:47:22 +0000760 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000761 Value *N = SymTab.lookup(D.getName());
Reid Spenceref9b9a72007-02-05 20:47:22 +0000762 if (N == 0)
763 return 0;
764 if (N->getType() != Ty)
765 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000766
767 D.destroy(); // Free old strdup'd memory...
768 return N;
769 }
770
771 // Check to make sure that "Ty" is an integral type, and that our
772 // value will fit into the specified type...
773 case ValID::ConstSIntVal: // Is it a constant pool reference??
Chris Lattner38905612008-02-19 04:36:25 +0000774 if (!isa<IntegerType>(Ty) ||
775 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000776 GenerateError("Signed integral constant '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000777 itostr(D.ConstPool64) + "' is invalid for type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +0000778 Ty->getDescription() + "'");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000779 return 0;
780 }
Reid Spencer49d273e2007-03-19 20:40:51 +0000781 return ConstantInt::get(Ty, D.ConstPool64, true);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000782
783 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
Chris Lattner38905612008-02-19 04:36:25 +0000784 if (isa<IntegerType>(Ty) &&
785 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
Reid Spencerb83eb642006-10-20 07:07:24 +0000786 return ConstantInt::get(Ty, D.UConstPool64);
Chris Lattner38905612008-02-19 04:36:25 +0000787
788 if (!isa<IntegerType>(Ty) ||
789 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
790 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
791 "' is invalid or out of range for type '" +
792 Ty->getDescription() + "'");
793 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000794 }
Chris Lattner38905612008-02-19 04:36:25 +0000795 // This is really a signed reference. Transmogrify.
796 return ConstantInt::get(Ty, D.ConstPool64, true);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000797
Chris Lattner1913b942008-07-11 00:30:39 +0000798 case ValID::ConstAPInt: // Is it an unsigned const pool reference?
799 if (!isa<IntegerType>(Ty)) {
800 GenerateError("Integral constant '" + D.getName() +
801 "' is invalid or out of range for type '" +
802 Ty->getDescription() + "'");
803 return 0;
804 }
805
806 {
807 APSInt Tmp = *D.ConstPoolInt;
808 Tmp.extOrTrunc(Ty->getPrimitiveSizeInBits());
809 return ConstantInt::get(Tmp);
810 }
811
Reid Spencer68a24bd2005-08-27 18:50:39 +0000812 case ValID::ConstFPVal: // Is it a floating point const pool reference?
Chris Lattner38905612008-02-19 04:36:25 +0000813 if (!Ty->isFloatingPoint() ||
814 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000815 GenerateError("FP constant invalid for type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000816 return 0;
817 }
Chris Lattnerd8eb63f2008-04-20 00:41:19 +0000818 // Lexer has no type info, so builds all float and double FP constants
Dale Johannesenc72cd7e2007-09-11 18:33:39 +0000819 // as double. Fix this here. Long double does not need this.
820 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
821 Ty==Type::FloatTy)
Dale Johannesencdd509a2007-09-07 21:07:57 +0000822 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
Chris Lattnerd8eb63f2008-04-20 00:41:19 +0000823 return ConstantFP::get(*D.ConstPoolFP);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000824
825 case ValID::ConstNullVal: // Is it a null value?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000826 if (!isa<PointerType>(Ty)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000827 GenerateError("Cannot create a a non pointer null");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000828 return 0;
829 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000830 return ConstantPointerNull::get(cast<PointerType>(Ty));
831
832 case ValID::ConstUndefVal: // Is it an undef value?
833 return UndefValue::get(Ty);
834
Chris Lattner7aa61892005-12-21 17:53:23 +0000835 case ValID::ConstZeroVal: // Is it a zero value?
836 return Constant::getNullValue(Ty);
837
Reid Spencer68a24bd2005-08-27 18:50:39 +0000838 case ValID::ConstantVal: // Fully resolved constant?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000839 if (D.ConstantValue->getType() != Ty) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000840 GenerateError("Constant expression type different from required type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000841 return 0;
842 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000843 return D.ConstantValue;
844
Chris Lattner0e9c3762006-01-25 22:27:16 +0000845 case ValID::InlineAsmVal: { // Inline asm expression
846 const PointerType *PTy = dyn_cast<PointerType>(Ty);
847 const FunctionType *FTy =
848 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000849 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000850 GenerateError("Invalid type for asm constraint string");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000851 return 0;
852 }
Chris Lattner0e9c3762006-01-25 22:27:16 +0000853 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
854 D.IAD->HasSideEffects);
855 D.destroy(); // Free InlineAsmDescriptor.
856 return IA;
857 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000858 default:
Reid Spencera9720f52007-02-05 17:04:00 +0000859 assert(0 && "Unhandled case!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000860 return 0;
861 } // End of switch
862
Reid Spencera9720f52007-02-05 17:04:00 +0000863 assert(0 && "Unhandled case!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000864 return 0;
865}
866
Reid Spencer93c40032007-03-19 18:40:50 +0000867// getVal - This function is identical to getExistingVal, except that if a
Reid Spencer68a24bd2005-08-27 18:50:39 +0000868// value is not already defined, it "improvises" by creating a placeholder var
869// that looks and acts just like the requested variable. When the value is
870// defined later, all uses of the placeholder variable are replaced with the
871// real thing.
872//
873static Value *getVal(const Type *Ty, const ValID &ID) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000874 if (Ty == Type::LabelTy) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000875 GenerateError("Cannot use a basic block here");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000876 return 0;
877 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000878
879 // See if the value has already been defined.
Reid Spencer93c40032007-03-19 18:40:50 +0000880 Value *V = getExistingVal(Ty, ID);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000881 if (V) return V;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000882 if (TriggerError) return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000883
Reid Spencer5b7e7532006-09-28 19:28:24 +0000884 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
Dan Gohmane4977cf2008-05-23 01:55:30 +0000885 GenerateError("Invalid use of a non-first-class type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000886 return 0;
887 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000888
889 // If we reached here, we referenced either a symbol that we don't know about
890 // or an id number that hasn't been read yet. We may be referencing something
891 // forward, so just create an entry to be resolved later and get to it...
892 //
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000893 switch (ID.Type) {
894 case ValID::GlobalName:
Reid Spencer9c9b63a2007-04-28 16:07:31 +0000895 case ValID::GlobalID: {
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000896 const PointerType *PTy = dyn_cast<PointerType>(Ty);
897 if (!PTy) {
898 GenerateError("Invalid type for reference to global" );
899 return 0;
900 }
901 const Type* ElTy = PTy->getElementType();
902 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
Gabor Greife64d2482008-04-06 23:07:54 +0000903 V = Function::Create(FTy, GlobalValue::ExternalLinkage);
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000904 else
Christopher Lamba8ed9bf2007-12-11 09:02:08 +0000905 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
906 (Module*)0, false, PTy->getAddressSpace());
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000907 break;
Reid Spencer9c9b63a2007-04-28 16:07:31 +0000908 }
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000909 default:
910 V = new Argument(Ty);
911 }
912
Reid Spencer68a24bd2005-08-27 18:50:39 +0000913 // Remember where this forward reference came from. FIXME, shouldn't we try
914 // to recycle these things??
915 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
Duncan Sandsdc024672007-11-27 13:23:08 +0000916 LLLgetLineNo())));
Reid Spencer68a24bd2005-08-27 18:50:39 +0000917
918 if (inFunctionScope())
919 InsertValue(V, CurFun.LateResolveValues);
920 else
921 InsertValue(V, CurModule.LateResolveValues);
922 return V;
923}
924
Reid Spencer93c40032007-03-19 18:40:50 +0000925/// defineBBVal - This is a definition of a new basic block with the specified
926/// identifier which must be the same as CurFun.NextValNum, if its numeric.
Chris Lattnercc81d152008-05-04 17:18:47 +0000927static BasicBlock *defineBBVal(const ValID &ID) {
Reid Spencera9720f52007-02-05 17:04:00 +0000928 assert(inFunctionScope() && "Can't get basic block at global scope!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000929
Reid Spencer68a24bd2005-08-27 18:50:39 +0000930 BasicBlock *BB = 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000931
Reid Spencer93c40032007-03-19 18:40:50 +0000932 // First, see if this was forward referenced
Reid Spencer68a24bd2005-08-27 18:50:39 +0000933
Reid Spencer93c40032007-03-19 18:40:50 +0000934 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
935 if (BBI != CurFun.BBForwardRefs.end()) {
936 BB = BBI->second;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000937 // The forward declaration could have been inserted anywhere in the
938 // function: insert it into the correct place now.
939 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
940 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
Reid Spencer93c40032007-03-19 18:40:50 +0000941
Reid Spencer66728ef2007-03-20 01:13:36 +0000942 // We're about to erase the entry, save the key so we can clean it up.
943 ValID Tmp = BBI->first;
944
Reid Spencer93c40032007-03-19 18:40:50 +0000945 // Erase the forward ref from the map as its no longer "forward"
946 CurFun.BBForwardRefs.erase(ID);
947
Reid Spencer66728ef2007-03-20 01:13:36 +0000948 // The key has been removed from the map but so we don't want to leave
949 // strdup'd memory around so destroy it too.
950 Tmp.destroy();
951
Reid Spencer93c40032007-03-19 18:40:50 +0000952 // If its a numbered definition, bump the number and set the BB value.
953 if (ID.Type == ValID::LocalID) {
954 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
955 InsertValue(BB);
956 }
Devang Patel67909432008-03-03 18:58:47 +0000957 } else {
958 // We haven't seen this BB before and its first mention is a definition.
959 // Just create it and return it.
960 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
Gabor Greife64d2482008-04-06 23:07:54 +0000961 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Devang Patel67909432008-03-03 18:58:47 +0000962 if (ID.Type == ValID::LocalID) {
963 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
964 InsertValue(BB);
965 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000966 }
Reid Spencer93c40032007-03-19 18:40:50 +0000967
Devang Patel67909432008-03-03 18:58:47 +0000968 ID.destroy();
Reid Spencer93c40032007-03-19 18:40:50 +0000969 return BB;
970}
971
972/// getBBVal - get an existing BB value or create a forward reference for it.
973///
974static BasicBlock *getBBVal(const ValID &ID) {
975 assert(inFunctionScope() && "Can't get basic block at global scope!");
976
977 BasicBlock *BB = 0;
978
979 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
980 if (BBI != CurFun.BBForwardRefs.end()) {
981 BB = BBI->second;
982 } if (ID.Type == ValID::LocalName) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000983 std::string Name = ID.getName();
Reid Spencer93c40032007-03-19 18:40:50 +0000984 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
Anton Korobeynikovc70d7732008-02-20 12:10:37 +0000985 if (N) {
Reid Spencer93c40032007-03-19 18:40:50 +0000986 if (N->getType()->getTypeID() == Type::LabelTyID)
987 BB = cast<BasicBlock>(N);
988 else
989 GenerateError("Reference to label '" + Name + "' is actually of type '"+
990 N->getType()->getDescription() + "'");
Anton Korobeynikovc70d7732008-02-20 12:10:37 +0000991 }
Reid Spencer93c40032007-03-19 18:40:50 +0000992 } else if (ID.Type == ValID::LocalID) {
993 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
994 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
995 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
996 else
997 GenerateError("Reference to label '%" + utostr(ID.Num) +
998 "' is actually of type '"+
999 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
1000 }
1001 } else {
1002 GenerateError("Illegal label reference " + ID.getName());
1003 return 0;
1004 }
1005
1006 // If its already been defined, return it now.
1007 if (BB) {
1008 ID.destroy(); // Free strdup'd memory.
1009 return BB;
1010 }
1011
1012 // Otherwise, this block has not been seen before, create it.
1013 std::string Name;
1014 if (ID.Type == ValID::LocalName)
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001015 Name = ID.getName();
Gabor Greife64d2482008-04-06 23:07:54 +00001016 BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
Reid Spencer93c40032007-03-19 18:40:50 +00001017
1018 // Insert it in the forward refs map.
1019 CurFun.BBForwardRefs[ID] = BB;
1020
Reid Spencer68a24bd2005-08-27 18:50:39 +00001021 return BB;
1022}
1023
1024
1025//===----------------------------------------------------------------------===//
1026// Code to handle forward references in instructions
1027//===----------------------------------------------------------------------===//
1028//
1029// This code handles the late binding needed with statements that reference
1030// values not defined yet... for example, a forward branch, or the PHI node for
1031// a loop body.
1032//
1033// This keeps a table (CurFun.LateResolveValues) of all such forward references
1034// and back patchs after we are done.
1035//
1036
1037// ResolveDefinitions - If we could not resolve some defs at parsing
1038// time (forward branches, phi functions for loops, etc...) resolve the
1039// defs now...
1040//
1041static void
Reid Spencer93c40032007-03-19 18:40:50 +00001042ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001043 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
Reid Spencer93c40032007-03-19 18:40:50 +00001044 while (!LateResolvers.empty()) {
1045 Value *V = LateResolvers.back();
1046 LateResolvers.pop_back();
Reid Spencer68a24bd2005-08-27 18:50:39 +00001047
Reid Spencer93c40032007-03-19 18:40:50 +00001048 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1049 CurModule.PlaceHolderInfo.find(V);
1050 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001051
Reid Spencer93c40032007-03-19 18:40:50 +00001052 ValID &DID = PHI->second.first;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001053
Reid Spencer93c40032007-03-19 18:40:50 +00001054 Value *TheRealValue = getExistingVal(V->getType(), DID);
1055 if (TriggerError)
1056 return;
1057 if (TheRealValue) {
1058 V->replaceAllUsesWith(TheRealValue);
1059 delete V;
1060 CurModule.PlaceHolderInfo.erase(PHI);
1061 } else if (FutureLateResolvers) {
1062 // Functions have their unresolved items forwarded to the module late
1063 // resolver table
1064 InsertValue(V, *FutureLateResolvers);
1065 } else {
1066 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1067 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1068 "' of type '" + V->getType()->getDescription() + "'",
1069 PHI->second.second);
Reid Spencer5b7e7532006-09-28 19:28:24 +00001070 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001071 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00001072 GenerateError("Reference to an invalid definition: #" +
1073 itostr(DID.Num) + " of type '" +
1074 V->getType()->getDescription() + "'",
1075 PHI->second.second);
1076 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001077 }
1078 }
1079 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001080 LateResolvers.clear();
1081}
1082
1083// ResolveTypeTo - A brand new type was just declared. This means that (if
1084// name is not null) things referencing Name can be resolved. Otherwise, things
1085// refering to the number can be resolved. Do this now.
1086//
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001087static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001088 ValID D;
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001089 if (Name)
1090 D = ValID::createLocalName(*Name);
1091 else
1092 D = ValID::createLocalID(CurModule.Types.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00001093
Reid Spencer861d9d62006-11-28 07:29:44 +00001094 std::map<ValID, PATypeHolder>::iterator I =
Reid Spencer68a24bd2005-08-27 18:50:39 +00001095 CurModule.LateResolveTypes.find(D);
1096 if (I != CurModule.LateResolveTypes.end()) {
Reid Spencer861d9d62006-11-28 07:29:44 +00001097 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001098 CurModule.LateResolveTypes.erase(I);
1099 }
1100}
1101
1102// setValueName - Set the specified value to the name given. The name may be
1103// null potentially, in which case this is a noop. The string passed in is
1104// assumed to be a malloc'd string buffer, and is free'd by this function.
1105//
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001106static void setValueName(Value *V, std::string *NameStr) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00001107 if (!NameStr) return;
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001108 std::string Name(*NameStr); // Copy string
1109 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001110
Reid Spencer41dff5e2007-01-26 08:05:27 +00001111 if (V->getType() == Type::VoidTy) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001112 GenerateError("Can't assign name '" + Name+"' to value with void type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00001113 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001114 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00001115
Reid Spencera9720f52007-02-05 17:04:00 +00001116 assert(inFunctionScope() && "Must be in function scope!");
Reid Spenceref9b9a72007-02-05 20:47:22 +00001117 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1118 if (ST.lookup(Name)) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00001119 GenerateError("Redefinition of value '" + Name + "' of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00001120 V->getType()->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00001121 return;
1122 }
1123
1124 // Set the name.
1125 V->setName(Name);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001126}
1127
1128/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1129/// this is a declaration, otherwise it is a definition.
Chris Lattnerb475c422005-11-12 18:22:38 +00001130static GlobalVariable *
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001131ParseGlobalVariable(std::string *NameStr,
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001132 GlobalValue::LinkageTypes Linkage,
1133 GlobalValue::VisibilityTypes Visibility,
Chris Lattnerb475c422005-11-12 18:22:38 +00001134 bool isConstantGlobal, const Type *Ty,
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001135 Constant *Initializer, bool IsThreadLocal,
1136 unsigned AddressSpace = 0) {
Reid Spencer5b7e7532006-09-28 19:28:24 +00001137 if (isa<FunctionType>(Ty)) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001138 GenerateError("Cannot declare global vars of function type");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001139 return 0;
1140 }
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001141 if (Ty == Type::LabelTy) {
1142 GenerateError("Cannot declare global vars of label type");
1143 return 0;
1144 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001145
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001146 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001147
1148 std::string Name;
1149 if (NameStr) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001150 Name = *NameStr; // Copy string
1151 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001152 }
1153
1154 // See if this global value was forward referenced. If so, recycle the
1155 // object.
1156 ValID ID;
1157 if (!Name.empty()) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001158 ID = ValID::createGlobalName(Name);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001159 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00001160 ID = ValID::createGlobalID(CurModule.Values.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00001161 }
1162
1163 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1164 // Move the global to the end of the list, from whereever it was
1165 // previously inserted.
1166 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1167 CurModule.CurrentModule->getGlobalList().remove(GV);
1168 CurModule.CurrentModule->getGlobalList().push_back(GV);
1169 GV->setInitializer(Initializer);
1170 GV->setLinkage(Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001171 GV->setVisibility(Visibility);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001172 GV->setConstant(isConstantGlobal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00001173 GV->setThreadLocal(IsThreadLocal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001174 InsertValue(GV, CurModule.Values);
Chris Lattnerb475c422005-11-12 18:22:38 +00001175 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001176 }
1177
Reid Spenceref9b9a72007-02-05 20:47:22 +00001178 // If this global has a name
Reid Spencer68a24bd2005-08-27 18:50:39 +00001179 if (!Name.empty()) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00001180 // if the global we're parsing has an initializer (is a definition) and
1181 // has external linkage.
1182 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1183 // If there is already a global with external linkage with this name
1184 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1185 // If we allow this GVar to get created, it will be renamed in the
1186 // symbol table because it conflicts with an existing GVar. We can't
1187 // allow redefinition of GVars whose linking indicates that their name
1188 // must stay the same. Issue the error.
1189 GenerateError("Redefinition of global variable named '" + Name +
1190 "' of type '" + Ty->getDescription() + "'");
1191 return 0;
1192 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001193 }
1194
1195 // Otherwise there is no existing GV to use, create one now.
1196 GlobalVariable *GV =
1197 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001198 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001199 GV->setVisibility(Visibility);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001200 InsertValue(GV, CurModule.Values);
Chris Lattnerb475c422005-11-12 18:22:38 +00001201 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001202}
1203
1204// setTypeName - Set the specified type to the name given. The name may be
1205// null potentially, in which case this is a noop. The string passed in is
1206// assumed to be a malloc'd string buffer, and is freed by this function.
1207//
1208// This function returns true if the type has already been defined, but is
1209// allowed to be redefined in the specified context. If the name is a new name
1210// for the type plane, it is inserted and false is returned.
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001211static bool setTypeName(const Type *T, std::string *NameStr) {
Reid Spencera9720f52007-02-05 17:04:00 +00001212 assert(!inFunctionScope() && "Can't give types function-local names!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001213 if (NameStr == 0) return false;
1214
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001215 std::string Name(*NameStr); // Copy string
1216 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001217
1218 // We don't allow assigning names to void type
Reid Spencer5b7e7532006-09-28 19:28:24 +00001219 if (T == Type::VoidTy) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001220 GenerateError("Can't assign name '" + Name + "' to the void type");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001221 return false;
1222 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001223
1224 // Set the type name, checking for conflicts as we do so.
1225 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1226
1227 if (AlreadyExists) { // Inserting a name that is already defined???
1228 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
Reid Spencera9720f52007-02-05 17:04:00 +00001229 assert(Existing && "Conflict but no matching type?!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001230
1231 // There is only one case where this is allowed: when we are refining an
1232 // opaque type. In this case, Existing will be an opaque type.
1233 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1234 // We ARE replacing an opaque type!
1235 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1236 return true;
1237 }
1238
1239 // Otherwise, this is an attempt to redefine a type. That's okay if
1240 // the redefinition is identical to the original. This will be so if
1241 // Existing and T point to the same Type object. In this one case we
1242 // allow the equivalent redefinition.
1243 if (Existing == T) return true; // Yes, it's equal.
1244
1245 // Any other kind of (non-equivalent) redefinition is an error.
Reid Spencer63c34452007-01-05 21:51:07 +00001246 GenerateError("Redefinition of type named '" + Name + "' of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00001247 T->getDescription() + "'");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001248 }
1249
1250 return false;
1251}
1252
1253//===----------------------------------------------------------------------===//
1254// Code for handling upreferences in type names...
1255//
1256
1257// TypeContains - Returns true if Ty directly contains E in it.
1258//
1259static bool TypeContains(const Type *Ty, const Type *E) {
1260 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1261 E) != Ty->subtype_end();
1262}
1263
1264namespace {
1265 struct UpRefRecord {
1266 // NestingLevel - The number of nesting levels that need to be popped before
1267 // this type is resolved.
1268 unsigned NestingLevel;
1269
1270 // LastContainedTy - This is the type at the current binding level for the
1271 // type. Every time we reduce the nesting level, this gets updated.
1272 const Type *LastContainedTy;
1273
1274 // UpRefTy - This is the actual opaque type that the upreference is
1275 // represented with.
1276 OpaqueType *UpRefTy;
1277
1278 UpRefRecord(unsigned NL, OpaqueType *URTy)
1279 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1280 };
1281}
1282
1283// UpRefs - A list of the outstanding upreferences that need to be resolved.
1284static std::vector<UpRefRecord> UpRefs;
1285
1286/// HandleUpRefs - Every time we finish a new layer of types, this function is
1287/// called. It loops through the UpRefs vector, which is a list of the
1288/// currently active types. For each type, if the up reference is contained in
1289/// the newly completed type, we decrement the level count. When the level
1290/// count reaches zero, the upreferenced type is the type that is passed in:
1291/// thus we can complete the cycle.
1292///
1293static PATypeHolder HandleUpRefs(const Type *ty) {
Chris Lattner224f84f2006-08-18 17:34:45 +00001294 // If Ty isn't abstract, or if there are no up-references in it, then there is
1295 // nothing to resolve here.
1296 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1297
Reid Spencer68a24bd2005-08-27 18:50:39 +00001298 PATypeHolder Ty(ty);
1299 UR_OUT("Type '" << Ty->getDescription() <<
1300 "' newly formed. Resolving upreferences.\n" <<
1301 UpRefs.size() << " upreferences active!\n");
1302
1303 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1304 // to zero), we resolve them all together before we resolve them to Ty. At
1305 // the end of the loop, if there is anything to resolve to Ty, it will be in
1306 // this variable.
1307 OpaqueType *TypeToResolve = 0;
1308
1309 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1310 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1311 << UpRefs[i].second->getDescription() << ") = "
1312 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1313 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1314 // Decrement level of upreference
1315 unsigned Level = --UpRefs[i].NestingLevel;
1316 UpRefs[i].LastContainedTy = Ty;
1317 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1318 if (Level == 0) { // Upreference should be resolved!
1319 if (!TypeToResolve) {
1320 TypeToResolve = UpRefs[i].UpRefTy;
1321 } else {
1322 UR_OUT(" * Resolving upreference for "
1323 << UpRefs[i].second->getDescription() << "\n";
1324 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1325 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1326 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1327 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1328 }
1329 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1330 --i; // Do not skip the next element...
1331 }
1332 }
1333 }
1334
1335 if (TypeToResolve) {
1336 UR_OUT(" * Resolving upreference for "
1337 << UpRefs[i].second->getDescription() << "\n";
1338 std::string OldName = TypeToResolve->getDescription());
1339 TypeToResolve->refineAbstractTypeTo(Ty);
1340 }
1341
1342 return Ty;
1343}
1344
Reid Spencer68a24bd2005-08-27 18:50:39 +00001345//===----------------------------------------------------------------------===//
1346// RunVMAsmParser - Define an interface to this parser
1347//===----------------------------------------------------------------------===//
1348//
Reid Spencer14310612006-12-31 05:40:51 +00001349static Module* RunParser(Module * M);
1350
Duncan Sandsdc024672007-11-27 13:23:08 +00001351Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1352 InitLLLexer(MB);
1353 Module *M = RunParser(new Module(LLLgetFilename()));
1354 FreeLexer();
1355 return M;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001356}
1357
1358
Dan Gohmanf4423b12008-04-19 00:24:39 +00001359
1360/* Enabling traces. */
1361#ifndef YYDEBUG
1362# define YYDEBUG 0
1363#endif
1364
1365/* Enabling verbose error messages. */
1366#ifdef YYERROR_VERBOSE
1367# undef YYERROR_VERBOSE
1368# define YYERROR_VERBOSE 1
1369#else
1370# define YYERROR_VERBOSE 0
1371#endif
1372
1373/* Enabling the token table. */
1374#ifndef YYTOKEN_TABLE
1375# define YYTOKEN_TABLE 0
1376#endif
1377
1378#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1379typedef union YYSTYPE
Devang Pateld4980812008-09-02 20:52:40 +00001380#line 970 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00001381{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001382 llvm::Module *ModuleVal;
1383 llvm::Function *FunctionVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001384 llvm::BasicBlock *BasicBlockVal;
1385 llvm::TerminatorInst *TermInstVal;
1386 llvm::Instruction *InstVal;
Reid Spencera132e042006-12-03 05:46:11 +00001387 llvm::Constant *ConstVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001388
Reid Spencera132e042006-12-03 05:46:11 +00001389 const llvm::Type *PrimType;
Reid Spencer14310612006-12-31 05:40:51 +00001390 std::list<llvm::PATypeHolder> *TypeList;
Reid Spencera132e042006-12-03 05:46:11 +00001391 llvm::PATypeHolder *TypeVal;
1392 llvm::Value *ValueVal;
Reid Spencera132e042006-12-03 05:46:11 +00001393 std::vector<llvm::Value*> *ValueList;
Dan Gohman81a0c0b2008-05-31 00:58:22 +00001394 std::vector<unsigned> *ConstantList;
Reid Spencer14310612006-12-31 05:40:51 +00001395 llvm::ArgListType *ArgList;
1396 llvm::TypeWithAttrs TypeWithAttrs;
1397 llvm::TypeWithAttrsList *TypeWithAttrsList;
Dale Johanneseneb57ea72007-11-05 21:20:28 +00001398 llvm::ParamList *ParamList;
Reid Spencer14310612006-12-31 05:40:51 +00001399
Reid Spencer68a24bd2005-08-27 18:50:39 +00001400 // Represent the RHS of PHI node
Reid Spencera132e042006-12-03 05:46:11 +00001401 std::list<std::pair<llvm::Value*,
1402 llvm::BasicBlock*> > *PHIList;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001403 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
Reid Spencera132e042006-12-03 05:46:11 +00001404 std::vector<llvm::Constant*> *ConstVector;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001405
1406 llvm::GlobalValue::LinkageTypes Linkage;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001407 llvm::GlobalValue::VisibilityTypes Visibility;
Dale Johannesen222ebf72008-02-19 21:40:51 +00001408 llvm::ParameterAttributes ParamAttrs;
Devang Pateld4980812008-09-02 20:52:40 +00001409 llvm::FunctionNotes FunctionNotes;
Reid Spencer38c91a92007-02-28 02:24:54 +00001410 llvm::APInt *APIntVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001411 int64_t SInt64Val;
1412 uint64_t UInt64Val;
1413 int SIntVal;
1414 unsigned UIntVal;
Dale Johannesencdd509a2007-09-07 21:07:57 +00001415 llvm::APFloat *FPVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001416 bool BoolVal;
1417
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001418 std::string *StrVal; // This memory must be deleted
1419 llvm::ValID ValIDVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001420
Reid Spencera132e042006-12-03 05:46:11 +00001421 llvm::Instruction::BinaryOps BinaryOpVal;
1422 llvm::Instruction::TermOps TermOpVal;
1423 llvm::Instruction::MemoryOps MemOpVal;
1424 llvm::Instruction::CastOps CastOpVal;
1425 llvm::Instruction::OtherOps OtherOpVal;
Reid Spencera132e042006-12-03 05:46:11 +00001426 llvm::ICmpInst::Predicate IPredicate;
1427 llvm::FCmpInst::Predicate FPredicate;
Dan Gohmanf4423b12008-04-19 00:24:39 +00001428}
Dan Gohman180c1692008-06-23 18:43:26 +00001429/* Line 193 of yacc.c. */
Devang Pateld4980812008-09-02 20:52:40 +00001430#line 1431 "llvmAsmParser.tab.c"
Dan Gohmanf4423b12008-04-19 00:24:39 +00001431 YYSTYPE;
1432# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1433# define YYSTYPE_IS_DECLARED 1
1434# define YYSTYPE_IS_TRIVIAL 1
Reid Spencer68a24bd2005-08-27 18:50:39 +00001435#endif
1436
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001437
Reid Spencer68a24bd2005-08-27 18:50:39 +00001438
Dan Gohmanf4423b12008-04-19 00:24:39 +00001439/* Copy the second part of user declarations. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001440
1441
Dan Gohmanf4423b12008-04-19 00:24:39 +00001442/* Line 216 of yacc.c. */
Devang Pateld4980812008-09-02 20:52:40 +00001443#line 1444 "llvmAsmParser.tab.c"
Reid Spencerb8f85052007-07-31 03:50:36 +00001444
Dan Gohmanf4423b12008-04-19 00:24:39 +00001445#ifdef short
1446# undef short
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001447#endif
1448
Dan Gohmanf4423b12008-04-19 00:24:39 +00001449#ifdef YYTYPE_UINT8
1450typedef YYTYPE_UINT8 yytype_uint8;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001451#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00001452typedef unsigned char yytype_uint8;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001453#endif
1454
Dan Gohmanf4423b12008-04-19 00:24:39 +00001455#ifdef YYTYPE_INT8
1456typedef YYTYPE_INT8 yytype_int8;
1457#elif (defined __STDC__ || defined __C99__FUNC__ \
1458 || defined __cplusplus || defined _MSC_VER)
1459typedef signed char yytype_int8;
1460#else
1461typedef short int yytype_int8;
1462#endif
1463
1464#ifdef YYTYPE_UINT16
1465typedef YYTYPE_UINT16 yytype_uint16;
1466#else
1467typedef unsigned short int yytype_uint16;
1468#endif
1469
1470#ifdef YYTYPE_INT16
1471typedef YYTYPE_INT16 yytype_int16;
1472#else
1473typedef short int yytype_int16;
1474#endif
1475
1476#ifndef YYSIZE_T
1477# ifdef __SIZE_TYPE__
1478# define YYSIZE_T __SIZE_TYPE__
1479# elif defined size_t
1480# define YYSIZE_T size_t
1481# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1482 || defined __cplusplus || defined _MSC_VER)
1483# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1484# define YYSIZE_T size_t
1485# else
1486# define YYSIZE_T unsigned int
1487# endif
1488#endif
1489
1490#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1491
1492#ifndef YY_
Dan Gohman180c1692008-06-23 18:43:26 +00001493# if defined YYENABLE_NLS && YYENABLE_NLS
Dan Gohmanf4423b12008-04-19 00:24:39 +00001494# if ENABLE_NLS
1495# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1496# define YY_(msgid) dgettext ("bison-runtime", msgid)
1497# endif
1498# endif
1499# ifndef YY_
1500# define YY_(msgid) msgid
1501# endif
1502#endif
1503
1504/* Suppress unused-variable warnings by "using" E. */
1505#if ! defined lint || defined __GNUC__
1506# define YYUSE(e) ((void) (e))
1507#else
1508# define YYUSE(e) /* empty */
1509#endif
1510
1511/* Identity function, used to suppress warnings about constant conditions. */
1512#ifndef lint
1513# define YYID(n) (n)
1514#else
1515#if (defined __STDC__ || defined __C99__FUNC__ \
1516 || defined __cplusplus || defined _MSC_VER)
1517static int
1518YYID (int i)
1519#else
1520static int
1521YYID (i)
1522 int i;
1523#endif
1524{
1525 return i;
1526}
1527#endif
1528
1529#if ! defined yyoverflow || YYERROR_VERBOSE
1530
1531/* The parser invokes alloca or malloc; define the necessary symbols. */
1532
1533# ifdef YYSTACK_USE_ALLOCA
1534# if YYSTACK_USE_ALLOCA
1535# ifdef __GNUC__
1536# define YYSTACK_ALLOC __builtin_alloca
1537# elif defined __BUILTIN_VA_ARG_INCR
1538# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1539# elif defined _AIX
1540# define YYSTACK_ALLOC __alloca
1541# elif defined _MSC_VER
1542# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1543# define alloca _alloca
1544# else
1545# define YYSTACK_ALLOC alloca
1546# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1547 || defined __cplusplus || defined _MSC_VER)
1548# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1549# ifndef _STDLIB_H
1550# define _STDLIB_H 1
1551# endif
1552# endif
1553# endif
1554# endif
1555# endif
1556
1557# ifdef YYSTACK_ALLOC
1558 /* Pacify GCC's `empty if-body' warning. */
1559# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1560# ifndef YYSTACK_ALLOC_MAXIMUM
1561 /* The OS might guarantee only one guard page at the bottom of the stack,
1562 and a page size can be as small as 4096 bytes. So we cannot safely
1563 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1564 to allow for a few compiler-allocated temporary stack slots. */
1565# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1566# endif
1567# else
1568# define YYSTACK_ALLOC YYMALLOC
1569# define YYSTACK_FREE YYFREE
1570# ifndef YYSTACK_ALLOC_MAXIMUM
1571# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1572# endif
1573# if (defined __cplusplus && ! defined _STDLIB_H \
1574 && ! ((defined YYMALLOC || defined malloc) \
1575 && (defined YYFREE || defined free)))
1576# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1577# ifndef _STDLIB_H
1578# define _STDLIB_H 1
1579# endif
1580# endif
1581# ifndef YYMALLOC
1582# define YYMALLOC malloc
1583# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1584 || defined __cplusplus || defined _MSC_VER)
1585void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1586# endif
1587# endif
1588# ifndef YYFREE
1589# define YYFREE free
1590# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1591 || defined __cplusplus || defined _MSC_VER)
1592void free (void *); /* INFRINGES ON USER NAME SPACE */
1593# endif
1594# endif
1595# endif
1596#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1597
1598
1599#if (! defined yyoverflow \
1600 && (! defined __cplusplus \
1601 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1602
1603/* A type that is properly aligned for any stack member. */
1604union yyalloc
1605{
1606 yytype_int16 yyss;
1607 YYSTYPE yyvs;
1608 };
1609
1610/* The size of the maximum gap between one aligned stack and the next. */
1611# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1612
1613/* The size of an array large to enough to hold all stacks, each with
1614 N elements. */
1615# define YYSTACK_BYTES(N) \
1616 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1617 + YYSTACK_GAP_MAXIMUM)
1618
1619/* Copy COUNT objects from FROM to TO. The source and destination do
1620 not overlap. */
1621# ifndef YYCOPY
1622# if defined __GNUC__ && 1 < __GNUC__
1623# define YYCOPY(To, From, Count) \
1624 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1625# else
1626# define YYCOPY(To, From, Count) \
1627 do \
1628 { \
1629 YYSIZE_T yyi; \
1630 for (yyi = 0; yyi < (Count); yyi++) \
1631 (To)[yyi] = (From)[yyi]; \
1632 } \
1633 while (YYID (0))
1634# endif
1635# endif
1636
1637/* Relocate STACK from its old location to the new one. The
1638 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1639 elements in the stack, and YYPTR gives the new location of the
1640 stack. Advance YYPTR to a properly aligned location for the next
1641 stack. */
1642# define YYSTACK_RELOCATE(Stack) \
1643 do \
1644 { \
1645 YYSIZE_T yynewbytes; \
1646 YYCOPY (&yyptr->Stack, Stack, yysize); \
1647 Stack = &yyptr->Stack; \
1648 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1649 yyptr += yynewbytes / sizeof (*yyptr); \
1650 } \
1651 while (YYID (0))
1652
1653#endif
1654
1655/* YYFINAL -- State number of the termination state. */
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001656#define YYFINAL 44
Dan Gohmanf4423b12008-04-19 00:24:39 +00001657/* YYLAST -- Last index in YYTABLE. */
Devang Pateld4980812008-09-02 20:52:40 +00001658#define YYLAST 2421
Dan Gohmanf4423b12008-04-19 00:24:39 +00001659
1660/* YYNTOKENS -- Number of terminals. */
Devang Pateld4980812008-09-02 20:52:40 +00001661#define YYNTOKENS 176
Dan Gohmanf4423b12008-04-19 00:24:39 +00001662/* YYNNTS -- Number of nonterminals. */
Devang Pateld4980812008-09-02 20:52:40 +00001663#define YYNNTS 90
Dan Gohmanf4423b12008-04-19 00:24:39 +00001664/* YYNRULES -- Number of rules. */
Devang Pateld4980812008-09-02 20:52:40 +00001665#define YYNRULES 353
Dan Gohmanf4423b12008-04-19 00:24:39 +00001666/* YYNRULES -- Number of states. */
Devang Pateld4980812008-09-02 20:52:40 +00001667#define YYNSTATES 720
Dan Gohmanf4423b12008-04-19 00:24:39 +00001668
1669/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1670#define YYUNDEFTOK 2
Devang Pateld4980812008-09-02 20:52:40 +00001671#define YYMAXUTOK 416
Dan Gohmanf4423b12008-04-19 00:24:39 +00001672
1673#define YYTRANSLATE(YYX) \
1674 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1675
1676/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1677static const yytype_uint8 yytranslate[] =
1678{
1679 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1680 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1681 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1682 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Pateld4980812008-09-02 20:52:40 +00001683 162, 163, 166, 2, 165, 2, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001684 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Pateld4980812008-09-02 20:52:40 +00001685 171, 164, 172, 2, 2, 2, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001686 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1687 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Pateld4980812008-09-02 20:52:40 +00001688 2, 168, 167, 170, 2, 2, 2, 2, 2, 175,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001689 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1690 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Pateld4980812008-09-02 20:52:40 +00001691 169, 2, 2, 173, 2, 174, 2, 2, 2, 2,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001692 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1693 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1694 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1695 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1696 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1697 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1698 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1699 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1700 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1701 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1702 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1703 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1704 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1705 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1706 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1707 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1708 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1709 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1710 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1711 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1712 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1713 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1714 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1715 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1716 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1717 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1718 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
Dan Gohmane4977cf2008-05-23 01:55:30 +00001719 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
Devang Pateld4980812008-09-02 20:52:40 +00001720 155, 156, 157, 158, 159, 160, 161
Dan Gohmanf4423b12008-04-19 00:24:39 +00001721};
1722
1723#if YYDEBUG
1724/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1725 YYRHS. */
1726static const yytype_uint16 yyprhs[] =
1727{
1728 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1729 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1730 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1731 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1732 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1733 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1734 119, 121, 123, 125, 127, 129, 130, 135, 136, 139,
Chris Lattner15bd0952008-08-29 17:20:18 +00001735 140, 143, 145, 147, 149, 150, 153, 155, 157, 159,
1736 161, 163, 165, 167, 169, 171, 172, 174, 176, 178,
1737 179, 181, 183, 184, 186, 188, 190, 192, 193, 195,
1738 197, 198, 200, 202, 204, 206, 208, 210, 213, 215,
1739 217, 219, 221, 223, 225, 227, 229, 231, 234, 235,
Devang Pateld4980812008-09-02 20:52:40 +00001740 238, 240, 242, 244, 246, 248, 250, 251, 254, 256,
1741 260, 264, 268, 270, 271, 276, 277, 280, 281, 284,
1742 285, 289, 292, 293, 295, 296, 300, 302, 305, 307,
1743 309, 311, 313, 315, 317, 319, 321, 323, 327, 329,
1744 332, 338, 344, 350, 356, 360, 363, 369, 374, 377,
1745 379, 381, 383, 387, 389, 393, 395, 396, 398, 402,
1746 407, 411, 415, 420, 425, 429, 436, 442, 445, 448,
1747 451, 454, 457, 460, 463, 466, 469, 472, 475, 478,
1748 485, 491, 500, 507, 514, 522, 530, 538, 546, 553,
1749 562, 571, 577, 585, 589, 591, 593, 595, 597, 598,
1750 601, 608, 610, 611, 613, 616, 617, 621, 622, 626,
1751 630, 634, 638, 639, 648, 649, 659, 660, 670, 676,
1752 679, 683, 685, 689, 693, 697, 701, 703, 704, 710,
1753 714, 716, 720, 722, 723, 735, 737, 739, 744, 746,
1754 748, 751, 755, 756, 758, 760, 762, 764, 766, 768,
1755 770, 772, 774, 776, 778, 782, 786, 789, 792, 796,
1756 799, 805, 810, 812, 818, 820, 822, 824, 826, 828,
1757 830, 833, 835, 839, 842, 845, 849, 853, 856, 857,
1758 859, 862, 865, 869, 879, 889, 898, 913, 915, 917,
1759 924, 930, 933, 936, 943, 951, 956, 961, 968, 975,
1760 976, 977, 981, 984, 988, 991, 993, 999, 1005, 1012,
1761 1019, 1026, 1033, 1038, 1045, 1050, 1055, 1062, 1069, 1072,
1762 1081, 1083, 1085, 1086, 1090, 1097, 1101, 1108, 1111, 1117,
1763 1125, 1131, 1136, 1141
Dan Gohmanf4423b12008-04-19 00:24:39 +00001764};
1765
1766/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1767static const yytype_int16 yyrhs[] =
1768{
Devang Pateld4980812008-09-02 20:52:40 +00001769 226, 0, -1, 76, -1, 77, -1, 78, -1, 79,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00001770 -1, 80, -1, 81, -1, 82, -1, 83, -1, 84,
1771 -1, 88, -1, 89, -1, 90, -1, 85, -1, 86,
1772 -1, 87, -1, 121, -1, 122, -1, 123, -1, 124,
1773 -1, 125, -1, 126, -1, 127, -1, 128, -1, 129,
1774 -1, 130, -1, 131, -1, 132, -1, 95, -1, 96,
1775 -1, 97, -1, 98, -1, 99, -1, 100, -1, 101,
1776 -1, 102, -1, 103, -1, 104, -1, 105, -1, 106,
1777 -1, 107, -1, 108, -1, 109, -1, 110, -1, 111,
1778 -1, 112, -1, 113, -1, 114, -1, 101, -1, 102,
1779 -1, 103, -1, 104, -1, 26, -1, 27, -1, 11,
Dan Gohmanf4423b12008-04-19 00:24:39 +00001780 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
Devang Pateld4980812008-09-02 20:52:40 +00001781 -1, 19, -1, 22, -1, 24, -1, 184, -1, -1,
1782 55, 162, 4, 163, -1, -1, 184, 164, -1, -1,
1783 7, 164, -1, 20, -1, 23, -1, 191, -1, -1,
1784 189, 164, -1, 42, -1, 44, -1, 43, -1, 45,
Chris Lattner15bd0952008-08-29 17:20:18 +00001785 -1, 47, -1, 49, -1, 46, -1, 48, -1, 51,
Devang Pateld4980812008-09-02 20:52:40 +00001786 -1, -1, 159, -1, 160, -1, 161, -1, -1, 46,
Chris Lattner15bd0952008-08-29 17:20:18 +00001787 -1, 48, -1, -1, 42, -1, 43, -1, 44, -1,
1788 47, -1, -1, 44, -1, 42, -1, -1, 63, -1,
1789 64, -1, 65, -1, 66, -1, 67, -1, 68, -1,
1790 62, 4, -1, 143, -1, 122, -1, 142, -1, 123,
1791 -1, 145, -1, 146, -1, 148, -1, 149, -1, 150,
Devang Pateld4980812008-09-02 20:52:40 +00001792 -1, 54, 4, -1, -1, 200, 199, -1, 144, -1,
Chris Lattner15bd0952008-08-29 17:20:18 +00001793 147, -1, 143, -1, 142, -1, 151, -1, 152, -1,
Devang Pateld4980812008-09-02 20:52:40 +00001794 -1, 202, 201, -1, 204, -1, 203, 165, 204, -1,
1795 155, 164, 157, -1, 155, 164, 156, -1, 158, -1,
1796 -1, 154, 162, 203, 163, -1, -1, 153, 22, -1,
1797 -1, 54, 4, -1, -1, 165, 54, 4, -1, 34,
1798 22, -1, -1, 209, -1, -1, 165, 212, 211, -1,
1799 209, -1, 54, 4, -1, 11, -1, 12, -1, 13,
1800 -1, 16, -1, 15, -1, 14, -1, 17, -1, 50,
1801 -1, 213, -1, 214, 186, 166, -1, 248, -1, 167,
1802 4, -1, 214, 162, 218, 163, 202, -1, 10, 162,
1803 218, 163, 202, -1, 168, 4, 169, 214, 170, -1,
1804 171, 4, 169, 214, 172, -1, 173, 219, 174, -1,
1805 173, 174, -1, 171, 173, 219, 174, 172, -1, 171,
1806 173, 174, 172, -1, 214, 200, -1, 214, -1, 10,
1807 -1, 215, -1, 217, 165, 215, -1, 217, -1, 217,
1808 165, 39, -1, 39, -1, -1, 214, -1, 219, 165,
1809 214, -1, 214, 168, 222, 170, -1, 214, 168, 170,
1810 -1, 214, 175, 22, -1, 214, 171, 222, 172, -1,
1811 214, 173, 222, 174, -1, 214, 173, 174, -1, 214,
1812 171, 173, 222, 174, 172, -1, 214, 171, 173, 174,
1813 172, -1, 214, 40, -1, 214, 41, -1, 214, 248,
1814 -1, 214, 221, -1, 214, 25, -1, 182, 3, -1,
1815 182, 5, -1, 182, 4, -1, 182, 6, -1, 11,
1816 26, -1, 11, 27, -1, 183, 9, -1, 179, 162,
1817 220, 38, 214, 163, -1, 120, 162, 220, 260, 163,
1818 -1, 134, 162, 220, 165, 220, 165, 220, 163, -1,
1819 177, 162, 220, 165, 220, 163, -1, 178, 162, 220,
1820 165, 220, 163, -1, 91, 180, 162, 220, 165, 220,
1821 163, -1, 92, 181, 162, 220, 165, 220, 163, -1,
1822 93, 180, 162, 220, 165, 220, 163, -1, 94, 181,
1823 162, 220, 165, 220, 163, -1, 136, 162, 220, 165,
1824 220, 163, -1, 137, 162, 220, 165, 220, 165, 220,
1825 163, -1, 138, 162, 220, 165, 220, 165, 220, 163,
1826 -1, 140, 162, 220, 261, 163, -1, 141, 162, 220,
1827 165, 220, 261, 163, -1, 222, 165, 220, -1, 220,
1828 -1, 32, -1, 33, -1, 37, -1, -1, 216, 248,
1829 -1, 126, 162, 225, 38, 214, 163, -1, 227, -1,
1830 -1, 228, -1, 227, 228, -1, -1, 31, 229, 244,
1831 -1, -1, 30, 230, 245, -1, 60, 59, 234, -1,
1832 187, 18, 214, -1, 187, 18, 10, -1, -1, 190,
1833 194, 224, 223, 220, 186, 231, 211, -1, -1, 190,
1834 192, 194, 224, 223, 220, 186, 232, 211, -1, -1,
1835 190, 193, 194, 224, 223, 214, 186, 233, 211, -1,
1836 190, 194, 35, 197, 225, -1, 52, 235, -1, 56,
1837 164, 236, -1, 22, -1, 53, 164, 22, -1, 69,
1838 164, 22, -1, 168, 237, 170, -1, 237, 165, 22,
1839 -1, 22, -1, -1, 238, 165, 214, 200, 185, -1,
1840 214, 200, 185, -1, 238, -1, 238, 165, 39, -1,
1841 39, -1, -1, 198, 216, 189, 162, 239, 163, 202,
1842 210, 207, 206, 205, -1, 28, -1, 173, -1, 196,
1843 194, 240, 241, -1, 29, -1, 174, -1, 252, 243,
1844 -1, 195, 194, 240, -1, -1, 61, -1, 3, -1,
1845 4, -1, 5, -1, 6, -1, 9, -1, 26, -1,
1846 27, -1, 40, -1, 41, -1, 25, -1, 171, 222,
1847 172, -1, 168, 222, 170, -1, 168, 170, -1, 175,
1848 22, -1, 173, 222, 174, -1, 173, 174, -1, 171,
1849 173, 222, 174, 172, -1, 171, 173, 174, 172, -1,
1850 221, -1, 59, 246, 22, 165, 22, -1, 7, -1,
1851 8, -1, 184, -1, 189, -1, 248, -1, 247, -1,
1852 214, 249, -1, 250, -1, 251, 165, 250, -1, 252,
1853 253, -1, 242, 253, -1, 254, 187, 255, -1, 254,
1854 188, 255, -1, 254, 257, -1, -1, 21, -1, 70,
1855 251, -1, 70, 10, -1, 71, 17, 249, -1, 71,
1856 11, 249, 165, 17, 249, 165, 17, 249, -1, 72,
1857 182, 249, 165, 17, 249, 168, 256, 170, -1, 72,
1858 182, 249, 165, 17, 249, 168, 170, -1, 73, 198,
1859 216, 249, 162, 259, 163, 202, 38, 17, 249, 74,
1860 17, 249, -1, 74, -1, 75, -1, 256, 182, 247,
1861 165, 17, 249, -1, 182, 247, 165, 17, 249, -1,
1862 187, 263, -1, 188, 263, -1, 214, 168, 249, 165,
1863 249, 170, -1, 258, 165, 168, 249, 165, 249, 170,
1864 -1, 214, 200, 249, 200, -1, 17, 200, 249, 200,
1865 -1, 259, 165, 214, 200, 249, 200, -1, 259, 165,
1866 17, 200, 249, 200, -1, -1, -1, 260, 165, 250,
1867 -1, 165, 4, -1, 261, 165, 4, -1, 58, 57,
1868 -1, 57, -1, 177, 214, 249, 165, 249, -1, 178,
1869 214, 249, 165, 249, -1, 91, 180, 214, 249, 165,
1870 249, -1, 92, 181, 214, 249, 165, 249, -1, 93,
1871 180, 214, 249, 165, 249, -1, 94, 181, 214, 249,
1872 165, 249, -1, 179, 250, 38, 214, -1, 134, 250,
1873 165, 250, 165, 250, -1, 135, 250, 165, 214, -1,
1874 136, 250, 165, 250, -1, 137, 250, 165, 250, 165,
1875 250, -1, 138, 250, 165, 250, 165, 250, -1, 133,
1876 258, -1, 262, 198, 216, 249, 162, 259, 163, 202,
1877 -1, 265, -1, 36, -1, -1, 115, 214, 208, -1,
1878 115, 214, 165, 11, 249, 208, -1, 116, 214, 208,
1879 -1, 116, 214, 165, 11, 249, 208, -1, 117, 250,
1880 -1, 264, 118, 214, 249, 208, -1, 264, 119, 250,
1881 165, 214, 249, 208, -1, 139, 214, 249, 165, 4,
1882 -1, 120, 214, 249, 260, -1, 140, 214, 249, 261,
1883 -1, 141, 214, 249, 165, 214, 249, 261, -1
Dan Gohmanf4423b12008-04-19 00:24:39 +00001884};
1885
1886/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1887static const yytype_uint16 yyrline[] =
1888{
Devang Pateld4980812008-09-02 20:52:40 +00001889 0, 1142, 1142, 1142, 1142, 1142, 1142, 1142, 1142, 1142,
1890 1142, 1143, 1143, 1143, 1143, 1143, 1143, 1144, 1144, 1144,
1891 1144, 1144, 1144, 1145, 1145, 1145, 1145, 1145, 1145, 1148,
1892 1148, 1149, 1149, 1150, 1150, 1151, 1151, 1152, 1152, 1156,
1893 1156, 1157, 1157, 1158, 1158, 1159, 1159, 1160, 1160, 1161,
1894 1161, 1162, 1162, 1163, 1164, 1169, 1170, 1170, 1170, 1170,
1895 1170, 1172, 1172, 1172, 1173, 1173, 1175, 1176, 1180, 1184,
1896 1189, 1195, 1195, 1197, 1198, 1203, 1209, 1210, 1211, 1212,
1897 1213, 1214, 1218, 1219, 1220, 1224, 1225, 1226, 1227, 1231,
1898 1232, 1233, 1237, 1238, 1239, 1240, 1241, 1245, 1246, 1247,
1899 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1264, 1265,
1900 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1277, 1278,
1901 1283, 1284, 1285, 1286, 1287, 1288, 1291, 1292, 1297, 1298,
1902 1309, 1310, 1311, 1314, 1315, 1320, 1321, 1328, 1329, 1335,
1903 1336, 1345, 1353, 1354, 1359, 1360, 1361, 1366, 1379, 1379,
1904 1379, 1379, 1379, 1379, 1379, 1382, 1386, 1390, 1397, 1402,
1905 1410, 1439, 1464, 1469, 1479, 1489, 1493, 1503, 1510, 1519,
1906 1526, 1531, 1536, 1543, 1544, 1551, 1558, 1566, 1572, 1584,
1907 1612, 1628, 1655, 1683, 1709, 1729, 1755, 1775, 1787, 1794,
1908 1860, 1870, 1880, 1886, 1896, 1902, 1912, 1918, 1924, 1937,
1909 1949, 1970, 1978, 1984, 1995, 2000, 2005, 2010, 2015, 2021,
1910 2027, 2033, 2041, 2052, 2056, 2064, 2064, 2067, 2067, 2070,
1911 2082, 2103, 2108, 2116, 2117, 2121, 2121, 2125, 2125, 2128,
1912 2131, 2155, 2167, 2166, 2178, 2177, 2187, 2186, 2197, 2237,
1913 2240, 2246, 2256, 2260, 2265, 2267, 2272, 2277, 2286, 2296,
1914 2307, 2311, 2320, 2329, 2334, 2466, 2466, 2468, 2477, 2477,
1915 2479, 2484, 2496, 2500, 2505, 2509, 2513, 2518, 2523, 2527,
1916 2531, 2535, 2539, 2543, 2547, 2569, 2591, 2597, 2610, 2622,
1917 2627, 2639, 2645, 2649, 2659, 2663, 2667, 2672, 2679, 2679,
1918 2685, 2694, 2699, 2704, 2708, 2717, 2726, 2739, 2748, 2752,
1919 2760, 2780, 2784, 2789, 2800, 2819, 2828, 2914, 2918, 2925,
1920 2936, 2949, 2958, 2971, 2982, 2992, 3003, 3011, 3021, 3028,
1921 3031, 3032, 3040, 3046, 3055, 3059, 3064, 3080, 3097, 3111,
1922 3125, 3139, 3153, 3165, 3173, 3180, 3186, 3192, 3198, 3213,
1923 3303, 3308, 3312, 3319, 3326, 3336, 3343, 3353, 3361, 3375,
1924 3392, 3406, 3421, 3436
Dan Gohmanf4423b12008-04-19 00:24:39 +00001925};
1926#endif
1927
1928#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1929/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1930 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1931static const char *const yytname[] =
1932{
1933 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1934 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1935 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1936 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1937 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1938 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1939 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1940 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
Dale Johannesenc7071cc2008-05-14 20:13:36 +00001941 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "COMMON", "OPAQUE",
Dan Gohmanf4423b12008-04-19 00:24:39 +00001942 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1943 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1944 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
Dale Johannesen20ab78b2008-08-13 18:41:46 +00001945 "X86_SSECALLCC_TOK", "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE",
1946 "UNWIND", "UNREACHABLE", "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV",
1947 "UREM", "SREM", "FREM", "AND", "OR", "XOR", "SHL", "LSHR", "ASHR",
1948 "ICMP", "FCMP", "VICMP", "VFCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE",
1949 "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE",
1950 "ORD", "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE",
1951 "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST",
1952 "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT",
1953 "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT",
1954 "SHUFFLEVECTOR", "GETRESULT", "EXTRACTVALUE", "INSERTVALUE", "SIGNEXT",
1955 "ZEROEXT", "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL",
Devang Pateld4980812008-09-02 20:52:40 +00001956 "NEST", "READNONE", "READONLY", "GC", "FNNOTE", "INLINE", "ALWAYS",
1957 "NEVER", "OPTIMIZEFORSIZE", "DEFAULT", "HIDDEN", "PROTECTED", "'('",
1958 "')'", "'='", "','", "'*'", "'\\\\'", "'['", "'x'", "']'", "'<'", "'>'",
1959 "'{'", "'}'", "'c'", "$accept", "ArithmeticOps", "LogicalOps", "CastOps",
1960 "IPredicates", "FPredicates", "IntType", "FPType", "LocalName",
1961 "OptLocalName", "OptAddrSpace", "OptLocalAssign", "LocalNumber",
1962 "GlobalName", "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
1963 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1964 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr",
1965 "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "FuncNoteList", "FuncNote",
1966 "OptFuncNotes", "OptGC", "OptAlign", "OptCAlign", "SectionString",
Chris Lattner15bd0952008-08-29 17:20:18 +00001967 "OptSection", "GlobalVarAttributes", "GlobalVarAttribute", "PrimType",
1968 "Types", "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI",
1969 "TypeListI", "ConstVal", "ConstExpr", "ConstVector", "GlobalType",
1970 "ThreadLocal", "AliaseeRef", "Module", "DefinitionList", "Definition",
1971 "@1", "@2", "@3", "@4", "@5", "AsmBlock", "TargetDefinition",
1972 "LibrariesDefinition", "LibList", "ArgListH", "ArgList",
1973 "FunctionHeaderH", "BEGIN", "FunctionHeader", "END", "Function",
1974 "FunctionProto", "OptSideEffect", "ConstValueRef", "SymbolicValueRef",
1975 "ValueRef", "ResolvedVal", "ReturnedVal", "BasicBlockList", "BasicBlock",
1976 "InstructionList", "BBTerminatorInst", "JumpTable", "Inst", "PHIList",
1977 "ParamList", "IndexList", "ConstantIndexList", "OptTailCall", "InstVal",
1978 "OptVolatile", "MemoryInst", 0
Dan Gohmanf4423b12008-04-19 00:24:39 +00001979};
1980#endif
1981
1982# ifdef YYPRINT
1983/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1984 token YYLEX-NUM. */
1985static const yytype_uint16 yytoknum[] =
1986{
1987 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1988 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1989 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1990 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1991 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1992 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1993 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1994 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1995 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1996 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1997 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1998 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1999 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
2000 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
2001 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
Devang Pateld4980812008-09-02 20:52:40 +00002002 405, 406, 407, 408, 409, 410, 411, 412, 413, 414,
2003 415, 416, 40, 41, 61, 44, 42, 92, 91, 120,
2004 93, 60, 62, 123, 125, 99
Dan Gohmanf4423b12008-04-19 00:24:39 +00002005};
2006# endif
2007
2008/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002009static const yytype_uint16 yyr1[] =
Dan Gohmanf4423b12008-04-19 00:24:39 +00002010{
Devang Pateld4980812008-09-02 20:52:40 +00002011 0, 176, 177, 177, 177, 177, 177, 177, 177, 177,
2012 177, 178, 178, 178, 178, 178, 178, 179, 179, 179,
2013 179, 179, 179, 179, 179, 179, 179, 179, 179, 180,
2014 180, 180, 180, 180, 180, 180, 180, 180, 180, 181,
2015 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
2016 181, 181, 181, 181, 181, 182, 183, 183, 183, 183,
2017 183, 184, 184, 184, 185, 185, 186, 186, 187, 187,
2018 188, 189, 189, 190, 190, 191, 192, 192, 192, 192,
2019 192, 192, 193, 193, 193, 194, 194, 194, 194, 195,
2020 195, 195, 196, 196, 196, 196, 196, 197, 197, 197,
2021 198, 198, 198, 198, 198, 198, 198, 198, 199, 199,
2022 199, 199, 199, 199, 199, 199, 199, 199, 200, 200,
2023 201, 201, 201, 201, 201, 201, 202, 202, 203, 203,
2024 204, 204, 204, 205, 205, 206, 206, 207, 207, 208,
2025 208, 209, 210, 210, 211, 211, 212, 212, 213, 213,
2026 213, 213, 213, 213, 213, 214, 214, 214, 214, 214,
2027 214, 214, 214, 214, 214, 214, 214, 214, 215, 216,
2028 216, 217, 217, 218, 218, 218, 218, 219, 219, 220,
2029 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,
2030 220, 220, 220, 220, 220, 220, 220, 220, 220, 221,
2031 221, 221, 221, 221, 221, 221, 221, 221, 221, 221,
2032 221, 221, 221, 222, 222, 223, 223, 224, 224, 225,
2033 225, 226, 226, 227, 227, 229, 228, 230, 228, 228,
2034 228, 228, 231, 228, 232, 228, 233, 228, 228, 228,
2035 228, 234, 235, 235, 236, 237, 237, 237, 238, 238,
2036 239, 239, 239, 239, 240, 241, 241, 242, 243, 243,
2037 244, 245, 246, 246, 247, 247, 247, 247, 247, 247,
2038 247, 247, 247, 247, 247, 247, 247, 247, 247, 247,
2039 247, 247, 247, 247, 248, 248, 248, 248, 249, 249,
2040 250, 251, 251, 252, 252, 253, 253, 254, 254, 254,
2041 255, 255, 255, 255, 255, 255, 255, 255, 255, 256,
2042 256, 257, 257, 258, 258, 259, 259, 259, 259, 259,
2043 260, 260, 261, 261, 262, 262, 263, 263, 263, 263,
2044 263, 263, 263, 263, 263, 263, 263, 263, 263, 263,
2045 263, 264, 264, 265, 265, 265, 265, 265, 265, 265,
2046 265, 265, 265, 265
Dan Gohmanf4423b12008-04-19 00:24:39 +00002047};
2048
2049/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
2050static const yytype_uint8 yyr2[] =
2051{
2052 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
2053 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2054 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2055 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2056 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2057 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2058 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
Chris Lattner15bd0952008-08-29 17:20:18 +00002059 2, 1, 1, 1, 0, 2, 1, 1, 1, 1,
2060 1, 1, 1, 1, 1, 0, 1, 1, 1, 0,
2061 1, 1, 0, 1, 1, 1, 1, 0, 1, 1,
2062 0, 1, 1, 1, 1, 1, 1, 2, 1, 1,
2063 1, 1, 1, 1, 1, 1, 1, 2, 0, 2,
Devang Pateld4980812008-09-02 20:52:40 +00002064 1, 1, 1, 1, 1, 1, 0, 2, 1, 3,
2065 3, 3, 1, 0, 4, 0, 2, 0, 2, 0,
2066 3, 2, 0, 1, 0, 3, 1, 2, 1, 1,
2067 1, 1, 1, 1, 1, 1, 1, 3, 1, 2,
2068 5, 5, 5, 5, 3, 2, 5, 4, 2, 1,
2069 1, 1, 3, 1, 3, 1, 0, 1, 3, 4,
2070 3, 3, 4, 4, 3, 6, 5, 2, 2, 2,
2071 2, 2, 2, 2, 2, 2, 2, 2, 2, 6,
2072 5, 8, 6, 6, 7, 7, 7, 7, 6, 8,
2073 8, 5, 7, 3, 1, 1, 1, 1, 0, 2,
2074 6, 1, 0, 1, 2, 0, 3, 0, 3, 3,
2075 3, 3, 0, 8, 0, 9, 0, 9, 5, 2,
2076 3, 1, 3, 3, 3, 3, 1, 0, 5, 3,
2077 1, 3, 1, 0, 11, 1, 1, 4, 1, 1,
2078 2, 3, 0, 1, 1, 1, 1, 1, 1, 1,
2079 1, 1, 1, 1, 3, 3, 2, 2, 3, 2,
2080 5, 4, 1, 5, 1, 1, 1, 1, 1, 1,
2081 2, 1, 3, 2, 2, 3, 3, 2, 0, 1,
2082 2, 2, 3, 9, 9, 8, 14, 1, 1, 6,
2083 5, 2, 2, 6, 7, 4, 4, 6, 6, 0,
2084 0, 3, 2, 3, 2, 1, 5, 5, 6, 6,
2085 6, 6, 4, 6, 4, 4, 6, 6, 2, 8,
2086 1, 1, 0, 3, 6, 3, 6, 2, 5, 7,
2087 5, 4, 4, 7
Dan Gohmanf4423b12008-04-19 00:24:39 +00002088};
2089
2090/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2091 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2092 means the default is an error. */
2093static const yytype_uint16 yydefact[] =
2094{
Devang Pateld4980812008-09-02 20:52:40 +00002095 74, 61, 71, 62, 72, 63, 227, 225, 0, 0,
2096 0, 0, 0, 0, 85, 73, 0, 74, 223, 89,
2097 92, 0, 0, 239, 0, 0, 68, 0, 75, 76,
Chris Lattner15bd0952008-08-29 17:20:18 +00002098 78, 77, 79, 82, 80, 83, 81, 84, 86, 87,
Devang Pateld4980812008-09-02 20:52:40 +00002099 88, 85, 85, 218, 1, 224, 90, 91, 85, 228,
2100 93, 94, 95, 96, 85, 298, 226, 298, 0, 0,
2101 247, 240, 241, 229, 284, 285, 231, 148, 149, 150,
2102 153, 152, 151, 154, 155, 0, 0, 0, 0, 286,
2103 287, 156, 230, 158, 218, 218, 97, 217, 0, 100,
2104 100, 299, 294, 69, 258, 259, 260, 293, 242, 243,
2105 246, 0, 176, 159, 0, 0, 0, 0, 165, 177,
2106 0, 0, 176, 0, 0, 0, 99, 98, 0, 215,
2107 216, 0, 0, 101, 102, 103, 104, 105, 106, 0,
2108 261, 0, 0, 342, 342, 297, 0, 244, 175, 118,
2109 171, 173, 0, 0, 0, 0, 0, 0, 164, 0,
2110 0, 157, 0, 0, 170, 0, 169, 0, 238, 148,
2111 149, 150, 153, 152, 151, 0, 0, 67, 67, 107,
2112 0, 255, 256, 257, 70, 341, 325, 0, 0, 0,
2113 0, 100, 307, 308, 2, 3, 4, 5, 6, 7,
Chris Lattner15bd0952008-08-29 17:20:18 +00002114 8, 9, 10, 14, 15, 16, 11, 12, 13, 0,
2115 0, 0, 0, 0, 0, 0, 0, 17, 18, 19,
2116 20, 21, 22, 23, 24, 25, 26, 27, 28, 0,
Nate Begemanac80ade2008-05-12 19:01:56 +00002117 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Pateld4980812008-09-02 20:52:40 +00002118 0, 295, 100, 311, 0, 340, 296, 312, 245, 168,
2119 0, 126, 67, 67, 167, 0, 178, 0, 126, 67,
2120 67, 0, 219, 196, 197, 192, 194, 193, 195, 198,
2121 191, 187, 188, 0, 0, 0, 0, 0, 0, 0,
Dan Gohmane4977cf2008-05-23 01:55:30 +00002122 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Pateld4980812008-09-02 20:52:40 +00002123 0, 190, 189, 232, 0, 324, 301, 67, 291, 300,
Chris Lattner15bd0952008-08-29 17:20:18 +00002124 0, 0, 55, 0, 0, 29, 30, 31, 32, 33,
2125 34, 35, 36, 37, 38, 0, 53, 54, 49, 50,
2126 51, 52, 39, 40, 41, 42, 43, 44, 45, 46,
Devang Pateld4980812008-09-02 20:52:40 +00002127 47, 48, 0, 0, 0, 139, 139, 347, 67, 67,
2128 338, 0, 0, 0, 0, 0, 67, 67, 67, 67,
Chris Lattner15bd0952008-08-29 17:20:18 +00002129 67, 0, 0, 0, 0, 0, 109, 111, 110, 108,
Devang Pateld4980812008-09-02 20:52:40 +00002130 112, 113, 114, 115, 116, 119, 174, 172, 161, 162,
2131 163, 166, 66, 160, 234, 236, 0, 0, 0, 0,
2132 0, 0, 0, 0, 0, 0, 0, 0, 180, 214,
2133 0, 0, 0, 184, 0, 181, 0, 0, 0, 144,
2134 253, 264, 265, 266, 267, 268, 273, 269, 270, 271,
2135 272, 262, 0, 0, 0, 0, 282, 289, 288, 290,
2136 0, 0, 302, 0, 0, 67, 67, 67, 67, 0,
2137 343, 0, 345, 320, 0, 0, 0, 0, 0, 0,
Chris Lattner15bd0952008-08-29 17:20:18 +00002138 0, 0, 0, 0, 0, 0, 0, 0, 67, 0,
Devang Pateld4980812008-09-02 20:52:40 +00002139 117, 123, 122, 120, 121, 124, 125, 127, 144, 144,
2140 0, 0, 0, 0, 0, 320, 0, 0, 0, 0,
2141 0, 0, 0, 179, 165, 177, 0, 182, 183, 0,
2142 0, 0, 0, 233, 252, 118, 250, 0, 263, 0,
2143 276, 0, 0, 0, 279, 0, 277, 292, 0, 0,
2144 0, 0, 0, 0, 0, 0, 0, 0, 351, 0,
2145 0, 0, 334, 335, 0, 0, 0, 0, 352, 0,
2146 0, 0, 332, 0, 139, 0, 235, 237, 67, 0,
Chris Lattner15bd0952008-08-29 17:20:18 +00002147 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Pateld4980812008-09-02 20:52:40 +00002148 213, 186, 0, 0, 0, 0, 0, 0, 146, 144,
2149 65, 0, 126, 0, 275, 165, 0, 274, 278, 0,
2150 0, 319, 0, 0, 0, 0, 139, 140, 139, 0,
2151 0, 0, 0, 0, 0, 350, 322, 0, 67, 326,
2152 327, 319, 0, 348, 67, 220, 0, 0, 0, 0,
2153 200, 0, 0, 0, 0, 211, 0, 185, 0, 0,
2154 67, 141, 147, 145, 64, 249, 251, 118, 142, 0,
2155 281, 0, 0, 0, 118, 118, 0, 328, 329, 330,
2156 331, 344, 346, 321, 0, 0, 333, 336, 337, 323,
2157 0, 0, 139, 0, 0, 0, 0, 0, 208, 0,
2158 0, 0, 202, 203, 199, 65, 143, 137, 283, 280,
2159 0, 0, 0, 0, 126, 0, 313, 0, 353, 126,
2160 349, 204, 205, 206, 207, 0, 0, 0, 212, 248,
2161 0, 135, 0, 305, 0, 0, 109, 111, 118, 118,
2162 0, 118, 118, 314, 339, 201, 209, 210, 138, 0,
2163 133, 303, 0, 304, 0, 316, 315, 0, 0, 0,
2164 136, 0, 254, 0, 0, 0, 118, 118, 0, 0,
2165 0, 0, 318, 317, 0, 132, 0, 128, 310, 0,
2166 0, 0, 134, 0, 309, 0, 131, 130, 129, 306
Dan Gohmanf4423b12008-04-19 00:24:39 +00002167};
2168
2169/* YYDEFGOTO[NTERM-NUM]. */
2170static const yytype_int16 yydefgoto[] =
2171{
Chris Lattner15bd0952008-08-29 17:20:18 +00002172 -1, 278, 279, 280, 305, 322, 165, 166, 79, 595,
2173 113, 12, 134, 80, 14, 15, 41, 42, 43, 48,
Devang Pateld4980812008-09-02 20:52:40 +00002174 54, 118, 129, 355, 239, 447, 358, 706, 707, 692,
2175 680, 661, 420, 538, 637, 473, 539, 81, 167, 140,
2176 157, 141, 142, 110, 379, 406, 380, 121, 88, 158,
2177 16, 17, 18, 20, 19, 389, 448, 449, 63, 23,
2178 61, 101, 476, 477, 130, 173, 55, 96, 56, 49,
2179 479, 407, 83, 409, 288, 289, 57, 92, 93, 231,
2180 665, 135, 330, 606, 498, 508, 232, 233, 234, 235
Dan Gohmanf4423b12008-04-19 00:24:39 +00002181};
2182
2183/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2184 STATE-NUM. */
Devang Pateld4980812008-09-02 20:52:40 +00002185#define YYPACT_NINF -630
Dan Gohmanf4423b12008-04-19 00:24:39 +00002186static const yytype_int16 yypact[] =
2187{
Devang Pateld4980812008-09-02 20:52:40 +00002188 247, -630, -630, -630, -630, -630, -630, -630, 30, -108,
2189 28, -66, 102, -40, -1, -630, 128, 668, -630, 29,
2190 248, 21, 44, -630, -28, 143, -630, 1914, -630, -630,
2191 -630, -630, -630, -630, -630, -630, -630, -630, -630, -630,
2192 -630, 191, 191, 170, -630, -630, -630, -630, 191, -630,
2193 -630, -630, -630, -630, 191, 167, -630, -7, 190, 210,
2194 221, -630, -630, -630, -630, -630, 114, -630, -630, -630,
2195 -630, -630, -630, -630, -630, 289, 315, 3, 50, -630,
2196 -630, -630, -32, -630, 252, 252, 171, -630, 280, 189,
2197 189, -630, -630, 324, -630, -630, -630, -630, -630, -630,
2198 -630, 57, 1662, -630, 153, 165, 313, 114, -630, -32,
2199 -84, 204, 1662, 214, 280, 280, -630, -630, 1614, -630,
2200 -630, 1955, 366, -630, -630, -630, -630, -630, -630, 1996,
2201 -630, -18, 219, 2230, 2230, -630, 354, -630, -630, -32,
2202 -630, 234, 260, 2040, 2040, 256, -80, 2040, -630, 411,
2203 275, -630, 1955, 2040, 114, 278, -32, 222, -630, 282,
2204 438, 439, 440, 441, 442, 158, 443, 1568, 398, -630,
2205 86, -630, -630, -630, -630, -630, -630, 400, 2081, 105,
2206 447, 189, -630, -630, -630, -630, -630, -630, -630, -630,
2207 -630, -630, -630, -630, -630, -630, -630, -630, -630, 480,
2208 284, 480, 284, 2040, 2040, 2040, 2040, -630, -630, -630,
2209 -630, -630, -630, -630, -630, -630, -630, -630, -630, 2040,
2210 2040, 2040, 2040, 2040, 2040, 2040, 2040, 2040, 2040, 2040,
2211 2040, -630, 189, -630, 55, -630, -630, -630, -630, 424,
2212 1703, -630, -19, -36, -630, 287, -32, 297, -630, 398,
2213 13, 1614, -630, -630, -630, -630, -630, -630, -630, -630,
2214 -630, -630, -630, 480, 284, 480, 284, 299, 300, 306,
2215 307, 310, 317, 320, 1744, 2122, 541, 453, 323, 326,
2216 328, -630, -630, -630, 330, -630, 114, 984, -630, 312,
2217 1157, 1157, -630, 1157, 1996, -630, -630, -630, -630, -630,
2218 -630, -630, -630, -630, -630, 2040, -630, -630, -630, -630,
2219 -630, -630, -630, -630, -630, -630, -630, -630, -630, -630,
2220 -630, -630, 2040, 2040, 2040, -17, 24, -630, 984, -39,
2221 336, 337, 341, 342, 343, 345, 984, 984, 984, 984,
2222 984, 457, 1996, 2040, 2040, 509, -630, -630, -630, -630,
2223 -630, -630, -630, -630, -630, -630, -630, -630, 283, -630,
2224 -630, -630, -630, 283, -630, 214, 486, 364, 365, 367,
2225 368, 1955, 1955, 1955, 1955, 1955, 1955, 1955, -630, -630,
2226 63, 650, 54, -630, -70, -630, 1955, 1955, 1955, 363,
2227 1788, -630, -630, -630, -630, -630, -630, -630, -630, -630,
2228 -630, 470, 1829, 2166, 755, 510, -630, -630, -630, -630,
2229 2040, 369, -630, 374, 1157, 984, 984, 984, 984, 42,
2230 -630, 43, -630, -630, 1157, 373, 2040, 2040, 2040, 2040,
2231 2040, 377, 378, 379, 385, 397, 2040, 1157, 984, 403,
2232 -630, -630, -630, -630, -630, -630, -630, -630, 363, 363,
2233 2040, 1955, 1955, 1955, 1955, -630, 406, 420, 423, 425,
2234 378, 427, 1955, -630, 417, 1432, -60, -630, -630, 428,
2235 429, 557, 17, -630, -630, -32, 431, 445, -630, 580,
2236 -630, 177, 1034, 129, -630, -24, -630, -630, 588, 592,
2237 448, 446, 449, 450, 451, 1157, 608, 1157, 452, 460,
2238 1157, 463, -32, -630, 469, 471, 609, 614, 472, 2040,
2239 1157, 1157, -32, 476, 475, 2040, -630, -630, -6, 477,
2240 479, 482, 483, 141, 1955, 1955, 1955, 1955, 202, 1955,
2241 -630, -630, 473, 1955, 1955, 2040, 600, 637, -630, 363,
2242 481, 1870, -630, 484, -630, 474, -21, -630, -630, 1157,
2243 1157, 2207, 1157, 1157, 1157, 1157, 475, -630, 475, 2040,
2244 1157, 485, 2040, 2040, 2040, -630, -630, 647, 984, -630,
2245 -630, 2207, 598, -630, 984, -630, 1955, 1955, 1955, 1955,
2246 -630, 489, 492, 491, 506, -630, 378, -630, 512, 513,
2247 47, -630, -630, -630, -630, -630, -630, -32, -5, 655,
2248 -630, 507, 516, 514, 4, -32, 212, -630, -630, -630,
2249 -630, -630, -630, -630, 515, 1157, -630, -630, -630, -630,
2250 378, 242, 475, 521, 526, 532, 533, 1955, -630, 1955,
2251 1955, 243, -630, -630, -630, 481, -630, 643, -630, -630,
2252 684, 1, 827, 827, -630, 2248, -630, 534, 472, -630,
2253 -630, -630, -630, -630, -630, 539, 540, 542, -630, -630,
2254 702, 554, 1157, -630, 1296, 2, 548, 549, -630, -630,
2255 40, 4, -32, -630, 283, -630, -630, -630, -630, 691,
2256 562, -630, 552, -630, 1296, 424, 424, 701, 827, 827,
2257 -630, 559, -630, 705, 558, 1157, -630, -630, 147, 1157,
2258 708, 645, 424, 424, 563, -630, 266, -630, -630, 1157,
2259 709, 188, -630, 147, -630, 1157, -630, -630, -630, -630
Dan Gohmanf4423b12008-04-19 00:24:39 +00002260};
2261
2262/* YYPGOTO[NTERM-NUM]. */
2263static const yytype_int16 yypgoto[] =
2264{
Devang Pateld4980812008-09-02 20:52:40 +00002265 -630, 220, 223, 285, -181, -175, -174, -630, 0, 94,
2266 -142, 638, -630, 11, -630, -630, -630, -630, 71, -630,
2267 -630, -630, -144, -630, -226, -630, -227, -630, 26, -630,
2268 -630, -630, -308, 132, -630, -424, -630, -630, -26, 494,
2269 -126, -630, 628, 635, -113, -165, -271, 318, 352, 493,
2270 -630, -630, 725, -630, -630, -630, -630, -630, -630, -630,
2271 -630, -630, -630, -630, 656, -630, -630, -630, -630, -630,
2272 -630, -629, -56, 183, -190, -630, -630, 688, -630, 613,
2273 -630, -630, -630, 178, 293, -451, -630, 616, -630, -630
Dan Gohmanf4423b12008-04-19 00:24:39 +00002274};
2275
2276/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2277 positive, shift that token. If negative, reduce the rule which
2278 number is the opposite. If zero, do what YYDEFACT says.
2279 If YYTABLE_NINF, syntax error. */
Devang Pateld4980812008-09-02 20:52:40 +00002280#define YYTABLE_NINF -223
Dan Gohmanf4423b12008-04-19 00:24:39 +00002281static const yytype_int16 yytable[] =
2282{
Devang Pateld4980812008-09-02 20:52:40 +00002283 11, 82, 281, 170, 382, 384, 293, 105, 168, 528,
2284 171, 13, 292, 292, 91, 327, 111, 11, 422, 111,
2285 323, 363, 94, 111, 516, 517, 283, 324, 13, 536,
2286 331, 332, 333, 334, 335, 682, 111, 294, 111, 249,
2287 341, 29, 30, 31, 32, 33, 34, 35, 36, 111,
2288 37, 536, 109, 495, 497, 694, 24, 64, 65, -154,
2289 107, 67, 68, 69, 70, 71, 72, 73, 111, 1,
2290 2, 537, 3, 4, 5, 46, 139, 47, 687, 111,
2291 109, 147, 367, 21, 369, 147, 139, 25, 342, 368,
2292 148, 370, 156, 11, 245, 462, 496, 496, 26, 22,
2293 74, 252, 111, 156, 468, 462, 2, 364, 365, 4,
2294 466, 282, 84, 85, 532, 593, 290, 242, 243, 89,
2295 27, 246, 291, 112, 28, 90, 112, 250, 44, 424,
2296 112, 481, 483, 485, -67, 631, 360, 441, 442, 443,
2297 60, 462, 444, 112, 462, 112, 445, 446, 419, -67,
2298 548, 359, 287, 601, 439, 172, 112, 575, 38, 39,
2299 40, 255, 256, 257, 258, 62, -154, 95, 414, 648,
2300 -154, 663, 683, 343, 344, 112, 106, 325, 326, 287,
2301 328, 284, 441, 442, 443, 58, 112, 444, 91, 421,
2302 -67, 445, 446, 329, 287, 287, 287, 287, 287, 336,
2303 337, 338, 339, 340, 287, 86, 573, 87, 59, 112,
2304 634, 546, 98, 116, 139, 117, 437, 75, 76, 462,
2305 487, 77, 136, 78, 108, 156, 467, 137, 462, 64,
2306 65, 408, 99, 463, 408, 408, 501, 408, 503, 504,
2307 505, 1, 2, 100, 3, 4, 5, -222, 611, 540,
2308 612, 122, 123, 124, 125, 126, 127, 128, 455, 456,
2309 457, 458, 459, 460, 461, -69, 1, 2, 156, 3,
2310 4, 5, 408, 469, 470, 471, 102, 6, 7, 415,
2311 408, 408, 408, 408, 408, -55, -55, -55, -55, 87,
2312 50, 51, 52, 103, 462, 53, 416, 417, 418, 8,
2313 281, 547, 704, 9, 580, 705, 559, 10, 253, 254,
2314 306, 307, 119, 120, 650, 598, 156, 438, 287, 104,
2315 64, 65, 143, 107, 67, 68, 69, 70, 71, 72,
2316 73, 132, 1, 2, 144, 3, 4, 5, 519, 520,
2317 521, 522, 462, 1, 716, 717, 3, 544, 5, 530,
2318 38, 39, 40, 228, 228, 465, 229, 229, 408, 408,
2319 408, 408, 408, 74, 475, 585, 149, 567, 408, 613,
2320 169, 635, 616, 617, 618, 644, 238, 645, 642, 643,
2321 151, 408, 408, 174, 287, 308, 309, 310, 311, 312,
2322 313, 314, 315, 316, 317, 318, 319, 320, 321, 240,
2323 287, 502, 287, 287, 287, 649, 658, 645, 567, 282,
2324 512, 581, 582, 583, 584, 247, 586, 670, 230, 230,
2325 588, 589, 674, 241, 518, 441, 442, 443, 244, 712,
2326 444, 713, 152, 153, 445, 446, 114, 115, 248, 408,
2327 251, 408, 685, 686, 408, 688, 689, -56, -57, -60,
2328 -59, -58, 259, 111, 408, 408, 465, 285, 292, 361,
2329 362, 371, 372, 623, 624, 625, 626, 664, 373, 374,
2330 702, 703, 375, 411, 412, 385, 413, 410, 345, 376,
2331 75, 76, 377, 568, 77, 386, 78, 145, 387, 574,
2332 388, 684, 390, 408, 408, 436, 408, 408, 408, 408,
2333 1, 425, 426, 3, 408, 5, 427, 428, 429, 590,
2334 430, 423, 408, 440, 655, 597, 656, 657, 408, 431,
2335 432, 433, 434, 435, 450, 605, 451, 452, 472, 453,
2336 454, 478, 486, 287, 488, 345, 287, 287, 287, 489,
2337 594, 500, 506, 507, 509, 605, 346, 347, 64, 65,
2338 510, 107, 159, 160, 161, 162, 163, 164, 73, 408,
2339 1, 2, 511, 3, 4, 5, 348, 349, 515, 350,
2340 351, 524, 352, 353, 354, 295, 296, 297, 298, 299,
2341 300, 301, 302, 303, 304, 525, 408, 408, 526, 531,
2342 527, 74, 529, 533, 534, 535, 541, 490, 491, 492,
2343 493, 494, 543, 346, 347, 549, 408, 499, 542, 550,
2344 551, 552, 557, 565, 553, 554, 555, 559, 566, 672,
2345 513, 514, 591, 348, 349, 560, 350, 351, 562, 352,
2346 353, 354, 408, 408, 563, 594, 564, 567, 571, 408,
2347 572, 592, 576, 408, 577, 587, 600, 578, 579, 599,
2348 615, 619, 496, 408, 627, 628, 629, 64, 65, 408,
2349 107, 159, 160, 161, 162, 163, 164, 73, -221, 1,
2350 2, 630, 3, 4, 5, 632, 633, 638, 556, 639,
2351 558, 640, 641, 561, 651, 646, -69, 1, 2, 652,
2352 3, 4, 5, 569, 570, 653, 654, 660, 6, 7,
2353 74, 662, 675, 676, 673, 677, 678, 679, 75, 76,
2354 -18, -19, 77, 690, 78, 383, 691, 693, 695, 710,
2355 8, 698, 699, 700, 9, 709, 715, 711, 10, 659,
2356 636, 133, 602, 603, 357, 607, 608, 609, 610, 718,
2357 150, 146, 45, 614, 366, 97, 131, 236, 523, 621,
2358 237, 620, 0, 0, 0, 0, 0, 622, 0, 0,
2359 0, 0, 64, 65, 0, 107, 159, 160, 161, 162,
Chris Lattner15bd0952008-08-29 17:20:18 +00002360 163, 164, 73, 0, 1, 2, 0, 3, 4, 5,
Chris Lattner15bd0952008-08-29 17:20:18 +00002361 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Pateld4980812008-09-02 20:52:40 +00002362 0, 0, 0, 0, 0, 0, 0, 0, 647, 0,
2363 0, 0, 0, 0, 0, 74, 0, 0, 0, 0,
Chris Lattner15bd0952008-08-29 17:20:18 +00002364 0, 0, 0, 0, 0, 0, 0, 75, 76, 0,
Devang Pateld4980812008-09-02 20:52:40 +00002365 0, 77, 0, 78, 464, 668, 669, 0, 0, 0,
2366 391, 392, 393, 394, 64, 65, 395, 0, 0, 0,
2367 0, 0, 0, 0, 0, 681, 1, 2, 0, 3,
2368 4, 5, 396, 397, 398, 0, 0, 0, 0, 0,
2369 0, 0, 0, 0, 0, 0, 0, 399, 400, 0,
2370 0, 696, 697, 0, 0, 0, 0, 0, 701, 0,
2371 0, 345, 708, 0, 0, 0, 401, 0, 0, 0,
2372 0, 0, 714, 0, 0, 0, 0, 0, 719, 0,
2373 0, 0, 0, 184, 185, 186, 187, 188, 189, 190,
2374 191, 192, 193, 194, 195, 196, 197, 198, 263, 264,
2375 265, 266, 75, 76, 0, 0, 77, 0, 78, 484,
Chris Lattner15bd0952008-08-29 17:20:18 +00002376 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Pateld4980812008-09-02 20:52:40 +00002377 0, 0, 0, 0, 0, 0, 0, 267, 207, 666,
2378 667, 210, 211, 212, 213, 214, 215, 216, 217, 218,
2379 0, 268, 0, 269, 270, 271, 0, 272, 273, 348,
2380 349, 0, 350, 351, 0, 352, 353, 354, 0, 0,
2381 0, 0, 0, 0, 0, 0, 0, 391, 392, 393,
2382 394, 64, 65, 395, 0, 402, 0, 0, 403, 0,
2383 404, 0, 405, 1, 2, 0, 3, 4, 5, 396,
2384 397, 398, 0, 0, 0, 0, 0, 0, 0, 0,
2385 0, 0, 0, 0, 399, 400, 0, 0, 0, 0,
Chris Lattner15bd0952008-08-29 17:20:18 +00002386 0, 0, 0, 0, 0, 0, 0, 0, 0, 111,
Devang Pateld4980812008-09-02 20:52:40 +00002387 0, 64, 65, 401, 107, 159, 160, 161, 162, 163,
2388 164, 73, 0, 1, 2, 0, 3, 4, 5, 0,
Chris Lattner15bd0952008-08-29 17:20:18 +00002389 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
2390 194, 195, 196, 197, 198, 263, 264, 265, 266, 0,
Devang Pateld4980812008-09-02 20:52:40 +00002391 0, 0, 0, 0, 74, 0, 0, 0, 0, 0,
2392 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner15bd0952008-08-29 17:20:18 +00002393 0, 0, 0, 0, 267, 207, 208, 209, 210, 211,
2394 212, 213, 214, 215, 216, 217, 218, 0, 268, 0,
Devang Pateld4980812008-09-02 20:52:40 +00002395 269, 270, 271, 0, 272, 273, 0, 0, 0, 0,
Chris Lattner15bd0952008-08-29 17:20:18 +00002396 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Pateld4980812008-09-02 20:52:40 +00002397 0, 0, 0, 0, 0, 0, 112, 0, 0, 0,
2398 0, 0, 402, 0, 0, 403, 0, 404, 0, 405,
2399 391, 392, 393, 394, 64, 65, 395, 0, 0, 0,
2400 0, 0, 0, 0, 0, 0, 1, 2, 0, 3,
2401 4, 5, 396, 397, 398, 0, 0, 0, 0, 0,
2402 0, 0, 0, 0, 0, 0, 0, 399, 400, 0,
2403 0, 75, 76, 0, 0, 77, 0, 78, 545, 0,
2404 0, 0, 0, 0, 0, 0, 401, 0, 0, 0,
2405 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2406 0, 0, 0, 184, 185, 186, 187, 188, 189, 190,
2407 191, 192, 193, 194, 195, 196, 197, 198, 263, 264,
2408 265, 266, 0, 0, 0, 0, 0, 0, 0, 0,
2409 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2410 0, 0, 0, 0, 0, 0, 0, 267, 207, 208,
2411 209, 210, 211, 212, 213, 214, 215, 216, 217, 218,
2412 0, 268, 0, 269, 270, 271, 0, 272, 273, 391,
2413 392, 393, 394, 0, 0, 395, 0, 0, 0, 0,
2414 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2415 0, 396, 397, 398, 0, 402, 0, 0, 403, 0,
2416 404, 0, 405, 0, 0, 0, 399, 400, 0, 0,
2417 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2418 0, 0, 0, 0, 0, 401, 0, 0, 0, 0,
2419 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2420 0, 0, 184, 185, 186, 187, 188, 189, 190, 191,
2421 192, 193, 194, 195, 196, 197, 198, 263, 264, 265,
2422 266, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2423 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2424 0, 0, 0, 0, 0, 0, 267, 207, 208, 209,
2425 210, 211, 212, 213, 214, 215, 216, 217, 218, 0,
2426 268, 0, 269, 270, 271, 0, 272, 273, 0, 64,
2427 65, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2428 0, 1, 2, 0, 3, 4, 5, 260, 0, 0,
2429 0, 0, 0, 0, 402, 0, 0, 403, 0, 404,
2430 0, 405, 261, 262, 0, 0, 0, 0, 0, 0,
2431 0, 0, 0, 0, 0, 0, 0, 111, 0, 0,
2432 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2433 0, 0, 0, 0, 0, 0, 0, 0, 184, 185,
2434 186, 187, 188, 189, 190, 191, 192, 193, 194, 195,
2435 196, 197, 198, 263, 264, 265, 266, 0, 0, 0,
2436 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2437 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2438 0, 0, 267, 207, 208, 209, 210, 211, 212, 213,
2439 214, 215, 216, 217, 218, 0, 268, 0, 269, 270,
2440 271, 0, 272, 273, 0, 64, 65, 0, 0, 0,
2441 0, 0, 0, 0, 0, 0, 0, 1, 2, 0,
2442 3, 4, 5, 260, 112, 0, 0, 0, -67, 0,
2443 274, 0, 0, 275, 0, 276, 0, 277, 261, 262,
2444 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2445 0, 64, 65, 111, 154, 67, 68, 69, 70, 71,
2446 72, 73, 0, 1, 2, 0, 3, 4, 5, 0,
2447 0, 0, 0, 0, 184, 185, 186, 187, 188, 189,
2448 190, 191, 192, 193, 194, 195, 196, 197, 198, 263,
2449 264, 265, 266, 0, 74, 0, 0, 0, 0, 64,
2450 65, 0, 107, 67, 68, 69, 70, 71, 72, 73,
2451 0, 1, 2, 0, 3, 4, 5, 0, 267, 207,
2452 208, 209, 210, 211, 212, 213, 214, 215, 216, 217,
2453 218, 138, 268, 0, 269, 270, 271, 0, 272, 273,
2454 64, 65, 74, 107, 67, 68, 69, 70, 71, 72,
2455 73, 0, 1, 2, 0, 3, 4, 5, 0, 0,
2456 112, 0, 0, 0, 0, 0, 274, 0, 0, 275,
2457 155, 276, 356, 277, 0, 0, 0, 0, 0, 0,
2458 0, 64, 65, 74, 107, 159, 160, 161, 162, 163,
2459 164, 73, 0, 1, 2, 0, 3, 4, 5, 0,
2460 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2461 0, 75, 76, 0, 0, 77, 0, 78, 0, 0,
2462 0, 0, 0, 0, 74, 64, 65, 0, 107, 67,
2463 68, 69, 70, 71, 72, 73, 0, 1, 2, 0,
2464 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
2465 0, 0, 0, 0, 0, 0, 0, 474, 0, 75,
2466 76, 0, 0, 77, 0, 78, 64, 65, 74, 107,
2467 159, 160, 161, 162, 163, 164, 73, 0, 1, 2,
2468 0, 3, 4, 5, 0, 0, 0, 0, 0, 0,
2469 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2470 75, 76, 0, 0, 77, 0, 78, 64, 65, 74,
2471 107, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2472 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2473 0, 0, 0, 0, 0, 0, 0, 0, 0, 596,
2474 0, 75, 76, 0, 378, 77, 0, 78, 0, 0,
2475 74, 64, 65, 0, 66, 67, 68, 69, 70, 71,
2476 72, 73, 0, 1, 2, 0, 3, 4, 5, 0,
2477 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2478 0, 0, 0, 0, 0, 75, 76, 0, 0, 77,
2479 0, 78, 64, 65, 74, 107, 159, 160, 161, 162,
2480 163, 164, 73, 0, 1, 2, 0, 3, 4, 5,
2481 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2482 0, 0, 0, 0, 0, 0, 75, 76, 0, 480,
2483 77, 0, 78, 64, 65, 74, 154, 67, 68, 69,
2484 70, 71, 72, 73, 0, 1, 2, 0, 3, 4,
2485 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2486 0, 0, 0, 0, 0, 0, 0, 75, 76, 0,
2487 0, 77, 0, 78, 0, 0, 74, 64, 65, 0,
2488 107, 67, 68, 69, 70, 71, 72, 73, 0, 1,
2489 2, 0, 3, 4, 5, 0, 0, 0, 0, 0,
2490 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner15bd0952008-08-29 17:20:18 +00002491 0, 75, 76, 0, 0, 77, 0, 78, 64, 65,
Devang Pateld4980812008-09-02 20:52:40 +00002492 74, 286, 67, 68, 69, 70, 71, 72, 73, 0,
Chris Lattner15bd0952008-08-29 17:20:18 +00002493 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
2494 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner15bd0952008-08-29 17:20:18 +00002495 0, 0, 75, 76, 0, 0, 77, 0, 78, 64,
Devang Pateld4980812008-09-02 20:52:40 +00002496 65, 74, 107, 159, 160, 161, 162, 163, 164, 73,
Chris Lattner15bd0952008-08-29 17:20:18 +00002497 0, 1, 2, 0, 3, 4, 5, 0, 0, 0,
Chris Lattner15bd0952008-08-29 17:20:18 +00002498 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Pateld4980812008-09-02 20:52:40 +00002499 0, 0, 0, 75, 76, 0, 0, 77, 0, 78,
2500 0, 0, 74, 64, 65, 0, 107, 159, 160, 161,
2501 162, 163, 164, 73, 0, 1, 2, 0, 3, 4,
2502 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2503 0, 0, 0, 0, 0, 0, 0, 75, 76, 0,
2504 0, 77, 0, 78, 64, 65, 74, 107, 67, 68,
2505 69, 70, 71, 72, 604, 0, 1, 2, 0, 3,
2506 4, 5, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner15bd0952008-08-29 17:20:18 +00002507 0, 0, 0, 0, 0, 0, 0, 0, 75, 76,
Devang Pateld4980812008-09-02 20:52:40 +00002508 0, 0, 77, 0, 78, 64, 65, 74, 107, 67,
2509 68, 69, 70, 71, 72, 671, 175, 1, 2, 0,
2510 3, 4, 5, 0, 0, 0, 0, 0, 0, 0,
2511 0, 0, 0, 0, 0, 0, 0, 176, 177, 75,
2512 76, 0, 0, 77, 0, 381, 0, 0, 74, 0,
2513 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
2514 188, 189, 190, 191, 192, 193, 194, 195, 196, 197,
2515 198, 199, 200, 201, 202, 0, 0, 0, 0, 0,
2516 0, 0, 0, 75, 76, 0, 0, 77, 0, 482,
2517 0, 0, 0, 0, 0, 203, 204, 205, 0, 0,
2518 206, 207, 208, 209, 210, 211, 212, 213, 214, 215,
2519 216, 217, 218, 219, 220, 221, 222, 223, 224, 225,
2520 226, 227, 0, 0, 75, 76, 0, 0, 77, 0,
2521 78, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002522 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2523 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Pateld4980812008-09-02 20:52:40 +00002524 0, 0, 0, 0, 0, 75, 76, 0, 0, 77,
2525 0, 78
Dan Gohmanf4423b12008-04-19 00:24:39 +00002526};
2527
2528static const yytype_int16 yycheck[] =
2529{
Devang Pateld4980812008-09-02 20:52:40 +00002530 0, 27, 167, 129, 275, 276, 180, 4, 121, 460,
2531 28, 0, 11, 11, 21, 205, 55, 17, 326, 55,
2532 201, 248, 29, 55, 448, 449, 168, 202, 17, 34,
2533 220, 221, 222, 223, 224, 664, 55, 181, 55, 152,
2534 230, 42, 43, 44, 45, 46, 47, 48, 49, 55,
2535 51, 34, 78, 11, 11, 684, 164, 7, 8, 55,
2536 10, 11, 12, 13, 14, 15, 16, 17, 55, 19,
2537 20, 54, 22, 23, 24, 46, 102, 48, 38, 55,
2538 106, 165, 263, 53, 265, 165, 112, 59, 232, 264,
2539 174, 266, 118, 93, 174, 165, 54, 54, 164, 69,
2540 50, 157, 55, 129, 174, 165, 20, 249, 250, 23,
2541 381, 167, 41, 42, 174, 539, 11, 143, 144, 48,
2542 18, 147, 17, 162, 164, 54, 162, 153, 0, 168,
2543 162, 402, 403, 404, 166, 586, 172, 142, 143, 144,
2544 168, 165, 147, 162, 165, 162, 151, 152, 165, 166,
2545 174, 170, 178, 174, 344, 173, 162, 163, 159, 160,
2546 161, 3, 4, 5, 6, 22, 162, 174, 294, 620,
2547 166, 170, 170, 118, 119, 162, 173, 203, 204, 205,
2548 206, 170, 142, 143, 144, 164, 162, 147, 21, 165,
2549 166, 151, 152, 219, 220, 221, 222, 223, 224, 225,
2550 226, 227, 228, 229, 230, 35, 514, 37, 164, 162,
2551 163, 482, 22, 42, 240, 44, 342, 167, 168, 165,
2552 410, 171, 165, 173, 174, 251, 172, 170, 165, 7,
2553 8, 287, 22, 170, 290, 291, 426, 293, 428, 429,
2554 430, 19, 20, 22, 22, 23, 24, 0, 556, 475,
2555 558, 62, 63, 64, 65, 66, 67, 68, 371, 372,
2556 373, 374, 375, 376, 377, 18, 19, 20, 294, 22,
2557 23, 24, 328, 386, 387, 388, 162, 30, 31, 305,
2558 336, 337, 338, 339, 340, 3, 4, 5, 6, 37,
2559 42, 43, 44, 4, 165, 47, 322, 323, 324, 52,
2560 465, 172, 155, 56, 163, 158, 165, 60, 26, 27,
2561 26, 27, 32, 33, 622, 542, 342, 343, 344, 4,
2562 7, 8, 169, 10, 11, 12, 13, 14, 15, 16,
2563 17, 7, 19, 20, 169, 22, 23, 24, 451, 452,
2564 453, 454, 165, 19, 156, 157, 22, 170, 24, 462,
2565 159, 160, 161, 133, 134, 381, 133, 134, 414, 415,
2566 416, 417, 418, 50, 390, 163, 162, 165, 424, 559,
2567 4, 597, 562, 563, 564, 163, 22, 165, 604, 605,
2568 166, 437, 438, 164, 410, 101, 102, 103, 104, 105,
2569 106, 107, 108, 109, 110, 111, 112, 113, 114, 165,
2570 426, 427, 428, 429, 430, 163, 163, 165, 165, 465,
2571 436, 524, 525, 526, 527, 4, 529, 644, 133, 134,
2572 533, 534, 649, 163, 450, 142, 143, 144, 172, 163,
2573 147, 165, 114, 115, 151, 152, 84, 85, 163, 495,
2574 162, 497, 668, 669, 500, 671, 672, 9, 9, 9,
2575 9, 9, 9, 55, 510, 511, 482, 57, 11, 172,
2576 163, 162, 162, 576, 577, 578, 579, 641, 162, 162,
2577 696, 697, 162, 290, 291, 22, 293, 165, 54, 162,
2578 167, 168, 162, 509, 171, 162, 173, 174, 162, 515,
2579 162, 665, 162, 549, 550, 38, 552, 553, 554, 555,
2580 19, 165, 165, 22, 560, 24, 165, 165, 165, 535,
2581 165, 328, 568, 4, 627, 541, 629, 630, 574, 336,
2582 337, 338, 339, 340, 38, 551, 162, 162, 165, 162,
2583 162, 61, 22, 559, 165, 54, 562, 563, 564, 165,
2584 540, 168, 165, 165, 165, 571, 122, 123, 7, 8,
2585 165, 10, 11, 12, 13, 14, 15, 16, 17, 615,
2586 19, 20, 165, 22, 23, 24, 142, 143, 165, 145,
2587 146, 165, 148, 149, 150, 95, 96, 97, 98, 99,
2588 100, 101, 102, 103, 104, 165, 642, 643, 165, 172,
2589 165, 50, 165, 165, 165, 38, 165, 414, 415, 416,
2590 417, 418, 22, 122, 123, 17, 662, 424, 163, 17,
2591 162, 165, 4, 4, 165, 165, 165, 165, 4, 645,
2592 437, 438, 22, 142, 143, 165, 145, 146, 165, 148,
2593 149, 150, 688, 689, 165, 635, 165, 165, 162, 695,
2594 165, 4, 165, 699, 165, 172, 172, 165, 165, 165,
2595 165, 4, 54, 709, 165, 163, 165, 7, 8, 715,
2596 10, 11, 12, 13, 14, 15, 16, 17, 0, 19,
2597 20, 165, 22, 23, 24, 163, 163, 22, 495, 172,
2598 497, 165, 168, 500, 163, 170, 18, 19, 20, 163,
2599 22, 23, 24, 510, 511, 163, 163, 54, 30, 31,
2600 50, 17, 163, 163, 170, 163, 4, 153, 167, 168,
2601 162, 162, 171, 22, 173, 174, 154, 165, 17, 74,
2602 52, 162, 17, 165, 56, 17, 17, 164, 60, 635,
2603 598, 93, 549, 550, 240, 552, 553, 554, 555, 713,
2604 112, 106, 17, 560, 251, 57, 90, 134, 455, 571,
2605 134, 568, -1, -1, -1, -1, -1, 574, -1, -1,
2606 -1, -1, 7, 8, -1, 10, 11, 12, 13, 14,
Chris Lattner15bd0952008-08-29 17:20:18 +00002607 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
Devang Pateld4980812008-09-02 20:52:40 +00002608 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2609 -1, -1, -1, -1, -1, -1, -1, -1, 615, -1,
2610 -1, -1, -1, -1, -1, 50, -1, -1, -1, -1,
2611 -1, -1, -1, -1, -1, -1, -1, 167, 168, -1,
2612 -1, 171, -1, 173, 174, 642, 643, -1, -1, -1,
2613 3, 4, 5, 6, 7, 8, 9, -1, -1, -1,
2614 -1, -1, -1, -1, -1, 662, 19, 20, -1, 22,
2615 23, 24, 25, 26, 27, -1, -1, -1, -1, -1,
Chris Lattner15bd0952008-08-29 17:20:18 +00002616 -1, -1, -1, -1, -1, -1, -1, 40, 41, -1,
Devang Pateld4980812008-09-02 20:52:40 +00002617 -1, 688, 689, -1, -1, -1, -1, -1, 695, -1,
2618 -1, 54, 699, -1, -1, -1, 59, -1, -1, -1,
2619 -1, -1, 709, -1, -1, -1, -1, -1, 715, -1,
2620 -1, -1, -1, 76, 77, 78, 79, 80, 81, 82,
Chris Lattner15bd0952008-08-29 17:20:18 +00002621 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
Devang Pateld4980812008-09-02 20:52:40 +00002622 93, 94, 167, 168, -1, -1, 171, -1, 173, 174,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002623 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Pateld4980812008-09-02 20:52:40 +00002624 -1, -1, -1, -1, -1, -1, -1, 120, 121, 122,
2625 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
2626 -1, 134, -1, 136, 137, 138, -1, 140, 141, 142,
2627 143, -1, 145, 146, -1, 148, 149, 150, -1, -1,
2628 -1, -1, -1, -1, -1, -1, -1, 3, 4, 5,
2629 6, 7, 8, 9, -1, 168, -1, -1, 171, -1,
2630 173, -1, 175, 19, 20, -1, 22, 23, 24, 25,
2631 26, 27, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattner15bd0952008-08-29 17:20:18 +00002632 -1, -1, -1, -1, 40, 41, -1, -1, -1, -1,
2633 -1, -1, -1, -1, -1, -1, -1, -1, -1, 55,
Devang Pateld4980812008-09-02 20:52:40 +00002634 -1, 7, 8, 59, 10, 11, 12, 13, 14, 15,
2635 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
Chris Lattner15bd0952008-08-29 17:20:18 +00002636 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2637 86, 87, 88, 89, 90, 91, 92, 93, 94, -1,
Devang Pateld4980812008-09-02 20:52:40 +00002638 -1, -1, -1, -1, 50, -1, -1, -1, -1, -1,
2639 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Chris Lattner15bd0952008-08-29 17:20:18 +00002640 -1, -1, -1, -1, 120, 121, 122, 123, 124, 125,
2641 126, 127, 128, 129, 130, 131, 132, -1, 134, -1,
Devang Pateld4980812008-09-02 20:52:40 +00002642 136, 137, 138, -1, 140, 141, -1, -1, -1, -1,
Dan Gohmanf910eaa2008-06-09 14:45:02 +00002643 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Pateld4980812008-09-02 20:52:40 +00002644 -1, -1, -1, -1, -1, -1, 162, -1, -1, -1,
2645 -1, -1, 168, -1, -1, 171, -1, 173, -1, 175,
2646 3, 4, 5, 6, 7, 8, 9, -1, -1, -1,
2647 -1, -1, -1, -1, -1, -1, 19, 20, -1, 22,
2648 23, 24, 25, 26, 27, -1, -1, -1, -1, -1,
2649 -1, -1, -1, -1, -1, -1, -1, 40, 41, -1,
2650 -1, 167, 168, -1, -1, 171, -1, 173, 174, -1,
2651 -1, -1, -1, -1, -1, -1, 59, -1, -1, -1,
2652 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2653 -1, -1, -1, 76, 77, 78, 79, 80, 81, 82,
2654 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
2655 93, 94, -1, -1, -1, -1, -1, -1, -1, -1,
2656 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2657 -1, -1, -1, -1, -1, -1, -1, 120, 121, 122,
2658 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
2659 -1, 134, -1, 136, 137, 138, -1, 140, 141, 3,
2660 4, 5, 6, -1, -1, 9, -1, -1, -1, -1,
2661 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2662 -1, 25, 26, 27, -1, 168, -1, -1, 171, -1,
2663 173, -1, 175, -1, -1, -1, 40, 41, -1, -1,
2664 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2665 -1, -1, -1, -1, -1, 59, -1, -1, -1, -1,
2666 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2667 -1, -1, 76, 77, 78, 79, 80, 81, 82, 83,
2668 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
2669 94, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2670 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2671 -1, -1, -1, -1, -1, -1, 120, 121, 122, 123,
2672 124, 125, 126, 127, 128, 129, 130, 131, 132, -1,
2673 134, -1, 136, 137, 138, -1, 140, 141, -1, 7,
2674 8, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2675 -1, 19, 20, -1, 22, 23, 24, 25, -1, -1,
2676 -1, -1, -1, -1, 168, -1, -1, 171, -1, 173,
2677 -1, 175, 40, 41, -1, -1, -1, -1, -1, -1,
2678 -1, -1, -1, -1, -1, -1, -1, 55, -1, -1,
2679 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2680 -1, -1, -1, -1, -1, -1, -1, -1, 76, 77,
2681 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2682 88, 89, 90, 91, 92, 93, 94, -1, -1, -1,
2683 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2684 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2685 -1, -1, 120, 121, 122, 123, 124, 125, 126, 127,
2686 128, 129, 130, 131, 132, -1, 134, -1, 136, 137,
2687 138, -1, 140, 141, -1, 7, 8, -1, -1, -1,
2688 -1, -1, -1, -1, -1, -1, -1, 19, 20, -1,
2689 22, 23, 24, 25, 162, -1, -1, -1, 166, -1,
2690 168, -1, -1, 171, -1, 173, -1, 175, 40, 41,
2691 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2692 -1, 7, 8, 55, 10, 11, 12, 13, 14, 15,
2693 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2694 -1, -1, -1, -1, 76, 77, 78, 79, 80, 81,
2695 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
2696 92, 93, 94, -1, 50, -1, -1, -1, -1, 7,
2697 8, -1, 10, 11, 12, 13, 14, 15, 16, 17,
2698 -1, 19, 20, -1, 22, 23, 24, -1, 120, 121,
2699 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
2700 132, 39, 134, -1, 136, 137, 138, -1, 140, 141,
2701 7, 8, 50, 10, 11, 12, 13, 14, 15, 16,
2702 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
2703 162, -1, -1, -1, -1, -1, 168, -1, -1, 171,
2704 126, 173, 39, 175, -1, -1, -1, -1, -1, -1,
2705 -1, 7, 8, 50, 10, 11, 12, 13, 14, 15,
2706 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2707 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2708 -1, 167, 168, -1, -1, 171, -1, 173, -1, -1,
2709 -1, -1, -1, -1, 50, 7, 8, -1, 10, 11,
2710 12, 13, 14, 15, 16, 17, -1, 19, 20, -1,
2711 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
2712 -1, -1, -1, -1, -1, -1, -1, 39, -1, 167,
2713 168, -1, -1, 171, -1, 173, 7, 8, 50, 10,
2714 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2715 -1, 22, 23, 24, -1, -1, -1, -1, -1, -1,
2716 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2717 167, 168, -1, -1, 171, -1, 173, 7, 8, 50,
2718 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2719 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2720 -1, -1, -1, -1, -1, -1, -1, -1, -1, 39,
2721 -1, 167, 168, -1, 170, 171, -1, 173, -1, -1,
2722 50, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2723 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2724 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2725 -1, -1, -1, -1, -1, 167, 168, -1, -1, 171,
2726 -1, 173, 7, 8, 50, 10, 11, 12, 13, 14,
2727 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2728 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2729 -1, -1, -1, -1, -1, -1, 167, 168, -1, 170,
2730 171, -1, 173, 7, 8, 50, 10, 11, 12, 13,
2731 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2732 24, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2733 -1, -1, -1, -1, -1, -1, -1, 167, 168, -1,
2734 -1, 171, -1, 173, -1, -1, 50, 7, 8, -1,
2735 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2736 20, -1, 22, 23, 24, -1, -1, -1, -1, -1,
2737 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2738 -1, 167, 168, -1, -1, 171, -1, 173, 7, 8,
2739 50, 10, 11, 12, 13, 14, 15, 16, 17, -1,
Chris Lattner15bd0952008-08-29 17:20:18 +00002740 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
2741 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Pateld4980812008-09-02 20:52:40 +00002742 -1, -1, 167, 168, -1, -1, 171, -1, 173, 7,
2743 8, 50, 10, 11, 12, 13, 14, 15, 16, 17,
Chris Lattner15bd0952008-08-29 17:20:18 +00002744 -1, 19, 20, -1, 22, 23, 24, -1, -1, -1,
Chris Lattner15bd0952008-08-29 17:20:18 +00002745 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Pateld4980812008-09-02 20:52:40 +00002746 -1, -1, -1, 167, 168, -1, -1, 171, -1, 173,
2747 -1, -1, 50, 7, 8, -1, 10, 11, 12, 13,
2748 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2749 24, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2750 -1, -1, -1, -1, -1, -1, -1, 167, 168, -1,
2751 -1, 171, -1, 173, 7, 8, 50, 10, 11, 12,
2752 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2753 23, 24, -1, -1, -1, -1, -1, -1, -1, -1,
2754 -1, -1, -1, -1, -1, -1, -1, -1, 167, 168,
2755 -1, -1, 171, -1, 173, 7, 8, 50, 10, 11,
2756 12, 13, 14, 15, 16, 17, 36, 19, 20, -1,
2757 22, 23, 24, -1, -1, -1, -1, -1, -1, -1,
2758 -1, -1, -1, -1, -1, -1, -1, 57, 58, 167,
2759 168, -1, -1, 171, -1, 173, -1, -1, 50, -1,
2760 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2761 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2762 90, 91, 92, 93, 94, -1, -1, -1, -1, -1,
2763 -1, -1, -1, 167, 168, -1, -1, 171, -1, 173,
2764 -1, -1, -1, -1, -1, 115, 116, 117, -1, -1,
2765 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
2766 130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
2767 140, 141, -1, -1, 167, 168, -1, -1, 171, -1,
2768 173, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Dan Gohman81a0c0b2008-05-31 00:58:22 +00002769 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2770 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Pateld4980812008-09-02 20:52:40 +00002771 -1, -1, -1, -1, -1, 167, 168, -1, -1, 171,
2772 -1, 173
Dan Gohmanf4423b12008-04-19 00:24:39 +00002773};
2774
2775/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2776 symbol of state STATE-NUM. */
Dale Johannesen20ab78b2008-08-13 18:41:46 +00002777static const yytype_uint16 yystos[] =
Dan Gohmanf4423b12008-04-19 00:24:39 +00002778{
Dale Johannesenc7071cc2008-05-14 20:13:36 +00002779 0, 19, 20, 22, 23, 24, 30, 31, 52, 56,
Devang Pateld4980812008-09-02 20:52:40 +00002780 60, 184, 187, 189, 190, 191, 226, 227, 228, 230,
2781 229, 53, 69, 235, 164, 59, 164, 18, 164, 42,
2782 43, 44, 45, 46, 47, 48, 49, 51, 159, 160,
2783 161, 192, 193, 194, 0, 228, 46, 48, 195, 245,
2784 42, 43, 44, 47, 196, 242, 244, 252, 164, 164,
2785 168, 236, 22, 234, 7, 8, 10, 11, 12, 13,
2786 14, 15, 16, 17, 50, 167, 168, 171, 173, 184,
2787 189, 213, 214, 248, 194, 194, 35, 37, 224, 194,
2788 194, 21, 253, 254, 29, 174, 243, 253, 22, 22,
2789 22, 237, 162, 4, 4, 4, 173, 10, 174, 214,
2790 219, 55, 162, 186, 224, 224, 42, 44, 197, 32,
2791 33, 223, 62, 63, 64, 65, 66, 67, 68, 198,
2792 240, 240, 7, 187, 188, 257, 165, 170, 39, 214,
2793 215, 217, 218, 169, 169, 174, 219, 165, 174, 162,
2794 218, 166, 223, 223, 10, 126, 214, 216, 225, 11,
2795 12, 13, 14, 15, 16, 182, 183, 214, 220, 4,
2796 216, 28, 173, 241, 164, 36, 57, 58, 70, 71,
Chris Lattner15bd0952008-08-29 17:20:18 +00002797 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
2798 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
2799 92, 93, 94, 115, 116, 117, 120, 121, 122, 123,
2800 124, 125, 126, 127, 128, 129, 130, 131, 132, 133,
Devang Pateld4980812008-09-02 20:52:40 +00002801 134, 135, 136, 137, 138, 139, 140, 141, 177, 178,
2802 179, 255, 262, 263, 264, 265, 255, 263, 22, 200,
2803 165, 163, 214, 214, 172, 174, 214, 4, 163, 220,
2804 214, 162, 248, 26, 27, 3, 4, 5, 6, 9,
Chris Lattner15bd0952008-08-29 17:20:18 +00002805 25, 40, 41, 91, 92, 93, 94, 120, 134, 136,
Devang Pateld4980812008-09-02 20:52:40 +00002806 137, 138, 140, 141, 168, 171, 173, 175, 177, 178,
2807 179, 221, 248, 186, 189, 57, 10, 214, 250, 251,
2808 11, 17, 11, 182, 198, 95, 96, 97, 98, 99,
2809 100, 101, 102, 103, 104, 180, 26, 27, 101, 102,
Chris Lattner15bd0952008-08-29 17:20:18 +00002810 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
Devang Pateld4980812008-09-02 20:52:40 +00002811 113, 114, 181, 180, 181, 214, 214, 250, 214, 214,
2812 258, 250, 250, 250, 250, 250, 214, 214, 214, 214,
2813 214, 250, 198, 118, 119, 54, 122, 123, 142, 143,
2814 145, 146, 148, 149, 150, 199, 39, 215, 202, 170,
2815 172, 172, 163, 202, 186, 186, 225, 180, 181, 180,
2816 181, 162, 162, 162, 162, 162, 162, 162, 170, 220,
2817 222, 173, 222, 174, 222, 22, 162, 162, 162, 231,
2818 162, 3, 4, 5, 6, 9, 25, 26, 27, 40,
2819 41, 59, 168, 171, 173, 175, 221, 247, 248, 249,
2820 165, 249, 249, 249, 216, 214, 214, 214, 214, 165,
2821 208, 165, 208, 249, 168, 165, 165, 165, 165, 165,
2822 165, 249, 249, 249, 249, 249, 38, 216, 214, 250,
2823 4, 142, 143, 144, 147, 151, 152, 201, 232, 233,
2824 38, 162, 162, 162, 162, 220, 220, 220, 220, 220,
2825 220, 220, 165, 170, 174, 214, 222, 172, 174, 220,
2826 220, 220, 165, 211, 39, 214, 238, 239, 61, 246,
2827 170, 222, 173, 222, 174, 222, 22, 250, 165, 165,
2828 249, 249, 249, 249, 249, 11, 54, 11, 260, 249,
2829 168, 250, 214, 250, 250, 250, 165, 165, 261, 165,
2830 165, 165, 214, 249, 249, 165, 211, 211, 214, 220,
2831 220, 220, 220, 260, 165, 165, 165, 165, 261, 165,
2832 220, 172, 174, 165, 165, 38, 34, 54, 209, 212,
2833 200, 165, 163, 22, 170, 174, 222, 172, 174, 17,
2834 17, 162, 165, 165, 165, 165, 249, 4, 249, 165,
2835 165, 249, 165, 165, 165, 4, 4, 165, 214, 249,
2836 249, 162, 165, 208, 214, 163, 165, 165, 165, 165,
2837 163, 220, 220, 220, 220, 163, 220, 172, 220, 220,
2838 214, 22, 4, 211, 184, 185, 39, 214, 202, 165,
2839 172, 174, 249, 249, 17, 214, 259, 249, 249, 249,
2840 249, 208, 208, 250, 249, 165, 250, 250, 250, 4,
2841 249, 259, 249, 220, 220, 220, 220, 165, 163, 165,
2842 165, 261, 163, 163, 163, 200, 209, 210, 22, 172,
2843 165, 168, 200, 200, 163, 165, 170, 249, 261, 163,
2844 208, 163, 163, 163, 163, 220, 220, 220, 163, 185,
2845 54, 207, 17, 170, 182, 256, 122, 123, 249, 249,
2846 202, 17, 214, 170, 202, 163, 163, 163, 4, 153,
2847 206, 249, 247, 170, 182, 200, 200, 38, 200, 200,
2848 22, 154, 205, 165, 247, 17, 249, 249, 162, 17,
2849 165, 249, 200, 200, 155, 158, 203, 204, 249, 17,
2850 74, 164, 163, 165, 249, 17, 156, 157, 204, 249
Dan Gohmanf4423b12008-04-19 00:24:39 +00002851};
David Greene718fda32007-08-01 03:59:32 +00002852
Reid Spencer68a24bd2005-08-27 18:50:39 +00002853#define yyerrok (yyerrstatus = 0)
2854#define yyclearin (yychar = YYEMPTY)
Dan Gohmanf4423b12008-04-19 00:24:39 +00002855#define YYEMPTY (-2)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002856#define YYEOF 0
Dan Gohmanf4423b12008-04-19 00:24:39 +00002857
Reid Spencer68a24bd2005-08-27 18:50:39 +00002858#define YYACCEPT goto yyacceptlab
Dan Gohmanf4423b12008-04-19 00:24:39 +00002859#define YYABORT goto yyabortlab
2860#define YYERROR goto yyerrorlab
2861
2862
2863/* Like YYERROR except do call yyerror. This remains here temporarily
2864 to ease the transition to the new meaning of YYERROR, for GCC.
Reid Spencer68a24bd2005-08-27 18:50:39 +00002865 Once GCC version 2 has supplanted version 1, this can go. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00002866
Reid Spencer68a24bd2005-08-27 18:50:39 +00002867#define YYFAIL goto yyerrlab
Dan Gohmanf4423b12008-04-19 00:24:39 +00002868
Reid Spencer68a24bd2005-08-27 18:50:39 +00002869#define YYRECOVERING() (!!yyerrstatus)
Dan Gohmanf4423b12008-04-19 00:24:39 +00002870
2871#define YYBACKUP(Token, Value) \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002872do \
2873 if (yychar == YYEMPTY && yylen == 1) \
Dan Gohmanf4423b12008-04-19 00:24:39 +00002874 { \
2875 yychar = (Token); \
2876 yylval = (Value); \
2877 yytoken = YYTRANSLATE (yychar); \
2878 YYPOPSTACK (1); \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002879 goto yybackup; \
2880 } \
2881 else \
Dan Gohmanf4423b12008-04-19 00:24:39 +00002882 { \
2883 yyerror (YY_("syntax error: cannot back up")); \
2884 YYERROR; \
2885 } \
2886while (YYID (0))
2887
Anton Korobeynikov38e09802007-04-28 13:48:45 +00002888
Reid Spencer68a24bd2005-08-27 18:50:39 +00002889#define YYTERROR 1
2890#define YYERRCODE 256
2891
Dan Gohmanf4423b12008-04-19 00:24:39 +00002892
2893/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2894 If N is 0, then set CURRENT to the empty location which ends
2895 the previous symbol: RHS[0] (always defined). */
2896
2897#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2898#ifndef YYLLOC_DEFAULT
2899# define YYLLOC_DEFAULT(Current, Rhs, N) \
2900 do \
2901 if (YYID (N)) \
2902 { \
2903 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2904 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2905 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2906 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2907 } \
2908 else \
2909 { \
2910 (Current).first_line = (Current).last_line = \
2911 YYRHSLOC (Rhs, 0).last_line; \
2912 (Current).first_column = (Current).last_column = \
2913 YYRHSLOC (Rhs, 0).last_column; \
2914 } \
2915 while (YYID (0))
Reid Spencer68a24bd2005-08-27 18:50:39 +00002916#endif
2917
Dan Gohmanf4423b12008-04-19 00:24:39 +00002918
2919/* YY_LOCATION_PRINT -- Print the location on the stream.
2920 This macro was not mandated originally: define only if we know
2921 we won't break user code: when these are the locations we know. */
2922
2923#ifndef YY_LOCATION_PRINT
Dan Gohman180c1692008-06-23 18:43:26 +00002924# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
Dan Gohmanf4423b12008-04-19 00:24:39 +00002925# define YY_LOCATION_PRINT(File, Loc) \
2926 fprintf (File, "%d.%d-%d.%d", \
2927 (Loc).first_line, (Loc).first_column, \
2928 (Loc).last_line, (Loc).last_column)
2929# else
2930# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2931# endif
2932#endif
2933
2934
2935/* YYLEX -- calling `yylex' with the right arguments. */
2936
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00002937#ifdef YYLEX_PARAM
Dan Gohmanf4423b12008-04-19 00:24:39 +00002938# define YYLEX yylex (YYLEX_PARAM)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00002939#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00002940# define YYLEX yylex ()
Gabor Greife64d2482008-04-06 23:07:54 +00002941#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002942
2943/* Enable debugging if requested. */
2944#if YYDEBUG
2945
2946# ifndef YYFPRINTF
2947# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2948# define YYFPRINTF fprintf
2949# endif
2950
2951# define YYDPRINTF(Args) \
2952do { \
2953 if (yydebug) \
2954 YYFPRINTF Args; \
2955} while (YYID (0))
2956
2957# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2958do { \
2959 if (yydebug) \
2960 { \
2961 YYFPRINTF (stderr, "%s ", Title); \
2962 yy_symbol_print (stderr, \
2963 Type, Value); \
2964 YYFPRINTF (stderr, "\n"); \
2965 } \
2966} while (YYID (0))
2967
2968
2969/*--------------------------------.
2970| Print this symbol on YYOUTPUT. |
2971`--------------------------------*/
2972
2973/*ARGSUSED*/
2974#if (defined __STDC__ || defined __C99__FUNC__ \
2975 || defined __cplusplus || defined _MSC_VER)
2976static void
2977yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
Gabor Greife64d2482008-04-06 23:07:54 +00002978#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00002979static void
2980yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2981 FILE *yyoutput;
2982 int yytype;
2983 YYSTYPE const * const yyvaluep;
Gabor Greife64d2482008-04-06 23:07:54 +00002984#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00002985{
2986 if (!yyvaluep)
2987 return;
2988# ifdef YYPRINT
2989 if (yytype < YYNTOKENS)
2990 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2991# else
2992 YYUSE (yyoutput);
2993# endif
2994 switch (yytype)
2995 {
2996 default:
2997 break;
2998 }
2999}
3000
3001
3002/*--------------------------------.
3003| Print this symbol on YYOUTPUT. |
3004`--------------------------------*/
3005
3006#if (defined __STDC__ || defined __C99__FUNC__ \
3007 || defined __cplusplus || defined _MSC_VER)
3008static void
3009yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
3010#else
3011static void
3012yy_symbol_print (yyoutput, yytype, yyvaluep)
3013 FILE *yyoutput;
3014 int yytype;
3015 YYSTYPE const * const yyvaluep;
Scott Michel15dcd8e2008-01-30 03:10:00 +00003016#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003017{
3018 if (yytype < YYNTOKENS)
3019 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
3020 else
3021 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
Chris Lattner38905612008-02-19 04:36:25 +00003022
Dan Gohmanf4423b12008-04-19 00:24:39 +00003023 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
3024 YYFPRINTF (yyoutput, ")");
3025}
Chris Lattner38905612008-02-19 04:36:25 +00003026
Dan Gohmanf4423b12008-04-19 00:24:39 +00003027/*------------------------------------------------------------------.
3028| yy_stack_print -- Print the state stack from its BOTTOM up to its |
3029| TOP (included). |
3030`------------------------------------------------------------------*/
Chris Lattner38905612008-02-19 04:36:25 +00003031
Dan Gohmanf4423b12008-04-19 00:24:39 +00003032#if (defined __STDC__ || defined __C99__FUNC__ \
3033 || defined __cplusplus || defined _MSC_VER)
3034static void
3035yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
3036#else
3037static void
3038yy_stack_print (bottom, top)
3039 yytype_int16 *bottom;
3040 yytype_int16 *top;
Scott Michel15dcd8e2008-01-30 03:10:00 +00003041#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003042{
3043 YYFPRINTF (stderr, "Stack now");
3044 for (; bottom <= top; ++bottom)
3045 YYFPRINTF (stderr, " %d", *bottom);
3046 YYFPRINTF (stderr, "\n");
3047}
Chris Lattner38905612008-02-19 04:36:25 +00003048
Dan Gohmanf4423b12008-04-19 00:24:39 +00003049# define YY_STACK_PRINT(Bottom, Top) \
3050do { \
3051 if (yydebug) \
3052 yy_stack_print ((Bottom), (Top)); \
3053} while (YYID (0))
Chris Lattner38905612008-02-19 04:36:25 +00003054
Dan Gohmanf4423b12008-04-19 00:24:39 +00003055
3056/*------------------------------------------------.
3057| Report that the YYRULE is going to be reduced. |
3058`------------------------------------------------*/
3059
3060#if (defined __STDC__ || defined __C99__FUNC__ \
3061 || defined __cplusplus || defined _MSC_VER)
3062static void
3063yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
3064#else
3065static void
3066yy_reduce_print (yyvsp, yyrule)
3067 YYSTYPE *yyvsp;
3068 int yyrule;
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00003069#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003070{
3071 int yynrhs = yyr2[yyrule];
3072 int yyi;
3073 unsigned long int yylno = yyrline[yyrule];
3074 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
3075 yyrule - 1, yylno);
3076 /* The symbols being reduced. */
3077 for (yyi = 0; yyi < yynrhs; yyi++)
3078 {
3079 fprintf (stderr, " $%d = ", yyi + 1);
3080 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
3081 &(yyvsp[(yyi + 1) - (yynrhs)])
3082 );
3083 fprintf (stderr, "\n");
3084 }
3085}
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003086
Dan Gohmanf4423b12008-04-19 00:24:39 +00003087# define YY_REDUCE_PRINT(Rule) \
3088do { \
3089 if (yydebug) \
3090 yy_reduce_print (yyvsp, Rule); \
3091} while (YYID (0))
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003092
Dan Gohmanf4423b12008-04-19 00:24:39 +00003093/* Nonzero means print parse trace. It is left uninitialized so that
3094 multiple parsers can coexist. */
3095int yydebug;
3096#else /* !YYDEBUG */
3097# define YYDPRINTF(Args)
3098# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
3099# define YY_STACK_PRINT(Bottom, Top)
3100# define YY_REDUCE_PRINT(Rule)
3101#endif /* !YYDEBUG */
3102
3103
3104/* YYINITDEPTH -- initial size of the parser's stacks. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003105#ifndef YYINITDEPTH
Dan Gohmanf4423b12008-04-19 00:24:39 +00003106# define YYINITDEPTH 200
Reid Spencer68a24bd2005-08-27 18:50:39 +00003107#endif
3108
Dan Gohmanf4423b12008-04-19 00:24:39 +00003109/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
3110 if the built-in stack extension method is used).
Reid Spencer68a24bd2005-08-27 18:50:39 +00003111
Dan Gohmanf4423b12008-04-19 00:24:39 +00003112 Do not make this value too large; the results are undefined if
3113 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
3114 evaluated with infinite-precision integer arithmetic. */
David Greene718fda32007-08-01 03:59:32 +00003115
Reid Spencer68a24bd2005-08-27 18:50:39 +00003116#ifndef YYMAXDEPTH
Dan Gohmanf4423b12008-04-19 00:24:39 +00003117# define YYMAXDEPTH 10000
Reid Spencer68a24bd2005-08-27 18:50:39 +00003118#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003119
Reid Spencer68a24bd2005-08-27 18:50:39 +00003120
3121
Dan Gohmanf4423b12008-04-19 00:24:39 +00003122#if YYERROR_VERBOSE
Reid Spencer68a24bd2005-08-27 18:50:39 +00003123
Dan Gohmanf4423b12008-04-19 00:24:39 +00003124# ifndef yystrlen
3125# if defined __GLIBC__ && defined _STRING_H
3126# define yystrlen strlen
3127# else
3128/* Return the length of YYSTR. */
3129#if (defined __STDC__ || defined __C99__FUNC__ \
3130 || defined __cplusplus || defined _MSC_VER)
3131static YYSIZE_T
3132yystrlen (const char *yystr)
Chris Lattner38905612008-02-19 04:36:25 +00003133#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00003134static YYSIZE_T
3135yystrlen (yystr)
3136 const char *yystr;
3137#endif
3138{
3139 YYSIZE_T yylen;
3140 for (yylen = 0; yystr[yylen]; yylen++)
3141 continue;
3142 return yylen;
3143}
3144# endif
3145# endif
3146
3147# ifndef yystpcpy
3148# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
3149# define yystpcpy stpcpy
3150# else
3151/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
3152 YYDEST. */
3153#if (defined __STDC__ || defined __C99__FUNC__ \
3154 || defined __cplusplus || defined _MSC_VER)
3155static char *
3156yystpcpy (char *yydest, const char *yysrc)
3157#else
3158static char *
3159yystpcpy (yydest, yysrc)
3160 char *yydest;
3161 const char *yysrc;
3162#endif
3163{
3164 char *yyd = yydest;
3165 const char *yys = yysrc;
3166
3167 while ((*yyd++ = *yys++) != '\0')
3168 continue;
3169
3170 return yyd - 1;
3171}
3172# endif
3173# endif
3174
3175# ifndef yytnamerr
3176/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3177 quotes and backslashes, so that it's suitable for yyerror. The
3178 heuristic is that double-quoting is unnecessary unless the string
3179 contains an apostrophe, a comma, or backslash (other than
3180 backslash-backslash). YYSTR is taken from yytname. If YYRES is
3181 null, do not copy; instead, return the length of what the result
3182 would have been. */
3183static YYSIZE_T
3184yytnamerr (char *yyres, const char *yystr)
3185{
3186 if (*yystr == '"')
3187 {
3188 YYSIZE_T yyn = 0;
3189 char const *yyp = yystr;
3190
3191 for (;;)
3192 switch (*++yyp)
3193 {
3194 case '\'':
3195 case ',':
3196 goto do_not_strip_quotes;
3197
3198 case '\\':
3199 if (*++yyp != '\\')
3200 goto do_not_strip_quotes;
3201 /* Fall through. */
3202 default:
3203 if (yyres)
3204 yyres[yyn] = *yyp;
3205 yyn++;
3206 break;
3207
3208 case '"':
3209 if (yyres)
3210 yyres[yyn] = '\0';
3211 return yyn;
3212 }
3213 do_not_strip_quotes: ;
3214 }
3215
3216 if (! yyres)
3217 return yystrlen (yystr);
3218
3219 return yystpcpy (yyres, yystr) - yyres;
3220}
3221# endif
3222
3223/* Copy into YYRESULT an error message about the unexpected token
3224 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3225 including the terminating null byte. If YYRESULT is null, do not
3226 copy anything; just return the number of bytes that would be
3227 copied. As a special case, return 0 if an ordinary "syntax error"
3228 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3229 size calculation. */
3230static YYSIZE_T
3231yysyntax_error (char *yyresult, int yystate, int yychar)
3232{
3233 int yyn = yypact[yystate];
3234
3235 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3236 return 0;
3237 else
3238 {
3239 int yytype = YYTRANSLATE (yychar);
3240 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3241 YYSIZE_T yysize = yysize0;
3242 YYSIZE_T yysize1;
3243 int yysize_overflow = 0;
3244 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3245 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3246 int yyx;
3247
3248# if 0
3249 /* This is so xgettext sees the translatable formats that are
3250 constructed on the fly. */
3251 YY_("syntax error, unexpected %s");
3252 YY_("syntax error, unexpected %s, expecting %s");
3253 YY_("syntax error, unexpected %s, expecting %s or %s");
3254 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3255 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3256# endif
3257 char *yyfmt;
3258 char const *yyf;
3259 static char const yyunexpected[] = "syntax error, unexpected %s";
3260 static char const yyexpecting[] = ", expecting %s";
3261 static char const yyor[] = " or %s";
3262 char yyformat[sizeof yyunexpected
3263 + sizeof yyexpecting - 1
3264 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3265 * (sizeof yyor - 1))];
3266 char const *yyprefix = yyexpecting;
3267
3268 /* Start YYX at -YYN if negative to avoid negative indexes in
3269 YYCHECK. */
3270 int yyxbegin = yyn < 0 ? -yyn : 0;
3271
3272 /* Stay within bounds of both yycheck and yytname. */
3273 int yychecklim = YYLAST - yyn + 1;
3274 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3275 int yycount = 1;
3276
3277 yyarg[0] = yytname[yytype];
3278 yyfmt = yystpcpy (yyformat, yyunexpected);
3279
3280 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3281 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3282 {
3283 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3284 {
3285 yycount = 1;
3286 yysize = yysize0;
3287 yyformat[sizeof yyunexpected - 1] = '\0';
3288 break;
3289 }
3290 yyarg[yycount++] = yytname[yyx];
3291 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3292 yysize_overflow |= (yysize1 < yysize);
3293 yysize = yysize1;
3294 yyfmt = yystpcpy (yyfmt, yyprefix);
3295 yyprefix = yyor;
3296 }
3297
3298 yyf = YY_(yyformat);
3299 yysize1 = yysize + yystrlen (yyf);
3300 yysize_overflow |= (yysize1 < yysize);
3301 yysize = yysize1;
3302
3303 if (yysize_overflow)
3304 return YYSIZE_MAXIMUM;
3305
3306 if (yyresult)
3307 {
3308 /* Avoid sprintf, as that infringes on the user's name space.
3309 Don't have undefined behavior even if the translation
3310 produced a string with the wrong number of "%s"s. */
3311 char *yyp = yyresult;
3312 int yyi = 0;
3313 while ((*yyp = *yyf) != '\0')
3314 {
3315 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3316 {
3317 yyp += yytnamerr (yyp, yyarg[yyi++]);
3318 yyf += 2;
3319 }
3320 else
3321 {
3322 yyp++;
3323 yyf++;
3324 }
3325 }
3326 }
3327 return yysize;
3328 }
3329}
3330#endif /* YYERROR_VERBOSE */
3331
3332
3333/*-----------------------------------------------.
3334| Release the memory associated to this symbol. |
3335`-----------------------------------------------*/
3336
3337/*ARGSUSED*/
3338#if (defined __STDC__ || defined __C99__FUNC__ \
3339 || defined __cplusplus || defined _MSC_VER)
3340static void
3341yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3342#else
3343static void
3344yydestruct (yymsg, yytype, yyvaluep)
3345 const char *yymsg;
3346 int yytype;
3347 YYSTYPE *yyvaluep;
3348#endif
3349{
3350 YYUSE (yyvaluep);
3351
3352 if (!yymsg)
3353 yymsg = "Deleting";
3354 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3355
3356 switch (yytype)
3357 {
3358
3359 default:
3360 break;
3361 }
3362}
3363
3364
3365/* Prevent warnings from -Wmissing-prototypes. */
3366
3367#ifdef YYPARSE_PARAM
3368#if defined __STDC__ || defined __cplusplus
3369int yyparse (void *YYPARSE_PARAM);
3370#else
3371int yyparse ();
3372#endif
3373#else /* ! YYPARSE_PARAM */
3374#if defined __STDC__ || defined __cplusplus
David Greene5fd22a82007-09-04 18:46:50 +00003375int yyparse (void);
Gabor Greife64d2482008-04-06 23:07:54 +00003376#else
Dan Gohmanf4423b12008-04-19 00:24:39 +00003377int yyparse ();
Scott Michel15dcd8e2008-01-30 03:10:00 +00003378#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003379#endif /* ! YYPARSE_PARAM */
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003380
Chris Lattner38905612008-02-19 04:36:25 +00003381
Dan Gohmanf4423b12008-04-19 00:24:39 +00003382
3383/* The look-ahead symbol. */
3384int yychar;
3385
3386/* The semantic value of the look-ahead symbol. */
3387YYSTYPE yylval;
3388
3389/* Number of syntax errors so far. */
3390int yynerrs;
3391
3392
3393
3394/*----------.
3395| yyparse. |
3396`----------*/
3397
3398#ifdef YYPARSE_PARAM
3399#if (defined __STDC__ || defined __C99__FUNC__ \
3400 || defined __cplusplus || defined _MSC_VER)
3401int
3402yyparse (void *YYPARSE_PARAM)
3403#else
3404int
3405yyparse (YYPARSE_PARAM)
3406 void *YYPARSE_PARAM;
3407#endif
3408#else /* ! YYPARSE_PARAM */
3409#if (defined __STDC__ || defined __C99__FUNC__ \
3410 || defined __cplusplus || defined _MSC_VER)
3411int
3412yyparse (void)
3413#else
3414int
3415yyparse ()
3416
Gabor Greife64d2482008-04-06 23:07:54 +00003417#endif
3418#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00003419{
3420
3421 int yystate;
3422 int yyn;
3423 int yyresult;
3424 /* Number of tokens to shift before error messages enabled. */
3425 int yyerrstatus;
3426 /* Look-ahead token as an internal (translated) token number. */
3427 int yytoken = 0;
3428#if YYERROR_VERBOSE
3429 /* Buffer for error messages, and its allocated size. */
3430 char yymsgbuf[128];
3431 char *yymsg = yymsgbuf;
3432 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
Gabor Greife64d2482008-04-06 23:07:54 +00003433#endif
Chris Lattner38905612008-02-19 04:36:25 +00003434
Dan Gohmanf4423b12008-04-19 00:24:39 +00003435 /* Three stacks and their tools:
3436 `yyss': related to states,
3437 `yyvs': related to semantic values,
3438 `yyls': related to locations.
3439
3440 Refer to the stacks thru separate pointers, to allow yyoverflow
3441 to reallocate them elsewhere. */
3442
3443 /* The state stack. */
3444 yytype_int16 yyssa[YYINITDEPTH];
3445 yytype_int16 *yyss = yyssa;
3446 yytype_int16 *yyssp;
3447
3448 /* The semantic value stack. */
3449 YYSTYPE yyvsa[YYINITDEPTH];
3450 YYSTYPE *yyvs = yyvsa;
3451 YYSTYPE *yyvsp;
3452
3453
3454
3455#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3456
3457 YYSIZE_T yystacksize = YYINITDEPTH;
3458
3459 /* The variables used to return semantic value and location from the
3460 action routines. */
3461 YYSTYPE yyval;
3462
3463
3464 /* The number of symbols on the RHS of the reduced rule.
3465 Keep to zero when no symbol should be popped. */
3466 int yylen = 0;
3467
3468 YYDPRINTF ((stderr, "Starting parse\n"));
3469
Reid Spencer68a24bd2005-08-27 18:50:39 +00003470 yystate = 0;
3471 yyerrstatus = 0;
3472 yynerrs = 0;
3473 yychar = YYEMPTY; /* Cause a token to be read. */
3474
3475 /* Initialize stack pointers.
3476 Waste one element of value and location stack
3477 so that they stay on the same level as the state stack.
3478 The wasted elements are never initialized. */
3479
Dan Gohmanf4423b12008-04-19 00:24:39 +00003480 yyssp = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003481 yyvsp = yyvs;
3482
Dan Gohmanf4423b12008-04-19 00:24:39 +00003483 goto yysetstate;
Jeff Cohen66c5fd62005-10-23 04:37:20 +00003484
Dan Gohmanf4423b12008-04-19 00:24:39 +00003485/*------------------------------------------------------------.
3486| yynewstate -- Push a new state, which is found in yystate. |
3487`------------------------------------------------------------*/
3488 yynewstate:
3489 /* In all cases, when you get here, the value and location stacks
3490 have just been pushed. So pushing a state here evens the stacks. */
3491 yyssp++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003492
Dan Gohmanf4423b12008-04-19 00:24:39 +00003493 yysetstate:
3494 *yyssp = yystate;
3495
3496 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003497 {
3498 /* Get the current used size of the three stacks, in elements. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003499 YYSIZE_T yysize = yyssp - yyss + 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003500
3501#ifdef yyoverflow
Dan Gohmanf4423b12008-04-19 00:24:39 +00003502 {
3503 /* Give user a chance to reallocate the stack. Use copies of
3504 these so that the &'s don't force the real ones into
3505 memory. */
3506 YYSTYPE *yyvs1 = yyvs;
3507 yytype_int16 *yyss1 = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003508
Dan Gohmanf4423b12008-04-19 00:24:39 +00003509
3510 /* Each stack pointer address is followed by the size of the
3511 data in use in that stack, in bytes. This used to be a
3512 conditional around just the two extra args, but that might
3513 be undefined if yyoverflow is a macro. */
3514 yyoverflow (YY_("memory exhausted"),
3515 &yyss1, yysize * sizeof (*yyssp),
3516 &yyvs1, yysize * sizeof (*yyvsp),
3517
3518 &yystacksize);
3519
3520 yyss = yyss1;
3521 yyvs = yyvs1;
3522 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00003523#else /* no yyoverflow */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003524# ifndef YYSTACK_RELOCATE
3525 goto yyexhaustedlab;
3526# else
Reid Spencer68a24bd2005-08-27 18:50:39 +00003527 /* Extend the stack our own way. */
Dan Gohmanf4423b12008-04-19 00:24:39 +00003528 if (YYMAXDEPTH <= yystacksize)
3529 goto yyexhaustedlab;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003530 yystacksize *= 2;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003531 if (YYMAXDEPTH < yystacksize)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003532 yystacksize = YYMAXDEPTH;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003533
3534 {
3535 yytype_int16 *yyss1 = yyss;
3536 union yyalloc *yyptr =
3537 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3538 if (! yyptr)
3539 goto yyexhaustedlab;
3540 YYSTACK_RELOCATE (yyss);
3541 YYSTACK_RELOCATE (yyvs);
3542
3543# undef YYSTACK_RELOCATE
3544 if (yyss1 != yyssa)
3545 YYSTACK_FREE (yyss1);
3546 }
3547# endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00003548#endif /* no yyoverflow */
3549
Dan Gohmanf4423b12008-04-19 00:24:39 +00003550 yyssp = yyss + yysize - 1;
3551 yyvsp = yyvs + yysize - 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003552
3553
Dan Gohmanf4423b12008-04-19 00:24:39 +00003554 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3555 (unsigned long int) yystacksize));
3556
3557 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003558 YYABORT;
3559 }
3560
Dan Gohmanf4423b12008-04-19 00:24:39 +00003561 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003562
3563 goto yybackup;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003564
Dan Gohmanf4423b12008-04-19 00:24:39 +00003565/*-----------.
3566| yybackup. |
3567`-----------*/
3568yybackup:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003569
Dan Gohmanf4423b12008-04-19 00:24:39 +00003570 /* Do appropriate processing given the current state. Read a
3571 look-ahead token if we need one and don't already have one. */
Reid Spencer7780acb2007-04-16 06:56:07 +00003572
Dan Gohmanf4423b12008-04-19 00:24:39 +00003573 /* First try to decide what to do without reference to look-ahead token. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003574 yyn = yypact[yystate];
Dan Gohmanf4423b12008-04-19 00:24:39 +00003575 if (yyn == YYPACT_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003576 goto yydefault;
3577
Dan Gohmanf4423b12008-04-19 00:24:39 +00003578 /* Not known => get a look-ahead token if don't already have one. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003579
Dan Gohmanf4423b12008-04-19 00:24:39 +00003580 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003581 if (yychar == YYEMPTY)
3582 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003583 YYDPRINTF ((stderr, "Reading a token: "));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003584 yychar = YYLEX;
3585 }
3586
Dan Gohmanf4423b12008-04-19 00:24:39 +00003587 if (yychar <= YYEOF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003588 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003589 yychar = yytoken = YYEOF;
3590 YYDPRINTF ((stderr, "Now at end of input.\n"));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003591 }
3592 else
3593 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003594 yytoken = YYTRANSLATE (yychar);
3595 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Reid Spencer68a24bd2005-08-27 18:50:39 +00003596 }
3597
Dan Gohmanf4423b12008-04-19 00:24:39 +00003598 /* If the proper action on seeing token YYTOKEN is to reduce or to
3599 detect an error, take that action. */
3600 yyn += yytoken;
3601 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003602 goto yydefault;
3603 yyn = yytable[yyn];
Dan Gohmanf4423b12008-04-19 00:24:39 +00003604 if (yyn <= 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003605 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003606 if (yyn == 0 || yyn == YYTABLE_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003607 goto yyerrlab;
3608 yyn = -yyn;
3609 goto yyreduce;
3610 }
3611
3612 if (yyn == YYFINAL)
3613 YYACCEPT;
3614
Dan Gohmanf4423b12008-04-19 00:24:39 +00003615 /* Count tokens shifted since error; after three, turn off error
3616 status. */
3617 if (yyerrstatus)
3618 yyerrstatus--;
Dale Johannesencdd509a2007-09-07 21:07:57 +00003619
Dan Gohmanf4423b12008-04-19 00:24:39 +00003620 /* Shift the look-ahead token. */
3621 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003622
Dan Gohmanf4423b12008-04-19 00:24:39 +00003623 /* Discard the shifted token unless it is eof. */
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003624 if (yychar != YYEOF)
3625 yychar = YYEMPTY;
3626
Gabor Greife64d2482008-04-06 23:07:54 +00003627 yystate = yyn;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003628 *++yyvsp = yylval;
3629
Reid Spencer68a24bd2005-08-27 18:50:39 +00003630 goto yynewstate;
3631
Gabor Greife64d2482008-04-06 23:07:54 +00003632
Dan Gohmanf4423b12008-04-19 00:24:39 +00003633/*-----------------------------------------------------------.
3634| yydefault -- do the default action for the current state. |
3635`-----------------------------------------------------------*/
3636yydefault:
Reid Spencer68a24bd2005-08-27 18:50:39 +00003637 yyn = yydefact[yystate];
3638 if (yyn == 0)
3639 goto yyerrlab;
Dan Gohmanf4423b12008-04-19 00:24:39 +00003640 goto yyreduce;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003641
Dan Gohmanf4423b12008-04-19 00:24:39 +00003642
3643/*-----------------------------.
3644| yyreduce -- Do a reduction. |
3645`-----------------------------*/
Reid Spencer68a24bd2005-08-27 18:50:39 +00003646yyreduce:
Dan Gohmanf4423b12008-04-19 00:24:39 +00003647 /* yyn is the number of a rule to reduce with. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003648 yylen = yyr2[yyn];
3649
Dan Gohmanf4423b12008-04-19 00:24:39 +00003650 /* If YYLEN is nonzero, implement the default value of the action:
3651 `$$ = $1'.
3652
3653 Otherwise, the following line sets YYVAL to garbage.
3654 This behavior is undocumented and Bison
3655 users should not rely upon it. Assigning to YYVAL
3656 unconditionally makes the parser a bit smaller, and it avoids a
3657 GCC warning that YYVAL may be used uninitialized. */
3658 yyval = yyvsp[1-yylen];
3659
3660
3661 YY_REDUCE_PRINT (yyn);
3662 switch (yyn)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003663 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00003664 case 29:
Devang Pateld4980812008-09-02 20:52:40 +00003665#line 1148 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003666 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3667 break;
Reid Spencer41dff5e2007-01-26 08:05:27 +00003668
Dan Gohmanf4423b12008-04-19 00:24:39 +00003669 case 30:
Devang Pateld4980812008-09-02 20:52:40 +00003670#line 1148 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003671 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3672 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003673
Dan Gohmanf4423b12008-04-19 00:24:39 +00003674 case 31:
Devang Pateld4980812008-09-02 20:52:40 +00003675#line 1149 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003676 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3677 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003678
Dan Gohmanf4423b12008-04-19 00:24:39 +00003679 case 32:
Devang Pateld4980812008-09-02 20:52:40 +00003680#line 1149 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003681 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3682 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003683
Dan Gohmanf4423b12008-04-19 00:24:39 +00003684 case 33:
Devang Pateld4980812008-09-02 20:52:40 +00003685#line 1150 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003686 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3687 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003688
Dan Gohmanf4423b12008-04-19 00:24:39 +00003689 case 34:
Devang Pateld4980812008-09-02 20:52:40 +00003690#line 1150 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003691 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3692 break;
3693
3694 case 35:
Devang Pateld4980812008-09-02 20:52:40 +00003695#line 1151 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003696 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3697 break;
3698
3699 case 36:
Devang Pateld4980812008-09-02 20:52:40 +00003700#line 1151 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003701 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3702 break;
3703
3704 case 37:
Devang Pateld4980812008-09-02 20:52:40 +00003705#line 1152 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003706 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3707 break;
3708
3709 case 38:
Devang Pateld4980812008-09-02 20:52:40 +00003710#line 1152 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003711 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3712 break;
3713
3714 case 39:
Devang Pateld4980812008-09-02 20:52:40 +00003715#line 1156 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003716 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3717 break;
3718
3719 case 40:
Devang Pateld4980812008-09-02 20:52:40 +00003720#line 1156 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003721 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3722 break;
3723
3724 case 41:
Devang Pateld4980812008-09-02 20:52:40 +00003725#line 1157 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003726 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3727 break;
3728
3729 case 42:
Devang Pateld4980812008-09-02 20:52:40 +00003730#line 1157 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003731 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3732 break;
3733
3734 case 43:
Devang Pateld4980812008-09-02 20:52:40 +00003735#line 1158 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003736 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3737 break;
3738
3739 case 44:
Devang Pateld4980812008-09-02 20:52:40 +00003740#line 1158 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003741 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3742 break;
3743
3744 case 45:
Devang Pateld4980812008-09-02 20:52:40 +00003745#line 1159 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003746 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3747 break;
3748
3749 case 46:
Devang Pateld4980812008-09-02 20:52:40 +00003750#line 1159 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003751 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3752 break;
3753
3754 case 47:
Devang Pateld4980812008-09-02 20:52:40 +00003755#line 1160 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003756 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3757 break;
3758
3759 case 48:
Devang Pateld4980812008-09-02 20:52:40 +00003760#line 1160 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003761 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3762 break;
3763
3764 case 49:
Devang Pateld4980812008-09-02 20:52:40 +00003765#line 1161 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003766 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3767 break;
3768
3769 case 50:
Devang Pateld4980812008-09-02 20:52:40 +00003770#line 1161 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003771 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3772 break;
3773
3774 case 51:
Devang Pateld4980812008-09-02 20:52:40 +00003775#line 1162 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003776 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3777 break;
3778
3779 case 52:
Devang Pateld4980812008-09-02 20:52:40 +00003780#line 1162 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003781 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3782 break;
3783
3784 case 53:
Devang Pateld4980812008-09-02 20:52:40 +00003785#line 1163 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003786 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3787 break;
3788
3789 case 54:
Devang Pateld4980812008-09-02 20:52:40 +00003790#line 1164 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003791 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3792 break;
3793
3794 case 65:
Devang Pateld4980812008-09-02 20:52:40 +00003795#line 1173 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003796 { (yyval.StrVal) = 0; ;}
3797 break;
3798
3799 case 66:
Devang Pateld4980812008-09-02 20:52:40 +00003800#line 1175 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003801 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3802 break;
3803
3804 case 67:
Devang Pateld4980812008-09-02 20:52:40 +00003805#line 1176 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003806 { (yyval.UIntVal)=0; ;}
3807 break;
3808
3809 case 68:
Devang Pateld4980812008-09-02 20:52:40 +00003810#line 1180 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003811 {
3812 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003813 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003814 ;}
3815 break;
3816
3817 case 69:
Devang Pateld4980812008-09-02 20:52:40 +00003818#line 1184 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003819 {
3820 (yyval.StrVal) = 0;
Christopher Lambbf3348d2007-12-12 08:45:45 +00003821 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003822 ;}
3823 break;
3824
Chris Lattner15bd0952008-08-29 17:20:18 +00003825 case 70:
Devang Pateld4980812008-09-02 20:52:40 +00003826#line 1189 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003827 {
Chris Lattner15bd0952008-08-29 17:20:18 +00003828 (yyval.UIntVal) = (yyvsp[(1) - (2)].UIntVal);
3829 CHECK_FOR_ERROR
3830;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003831 break;
3832
3833 case 74:
Devang Pateld4980812008-09-02 20:52:40 +00003834#line 1198 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003835 {
3836 (yyval.StrVal) = 0;
3837 CHECK_FOR_ERROR
3838 ;}
3839 break;
3840
3841 case 75:
Devang Pateld4980812008-09-02 20:52:40 +00003842#line 1203 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003843 {
3844 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00003845 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00003846 ;}
3847 break;
3848
Chris Lattner15bd0952008-08-29 17:20:18 +00003849 case 76:
Devang Pateld4980812008-09-02 20:52:40 +00003850#line 1209 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003851 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3852 break;
3853
Chris Lattner15bd0952008-08-29 17:20:18 +00003854 case 77:
Devang Pateld4980812008-09-02 20:52:40 +00003855#line 1210 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003856 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3857 break;
3858
Chris Lattner15bd0952008-08-29 17:20:18 +00003859 case 78:
Devang Pateld4980812008-09-02 20:52:40 +00003860#line 1211 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003861 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3862 break;
3863
Chris Lattner15bd0952008-08-29 17:20:18 +00003864 case 79:
Devang Pateld4980812008-09-02 20:52:40 +00003865#line 1212 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003866 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3867 break;
3868
Chris Lattner15bd0952008-08-29 17:20:18 +00003869 case 80:
Devang Pateld4980812008-09-02 20:52:40 +00003870#line 1213 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00003871 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3872 break;
3873
Chris Lattner15bd0952008-08-29 17:20:18 +00003874 case 81:
Devang Pateld4980812008-09-02 20:52:40 +00003875#line 1214 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003876 { (yyval.Linkage) = GlobalValue::CommonLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003877 break;
3878
Chris Lattner15bd0952008-08-29 17:20:18 +00003879 case 82:
Devang Pateld4980812008-09-02 20:52:40 +00003880#line 1218 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003881 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003882 break;
3883
Chris Lattner15bd0952008-08-29 17:20:18 +00003884 case 83:
Devang Pateld4980812008-09-02 20:52:40 +00003885#line 1219 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003886 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003887 break;
3888
Chris Lattner15bd0952008-08-29 17:20:18 +00003889 case 84:
Devang Pateld4980812008-09-02 20:52:40 +00003890#line 1220 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003891 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003892 break;
3893
Dan Gohmanf4423b12008-04-19 00:24:39 +00003894 case 85:
Devang Pateld4980812008-09-02 20:52:40 +00003895#line 1224 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003896 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003897 break;
3898
3899 case 86:
Devang Pateld4980812008-09-02 20:52:40 +00003900#line 1225 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003901 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003902 break;
3903
3904 case 87:
Devang Pateld4980812008-09-02 20:52:40 +00003905#line 1226 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003906 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003907 break;
3908
3909 case 88:
Devang Pateld4980812008-09-02 20:52:40 +00003910#line 1227 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003911 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003912 break;
3913
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003914 case 89:
Devang Pateld4980812008-09-02 20:52:40 +00003915#line 1231 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003916 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003917 break;
3918
3919 case 90:
Devang Pateld4980812008-09-02 20:52:40 +00003920#line 1232 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003921 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003922 break;
3923
3924 case 91:
Devang Pateld4980812008-09-02 20:52:40 +00003925#line 1233 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003926 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003927 break;
3928
3929 case 92:
Devang Pateld4980812008-09-02 20:52:40 +00003930#line 1237 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00003931 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3932 break;
3933
Chris Lattner15bd0952008-08-29 17:20:18 +00003934 case 93:
Devang Pateld4980812008-09-02 20:52:40 +00003935#line 1238 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003936 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003937 break;
3938
Chris Lattner15bd0952008-08-29 17:20:18 +00003939 case 94:
Devang Pateld4980812008-09-02 20:52:40 +00003940#line 1239 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003941 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3942 break;
3943
3944 case 95:
Devang Pateld4980812008-09-02 20:52:40 +00003945#line 1240 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003946 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3947 break;
3948
3949 case 96:
Devang Pateld4980812008-09-02 20:52:40 +00003950#line 1241 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003951 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3952 break;
3953
3954 case 97:
Devang Pateld4980812008-09-02 20:52:40 +00003955#line 1245 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003956 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3957 break;
3958
3959 case 98:
Devang Pateld4980812008-09-02 20:52:40 +00003960#line 1246 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003961 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3962 break;
3963
Dan Gohmanf4423b12008-04-19 00:24:39 +00003964 case 99:
Devang Pateld4980812008-09-02 20:52:40 +00003965#line 1247 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003966 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003967 break;
3968
3969 case 100:
Devang Pateld4980812008-09-02 20:52:40 +00003970#line 1250 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003971 { (yyval.UIntVal) = CallingConv::C; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003972 break;
3973
3974 case 101:
Devang Pateld4980812008-09-02 20:52:40 +00003975#line 1251 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003976 { (yyval.UIntVal) = CallingConv::C; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003977 break;
3978
3979 case 102:
Devang Pateld4980812008-09-02 20:52:40 +00003980#line 1252 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003981 { (yyval.UIntVal) = CallingConv::Fast; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003982 break;
3983
3984 case 103:
Devang Pateld4980812008-09-02 20:52:40 +00003985#line 1253 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003986 { (yyval.UIntVal) = CallingConv::Cold; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00003987 break;
3988
3989 case 104:
Devang Pateld4980812008-09-02 20:52:40 +00003990#line 1254 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003991 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
Dale Johannesenc7071cc2008-05-14 20:13:36 +00003992 break;
3993
3994 case 105:
Devang Pateld4980812008-09-02 20:52:40 +00003995#line 1255 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00003996 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
Dale Johannesen20ab78b2008-08-13 18:41:46 +00003997 break;
3998
3999 case 106:
Devang Pateld4980812008-09-02 20:52:40 +00004000#line 1256 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004001 { (yyval.UIntVal) = CallingConv::X86_SSECall; ;}
4002 break;
4003
4004 case 107:
Devang Pateld4980812008-09-02 20:52:40 +00004005#line 1257 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004006 {
4007 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004008 GEN_ERROR("Calling conv too large");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004009 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004010 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004011 ;}
4012 break;
4013
Dan Gohmanf4423b12008-04-19 00:24:39 +00004014 case 108:
Devang Pateld4980812008-09-02 20:52:40 +00004015#line 1264 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004016 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004017 break;
4018
4019 case 109:
Devang Pateld4980812008-09-02 20:52:40 +00004020#line 1265 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004021 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004022 break;
4023
4024 case 110:
Devang Pateld4980812008-09-02 20:52:40 +00004025#line 1266 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004026 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004027 break;
4028
4029 case 111:
Devang Pateld4980812008-09-02 20:52:40 +00004030#line 1267 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004031 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004032 break;
4033
4034 case 112:
Devang Pateld4980812008-09-02 20:52:40 +00004035#line 1268 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004036 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004037 break;
4038
4039 case 113:
Devang Pateld4980812008-09-02 20:52:40 +00004040#line 1269 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004041 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004042 break;
4043
4044 case 114:
Devang Pateld4980812008-09-02 20:52:40 +00004045#line 1270 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004046 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004047 break;
4048
4049 case 115:
Devang Pateld4980812008-09-02 20:52:40 +00004050#line 1271 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004051 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004052 break;
4053
4054 case 116:
Devang Pateld4980812008-09-02 20:52:40 +00004055#line 1272 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004056 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
4057 break;
4058
4059 case 117:
Devang Pateld4980812008-09-02 20:52:40 +00004060#line 1273 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004061 { (yyval.ParamAttrs) =
4062 ParamAttr::constructAlignmentFromInt((yyvsp[(2) - (2)].UInt64Val)); ;}
4063 break;
4064
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004065 case 118:
Devang Pateld4980812008-09-02 20:52:40 +00004066#line 1277 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004067 { (yyval.ParamAttrs) = ParamAttr::None; ;}
Dan Gohmanf4423b12008-04-19 00:24:39 +00004068 break;
4069
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004070 case 119:
Devang Pateld4980812008-09-02 20:52:40 +00004071#line 1278 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004072 {
4073 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
4074 ;}
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004075 break;
4076
Chris Lattner15bd0952008-08-29 17:20:18 +00004077 case 120:
Devang Pateld4980812008-09-02 20:52:40 +00004078#line 1283 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004079 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
4080 break;
4081
4082 case 121:
Devang Pateld4980812008-09-02 20:52:40 +00004083#line 1284 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004084 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
4085 break;
4086
4087 case 122:
Devang Pateld4980812008-09-02 20:52:40 +00004088#line 1285 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004089 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
4090 break;
4091
4092 case 123:
Devang Pateld4980812008-09-02 20:52:40 +00004093#line 1286 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004094 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
4095 break;
4096
4097 case 124:
Devang Pateld4980812008-09-02 20:52:40 +00004098#line 1287 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004099 { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
4100 break;
4101
4102 case 125:
Devang Pateld4980812008-09-02 20:52:40 +00004103#line 1288 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004104 { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
4105 break;
4106
4107 case 126:
Devang Pateld4980812008-09-02 20:52:40 +00004108#line 1291 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004109 { (yyval.ParamAttrs) = ParamAttr::None; ;}
4110 break;
4111
Dale Johannesenc7071cc2008-05-14 20:13:36 +00004112 case 127:
Devang Pateld4980812008-09-02 20:52:40 +00004113#line 1292 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004114 {
4115 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
4116 ;}
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004117 break;
4118
4119 case 128:
Devang Pateld4980812008-09-02 20:52:40 +00004120#line 1297 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
4121 { (yyval.FunctionNotes) = (yyvsp[(1) - (1)].FunctionNotes); ;}
Chris Lattner15bd0952008-08-29 17:20:18 +00004122 break;
4123
4124 case 129:
Devang Pateld4980812008-09-02 20:52:40 +00004125#line 1298 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
4126 {
4127 FunctionNotes tmp = (yyvsp[(1) - (3)].FunctionNotes) | (yyvsp[(3) - (3)].FunctionNotes);
Devang Patelcb7f4832008-09-02 22:43:57 +00004128 if ((yyvsp[(3) - (3)].FunctionNotes) == FN_NOTE_NoInline && ((yyvsp[(1) - (3)].FunctionNotes) & FN_NOTE_AlwaysInline))
Devang Pateld4980812008-09-02 20:52:40 +00004129 GEN_ERROR("Function Notes may include only one inline notes!")
Devang Patelcb7f4832008-09-02 22:43:57 +00004130 if ((yyvsp[(3) - (3)].FunctionNotes) == FN_NOTE_AlwaysInline && ((yyvsp[(1) - (3)].FunctionNotes) & FN_NOTE_NoInline))
Devang Pateld4980812008-09-02 20:52:40 +00004131 GEN_ERROR("Function Notes may include only one inline notes!")
4132 (yyval.FunctionNotes) = tmp;
4133 CHECK_FOR_ERROR
4134 ;}
4135 break;
4136
4137 case 130:
4138#line 1309 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcb7f4832008-09-02 22:43:57 +00004139 { (yyval.FunctionNotes) = FN_NOTE_NoInline; ;}
Devang Pateld4980812008-09-02 20:52:40 +00004140 break;
4141
4142 case 131:
4143#line 1310 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcb7f4832008-09-02 22:43:57 +00004144 { (yyval.FunctionNotes) = FN_NOTE_AlwaysInline; ;}
Devang Pateld4980812008-09-02 20:52:40 +00004145 break;
4146
4147 case 132:
4148#line 1311 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcb7f4832008-09-02 22:43:57 +00004149 { (yyval.FunctionNotes) = FN_NOTE_OptimizeForSize; ;}
Devang Pateld4980812008-09-02 20:52:40 +00004150 break;
4151
4152 case 133:
4153#line 1314 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patelcb7f4832008-09-02 22:43:57 +00004154 { (yyval.FunctionNotes) = FN_NOTE_None; ;}
Devang Pateld4980812008-09-02 20:52:40 +00004155 break;
4156
4157 case 134:
4158#line 1315 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
4159 {
4160 (yyval.FunctionNotes) = (yyvsp[(3) - (4)].FunctionNotes);
4161 ;}
4162 break;
4163
4164 case 135:
4165#line 1320 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
4166 { (yyval.StrVal) = 0; ;}
4167 break;
4168
4169 case 136:
4170#line 1321 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004171 {
4172 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
4173 ;}
4174 break;
4175
Devang Pateld4980812008-09-02 20:52:40 +00004176 case 137:
4177#line 1328 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004178 { (yyval.UIntVal) = 0; ;}
4179 break;
4180
Devang Pateld4980812008-09-02 20:52:40 +00004181 case 138:
4182#line 1329 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004183 {
4184 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
4185 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004186 GEN_ERROR("Alignment must be a power of two");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004187 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004188;}
4189 break;
4190
Devang Pateld4980812008-09-02 20:52:40 +00004191 case 139:
4192#line 1335 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004193 { (yyval.UIntVal) = 0; ;}
4194 break;
4195
Devang Pateld4980812008-09-02 20:52:40 +00004196 case 140:
4197#line 1336 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004198 {
4199 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
4200 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Christopher Lambbf3348d2007-12-12 08:45:45 +00004201 GEN_ERROR("Alignment must be a power of two");
4202 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004203;}
4204 break;
4205
Devang Pateld4980812008-09-02 20:52:40 +00004206 case 141:
4207#line 1345 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004208 {
4209 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
4210 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004211 GEN_ERROR("Invalid character in section name");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004212 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004213 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004214;}
4215 break;
4216
Devang Pateld4980812008-09-02 20:52:40 +00004217 case 142:
4218#line 1353 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004219 { (yyval.StrVal) = 0; ;}
4220 break;
4221
Devang Pateld4980812008-09-02 20:52:40 +00004222 case 143:
4223#line 1354 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004224 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
4225 break;
4226
Devang Pateld4980812008-09-02 20:52:40 +00004227 case 144:
4228#line 1359 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen20ab78b2008-08-13 18:41:46 +00004229 {;}
4230 break;
4231
Devang Pateld4980812008-09-02 20:52:40 +00004232 case 145:
4233#line 1360 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00004234 {;}
4235 break;
4236
Devang Pateld4980812008-09-02 20:52:40 +00004237 case 146:
4238#line 1361 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004239 {
4240 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
4241 delete (yyvsp[(1) - (1)].StrVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004242 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004243 ;}
4244 break;
4245
Devang Pateld4980812008-09-02 20:52:40 +00004246 case 147:
4247#line 1366 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004248 {
4249 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004250 GEN_ERROR("Alignment must be a power of two");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004251 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004252 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004253 ;}
4254 break;
4255
Devang Pateld4980812008-09-02 20:52:40 +00004256 case 155:
4257#line 1382 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004258 {
4259 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004260 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004261 ;}
4262 break;
4263
Devang Pateld4980812008-09-02 20:52:40 +00004264 case 156:
4265#line 1386 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004266 {
4267 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004268 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004269 ;}
4270 break;
4271
Devang Pateld4980812008-09-02 20:52:40 +00004272 case 157:
4273#line 1390 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004274 { // Pointer type?
4275 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
Christopher Lambbf3348d2007-12-12 08:45:45 +00004276 GEN_ERROR("Cannot form a pointer to a basic block");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004277 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4278 delete (yyvsp[(1) - (3)].TypeVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00004279 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004280 ;}
4281 break;
4282
Devang Pateld4980812008-09-02 20:52:40 +00004283 case 158:
4284#line 1397 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004285 { // Named types are also simple types...
4286 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00004287 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004288 (yyval.TypeVal) = new PATypeHolder(tmp);
4289 ;}
4290 break;
4291
Devang Pateld4980812008-09-02 20:52:40 +00004292 case 159:
4293#line 1402 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004294 { // Type UpReference
4295 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004296 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Dan Gohmanf4423b12008-04-19 00:24:39 +00004297 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4298 (yyval.TypeVal) = new PATypeHolder(OT);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004299 UR_OUT("New Upreference!\n");
4300 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004301 ;}
4302 break;
4303
Devang Pateld4980812008-09-02 20:52:40 +00004304 case 160:
4305#line 1410 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004306 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004307 // Allow but ignore attributes on function types; this permits auto-upgrade.
4308 // FIXME: remove in LLVM 3.0.
Chris Lattnera925a142008-04-23 05:37:08 +00004309 const Type *RetTy = *(yyvsp[(1) - (5)].TypeVal);
4310 if (!FunctionType::isValidReturnType(RetTy))
4311 GEN_ERROR("Invalid result type for LLVM function");
4312
Reid Spencer41dff5e2007-01-26 08:05:27 +00004313 std::vector<const Type*> Params;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004314 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00004315 for (; I != E; ++I ) {
Reid Spencer66728ef2007-03-20 01:13:36 +00004316 const Type *Ty = I->Ty->get();
Reid Spencer66728ef2007-03-20 01:13:36 +00004317 Params.push_back(Ty);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004318 }
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004319
Reid Spencer41dff5e2007-01-26 08:05:27 +00004320 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4321 if (isVarArg) Params.pop_back();
4322
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004323 for (unsigned i = 0; i != Params.size(); ++i)
4324 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4325 GEN_ERROR("Function arguments must be value types!");
4326
4327 CHECK_FOR_ERROR
4328
Anton Korobeynikovc36284e2007-12-03 19:17:47 +00004329 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004330 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4331 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4332 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Reid Spencere4d87aa2006-12-23 06:05:41 +00004333 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004334 ;}
4335 break;
4336
Devang Pateld4980812008-09-02 20:52:40 +00004337 case 161:
4338#line 1439 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004339 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004340 // Allow but ignore attributes on function types; this permits auto-upgrade.
4341 // FIXME: remove in LLVM 3.0.
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004342 std::vector<const Type*> Params;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004343 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00004344 for ( ; I != E; ++I ) {
Reid Spencer66728ef2007-03-20 01:13:36 +00004345 const Type* Ty = I->Ty->get();
Reid Spencer66728ef2007-03-20 01:13:36 +00004346 Params.push_back(Ty);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004347 }
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004348
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004349 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4350 if (isVarArg) Params.pop_back();
4351
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004352 for (unsigned i = 0; i != Params.size(); ++i)
4353 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4354 GEN_ERROR("Function arguments must be value types!");
4355
4356 CHECK_FOR_ERROR
4357
Dan Gohmanf4423b12008-04-19 00:24:39 +00004358 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4359 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4360 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004361 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004362 ;}
4363 break;
4364
Devang Pateld4980812008-09-02 20:52:40 +00004365 case 162:
4366#line 1464 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004367 { // Sized array type?
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004368 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (yyvsp[(2) - (5)].UInt64Val))));
Dan Gohmanf4423b12008-04-19 00:24:39 +00004369 delete (yyvsp[(4) - (5)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004370 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004371 ;}
4372 break;
4373
Devang Pateld4980812008-09-02 20:52:40 +00004374 case 163:
4375#line 1469 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004376 { // Vector type?
4377 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4378 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004379 GEN_ERROR("Unsigned result not equal to signed result");
4380 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4381 GEN_ERROR("Element type of a VectorType must be primitive");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004382 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4383 delete (yyvsp[(4) - (5)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004384 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004385 ;}
4386 break;
4387
Devang Pateld4980812008-09-02 20:52:40 +00004388 case 164:
4389#line 1479 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004390 { // Structure type?
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004391 std::vector<const Type*> Elements;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004392 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4393 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004394 Elements.push_back(*I);
4395
Dan Gohmanf4423b12008-04-19 00:24:39 +00004396 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4397 delete (yyvsp[(2) - (3)].TypeList);
Reid Spencer14310612006-12-31 05:40:51 +00004398 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004399 ;}
4400 break;
4401
Devang Pateld4980812008-09-02 20:52:40 +00004402 case 165:
4403#line 1489 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004404 { // Empty structure type?
4405 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Reid Spencer14310612006-12-31 05:40:51 +00004406 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004407 ;}
4408 break;
4409
Devang Pateld4980812008-09-02 20:52:40 +00004410 case 166:
4411#line 1493 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004412 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004413 std::vector<const Type*> Elements;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004414 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4415 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004416 Elements.push_back(*I);
4417
Dan Gohmanf4423b12008-04-19 00:24:39 +00004418 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4419 delete (yyvsp[(3) - (5)].TypeList);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004420 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004421 ;}
4422 break;
4423
Devang Pateld4980812008-09-02 20:52:40 +00004424 case 167:
4425#line 1503 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004426 { // Empty structure type?
4427 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004428 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004429 ;}
4430 break;
4431
Devang Pateld4980812008-09-02 20:52:40 +00004432 case 168:
4433#line 1510 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004434 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004435 // Allow but ignore attributes on function types; this permits auto-upgrade.
4436 // FIXME: remove in LLVM 3.0.
Dan Gohmanf4423b12008-04-19 00:24:39 +00004437 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4438 (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
4439 ;}
4440 break;
4441
Devang Pateld4980812008-09-02 20:52:40 +00004442 case 169:
4443#line 1519 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004444 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004445 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004446 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4447 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType() && !isa<StructType>((yyvsp[(1) - (1)].TypeVal)->get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004448 GEN_ERROR("LLVM functions cannot return aggregate types");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004449 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4450 ;}
4451 break;
4452
Devang Pateld4980812008-09-02 20:52:40 +00004453 case 170:
4454#line 1526 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004455 {
4456 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4457 ;}
4458 break;
4459
Devang Pateld4980812008-09-02 20:52:40 +00004460 case 171:
4461#line 1531 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004462 {
4463 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4464 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
Reid Spencer3da59db2006-11-27 01:05:10 +00004465 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004466 ;}
4467 break;
4468
Devang Pateld4980812008-09-02 20:52:40 +00004469 case 172:
4470#line 1536 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004471 {
4472 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004473 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004474 ;}
4475 break;
4476
Devang Pateld4980812008-09-02 20:52:40 +00004477 case 174:
4478#line 1544 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004479 {
4480 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
Reid Spencer18da0722007-04-11 02:44:20 +00004481 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
Reid Spencer41dff5e2007-01-26 08:05:27 +00004482 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004483 (yyval.TypeWithAttrsList)->push_back(TWA);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004484 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004485 ;}
4486 break;
4487
Devang Pateld4980812008-09-02 20:52:40 +00004488 case 175:
4489#line 1551 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004490 {
4491 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004492 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4493 TWA.Ty = new PATypeHolder(Type::VoidTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00004494 (yyval.TypeWithAttrsList)->push_back(TWA);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004495 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004496 ;}
4497 break;
4498
Devang Pateld4980812008-09-02 20:52:40 +00004499 case 176:
4500#line 1558 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004501 {
4502 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004503 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004504 ;}
4505 break;
4506
Devang Pateld4980812008-09-02 20:52:40 +00004507 case 177:
4508#line 1566 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004509 {
4510 (yyval.TypeList) = new std::list<PATypeHolder>();
4511 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4512 delete (yyvsp[(1) - (1)].TypeVal);
Reid Spencer3da59db2006-11-27 01:05:10 +00004513 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004514 ;}
4515 break;
4516
Devang Pateld4980812008-09-02 20:52:40 +00004517 case 178:
4518#line 1572 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004519 {
4520 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4521 delete (yyvsp[(3) - (3)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004522 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004523 ;}
4524 break;
4525
Devang Pateld4980812008-09-02 20:52:40 +00004526 case 179:
4527#line 1584 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004528 { // Nonempty unsized arr
Reid Spencer14310612006-12-31 05:40:51 +00004529 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004530 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4531 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004532 if (ATy == 0)
Reid Spencer61c83e02006-08-18 08:43:06 +00004533 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004534 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004535 const Type *ETy = ATy->getElementType();
Dan Gohman180c1692008-06-23 18:43:26 +00004536 uint64_t NumElements = ATy->getNumElements();
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004537
4538 // Verify that we have the correct size...
Mon P Wang28873102008-06-25 08:15:39 +00004539 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (4)].ConstVector)->size())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004540 GEN_ERROR("Type mismatch: constant sized array initialized with " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004541 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Mon P Wang28873102008-06-25 08:15:39 +00004542 utostr(NumElements) + "");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004543
4544 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004545 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4546 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004547 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4548 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohmanf4423b12008-04-19 00:24:39 +00004549 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004550 }
4551
Dan Gohmanf4423b12008-04-19 00:24:39 +00004552 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4553 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004554 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004555 ;}
4556 break;
4557
Devang Pateld4980812008-09-02 20:52:40 +00004558 case 180:
4559#line 1612 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004560 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004561 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004562 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4563 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004564 if (ATy == 0)
4565 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004566 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004567
Dan Gohman180c1692008-06-23 18:43:26 +00004568 uint64_t NumElements = ATy->getNumElements();
Mon P Wang28873102008-06-25 08:15:39 +00004569 if (NumElements != uint64_t(-1) && NumElements != 0)
Andrew Lenharth6353e052006-12-08 18:07:09 +00004570 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
Mon P Wang28873102008-06-25 08:15:39 +00004571 " arguments, but has size of " + utostr(NumElements) +"");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004572 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4573 delete (yyvsp[(1) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00004574 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004575 ;}
4576 break;
4577
Devang Pateld4980812008-09-02 20:52:40 +00004578 case 181:
4579#line 1628 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004580 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004581 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004582 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4583 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004584 if (ATy == 0)
4585 GEN_ERROR("Cannot make array constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004586 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004587
Dan Gohman180c1692008-06-23 18:43:26 +00004588 uint64_t NumElements = ATy->getNumElements();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004589 const Type *ETy = ATy->getElementType();
Mon P Wang28873102008-06-25 08:15:39 +00004590 if (NumElements != uint64_t(-1) && NumElements != (yyvsp[(3) - (3)].StrVal)->length())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004591 GEN_ERROR("Can't build string constant of size " +
Mon P Wang28873102008-06-25 08:15:39 +00004592 utostr((yyvsp[(3) - (3)].StrVal)->length()) +
4593 " when array has size " + utostr(NumElements) + "");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004594 std::vector<Constant*> Vals;
4595 if (ETy == Type::Int8Ty) {
Mon P Wang28873102008-06-25 08:15:39 +00004596 for (uint64_t i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
Dan Gohmanf4423b12008-04-19 00:24:39 +00004597 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004598 } else {
Dan Gohmanf4423b12008-04-19 00:24:39 +00004599 delete (yyvsp[(3) - (3)].StrVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004600 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4601 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004602 delete (yyvsp[(3) - (3)].StrVal);
4603 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4604 delete (yyvsp[(1) - (3)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004605 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004606 ;}
4607 break;
4608
Devang Pateld4980812008-09-02 20:52:40 +00004609 case 182:
4610#line 1655 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004611 { // Nonempty unsized arr
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004612 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004613 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4614 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004615 if (PTy == 0)
4616 GEN_ERROR("Cannot make packed constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004617 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004618 const Type *ETy = PTy->getElementType();
Dan Gohman180c1692008-06-23 18:43:26 +00004619 unsigned NumElements = PTy->getNumElements();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004620
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004621 // Verify that we have the correct size...
Mon P Wang28873102008-06-25 08:15:39 +00004622 if (NumElements != unsigned(-1) && NumElements != (unsigned)(yyvsp[(3) - (4)].ConstVector)->size())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004623 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004624 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Mon P Wang28873102008-06-25 08:15:39 +00004625 utostr(NumElements) + "");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004626
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004627 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004628 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4629 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004630 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4631 ETy->getDescription() +"' as required!\nIt is of type '"+
Dan Gohmanf4423b12008-04-19 00:24:39 +00004632 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004633 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00004634
Dan Gohmanf4423b12008-04-19 00:24:39 +00004635 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4636 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004637 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004638 ;}
4639 break;
4640
Devang Pateld4980812008-09-02 20:52:40 +00004641 case 183:
4642#line 1683 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004643 {
4644 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004645 if (STy == 0)
4646 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004647 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004648
Dan Gohmanf4423b12008-04-19 00:24:39 +00004649 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004650 GEN_ERROR("Illegal number of initializers for structure type");
4651
4652 // Check to ensure that constants are compatible with the type initializer!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004653 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4654 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004655 GEN_ERROR("Expected type '" +
4656 STy->getElementType(i)->getDescription() +
4657 "' for element #" + utostr(i) +
4658 " of structure initializer");
4659
4660 // Check to ensure that Type is not packed
4661 if (STy->isPacked())
4662 GEN_ERROR("Unpacked Initializer to vector type '" +
4663 STy->getDescription() + "'");
4664
Dan Gohmanf4423b12008-04-19 00:24:39 +00004665 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4666 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004667 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004668 ;}
4669 break;
4670
Devang Pateld4980812008-09-02 20:52:40 +00004671 case 184:
4672#line 1709 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004673 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004674 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004675 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4676 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004677 if (STy == 0)
4678 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004679 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004680
4681 if (STy->getNumContainedTypes() != 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00004682 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004683
4684 // Check to ensure that Type is not packed
4685 if (STy->isPacked())
Chris Lattner6cdc6822007-04-26 05:31:05 +00004686 GEN_ERROR("Unpacked Initializer to vector type '" +
4687 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004688
Dan Gohmanf4423b12008-04-19 00:24:39 +00004689 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4690 delete (yyvsp[(1) - (3)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004691 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004692 ;}
4693 break;
4694
Devang Pateld4980812008-09-02 20:52:40 +00004695 case 185:
4696#line 1729 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004697 {
4698 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004699 if (STy == 0)
4700 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004701 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004702
Dan Gohmanf4423b12008-04-19 00:24:39 +00004703 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
Reid Spencerb5334b02007-02-05 10:18:06 +00004704 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004705
4706 // Check to ensure that constants are compatible with the type initializer!
Dan Gohmanf4423b12008-04-19 00:24:39 +00004707 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4708 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
Reid Spencer41dff5e2007-01-26 08:05:27 +00004709 GEN_ERROR("Expected type '" +
4710 STy->getElementType(i)->getDescription() +
4711 "' for element #" + utostr(i) +
Reid Spencerb5334b02007-02-05 10:18:06 +00004712 " of structure initializer");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004713
4714 // Check to ensure that Type is packed
4715 if (!STy->isPacked())
Chris Lattner32980692007-02-19 07:44:24 +00004716 GEN_ERROR("Vector initializer to non-vector type '" +
4717 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004718
Dan Gohmanf4423b12008-04-19 00:24:39 +00004719 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4720 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004721 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004722 ;}
4723 break;
4724
Devang Pateld4980812008-09-02 20:52:40 +00004725 case 186:
4726#line 1755 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004727 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004728 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004729 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4730 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004731 if (STy == 0)
4732 GEN_ERROR("Cannot make struct constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004733 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004734
4735 if (STy->getNumContainedTypes() != 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00004736 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004737
4738 // Check to ensure that Type is packed
4739 if (!STy->isPacked())
Chris Lattner32980692007-02-19 07:44:24 +00004740 GEN_ERROR("Vector initializer to non-vector type '" +
4741 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004742
Dan Gohmanf4423b12008-04-19 00:24:39 +00004743 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4744 delete (yyvsp[(1) - (5)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004745 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004746 ;}
4747 break;
4748
Devang Pateld4980812008-09-02 20:52:40 +00004749 case 187:
4750#line 1775 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004751 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004752 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004753 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4754 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004755 if (PTy == 0)
4756 GEN_ERROR("Cannot make null pointer constant with type: '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004757 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004758
Dan Gohmanf4423b12008-04-19 00:24:39 +00004759 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4760 delete (yyvsp[(1) - (2)].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004761 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004762 ;}
4763 break;
4764
Devang Pateld4980812008-09-02 20:52:40 +00004765 case 188:
4766#line 1787 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004767 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004768 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004769 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4770 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4771 delete (yyvsp[(1) - (2)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004772 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004773 ;}
4774 break;
4775
Devang Pateld4980812008-09-02 20:52:40 +00004776 case 189:
4777#line 1794 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004778 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004779 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004780 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4781 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004782 if (Ty == 0)
Dan Gohmanf4423b12008-04-19 00:24:39 +00004783 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004784
4785 // ConstExprs can exist in the body of a function, thus creating
4786 // GlobalValues whenever they refer to a variable. Because we are in
Reid Spencer93c40032007-03-19 18:40:50 +00004787 // the context of a function, getExistingVal will search the functions
Reid Spencer68a24bd2005-08-27 18:50:39 +00004788 // symbol table instead of the module symbol table for the global symbol,
4789 // which throws things all off. To get around this, we just tell
Reid Spencer93c40032007-03-19 18:40:50 +00004790 // getExistingVal that we are at global scope here.
Reid Spencer68a24bd2005-08-27 18:50:39 +00004791 //
4792 Function *SavedCurFn = CurFun.CurrentFunction;
4793 CurFun.CurrentFunction = 0;
4794
Dan Gohmanf4423b12008-04-19 00:24:39 +00004795 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00004796 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00004797
4798 CurFun.CurrentFunction = SavedCurFn;
4799
4800 // If this is an initializer for a constant pointer, which is referencing a
4801 // (currently) undefined variable, create a stub now that shall be replaced
4802 // in the future with the right type of variable.
4803 //
4804 if (V == 0) {
Reid Spencera9720f52007-02-05 17:04:00 +00004805 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004806 const PointerType *PT = cast<PointerType>(Ty);
4807
4808 // First check to see if the forward references value is already created!
4809 PerModuleInfo::GlobalRefsType::iterator I =
Dan Gohmanf4423b12008-04-19 00:24:39 +00004810 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004811
4812 if (I != CurModule.GlobalRefs.end()) {
4813 V = I->second; // Placeholder already exists, use it...
Dan Gohmanf4423b12008-04-19 00:24:39 +00004814 (yyvsp[(2) - (2)].ValIDVal).destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +00004815 } else {
4816 std::string Name;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004817 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4818 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4819 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
Reid Spencer41dff5e2007-01-26 08:05:27 +00004820 GEN_ERROR("Invalid reference to global");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004821
4822 // Create the forward referenced global.
4823 GlobalValue *GV;
4824 if (const FunctionType *FTy =
4825 dyn_cast<FunctionType>(PT->getElementType())) {
Gabor Greife64d2482008-04-06 23:07:54 +00004826 GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
4827 CurModule.CurrentModule);
Reid Spencer68a24bd2005-08-27 18:50:39 +00004828 } else {
4829 GV = new GlobalVariable(PT->getElementType(), false,
Chris Lattner6cdc6822007-04-26 05:31:05 +00004830 GlobalValue::ExternalWeakLinkage, 0,
Reid Spencer68a24bd2005-08-27 18:50:39 +00004831 Name, CurModule.CurrentModule);
4832 }
4833
4834 // Keep track of the fact that we have a forward ref to recycle it
Dan Gohmanf4423b12008-04-19 00:24:39 +00004835 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004836 V = GV;
4837 }
4838 }
4839
Dan Gohmanf4423b12008-04-19 00:24:39 +00004840 (yyval.ConstVal) = cast<GlobalValue>(V);
4841 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
Reid Spencer61c83e02006-08-18 08:43:06 +00004842 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004843 ;}
4844 break;
4845
Devang Pateld4980812008-09-02 20:52:40 +00004846 case 190:
4847#line 1860 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004848 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004849 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004850 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4851 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004852 GEN_ERROR("Mismatched types for constant expression: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00004853 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4854 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4855 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004856 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004857 ;}
4858 break;
4859
Devang Pateld4980812008-09-02 20:52:40 +00004860 case 191:
4861#line 1870 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004862 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004863 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004864 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4865 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004866 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4867 GEN_ERROR("Cannot create a null initialized value of this type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004868 (yyval.ConstVal) = Constant::getNullValue(Ty);
4869 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004870 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004871 ;}
4872 break;
4873
Devang Pateld4980812008-09-02 20:52:40 +00004874 case 192:
4875#line 1880 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004876 { // integral constants
4877 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004878 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004879 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
Reid Spencer38c91a92007-02-28 02:24:54 +00004880 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004881 ;}
4882 break;
4883
Devang Pateld4980812008-09-02 20:52:40 +00004884 case 193:
4885#line 1886 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004886 { // arbitrary precision integer constants
4887 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4888 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004889 GEN_ERROR("Constant value does not fit in type");
4890 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004891 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4892 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4893 delete (yyvsp[(2) - (2)].APIntVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004894 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004895 ;}
4896 break;
4897
Devang Pateld4980812008-09-02 20:52:40 +00004898 case 194:
4899#line 1896 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004900 { // integral constants
4901 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004902 GEN_ERROR("Constant value doesn't fit in type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004903 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004904 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004905 ;}
4906 break;
4907
Devang Pateld4980812008-09-02 20:52:40 +00004908 case 195:
4909#line 1902 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004910 { // arbitrary precision integer constants
4911 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4912 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004913 GEN_ERROR("Constant value does not fit in type");
4914 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00004915 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4916 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4917 delete (yyvsp[(2) - (2)].APIntVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004918 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004919 ;}
4920 break;
4921
Devang Pateld4980812008-09-02 20:52:40 +00004922 case 196:
4923#line 1912 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004924 { // Boolean constants
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004925 if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1)
4926 GEN_ERROR("Constant true must have type i1");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004927 (yyval.ConstVal) = ConstantInt::getTrue();
Reid Spencer38c91a92007-02-28 02:24:54 +00004928 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004929 ;}
4930 break;
4931
Devang Pateld4980812008-09-02 20:52:40 +00004932 case 197:
4933#line 1918 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004934 { // Boolean constants
Dan Gohman81a0c0b2008-05-31 00:58:22 +00004935 if (cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() != 1)
4936 GEN_ERROR("Constant false must have type i1");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004937 (yyval.ConstVal) = ConstantInt::getFalse();
Reid Spencer6f407902007-01-13 05:00:46 +00004938 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004939 ;}
4940 break;
4941
Devang Pateld4980812008-09-02 20:52:40 +00004942 case 198:
4943#line 1924 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004944 { // Floating point constants
4945 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004946 GEN_ERROR("Floating point constant invalid for type");
Dale Johannesenc72cd7e2007-09-11 18:33:39 +00004947 // Lexer has no type info, so builds all float and double FP constants
4948 // as double. Fix this here. Long double is done right.
Dan Gohmanf4423b12008-04-19 00:24:39 +00004949 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4950 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
Chris Lattnerd8eb63f2008-04-20 00:41:19 +00004951 (yyval.ConstVal) = ConstantFP::get(*(yyvsp[(2) - (2)].FPVal));
Dan Gohmanf4423b12008-04-19 00:24:39 +00004952 delete (yyvsp[(2) - (2)].FPVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004953 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004954 ;}
4955 break;
4956
Devang Pateld4980812008-09-02 20:52:40 +00004957 case 199:
4958#line 1937 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004959 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004960 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00004961 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4962 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4963 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4964 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004965 GEN_ERROR("invalid cast opcode for cast from '" +
4966 Val->getType()->getDescription() + "' to '" +
4967 DestTy->getDescription() + "'");
Dan Gohmanf4423b12008-04-19 00:24:39 +00004968 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4969 delete (yyvsp[(5) - (6)].TypeVal);
4970 ;}
4971 break;
4972
Devang Pateld4980812008-09-02 20:52:40 +00004973 case 200:
4974#line 1949 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00004975 {
4976 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
Reid Spencerb5334b02007-02-05 10:18:06 +00004977 GEN_ERROR("GetElementPtr requires a pointer operand");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004978
4979 const Type *IdxTy =
Dan Gohman041e2eb2008-05-15 19:50:34 +00004980 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004981 if (!IdxTy)
Reid Spencerb5334b02007-02-05 10:18:06 +00004982 GEN_ERROR("Index list invalid for constant getelementptr");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004983
Chris Lattnerf7469af2007-01-31 04:44:08 +00004984 SmallVector<Constant*, 8> IdxVec;
Dan Gohmanf4423b12008-04-19 00:24:39 +00004985 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4986 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004987 IdxVec.push_back(C);
4988 else
Reid Spencerb5334b02007-02-05 10:18:06 +00004989 GEN_ERROR("Indices to constant getelementptr must be constants");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004990
Dan Gohmanf4423b12008-04-19 00:24:39 +00004991 delete (yyvsp[(4) - (5)].ValueList);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004992
Dan Gohmanf4423b12008-04-19 00:24:39 +00004993 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
Andrew Lenharth6353e052006-12-08 18:07:09 +00004994 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00004995 ;}
4996 break;
4997
Devang Pateld4980812008-09-02 20:52:40 +00004998 case 201:
4999#line 1970 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005000 {
5001 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005002 GEN_ERROR("Select condition must be of boolean type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005003 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005004 GEN_ERROR("Select operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005005 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005006 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005007 ;}
5008 break;
5009
Devang Pateld4980812008-09-02 20:52:40 +00005010 case 202:
5011#line 1978 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005012 {
5013 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005014 GEN_ERROR("Binary operator types must match");
5015 CHECK_FOR_ERROR;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005016 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
5017 ;}
5018 break;
5019
Devang Pateld4980812008-09-02 20:52:40 +00005020 case 203:
5021#line 1984 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005022 {
5023 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005024 GEN_ERROR("Logical operator types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005025 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
Nate Begeman5bc1ea02008-07-29 15:49:41 +00005026 if (!isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
Dan Gohmanf4423b12008-04-19 00:24:39 +00005027 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005028 GEN_ERROR("Logical operator requires integral operands");
5029 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00005030 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005031 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005032 ;}
5033 break;
5034
Devang Pateld4980812008-09-02 20:52:40 +00005035 case 204:
5036#line 1995 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005037 {
5038 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005039 GEN_ERROR("icmp operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005040 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5041 ;}
5042 break;
5043
Devang Pateld4980812008-09-02 20:52:40 +00005044 case 205:
5045#line 2000 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005046 {
5047 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005048 GEN_ERROR("fcmp operand types must match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005049 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5050 ;}
5051 break;
5052
Devang Pateld4980812008-09-02 20:52:40 +00005053 case 206:
5054#line 2005 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00005055 {
5056 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5057 GEN_ERROR("vicmp operand types must match");
5058 (yyval.ConstVal) = ConstantExpr::getVICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5059 ;}
5060 break;
5061
Devang Pateld4980812008-09-02 20:52:40 +00005062 case 207:
5063#line 2010 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00005064 {
5065 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
5066 GEN_ERROR("vfcmp operand types must match");
5067 (yyval.ConstVal) = ConstantExpr::getVFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
5068 ;}
5069 break;
5070
Devang Pateld4980812008-09-02 20:52:40 +00005071 case 208:
5072#line 2015 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005073 {
5074 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005075 GEN_ERROR("Invalid extractelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005076 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00005077 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005078 ;}
5079 break;
5080
Devang Pateld4980812008-09-02 20:52:40 +00005081 case 209:
5082#line 2021 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005083 {
5084 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005085 GEN_ERROR("Invalid insertelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005086 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00005087 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005088 ;}
5089 break;
5090
Devang Pateld4980812008-09-02 20:52:40 +00005091 case 210:
5092#line 2027 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005093 {
5094 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005095 GEN_ERROR("Invalid shufflevector operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005096 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00005097 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005098 ;}
5099 break;
5100
Devang Pateld4980812008-09-02 20:52:40 +00005101 case 211:
5102#line 2033 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005103 {
5104 if (!isa<StructType>((yyvsp[(3) - (5)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (5)].ConstVal)->getType()))
5105 GEN_ERROR("ExtractValue requires an aggregate operand");
5106
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005107 (yyval.ConstVal) = ConstantExpr::getExtractValue((yyvsp[(3) - (5)].ConstVal), &(*(yyvsp[(4) - (5)].ConstantList))[0], (yyvsp[(4) - (5)].ConstantList)->size());
5108 delete (yyvsp[(4) - (5)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00005109 CHECK_FOR_ERROR
5110 ;}
5111 break;
5112
Devang Pateld4980812008-09-02 20:52:40 +00005113 case 212:
5114#line 2041 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005115 {
5116 if (!isa<StructType>((yyvsp[(3) - (7)].ConstVal)->getType()) && !isa<ArrayType>((yyvsp[(3) - (7)].ConstVal)->getType()))
5117 GEN_ERROR("InsertValue requires an aggregate operand");
5118
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005119 (yyval.ConstVal) = ConstantExpr::getInsertValue((yyvsp[(3) - (7)].ConstVal), (yyvsp[(5) - (7)].ConstVal), &(*(yyvsp[(6) - (7)].ConstantList))[0], (yyvsp[(6) - (7)].ConstantList)->size());
5120 delete (yyvsp[(6) - (7)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00005121 CHECK_FOR_ERROR
5122 ;}
5123 break;
5124
Devang Pateld4980812008-09-02 20:52:40 +00005125 case 213:
5126#line 2052 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005127 {
5128 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005129 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005130 ;}
5131 break;
5132
Devang Pateld4980812008-09-02 20:52:40 +00005133 case 214:
5134#line 2056 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005135 {
5136 (yyval.ConstVector) = new std::vector<Constant*>();
5137 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005138 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005139 ;}
5140 break;
5141
Devang Pateld4980812008-09-02 20:52:40 +00005142 case 215:
5143#line 2064 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00005144 { (yyval.BoolVal) = false; ;}
Nate Begemanac80ade2008-05-12 19:01:56 +00005145 break;
5146
Devang Pateld4980812008-09-02 20:52:40 +00005147 case 216:
5148#line 2064 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005149 { (yyval.BoolVal) = true; ;}
Dan Gohmane4977cf2008-05-23 01:55:30 +00005150 break;
5151
Devang Pateld4980812008-09-02 20:52:40 +00005152 case 217:
5153#line 2067 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00005154 { (yyval.BoolVal) = true; ;}
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005155 break;
5156
Devang Pateld4980812008-09-02 20:52:40 +00005157 case 218:
5158#line 2067 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00005159 { (yyval.BoolVal) = false; ;}
5160 break;
5161
Devang Pateld4980812008-09-02 20:52:40 +00005162 case 219:
5163#line 2070 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005164 {
5165 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
5166 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
Chris Lattner0275cff2007-08-06 21:00:46 +00005167 CHECK_FOR_ERROR
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005168 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
5169 if (!Aliasee)
5170 GEN_ERROR("Aliases can be created only to global values");
5171
Dan Gohmanf4423b12008-04-19 00:24:39 +00005172 (yyval.ConstVal) = Aliasee;
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005173 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005174 delete (yyvsp[(1) - (2)].TypeVal);
5175 ;}
5176 break;
5177
Devang Pateld4980812008-09-02 20:52:40 +00005178 case 220:
5179#line 2082 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005180 {
5181 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
5182 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
5183 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005184 GEN_ERROR("invalid cast opcode for cast from '" +
5185 Val->getType()->getDescription() + "' to '" +
5186 DestTy->getDescription() + "'");
5187
Dan Gohmanf4423b12008-04-19 00:24:39 +00005188 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005189 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005190 delete (yyvsp[(5) - (6)].TypeVal);
5191 ;}
5192 break;
5193
Devang Pateld4980812008-09-02 20:52:40 +00005194 case 221:
5195#line 2103 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005196 {
5197 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5198 CurModule.ModuleDone();
5199 CHECK_FOR_ERROR;
5200 ;}
Dale Johannesenc7071cc2008-05-14 20:13:36 +00005201 break;
5202
Devang Pateld4980812008-09-02 20:52:40 +00005203 case 222:
5204#line 2108 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00005205 {
5206 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
5207 CurModule.ModuleDone();
5208 CHECK_FOR_ERROR;
5209 ;}
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005210 break;
5211
Devang Pateld4980812008-09-02 20:52:40 +00005212 case 225:
5213#line 2121 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00005214 { CurFun.isDeclare = false; ;}
5215 break;
5216
Devang Pateld4980812008-09-02 20:52:40 +00005217 case 226:
5218#line 2121 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005219 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005220 CurFun.FunctionDone();
5221 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005222 ;}
5223 break;
5224
Devang Pateld4980812008-09-02 20:52:40 +00005225 case 227:
5226#line 2125 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005227 { CurFun.isDeclare = true; ;}
5228 break;
5229
Devang Pateld4980812008-09-02 20:52:40 +00005230 case 228:
5231#line 2125 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dale Johannesen20ab78b2008-08-13 18:41:46 +00005232 {
5233 CHECK_FOR_ERROR
5234 ;}
5235 break;
5236
Devang Pateld4980812008-09-02 20:52:40 +00005237 case 229:
5238#line 2128 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00005239 {
5240 CHECK_FOR_ERROR
5241 ;}
5242 break;
5243
Devang Pateld4980812008-09-02 20:52:40 +00005244 case 230:
5245#line 2131 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005246 {
Reid Spencer14310612006-12-31 05:40:51 +00005247 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005248 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005249 // Eagerly resolve types. This is not an optimization, this is a
5250 // requirement that is due to the fact that we could have this:
5251 //
5252 // %list = type { %list * }
5253 // %list = type { %list * } ; repeated type decl
5254 //
5255 // If types are not resolved eagerly, then the two types will not be
5256 // determined to be the same type!
5257 //
Dan Gohmanf4423b12008-04-19 00:24:39 +00005258 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005259
Dan Gohmanf4423b12008-04-19 00:24:39 +00005260 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Reid Spencer5b7e7532006-09-28 19:28:24 +00005261 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005262 // If this is a named type that is not a redefinition, add it to the slot
5263 // table.
Dan Gohmanf4423b12008-04-19 00:24:39 +00005264 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005265 }
Reid Spencera132e042006-12-03 05:46:11 +00005266
Dan Gohmanf4423b12008-04-19 00:24:39 +00005267 delete (yyvsp[(3) - (3)].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005268 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005269 ;}
5270 break;
Reid Spencerb8f85052007-07-31 03:50:36 +00005271
Devang Pateld4980812008-09-02 20:52:40 +00005272 case 231:
5273#line 2155 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005274 {
5275 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
5276
5277 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005278 CHECK_FOR_ERROR
5279 // If this is a named type that is not a redefinition, add it to the slot
5280 // table.
Dan Gohmanf4423b12008-04-19 00:24:39 +00005281 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005282 }
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005283 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005284 ;}
5285 break;
5286
Devang Pateld4980812008-09-02 20:52:40 +00005287 case 232:
5288#line 2167 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005289 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005290 /* "Externally Visible" Linkage */
Dan Gohmanf4423b12008-04-19 00:24:39 +00005291 if ((yyvsp[(5) - (6)].ConstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005292 GEN_ERROR("Global value initializer is not a constant");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005293 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
5294 (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 +00005295 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005296 ;}
5297 break;
5298
Devang Pateld4980812008-09-02 20:52:40 +00005299 case 233:
5300#line 2174 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005301 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005302 CurGV = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005303 ;}
5304 break;
5305
Devang Pateld4980812008-09-02 20:52:40 +00005306 case 234:
5307#line 2178 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005308 {
5309 if ((yyvsp[(6) - (7)].ConstVal) == 0)
Christopher Lambbf3348d2007-12-12 08:45:45 +00005310 GEN_ERROR("Global value initializer is not a constant");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005311 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 +00005312 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005313 ;}
5314 break;
5315
Devang Pateld4980812008-09-02 20:52:40 +00005316 case 235:
5317#line 2183 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005318 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005319 CurGV = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005320 ;}
5321 break;
5322
Devang Pateld4980812008-09-02 20:52:40 +00005323 case 236:
5324#line 2187 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005325 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005326 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005327 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5328 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 +00005329 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005330 delete (yyvsp[(6) - (7)].TypeVal);
5331 ;}
5332 break;
5333
Devang Pateld4980812008-09-02 20:52:40 +00005334 case 237:
5335#line 2193 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005336 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005337 CurGV = 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +00005338 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005339 ;}
5340 break;
5341
Devang Pateld4980812008-09-02 20:52:40 +00005342 case 238:
5343#line 2197 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005344 {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005345 std::string Name;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005346 if ((yyvsp[(1) - (5)].StrVal)) {
5347 Name = *(yyvsp[(1) - (5)].StrVal);
5348 delete (yyvsp[(1) - (5)].StrVal);
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005349 }
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005350 if (Name.empty())
5351 GEN_ERROR("Alias name cannot be empty");
5352
Dan Gohmanf4423b12008-04-19 00:24:39 +00005353 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005354 if (Aliasee == 0)
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005355 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005356
Dan Gohmanf4423b12008-04-19 00:24:39 +00005357 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005358 CurModule.CurrentModule);
Dan Gohmanf4423b12008-04-19 00:24:39 +00005359 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005360 InsertValue(GA, CurModule.Values);
Chris Lattner569f7372007-09-10 23:24:14 +00005361
5362
5363 // If there was a forward reference of this alias, resolve it now.
5364
5365 ValID ID;
5366 if (!Name.empty())
5367 ID = ValID::createGlobalName(Name);
5368 else
5369 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5370
5371 if (GlobalValue *FWGV =
5372 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5373 // Replace uses of the fwdref with the actual alias.
5374 FWGV->replaceAllUsesWith(GA);
5375 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5376 GV->eraseFromParent();
5377 else
5378 cast<Function>(FWGV)->eraseFromParent();
5379 }
5380 ID.destroy();
5381
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005382 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005383 ;}
5384 break;
5385
Devang Pateld4980812008-09-02 20:52:40 +00005386 case 239:
5387#line 2237 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005388 {
Anton Korobeynikov77d0f972007-04-25 14:29:12 +00005389 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005390 ;}
5391 break;
5392
Devang Pateld4980812008-09-02 20:52:40 +00005393 case 240:
5394#line 2240 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005395 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005396 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005397 ;}
5398 break;
5399
Devang Pateld4980812008-09-02 20:52:40 +00005400 case 241:
5401#line 2246 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005402 {
Chris Lattner66316012006-01-24 04:14:29 +00005403 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
Chris Lattner66316012006-01-24 04:14:29 +00005404 if (AsmSoFar.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005405 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
Chris Lattner66316012006-01-24 04:14:29 +00005406 else
Dan Gohmanf4423b12008-04-19 00:24:39 +00005407 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5408 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00005409 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005410;}
5411 break;
5412
Devang Pateld4980812008-09-02 20:52:40 +00005413 case 242:
5414#line 2256 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005415 {
5416 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5417 delete (yyvsp[(3) - (3)].StrVal);
5418 ;}
5419 break;
5420
Devang Pateld4980812008-09-02 20:52:40 +00005421 case 243:
5422#line 2260 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005423 {
5424 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5425 delete (yyvsp[(3) - (3)].StrVal);
5426 ;}
5427 break;
5428
Devang Pateld4980812008-09-02 20:52:40 +00005429 case 245:
5430#line 2267 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005431 {
5432 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5433 delete (yyvsp[(3) - (3)].StrVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00005434 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005435 ;}
5436 break;
5437
Devang Pateld4980812008-09-02 20:52:40 +00005438 case 246:
5439#line 2272 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005440 {
5441 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5442 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer1013b4d2007-07-31 14:41:17 +00005443 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005444 ;}
5445 break;
5446
Devang Pateld4980812008-09-02 20:52:40 +00005447 case 247:
5448#line 2277 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005449 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005450 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005451 ;}
5452 break;
5453
Devang Pateld4980812008-09-02 20:52:40 +00005454 case 248:
5455#line 2286 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005456 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005457 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005458 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005459 if (!(*(yyvsp[(3) - (5)].TypeVal))->isFirstClassType())
5460 GEN_ERROR("Argument types must be first-class");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005461 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5462 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5463 (yyvsp[(1) - (5)].ArgList)->push_back(E);
Reid Spencer6f407902007-01-13 05:00:46 +00005464 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005465 ;}
5466 break;
5467
Devang Pateld4980812008-09-02 20:52:40 +00005468 case 249:
5469#line 2296 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005470 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005471 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005472 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005473 if (!(*(yyvsp[(1) - (3)].TypeVal))->isFirstClassType())
5474 GEN_ERROR("Argument types must be first-class");
Dan Gohmanf4423b12008-04-19 00:24:39 +00005475 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5476 (yyval.ArgList) = new ArgListType;
5477 (yyval.ArgList)->push_back(E);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005478 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005479 ;}
5480 break;
5481
Devang Pateld4980812008-09-02 20:52:40 +00005482 case 250:
5483#line 2307 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005484 {
5485 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005486 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005487 ;}
5488 break;
5489
Devang Pateld4980812008-09-02 20:52:40 +00005490 case 251:
5491#line 2311 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005492 {
5493 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005494 struct ArgListEntry E;
5495 E.Ty = new PATypeHolder(Type::VoidTy);
5496 E.Name = 0;
Reid Spencer18da0722007-04-11 02:44:20 +00005497 E.Attrs = ParamAttr::None;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005498 (yyval.ArgList)->push_back(E);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005499 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005500 ;}
5501 break;
5502
Devang Pateld4980812008-09-02 20:52:40 +00005503 case 252:
5504#line 2320 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005505 {
5506 (yyval.ArgList) = new ArgListType;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005507 struct ArgListEntry E;
5508 E.Ty = new PATypeHolder(Type::VoidTy);
5509 E.Name = 0;
5510 E.Attrs = ParamAttr::None;
Dan Gohmanf4423b12008-04-19 00:24:39 +00005511 (yyval.ArgList)->push_back(E);
Reid Spencer61c83e02006-08-18 08:43:06 +00005512 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005513 ;}
5514 break;
5515
Devang Pateld4980812008-09-02 20:52:40 +00005516 case 253:
5517#line 2329 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005518 {
5519 (yyval.ArgList) = 0;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005520 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005521 ;}
5522 break;
5523
Devang Pateld4980812008-09-02 20:52:40 +00005524 case 254:
5525#line 2335 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005526 {
Devang Pateld4980812008-09-02 20:52:40 +00005527 std::string FunctionName(*(yyvsp[(3) - (11)].StrVal));
5528 delete (yyvsp[(3) - (11)].StrVal); // Free strdup'd memory!
Reid Spencer68a24bd2005-08-27 18:50:39 +00005529
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005530 // Check the function result for abstractness if this is a define. We should
5531 // have no abstract types at this point
Devang Pateld4980812008-09-02 20:52:40 +00005532 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (11)].TypeVal)))
5533 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (11)].TypeVal)->get()->getDescription());
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005534
Devang Pateld4980812008-09-02 20:52:40 +00005535 if (!FunctionType::isValidReturnType(*(yyvsp[(2) - (11)].TypeVal)))
Chris Lattnera925a142008-04-23 05:37:08 +00005536 GEN_ERROR("Invalid result type for LLVM function");
5537
Reid Spencer68a24bd2005-08-27 18:50:39 +00005538 std::vector<const Type*> ParamTypeList;
Chris Lattner58d74912008-03-12 17:45:29 +00005539 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Devang Pateld4980812008-09-02 20:52:40 +00005540 if ((yyvsp[(7) - (11)].ParamAttrs) != ParamAttr::None)
5541 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(7) - (11)].ParamAttrs)));
5542 if ((yyvsp[(5) - (11)].ArgList)) { // If there are arguments...
Reid Spencer7b5d4662007-04-09 06:16:21 +00005543 unsigned index = 1;
Devang Pateld4980812008-09-02 20:52:40 +00005544 for (ArgListType::iterator I = (yyvsp[(5) - (11)].ArgList)->begin(); I != (yyvsp[(5) - (11)].ArgList)->end(); ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00005545 const Type* Ty = I->Ty->get();
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005546 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5547 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
Reid Spencer14310612006-12-31 05:40:51 +00005548 ParamTypeList.push_back(Ty);
Chris Lattner58d74912008-03-12 17:45:29 +00005549 if (Ty != Type::VoidTy && I->Attrs != ParamAttr::None)
5550 Attrs.push_back(ParamAttrsWithIndex::get(index, I->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00005551 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005552 }
5553
5554 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5555 if (isVarArg) ParamTypeList.pop_back();
5556
Chris Lattner58d74912008-03-12 17:45:29 +00005557 PAListPtr PAL;
Christopher Lamb5c104242007-04-22 20:09:11 +00005558 if (!Attrs.empty())
Chris Lattner58d74912008-03-12 17:45:29 +00005559 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Reid Spencer7b5d4662007-04-09 06:16:21 +00005560
Devang Pateld4980812008-09-02 20:52:40 +00005561 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (11)].TypeVal), ParamTypeList, isVarArg);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00005562 const PointerType *PFT = PointerType::getUnqual(FT);
Devang Pateld4980812008-09-02 20:52:40 +00005563 delete (yyvsp[(2) - (11)].TypeVal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005564
5565 ValID ID;
5566 if (!FunctionName.empty()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005567 ID = ValID::createGlobalName((char*)FunctionName.c_str());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005568 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00005569 ID = ValID::createGlobalID(CurModule.Values.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005570 }
5571
5572 Function *Fn = 0;
5573 // See if this function was forward referenced. If so, recycle the object.
5574 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5575 // Move the function to the end of the list, from whereever it was
5576 // previously inserted.
5577 Fn = cast<Function>(FWRef);
Chris Lattner58d74912008-03-12 17:45:29 +00005578 assert(Fn->getParamAttrs().isEmpty() &&
5579 "Forward reference has parameter attributes!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005580 CurModule.CurrentModule->getFunctionList().remove(Fn);
5581 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5582 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
Reid Spenceref9b9a72007-02-05 20:47:22 +00005583 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
Duncan Sandsdc024672007-11-27 13:23:08 +00005584 if (Fn->getFunctionType() != FT ) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00005585 // The existing function doesn't have the same type. This is an overload
5586 // error.
5587 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Duncan Sandsdc024672007-11-27 13:23:08 +00005588 } else if (Fn->getParamAttrs() != PAL) {
5589 // The existing function doesn't have the same parameter attributes.
5590 // This is an overload error.
5591 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Reid Spenceref9b9a72007-02-05 20:47:22 +00005592 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
Chris Lattner6cdc6822007-04-26 05:31:05 +00005593 // Neither the existing or the current function is a declaration and they
5594 // have the same name and same type. Clearly this is a redefinition.
5595 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
Duncan Sandsdc024672007-11-27 13:23:08 +00005596 } else if (Fn->isDeclaration()) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00005597 // Make sure to strip off any argument names so we can't get conflicts.
Reid Spencer68a24bd2005-08-27 18:50:39 +00005598 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5599 AI != AE; ++AI)
5600 AI->setName("");
Reid Spenceref9b9a72007-02-05 20:47:22 +00005601 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005602 } else { // Not already defined?
Gabor Greife64d2482008-04-06 23:07:54 +00005603 Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
5604 CurModule.CurrentModule);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005605 InsertValue(Fn, CurModule.Values);
5606 }
5607
5608 CurFun.FunctionStart(Fn);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00005609
5610 if (CurFun.isDeclare) {
5611 // If we have declaration, always overwrite linkage. This will allow us to
5612 // correctly handle cases, when pointer to function is passed as argument to
5613 // another function.
5614 Fn->setLinkage(CurFun.Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005615 Fn->setVisibility(CurFun.Visibility);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00005616 }
Devang Pateld4980812008-09-02 20:52:40 +00005617 Fn->setCallingConv((yyvsp[(1) - (11)].UIntVal));
Duncan Sandsdc024672007-11-27 13:23:08 +00005618 Fn->setParamAttrs(PAL);
Devang Pateld4980812008-09-02 20:52:40 +00005619 Fn->setAlignment((yyvsp[(9) - (11)].UIntVal));
5620 if ((yyvsp[(8) - (11)].StrVal)) {
5621 Fn->setSection(*(yyvsp[(8) - (11)].StrVal));
5622 delete (yyvsp[(8) - (11)].StrVal);
Gordon Henriksen80a75bf2007-12-10 03:18:06 +00005623 }
Devang Pateld4980812008-09-02 20:52:40 +00005624 if ((yyvsp[(10) - (11)].StrVal)) {
5625 Fn->setGC((yyvsp[(10) - (11)].StrVal)->c_str());
5626 delete (yyvsp[(10) - (11)].StrVal);
5627 }
5628 if ((yyvsp[(11) - (11)].FunctionNotes)) {
5629 Fn->setNotes((yyvsp[(11) - (11)].FunctionNotes));
Chris Lattnere869eef2005-11-12 00:11:49 +00005630 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005631
5632 // Add all of the arguments we parsed to the function...
Devang Pateld4980812008-09-02 20:52:40 +00005633 if ((yyvsp[(5) - (11)].ArgList)) { // Is null if empty...
Reid Spencer68a24bd2005-08-27 18:50:39 +00005634 if (isVarArg) { // Nuke the last entry
Devang Pateld4980812008-09-02 20:52:40 +00005635 assert((yyvsp[(5) - (11)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (11)].ArgList)->back().Name == 0 &&
Reid Spencera9720f52007-02-05 17:04:00 +00005636 "Not a varargs marker!");
Devang Pateld4980812008-09-02 20:52:40 +00005637 delete (yyvsp[(5) - (11)].ArgList)->back().Ty;
5638 (yyvsp[(5) - (11)].ArgList)->pop_back(); // Delete the last entry
Reid Spencer68a24bd2005-08-27 18:50:39 +00005639 }
5640 Function::arg_iterator ArgIt = Fn->arg_begin();
Reid Spenceref9b9a72007-02-05 20:47:22 +00005641 Function::arg_iterator ArgEnd = Fn->arg_end();
Reid Spencer14310612006-12-31 05:40:51 +00005642 unsigned Idx = 1;
Devang Pateld4980812008-09-02 20:52:40 +00005643 for (ArgListType::iterator I = (yyvsp[(5) - (11)].ArgList)->begin();
5644 I != (yyvsp[(5) - (11)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
Reid Spencer14310612006-12-31 05:40:51 +00005645 delete I->Ty; // Delete the typeholder...
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005646 setValueName(ArgIt, I->Name); // Insert arg into symtab...
Reid Spencer5b7e7532006-09-28 19:28:24 +00005647 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005648 InsertValue(ArgIt);
Reid Spencer14310612006-12-31 05:40:51 +00005649 Idx++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005650 }
Reid Spencera132e042006-12-03 05:46:11 +00005651
Devang Pateld4980812008-09-02 20:52:40 +00005652 delete (yyvsp[(5) - (11)].ArgList); // We're now done with the argument list
Reid Spencer68a24bd2005-08-27 18:50:39 +00005653 }
Reid Spencer61c83e02006-08-18 08:43:06 +00005654 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005655;}
5656 break;
5657
Devang Pateld4980812008-09-02 20:52:40 +00005658 case 257:
5659#line 2468 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005660 {
5661 (yyval.FunctionVal) = CurFun.CurrentFunction;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005662
5663 // Make sure that we keep track of the linkage type even if there was a
5664 // previous "declare".
Dan Gohmanf4423b12008-04-19 00:24:39 +00005665 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5666 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5667;}
5668 break;
5669
Devang Pateld4980812008-09-02 20:52:40 +00005670 case 260:
5671#line 2479 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005672 {
5673 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005674 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005675;}
5676 break;
5677
Devang Pateld4980812008-09-02 20:52:40 +00005678 case 261:
5679#line 2484 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005680 {
5681 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5682 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5683 (yyval.FunctionVal) = CurFun.CurrentFunction;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005684 CurFun.FunctionDone();
Reid Spencer41dff5e2007-01-26 08:05:27 +00005685 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005686 ;}
5687 break;
5688
Devang Pateld4980812008-09-02 20:52:40 +00005689 case 262:
5690#line 2496 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005691 {
5692 (yyval.BoolVal) = false;
Reid Spencer61c83e02006-08-18 08:43:06 +00005693 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005694 ;}
5695 break;
5696
Devang Pateld4980812008-09-02 20:52:40 +00005697 case 263:
5698#line 2500 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005699 {
5700 (yyval.BoolVal) = true;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005701 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005702 ;}
5703 break;
5704
Devang Pateld4980812008-09-02 20:52:40 +00005705 case 264:
5706#line 2505 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005707 { // A reference to a direct constant
5708 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005709 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005710 ;}
5711 break;
5712
Devang Pateld4980812008-09-02 20:52:40 +00005713 case 265:
5714#line 2509 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005715 {
5716 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005717 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005718 ;}
5719 break;
5720
Devang Pateld4980812008-09-02 20:52:40 +00005721 case 266:
5722#line 2513 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner1913b942008-07-11 00:30:39 +00005723 { // arbitrary precision integer constants
5724 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), true);
5725 delete (yyvsp[(1) - (1)].APIntVal);
5726 CHECK_FOR_ERROR
5727 ;}
5728 break;
5729
Devang Pateld4980812008-09-02 20:52:40 +00005730 case 267:
5731#line 2518 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner1913b942008-07-11 00:30:39 +00005732 { // arbitrary precision integer constants
5733 (yyval.ValIDVal) = ValID::create(*(yyvsp[(1) - (1)].APIntVal), false);
5734 delete (yyvsp[(1) - (1)].APIntVal);
5735 CHECK_FOR_ERROR
5736 ;}
5737 break;
5738
Devang Pateld4980812008-09-02 20:52:40 +00005739 case 268:
5740#line 2523 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005741 { // Perhaps it's an FP constant?
5742 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00005743 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005744 ;}
5745 break;
5746
Devang Pateld4980812008-09-02 20:52:40 +00005747 case 269:
5748#line 2527 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005749 {
5750 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
Reid Spencere4d87aa2006-12-23 06:05:41 +00005751 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005752 ;}
5753 break;
5754
Devang Pateld4980812008-09-02 20:52:40 +00005755 case 270:
5756#line 2531 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005757 {
5758 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00005759 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005760 ;}
5761 break;
5762
Devang Pateld4980812008-09-02 20:52:40 +00005763 case 271:
5764#line 2535 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005765 {
5766 (yyval.ValIDVal) = ValID::createNull();
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00005767 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005768 ;}
5769 break;
5770
Devang Pateld4980812008-09-02 20:52:40 +00005771 case 272:
5772#line 2539 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005773 {
5774 (yyval.ValIDVal) = ValID::createUndef();
Reid Spencer61c83e02006-08-18 08:43:06 +00005775 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005776 ;}
5777 break;
5778
Devang Pateld4980812008-09-02 20:52:40 +00005779 case 273:
5780#line 2543 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005781 { // A vector zero constant.
5782 (yyval.ValIDVal) = ValID::createZeroInit();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005783 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005784 ;}
5785 break;
5786
Devang Pateld4980812008-09-02 20:52:40 +00005787 case 274:
5788#line 2547 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005789 { // Nonempty unsized packed vector
5790 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
Dan Gohman180c1692008-06-23 18:43:26 +00005791 unsigned NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohman81a0c0b2008-05-31 00:58:22 +00005792
5793 if (!ETy->isInteger() && !ETy->isFloatingPoint())
5794 GEN_ERROR("Invalid vector element type: " + ETy->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005795
Reid Spencer9d6565a2007-02-15 02:26:10 +00005796 VectorType* pt = VectorType::get(ETy, NumElements);
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005797 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(pt));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005798
5799 // Verify all elements are correct type!
Dan Gohmanf4423b12008-04-19 00:24:39 +00005800 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5801 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Reid Spencer61c83e02006-08-18 08:43:06 +00005802 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +00005803 ETy->getDescription() +"' as required!\nIt is of type '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00005804 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005805 }
5806
Dan Gohmanf4423b12008-04-19 00:24:39 +00005807 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5808 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
Reid Spencer832254e2007-02-02 02:16:23 +00005809 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005810 ;}
5811 break;
5812
Devang Pateld4980812008-09-02 20:52:40 +00005813 case 275:
5814#line 2569 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005815 { // Nonempty unsized arr
5816 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
Dan Gohman180c1692008-06-23 18:43:26 +00005817 uint64_t NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005818
5819 if (!ETy->isFirstClassType())
5820 GEN_ERROR("Invalid array element type: " + ETy->getDescription());
5821
5822 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5823 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(ATy));
5824
5825 // Verify all elements are correct type!
5826 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5827 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
5828 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
5829 ETy->getDescription() +"' as required!\nIt is of type '"+
5830 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
5831 }
5832
5833 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, *(yyvsp[(2) - (3)].ConstVector)));
5834 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5835 CHECK_FOR_ERROR
5836 ;}
5837 break;
5838
Devang Pateld4980812008-09-02 20:52:40 +00005839 case 276:
5840#line 2591 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005841 {
Dan Gohman180c1692008-06-23 18:43:26 +00005842 // Use undef instead of an array because it's inconvenient to determine
5843 // the element type at this point, there being no elements to examine.
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005844 (yyval.ValIDVal) = ValID::createUndef();
5845 CHECK_FOR_ERROR
5846 ;}
5847 break;
5848
Devang Pateld4980812008-09-02 20:52:40 +00005849 case 277:
5850#line 2597 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005851 {
Dan Gohman180c1692008-06-23 18:43:26 +00005852 uint64_t NumElements = (yyvsp[(2) - (2)].StrVal)->length();
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005853 const Type *ETy = Type::Int8Ty;
5854
5855 ArrayType *ATy = ArrayType::get(ETy, NumElements);
5856
5857 std::vector<Constant*> Vals;
5858 for (unsigned i = 0; i < (yyvsp[(2) - (2)].StrVal)->length(); ++i)
5859 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(2) - (2)].StrVal))[i]));
5860 delete (yyvsp[(2) - (2)].StrVal);
5861 (yyval.ValIDVal) = ValID::create(ConstantArray::get(ATy, Vals));
5862 CHECK_FOR_ERROR
5863 ;}
5864 break;
5865
Devang Pateld4980812008-09-02 20:52:40 +00005866 case 278:
5867#line 2610 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005868 {
5869 std::vector<const Type*> Elements((yyvsp[(2) - (3)].ConstVector)->size());
5870 for (unsigned i = 0, e = (yyvsp[(2) - (3)].ConstVector)->size(); i != e; ++i)
5871 Elements[i] = (*(yyvsp[(2) - (3)].ConstVector))[i]->getType();
5872
5873 const StructType *STy = StructType::get(Elements);
5874 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5875
5876 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(2) - (3)].ConstVector)));
5877 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
5878 CHECK_FOR_ERROR
5879 ;}
5880 break;
5881
Devang Pateld4980812008-09-02 20:52:40 +00005882 case 279:
5883#line 2622 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005884 {
5885 const StructType *STy = StructType::get(std::vector<const Type*>());
5886 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5887 CHECK_FOR_ERROR
5888 ;}
5889 break;
5890
Devang Pateld4980812008-09-02 20:52:40 +00005891 case 280:
5892#line 2627 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005893 {
5894 std::vector<const Type*> Elements((yyvsp[(3) - (5)].ConstVector)->size());
5895 for (unsigned i = 0, e = (yyvsp[(3) - (5)].ConstVector)->size(); i != e; ++i)
5896 Elements[i] = (*(yyvsp[(3) - (5)].ConstVector))[i]->getType();
5897
5898 const StructType *STy = StructType::get(Elements, /*isPacked=*/true);
5899 PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(STy));
5900
5901 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, *(yyvsp[(3) - (5)].ConstVector)));
5902 delete PTy; delete (yyvsp[(3) - (5)].ConstVector);
5903 CHECK_FOR_ERROR
5904 ;}
5905 break;
5906
Devang Pateld4980812008-09-02 20:52:40 +00005907 case 281:
5908#line 2639 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf910eaa2008-06-09 14:45:02 +00005909 {
5910 const StructType *STy = StructType::get(std::vector<const Type*>(),
5911 /*isPacked=*/true);
5912 (yyval.ValIDVal) = ValID::create(ConstantStruct::get(STy, std::vector<Constant*>()));
5913 CHECK_FOR_ERROR
5914 ;}
5915 break;
5916
Devang Pateld4980812008-09-02 20:52:40 +00005917 case 282:
5918#line 2645 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005919 {
5920 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
Reid Spencer832254e2007-02-02 02:16:23 +00005921 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005922 ;}
5923 break;
5924
Devang Pateld4980812008-09-02 20:52:40 +00005925 case 283:
5926#line 2649 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005927 {
5928 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5929 delete (yyvsp[(3) - (5)].StrVal);
5930 delete (yyvsp[(5) - (5)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005931 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005932 ;}
5933 break;
5934
Devang Pateld4980812008-09-02 20:52:40 +00005935 case 284:
5936#line 2659 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005937 { // Is it an integer reference...?
5938 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005939 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005940 ;}
5941 break;
5942
Devang Pateld4980812008-09-02 20:52:40 +00005943 case 285:
5944#line 2663 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005945 {
5946 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
Reid Spencer832254e2007-02-02 02:16:23 +00005947 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005948 ;}
5949 break;
5950
Devang Pateld4980812008-09-02 20:52:40 +00005951 case 286:
5952#line 2667 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005953 { // Is it a named reference...?
5954 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5955 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005956 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005957 ;}
5958 break;
5959
Devang Pateld4980812008-09-02 20:52:40 +00005960 case 287:
5961#line 2672 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005962 { // Is it a named reference...?
5963 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5964 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005965 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005966 ;}
5967 break;
5968
Devang Pateld4980812008-09-02 20:52:40 +00005969 case 290:
5970#line 2685 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005971 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005972 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00005973 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5974 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5975 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005976 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005977 ;}
5978 break;
5979
Devang Pateld4980812008-09-02 20:52:40 +00005980 case 291:
5981#line 2694 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005982 {
5983 (yyval.ValueList) = new std::vector<Value *>();
5984 (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal));
Devang Patel7990dc72008-02-20 22:40:23 +00005985 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005986 ;}
5987 break;
5988
Devang Pateld4980812008-09-02 20:52:40 +00005989 case 292:
5990#line 2699 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005991 {
5992 ((yyval.ValueList)=(yyvsp[(1) - (3)].ValueList))->push_back((yyvsp[(3) - (3)].ValueVal));
Devang Patel7990dc72008-02-20 22:40:23 +00005993 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00005994 ;}
5995 break;
5996
Devang Pateld4980812008-09-02 20:52:40 +00005997 case 293:
5998#line 2704 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00005999 {
6000 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006001 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006002 ;}
6003 break;
6004
Devang Pateld4980812008-09-02 20:52:40 +00006005 case 294:
6006#line 2708 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006007 { // Do not allow functions with 0 basic blocks
6008 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006009 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006010 ;}
6011 break;
6012
Devang Pateld4980812008-09-02 20:52:40 +00006013 case 295:
6014#line 2717 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006015 {
6016 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006017 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006018 InsertValue((yyvsp[(3) - (3)].TermInstVal));
6019 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
6020 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006021 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006022 ;}
6023 break;
6024
Devang Pateld4980812008-09-02 20:52:40 +00006025 case 296:
6026#line 2726 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00006027 {
6028 CHECK_FOR_ERROR
6029 int ValNum = InsertValue((yyvsp[(3) - (3)].TermInstVal));
6030 if (ValNum != (int)(yyvsp[(2) - (3)].UIntVal))
6031 GEN_ERROR("Result value number %" + utostr((yyvsp[(2) - (3)].UIntVal)) +
6032 " is incorrect, expected %" + utostr((unsigned)ValNum));
6033
6034 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
6035 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
6036 CHECK_FOR_ERROR
6037;}
6038 break;
6039
Devang Pateld4980812008-09-02 20:52:40 +00006040 case 297:
6041#line 2739 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006042 {
6043 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006044 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
6045 if (CI2->getParent() == 0)
Dan Gohmanf4423b12008-04-19 00:24:39 +00006046 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
6047 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
6048 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
Anton Korobeynikov38e09802007-04-28 13:48:45 +00006049 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006050 ;}
6051 break;
Chris Lattner38905612008-02-19 04:36:25 +00006052
Devang Pateld4980812008-09-02 20:52:40 +00006053 case 298:
6054#line 2748 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006055 { // Empty space between instruction lists
Chris Lattnercc81d152008-05-04 17:18:47 +00006056 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
Dan Gohmanf4423b12008-04-19 00:24:39 +00006057 CHECK_FOR_ERROR
6058 ;}
6059 break;
6060
Devang Pateld4980812008-09-02 20:52:40 +00006061 case 299:
6062#line 2752 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattnercc81d152008-05-04 17:18:47 +00006063 { // Labelled (named) basic block
6064 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
6065 delete (yyvsp[(1) - (1)].StrVal);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006066 CHECK_FOR_ERROR
Chris Lattnercc81d152008-05-04 17:18:47 +00006067
Dan Gohmanf4423b12008-04-19 00:24:39 +00006068 ;}
6069 break;
6070
Devang Pateld4980812008-09-02 20:52:40 +00006071 case 300:
6072#line 2760 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006073 { // Return with a result...
6074 ValueList &VL = *(yyvsp[(2) - (2)].ValueList);
6075 assert(!VL.empty() && "Invalid ret operands!");
Dan Gohman1a570242008-07-23 00:54:54 +00006076 const Type *ReturnType = CurFun.CurrentFunction->getReturnType();
6077 if (VL.size() > 1 ||
6078 (isa<StructType>(ReturnType) &&
6079 (VL.empty() || VL[0]->getType() != ReturnType))) {
6080 Value *RV = UndefValue::get(ReturnType);
6081 for (unsigned i = 0, e = VL.size(); i != e; ++i) {
6082 Instruction *I = InsertValueInst::Create(RV, VL[i], i, "mrv");
6083 ((yyvsp[(-1) - (2)].BasicBlockVal))->getInstList().push_back(I);
6084 RV = I;
6085 }
6086 (yyval.TermInstVal) = ReturnInst::Create(RV);
6087 } else {
6088 (yyval.TermInstVal) = ReturnInst::Create(VL[0]);
6089 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006090 delete (yyvsp[(2) - (2)].ValueList);
6091 CHECK_FOR_ERROR
6092 ;}
6093 break;
6094
Devang Pateld4980812008-09-02 20:52:40 +00006095 case 301:
6096#line 2780 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006097 { // Return with no result...
6098 (yyval.TermInstVal) = ReturnInst::Create();
6099 CHECK_FOR_ERROR
6100 ;}
6101 break;
6102
Devang Pateld4980812008-09-02 20:52:40 +00006103 case 302:
6104#line 2784 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006105 { // Unconditional Branch...
6106 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
6107 CHECK_FOR_ERROR
6108 (yyval.TermInstVal) = BranchInst::Create(tmpBB);
6109 ;}
6110 break;
6111
Devang Pateld4980812008-09-02 20:52:40 +00006112 case 303:
6113#line 2789 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006114 {
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006115 if (cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() != 1)
6116 GEN_ERROR("Branch condition must have type i1");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006117 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6118 CHECK_FOR_ERROR
6119 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
6120 CHECK_FOR_ERROR
6121 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
6122 CHECK_FOR_ERROR
6123 (yyval.TermInstVal) = BranchInst::Create(tmpBBA, tmpBBB, tmpVal);
6124 ;}
6125 break;
6126
Devang Pateld4980812008-09-02 20:52:40 +00006127 case 304:
6128#line 2800 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006129 {
6130 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
6131 CHECK_FOR_ERROR
6132 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
6133 CHECK_FOR_ERROR
6134 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
6135 (yyval.TermInstVal) = S;
6136
6137 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
6138 E = (yyvsp[(8) - (9)].JumpTable)->end();
Reid Spencer68a24bd2005-08-27 18:50:39 +00006139 for (; I != E; ++I) {
6140 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
6141 S->addCase(CI, I->second);
6142 else
Reid Spencerb5334b02007-02-05 10:18:06 +00006143 GEN_ERROR("Switch case is constant, but not a simple integer");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006144 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006145 delete (yyvsp[(8) - (9)].JumpTable);
Reid Spencer61c83e02006-08-18 08:43:06 +00006146 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006147 ;}
6148 break;
6149
Devang Pateld4980812008-09-02 20:52:40 +00006150 case 305:
6151#line 2819 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006152 {
6153 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006154 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006155 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006156 CHECK_FOR_ERROR
Gabor Greife64d2482008-04-06 23:07:54 +00006157 SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006158 (yyval.TermInstVal) = S;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006159 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006160 ;}
6161 break;
6162
Devang Pateld4980812008-09-02 20:52:40 +00006163 case 306:
6164#line 2829 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006165 {
Reid Spencer3822ff52006-11-08 06:47:33 +00006166
Reid Spencer14310612006-12-31 05:40:51 +00006167 // Handle the short syntax
6168 const PointerType *PFTy = 0;
6169 const FunctionType *Ty = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006170 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
Reid Spencer68a24bd2005-08-27 18:50:39 +00006171 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6172 // Pull out the types of all of the arguments...
6173 std::vector<const Type*> ParamTypes;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006174 ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006175 for (; I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00006176 const Type *Ty = I->Val->getType();
6177 if (Ty == Type::VoidTy)
6178 GEN_ERROR("Short call syntax cannot be used with varargs");
6179 ParamTypes.push_back(Ty);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006180 }
Chris Lattnera925a142008-04-23 05:37:08 +00006181
6182 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (14)].TypeVal)))
6183 GEN_ERROR("Invalid result type for LLVM function");
6184
Dan Gohmanf4423b12008-04-19 00:24:39 +00006185 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00006186 PFTy = PointerType::getUnqual(Ty);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006187 }
6188
Dan Gohmanf4423b12008-04-19 00:24:39 +00006189 delete (yyvsp[(3) - (14)].TypeVal);
Reid Spencer66728ef2007-03-20 01:13:36 +00006190
Dan Gohmanf4423b12008-04-19 00:24:39 +00006191 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00006192 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006193 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006194 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006195 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00006196 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00006197
Chris Lattner58d74912008-03-12 17:45:29 +00006198 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006199 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None)
6200 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (14)].ParamAttrs)));
Duncan Sandsdc024672007-11-27 13:23:08 +00006201
Reid Spencer14310612006-12-31 05:40:51 +00006202 // Check the arguments
6203 ValueList Args;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006204 if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments?
Reid Spencer14310612006-12-31 05:40:51 +00006205 // Make sure no arguments is a good thing!
6206 if (Ty->getNumParams() != 0)
6207 GEN_ERROR("No arguments passed to a function that "
Reid Spencerb5334b02007-02-05 10:18:06 +00006208 "expects arguments");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006209 } else { // Has arguments?
6210 // Loop through FunctionType's arguments and ensure they are specified
6211 // correctly!
Reid Spencer68a24bd2005-08-27 18:50:39 +00006212 FunctionType::param_iterator I = Ty->param_begin();
6213 FunctionType::param_iterator E = Ty->param_end();
Dan Gohmanf4423b12008-04-19 00:24:39 +00006214 ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006215 unsigned index = 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00006216
Duncan Sandsdc024672007-11-27 13:23:08 +00006217 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006218 if (ArgI->Val->getType() != *I)
6219 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00006220 (*I)->getDescription() + "'");
Reid Spencer14310612006-12-31 05:40:51 +00006221 Args.push_back(ArgI->Val);
Chris Lattner58d74912008-03-12 17:45:29 +00006222 if (ArgI->Attrs != ParamAttr::None)
6223 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00006224 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00006225
Reid Spencer14310612006-12-31 05:40:51 +00006226 if (Ty->isVarArg()) {
6227 if (I == E)
Chris Lattner38905612008-02-19 04:36:25 +00006228 for (; ArgI != ArgE; ++ArgI, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006229 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner58d74912008-03-12 17:45:29 +00006230 if (ArgI->Attrs != ParamAttr::None)
6231 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Chris Lattner38905612008-02-19 04:36:25 +00006232 }
Reid Spencer14310612006-12-31 05:40:51 +00006233 } else if (I != E || ArgI != ArgE)
Reid Spencerb5334b02007-02-05 10:18:06 +00006234 GEN_ERROR("Invalid number of parameters detected");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006235 }
Reid Spencer14310612006-12-31 05:40:51 +00006236
Chris Lattner58d74912008-03-12 17:45:29 +00006237 PAListPtr PAL;
Duncan Sandsdc024672007-11-27 13:23:08 +00006238 if (!Attrs.empty())
Chris Lattner58d74912008-03-12 17:45:29 +00006239 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsdc024672007-11-27 13:23:08 +00006240
Reid Spencer14310612006-12-31 05:40:51 +00006241 // Create the InvokeInst
Dan Gohman041e2eb2008-05-15 19:50:34 +00006242 InvokeInst *II = InvokeInst::Create(V, Normal, Except,
6243 Args.begin(), Args.end());
Dan Gohmanf4423b12008-04-19 00:24:39 +00006244 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
Duncan Sandsdc024672007-11-27 13:23:08 +00006245 II->setParamAttrs(PAL);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006246 (yyval.TermInstVal) = II;
6247 delete (yyvsp[(6) - (14)].ParamList);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006248 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006249 ;}
6250 break;
6251
Devang Pateld4980812008-09-02 20:52:40 +00006252 case 307:
6253#line 2914 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006254 {
6255 (yyval.TermInstVal) = new UnwindInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00006256 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006257 ;}
6258 break;
6259
Devang Pateld4980812008-09-02 20:52:40 +00006260 case 308:
6261#line 2918 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006262 {
6263 (yyval.TermInstVal) = new UnreachableInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00006264 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006265 ;}
6266 break;
6267
Devang Pateld4980812008-09-02 20:52:40 +00006268 case 309:
6269#line 2925 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006270 {
6271 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
6272 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006273 CHECK_FOR_ERROR
6274 if (V == 0)
6275 GEN_ERROR("May only switch on a constant pool value");
6276
Dan Gohmanf4423b12008-04-19 00:24:39 +00006277 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006278 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006279 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
6280 ;}
6281 break;
6282
Devang Pateld4980812008-09-02 20:52:40 +00006283 case 310:
6284#line 2936 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006285 {
6286 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
6287 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006288 CHECK_FOR_ERROR
6289
6290 if (V == 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00006291 GEN_ERROR("May only switch on a constant pool value");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006292
Dan Gohmanf4423b12008-04-19 00:24:39 +00006293 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006294 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006295 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
6296 ;}
6297 break;
6298
Devang Pateld4980812008-09-02 20:52:40 +00006299 case 311:
6300#line 2949 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006301 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006302 // Is this definition named?? if so, assign the name...
Dan Gohmanf4423b12008-04-19 00:24:39 +00006303 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006304 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006305 InsertValue((yyvsp[(2) - (2)].InstVal));
6306 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006307 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006308 ;}
6309 break;
6310
Devang Pateld4980812008-09-02 20:52:40 +00006311 case 312:
6312#line 2958 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner15bd0952008-08-29 17:20:18 +00006313 {
6314 CHECK_FOR_ERROR
6315 int ValNum = InsertValue((yyvsp[(2) - (2)].InstVal));
6316
6317 if (ValNum != (int)(yyvsp[(1) - (2)].UIntVal))
6318 GEN_ERROR("Result value number %" + utostr((yyvsp[(1) - (2)].UIntVal)) +
6319 " is incorrect, expected %" + utostr((unsigned)ValNum));
6320
6321 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
6322 CHECK_FOR_ERROR
6323 ;}
6324 break;
6325
Devang Pateld4980812008-09-02 20:52:40 +00006326 case 313:
6327#line 2971 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006328 { // Used for PHI nodes
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006329 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006330 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
6331 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
6332 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
Reid Spencer6f407902007-01-13 05:00:46 +00006333 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006334 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006335 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006336 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6337 delete (yyvsp[(1) - (6)].TypeVal);
6338 ;}
6339 break;
6340
Devang Pateld4980812008-09-02 20:52:40 +00006341 case 314:
6342#line 2982 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006343 {
6344 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
6345 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006346 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006347 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006348 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006349 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
6350 ;}
6351 break;
6352
Devang Pateld4980812008-09-02 20:52:40 +00006353 case 315:
6354#line 2992 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006355 {
Duncan Sandsdc024672007-11-27 13:23:08 +00006356 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006357 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006358 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006359 // Used for call and invoke instructions
Dan Gohmanf4423b12008-04-19 00:24:39 +00006360 (yyval.ParamList) = new ParamList();
6361 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
6362 (yyval.ParamList)->push_back(E);
6363 delete (yyvsp[(1) - (4)].TypeVal);
Duncan Sandsdc024672007-11-27 13:23:08 +00006364 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006365 ;}
6366 break;
6367
Devang Pateld4980812008-09-02 20:52:40 +00006368 case 316:
6369#line 3003 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006370 {
Duncan Sandsdc024672007-11-27 13:23:08 +00006371 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dale Johanneseneb57ea72007-11-05 21:20:28 +00006372 // Labels are only valid in ASMs
Dan Gohmanf4423b12008-04-19 00:24:39 +00006373 (yyval.ParamList) = new ParamList();
6374 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
6375 (yyval.ParamList)->push_back(E);
Duncan Sandsdc024672007-11-27 13:23:08 +00006376 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006377 ;}
6378 break;
6379
Devang Pateld4980812008-09-02 20:52:40 +00006380 case 317:
6381#line 3011 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006382 {
Duncan Sandsdc024672007-11-27 13:23:08 +00006383 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006384 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006385 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6386 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
6387 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
6388 (yyval.ParamList)->push_back(E);
6389 delete (yyvsp[(3) - (6)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006390 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006391 ;}
6392 break;
6393
Devang Pateld4980812008-09-02 20:52:40 +00006394 case 318:
6395#line 3021 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006396 {
Duncan Sandsdc024672007-11-27 13:23:08 +00006397 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dan Gohmanf4423b12008-04-19 00:24:39 +00006398 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
6399 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
6400 (yyval.ParamList)->push_back(E);
Dale Johanneseneb57ea72007-11-05 21:20:28 +00006401 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006402 ;}
6403 break;
6404
Devang Pateld4980812008-09-02 20:52:40 +00006405 case 319:
6406#line 3028 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006407 { (yyval.ParamList) = new ParamList(); ;}
6408 break;
6409
Devang Pateld4980812008-09-02 20:52:40 +00006410 case 320:
6411#line 3031 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006412 { (yyval.ValueList) = new std::vector<Value*>(); ;}
6413 break;
6414
Devang Pateld4980812008-09-02 20:52:40 +00006415 case 321:
6416#line 3032 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006417 {
6418 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
6419 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00006420 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006421 ;}
6422 break;
6423
Devang Pateld4980812008-09-02 20:52:40 +00006424 case 322:
6425#line 3040 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006426 {
6427 (yyval.ConstantList) = new std::vector<unsigned>();
6428 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
6429 GEN_ERROR("Index " + utostr((yyvsp[(2) - (2)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6430 (yyval.ConstantList)->push_back((yyvsp[(2) - (2)].UInt64Val));
6431 ;}
6432 break;
6433
Devang Pateld4980812008-09-02 20:52:40 +00006434 case 323:
6435#line 3046 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006436 {
6437 (yyval.ConstantList) = (yyvsp[(1) - (3)].ConstantList);
6438 if ((unsigned)(yyvsp[(3) - (3)].UInt64Val) != (yyvsp[(3) - (3)].UInt64Val))
6439 GEN_ERROR("Index " + utostr((yyvsp[(3) - (3)].UInt64Val)) + " is not valid for insertvalue or extractvalue.");
6440 (yyval.ConstantList)->push_back((yyvsp[(3) - (3)].UInt64Val));
6441 CHECK_FOR_ERROR
6442 ;}
6443 break;
6444
Devang Pateld4980812008-09-02 20:52:40 +00006445 case 324:
6446#line 3055 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006447 {
6448 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00006449 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006450 ;}
6451 break;
6452
Devang Pateld4980812008-09-02 20:52:40 +00006453 case 325:
6454#line 3059 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006455 {
6456 (yyval.BoolVal) = false;
Andrew Lenharth6353e052006-12-08 18:07:09 +00006457 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006458 ;}
6459 break;
6460
Devang Pateld4980812008-09-02 20:52:40 +00006461 case 326:
6462#line 3064 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006463 {
Reid Spencer14310612006-12-31 05:40:51 +00006464 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006465 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6466 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
6467 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006468 GEN_ERROR(
6469 "Arithmetic operator requires integer, FP, or packed operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006470 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006471 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006472 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006473 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006474 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006475 if ((yyval.InstVal) == 0)
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006476 GEN_ERROR("binary operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006477 delete (yyvsp[(2) - (5)].TypeVal);
6478 ;}
6479 break;
6480
Devang Pateld4980812008-09-02 20:52:40 +00006481 case 327:
6482#line 3080 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006483 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006484 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006485 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6486 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
Nate Begeman5bc1ea02008-07-29 15:49:41 +00006487 if (!isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
Dan Gohmanf4423b12008-04-19 00:24:39 +00006488 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006489 GEN_ERROR("Logical operator requires integral operands");
6490 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006491 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006492 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006493 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006494 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006495 (yyval.InstVal) = BinaryOperator::Create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006496 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006497 GEN_ERROR("binary operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006498 delete (yyvsp[(2) - (5)].TypeVal);
6499 ;}
6500 break;
6501
Devang Pateld4980812008-09-02 20:52:40 +00006502 case 328:
6503#line 3097 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006504 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006505 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006506 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6507 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006508 GEN_ERROR("Vector types not supported by icmp instruction");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006509 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006510 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006511 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006512 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006513 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006514 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006515 GEN_ERROR("icmp operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006516 delete (yyvsp[(3) - (6)].TypeVal);
6517 ;}
6518 break;
6519
Devang Pateld4980812008-09-02 20:52:40 +00006520 case 329:
6521#line 3111 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006522 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006523 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006524 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6525 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006526 GEN_ERROR("Vector types not supported by fcmp instruction");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006527 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006528 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006529 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006530 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006531 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006532 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006533 GEN_ERROR("fcmp operator returned null");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006534 delete (yyvsp[(3) - (6)].TypeVal);
6535 ;}
6536 break;
6537
Devang Pateld4980812008-09-02 20:52:40 +00006538 case 330:
6539#line 3125 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00006540 {
6541 if (!UpRefs.empty())
6542 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6543 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6544 GEN_ERROR("Scalar types not supported by vicmp instruction");
6545 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6546 CHECK_FOR_ERROR
6547 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6548 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006549 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Nate Begemanac80ade2008-05-12 19:01:56 +00006550 if ((yyval.InstVal) == 0)
6551 GEN_ERROR("icmp operator returned null");
6552 delete (yyvsp[(3) - (6)].TypeVal);
6553 ;}
6554 break;
6555
Devang Pateld4980812008-09-02 20:52:40 +00006556 case 331:
6557#line 3139 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Nate Begemanac80ade2008-05-12 19:01:56 +00006558 {
6559 if (!UpRefs.empty())
6560 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6561 if (!isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
6562 GEN_ERROR("Scalar types not supported by vfcmp instruction");
6563 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
6564 CHECK_FOR_ERROR
6565 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
6566 CHECK_FOR_ERROR
Dan Gohmane4977cf2008-05-23 01:55:30 +00006567 (yyval.InstVal) = CmpInst::Create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Nate Begemanac80ade2008-05-12 19:01:56 +00006568 if ((yyval.InstVal) == 0)
6569 GEN_ERROR("fcmp operator returned null");
6570 delete (yyvsp[(3) - (6)].TypeVal);
6571 ;}
6572 break;
6573
Devang Pateld4980812008-09-02 20:52:40 +00006574 case 332:
6575#line 3153 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006576 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006577 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006578 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6579 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6580 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6581 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006582 GEN_ERROR("invalid cast opcode for cast from '" +
6583 Val->getType()->getDescription() + "' to '" +
6584 DestTy->getDescription() + "'");
Dan Gohmane4977cf2008-05-23 01:55:30 +00006585 (yyval.InstVal) = CastInst::Create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006586 delete (yyvsp[(4) - (4)].TypeVal);
6587 ;}
6588 break;
6589
Devang Pateld4980812008-09-02 20:52:40 +00006590 case 333:
6591#line 3165 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006592 {
6593 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006594 GEN_ERROR("select condition must be boolean");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006595 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006596 GEN_ERROR("select value types should match");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006597 (yyval.InstVal) = SelectInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006598 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006599 ;}
6600 break;
6601
Devang Pateld4980812008-09-02 20:52:40 +00006602 case 334:
6603#line 3173 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006604 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006605 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006606 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6607 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6608 delete (yyvsp[(4) - (4)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006609 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006610 ;}
6611 break;
6612
Devang Pateld4980812008-09-02 20:52:40 +00006613 case 335:
6614#line 3180 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006615 {
6616 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006617 GEN_ERROR("Invalid extractelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006618 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006619 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006620 ;}
6621 break;
6622
Devang Pateld4980812008-09-02 20:52:40 +00006623 case 336:
6624#line 3186 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006625 {
6626 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006627 GEN_ERROR("Invalid insertelement operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006628 (yyval.InstVal) = InsertElementInst::Create((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006629 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006630 ;}
6631 break;
6632
Devang Pateld4980812008-09-02 20:52:40 +00006633 case 337:
6634#line 3192 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006635 {
6636 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006637 GEN_ERROR("Invalid shufflevector operands");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006638 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006639 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006640 ;}
6641 break;
6642
Devang Pateld4980812008-09-02 20:52:40 +00006643 case 338:
6644#line 3198 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006645 {
6646 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006647 if (!Ty->isFirstClassType())
6648 GEN_ERROR("PHI node operands must be of first class type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006649 (yyval.InstVal) = PHINode::Create(Ty);
6650 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6651 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6652 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006653 GEN_ERROR("All elements of a PHI node must be of the same type");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006654 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6655 (yyvsp[(2) - (2)].PHIList)->pop_front();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006656 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006657 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006658 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006659 ;}
6660 break;
6661
Devang Pateld4980812008-09-02 20:52:40 +00006662 case 339:
6663#line 3214 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006664 {
Reid Spencer14310612006-12-31 05:40:51 +00006665
6666 // Handle the short syntax
Andrew Lenharth6353e052006-12-08 18:07:09 +00006667 const PointerType *PFTy = 0;
6668 const FunctionType *Ty = 0;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006669 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
Andrew Lenharth6353e052006-12-08 18:07:09 +00006670 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6671 // Pull out the types of all of the arguments...
6672 std::vector<const Type*> ParamTypes;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006673 ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006674 for (; I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00006675 const Type *Ty = I->Val->getType();
6676 if (Ty == Type::VoidTy)
6677 GEN_ERROR("Short call syntax cannot be used with varargs");
6678 ParamTypes.push_back(Ty);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006679 }
Chris Lattnera925a142008-04-23 05:37:08 +00006680
6681 if (!FunctionType::isValidReturnType(*(yyvsp[(3) - (8)].TypeVal)))
6682 GEN_ERROR("Invalid result type for LLVM function");
6683
Dan Gohmanf4423b12008-04-19 00:24:39 +00006684 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00006685 PFTy = PointerType::getUnqual(Ty);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006686 }
Chris Lattner6cdc6822007-04-26 05:31:05 +00006687
Dan Gohmanf4423b12008-04-19 00:24:39 +00006688 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00006689 CHECK_FOR_ERROR
Chris Lattner6cdc6822007-04-26 05:31:05 +00006690
Reid Spencer7780acb2007-04-16 06:56:07 +00006691 // Check for call to invalid intrinsic to avoid crashing later.
6692 if (Function *theF = dyn_cast<Function>(V)) {
Reid Spencered48de22007-04-16 22:02:23 +00006693 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
Reid Spencer36fdde12007-04-16 20:35:38 +00006694 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6695 !theF->getIntrinsicID(true))
Reid Spencer7780acb2007-04-16 06:56:07 +00006696 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6697 theF->getName() + "'");
6698 }
6699
Duncan Sandsdc024672007-11-27 13:23:08 +00006700 // Set up the ParamAttrs for the function
Chris Lattner58d74912008-03-12 17:45:29 +00006701 SmallVector<ParamAttrsWithIndex, 8> Attrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006702 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None)
6703 Attrs.push_back(ParamAttrsWithIndex::get(0, (yyvsp[(8) - (8)].ParamAttrs)));
Reid Spencer14310612006-12-31 05:40:51 +00006704 // Check the arguments
6705 ValueList Args;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006706 if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments?
Andrew Lenharth6353e052006-12-08 18:07:09 +00006707 // Make sure no arguments is a good thing!
6708 if (Ty->getNumParams() != 0)
6709 GEN_ERROR("No arguments passed to a function that "
Reid Spencerb5334b02007-02-05 10:18:06 +00006710 "expects arguments");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006711 } else { // Has arguments?
6712 // Loop through FunctionType's arguments and ensure they are specified
Duncan Sandsdc024672007-11-27 13:23:08 +00006713 // correctly. Also, gather any parameter attributes.
Andrew Lenharth6353e052006-12-08 18:07:09 +00006714 FunctionType::param_iterator I = Ty->param_begin();
6715 FunctionType::param_iterator E = Ty->param_end();
Dan Gohmanf4423b12008-04-19 00:24:39 +00006716 ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006717 unsigned index = 1;
Andrew Lenharth6353e052006-12-08 18:07:09 +00006718
Duncan Sandsdc024672007-11-27 13:23:08 +00006719 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006720 if (ArgI->Val->getType() != *I)
6721 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00006722 (*I)->getDescription() + "'");
Reid Spencer14310612006-12-31 05:40:51 +00006723 Args.push_back(ArgI->Val);
Chris Lattner58d74912008-03-12 17:45:29 +00006724 if (ArgI->Attrs != ParamAttr::None)
6725 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Reid Spencer14310612006-12-31 05:40:51 +00006726 }
6727 if (Ty->isVarArg()) {
6728 if (I == E)
Chris Lattner38905612008-02-19 04:36:25 +00006729 for (; ArgI != ArgE; ++ArgI, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006730 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner58d74912008-03-12 17:45:29 +00006731 if (ArgI->Attrs != ParamAttr::None)
6732 Attrs.push_back(ParamAttrsWithIndex::get(index, ArgI->Attrs));
Chris Lattner38905612008-02-19 04:36:25 +00006733 }
Reid Spencer14310612006-12-31 05:40:51 +00006734 } else if (I != E || ArgI != ArgE)
Reid Spencerb5334b02007-02-05 10:18:06 +00006735 GEN_ERROR("Invalid number of parameters detected");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006736 }
Duncan Sandsdc024672007-11-27 13:23:08 +00006737
6738 // Finish off the ParamAttrs and check them
Chris Lattner58d74912008-03-12 17:45:29 +00006739 PAListPtr PAL;
Duncan Sandsdc024672007-11-27 13:23:08 +00006740 if (!Attrs.empty())
Chris Lattner58d74912008-03-12 17:45:29 +00006741 PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
Duncan Sandsdc024672007-11-27 13:23:08 +00006742
Reid Spencer14310612006-12-31 05:40:51 +00006743 // Create the call node
Gabor Greife64d2482008-04-06 23:07:54 +00006744 CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
Dan Gohmanf4423b12008-04-19 00:24:39 +00006745 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6746 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
Duncan Sandsdc024672007-11-27 13:23:08 +00006747 CI->setParamAttrs(PAL);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006748 (yyval.InstVal) = CI;
6749 delete (yyvsp[(6) - (8)].ParamList);
6750 delete (yyvsp[(3) - (8)].TypeVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00006751 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006752 ;}
6753 break;
6754
Devang Pateld4980812008-09-02 20:52:40 +00006755 case 340:
6756#line 3303 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006757 {
6758 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00006759 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006760 ;}
6761 break;
6762
Devang Pateld4980812008-09-02 20:52:40 +00006763 case 341:
6764#line 3308 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006765 {
6766 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00006767 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006768 ;}
6769 break;
6770
Devang Pateld4980812008-09-02 20:52:40 +00006771 case 342:
6772#line 3312 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006773 {
6774 (yyval.BoolVal) = false;
Reid Spencer61c83e02006-08-18 08:43:06 +00006775 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006776 ;}
6777 break;
6778
Devang Pateld4980812008-09-02 20:52:40 +00006779 case 343:
6780#line 3319 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006781 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006782 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006783 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6784 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6785 delete (yyvsp[(2) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006786 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006787 ;}
6788 break;
6789
Devang Pateld4980812008-09-02 20:52:40 +00006790 case 344:
6791#line 3326 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006792 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006793 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006794 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006795 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6796 GEN_ERROR("Malloc array size is not a 32-bit integer!");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006797 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00006798 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006799 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6800 delete (yyvsp[(2) - (6)].TypeVal);
6801 ;}
6802 break;
6803
Devang Pateld4980812008-09-02 20:52:40 +00006804 case 345:
6805#line 3336 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006806 {
Reid Spencer14310612006-12-31 05:40:51 +00006807 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006808 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6809 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6810 delete (yyvsp[(2) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006811 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006812 ;}
6813 break;
6814
Devang Pateld4980812008-09-02 20:52:40 +00006815 case 346:
6816#line 3343 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006817 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006818 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006819 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006820 if ((yyvsp[(4) - (6)].PrimType) != Type::Int32Ty)
6821 GEN_ERROR("Alloca array size is not a 32-bit integer!");
Dan Gohmanf4423b12008-04-19 00:24:39 +00006822 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006823 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006824 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6825 delete (yyvsp[(2) - (6)].TypeVal);
6826 ;}
6827 break;
6828
Devang Pateld4980812008-09-02 20:52:40 +00006829 case 347:
6830#line 3353 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006831 {
6832 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006833 GEN_ERROR("Trying to free nonpointer type " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006834 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6835 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006836 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006837 ;}
6838 break;
6839
Devang Pateld4980812008-09-02 20:52:40 +00006840 case 348:
6841#line 3361 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006842 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006843 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006844 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6845 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006846 GEN_ERROR("Can't load from nonpointer type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006847 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6848 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006849 GEN_ERROR("Can't load from pointer of non-first-class type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006850 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6851 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006852 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006853 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6854 delete (yyvsp[(3) - (5)].TypeVal);
6855 ;}
6856 break;
6857
Devang Pateld4980812008-09-02 20:52:40 +00006858 case 349:
6859#line 3375 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006860 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006861 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006862 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6863 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006864 if (!PT)
6865 GEN_ERROR("Can't store to a nonpointer type: " +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006866 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006867 const Type *ElTy = PT->getElementType();
Dan Gohmanf4423b12008-04-19 00:24:39 +00006868 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6869 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006870 "' into space of type '" + ElTy->getDescription() + "'");
6871
Dan Gohmanf4423b12008-04-19 00:24:39 +00006872 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006873 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006874 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6875 delete (yyvsp[(5) - (7)].TypeVal);
6876 ;}
6877 break;
6878
Devang Pateld4980812008-09-02 20:52:40 +00006879 case 350:
6880#line 3392 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006881 {
Dan Gohman1a570242008-07-23 00:54:54 +00006882 if (!UpRefs.empty())
6883 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
6884 if (!isa<StructType>((yyvsp[(2) - (5)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (5)].TypeVal)->get()))
6885 GEN_ERROR("getresult insn requires an aggregate operand");
6886 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].UInt64Val)))
6887 GEN_ERROR("Invalid getresult index for type '" +
6888 (*(yyvsp[(2) - (5)].TypeVal))->getDescription()+ "'");
6889
6890 Value *tmpVal = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Devang Patel5a970972008-02-19 22:27:01 +00006891 CHECK_FOR_ERROR
Dan Gohman1a570242008-07-23 00:54:54 +00006892 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(5) - (5)].UInt64Val));
6893 delete (yyvsp[(2) - (5)].TypeVal);
Dan Gohmanf4423b12008-04-19 00:24:39 +00006894 ;}
6895 break;
6896
Devang Pateld4980812008-09-02 20:52:40 +00006897 case 351:
6898#line 3406 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006899 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006900 if (!UpRefs.empty())
Dan Gohmanf4423b12008-04-19 00:24:39 +00006901 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6902 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
Reid Spencerb5334b02007-02-05 10:18:06 +00006903 GEN_ERROR("getelementptr insn requires pointer operand");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006904
Dan Gohman041e2eb2008-05-15 19:50:34 +00006905 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()))
Reid Spencer61c83e02006-08-18 08:43:06 +00006906 GEN_ERROR("Invalid getelementptr indices for type '" +
Dan Gohmanf4423b12008-04-19 00:24:39 +00006907 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6908 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00006909 CHECK_FOR_ERROR
Dan Gohmanf4423b12008-04-19 00:24:39 +00006910 (yyval.InstVal) = GetElementPtrInst::Create(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6911 delete (yyvsp[(2) - (4)].TypeVal);
6912 delete (yyvsp[(4) - (4)].ValueList);
6913 ;}
6914 break;
Reid Spencer7780acb2007-04-16 06:56:07 +00006915
Devang Pateld4980812008-09-02 20:52:40 +00006916 case 352:
6917#line 3421 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00006918 {
6919 if (!UpRefs.empty())
6920 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6921 if (!isa<StructType>((yyvsp[(2) - (4)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (4)].TypeVal)->get()))
6922 GEN_ERROR("extractvalue insn requires an aggregate operand");
6923
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006924 if (!ExtractValueInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end()))
Dan Gohmane4977cf2008-05-23 01:55:30 +00006925 GEN_ERROR("Invalid extractvalue indices for type '" +
6926 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6927 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
6928 CHECK_FOR_ERROR
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006929 (yyval.InstVal) = ExtractValueInst::Create(tmpVal, (yyvsp[(4) - (4)].ConstantList)->begin(), (yyvsp[(4) - (4)].ConstantList)->end());
Dan Gohmane4977cf2008-05-23 01:55:30 +00006930 delete (yyvsp[(2) - (4)].TypeVal);
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006931 delete (yyvsp[(4) - (4)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00006932 ;}
6933 break;
6934
Devang Pateld4980812008-09-02 20:52:40 +00006935 case 353:
6936#line 3436 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Dan Gohmane4977cf2008-05-23 01:55:30 +00006937 {
6938 if (!UpRefs.empty())
6939 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (7)].TypeVal))->getDescription());
6940 if (!isa<StructType>((yyvsp[(2) - (7)].TypeVal)->get()) && !isa<ArrayType>((yyvsp[(2) - (7)].TypeVal)->get()))
6941 GEN_ERROR("extractvalue insn requires an aggregate operand");
6942
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006943 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 +00006944 GEN_ERROR("Invalid insertvalue indices for type '" +
6945 (*(yyvsp[(2) - (7)].TypeVal))->getDescription()+ "'");
6946 Value* aggVal = getVal(*(yyvsp[(2) - (7)].TypeVal), (yyvsp[(3) - (7)].ValIDVal));
6947 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
6948 CHECK_FOR_ERROR
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006949 (yyval.InstVal) = InsertValueInst::Create(aggVal, tmpVal, (yyvsp[(7) - (7)].ConstantList)->begin(), (yyvsp[(7) - (7)].ConstantList)->end());
Dan Gohmane4977cf2008-05-23 01:55:30 +00006950 delete (yyvsp[(2) - (7)].TypeVal);
6951 delete (yyvsp[(5) - (7)].TypeVal);
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006952 delete (yyvsp[(7) - (7)].ConstantList);
Dan Gohmane4977cf2008-05-23 01:55:30 +00006953 ;}
6954 break;
6955
Dan Gohmanf4423b12008-04-19 00:24:39 +00006956
6957/* Line 1267 of yacc.c. */
Devang Pateld4980812008-09-02 20:52:40 +00006958#line 6959 "llvmAsmParser.tab.c"
Dan Gohmanf4423b12008-04-19 00:24:39 +00006959 default: break;
Dale Johannesencdd509a2007-09-07 21:07:57 +00006960 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00006961 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6962
6963 YYPOPSTACK (yylen);
6964 yylen = 0;
6965 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006966
6967 *++yyvsp = yyval;
6968
6969
Dan Gohmanf4423b12008-04-19 00:24:39 +00006970 /* Now `shift' the result of the reduction. Determine what state
6971 that goes to, based on the state we popped back to and the rule
6972 number reduced by. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00006973
6974 yyn = yyr1[yyn];
6975
Dan Gohmanf4423b12008-04-19 00:24:39 +00006976 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6977 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00006978 yystate = yytable[yystate];
6979 else
Dan Gohmanf4423b12008-04-19 00:24:39 +00006980 yystate = yydefgoto[yyn - YYNTOKENS];
Reid Spencer68a24bd2005-08-27 18:50:39 +00006981
6982 goto yynewstate;
6983
6984
Dan Gohmanf4423b12008-04-19 00:24:39 +00006985/*------------------------------------.
6986| yyerrlab -- here on detecting error |
6987`------------------------------------*/
6988yyerrlab:
6989 /* If not already recovering from an error, report this error. */
6990 if (!yyerrstatus)
Reid Spencer68a24bd2005-08-27 18:50:39 +00006991 {
6992 ++yynerrs;
Dan Gohmanf4423b12008-04-19 00:24:39 +00006993#if ! YYERROR_VERBOSE
6994 yyerror (YY_("syntax error"));
6995#else
6996 {
6997 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
6998 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
6999 {
7000 YYSIZE_T yyalloc = 2 * yysize;
7001 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
7002 yyalloc = YYSTACK_ALLOC_MAXIMUM;
7003 if (yymsg != yymsgbuf)
7004 YYSTACK_FREE (yymsg);
7005 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
7006 if (yymsg)
7007 yymsg_alloc = yyalloc;
7008 else
7009 {
7010 yymsg = yymsgbuf;
7011 yymsg_alloc = sizeof yymsgbuf;
7012 }
7013 }
Dale Johannesencdd509a2007-09-07 21:07:57 +00007014
Dan Gohmanf4423b12008-04-19 00:24:39 +00007015 if (0 < yysize && yysize <= yymsg_alloc)
7016 {
7017 (void) yysyntax_error (yymsg, yystate, yychar);
7018 yyerror (yymsg);
7019 }
7020 else
7021 {
7022 yyerror (YY_("syntax error"));
7023 if (yysize != 0)
7024 goto yyexhaustedlab;
7025 }
7026 }
7027#endif
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00007028 }
7029
Dan Gohmanf4423b12008-04-19 00:24:39 +00007030
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00007031
7032 if (yyerrstatus == 3)
7033 {
Dan Gohmanf4423b12008-04-19 00:24:39 +00007034 /* If just tried and failed to reuse look-ahead token after an
7035 error, discard it. */
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00007036
Dan Gohmanf4423b12008-04-19 00:24:39 +00007037 if (yychar <= YYEOF)
7038 {
7039 /* Return failure if at end of input. */
7040 if (yychar == YYEOF)
7041 YYABORT;
7042 }
7043 else
7044 {
7045 yydestruct ("Error: discarding",
7046 yytoken, &yylval);
7047 yychar = YYEMPTY;
7048 }
7049 }
7050
7051 /* Else will try to reuse look-ahead token after shifting the error
7052 token. */
7053 goto yyerrlab1;
7054
7055
7056/*---------------------------------------------------.
7057| yyerrorlab -- error raised explicitly by YYERROR. |
7058`---------------------------------------------------*/
7059yyerrorlab:
7060
7061 /* Pacify compilers like GCC when the user code never invokes
7062 YYERROR and the label yyerrorlab therefore never appears in user
7063 code. */
7064 if (/*CONSTCOND*/ 0)
7065 goto yyerrorlab;
7066
7067 /* Do not reclaim the symbols of the rule which action triggered
7068 this YYERROR. */
7069 YYPOPSTACK (yylen);
7070 yylen = 0;
7071 YY_STACK_PRINT (yyss, yyssp);
7072 yystate = *yyssp;
7073 goto yyerrlab1;
7074
7075
7076/*-------------------------------------------------------------.
7077| yyerrlab1 -- common code for both syntax error and YYERROR. |
7078`-------------------------------------------------------------*/
7079yyerrlab1:
7080 yyerrstatus = 3; /* Each real token shifted decrements this. */
7081
7082 for (;;)
7083 {
7084 yyn = yypact[yystate];
7085 if (yyn != YYPACT_NINF)
7086 {
7087 yyn += YYTERROR;
7088 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
7089 {
7090 yyn = yytable[yyn];
7091 if (0 < yyn)
7092 break;
7093 }
7094 }
7095
7096 /* Pop the current state because it cannot handle the error token. */
7097 if (yyssp == yyss)
Reid Spencer68a24bd2005-08-27 18:50:39 +00007098 YYABORT;
7099
Dale Johannesencdd509a2007-09-07 21:07:57 +00007100
Dan Gohmanf4423b12008-04-19 00:24:39 +00007101 yydestruct ("Error: popping",
7102 yystos[yystate], yyvsp);
7103 YYPOPSTACK (1);
7104 yystate = *yyssp;
7105 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00007106 }
7107
7108 if (yyn == YYFINAL)
7109 YYACCEPT;
7110
Reid Spencer68a24bd2005-08-27 18:50:39 +00007111 *++yyvsp = yylval;
Dan Gohmanf4423b12008-04-19 00:24:39 +00007112
7113
7114 /* Shift the error token. */
7115 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spencerb8f85052007-07-31 03:50:36 +00007116
Reid Spencer68a24bd2005-08-27 18:50:39 +00007117 yystate = yyn;
7118 goto yynewstate;
7119
Gabor Greife64d2482008-04-06 23:07:54 +00007120
Dan Gohmanf4423b12008-04-19 00:24:39 +00007121/*-------------------------------------.
7122| yyacceptlab -- YYACCEPT comes here. |
7123`-------------------------------------*/
7124yyacceptlab:
7125 yyresult = 0;
7126 goto yyreturn;
7127
7128/*-----------------------------------.
7129| yyabortlab -- YYABORT comes here. |
7130`-----------------------------------*/
7131yyabortlab:
7132 yyresult = 1;
7133 goto yyreturn;
7134
7135#ifndef yyoverflow
7136/*-------------------------------------------------.
7137| yyexhaustedlab -- memory exhaustion comes here. |
7138`-------------------------------------------------*/
7139yyexhaustedlab:
7140 yyerror (YY_("memory exhausted"));
7141 yyresult = 2;
7142 /* Fall through. */
Chris Lattner38905612008-02-19 04:36:25 +00007143#endif
Dan Gohmanf4423b12008-04-19 00:24:39 +00007144
7145yyreturn:
7146 if (yychar != YYEOF && yychar != YYEMPTY)
7147 yydestruct ("Cleanup: discarding lookahead",
7148 yytoken, &yylval);
7149 /* Do not reclaim the symbols of the rule which action triggered
7150 this YYABORT or YYACCEPT. */
7151 YYPOPSTACK (yylen);
7152 YY_STACK_PRINT (yyss, yyssp);
7153 while (yyssp != yyss)
7154 {
7155 yydestruct ("Cleanup: popping",
7156 yystos[*yyssp], yyvsp);
7157 YYPOPSTACK (1);
Gabor Greife64d2482008-04-06 23:07:54 +00007158 }
Dan Gohmanf4423b12008-04-19 00:24:39 +00007159#ifndef yyoverflow
7160 if (yyss != yyssa)
7161 YYSTACK_FREE (yyss);
7162#endif
7163#if YYERROR_VERBOSE
7164 if (yymsg != yymsgbuf)
7165 YYSTACK_FREE (yymsg);
7166#endif
7167 /* Make sure YYID is used. */
7168 return YYID (yyresult);
Reid Spencer68a24bd2005-08-27 18:50:39 +00007169}
Dan Gohmanf4423b12008-04-19 00:24:39 +00007170
7171
Devang Pateld4980812008-09-02 20:52:40 +00007172#line 3455 "/Volumes/Nanpura/fn_prop/llvm/lib/AsmParser/llvmAsmParser.y"
Reid Spencer61c83e02006-08-18 08:43:06 +00007173
7174
Reid Spencer14310612006-12-31 05:40:51 +00007175// common code from the two 'RunVMAsmParser' functions
7176static Module* RunParser(Module * M) {
Reid Spencer14310612006-12-31 05:40:51 +00007177 CurModule.CurrentModule = M;
Reid Spencer14310612006-12-31 05:40:51 +00007178 // Check to make sure the parser succeeded
7179 if (yyparse()) {
7180 if (ParserResult)
7181 delete ParserResult;
7182 return 0;
7183 }
7184
Reid Spencer0d60b5a2007-03-30 01:37:39 +00007185 // Emit an error if there are any unresolved types left.
7186 if (!CurModule.LateResolveTypes.empty()) {
7187 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
7188 if (DID.Type == ValID::LocalName) {
7189 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
7190 } else {
7191 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
7192 }
7193 if (ParserResult)
7194 delete ParserResult;
7195 return 0;
7196 }
7197
7198 // Emit an error if there are any unresolved values left.
7199 if (!CurModule.LateResolveValues.empty()) {
7200 Value *V = CurModule.LateResolveValues.back();
7201 std::map<Value*, std::pair<ValID, int> >::iterator I =
7202 CurModule.PlaceHolderInfo.find(V);
7203
7204 if (I != CurModule.PlaceHolderInfo.end()) {
7205 ValID &DID = I->second.first;
7206 if (DID.Type == ValID::LocalName) {
7207 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
7208 } else {
7209 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
7210 }
7211 if (ParserResult)
7212 delete ParserResult;
7213 return 0;
7214 }
7215 }
7216
Reid Spencer14310612006-12-31 05:40:51 +00007217 // Check to make sure that parsing produced a result
7218 if (!ParserResult)
7219 return 0;
7220
7221 // Reset ParserResult variable while saving its value for the result.
7222 Module *Result = ParserResult;
7223 ParserResult = 0;
7224
7225 return Result;
7226}
7227
Reid Spencer61c83e02006-08-18 08:43:06 +00007228void llvm::GenerateError(const std::string &message, int LineNo) {
Duncan Sandsdc024672007-11-27 13:23:08 +00007229 if (LineNo == -1) LineNo = LLLgetLineNo();
Reid Spencer61c83e02006-08-18 08:43:06 +00007230 // TODO: column number in exception
7231 if (TheParseError)
Duncan Sandsdc024672007-11-27 13:23:08 +00007232 TheParseError->setError(LLLgetFilename(), message, LineNo);
Reid Spencer61c83e02006-08-18 08:43:06 +00007233 TriggerError = 1;
7234}
Reid Spencer68a24bd2005-08-27 18:50:39 +00007235
7236int yyerror(const char *ErrorMsg) {
Duncan Sandsdc024672007-11-27 13:23:08 +00007237 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
Reid Spenceref9b9a72007-02-05 20:47:22 +00007238 std::string errMsg = where + "error: " + std::string(ErrorMsg);
Duncan Sandsdc024672007-11-27 13:23:08 +00007239 if (yychar != YYEMPTY && yychar != 0) {
7240 errMsg += " while reading token: '";
7241 errMsg += std::string(LLLgetTokenStart(),
7242 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
7243 }
Reid Spencer61c83e02006-08-18 08:43:06 +00007244 GenerateError(errMsg);
Reid Spencer68a24bd2005-08-27 18:50:39 +00007245 return 0;
7246}
Dan Gohmanf4423b12008-04-19 00:24:39 +00007247