blob: 8d49f7e7ad4ab619d6a0eeab8d350e67f6085c2a [file] [log] [blame]
Chris Lattner38905612008-02-19 04:36:25 +00001/* A Bison parser, made by GNU Bison 2.3. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002
Chris Lattner38905612008-02-19 04:36:25 +00003/* Skeleton implementation for Bison's Yacc-like parsers in C
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004
Chris Lattner38905612008-02-19 04:36:25 +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
Chris Lattner38905612008-02-19 04:36:25 +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
Chris Lattner38905612008-02-19 04:36:25 +000063#define yylex llvmAsmlex
Reid Spencer68a24bd2005-08-27 18:50:39 +000064#define yyerror llvmAsmerror
Chris Lattner38905612008-02-19 04:36:25 +000065#define yylval llvmAsmlval
66#define yychar llvmAsmchar
Reid Spencer68a24bd2005-08-27 18:50:39 +000067#define yydebug llvmAsmdebug
68#define yynerrs llvmAsmnerrs
69
Chris Lattner38905612008-02-19 04:36:25 +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,
123 OPAQUE = 304,
124 EXTERNAL = 305,
125 TARGET = 306,
126 TRIPLE = 307,
127 ALIGN = 308,
128 ADDRSPACE = 309,
129 DEPLIBS = 310,
130 CALL = 311,
131 TAIL = 312,
132 ASM_TOK = 313,
133 MODULE = 314,
134 SIDEEFFECT = 315,
135 CC_TOK = 316,
136 CCC_TOK = 317,
137 FASTCC_TOK = 318,
138 COLDCC_TOK = 319,
139 X86_STDCALLCC_TOK = 320,
140 X86_FASTCALLCC_TOK = 321,
141 DATALAYOUT = 322,
142 RET = 323,
143 BR = 324,
144 SWITCH = 325,
145 INVOKE = 326,
146 UNWIND = 327,
147 UNREACHABLE = 328,
148 ADD = 329,
149 SUB = 330,
150 MUL = 331,
151 UDIV = 332,
152 SDIV = 333,
153 FDIV = 334,
154 UREM = 335,
155 SREM = 336,
156 FREM = 337,
157 AND = 338,
158 OR = 339,
159 XOR = 340,
160 SHL = 341,
161 LSHR = 342,
162 ASHR = 343,
163 ICMP = 344,
164 FCMP = 345,
165 EQ = 346,
166 NE = 347,
167 SLT = 348,
168 SGT = 349,
169 SLE = 350,
170 SGE = 351,
171 ULT = 352,
172 UGT = 353,
173 ULE = 354,
174 UGE = 355,
175 OEQ = 356,
176 ONE = 357,
177 OLT = 358,
178 OGT = 359,
179 OLE = 360,
180 OGE = 361,
181 ORD = 362,
182 UNO = 363,
183 UEQ = 364,
184 UNE = 365,
185 MALLOC = 366,
186 ALLOCA = 367,
187 FREE = 368,
188 LOAD = 369,
189 STORE = 370,
190 GETELEMENTPTR = 371,
191 TRUNC = 372,
192 ZEXT = 373,
193 SEXT = 374,
194 FPTRUNC = 375,
195 FPEXT = 376,
196 BITCAST = 377,
197 UITOFP = 378,
198 SITOFP = 379,
199 FPTOUI = 380,
200 FPTOSI = 381,
201 INTTOPTR = 382,
202 PTRTOINT = 383,
203 PHI_TOK = 384,
204 SELECT = 385,
205 VAARG = 386,
206 EXTRACTELEMENT = 387,
207 INSERTELEMENT = 388,
208 SHUFFLEVECTOR = 389,
Devang Patel5a970972008-02-19 22:27:01 +0000209 GETRESULT = 390,
210 SIGNEXT = 391,
211 ZEROEXT = 392,
212 NORETURN = 393,
213 INREG = 394,
214 SRET = 395,
215 NOUNWIND = 396,
216 NOALIAS = 397,
217 BYVAL = 398,
218 NEST = 399,
219 READNONE = 400,
220 READONLY = 401,
221 GC = 402,
222 DEFAULT = 403,
223 HIDDEN = 404,
224 PROTECTED = 405
Chris Lattner38905612008-02-19 04:36:25 +0000225 };
226#endif
227/* Tokens. */
228#define ESINT64VAL 258
229#define EUINT64VAL 259
230#define ESAPINTVAL 260
231#define EUAPINTVAL 261
232#define LOCALVAL_ID 262
233#define GLOBALVAL_ID 263
234#define FPVAL 264
235#define VOID 265
236#define INTTYPE 266
237#define FLOAT 267
238#define DOUBLE 268
239#define X86_FP80 269
240#define FP128 270
241#define PPC_FP128 271
242#define LABEL 272
243#define TYPE 273
244#define LOCALVAR 274
245#define GLOBALVAR 275
246#define LABELSTR 276
247#define STRINGCONSTANT 277
248#define ATSTRINGCONSTANT 278
249#define PCTSTRINGCONSTANT 279
250#define ZEROINITIALIZER 280
251#define TRUETOK 281
252#define FALSETOK 282
253#define BEGINTOK 283
254#define ENDTOK 284
255#define DECLARE 285
256#define DEFINE 286
257#define GLOBAL 287
258#define CONSTANT 288
259#define SECTION 289
260#define ALIAS 290
261#define VOLATILE 291
262#define THREAD_LOCAL 292
263#define TO 293
264#define DOTDOTDOT 294
265#define NULL_TOK 295
266#define UNDEF 296
267#define INTERNAL 297
268#define LINKONCE 298
269#define WEAK 299
270#define APPENDING 300
271#define DLLIMPORT 301
272#define DLLEXPORT 302
273#define EXTERN_WEAK 303
274#define OPAQUE 304
275#define EXTERNAL 305
276#define TARGET 306
277#define TRIPLE 307
278#define ALIGN 308
279#define ADDRSPACE 309
280#define DEPLIBS 310
281#define CALL 311
282#define TAIL 312
283#define ASM_TOK 313
284#define MODULE 314
285#define SIDEEFFECT 315
286#define CC_TOK 316
287#define CCC_TOK 317
288#define FASTCC_TOK 318
289#define COLDCC_TOK 319
290#define X86_STDCALLCC_TOK 320
291#define X86_FASTCALLCC_TOK 321
292#define DATALAYOUT 322
293#define RET 323
294#define BR 324
295#define SWITCH 325
296#define INVOKE 326
297#define UNWIND 327
298#define UNREACHABLE 328
299#define ADD 329
300#define SUB 330
301#define MUL 331
302#define UDIV 332
303#define SDIV 333
304#define FDIV 334
305#define UREM 335
306#define SREM 336
307#define FREM 337
308#define AND 338
309#define OR 339
310#define XOR 340
311#define SHL 341
312#define LSHR 342
313#define ASHR 343
314#define ICMP 344
315#define FCMP 345
316#define EQ 346
317#define NE 347
318#define SLT 348
319#define SGT 349
320#define SLE 350
321#define SGE 351
322#define ULT 352
323#define UGT 353
324#define ULE 354
325#define UGE 355
326#define OEQ 356
327#define ONE 357
328#define OLT 358
329#define OGT 359
330#define OLE 360
331#define OGE 361
332#define ORD 362
333#define UNO 363
334#define UEQ 364
335#define UNE 365
336#define MALLOC 366
337#define ALLOCA 367
338#define FREE 368
339#define LOAD 369
340#define STORE 370
341#define GETELEMENTPTR 371
342#define TRUNC 372
343#define ZEXT 373
344#define SEXT 374
345#define FPTRUNC 375
346#define FPEXT 376
347#define BITCAST 377
348#define UITOFP 378
349#define SITOFP 379
350#define FPTOUI 380
351#define FPTOSI 381
352#define INTTOPTR 382
353#define PTRTOINT 383
354#define PHI_TOK 384
355#define SELECT 385
356#define VAARG 386
357#define EXTRACTELEMENT 387
358#define INSERTELEMENT 388
359#define SHUFFLEVECTOR 389
Devang Patel5a970972008-02-19 22:27:01 +0000360#define GETRESULT 390
361#define SIGNEXT 391
362#define ZEROEXT 392
363#define NORETURN 393
364#define INREG 394
365#define SRET 395
366#define NOUNWIND 396
367#define NOALIAS 397
368#define BYVAL 398
369#define NEST 399
370#define READNONE 400
371#define READONLY 401
372#define GC 402
373#define DEFAULT 403
374#define HIDDEN 404
375#define PROTECTED 405
Chris Lattner38905612008-02-19 04:36:25 +0000376
377
378
379
380/* Copy the first part of user declarations. */
Devang Patel4c3f8442008-02-20 19:13:10 +0000381#line 14 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000382
383#include "ParserInternals.h"
384#include "llvm/CallingConv.h"
Chris Lattner0e9c3762006-01-25 22:27:16 +0000385#include "llvm/InlineAsm.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000386#include "llvm/Instructions.h"
387#include "llvm/Module.h"
Reid Spenceref9b9a72007-02-05 20:47:22 +0000388#include "llvm/ValueSymbolTable.h"
Chandler Carruth02202192007-08-04 01:56:21 +0000389#include "llvm/AutoUpgrade.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000390#include "llvm/Support/GetElementPtrTypeIterator.h"
Reid Spencer14310612006-12-31 05:40:51 +0000391#include "llvm/Support/CommandLine.h"
Chris Lattnerf7469af2007-01-31 04:44:08 +0000392#include "llvm/ADT/SmallVector.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000393#include "llvm/ADT/STLExtras.h"
Chris Lattner0019bbe2005-11-06 06:46:53 +0000394#include "llvm/Support/MathExtras.h"
Reid Spencer481169e2006-12-01 00:33:46 +0000395#include "llvm/Support/Streams.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000396#include <algorithm>
Reid Spencer68a24bd2005-08-27 18:50:39 +0000397#include <list>
Chris Lattner8adde282007-02-11 21:40:10 +0000398#include <map>
Reid Spencer68a24bd2005-08-27 18:50:39 +0000399#include <utility>
400
Reid Spencere4f47592006-08-18 17:32:55 +0000401// The following is a gross hack. In order to rid the libAsmParser library of
402// exceptions, we have to have a way of getting the yyparse function to go into
403// an error situation. So, whenever we want an error to occur, the GenerateError
404// function (see bottom of file) sets TriggerError. Then, at the end of each
405// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
406// (a goto) to put YACC in error state. Furthermore, several calls to
407// GenerateError are made from inside productions and they must simulate the
408// previous exception behavior by exiting the production immediately. We have
409// replaced these with the GEN_ERROR macro which calls GeneratError and then
410// immediately invokes YYERROR. This would be so much cleaner if it was a
411// recursive descent parser.
Reid Spencer61c83e02006-08-18 08:43:06 +0000412static bool TriggerError = false;
Reid Spencerf63697d2006-10-09 17:36:59 +0000413#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
Reid Spencer61c83e02006-08-18 08:43:06 +0000414#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
415
Reid Spencer68a24bd2005-08-27 18:50:39 +0000416int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
417int yylex(); // declaration" of xxx warnings.
418int yyparse();
Reid Spencer68a24bd2005-08-27 18:50:39 +0000419using namespace llvm;
420
421static Module *ParserResult;
422
423// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
424// relating to upreferences in the input stream.
425//
426//#define DEBUG_UPREFS 1
427#ifdef DEBUG_UPREFS
Bill Wendlinge8156192006-12-07 01:30:32 +0000428#define UR_OUT(X) cerr << X
Reid Spencer68a24bd2005-08-27 18:50:39 +0000429#else
430#define UR_OUT(X)
431#endif
432
433#define YYERROR_VERBOSE 1
434
Chris Lattnerb475c422005-11-12 18:22:38 +0000435static GlobalVariable *CurGV;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000436
437
438// This contains info used when building the body of a function. It is
439// destroyed when the function is completed.
440//
441typedef std::vector<Value *> ValueList; // Numbered defs
Reid Spencer14310612006-12-31 05:40:51 +0000442
Reid Spencer68a24bd2005-08-27 18:50:39 +0000443static void
Reid Spencer93c40032007-03-19 18:40:50 +0000444ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers=0);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000445
446static struct PerModuleInfo {
447 Module *CurrentModule;
Reid Spencer93c40032007-03-19 18:40:50 +0000448 ValueList Values; // Module level numbered definitions
449 ValueList LateResolveValues;
Reid Spencer861d9d62006-11-28 07:29:44 +0000450 std::vector<PATypeHolder> Types;
451 std::map<ValID, PATypeHolder> LateResolveTypes;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000452
453 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
Chris Lattner0ad19702006-06-21 16:53:00 +0000454 /// how they were referenced and on which line of the input they came from so
Reid Spencer68a24bd2005-08-27 18:50:39 +0000455 /// that we can resolve them later and print error messages as appropriate.
456 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
457
458 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
459 // references to global values. Global values may be referenced before they
460 // are defined, and if so, the temporary object that they represent is held
461 // here. This is used for forward references of GlobalValues.
462 //
463 typedef std::map<std::pair<const PointerType *,
464 ValID>, GlobalValue*> GlobalRefsType;
465 GlobalRefsType GlobalRefs;
466
467 void ModuleDone() {
468 // If we could not resolve some functions at function compilation time
469 // (calls to functions before they are defined), resolve them now... Types
470 // are resolved when the constant pool has been completely parsed.
471 //
472 ResolveDefinitions(LateResolveValues);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000473 if (TriggerError)
474 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000475
476 // Check to make sure that all global value forward references have been
477 // resolved!
478 //
479 if (!GlobalRefs.empty()) {
480 std::string UndefinedReferences = "Unresolved global references exist:\n";
481
482 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
483 I != E; ++I) {
484 UndefinedReferences += " " + I->first.first->getDescription() + " " +
485 I->first.second.getName() + "\n";
486 }
Reid Spencer61c83e02006-08-18 08:43:06 +0000487 GenerateError(UndefinedReferences);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000488 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000489 }
490
Chandler Carruth02202192007-08-04 01:56:21 +0000491 // Look for intrinsic functions and CallInst that need to be upgraded
492 for (Module::iterator FI = CurrentModule->begin(),
493 FE = CurrentModule->end(); FI != FE; )
494 UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove
495
Reid Spencer68a24bd2005-08-27 18:50:39 +0000496 Values.clear(); // Clear out function local definitions
497 Types.clear();
498 CurrentModule = 0;
499 }
500
Reid Spencer68a24bd2005-08-27 18:50:39 +0000501 // GetForwardRefForGlobal - Check to see if there is a forward reference
502 // for this global. If so, remove it from the GlobalRefs map and return it.
503 // If not, just return null.
504 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
505 // Check to see if there is a forward reference to this global variable...
506 // if there is, eliminate it and patch the reference to use the new def'n.
507 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
508 GlobalValue *Ret = 0;
509 if (I != GlobalRefs.end()) {
510 Ret = I->second;
511 GlobalRefs.erase(I);
512 }
513 return Ret;
514 }
Reid Spencer8c8a2dc2007-01-02 21:54:12 +0000515
516 bool TypeIsUnresolved(PATypeHolder* PATy) {
517 // If it isn't abstract, its resolved
518 const Type* Ty = PATy->get();
519 if (!Ty->isAbstract())
520 return false;
521 // Traverse the type looking for abstract types. If it isn't abstract then
522 // we don't need to traverse that leg of the type.
523 std::vector<const Type*> WorkList, SeenList;
524 WorkList.push_back(Ty);
525 while (!WorkList.empty()) {
526 const Type* Ty = WorkList.back();
527 SeenList.push_back(Ty);
528 WorkList.pop_back();
529 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
530 // Check to see if this is an unresolved type
531 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
532 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
533 for ( ; I != E; ++I) {
534 if (I->second.get() == OpTy)
535 return true;
536 }
537 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
538 const Type* TheTy = SeqTy->getElementType();
539 if (TheTy->isAbstract() && TheTy != Ty) {
540 std::vector<const Type*>::iterator I = SeenList.begin(),
541 E = SeenList.end();
542 for ( ; I != E; ++I)
543 if (*I == TheTy)
544 break;
545 if (I == E)
546 WorkList.push_back(TheTy);
547 }
548 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
549 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
550 const Type* TheTy = StrTy->getElementType(i);
551 if (TheTy->isAbstract() && TheTy != Ty) {
552 std::vector<const Type*>::iterator I = SeenList.begin(),
553 E = SeenList.end();
554 for ( ; I != E; ++I)
555 if (*I == TheTy)
556 break;
557 if (I == E)
558 WorkList.push_back(TheTy);
559 }
560 }
561 }
562 }
563 return false;
564 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000565} CurModule;
566
567static struct PerFunctionInfo {
568 Function *CurrentFunction; // Pointer to current function being created
569
Reid Spencer93c40032007-03-19 18:40:50 +0000570 ValueList Values; // Keep track of #'d definitions
571 unsigned NextValNum;
572 ValueList LateResolveValues;
Reid Spenceref9b9a72007-02-05 20:47:22 +0000573 bool isDeclare; // Is this function a forward declararation?
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000574 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000575 GlobalValue::VisibilityTypes Visibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000576
577 /// BBForwardRefs - When we see forward references to basic blocks, keep
578 /// track of them here.
Reid Spencer93c40032007-03-19 18:40:50 +0000579 std::map<ValID, BasicBlock*> BBForwardRefs;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000580
581 inline PerFunctionInfo() {
582 CurrentFunction = 0;
583 isDeclare = false;
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000584 Linkage = GlobalValue::ExternalLinkage;
585 Visibility = GlobalValue::DefaultVisibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000586 }
587
588 inline void FunctionStart(Function *M) {
589 CurrentFunction = M;
Reid Spencer93c40032007-03-19 18:40:50 +0000590 NextValNum = 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000591 }
592
593 void FunctionDone() {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000594 // Any forward referenced blocks left?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000595 if (!BBForwardRefs.empty()) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000596 GenerateError("Undefined reference to label " +
Reid Spencer93c40032007-03-19 18:40:50 +0000597 BBForwardRefs.begin()->second->getName());
Reid Spencer5b7e7532006-09-28 19:28:24 +0000598 return;
599 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000600
601 // Resolve all forward references now.
602 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
603
604 Values.clear(); // Clear out function local definitions
Reid Spencer93c40032007-03-19 18:40:50 +0000605 BBForwardRefs.clear();
Reid Spencer68a24bd2005-08-27 18:50:39 +0000606 CurrentFunction = 0;
607 isDeclare = false;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000608 Linkage = GlobalValue::ExternalLinkage;
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000609 Visibility = GlobalValue::DefaultVisibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000610 }
611} CurFun; // Info for the current function...
612
613static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
614
615
616//===----------------------------------------------------------------------===//
617// Code to handle definitions of all the types
618//===----------------------------------------------------------------------===//
619
Reid Spencer93c40032007-03-19 18:40:50 +0000620static void InsertValue(Value *V, ValueList &ValueTab = CurFun.Values) {
621 // Things that have names or are void typed don't get slot numbers
622 if (V->hasName() || (V->getType() == Type::VoidTy))
623 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000624
Reid Spencer93c40032007-03-19 18:40:50 +0000625 // In the case of function values, we have to allow for the forward reference
626 // of basic blocks, which are included in the numbering. Consequently, we keep
627 // track of the next insertion location with NextValNum. When a BB gets
628 // inserted, it could change the size of the CurFun.Values vector.
629 if (&ValueTab == &CurFun.Values) {
630 if (ValueTab.size() <= CurFun.NextValNum)
631 ValueTab.resize(CurFun.NextValNum+1);
632 ValueTab[CurFun.NextValNum++] = V;
633 return;
634 }
635 // For all other lists, its okay to just tack it on the back of the vector.
636 ValueTab.push_back(V);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000637}
638
639static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
640 switch (D.Type) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000641 case ValID::LocalID: // Is it a numbered definition?
Reid Spencer68a24bd2005-08-27 18:50:39 +0000642 // Module constants occupy the lowest numbered slots...
Reid Spencer41dff5e2007-01-26 08:05:27 +0000643 if (D.Num < CurModule.Types.size())
644 return CurModule.Types[D.Num];
Reid Spencer68a24bd2005-08-27 18:50:39 +0000645 break;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000646 case ValID::LocalName: // Is it a named definition?
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000647 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.getName())) {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000648 D.destroy(); // Free old strdup'd memory...
649 return N;
650 }
651 break;
652 default:
Reid Spencerb5334b02007-02-05 10:18:06 +0000653 GenerateError("Internal parser error: Invalid symbol type reference");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000654 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000655 }
656
657 // If we reached here, we referenced either a symbol that we don't know about
658 // or an id number that hasn't been read yet. We may be referencing something
659 // forward, so just create an entry to be resolved later and get to it...
660 //
661 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
662
663
664 if (inFunctionScope()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000665 if (D.Type == ValID::LocalName) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000666 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000667 return 0;
668 } else {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000669 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
Reid Spencer5b7e7532006-09-28 19:28:24 +0000670 return 0;
671 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000672 }
673
Reid Spencer861d9d62006-11-28 07:29:44 +0000674 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000675 if (I != CurModule.LateResolveTypes.end())
Reid Spencer861d9d62006-11-28 07:29:44 +0000676 return I->second;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000677
Reid Spencer861d9d62006-11-28 07:29:44 +0000678 Type *Typ = OpaqueType::get();
679 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
680 return Typ;
Reid Spencera132e042006-12-03 05:46:11 +0000681 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000682
Reid Spencer93c40032007-03-19 18:40:50 +0000683// getExistingVal - Look up the value specified by the provided type and
Reid Spencer68a24bd2005-08-27 18:50:39 +0000684// the provided ValID. If the value exists and has already been defined, return
685// it. Otherwise return null.
686//
Reid Spencer93c40032007-03-19 18:40:50 +0000687static Value *getExistingVal(const Type *Ty, const ValID &D) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000688 if (isa<FunctionType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000689 GenerateError("Functions are not values and "
Reid Spencer68a24bd2005-08-27 18:50:39 +0000690 "must be referenced as pointers");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000691 return 0;
692 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000693
694 switch (D.Type) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000695 case ValID::LocalID: { // Is it a numbered definition?
Reid Spencer41dff5e2007-01-26 08:05:27 +0000696 // Check that the number is within bounds.
Reid Spencer93c40032007-03-19 18:40:50 +0000697 if (D.Num >= CurFun.Values.size())
698 return 0;
699 Value *Result = CurFun.Values[D.Num];
700 if (Ty != Result->getType()) {
701 GenerateError("Numbered value (%" + utostr(D.Num) + ") of type '" +
702 Result->getType()->getDescription() + "' does not match "
703 "expected type, '" + Ty->getDescription() + "'");
704 return 0;
705 }
706 return Result;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000707 }
708 case ValID::GlobalID: { // Is it a numbered definition?
Reid Spencer93c40032007-03-19 18:40:50 +0000709 if (D.Num >= CurModule.Values.size())
Reid Spenceref9b9a72007-02-05 20:47:22 +0000710 return 0;
Reid Spencer93c40032007-03-19 18:40:50 +0000711 Value *Result = CurModule.Values[D.Num];
712 if (Ty != Result->getType()) {
713 GenerateError("Numbered value (@" + utostr(D.Num) + ") of type '" +
714 Result->getType()->getDescription() + "' does not match "
715 "expected type, '" + Ty->getDescription() + "'");
Reid Spenceref9b9a72007-02-05 20:47:22 +0000716 return 0;
Reid Spencer93c40032007-03-19 18:40:50 +0000717 }
718 return Result;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000719 }
Reid Spencer41dff5e2007-01-26 08:05:27 +0000720
721 case ValID::LocalName: { // Is it a named definition?
Reid Spenceref9b9a72007-02-05 20:47:22 +0000722 if (!inFunctionScope())
723 return 0;
724 ValueSymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000725 Value *N = SymTab.lookup(D.getName());
Reid Spenceref9b9a72007-02-05 20:47:22 +0000726 if (N == 0)
727 return 0;
728 if (N->getType() != Ty)
729 return 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000730
731 D.destroy(); // Free old strdup'd memory...
732 return N;
733 }
734 case ValID::GlobalName: { // Is it a named definition?
Reid Spenceref9b9a72007-02-05 20:47:22 +0000735 ValueSymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000736 Value *N = SymTab.lookup(D.getName());
Reid Spenceref9b9a72007-02-05 20:47:22 +0000737 if (N == 0)
738 return 0;
739 if (N->getType() != Ty)
740 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000741
742 D.destroy(); // Free old strdup'd memory...
743 return N;
744 }
745
746 // Check to make sure that "Ty" is an integral type, and that our
747 // value will fit into the specified type...
748 case ValID::ConstSIntVal: // Is it a constant pool reference??
Chris Lattner38905612008-02-19 04:36:25 +0000749 if (!isa<IntegerType>(Ty) ||
750 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000751 GenerateError("Signed integral constant '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000752 itostr(D.ConstPool64) + "' is invalid for type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +0000753 Ty->getDescription() + "'");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000754 return 0;
755 }
Reid Spencer49d273e2007-03-19 20:40:51 +0000756 return ConstantInt::get(Ty, D.ConstPool64, true);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000757
758 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
Chris Lattner38905612008-02-19 04:36:25 +0000759 if (isa<IntegerType>(Ty) &&
760 ConstantInt::isValueValidForType(Ty, D.UConstPool64))
Reid Spencerb83eb642006-10-20 07:07:24 +0000761 return ConstantInt::get(Ty, D.UConstPool64);
Chris Lattner38905612008-02-19 04:36:25 +0000762
763 if (!isa<IntegerType>(Ty) ||
764 !ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
765 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
766 "' is invalid or out of range for type '" +
767 Ty->getDescription() + "'");
768 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000769 }
Chris Lattner38905612008-02-19 04:36:25 +0000770 // This is really a signed reference. Transmogrify.
771 return ConstantInt::get(Ty, D.ConstPool64, true);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000772
773 case ValID::ConstFPVal: // Is it a floating point const pool reference?
Chris Lattner38905612008-02-19 04:36:25 +0000774 if (!Ty->isFloatingPoint() ||
775 !ConstantFP::isValueValidForType(Ty, *D.ConstPoolFP)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000776 GenerateError("FP constant invalid for type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000777 return 0;
778 }
Dale Johannesenc72cd7e2007-09-11 18:33:39 +0000779 // Lexer has no type info, so builds all float and double FP constants
780 // as double. Fix this here. Long double does not need this.
781 if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble &&
782 Ty==Type::FloatTy)
Dale Johannesencdd509a2007-09-07 21:07:57 +0000783 D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
784 return ConstantFP::get(Ty, *D.ConstPoolFP);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000785
786 case ValID::ConstNullVal: // Is it a null value?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000787 if (!isa<PointerType>(Ty)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000788 GenerateError("Cannot create a a non pointer null");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000789 return 0;
790 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000791 return ConstantPointerNull::get(cast<PointerType>(Ty));
792
793 case ValID::ConstUndefVal: // Is it an undef value?
794 return UndefValue::get(Ty);
795
Chris Lattner7aa61892005-12-21 17:53:23 +0000796 case ValID::ConstZeroVal: // Is it a zero value?
797 return Constant::getNullValue(Ty);
798
Reid Spencer68a24bd2005-08-27 18:50:39 +0000799 case ValID::ConstantVal: // Fully resolved constant?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000800 if (D.ConstantValue->getType() != Ty) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000801 GenerateError("Constant expression type different from required type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000802 return 0;
803 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000804 return D.ConstantValue;
805
Chris Lattner0e9c3762006-01-25 22:27:16 +0000806 case ValID::InlineAsmVal: { // Inline asm expression
807 const PointerType *PTy = dyn_cast<PointerType>(Ty);
808 const FunctionType *FTy =
809 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000810 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000811 GenerateError("Invalid type for asm constraint string");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000812 return 0;
813 }
Chris Lattner0e9c3762006-01-25 22:27:16 +0000814 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
815 D.IAD->HasSideEffects);
816 D.destroy(); // Free InlineAsmDescriptor.
817 return IA;
818 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000819 default:
Reid Spencera9720f52007-02-05 17:04:00 +0000820 assert(0 && "Unhandled case!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000821 return 0;
822 } // End of switch
823
Reid Spencera9720f52007-02-05 17:04:00 +0000824 assert(0 && "Unhandled case!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000825 return 0;
826}
827
Reid Spencer93c40032007-03-19 18:40:50 +0000828// getVal - This function is identical to getExistingVal, except that if a
Reid Spencer68a24bd2005-08-27 18:50:39 +0000829// value is not already defined, it "improvises" by creating a placeholder var
830// that looks and acts just like the requested variable. When the value is
831// defined later, all uses of the placeholder variable are replaced with the
832// real thing.
833//
834static Value *getVal(const Type *Ty, const ValID &ID) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000835 if (Ty == Type::LabelTy) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000836 GenerateError("Cannot use a basic block here");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000837 return 0;
838 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000839
840 // See if the value has already been defined.
Reid Spencer93c40032007-03-19 18:40:50 +0000841 Value *V = getExistingVal(Ty, ID);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000842 if (V) return V;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000843 if (TriggerError) return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000844
Reid Spencer5b7e7532006-09-28 19:28:24 +0000845 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
Reid Spencerb5334b02007-02-05 10:18:06 +0000846 GenerateError("Invalid use of a composite type");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000847 return 0;
848 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000849
850 // If we reached here, we referenced either a symbol that we don't know about
851 // or an id number that hasn't been read yet. We may be referencing something
852 // forward, so just create an entry to be resolved later and get to it...
853 //
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000854 switch (ID.Type) {
855 case ValID::GlobalName:
Reid Spencer9c9b63a2007-04-28 16:07:31 +0000856 case ValID::GlobalID: {
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000857 const PointerType *PTy = dyn_cast<PointerType>(Ty);
858 if (!PTy) {
859 GenerateError("Invalid type for reference to global" );
860 return 0;
861 }
862 const Type* ElTy = PTy->getElementType();
863 if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
864 V = new Function(FTy, GlobalValue::ExternalLinkage);
865 else
Christopher Lamba8ed9bf2007-12-11 09:02:08 +0000866 V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
867 (Module*)0, false, PTy->getAddressSpace());
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000868 break;
Reid Spencer9c9b63a2007-04-28 16:07:31 +0000869 }
Anton Korobeynikov38e09802007-04-28 13:48:45 +0000870 default:
871 V = new Argument(Ty);
872 }
873
Reid Spencer68a24bd2005-08-27 18:50:39 +0000874 // Remember where this forward reference came from. FIXME, shouldn't we try
875 // to recycle these things??
876 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
Duncan Sandsdc024672007-11-27 13:23:08 +0000877 LLLgetLineNo())));
Reid Spencer68a24bd2005-08-27 18:50:39 +0000878
879 if (inFunctionScope())
880 InsertValue(V, CurFun.LateResolveValues);
881 else
882 InsertValue(V, CurModule.LateResolveValues);
883 return V;
884}
885
Reid Spencer93c40032007-03-19 18:40:50 +0000886/// defineBBVal - This is a definition of a new basic block with the specified
887/// identifier which must be the same as CurFun.NextValNum, if its numeric.
888static BasicBlock *defineBBVal(const ValID &ID) {
Reid Spencera9720f52007-02-05 17:04:00 +0000889 assert(inFunctionScope() && "Can't get basic block at global scope!");
Reid Spencer68a24bd2005-08-27 18:50:39 +0000890
Reid Spencer68a24bd2005-08-27 18:50:39 +0000891 BasicBlock *BB = 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000892
Reid Spencer93c40032007-03-19 18:40:50 +0000893 // First, see if this was forward referenced
Reid Spencer68a24bd2005-08-27 18:50:39 +0000894
Reid Spencer93c40032007-03-19 18:40:50 +0000895 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
896 if (BBI != CurFun.BBForwardRefs.end()) {
897 BB = BBI->second;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000898 // The forward declaration could have been inserted anywhere in the
899 // function: insert it into the correct place now.
900 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
901 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
Reid Spencer93c40032007-03-19 18:40:50 +0000902
Reid Spencer66728ef2007-03-20 01:13:36 +0000903 // We're about to erase the entry, save the key so we can clean it up.
904 ValID Tmp = BBI->first;
905
Reid Spencer93c40032007-03-19 18:40:50 +0000906 // Erase the forward ref from the map as its no longer "forward"
907 CurFun.BBForwardRefs.erase(ID);
908
Reid Spencer66728ef2007-03-20 01:13:36 +0000909 // The key has been removed from the map but so we don't want to leave
910 // strdup'd memory around so destroy it too.
911 Tmp.destroy();
912
Reid Spencer93c40032007-03-19 18:40:50 +0000913 // If its a numbered definition, bump the number and set the BB value.
914 if (ID.Type == ValID::LocalID) {
915 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
916 InsertValue(BB);
917 }
918
919 ID.destroy();
920 return BB;
921 }
922
923 // We haven't seen this BB before and its first mention is a definition.
924 // Just create it and return it.
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000925 std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
Reid Spencer93c40032007-03-19 18:40:50 +0000926 BB = new BasicBlock(Name, CurFun.CurrentFunction);
927 if (ID.Type == ValID::LocalID) {
928 assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
929 InsertValue(BB);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000930 }
Reid Spencer93c40032007-03-19 18:40:50 +0000931
932 ID.destroy(); // Free strdup'd memory
933 return BB;
934}
935
936/// getBBVal - get an existing BB value or create a forward reference for it.
937///
938static BasicBlock *getBBVal(const ValID &ID) {
939 assert(inFunctionScope() && "Can't get basic block at global scope!");
940
941 BasicBlock *BB = 0;
942
943 std::map<ValID, BasicBlock*>::iterator BBI = CurFun.BBForwardRefs.find(ID);
944 if (BBI != CurFun.BBForwardRefs.end()) {
945 BB = BBI->second;
946 } if (ID.Type == ValID::LocalName) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000947 std::string Name = ID.getName();
Reid Spencer93c40032007-03-19 18:40:50 +0000948 Value *N = CurFun.CurrentFunction->getValueSymbolTable().lookup(Name);
Anton Korobeynikovc70d7732008-02-20 12:10:37 +0000949 if (N) {
Reid Spencer93c40032007-03-19 18:40:50 +0000950 if (N->getType()->getTypeID() == Type::LabelTyID)
951 BB = cast<BasicBlock>(N);
952 else
953 GenerateError("Reference to label '" + Name + "' is actually of type '"+
954 N->getType()->getDescription() + "'");
Anton Korobeynikovc70d7732008-02-20 12:10:37 +0000955 }
Reid Spencer93c40032007-03-19 18:40:50 +0000956 } else if (ID.Type == ValID::LocalID) {
957 if (ID.Num < CurFun.NextValNum && ID.Num < CurFun.Values.size()) {
958 if (CurFun.Values[ID.Num]->getType()->getTypeID() == Type::LabelTyID)
959 BB = cast<BasicBlock>(CurFun.Values[ID.Num]);
960 else
961 GenerateError("Reference to label '%" + utostr(ID.Num) +
962 "' is actually of type '"+
963 CurFun.Values[ID.Num]->getType()->getDescription() + "'");
964 }
965 } else {
966 GenerateError("Illegal label reference " + ID.getName());
967 return 0;
968 }
969
970 // If its already been defined, return it now.
971 if (BB) {
972 ID.destroy(); // Free strdup'd memory.
973 return BB;
974 }
975
976 // Otherwise, this block has not been seen before, create it.
977 std::string Name;
978 if (ID.Type == ValID::LocalName)
Reid Spencer0a8a16b2007-05-22 18:52:55 +0000979 Name = ID.getName();
Reid Spencer93c40032007-03-19 18:40:50 +0000980 BB = new BasicBlock(Name, CurFun.CurrentFunction);
981
982 // Insert it in the forward refs map.
983 CurFun.BBForwardRefs[ID] = BB;
984
Reid Spencer68a24bd2005-08-27 18:50:39 +0000985 return BB;
986}
987
988
989//===----------------------------------------------------------------------===//
990// Code to handle forward references in instructions
991//===----------------------------------------------------------------------===//
992//
993// This code handles the late binding needed with statements that reference
994// values not defined yet... for example, a forward branch, or the PHI node for
995// a loop body.
996//
997// This keeps a table (CurFun.LateResolveValues) of all such forward references
998// and back patchs after we are done.
999//
1000
1001// ResolveDefinitions - If we could not resolve some defs at parsing
1002// time (forward branches, phi functions for loops, etc...) resolve the
1003// defs now...
1004//
1005static void
Reid Spencer93c40032007-03-19 18:40:50 +00001006ResolveDefinitions(ValueList &LateResolvers, ValueList *FutureLateResolvers) {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001007 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
Reid Spencer93c40032007-03-19 18:40:50 +00001008 while (!LateResolvers.empty()) {
1009 Value *V = LateResolvers.back();
1010 LateResolvers.pop_back();
Reid Spencer68a24bd2005-08-27 18:50:39 +00001011
Reid Spencer93c40032007-03-19 18:40:50 +00001012 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
1013 CurModule.PlaceHolderInfo.find(V);
1014 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001015
Reid Spencer93c40032007-03-19 18:40:50 +00001016 ValID &DID = PHI->second.first;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001017
Reid Spencer93c40032007-03-19 18:40:50 +00001018 Value *TheRealValue = getExistingVal(V->getType(), DID);
1019 if (TriggerError)
1020 return;
1021 if (TheRealValue) {
1022 V->replaceAllUsesWith(TheRealValue);
1023 delete V;
1024 CurModule.PlaceHolderInfo.erase(PHI);
1025 } else if (FutureLateResolvers) {
1026 // Functions have their unresolved items forwarded to the module late
1027 // resolver table
1028 InsertValue(V, *FutureLateResolvers);
1029 } else {
1030 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
1031 GenerateError("Reference to an invalid definition: '" +DID.getName()+
1032 "' of type '" + V->getType()->getDescription() + "'",
1033 PHI->second.second);
Reid Spencer5b7e7532006-09-28 19:28:24 +00001034 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001035 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00001036 GenerateError("Reference to an invalid definition: #" +
1037 itostr(DID.Num) + " of type '" +
1038 V->getType()->getDescription() + "'",
1039 PHI->second.second);
1040 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001041 }
1042 }
1043 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001044 LateResolvers.clear();
1045}
1046
1047// ResolveTypeTo - A brand new type was just declared. This means that (if
1048// name is not null) things referencing Name can be resolved. Otherwise, things
1049// refering to the number can be resolved. Do this now.
1050//
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001051static void ResolveTypeTo(std::string *Name, const Type *ToTy) {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001052 ValID D;
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001053 if (Name)
1054 D = ValID::createLocalName(*Name);
1055 else
1056 D = ValID::createLocalID(CurModule.Types.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00001057
Reid Spencer861d9d62006-11-28 07:29:44 +00001058 std::map<ValID, PATypeHolder>::iterator I =
Reid Spencer68a24bd2005-08-27 18:50:39 +00001059 CurModule.LateResolveTypes.find(D);
1060 if (I != CurModule.LateResolveTypes.end()) {
Reid Spencer861d9d62006-11-28 07:29:44 +00001061 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001062 CurModule.LateResolveTypes.erase(I);
1063 }
1064}
1065
1066// setValueName - Set the specified value to the name given. The name may be
1067// null potentially, in which case this is a noop. The string passed in is
1068// assumed to be a malloc'd string buffer, and is free'd by this function.
1069//
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001070static void setValueName(Value *V, std::string *NameStr) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00001071 if (!NameStr) return;
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001072 std::string Name(*NameStr); // Copy string
1073 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001074
Reid Spencer41dff5e2007-01-26 08:05:27 +00001075 if (V->getType() == Type::VoidTy) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001076 GenerateError("Can't assign name '" + Name+"' to value with void type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00001077 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001078 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00001079
Reid Spencera9720f52007-02-05 17:04:00 +00001080 assert(inFunctionScope() && "Must be in function scope!");
Reid Spenceref9b9a72007-02-05 20:47:22 +00001081 ValueSymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
1082 if (ST.lookup(Name)) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00001083 GenerateError("Redefinition of value '" + Name + "' of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00001084 V->getType()->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00001085 return;
1086 }
1087
1088 // Set the name.
1089 V->setName(Name);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001090}
1091
1092/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
1093/// this is a declaration, otherwise it is a definition.
Chris Lattnerb475c422005-11-12 18:22:38 +00001094static GlobalVariable *
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001095ParseGlobalVariable(std::string *NameStr,
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001096 GlobalValue::LinkageTypes Linkage,
1097 GlobalValue::VisibilityTypes Visibility,
Chris Lattnerb475c422005-11-12 18:22:38 +00001098 bool isConstantGlobal, const Type *Ty,
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001099 Constant *Initializer, bool IsThreadLocal,
1100 unsigned AddressSpace = 0) {
Reid Spencer5b7e7532006-09-28 19:28:24 +00001101 if (isa<FunctionType>(Ty)) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001102 GenerateError("Cannot declare global vars of function type");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001103 return 0;
1104 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001105
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001106 const PointerType *PTy = PointerType::get(Ty, AddressSpace);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001107
1108 std::string Name;
1109 if (NameStr) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001110 Name = *NameStr; // Copy string
1111 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001112 }
1113
1114 // See if this global value was forward referenced. If so, recycle the
1115 // object.
1116 ValID ID;
1117 if (!Name.empty()) {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001118 ID = ValID::createGlobalName(Name);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001119 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00001120 ID = ValID::createGlobalID(CurModule.Values.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00001121 }
1122
1123 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1124 // Move the global to the end of the list, from whereever it was
1125 // previously inserted.
1126 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1127 CurModule.CurrentModule->getGlobalList().remove(GV);
1128 CurModule.CurrentModule->getGlobalList().push_back(GV);
1129 GV->setInitializer(Initializer);
1130 GV->setLinkage(Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001131 GV->setVisibility(Visibility);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001132 GV->setConstant(isConstantGlobal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00001133 GV->setThreadLocal(IsThreadLocal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001134 InsertValue(GV, CurModule.Values);
Chris Lattnerb475c422005-11-12 18:22:38 +00001135 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001136 }
1137
Reid Spenceref9b9a72007-02-05 20:47:22 +00001138 // If this global has a name
Reid Spencer68a24bd2005-08-27 18:50:39 +00001139 if (!Name.empty()) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00001140 // if the global we're parsing has an initializer (is a definition) and
1141 // has external linkage.
1142 if (Initializer && Linkage != GlobalValue::InternalLinkage)
1143 // If there is already a global with external linkage with this name
1144 if (CurModule.CurrentModule->getGlobalVariable(Name, false)) {
1145 // If we allow this GVar to get created, it will be renamed in the
1146 // symbol table because it conflicts with an existing GVar. We can't
1147 // allow redefinition of GVars whose linking indicates that their name
1148 // must stay the same. Issue the error.
1149 GenerateError("Redefinition of global variable named '" + Name +
1150 "' of type '" + Ty->getDescription() + "'");
1151 return 0;
1152 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001153 }
1154
1155 // Otherwise there is no existing GV to use, create one now.
1156 GlobalVariable *GV =
1157 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00001158 CurModule.CurrentModule, IsThreadLocal, AddressSpace);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001159 GV->setVisibility(Visibility);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001160 InsertValue(GV, CurModule.Values);
Chris Lattnerb475c422005-11-12 18:22:38 +00001161 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001162}
1163
1164// setTypeName - Set the specified type to the name given. The name may be
1165// null potentially, in which case this is a noop. The string passed in is
1166// assumed to be a malloc'd string buffer, and is freed by this function.
1167//
1168// This function returns true if the type has already been defined, but is
1169// allowed to be redefined in the specified context. If the name is a new name
1170// for the type plane, it is inserted and false is returned.
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001171static bool setTypeName(const Type *T, std::string *NameStr) {
Reid Spencera9720f52007-02-05 17:04:00 +00001172 assert(!inFunctionScope() && "Can't give types function-local names!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001173 if (NameStr == 0) return false;
1174
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001175 std::string Name(*NameStr); // Copy string
1176 delete NameStr; // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +00001177
1178 // We don't allow assigning names to void type
Reid Spencer5b7e7532006-09-28 19:28:24 +00001179 if (T == Type::VoidTy) {
Reid Spencerb5334b02007-02-05 10:18:06 +00001180 GenerateError("Can't assign name '" + Name + "' to the void type");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001181 return false;
1182 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001183
1184 // Set the type name, checking for conflicts as we do so.
1185 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1186
1187 if (AlreadyExists) { // Inserting a name that is already defined???
1188 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
Reid Spencera9720f52007-02-05 17:04:00 +00001189 assert(Existing && "Conflict but no matching type?!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001190
1191 // There is only one case where this is allowed: when we are refining an
1192 // opaque type. In this case, Existing will be an opaque type.
1193 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1194 // We ARE replacing an opaque type!
1195 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1196 return true;
1197 }
1198
1199 // Otherwise, this is an attempt to redefine a type. That's okay if
1200 // the redefinition is identical to the original. This will be so if
1201 // Existing and T point to the same Type object. In this one case we
1202 // allow the equivalent redefinition.
1203 if (Existing == T) return true; // Yes, it's equal.
1204
1205 // Any other kind of (non-equivalent) redefinition is an error.
Reid Spencer63c34452007-01-05 21:51:07 +00001206 GenerateError("Redefinition of type named '" + Name + "' of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00001207 T->getDescription() + "'");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001208 }
1209
1210 return false;
1211}
1212
1213//===----------------------------------------------------------------------===//
1214// Code for handling upreferences in type names...
1215//
1216
1217// TypeContains - Returns true if Ty directly contains E in it.
1218//
1219static bool TypeContains(const Type *Ty, const Type *E) {
1220 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1221 E) != Ty->subtype_end();
1222}
1223
1224namespace {
1225 struct UpRefRecord {
1226 // NestingLevel - The number of nesting levels that need to be popped before
1227 // this type is resolved.
1228 unsigned NestingLevel;
1229
1230 // LastContainedTy - This is the type at the current binding level for the
1231 // type. Every time we reduce the nesting level, this gets updated.
1232 const Type *LastContainedTy;
1233
1234 // UpRefTy - This is the actual opaque type that the upreference is
1235 // represented with.
1236 OpaqueType *UpRefTy;
1237
1238 UpRefRecord(unsigned NL, OpaqueType *URTy)
1239 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1240 };
1241}
1242
1243// UpRefs - A list of the outstanding upreferences that need to be resolved.
1244static std::vector<UpRefRecord> UpRefs;
1245
1246/// HandleUpRefs - Every time we finish a new layer of types, this function is
1247/// called. It loops through the UpRefs vector, which is a list of the
1248/// currently active types. For each type, if the up reference is contained in
1249/// the newly completed type, we decrement the level count. When the level
1250/// count reaches zero, the upreferenced type is the type that is passed in:
1251/// thus we can complete the cycle.
1252///
1253static PATypeHolder HandleUpRefs(const Type *ty) {
Chris Lattner224f84f2006-08-18 17:34:45 +00001254 // If Ty isn't abstract, or if there are no up-references in it, then there is
1255 // nothing to resolve here.
1256 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1257
Reid Spencer68a24bd2005-08-27 18:50:39 +00001258 PATypeHolder Ty(ty);
1259 UR_OUT("Type '" << Ty->getDescription() <<
1260 "' newly formed. Resolving upreferences.\n" <<
1261 UpRefs.size() << " upreferences active!\n");
1262
1263 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1264 // to zero), we resolve them all together before we resolve them to Ty. At
1265 // the end of the loop, if there is anything to resolve to Ty, it will be in
1266 // this variable.
1267 OpaqueType *TypeToResolve = 0;
1268
1269 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1270 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1271 << UpRefs[i].second->getDescription() << ") = "
1272 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1273 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1274 // Decrement level of upreference
1275 unsigned Level = --UpRefs[i].NestingLevel;
1276 UpRefs[i].LastContainedTy = Ty;
1277 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1278 if (Level == 0) { // Upreference should be resolved!
1279 if (!TypeToResolve) {
1280 TypeToResolve = UpRefs[i].UpRefTy;
1281 } else {
1282 UR_OUT(" * Resolving upreference for "
1283 << UpRefs[i].second->getDescription() << "\n";
1284 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1285 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1286 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1287 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1288 }
1289 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1290 --i; // Do not skip the next element...
1291 }
1292 }
1293 }
1294
1295 if (TypeToResolve) {
1296 UR_OUT(" * Resolving upreference for "
1297 << UpRefs[i].second->getDescription() << "\n";
1298 std::string OldName = TypeToResolve->getDescription());
1299 TypeToResolve->refineAbstractTypeTo(Ty);
1300 }
1301
1302 return Ty;
1303}
1304
Reid Spencer68a24bd2005-08-27 18:50:39 +00001305//===----------------------------------------------------------------------===//
1306// RunVMAsmParser - Define an interface to this parser
1307//===----------------------------------------------------------------------===//
1308//
Reid Spencer14310612006-12-31 05:40:51 +00001309static Module* RunParser(Module * M);
1310
Duncan Sandsdc024672007-11-27 13:23:08 +00001311Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) {
1312 InitLLLexer(MB);
1313 Module *M = RunParser(new Module(LLLgetFilename()));
1314 FreeLexer();
1315 return M;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001316}
1317
1318
Chris Lattner38905612008-02-19 04:36:25 +00001319
1320/* Enabling traces. */
1321#ifndef YYDEBUG
1322# define YYDEBUG 0
1323#endif
1324
1325/* Enabling verbose error messages. */
1326#ifdef YYERROR_VERBOSE
1327# undef YYERROR_VERBOSE
1328# define YYERROR_VERBOSE 1
1329#else
1330# define YYERROR_VERBOSE 0
1331#endif
1332
1333/* Enabling the token table. */
1334#ifndef YYTOKEN_TABLE
1335# define YYTOKEN_TABLE 0
1336#endif
1337
1338#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1339typedef union YYSTYPE
Devang Patel4c3f8442008-02-20 19:13:10 +00001340#line 952 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00001341{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001342 llvm::Module *ModuleVal;
1343 llvm::Function *FunctionVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001344 llvm::BasicBlock *BasicBlockVal;
1345 llvm::TerminatorInst *TermInstVal;
1346 llvm::Instruction *InstVal;
Reid Spencera132e042006-12-03 05:46:11 +00001347 llvm::Constant *ConstVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001348
Reid Spencera132e042006-12-03 05:46:11 +00001349 const llvm::Type *PrimType;
Reid Spencer14310612006-12-31 05:40:51 +00001350 std::list<llvm::PATypeHolder> *TypeList;
Reid Spencera132e042006-12-03 05:46:11 +00001351 llvm::PATypeHolder *TypeVal;
1352 llvm::Value *ValueVal;
Reid Spencera132e042006-12-03 05:46:11 +00001353 std::vector<llvm::Value*> *ValueList;
Reid Spencer14310612006-12-31 05:40:51 +00001354 llvm::ArgListType *ArgList;
1355 llvm::TypeWithAttrs TypeWithAttrs;
1356 llvm::TypeWithAttrsList *TypeWithAttrsList;
Dale Johanneseneb57ea72007-11-05 21:20:28 +00001357 llvm::ParamList *ParamList;
Reid Spencer14310612006-12-31 05:40:51 +00001358
Reid Spencer68a24bd2005-08-27 18:50:39 +00001359 // Represent the RHS of PHI node
Reid Spencera132e042006-12-03 05:46:11 +00001360 std::list<std::pair<llvm::Value*,
1361 llvm::BasicBlock*> > *PHIList;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001362 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
Reid Spencera132e042006-12-03 05:46:11 +00001363 std::vector<llvm::Constant*> *ConstVector;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001364
1365 llvm::GlobalValue::LinkageTypes Linkage;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001366 llvm::GlobalValue::VisibilityTypes Visibility;
Dale Johannesen222ebf72008-02-19 21:40:51 +00001367 llvm::ParameterAttributes ParamAttrs;
Reid Spencer38c91a92007-02-28 02:24:54 +00001368 llvm::APInt *APIntVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001369 int64_t SInt64Val;
1370 uint64_t UInt64Val;
1371 int SIntVal;
1372 unsigned UIntVal;
Dale Johannesencdd509a2007-09-07 21:07:57 +00001373 llvm::APFloat *FPVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001374 bool BoolVal;
1375
Reid Spencer0a8a16b2007-05-22 18:52:55 +00001376 std::string *StrVal; // This memory must be deleted
1377 llvm::ValID ValIDVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001378
Reid Spencera132e042006-12-03 05:46:11 +00001379 llvm::Instruction::BinaryOps BinaryOpVal;
1380 llvm::Instruction::TermOps TermOpVal;
1381 llvm::Instruction::MemoryOps MemOpVal;
1382 llvm::Instruction::CastOps CastOpVal;
1383 llvm::Instruction::OtherOps OtherOpVal;
Reid Spencera132e042006-12-03 05:46:11 +00001384 llvm::ICmpInst::Predicate IPredicate;
1385 llvm::FCmpInst::Predicate FPredicate;
Chris Lattner38905612008-02-19 04:36:25 +00001386}
Devang Patel4c3f8442008-02-20 19:13:10 +00001387/* Line 193 of yacc.c. */
Anton Korobeynikovc70d7732008-02-20 12:10:37 +00001388#line 1389 "llvmAsmParser.tab.c"
Chris Lattner38905612008-02-19 04:36:25 +00001389 YYSTYPE;
1390# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1391# define YYSTYPE_IS_DECLARED 1
1392# define YYSTYPE_IS_TRIVIAL 1
Reid Spencer68a24bd2005-08-27 18:50:39 +00001393#endif
1394
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001395
Reid Spencer68a24bd2005-08-27 18:50:39 +00001396
Chris Lattner38905612008-02-19 04:36:25 +00001397/* Copy the second part of user declarations. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001398
1399
Chris Lattner38905612008-02-19 04:36:25 +00001400/* Line 216 of yacc.c. */
Anton Korobeynikovc70d7732008-02-20 12:10:37 +00001401#line 1402 "llvmAsmParser.tab.c"
Reid Spencerb8f85052007-07-31 03:50:36 +00001402
Chris Lattner38905612008-02-19 04:36:25 +00001403#ifdef short
1404# undef short
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001405#endif
1406
Chris Lattner38905612008-02-19 04:36:25 +00001407#ifdef YYTYPE_UINT8
1408typedef YYTYPE_UINT8 yytype_uint8;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001409#else
Chris Lattner38905612008-02-19 04:36:25 +00001410typedef unsigned char yytype_uint8;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00001411#endif
1412
Chris Lattner38905612008-02-19 04:36:25 +00001413#ifdef YYTYPE_INT8
1414typedef YYTYPE_INT8 yytype_int8;
1415#elif (defined __STDC__ || defined __C99__FUNC__ \
1416 || defined __cplusplus || defined _MSC_VER)
1417typedef signed char yytype_int8;
1418#else
1419typedef short int yytype_int8;
1420#endif
1421
1422#ifdef YYTYPE_UINT16
1423typedef YYTYPE_UINT16 yytype_uint16;
1424#else
1425typedef unsigned short int yytype_uint16;
1426#endif
1427
1428#ifdef YYTYPE_INT16
1429typedef YYTYPE_INT16 yytype_int16;
1430#else
1431typedef short int yytype_int16;
1432#endif
1433
1434#ifndef YYSIZE_T
1435# ifdef __SIZE_TYPE__
1436# define YYSIZE_T __SIZE_TYPE__
1437# elif defined size_t
1438# define YYSIZE_T size_t
1439# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1440 || defined __cplusplus || defined _MSC_VER)
1441# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1442# define YYSIZE_T size_t
1443# else
1444# define YYSIZE_T unsigned int
1445# endif
1446#endif
1447
1448#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1449
1450#ifndef YY_
Devang Patel4c3f8442008-02-20 19:13:10 +00001451# if defined YYENABLE_NLS && YYENABLE_NLS
Chris Lattner38905612008-02-19 04:36:25 +00001452# if ENABLE_NLS
1453# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1454# define YY_(msgid) dgettext ("bison-runtime", msgid)
1455# endif
1456# endif
1457# ifndef YY_
1458# define YY_(msgid) msgid
1459# endif
1460#endif
1461
1462/* Suppress unused-variable warnings by "using" E. */
1463#if ! defined lint || defined __GNUC__
1464# define YYUSE(e) ((void) (e))
1465#else
1466# define YYUSE(e) /* empty */
1467#endif
1468
1469/* Identity function, used to suppress warnings about constant conditions. */
1470#ifndef lint
1471# define YYID(n) (n)
1472#else
1473#if (defined __STDC__ || defined __C99__FUNC__ \
1474 || defined __cplusplus || defined _MSC_VER)
1475static int
1476YYID (int i)
1477#else
1478static int
1479YYID (i)
1480 int i;
1481#endif
1482{
1483 return i;
1484}
1485#endif
1486
1487#if ! defined yyoverflow || YYERROR_VERBOSE
1488
1489/* The parser invokes alloca or malloc; define the necessary symbols. */
1490
1491# ifdef YYSTACK_USE_ALLOCA
1492# if YYSTACK_USE_ALLOCA
1493# ifdef __GNUC__
1494# define YYSTACK_ALLOC __builtin_alloca
1495# elif defined __BUILTIN_VA_ARG_INCR
1496# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1497# elif defined _AIX
1498# define YYSTACK_ALLOC __alloca
1499# elif defined _MSC_VER
1500# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1501# define alloca _alloca
1502# else
1503# define YYSTACK_ALLOC alloca
1504# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1505 || defined __cplusplus || defined _MSC_VER)
1506# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1507# ifndef _STDLIB_H
1508# define _STDLIB_H 1
1509# endif
1510# endif
1511# endif
1512# endif
1513# endif
1514
1515# ifdef YYSTACK_ALLOC
1516 /* Pacify GCC's `empty if-body' warning. */
1517# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
1518# ifndef YYSTACK_ALLOC_MAXIMUM
1519 /* The OS might guarantee only one guard page at the bottom of the stack,
1520 and a page size can be as small as 4096 bytes. So we cannot safely
1521 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1522 to allow for a few compiler-allocated temporary stack slots. */
1523# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1524# endif
1525# else
1526# define YYSTACK_ALLOC YYMALLOC
1527# define YYSTACK_FREE YYFREE
1528# ifndef YYSTACK_ALLOC_MAXIMUM
1529# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1530# endif
1531# if (defined __cplusplus && ! defined _STDLIB_H \
1532 && ! ((defined YYMALLOC || defined malloc) \
1533 && (defined YYFREE || defined free)))
1534# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1535# ifndef _STDLIB_H
1536# define _STDLIB_H 1
1537# endif
1538# endif
1539# ifndef YYMALLOC
1540# define YYMALLOC malloc
1541# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1542 || defined __cplusplus || defined _MSC_VER)
1543void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1544# endif
1545# endif
1546# ifndef YYFREE
1547# define YYFREE free
1548# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1549 || defined __cplusplus || defined _MSC_VER)
1550void free (void *); /* INFRINGES ON USER NAME SPACE */
1551# endif
1552# endif
1553# endif
1554#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1555
1556
1557#if (! defined yyoverflow \
1558 && (! defined __cplusplus \
1559 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1560
1561/* A type that is properly aligned for any stack member. */
1562union yyalloc
1563{
1564 yytype_int16 yyss;
1565 YYSTYPE yyvs;
1566 };
1567
1568/* The size of the maximum gap between one aligned stack and the next. */
1569# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1570
1571/* The size of an array large to enough to hold all stacks, each with
1572 N elements. */
1573# define YYSTACK_BYTES(N) \
1574 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
1575 + YYSTACK_GAP_MAXIMUM)
1576
1577/* Copy COUNT objects from FROM to TO. The source and destination do
1578 not overlap. */
1579# ifndef YYCOPY
1580# if defined __GNUC__ && 1 < __GNUC__
1581# define YYCOPY(To, From, Count) \
1582 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1583# else
1584# define YYCOPY(To, From, Count) \
1585 do \
1586 { \
1587 YYSIZE_T yyi; \
1588 for (yyi = 0; yyi < (Count); yyi++) \
1589 (To)[yyi] = (From)[yyi]; \
1590 } \
1591 while (YYID (0))
1592# endif
1593# endif
1594
1595/* Relocate STACK from its old location to the new one. The
1596 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1597 elements in the stack, and YYPTR gives the new location of the
1598 stack. Advance YYPTR to a properly aligned location for the next
1599 stack. */
1600# define YYSTACK_RELOCATE(Stack) \
1601 do \
1602 { \
1603 YYSIZE_T yynewbytes; \
1604 YYCOPY (&yyptr->Stack, Stack, yysize); \
1605 Stack = &yyptr->Stack; \
1606 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1607 yyptr += yynewbytes / sizeof (*yyptr); \
1608 } \
1609 while (YYID (0))
1610
1611#endif
1612
1613/* YYFINAL -- State number of the termination state. */
1614#define YYFINAL 43
1615/* YYLAST -- Last index in YYTABLE. */
Devang Patel5a970972008-02-19 22:27:01 +00001616#define YYLAST 1955
Chris Lattner38905612008-02-19 04:36:25 +00001617
1618/* YYNTOKENS -- Number of terminals. */
Devang Patel5a970972008-02-19 22:27:01 +00001619#define YYNTOKENS 165
Chris Lattner38905612008-02-19 04:36:25 +00001620/* YYNNTS -- Number of nonterminals. */
1621#define YYNNTS 84
1622/* YYNRULES -- Number of rules. */
Devang Patel5a970972008-02-19 22:27:01 +00001623#define YYNRULES 319
Chris Lattner38905612008-02-19 04:36:25 +00001624/* YYNRULES -- Number of states. */
Devang Patel5a970972008-02-19 22:27:01 +00001625#define YYNSTATES 624
Chris Lattner38905612008-02-19 04:36:25 +00001626
1627/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1628#define YYUNDEFTOK 2
Devang Patel5a970972008-02-19 22:27:01 +00001629#define YYMAXUTOK 405
Chris Lattner38905612008-02-19 04:36:25 +00001630
1631#define YYTRANSLATE(YYX) \
1632 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1633
1634/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
1635static const yytype_uint8 yytranslate[] =
1636{
1637 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1638 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1639 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1640 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patel5a970972008-02-19 22:27:01 +00001641 151, 152, 155, 2, 154, 2, 2, 2, 2, 2,
Chris Lattner38905612008-02-19 04:36:25 +00001642 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patel5a970972008-02-19 22:27:01 +00001643 160, 153, 161, 2, 2, 2, 2, 2, 2, 2,
Chris Lattner38905612008-02-19 04:36:25 +00001644 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1645 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patel5a970972008-02-19 22:27:01 +00001646 2, 157, 156, 159, 2, 2, 2, 2, 2, 164,
Chris Lattner38905612008-02-19 04:36:25 +00001647 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1648 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Devang Patel5a970972008-02-19 22:27:01 +00001649 158, 2, 2, 162, 2, 163, 2, 2, 2, 2,
Chris Lattner38905612008-02-19 04:36:25 +00001650 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1651 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1652 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1653 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1654 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1655 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1656 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1657 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1658 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1659 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1660 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1661 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1662 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1663 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1664 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1665 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1666 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1667 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1668 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1669 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1670 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1671 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1672 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1673 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1674 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1675 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1676 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
Devang Patel5a970972008-02-19 22:27:01 +00001677 145, 146, 147, 148, 149, 150
Chris Lattner38905612008-02-19 04:36:25 +00001678};
1679
1680#if YYDEBUG
1681/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1682 YYRHS. */
1683static const yytype_uint16 yyprhs[] =
1684{
1685 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1686 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1687 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1688 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1689 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1690 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1691 119, 121, 123, 125, 127, 129, 130, 135, 136, 139,
1692 140, 142, 144, 146, 147, 150, 152, 154, 156, 158,
1693 160, 162, 164, 166, 167, 169, 171, 173, 174, 176,
1694 178, 179, 181, 183, 185, 187, 188, 190, 192, 193,
1695 195, 197, 199, 201, 203, 206, 208, 210, 212, 214,
1696 216, 218, 220, 222, 224, 225, 228, 230, 232, 234,
1697 236, 238, 240, 241, 244, 245, 248, 249, 252, 253,
1698 257, 260, 261, 263, 264, 268, 270, 273, 275, 277,
1699 279, 281, 283, 285, 287, 289, 291, 295, 297, 300,
1700 306, 312, 318, 324, 328, 331, 337, 342, 345, 347,
1701 349, 351, 355, 357, 361, 363, 364, 366, 370, 375,
1702 379, 383, 388, 393, 397, 404, 410, 413, 416, 419,
1703 422, 425, 428, 431, 434, 437, 440, 443, 446, 453,
1704 459, 468, 475, 482, 490, 498, 505, 514, 523, 527,
1705 529, 531, 533, 535, 536, 539, 546, 548, 549, 551,
1706 554, 555, 559, 560, 564, 568, 572, 576, 577, 586,
1707 587, 597, 598, 608, 614, 617, 621, 623, 627, 631,
1708 635, 639, 641, 642, 648, 652, 654, 658, 660, 661,
1709 672, 674, 676, 681, 683, 685, 688, 692, 693, 695,
1710 697, 699, 701, 703, 705, 707, 709, 711, 715, 717,
1711 723, 725, 727, 729, 731, 733, 735, 738, 741, 744,
1712 748, 751, 752, 754, 757, 760, 764, 774, 784, 793,
1713 808, 810, 812, 819, 825, 828, 835, 843, 848, 853,
1714 860, 867, 868, 869, 873, 876, 878, 884, 890, 897,
1715 904, 909, 916, 921, 926, 933, 940, 943, 952, 954,
Devang Patel5a970972008-02-19 22:27:01 +00001716 956, 957, 961, 968, 972, 979, 982, 988, 996, 1002
Chris Lattner38905612008-02-19 04:36:25 +00001717};
1718
1719/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1720static const yytype_int16 yyrhs[] =
1721{
Devang Patel5a970972008-02-19 22:27:01 +00001722 211, 0, -1, 74, -1, 75, -1, 76, -1, 77,
Chris Lattner38905612008-02-19 04:36:25 +00001723 -1, 78, -1, 79, -1, 80, -1, 81, -1, 82,
1724 -1, 86, -1, 87, -1, 88, -1, 83, -1, 84,
1725 -1, 85, -1, 117, -1, 118, -1, 119, -1, 120,
1726 -1, 121, -1, 122, -1, 123, -1, 124, -1, 125,
1727 -1, 126, -1, 127, -1, 128, -1, 91, -1, 92,
1728 -1, 93, -1, 94, -1, 95, -1, 96, -1, 97,
1729 -1, 98, -1, 99, -1, 100, -1, 101, -1, 102,
1730 -1, 103, -1, 104, -1, 105, -1, 106, -1, 107,
1731 -1, 108, -1, 109, -1, 110, -1, 97, -1, 98,
1732 -1, 99, -1, 100, -1, 26, -1, 27, -1, 11,
1733 -1, 12, -1, 13, -1, 16, -1, 15, -1, 14,
Devang Patel5a970972008-02-19 22:27:01 +00001734 -1, 19, -1, 22, -1, 24, -1, 173, -1, -1,
1735 54, 151, 4, 152, -1, -1, 173, 153, -1, -1,
1736 20, -1, 23, -1, 179, -1, -1, 177, 153, -1,
Chris Lattner38905612008-02-19 04:36:25 +00001737 42, -1, 44, -1, 43, -1, 45, -1, 47, -1,
Devang Patel5a970972008-02-19 22:27:01 +00001738 46, -1, 48, -1, 50, -1, -1, 148, -1, 149,
1739 -1, 150, -1, -1, 46, -1, 48, -1, -1, 42,
Chris Lattner38905612008-02-19 04:36:25 +00001740 -1, 43, -1, 44, -1, 47, -1, -1, 44, -1,
1741 42, -1, -1, 62, -1, 63, -1, 64, -1, 65,
Devang Patel5a970972008-02-19 22:27:01 +00001742 -1, 66, -1, 61, 4, -1, 137, -1, 118, -1,
1743 136, -1, 119, -1, 139, -1, 140, -1, 142, -1,
1744 143, -1, 144, -1, -1, 188, 187, -1, 138, -1,
1745 141, -1, 137, -1, 136, -1, 145, -1, 146, -1,
1746 -1, 190, 189, -1, -1, 147, 22, -1, -1, 53,
1747 4, -1, -1, 154, 53, 4, -1, 34, 22, -1,
1748 -1, 194, -1, -1, 154, 197, 196, -1, 194, -1,
Chris Lattner38905612008-02-19 04:36:25 +00001749 53, 4, -1, 11, -1, 12, -1, 13, -1, 16,
Devang Patel5a970972008-02-19 22:27:01 +00001750 -1, 15, -1, 14, -1, 17, -1, 49, -1, 198,
1751 -1, 199, 175, 155, -1, 233, -1, 156, 4, -1,
1752 199, 151, 203, 152, 190, -1, 10, 151, 203, 152,
1753 190, -1, 157, 4, 158, 199, 159, -1, 160, 4,
1754 158, 199, 161, -1, 162, 204, 163, -1, 162, 163,
1755 -1, 160, 162, 204, 163, 161, -1, 160, 162, 163,
1756 161, -1, 199, 188, -1, 199, -1, 10, -1, 200,
1757 -1, 202, 154, 200, -1, 202, -1, 202, 154, 39,
1758 -1, 39, -1, -1, 199, -1, 204, 154, 199, -1,
1759 199, 157, 207, 159, -1, 199, 157, 159, -1, 199,
1760 164, 22, -1, 199, 160, 207, 161, -1, 199, 162,
1761 207, 163, -1, 199, 162, 163, -1, 199, 160, 162,
1762 207, 163, 161, -1, 199, 160, 162, 163, 161, -1,
1763 199, 40, -1, 199, 41, -1, 199, 233, -1, 199,
1764 206, -1, 199, 25, -1, 171, 3, -1, 171, 5,
1765 -1, 171, 4, -1, 171, 6, -1, 11, 26, -1,
1766 11, 27, -1, 172, 9, -1, 168, 151, 205, 38,
1767 199, 152, -1, 116, 151, 205, 244, 152, -1, 130,
1768 151, 205, 154, 205, 154, 205, 152, -1, 166, 151,
1769 205, 154, 205, 152, -1, 167, 151, 205, 154, 205,
1770 152, -1, 89, 169, 151, 205, 154, 205, 152, -1,
1771 90, 170, 151, 205, 154, 205, 152, -1, 132, 151,
1772 205, 154, 205, 152, -1, 133, 151, 205, 154, 205,
1773 154, 205, 152, -1, 134, 151, 205, 154, 205, 154,
1774 205, 152, -1, 207, 154, 205, -1, 205, -1, 32,
1775 -1, 33, -1, 37, -1, -1, 201, 233, -1, 122,
1776 151, 210, 38, 199, 152, -1, 212, -1, -1, 213,
1777 -1, 212, 213, -1, -1, 31, 214, 229, -1, -1,
1778 30, 215, 230, -1, 59, 58, 219, -1, 176, 18,
1779 199, -1, 176, 18, 10, -1, -1, 178, 182, 209,
1780 208, 205, 175, 216, 196, -1, -1, 178, 180, 182,
1781 209, 208, 205, 175, 217, 196, -1, -1, 178, 181,
1782 182, 209, 208, 199, 175, 218, 196, -1, 178, 182,
1783 35, 185, 210, -1, 51, 220, -1, 55, 153, 221,
1784 -1, 22, -1, 52, 153, 22, -1, 67, 153, 22,
1785 -1, 157, 222, 159, -1, 222, 154, 22, -1, 22,
1786 -1, -1, 223, 154, 199, 188, 174, -1, 199, 188,
1787 174, -1, 223, -1, 223, 154, 39, -1, 39, -1,
1788 -1, 186, 201, 177, 151, 224, 152, 190, 195, 192,
1789 191, -1, 28, -1, 162, -1, 184, 182, 225, 226,
1790 -1, 29, -1, 163, -1, 236, 228, -1, 183, 182,
1791 225, -1, -1, 60, -1, 3, -1, 4, -1, 9,
Chris Lattner38905612008-02-19 04:36:25 +00001792 -1, 26, -1, 27, -1, 40, -1, 41, -1, 25,
Devang Patel5a970972008-02-19 22:27:01 +00001793 -1, 160, 207, 161, -1, 206, -1, 58, 231, 22,
1794 154, 22, -1, 7, -1, 8, -1, 173, -1, 177,
1795 -1, 233, -1, 232, -1, 199, 234, -1, 236, 237,
1796 -1, 227, 237, -1, 238, 176, 239, -1, 238, 241,
1797 -1, -1, 21, -1, 68, 235, -1, 68, 10, -1,
1798 69, 17, 234, -1, 69, 11, 234, 154, 17, 234,
1799 154, 17, 234, -1, 70, 171, 234, 154, 17, 234,
1800 157, 240, 159, -1, 70, 171, 234, 154, 17, 234,
1801 157, 159, -1, 71, 186, 201, 234, 151, 243, 152,
1802 190, 38, 17, 234, 72, 17, 234, -1, 72, -1,
1803 73, -1, 240, 171, 232, 154, 17, 234, -1, 171,
1804 232, 154, 17, 234, -1, 176, 246, -1, 199, 157,
1805 234, 154, 234, 159, -1, 242, 154, 157, 234, 154,
1806 234, 159, -1, 199, 188, 234, 188, -1, 17, 188,
1807 234, 188, -1, 243, 154, 199, 188, 234, 188, -1,
1808 243, 154, 17, 188, 234, 188, -1, -1, -1, 244,
1809 154, 235, -1, 57, 56, -1, 56, -1, 166, 199,
1810 234, 154, 234, -1, 167, 199, 234, 154, 234, -1,
1811 89, 169, 199, 234, 154, 234, -1, 90, 170, 199,
1812 234, 154, 234, -1, 168, 235, 38, 199, -1, 130,
1813 235, 154, 235, 154, 235, -1, 131, 235, 154, 199,
1814 -1, 132, 235, 154, 235, -1, 133, 235, 154, 235,
1815 154, 235, -1, 134, 235, 154, 235, 154, 235, -1,
1816 129, 242, -1, 245, 186, 201, 234, 151, 243, 152,
1817 190, -1, 248, -1, 36, -1, -1, 111, 199, 193,
1818 -1, 111, 199, 154, 11, 234, 193, -1, 112, 199,
1819 193, -1, 112, 199, 154, 11, 234, 193, -1, 113,
1820 235, -1, 247, 114, 199, 234, 193, -1, 247, 115,
1821 235, 154, 199, 234, 193, -1, 135, 199, 173, 154,
Devang Patel4c3f8442008-02-20 19:13:10 +00001822 4, -1, 116, 199, 234, 244, -1
Chris Lattner38905612008-02-19 04:36:25 +00001823};
1824
1825/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
1826static const yytype_uint16 yyrline[] =
1827{
Anton Korobeynikovc70d7732008-02-20 12:10:37 +00001828 0, 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1113,
1829 1113, 1114, 1114, 1114, 1114, 1114, 1114, 1115, 1115, 1115,
1830 1115, 1115, 1115, 1116, 1116, 1116, 1116, 1116, 1116, 1119,
1831 1119, 1120, 1120, 1121, 1121, 1122, 1122, 1123, 1123, 1127,
1832 1127, 1128, 1128, 1129, 1129, 1130, 1130, 1131, 1131, 1132,
1833 1132, 1133, 1133, 1134, 1135, 1140, 1141, 1141, 1141, 1141,
1834 1141, 1143, 1143, 1143, 1144, 1144, 1146, 1147, 1151, 1155,
1835 1160, 1160, 1162, 1163, 1168, 1174, 1175, 1176, 1177, 1178,
1836 1182, 1183, 1184, 1188, 1189, 1190, 1191, 1195, 1196, 1197,
1837 1201, 1202, 1203, 1204, 1205, 1209, 1210, 1211, 1214, 1215,
1838 1216, 1217, 1218, 1219, 1220, 1227, 1228, 1229, 1230, 1231,
1839 1232, 1233, 1234, 1235, 1238, 1239, 1244, 1245, 1246, 1247,
1840 1248, 1249, 1252, 1253, 1258, 1259, 1266, 1267, 1273, 1274,
1841 1283, 1291, 1292, 1297, 1298, 1299, 1304, 1317, 1317, 1317,
1842 1317, 1317, 1317, 1317, 1320, 1324, 1328, 1335, 1340, 1348,
1843 1378, 1403, 1408, 1418, 1428, 1432, 1442, 1449, 1458, 1465,
1844 1470, 1475, 1482, 1483, 1490, 1497, 1505, 1511, 1523, 1551,
1845 1567, 1594, 1622, 1648, 1668, 1694, 1714, 1726, 1733, 1799,
1846 1809, 1819, 1825, 1835, 1841, 1851, 1856, 1861, 1874, 1886,
1847 1908, 1916, 1922, 1933, 1938, 1943, 1949, 1955, 1964, 1968,
1848 1976, 1976, 1979, 1979, 1982, 1994, 2015, 2020, 2028, 2029,
1849 2033, 2033, 2037, 2037, 2040, 2043, 2067, 2079, 2078, 2090,
1850 2089, 2099, 2098, 2109, 2149, 2152, 2158, 2168, 2172, 2177,
1851 2179, 2184, 2189, 2198, 2208, 2219, 2223, 2232, 2241, 2246,
1852 2380, 2380, 2382, 2391, 2391, 2393, 2398, 2410, 2414, 2419,
1853 2423, 2427, 2431, 2435, 2439, 2443, 2447, 2451, 2476, 2480,
1854 2490, 2494, 2498, 2503, 2510, 2510, 2516, 2525, 2529, 2538,
1855 2547, 2556, 2560, 2567, 2571, 2575, 2580, 2590, 2609, 2618,
1856 2709, 2713, 2720, 2731, 2744, 2754, 2765, 2775, 2786, 2794,
1857 2804, 2811, 2814, 2815, 2822, 2826, 2831, 2847, 2864, 2878,
1858 2892, 2904, 2912, 2919, 2925, 2931, 2937, 2952, 3050, 3055,
1859 3059, 3066, 3073, 3081, 3088, 3096, 3104, 3118, 3135, 3143
Chris Lattner38905612008-02-19 04:36:25 +00001860};
1861#endif
1862
1863#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1864/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1865 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1866static const char *const yytname[] =
1867{
1868 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
1869 "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
1870 "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
1871 "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
1872 "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
1873 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1874 "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
1875 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1876 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1877 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "ADDRSPACE", "DEPLIBS", "CALL",
1878 "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1879 "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK",
1880 "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE",
1881 "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM",
1882 "AND", "OR", "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "EQ", "NE",
1883 "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE",
1884 "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC",
1885 "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT",
1886 "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI",
1887 "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK", "SELECT", "VAARG",
Devang Patel5a970972008-02-19 22:27:01 +00001888 "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", "GETRESULT",
1889 "SIGNEXT", "ZEROEXT", "NORETURN", "INREG", "SRET", "NOUNWIND", "NOALIAS",
1890 "BYVAL", "NEST", "READNONE", "READONLY", "GC", "DEFAULT", "HIDDEN",
1891 "PROTECTED", "'('", "')'", "'='", "','", "'*'", "'\\\\'", "'['", "'x'",
1892 "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept", "ArithmeticOps",
1893 "LogicalOps", "CastOps", "IPredicates", "FPredicates", "IntType",
1894 "FPType", "LocalName", "OptLocalName", "OptAddrSpace", "OptLocalAssign",
1895 "GlobalName", "OptGlobalAssign", "GlobalAssign", "GVInternalLinkage",
Chris Lattner38905612008-02-19 04:36:25 +00001896 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1897 "FunctionDefineLinkage", "AliasLinkage", "OptCallingConv", "ParamAttr",
1898 "OptParamAttrs", "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign",
1899 "OptCAlign", "SectionString", "OptSection", "GlobalVarAttributes",
1900 "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
1901 "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
1902 "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
1903 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1904 "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
1905 "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
1906 "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1907 "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList",
1908 "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst",
1909 "PHIList", "ParamList", "IndexList", "OptTailCall", "InstVal",
1910 "OptVolatile", "MemoryInst", 0
1911};
1912#endif
1913
1914# ifdef YYPRINT
1915/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1916 token YYLEX-NUM. */
1917static const yytype_uint16 yytoknum[] =
1918{
1919 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1920 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1921 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1922 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1923 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1924 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1925 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1926 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1927 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1928 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1929 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1930 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1931 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1932 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1933 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
Devang Patel5a970972008-02-19 22:27:01 +00001934 405, 40, 41, 61, 44, 42, 92, 91, 120, 93,
1935 60, 62, 123, 125, 99
Chris Lattner38905612008-02-19 04:36:25 +00001936};
1937# endif
1938
1939/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1940static const yytype_uint8 yyr1[] =
1941{
Devang Patel5a970972008-02-19 22:27:01 +00001942 0, 165, 166, 166, 166, 166, 166, 166, 166, 166,
1943 166, 167, 167, 167, 167, 167, 167, 168, 168, 168,
Chris Lattner38905612008-02-19 04:36:25 +00001944 168, 168, 168, 168, 168, 168, 168, 168, 168, 169,
Devang Patel5a970972008-02-19 22:27:01 +00001945 169, 169, 169, 169, 169, 169, 169, 169, 169, 170,
1946 170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
1947 170, 170, 170, 170, 170, 171, 172, 172, 172, 172,
1948 172, 173, 173, 173, 174, 174, 175, 175, 176, 176,
1949 177, 177, 178, 178, 179, 180, 180, 180, 180, 180,
1950 181, 181, 181, 182, 182, 182, 182, 183, 183, 183,
1951 184, 184, 184, 184, 184, 185, 185, 185, 186, 186,
1952 186, 186, 186, 186, 186, 187, 187, 187, 187, 187,
1953 187, 187, 187, 187, 188, 188, 189, 189, 189, 189,
1954 189, 189, 190, 190, 191, 191, 192, 192, 193, 193,
1955 194, 195, 195, 196, 196, 197, 197, 198, 198, 198,
1956 198, 198, 198, 198, 199, 199, 199, 199, 199, 199,
1957 199, 199, 199, 199, 199, 199, 199, 200, 201, 201,
1958 202, 202, 203, 203, 203, 203, 204, 204, 205, 205,
1959 205, 205, 205, 205, 205, 205, 205, 205, 205, 205,
Chris Lattner38905612008-02-19 04:36:25 +00001960 205, 205, 205, 205, 205, 205, 205, 205, 206, 206,
Devang Patel5a970972008-02-19 22:27:01 +00001961 206, 206, 206, 206, 206, 206, 206, 206, 207, 207,
1962 208, 208, 209, 209, 210, 210, 211, 211, 212, 212,
1963 214, 213, 215, 213, 213, 213, 213, 216, 213, 217,
1964 213, 218, 213, 213, 213, 213, 219, 220, 220, 221,
1965 222, 222, 222, 223, 223, 224, 224, 224, 224, 225,
1966 226, 226, 227, 228, 228, 229, 230, 231, 231, 232,
1967 232, 232, 232, 232, 232, 232, 232, 232, 232, 232,
1968 233, 233, 233, 233, 234, 234, 235, 236, 236, 237,
1969 238, 238, 238, 239, 239, 239, 239, 239, 239, 239,
1970 239, 239, 240, 240, 241, 242, 242, 243, 243, 243,
1971 243, 243, 244, 244, 245, 245, 246, 246, 246, 246,
1972 246, 246, 246, 246, 246, 246, 246, 246, 246, 247,
1973 247, 248, 248, 248, 248, 248, 248, 248, 248, 248
Chris Lattner38905612008-02-19 04:36:25 +00001974};
1975
1976/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1977static const yytype_uint8 yyr2[] =
1978{
1979 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1980 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1981 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1982 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1983 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1984 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1985 1, 1, 1, 1, 1, 0, 4, 0, 2, 0,
1986 1, 1, 1, 0, 2, 1, 1, 1, 1, 1,
1987 1, 1, 1, 0, 1, 1, 1, 0, 1, 1,
1988 0, 1, 1, 1, 1, 0, 1, 1, 0, 1,
1989 1, 1, 1, 1, 2, 1, 1, 1, 1, 1,
1990 1, 1, 1, 1, 0, 2, 1, 1, 1, 1,
1991 1, 1, 0, 2, 0, 2, 0, 2, 0, 3,
1992 2, 0, 1, 0, 3, 1, 2, 1, 1, 1,
1993 1, 1, 1, 1, 1, 1, 3, 1, 2, 5,
1994 5, 5, 5, 3, 2, 5, 4, 2, 1, 1,
1995 1, 3, 1, 3, 1, 0, 1, 3, 4, 3,
1996 3, 4, 4, 3, 6, 5, 2, 2, 2, 2,
1997 2, 2, 2, 2, 2, 2, 2, 2, 6, 5,
1998 8, 6, 6, 7, 7, 6, 8, 8, 3, 1,
1999 1, 1, 1, 0, 2, 6, 1, 0, 1, 2,
2000 0, 3, 0, 3, 3, 3, 3, 0, 8, 0,
2001 9, 0, 9, 5, 2, 3, 1, 3, 3, 3,
2002 3, 1, 0, 5, 3, 1, 3, 1, 0, 10,
2003 1, 1, 4, 1, 1, 2, 3, 0, 1, 1,
2004 1, 1, 1, 1, 1, 1, 1, 3, 1, 5,
2005 1, 1, 1, 1, 1, 1, 2, 2, 2, 3,
2006 2, 0, 1, 2, 2, 3, 9, 9, 8, 14,
2007 1, 1, 6, 5, 2, 6, 7, 4, 4, 6,
2008 6, 0, 0, 3, 2, 1, 5, 5, 6, 6,
2009 4, 6, 4, 4, 6, 6, 2, 8, 1, 1,
Devang Patel5a970972008-02-19 22:27:01 +00002010 0, 3, 6, 3, 6, 2, 5, 7, 5, 4
Chris Lattner38905612008-02-19 04:36:25 +00002011};
2012
2013/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
2014 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
2015 means the default is an error. */
2016static const yytype_uint16 yydefact[] =
2017{
2018 73, 61, 70, 62, 71, 63, 212, 210, 0, 0,
2019 0, 0, 0, 0, 83, 72, 0, 73, 208, 87,
2020 90, 0, 0, 224, 0, 0, 68, 0, 74, 75,
2021 77, 76, 78, 80, 79, 81, 82, 84, 85, 86,
2022 83, 83, 203, 1, 209, 88, 89, 83, 213, 91,
2023 92, 93, 94, 83, 271, 211, 271, 0, 0, 232,
2024 225, 226, 214, 260, 261, 216, 137, 138, 139, 142,
2025 141, 140, 143, 144, 0, 0, 0, 0, 262, 263,
2026 145, 215, 147, 203, 203, 95, 202, 0, 98, 98,
2027 272, 268, 69, 243, 244, 245, 267, 227, 228, 231,
2028 0, 165, 148, 0, 0, 0, 0, 154, 166, 0,
2029 0, 165, 0, 0, 0, 97, 96, 0, 200, 201,
2030 0, 0, 99, 100, 101, 102, 103, 0, 246, 0,
2031 310, 270, 0, 229, 164, 114, 160, 162, 0, 0,
2032 0, 0, 0, 0, 153, 0, 0, 146, 0, 0,
2033 159, 0, 158, 0, 223, 137, 138, 139, 142, 141,
2034 140, 0, 0, 67, 67, 104, 0, 240, 241, 242,
2035 309, 295, 0, 0, 0, 0, 98, 280, 281, 2,
2036 3, 4, 5, 6, 7, 8, 9, 10, 14, 15,
2037 16, 11, 12, 13, 0, 0, 0, 0, 0, 0,
2038 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
2039 27, 28, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patel5a970972008-02-19 22:27:01 +00002040 0, 0, 269, 98, 284, 0, 308, 230, 157, 0,
2041 122, 67, 67, 156, 0, 167, 0, 122, 67, 67,
2042 0, 204, 185, 186, 181, 183, 182, 184, 187, 180,
2043 176, 177, 0, 0, 0, 0, 0, 0, 0, 0,
2044 0, 0, 0, 0, 0, 0, 179, 178, 217, 0,
2045 294, 274, 67, 273, 0, 0, 55, 0, 0, 29,
2046 30, 31, 32, 33, 34, 35, 36, 37, 38, 0,
2047 53, 54, 49, 50, 51, 52, 39, 40, 41, 42,
2048 43, 44, 45, 46, 47, 48, 0, 128, 128, 315,
2049 67, 67, 306, 0, 0, 0, 0, 0, 67, 67,
2050 67, 0, 0, 0, 0, 106, 108, 107, 105, 109,
2051 110, 111, 112, 113, 115, 163, 161, 150, 151, 152,
2052 155, 66, 149, 219, 221, 0, 0, 0, 0, 0,
2053 0, 0, 0, 169, 199, 0, 0, 0, 173, 0,
2054 170, 0, 0, 0, 133, 238, 249, 250, 251, 256,
2055 252, 253, 254, 255, 247, 0, 258, 265, 264, 266,
2056 0, 275, 0, 0, 67, 67, 0, 311, 0, 313,
2057 292, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2058 0, 0, 0, 67, 0, 119, 118, 116, 117, 120,
2059 121, 123, 133, 133, 0, 0, 0, 292, 0, 0,
2060 0, 0, 0, 168, 154, 166, 0, 171, 172, 0,
2061 0, 0, 0, 218, 237, 114, 235, 0, 248, 0,
2062 0, 0, 0, 0, 0, 0, 0, 0, 0, 319,
2063 0, 0, 0, 302, 303, 0, 0, 0, 0, 0,
2064 300, 0, 128, 0, 220, 222, 67, 0, 0, 0,
2065 0, 0, 0, 0, 198, 175, 0, 0, 0, 0,
2066 0, 0, 135, 133, 65, 0, 122, 0, 257, 0,
2067 0, 291, 0, 0, 128, 129, 128, 0, 0, 0,
2068 0, 0, 0, 318, 296, 297, 291, 0, 316, 67,
2069 205, 0, 0, 189, 0, 0, 0, 0, 174, 0,
2070 0, 67, 130, 136, 134, 64, 234, 236, 114, 131,
2071 0, 0, 0, 114, 114, 0, 298, 299, 312, 314,
2072 293, 0, 0, 301, 304, 305, 0, 128, 0, 0,
2073 0, 195, 0, 0, 191, 192, 188, 65, 132, 126,
2074 259, 0, 0, 0, 0, 122, 0, 285, 0, 122,
2075 317, 193, 194, 0, 0, 0, 233, 0, 124, 0,
2076 278, 0, 0, 106, 108, 114, 114, 0, 114, 114,
2077 286, 307, 190, 196, 197, 127, 0, 239, 276, 0,
2078 277, 0, 288, 287, 0, 0, 0, 125, 0, 0,
2079 0, 114, 114, 0, 0, 0, 290, 289, 283, 0,
2080 0, 282, 0, 279
Chris Lattner38905612008-02-19 04:36:25 +00002081};
2082
2083/* YYDEFGOTO[NTERM-NUM]. */
2084static const yytype_int16 yydefgoto[] =
2085{
Devang Patel5a970972008-02-19 22:27:01 +00002086 -1, 263, 264, 265, 289, 306, 161, 162, 78, 526,
Chris Lattner38905612008-02-19 04:36:25 +00002087 112, 12, 79, 14, 15, 40, 41, 42, 47, 53,
Devang Patel5a970972008-02-19 22:27:01 +00002088 117, 127, 334, 228, 411, 337, 597, 578, 387, 482,
2089 559, 433, 483, 80, 163, 136, 153, 137, 138, 109,
2090 354, 376, 355, 120, 87, 154, 16, 17, 18, 20,
2091 19, 364, 412, 413, 62, 23, 60, 100, 436, 437,
2092 128, 169, 54, 95, 55, 48, 439, 377, 82, 379,
2093 273, 56, 91, 92, 222, 582, 131, 312, 535, 449,
2094 223, 224, 225, 226
Chris Lattner38905612008-02-19 04:36:25 +00002095};
2096
2097/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
2098 STATE-NUM. */
Devang Patel5a970972008-02-19 22:27:01 +00002099#define YYPACT_NINF -566
Chris Lattner38905612008-02-19 04:36:25 +00002100static const yytype_int16 yypact[] =
2101{
Devang Patel5a970972008-02-19 22:27:01 +00002102 331, -566, -566, -566, -566, -566, -566, -566, -9, -100,
2103 18, -71, 93, 30, 60, -566, 155, 403, -566, 193,
2104 186, 62, 87, -566, 120, 228, -566, 1521, -566, -566,
2105 -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,
2106 63, 63, 223, -566, -566, -566, -566, 63, -566, -566,
2107 -566, -566, -566, 63, 258, -566, -11, 259, 260, 263,
2108 -566, -566, -566, -566, -566, 136, -566, -566, -566, -566,
2109 -566, -566, -566, -566, 284, 287, 1, 710, -566, -566,
2110 -566, -31, -566, 255, 255, 217, -566, 57, 34, 34,
2111 -566, -566, 177, -566, -566, -566, -566, -566, -566, -566,
2112 -88, 1304, -566, 135, 137, 750, 136, -566, -31, -102,
2113 143, 1304, 144, 57, 57, -566, -566, 1347, -566, -566,
2114 1579, 296, -566, -566, -566, -566, -566, 1619, -566, -17,
2115 1790, -566, 281, -566, -566, -31, -566, 150, 153, 1637,
2116 1637, 145, -99, 1637, -566, 303, 164, -566, 1579, 1637,
2117 136, 166, -31, 302, -566, 240, 311, 314, 318, 325,
2118 328, 251, 332, 1074, 286, -566, 128, -566, -566, -566,
2119 -566, -566, 288, 1677, 20, 336, 34, -566, -566, -566,
2120 -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,
2121 -566, -566, -566, -566, 349, 1159, 1637, 1637, 1637, 1637,
2122 -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,
2123 -566, -566, 1637, 1637, 1637, 1637, 1637, 1637, 1637, 1637,
2124 1637, 1637, -566, 34, -566, 53, -566, -566, -56, 1365,
Devang Patel4c3f8442008-02-20 19:13:10 +00002125 -566, -22, -39, -566, 181, -31, 191, -566, 286, -21,
Devang Patel5a970972008-02-19 22:27:01 +00002126 1347, -566, -566, -566, -566, -566, -566, -566, -566, -566,
Devang Patel4c3f8442008-02-20 19:13:10 +00002127 -566, -566, 349, 1159, 197, 201, 209, 214, 215, 1405,
2128 1695, 973, 350, 222, 227, 230, -566, -566, -566, 232,
Devang Patel5a970972008-02-19 22:27:01 +00002129 -566, 136, 661, -566, 800, 800, -566, 800, 1619, -566,
2130 -566, -566, -566, -566, -566, -566, -566, -566, -566, 1637,
2131 -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,
2132 -566, -566, -566, -566, -566, -566, 1637, -13, -5, -566,
Devang Patel4c3f8442008-02-20 19:13:10 +00002133 661, -32, 220, 233, 237, 241, 245, 247, 5, 661,
2134 661, 346, 1619, 1637, 1637, -566, -566, -566, -566, -566,
Devang Patel5a970972008-02-19 22:27:01 +00002135 -566, -566, -566, -566, -566, -566, -566, 86, -566, -566,
Devang Patel4c3f8442008-02-20 19:13:10 +00002136 -566, -566, 86, -566, 144, 364, 253, 254, 1579, 1579,
Devang Patel5a970972008-02-19 22:27:01 +00002137 1579, 1579, 1579, -566, -566, 6, 1016, -119, -566, -89,
2138 -566, 1579, 1579, 1579, 252, 1423, -566, -566, -566, -566,
Devang Patel4c3f8442008-02-20 19:13:10 +00002139 -566, -566, -566, -566, 347, 1579, -566, -566, -566, -566,
2140 256, -566, 262, 800, 661, 661, 15, -566, 19, -566,
2141 -566, 800, 257, 1637, 1637, 1637, 1637, 1637, 270, 274,
2142 276, 1637, 800, 661, 277, -566, -566, -566, -566, -566,
2143 -566, -566, 252, 252, 1637, 1579, 1579, -566, 278, 298,
2144 307, 309, 1579, -566, 295, 928, -85, -566, -566, 310,
2145 315, 370, 4, -566, -566, -31, 316, 261, -566, 395,
2146 -84, 418, 455, 322, 323, 324, 800, 475, 800, 327,
2147 329, 800, 333, -31, -566, 334, 335, 478, 800, 800,
2148 -31, 339, 337, 1637, -566, -566, -8, 340, 341, 110,
2149 1579, 1579, 1579, 1579, -566, -566, 342, 1579, 1579, 1637,
2150 463, 482, -566, 252, 556, 1463, -566, 351, -566, 800,
2151 800, 1735, 800, 800, 337, -566, 337, 1637, 800, 354,
2152 1637, 1637, 1637, -566, -566, -566, 1735, 443, -566, 661,
2153 -566, 1579, 1579, -566, 356, 352, 357, 358, -566, 361,
Devang Patel5a970972008-02-19 22:27:01 +00002154 362, 2, -566, -566, -566, -566, -566, -566, -31, 39,
2155 493, 363, 359, -15, -31, 121, -566, -566, -566, -566,
Devang Patel4c3f8442008-02-20 19:13:10 +00002156 -566, 360, 800, -566, -566, -566, 122, 337, 368, 369,
Devang Patel5a970972008-02-19 22:27:01 +00002157 1579, -566, 1579, 1579, -566, -566, -566, 556, -566, 471,
Devang Patel4c3f8442008-02-20 19:13:10 +00002158 -566, 508, -2, 519, 519, -566, 1793, -566, 371, -566,
2159 -566, -566, -566, 377, 379, 380, -566, 529, 387, 800,
Devang Patel5a970972008-02-19 22:27:01 +00002160 -566, 1214, 10, 384, 385, -566, -566, 80, -15, -31,
2161 -566, 86, -566, -566, -566, -566, 515, -566, -566, 393,
2162 -566, 1214, -56, -56, 531, 519, 519, -566, 532, 396,
2163 800, -566, -566, 800, 535, 481, -56, -56, -566, 800,
2164 537, -566, 800, -566
Chris Lattner38905612008-02-19 04:36:25 +00002165};
2166
2167/* YYPGOTO[NTERM-NUM]. */
2168static const yytype_int16 yypgoto[] =
2169{
Devang Patel5a970972008-02-19 22:27:01 +00002170 -566, 425, 426, 428, 312, 308, -173, -566, 0, 11,
2171 -145, 470, 8, -566, -566, -566, -566, 7, -566, -566,
2172 -566, -156, -566, -407, -566, -233, -566, -566, -296, 36,
2173 -566, -368, -566, -566, -26, 338, -120, -566, 452, 461,
2174 -114, -160, -247, 106, 185, 330, -566, -566, 552, -566,
2175 -566, -566, -566, -566, -566, -566, -566, -566, -566, -566,
2176 485, -566, -566, -566, -566, -566, -566, -565, -113, 9,
2177 -82, -566, 520, -566, -566, -566, -566, -566, 65, 162,
2178 -566, -566, -566, -566
Chris Lattner38905612008-02-19 04:36:25 +00002179};
2180
2181/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2182 positive, shift that token. If negative, reduce the rule which
2183 number is the opposite. If zero, do what YYDEFACT says.
2184 If YYTABLE_NINF, syntax error. */
2185#define YYTABLE_NINF -208
2186static const yytype_int16 yytable[] =
2187{
Devang Patel5a970972008-02-19 22:27:01 +00002188 11, 81, 277, 266, 342, 104, 164, 166, 13, 276,
2189 90, 167, 389, 357, 359, 110, 599, 11, 93, 268,
2190 278, 276, 110, 110, 1, 13, 446, 3, 484, 5,
2191 448, 274, 110, 110, 238, 422, 609, 275, 480, -143,
2192 241, 110, 427, 21, 464, 465, 110, 83, 84, 110,
2193 267, 108, 143, 24, 88, 143, 110, 481, 22, 110,
2194 89, 144, 325, 326, 234, 422, 132, 322, 447, 422,
2195 422, 133, 447, 480, 428, 135, 25, 488, 476, 108,
2196 327, 328, 26, 329, 330, 135, 331, 332, 333, 118,
2197 119, 152, 11, 343, 344, 121, 122, 123, 124, 125,
2198 126, 152, 29, 30, 31, 32, 33, 34, 35, 426,
2199 36, 27, 111, 231, 232, 524, 309, 235, 604, 111,
2200 111, 557, 339, 239, -67, 391, 563, 564, 440, 111,
2201 111, 313, 314, 315, 316, 317, -143, 338, 111, 321,
2202 -143, 386, -67, 111, 510, 168, 111, 272, 2, 388,
2203 -67, 4, 94, 111, 556, 43, 111, 580, 383, 378,
2204 422, 378, 378, 105, 378, 423, 508, 323, 324, 600,
2205 307, 308, 272, 310, 269, 405, 406, 407, 602, 603,
2206 408, 605, 606, 28, 409, 410, 311, 272, 272, 272,
2207 272, 272, 318, 319, 320, 272, 1, 378, 538, 3,
2208 539, 5, 402, 135, 616, 617, 378, 378, 37, 38,
2209 39, 37, 38, 39, 152, 57, 405, 406, 407, 148,
2210 149, 408, 405, 406, 407, 409, 410, 408, 49, 50,
2211 51, 409, 410, 52, 417, 418, 419, 420, 421, 45,
2212 58, 46, 404, -55, -55, -55, -55, 429, 430, 431,
2213 61, 570, 152, 529, 244, 245, 246, 247, 85, 115,
2214 86, 116, 513, 384, 497, 266, 242, 243, 113, 114,
2215 378, 378, 378, 565, 569, 566, 566, 59, 378, 90,
2216 385, 97, 98, 380, 381, 99, 382, 101, 102, 378,
2217 378, 103, 86, 139, 145, 140, 152, 403, 272, 147,
2218 165, 467, 468, 227, 229, 230, 233, 236, 474, 63,
2219 64, 452, 267, 454, 455, 456, 237, 240, 398, 390,
2220 -56, 1, 2, -57, 3, 4, 5, -60, 399, 400,
2221 425, -207, 587, 378, -59, 378, 591, -58, 378, 435,
Devang Patel4c3f8442008-02-20 19:13:10 +00002222 110, 248, 340, 341, 270, 378, 378, 276, 348, -69,
2223 1, 2, 349, 3, 4, 5, 514, 515, 516, 517,
2224 350, 6, 7, 519, 520, 351, 352, 272, 453, 272,
2225 272, 272, 360, 361, 392, 460, 378, 378, 362, 378,
2226 378, 363, 8, 365, 401, 378, 9, 393, 466, 581,
2227 10, 394, 443, 444, 445, 395, 378, 548, 549, 396,
2228 450, 397, 414, -206, 415, 416, 432, 438, 479, 601,
2229 441, 461, 462, 486, 451, 540, 442, 487, 543, 544,
2230 545, -69, 1, 2, 457, 3, 4, 5, 458, 378,
2231 459, 463, 470, 6, 7, 489, 573, 509, 574, 575,
Devang Patel5a970972008-02-19 22:27:01 +00002232 279, 280, 281, 282, 283, 284, 285, 286, 287, 288,
Devang Patel4c3f8442008-02-20 19:13:10 +00002233 378, 378, 471, 521, 8, 494, 475, 496, 9, 528,
2234 499, 472, 10, 473, 477, 534, 378, 504, 505, 478,
2235 485, 272, 490, 491, 272, 272, 272, 492, 493, 495,
2236 534, 497, 503, 498, 525, 522, 523, 500, 501, 502,
2237 506, 507, 378, 378, 511, 512, 447, 378, 531, 532,
2238 378, 536, 537, 518, 551, 530, 378, 541, 542, 378,
Devang Patel5a970972008-02-19 22:27:01 +00002239 550, 552, 553, 554, 555, 560, 562, 561, 547, 567,
Devang Patel4c3f8442008-02-20 19:13:10 +00002240 571, 572, 366, 367, 577, 579, 63, 64, 368, 592,
2241 590, 593, 594, 595, 596, -18, -19, 607, 1, 2,
Devang Patel5a970972008-02-19 22:27:01 +00002242 589, 3, 4, 5, 369, 370, 371, 608, 610, 613,
2243 614, 568, 619, 620, 622, 219, 220, 525, 221, 372,
2244 373, 347, 130, 146, 346, 558, 142, 336, 576, 44,
2245 345, 546, 585, 586, 129, 1, 96, 374, 3, 469,
2246 5, 0, 0, 0, 0, 0, 0, 0, 598, 0,
2247 0, 0, 0, 179, 180, 181, 182, 183, 184, 185,
2248 186, 187, 188, 189, 190, 191, 192, 193, 252, 253,
2249 0, 0, 0, 0, 611, 612, 0, 0, 0, 615,
2250 0, 0, 618, 0, 0, 0, 0, 0, 621, 0,
2251 0, 623, 0, 0, 0, 254, 200, 583, 584, 203,
2252 204, 205, 206, 207, 208, 209, 210, 211, 0, 255,
2253 0, 256, 257, 258, 0, 327, 328, 0, 329, 330,
2254 0, 331, 332, 333, 366, 367, 0, 0, 63, 64,
2255 368, 0, 0, 0, 325, 326, 0, 0, 0, 375,
2256 1, 2, 0, 3, 4, 5, 369, 370, 371, 0,
2257 0, 0, 327, 328, 0, 329, 330, 0, 331, 332,
2258 333, 372, 373, 0, 0, 0, 0, 0, 0, 0,
2259 0, 0, 0, 0, 0, 110, 0, 63, 64, 374,
2260 106, 66, 67, 68, 69, 70, 71, 72, 0, 1,
2261 2, 0, 3, 4, 5, 179, 180, 181, 182, 183,
2262 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
2263 252, 253, 0, 0, 0, 0, 0, 63, 64, 73,
2264 106, 66, 67, 68, 69, 70, 71, 72, 0, 1,
2265 2, 0, 3, 4, 5, 0, 0, 254, 200, 201,
2266 202, 203, 204, 205, 206, 207, 208, 209, 210, 211,
2267 0, 255, 0, 256, 257, 258, 0, 0, 0, 73,
2268 0, 0, 0, 366, 367, 0, 0, 63, 64, 368,
2269 0, 0, 111, 0, 0, 0, 0, 0, 0, 1,
2270 2, 375, 3, 4, 5, 369, 370, 371, 0, 0,
Chris Lattner38905612008-02-19 04:36:25 +00002271 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patel5a970972008-02-19 22:27:01 +00002272 372, 373, 0, 0, 0, 0, 0, 0, 0, 0,
2273 0, 0, 0, 0, 0, 0, 0, 0, 374, 0,
2274 0, 0, 0, 0, 0, 0, 74, 75, 0, 0,
2275 76, 0, 77, 107, 179, 180, 181, 182, 183, 184,
2276 185, 186, 187, 188, 189, 190, 191, 192, 193, 252,
2277 253, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2278 0, 0, 0, 0, 0, 0, 74, 75, 0, 0,
2279 76, 0, 77, 141, 0, 0, 254, 200, 201, 202,
Chris Lattner38905612008-02-19 04:36:25 +00002280 203, 204, 205, 206, 207, 208, 209, 210, 211, 0,
Devang Patel5a970972008-02-19 22:27:01 +00002281 255, 0, 256, 257, 258, 63, 64, 0, 0, 0,
2282 0, 0, 0, 0, 0, 0, 0, 1, 2, 0,
2283 3, 4, 5, 249, 0, 0, 0, 0, 0, 0,
2284 375, 0, 0, 0, 0, 0, 0, 0, 250, 251,
Chris Lattner38905612008-02-19 04:36:25 +00002285 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patel5a970972008-02-19 22:27:01 +00002286 63, 64, 110, 106, 155, 156, 157, 158, 159, 160,
2287 72, 0, 1, 2, 0, 3, 4, 5, 0, 0,
2288 0, 0, 179, 180, 181, 182, 183, 184, 185, 186,
2289 187, 188, 189, 190, 191, 192, 193, 252, 253, 0,
2290 0, 0, 73, 63, 64, 0, 106, 155, 156, 157,
2291 158, 159, 160, 72, 0, 1, 2, 0, 3, 4,
2292 5, 0, 0, 0, 254, 200, 201, 202, 203, 204,
2293 205, 206, 207, 208, 209, 210, 211, 0, 255, 0,
2294 256, 257, 258, 0, 0, 73, 0, 0, 0, 0,
2295 0, 0, 0, 0, 0, 0, 0, 0, 0, 111,
2296 0, 63, 64, -67, 0, 259, 0, 0, 260, 0,
2297 261, 0, 262, 1, 2, 0, 3, 4, 5, 249,
2298 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2299 0, 0, 0, 0, 250, 251, 0, 0, 0, 0,
2300 0, 0, 0, 0, 0, 0, 0, 0, 110, 74,
2301 75, 0, 0, 76, 0, 77, 358, 0, 0, 0,
2302 0, 0, 0, 0, 0, 0, 0, 0, 179, 180,
2303 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
2304 191, 192, 193, 252, 253, 0, 0, 0, 0, 0,
2305 0, 0, 74, 75, 0, 0, 76, 0, 77, 424,
2306 0, 0, 0, 0, 0, 290, 291, 0, 0, 0,
2307 254, 200, 201, 202, 203, 204, 205, 206, 207, 208,
2308 209, 210, 211, 0, 255, 0, 256, 257, 258, 0,
2309 0, 0, 0, 0, 0, 0, 0, 366, 367, 0,
2310 0, 0, 0, 368, 0, 111, 0, 0, 0, 0,
2311 0, 259, 0, 0, 260, 0, 261, 0, 262, 369,
2312 370, 371, 0, 0, 0, 0, 0, 0, 0, 0,
2313 0, 0, 0, 0, 372, 373, 292, 293, 294, 295,
2314 296, 297, 298, 299, 300, 301, 302, 303, 304, 305,
2315 0, 0, 374, 0, 0, 0, 0, 0, 0, 0,
2316 0, 0, 0, 0, 0, 0, 0, 0, 179, 180,
2317 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
2318 191, 192, 193, 252, 253, 0, 0, 0, 0, 0,
2319 0, 63, 64, 0, 106, 66, 67, 68, 69, 70,
2320 71, 72, 0, 1, 2, 0, 3, 4, 5, 0,
2321 254, 200, 201, 202, 203, 204, 205, 206, 207, 208,
2322 209, 210, 211, 134, 255, 0, 256, 257, 258, 0,
2323 0, 0, 0, 73, 63, 64, 0, 150, 66, 67,
Chris Lattner38905612008-02-19 04:36:25 +00002324 68, 69, 70, 71, 72, 0, 1, 2, 0, 3,
Devang Patel5a970972008-02-19 22:27:01 +00002325 4, 5, 63, 64, 375, 106, 66, 67, 68, 69,
2326 70, 71, 72, 0, 1, 2, 0, 3, 4, 5,
Chris Lattner38905612008-02-19 04:36:25 +00002327 0, 0, 0, 0, 0, 0, 73, 0, 0, 0,
Devang Patel5a970972008-02-19 22:27:01 +00002328 0, 0, 0, 0, 335, 0, 0, 0, 0, 0,
2329 0, 0, 63, 64, 73, 106, 155, 156, 157, 158,
2330 159, 160, 72, 0, 1, 2, 0, 3, 4, 5,
2331 63, 64, 0, 106, 66, 67, 68, 69, 70, 71,
2332 72, 0, 1, 2, 0, 3, 4, 5, 0, 0,
Chris Lattner38905612008-02-19 04:36:25 +00002333 0, 0, 0, 0, 73, 0, 0, 0, 0, 0,
Devang Patel5a970972008-02-19 22:27:01 +00002334 74, 75, 434, 0, 76, 0, 77, 0, 0, 151,
2335 63, 64, 73, 106, 66, 67, 68, 69, 70, 71,
2336 72, 0, 1, 2, 0, 3, 4, 5, 0, 0,
Chris Lattner38905612008-02-19 04:36:25 +00002337 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patel5a970972008-02-19 22:27:01 +00002338 0, 0, 527, 74, 75, 0, 0, 76, 0, 77,
2339 0, 0, 73, 0, 0, 0, 0, 0, 0, 0,
2340 0, 74, 75, 0, 0, 76, 0, 77, 63, 64,
2341 0, 65, 66, 67, 68, 69, 70, 71, 72, 0,
2342 1, 2, 0, 3, 4, 5, 0, 0, 0, 0,
Chris Lattner38905612008-02-19 04:36:25 +00002343 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Devang Patel5a970972008-02-19 22:27:01 +00002344 0, 74, 75, 0, 353, 76, 0, 77, 0, 0,
2345 73, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2346 75, 0, 0, 76, 0, 77, 63, 64, 0, 106,
2347 155, 156, 157, 158, 159, 160, 72, 0, 1, 2,
2348 0, 3, 4, 5, 0, 0, 0, 0, 0, 0,
2349 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2350 75, 0, 0, 76, 0, 77, 63, 64, 73, 150,
2351 66, 67, 68, 69, 70, 71, 72, 0, 1, 2,
2352 0, 3, 4, 5, 63, 64, 0, 106, 66, 67,
2353 68, 69, 70, 71, 72, 0, 1, 2, 0, 3,
2354 4, 5, 0, 0, 0, 0, 0, 0, 73, 0,
Chris Lattner38905612008-02-19 04:36:25 +00002355 0, 0, 0, 0, 0, 0, 0, 74, 75, 0,
Devang Patel5a970972008-02-19 22:27:01 +00002356 0, 76, 0, 77, 63, 64, 73, 271, 66, 67,
2357 68, 69, 70, 71, 72, 0, 1, 2, 0, 3,
2358 4, 5, 63, 64, 0, 106, 155, 156, 157, 158,
2359 159, 160, 72, 0, 1, 2, 0, 3, 4, 5,
2360 0, 0, 0, 0, 0, 0, 73, 0, 0, 0,
Chris Lattner38905612008-02-19 04:36:25 +00002361 0, 0, 0, 0, 0, 74, 75, 0, 0, 76,
Devang Patel5a970972008-02-19 22:27:01 +00002362 0, 77, 63, 64, 73, 106, 66, 67, 68, 69,
2363 70, 71, 533, 0, 1, 2, 0, 3, 4, 5,
2364 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2365 0, 0, 0, 0, 0, 74, 75, 0, 0, 76,
2366 0, 77, 0, 0, 73, 0, 0, 0, 0, 0,
Chris Lattner38905612008-02-19 04:36:25 +00002367 0, 0, 0, 74, 75, 0, 0, 76, 0, 77,
2368 63, 64, 0, 106, 66, 67, 68, 69, 70, 71,
Devang Patel5a970972008-02-19 22:27:01 +00002369 588, 0, 1, 2, 0, 3, 4, 5, 0, 0,
2370 0, 0, 0, 0, 0, 0, 170, 0, 0, 0,
Chris Lattner38905612008-02-19 04:36:25 +00002371 0, 0, 0, 74, 75, 0, 0, 76, 0, 77,
Devang Patel5a970972008-02-19 22:27:01 +00002372 0, 0, 73, 0, 0, 0, 171, 172, 0, 0,
2373 0, 74, 75, 0, 0, 76, 0, 356, 173, 174,
2374 175, 176, 177, 178, 179, 180, 181, 182, 183, 184,
2375 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
2376 195, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Chris Lattner38905612008-02-19 04:36:25 +00002377 0, 74, 75, 0, 0, 76, 0, 77, 0, 0,
Devang Patel5a970972008-02-19 22:27:01 +00002378 0, 196, 197, 198, 0, 0, 199, 200, 201, 202,
2379 203, 204, 205, 206, 207, 208, 209, 210, 211, 212,
2380 213, 214, 215, 216, 217, 218, 0, 0, 0, 0,
2381 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2382 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
2383 75, 0, 0, 76, 0, 77
Chris Lattner38905612008-02-19 04:36:25 +00002384};
2385
2386static const yytype_int16 yycheck[] =
2387{
Devang Patel5a970972008-02-19 22:27:01 +00002388 0, 27, 175, 163, 237, 4, 120, 127, 0, 11,
2389 21, 28, 308, 260, 261, 54, 581, 17, 29, 164,
2390 176, 11, 54, 54, 19, 17, 11, 22, 435, 24,
2391 11, 11, 54, 54, 148, 154, 601, 17, 34, 54,
2392 153, 54, 161, 52, 412, 413, 54, 40, 41, 54,
2393 163, 77, 154, 153, 47, 154, 54, 53, 67, 54,
2394 53, 163, 118, 119, 163, 154, 154, 223, 53, 154,
2395 154, 159, 53, 34, 163, 101, 58, 161, 163, 105,
2396 136, 137, 153, 139, 140, 111, 142, 143, 144, 32,
2397 33, 117, 92, 238, 239, 61, 62, 63, 64, 65,
2398 66, 127, 42, 43, 44, 45, 46, 47, 48, 356,
2399 50, 18, 151, 139, 140, 483, 198, 143, 38, 151,
2400 151, 528, 161, 149, 155, 157, 533, 534, 375, 151,
2401 151, 213, 214, 215, 216, 217, 151, 159, 151, 221,
2402 155, 154, 155, 151, 152, 162, 151, 173, 20, 154,
2403 155, 23, 163, 151, 152, 0, 151, 159, 278, 272,
2404 154, 274, 275, 162, 277, 159, 462, 114, 115, 159,
2405 196, 197, 198, 199, 166, 136, 137, 138, 585, 586,
2406 141, 588, 589, 153, 145, 146, 212, 213, 214, 215,
2407 216, 217, 218, 219, 220, 221, 19, 310, 494, 22,
2408 496, 24, 322, 229, 611, 612, 319, 320, 148, 149,
2409 150, 148, 149, 150, 240, 153, 136, 137, 138, 113,
2410 114, 141, 136, 137, 138, 145, 146, 141, 42, 43,
2411 44, 145, 146, 47, 348, 349, 350, 351, 352, 46,
2412 153, 48, 324, 3, 4, 5, 6, 361, 362, 363,
2413 22, 547, 278, 486, 3, 4, 5, 6, 35, 42,
2414 37, 44, 152, 289, 154, 425, 26, 27, 83, 84,
2415 383, 384, 385, 152, 152, 154, 154, 157, 391, 21,
2416 306, 22, 22, 274, 275, 22, 277, 151, 4, 402,
2417 403, 4, 37, 158, 151, 158, 322, 323, 324, 155,
2418 4, 415, 416, 22, 154, 152, 161, 4, 422, 7,
2419 8, 393, 425, 395, 396, 397, 152, 151, 318, 310,
2420 9, 19, 20, 9, 22, 23, 24, 9, 319, 320,
2421 356, 0, 565, 446, 9, 448, 569, 9, 451, 365,
Devang Patel4c3f8442008-02-20 19:13:10 +00002422 54, 9, 161, 152, 56, 458, 459, 11, 151, 18,
Devang Patel5a970972008-02-19 22:27:01 +00002423 19, 20, 151, 22, 23, 24, 470, 471, 472, 473,
2424 151, 30, 31, 477, 478, 151, 151, 393, 394, 395,
Devang Patel4c3f8442008-02-20 19:13:10 +00002425 396, 397, 22, 151, 154, 401, 489, 490, 151, 492,
2426 493, 151, 51, 151, 38, 498, 55, 154, 414, 562,
Devang Patel5a970972008-02-19 22:27:01 +00002427 59, 154, 383, 384, 385, 154, 509, 511, 512, 154,
Devang Patel4c3f8442008-02-20 19:13:10 +00002428 391, 154, 38, 0, 151, 151, 154, 60, 38, 582,
2429 154, 402, 403, 152, 157, 497, 154, 22, 500, 501,
Devang Patel5a970972008-02-19 22:27:01 +00002430 502, 18, 19, 20, 154, 22, 23, 24, 154, 542,
2431 154, 154, 154, 30, 31, 17, 550, 463, 552, 553,
2432 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
2433 563, 564, 154, 479, 51, 446, 161, 448, 55, 485,
2434 451, 154, 59, 154, 154, 491, 579, 458, 459, 154,
Devang Patel4c3f8442008-02-20 19:13:10 +00002435 154, 497, 17, 151, 500, 501, 502, 154, 154, 4,
2436 506, 154, 4, 154, 484, 22, 4, 154, 154, 154,
2437 151, 154, 605, 606, 154, 154, 53, 610, 489, 490,
2438 613, 492, 493, 161, 152, 154, 619, 498, 154, 622,
Devang Patel5a970972008-02-19 22:27:01 +00002439 154, 154, 154, 152, 152, 22, 157, 154, 509, 159,
Devang Patel4c3f8442008-02-20 19:13:10 +00002440 152, 152, 3, 4, 53, 17, 7, 8, 9, 152,
2441 159, 152, 152, 4, 147, 151, 151, 22, 19, 20,
Devang Patel5a970972008-02-19 22:27:01 +00002442 566, 22, 23, 24, 25, 26, 27, 154, 17, 17,
2443 154, 542, 17, 72, 17, 130, 130, 557, 130, 40,
2444 41, 253, 92, 111, 252, 529, 105, 229, 557, 17,
2445 240, 506, 563, 564, 89, 19, 56, 58, 22, 417,
2446 24, -1, -1, -1, -1, -1, -1, -1, 579, -1,
2447 -1, -1, -1, 74, 75, 76, 77, 78, 79, 80,
Chris Lattner38905612008-02-19 04:36:25 +00002448 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
Devang Patel5a970972008-02-19 22:27:01 +00002449 -1, -1, -1, -1, 605, 606, -1, -1, -1, 610,
2450 -1, -1, 613, -1, -1, -1, -1, -1, 619, -1,
2451 -1, 622, -1, -1, -1, 116, 117, 118, 119, 120,
Chris Lattner38905612008-02-19 04:36:25 +00002452 121, 122, 123, 124, 125, 126, 127, 128, -1, 130,
Devang Patel5a970972008-02-19 22:27:01 +00002453 -1, 132, 133, 134, -1, 136, 137, -1, 139, 140,
2454 -1, 142, 143, 144, 3, 4, -1, -1, 7, 8,
2455 9, -1, -1, -1, 118, 119, -1, -1, -1, 160,
2456 19, 20, -1, 22, 23, 24, 25, 26, 27, -1,
2457 -1, -1, 136, 137, -1, 139, 140, -1, 142, 143,
2458 144, 40, 41, -1, -1, -1, -1, -1, -1, -1,
2459 -1, -1, -1, -1, -1, 54, -1, 7, 8, 58,
Chris Lattner38905612008-02-19 04:36:25 +00002460 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
Devang Patel5a970972008-02-19 22:27:01 +00002461 20, -1, 22, 23, 24, 74, 75, 76, 77, 78,
2462 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2463 89, 90, -1, -1, -1, -1, -1, 7, 8, 49,
2464 10, 11, 12, 13, 14, 15, 16, 17, -1, 19,
2465 20, -1, 22, 23, 24, -1, -1, 116, 117, 118,
2466 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
2467 -1, 130, -1, 132, 133, 134, -1, -1, -1, 49,
2468 -1, -1, -1, 3, 4, -1, -1, 7, 8, 9,
2469 -1, -1, 151, -1, -1, -1, -1, -1, -1, 19,
2470 20, 160, 22, 23, 24, 25, 26, 27, -1, -1,
Chris Lattner38905612008-02-19 04:36:25 +00002471 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2472 40, 41, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patel5a970972008-02-19 22:27:01 +00002473 -1, -1, -1, -1, -1, -1, -1, -1, 58, -1,
2474 -1, -1, -1, -1, -1, -1, 156, 157, -1, -1,
2475 160, -1, 162, 163, 74, 75, 76, 77, 78, 79,
Chris Lattner38905612008-02-19 04:36:25 +00002476 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2477 90, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patel5a970972008-02-19 22:27:01 +00002478 -1, -1, -1, -1, -1, -1, 156, 157, -1, -1,
2479 160, -1, 162, 163, -1, -1, 116, 117, 118, 119,
Chris Lattner38905612008-02-19 04:36:25 +00002480 120, 121, 122, 123, 124, 125, 126, 127, 128, -1,
Devang Patel5a970972008-02-19 22:27:01 +00002481 130, -1, 132, 133, 134, 7, 8, -1, -1, -1,
2482 -1, -1, -1, -1, -1, -1, -1, 19, 20, -1,
2483 22, 23, 24, 25, -1, -1, -1, -1, -1, -1,
2484 160, -1, -1, -1, -1, -1, -1, -1, 40, 41,
Chris Lattner38905612008-02-19 04:36:25 +00002485 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patel5a970972008-02-19 22:27:01 +00002486 7, 8, 54, 10, 11, 12, 13, 14, 15, 16,
Chris Lattner38905612008-02-19 04:36:25 +00002487 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
Devang Patel5a970972008-02-19 22:27:01 +00002488 -1, -1, 74, 75, 76, 77, 78, 79, 80, 81,
2489 82, 83, 84, 85, 86, 87, 88, 89, 90, -1,
2490 -1, -1, 49, 7, 8, -1, 10, 11, 12, 13,
2491 14, 15, 16, 17, -1, 19, 20, -1, 22, 23,
2492 24, -1, -1, -1, 116, 117, 118, 119, 120, 121,
2493 122, 123, 124, 125, 126, 127, 128, -1, 130, -1,
2494 132, 133, 134, -1, -1, 49, -1, -1, -1, -1,
2495 -1, -1, -1, -1, -1, -1, -1, -1, -1, 151,
2496 -1, 7, 8, 155, -1, 157, -1, -1, 160, -1,
2497 162, -1, 164, 19, 20, -1, 22, 23, 24, 25,
Chris Lattner38905612008-02-19 04:36:25 +00002498 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Devang Patel5a970972008-02-19 22:27:01 +00002499 -1, -1, -1, -1, 40, 41, -1, -1, -1, -1,
2500 -1, -1, -1, -1, -1, -1, -1, -1, 54, 156,
2501 157, -1, -1, 160, -1, 162, 163, -1, -1, -1,
2502 -1, -1, -1, -1, -1, -1, -1, -1, 74, 75,
Chris Lattner38905612008-02-19 04:36:25 +00002503 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2504 86, 87, 88, 89, 90, -1, -1, -1, -1, -1,
Devang Patel5a970972008-02-19 22:27:01 +00002505 -1, -1, 156, 157, -1, -1, 160, -1, 162, 163,
2506 -1, -1, -1, -1, -1, 26, 27, -1, -1, -1,
Chris Lattner38905612008-02-19 04:36:25 +00002507 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
Devang Patel5a970972008-02-19 22:27:01 +00002508 126, 127, 128, -1, 130, -1, 132, 133, 134, -1,
2509 -1, -1, -1, -1, -1, -1, -1, 3, 4, -1,
2510 -1, -1, -1, 9, -1, 151, -1, -1, -1, -1,
2511 -1, 157, -1, -1, 160, -1, 162, -1, 164, 25,
2512 26, 27, -1, -1, -1, -1, -1, -1, -1, -1,
2513 -1, -1, -1, -1, 40, 41, 97, 98, 99, 100,
2514 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
2515 -1, -1, 58, -1, -1, -1, -1, -1, -1, -1,
2516 -1, -1, -1, -1, -1, -1, -1, -1, 74, 75,
2517 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
2518 86, 87, 88, 89, 90, -1, -1, -1, -1, -1,
2519 -1, 7, 8, -1, 10, 11, 12, 13, 14, 15,
2520 16, 17, -1, 19, 20, -1, 22, 23, 24, -1,
2521 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
2522 126, 127, 128, 39, 130, -1, 132, 133, 134, -1,
2523 -1, -1, -1, 49, 7, 8, -1, 10, 11, 12,
2524 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2525 23, 24, 7, 8, 160, 10, 11, 12, 13, 14,
2526 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2527 -1, -1, -1, -1, -1, -1, 49, -1, -1, -1,
2528 -1, -1, -1, -1, 39, -1, -1, -1, -1, -1,
2529 -1, -1, 7, 8, 49, 10, 11, 12, 13, 14,
2530 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2531 7, 8, -1, 10, 11, 12, 13, 14, 15, 16,
2532 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
2533 -1, -1, -1, -1, 49, -1, -1, -1, -1, -1,
2534 156, 157, 39, -1, 160, -1, 162, -1, -1, 122,
2535 7, 8, 49, 10, 11, 12, 13, 14, 15, 16,
2536 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
2537 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2538 -1, -1, 39, 156, 157, -1, -1, 160, -1, 162,
2539 -1, -1, 49, -1, -1, -1, -1, -1, -1, -1,
2540 -1, 156, 157, -1, -1, 160, -1, 162, 7, 8,
2541 -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
2542 19, 20, -1, 22, 23, 24, -1, -1, -1, -1,
2543 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2544 -1, 156, 157, -1, 159, 160, -1, 162, -1, -1,
2545 49, -1, -1, -1, -1, -1, -1, -1, -1, 156,
2546 157, -1, -1, 160, -1, 162, 7, 8, -1, 10,
2547 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2548 -1, 22, 23, 24, -1, -1, -1, -1, -1, -1,
2549 -1, -1, -1, -1, -1, -1, -1, -1, -1, 156,
2550 157, -1, -1, 160, -1, 162, 7, 8, 49, 10,
2551 11, 12, 13, 14, 15, 16, 17, -1, 19, 20,
2552 -1, 22, 23, 24, 7, 8, -1, 10, 11, 12,
2553 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2554 23, 24, -1, -1, -1, -1, -1, -1, 49, -1,
2555 -1, -1, -1, -1, -1, -1, -1, 156, 157, -1,
2556 -1, 160, -1, 162, 7, 8, 49, 10, 11, 12,
2557 13, 14, 15, 16, 17, -1, 19, 20, -1, 22,
2558 23, 24, 7, 8, -1, 10, 11, 12, 13, 14,
2559 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2560 -1, -1, -1, -1, -1, -1, 49, -1, -1, -1,
2561 -1, -1, -1, -1, -1, 156, 157, -1, -1, 160,
2562 -1, 162, 7, 8, 49, 10, 11, 12, 13, 14,
2563 15, 16, 17, -1, 19, 20, -1, 22, 23, 24,
2564 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2565 -1, -1, -1, -1, -1, 156, 157, -1, -1, 160,
2566 -1, 162, -1, -1, 49, -1, -1, -1, -1, -1,
2567 -1, -1, -1, 156, 157, -1, -1, 160, -1, 162,
2568 7, 8, -1, 10, 11, 12, 13, 14, 15, 16,
2569 17, -1, 19, 20, -1, 22, 23, 24, -1, -1,
2570 -1, -1, -1, -1, -1, -1, 36, -1, -1, -1,
2571 -1, -1, -1, 156, 157, -1, -1, 160, -1, 162,
2572 -1, -1, 49, -1, -1, -1, 56, 57, -1, -1,
2573 -1, 156, 157, -1, -1, 160, -1, 162, 68, 69,
2574 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2575 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2576 90, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2577 -1, 156, 157, -1, -1, 160, -1, 162, -1, -1,
2578 -1, 111, 112, 113, -1, -1, 116, 117, 118, 119,
2579 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
2580 130, 131, 132, 133, 134, 135, -1, -1, -1, -1,
2581 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2582 -1, -1, -1, -1, -1, -1, -1, -1, -1, 156,
2583 157, -1, -1, 160, -1, 162
Chris Lattner38905612008-02-19 04:36:25 +00002584};
2585
2586/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2587 symbol of state STATE-NUM. */
2588static const yytype_uint8 yystos[] =
2589{
2590 0, 19, 20, 22, 23, 24, 30, 31, 51, 55,
Devang Patel5a970972008-02-19 22:27:01 +00002591 59, 173, 176, 177, 178, 179, 211, 212, 213, 215,
2592 214, 52, 67, 220, 153, 58, 153, 18, 153, 42,
2593 43, 44, 45, 46, 47, 48, 50, 148, 149, 150,
2594 180, 181, 182, 0, 213, 46, 48, 183, 230, 42,
2595 43, 44, 47, 184, 227, 229, 236, 153, 153, 157,
2596 221, 22, 219, 7, 8, 10, 11, 12, 13, 14,
2597 15, 16, 17, 49, 156, 157, 160, 162, 173, 177,
2598 198, 199, 233, 182, 182, 35, 37, 209, 182, 182,
2599 21, 237, 238, 29, 163, 228, 237, 22, 22, 22,
2600 222, 151, 4, 4, 4, 162, 10, 163, 199, 204,
2601 54, 151, 175, 209, 209, 42, 44, 185, 32, 33,
2602 208, 61, 62, 63, 64, 65, 66, 186, 225, 225,
2603 176, 241, 154, 159, 39, 199, 200, 202, 203, 158,
2604 158, 163, 204, 154, 163, 151, 203, 155, 208, 208,
2605 10, 122, 199, 201, 210, 11, 12, 13, 14, 15,
2606 16, 171, 172, 199, 205, 4, 201, 28, 162, 226,
Chris Lattner38905612008-02-19 04:36:25 +00002607 36, 56, 57, 68, 69, 70, 71, 72, 73, 74,
2608 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
2609 85, 86, 87, 88, 89, 90, 111, 112, 113, 116,
2610 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
Devang Patel5a970972008-02-19 22:27:01 +00002611 127, 128, 129, 130, 131, 132, 133, 134, 135, 166,
2612 167, 168, 239, 245, 246, 247, 248, 22, 188, 154,
2613 152, 199, 199, 161, 163, 199, 4, 152, 205, 199,
2614 151, 233, 26, 27, 3, 4, 5, 6, 9, 25,
2615 40, 41, 89, 90, 116, 130, 132, 133, 134, 157,
2616 160, 162, 164, 166, 167, 168, 206, 233, 175, 177,
2617 56, 10, 199, 235, 11, 17, 11, 171, 186, 91,
2618 92, 93, 94, 95, 96, 97, 98, 99, 100, 169,
2619 26, 27, 97, 98, 99, 100, 101, 102, 103, 104,
2620 105, 106, 107, 108, 109, 110, 170, 199, 199, 235,
2621 199, 199, 242, 235, 235, 235, 235, 235, 199, 199,
2622 199, 235, 186, 114, 115, 118, 119, 136, 137, 139,
2623 140, 142, 143, 144, 187, 39, 200, 190, 159, 161,
2624 161, 152, 190, 175, 175, 210, 169, 170, 151, 151,
2625 151, 151, 151, 159, 205, 207, 162, 207, 163, 207,
2626 22, 151, 151, 151, 216, 151, 3, 4, 9, 25,
2627 26, 27, 40, 41, 58, 160, 206, 232, 233, 234,
2628 234, 234, 234, 201, 199, 199, 154, 193, 154, 193,
2629 234, 157, 154, 154, 154, 154, 154, 154, 173, 234,
2630 234, 38, 201, 199, 235, 136, 137, 138, 141, 145,
2631 146, 189, 217, 218, 38, 151, 151, 205, 205, 205,
2632 205, 205, 154, 159, 163, 199, 207, 161, 163, 205,
2633 205, 205, 154, 196, 39, 199, 223, 224, 60, 231,
2634 207, 154, 154, 234, 234, 234, 11, 53, 11, 244,
2635 234, 157, 235, 199, 235, 235, 235, 154, 154, 154,
2636 199, 234, 234, 154, 196, 196, 199, 205, 205, 244,
2637 154, 154, 154, 154, 205, 161, 163, 154, 154, 38,
2638 34, 53, 194, 197, 188, 154, 152, 22, 161, 17,
2639 17, 151, 154, 154, 234, 4, 234, 154, 154, 234,
Devang Patel4c3f8442008-02-20 19:13:10 +00002640 154, 154, 154, 4, 234, 234, 151, 154, 193, 199,
Devang Patel5a970972008-02-19 22:27:01 +00002641 152, 154, 154, 152, 205, 205, 205, 205, 161, 205,
2642 205, 199, 22, 4, 196, 173, 174, 39, 199, 190,
2643 154, 234, 234, 17, 199, 243, 234, 234, 193, 193,
2644 235, 234, 154, 235, 235, 235, 243, 234, 205, 205,
2645 154, 152, 154, 154, 152, 152, 152, 188, 194, 195,
2646 22, 154, 157, 188, 188, 152, 154, 159, 234, 152,
2647 193, 152, 152, 205, 205, 205, 174, 53, 192, 17,
2648 159, 171, 240, 118, 119, 234, 234, 190, 17, 199,
2649 159, 190, 152, 152, 152, 4, 147, 191, 234, 232,
2650 159, 171, 188, 188, 38, 188, 188, 22, 154, 232,
2651 17, 234, 234, 17, 154, 234, 188, 188, 234, 17,
2652 72, 234, 17, 234
Chris Lattner38905612008-02-19 04:36:25 +00002653};
David Greene718fda32007-08-01 03:59:32 +00002654
Reid Spencer68a24bd2005-08-27 18:50:39 +00002655#define yyerrok (yyerrstatus = 0)
2656#define yyclearin (yychar = YYEMPTY)
Chris Lattner38905612008-02-19 04:36:25 +00002657#define YYEMPTY (-2)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002658#define YYEOF 0
Chris Lattner38905612008-02-19 04:36:25 +00002659
Reid Spencer68a24bd2005-08-27 18:50:39 +00002660#define YYACCEPT goto yyacceptlab
Chris Lattner38905612008-02-19 04:36:25 +00002661#define YYABORT goto yyabortlab
2662#define YYERROR goto yyerrorlab
2663
2664
2665/* Like YYERROR except do call yyerror. This remains here temporarily
2666 to ease the transition to the new meaning of YYERROR, for GCC.
Reid Spencer68a24bd2005-08-27 18:50:39 +00002667 Once GCC version 2 has supplanted version 1, this can go. */
Chris Lattner38905612008-02-19 04:36:25 +00002668
Reid Spencer68a24bd2005-08-27 18:50:39 +00002669#define YYFAIL goto yyerrlab
Chris Lattner38905612008-02-19 04:36:25 +00002670
Reid Spencer68a24bd2005-08-27 18:50:39 +00002671#define YYRECOVERING() (!!yyerrstatus)
Chris Lattner38905612008-02-19 04:36:25 +00002672
2673#define YYBACKUP(Token, Value) \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002674do \
2675 if (yychar == YYEMPTY && yylen == 1) \
Chris Lattner38905612008-02-19 04:36:25 +00002676 { \
2677 yychar = (Token); \
2678 yylval = (Value); \
2679 yytoken = YYTRANSLATE (yychar); \
2680 YYPOPSTACK (1); \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002681 goto yybackup; \
2682 } \
2683 else \
Chris Lattner38905612008-02-19 04:36:25 +00002684 { \
2685 yyerror (YY_("syntax error: cannot back up")); \
2686 YYERROR; \
2687 } \
2688while (YYID (0))
2689
Anton Korobeynikov38e09802007-04-28 13:48:45 +00002690
Reid Spencer68a24bd2005-08-27 18:50:39 +00002691#define YYTERROR 1
2692#define YYERRCODE 256
2693
Chris Lattner38905612008-02-19 04:36:25 +00002694
2695/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2696 If N is 0, then set CURRENT to the empty location which ends
2697 the previous symbol: RHS[0] (always defined). */
2698
2699#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2700#ifndef YYLLOC_DEFAULT
2701# define YYLLOC_DEFAULT(Current, Rhs, N) \
2702 do \
2703 if (YYID (N)) \
2704 { \
2705 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2706 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2707 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2708 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2709 } \
2710 else \
2711 { \
2712 (Current).first_line = (Current).last_line = \
2713 YYRHSLOC (Rhs, 0).last_line; \
2714 (Current).first_column = (Current).last_column = \
2715 YYRHSLOC (Rhs, 0).last_column; \
2716 } \
2717 while (YYID (0))
Reid Spencer68a24bd2005-08-27 18:50:39 +00002718#endif
2719
Chris Lattner38905612008-02-19 04:36:25 +00002720
2721/* YY_LOCATION_PRINT -- Print the location on the stream.
2722 This macro was not mandated originally: define only if we know
2723 we won't break user code: when these are the locations we know. */
2724
2725#ifndef YY_LOCATION_PRINT
Devang Patel4c3f8442008-02-20 19:13:10 +00002726# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
Chris Lattner38905612008-02-19 04:36:25 +00002727# define YY_LOCATION_PRINT(File, Loc) \
2728 fprintf (File, "%d.%d-%d.%d", \
2729 (Loc).first_line, (Loc).first_column, \
2730 (Loc).last_line, (Loc).last_column)
2731# else
2732# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2733# endif
2734#endif
2735
2736
2737/* YYLEX -- calling `yylex' with the right arguments. */
2738
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00002739#ifdef YYLEX_PARAM
Chris Lattner38905612008-02-19 04:36:25 +00002740# define YYLEX yylex (YYLEX_PARAM)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00002741#else
Chris Lattner38905612008-02-19 04:36:25 +00002742# define YYLEX yylex ()
Scott Michel15dcd8e2008-01-30 03:10:00 +00002743#endif
Chris Lattner38905612008-02-19 04:36:25 +00002744
2745/* Enable debugging if requested. */
2746#if YYDEBUG
2747
2748# ifndef YYFPRINTF
2749# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2750# define YYFPRINTF fprintf
2751# endif
2752
2753# define YYDPRINTF(Args) \
2754do { \
2755 if (yydebug) \
2756 YYFPRINTF Args; \
2757} while (YYID (0))
2758
2759# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2760do { \
2761 if (yydebug) \
2762 { \
2763 YYFPRINTF (stderr, "%s ", Title); \
2764 yy_symbol_print (stderr, \
2765 Type, Value); \
2766 YYFPRINTF (stderr, "\n"); \
2767 } \
2768} while (YYID (0))
2769
2770
2771/*--------------------------------.
2772| Print this symbol on YYOUTPUT. |
2773`--------------------------------*/
2774
2775/*ARGSUSED*/
2776#if (defined __STDC__ || defined __C99__FUNC__ \
2777 || defined __cplusplus || defined _MSC_VER)
2778static void
2779yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
Scott Michel15dcd8e2008-01-30 03:10:00 +00002780#else
Chris Lattner38905612008-02-19 04:36:25 +00002781static void
2782yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2783 FILE *yyoutput;
2784 int yytype;
2785 YYSTYPE const * const yyvaluep;
Scott Michel15dcd8e2008-01-30 03:10:00 +00002786#endif
Chris Lattner38905612008-02-19 04:36:25 +00002787{
2788 if (!yyvaluep)
2789 return;
2790# ifdef YYPRINT
2791 if (yytype < YYNTOKENS)
2792 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2793# else
2794 YYUSE (yyoutput);
2795# endif
2796 switch (yytype)
2797 {
2798 default:
2799 break;
2800 }
2801}
2802
2803
2804/*--------------------------------.
2805| Print this symbol on YYOUTPUT. |
2806`--------------------------------*/
2807
2808#if (defined __STDC__ || defined __C99__FUNC__ \
2809 || defined __cplusplus || defined _MSC_VER)
2810static void
2811yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2812#else
2813static void
2814yy_symbol_print (yyoutput, yytype, yyvaluep)
2815 FILE *yyoutput;
2816 int yytype;
2817 YYSTYPE const * const yyvaluep;
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00002818#endif
Chris Lattner38905612008-02-19 04:36:25 +00002819{
2820 if (yytype < YYNTOKENS)
2821 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2822 else
2823 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
Scott Michel7f9ba9b2008-01-30 02:55:46 +00002824
Chris Lattner38905612008-02-19 04:36:25 +00002825 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2826 YYFPRINTF (yyoutput, ")");
2827}
Scott Michel7f9ba9b2008-01-30 02:55:46 +00002828
Chris Lattner38905612008-02-19 04:36:25 +00002829/*------------------------------------------------------------------.
2830| yy_stack_print -- Print the state stack from its BOTTOM up to its |
2831| TOP (included). |
2832`------------------------------------------------------------------*/
Scott Michel7f9ba9b2008-01-30 02:55:46 +00002833
Chris Lattner38905612008-02-19 04:36:25 +00002834#if (defined __STDC__ || defined __C99__FUNC__ \
2835 || defined __cplusplus || defined _MSC_VER)
2836static void
2837yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
2838#else
2839static void
2840yy_stack_print (bottom, top)
2841 yytype_int16 *bottom;
2842 yytype_int16 *top;
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00002843#endif
Chris Lattner38905612008-02-19 04:36:25 +00002844{
2845 YYFPRINTF (stderr, "Stack now");
2846 for (; bottom <= top; ++bottom)
2847 YYFPRINTF (stderr, " %d", *bottom);
2848 YYFPRINTF (stderr, "\n");
2849}
Scott Michel7f9ba9b2008-01-30 02:55:46 +00002850
Chris Lattner38905612008-02-19 04:36:25 +00002851# define YY_STACK_PRINT(Bottom, Top) \
2852do { \
2853 if (yydebug) \
2854 yy_stack_print ((Bottom), (Top)); \
2855} while (YYID (0))
Scott Michel7f9ba9b2008-01-30 02:55:46 +00002856
Chris Lattner38905612008-02-19 04:36:25 +00002857
2858/*------------------------------------------------.
2859| Report that the YYRULE is going to be reduced. |
2860`------------------------------------------------*/
2861
2862#if (defined __STDC__ || defined __C99__FUNC__ \
2863 || defined __cplusplus || defined _MSC_VER)
2864static void
2865yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
2866#else
2867static void
2868yy_reduce_print (yyvsp, yyrule)
2869 YYSTYPE *yyvsp;
2870 int yyrule;
Dale Johannesencdd509a2007-09-07 21:07:57 +00002871#endif
Chris Lattner38905612008-02-19 04:36:25 +00002872{
2873 int yynrhs = yyr2[yyrule];
2874 int yyi;
2875 unsigned long int yylno = yyrline[yyrule];
2876 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2877 yyrule - 1, yylno);
2878 /* The symbols being reduced. */
2879 for (yyi = 0; yyi < yynrhs; yyi++)
2880 {
2881 fprintf (stderr, " $%d = ", yyi + 1);
2882 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2883 &(yyvsp[(yyi + 1) - (yynrhs)])
2884 );
2885 fprintf (stderr, "\n");
2886 }
2887}
Anton Korobeynikovb9b977d2007-11-14 09:53:48 +00002888
Chris Lattner38905612008-02-19 04:36:25 +00002889# define YY_REDUCE_PRINT(Rule) \
2890do { \
2891 if (yydebug) \
2892 yy_reduce_print (yyvsp, Rule); \
2893} while (YYID (0))
Anton Korobeynikovb9b977d2007-11-14 09:53:48 +00002894
Chris Lattner38905612008-02-19 04:36:25 +00002895/* Nonzero means print parse trace. It is left uninitialized so that
2896 multiple parsers can coexist. */
2897int yydebug;
2898#else /* !YYDEBUG */
2899# define YYDPRINTF(Args)
2900# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2901# define YY_STACK_PRINT(Bottom, Top)
2902# define YY_REDUCE_PRINT(Rule)
2903#endif /* !YYDEBUG */
2904
2905
2906/* YYINITDEPTH -- initial size of the parser's stacks. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002907#ifndef YYINITDEPTH
Chris Lattner38905612008-02-19 04:36:25 +00002908# define YYINITDEPTH 200
Reid Spencer68a24bd2005-08-27 18:50:39 +00002909#endif
2910
Chris Lattner38905612008-02-19 04:36:25 +00002911/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2912 if the built-in stack extension method is used).
Reid Spencer68a24bd2005-08-27 18:50:39 +00002913
Chris Lattner38905612008-02-19 04:36:25 +00002914 Do not make this value too large; the results are undefined if
2915 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2916 evaluated with infinite-precision integer arithmetic. */
David Greene718fda32007-08-01 03:59:32 +00002917
Reid Spencer68a24bd2005-08-27 18:50:39 +00002918#ifndef YYMAXDEPTH
Chris Lattner38905612008-02-19 04:36:25 +00002919# define YYMAXDEPTH 10000
Reid Spencer68a24bd2005-08-27 18:50:39 +00002920#endif
Chris Lattner38905612008-02-19 04:36:25 +00002921
Reid Spencer68a24bd2005-08-27 18:50:39 +00002922
2923
Chris Lattner38905612008-02-19 04:36:25 +00002924#if YYERROR_VERBOSE
Reid Spencer68a24bd2005-08-27 18:50:39 +00002925
Chris Lattner38905612008-02-19 04:36:25 +00002926# ifndef yystrlen
2927# if defined __GLIBC__ && defined _STRING_H
2928# define yystrlen strlen
2929# else
2930/* Return the length of YYSTR. */
2931#if (defined __STDC__ || defined __C99__FUNC__ \
2932 || defined __cplusplus || defined _MSC_VER)
2933static YYSIZE_T
2934yystrlen (const char *yystr)
Scott Michel7f9ba9b2008-01-30 02:55:46 +00002935#else
Chris Lattner38905612008-02-19 04:36:25 +00002936static YYSIZE_T
2937yystrlen (yystr)
2938 const char *yystr;
2939#endif
2940{
2941 YYSIZE_T yylen;
2942 for (yylen = 0; yystr[yylen]; yylen++)
2943 continue;
2944 return yylen;
2945}
2946# endif
2947# endif
2948
2949# ifndef yystpcpy
2950# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
2951# define yystpcpy stpcpy
2952# else
2953/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2954 YYDEST. */
2955#if (defined __STDC__ || defined __C99__FUNC__ \
2956 || defined __cplusplus || defined _MSC_VER)
2957static char *
2958yystpcpy (char *yydest, const char *yysrc)
2959#else
2960static char *
2961yystpcpy (yydest, yysrc)
2962 char *yydest;
2963 const char *yysrc;
2964#endif
2965{
2966 char *yyd = yydest;
2967 const char *yys = yysrc;
2968
2969 while ((*yyd++ = *yys++) != '\0')
2970 continue;
2971
2972 return yyd - 1;
2973}
2974# endif
2975# endif
2976
2977# ifndef yytnamerr
2978/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2979 quotes and backslashes, so that it's suitable for yyerror. The
2980 heuristic is that double-quoting is unnecessary unless the string
2981 contains an apostrophe, a comma, or backslash (other than
2982 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2983 null, do not copy; instead, return the length of what the result
2984 would have been. */
2985static YYSIZE_T
2986yytnamerr (char *yyres, const char *yystr)
2987{
2988 if (*yystr == '"')
2989 {
2990 YYSIZE_T yyn = 0;
2991 char const *yyp = yystr;
2992
2993 for (;;)
2994 switch (*++yyp)
2995 {
2996 case '\'':
2997 case ',':
2998 goto do_not_strip_quotes;
2999
3000 case '\\':
3001 if (*++yyp != '\\')
3002 goto do_not_strip_quotes;
3003 /* Fall through. */
3004 default:
3005 if (yyres)
3006 yyres[yyn] = *yyp;
3007 yyn++;
3008 break;
3009
3010 case '"':
3011 if (yyres)
3012 yyres[yyn] = '\0';
3013 return yyn;
3014 }
3015 do_not_strip_quotes: ;
3016 }
3017
3018 if (! yyres)
3019 return yystrlen (yystr);
3020
3021 return yystpcpy (yyres, yystr) - yyres;
3022}
3023# endif
3024
3025/* Copy into YYRESULT an error message about the unexpected token
3026 YYCHAR while in state YYSTATE. Return the number of bytes copied,
3027 including the terminating null byte. If YYRESULT is null, do not
3028 copy anything; just return the number of bytes that would be
3029 copied. As a special case, return 0 if an ordinary "syntax error"
3030 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
3031 size calculation. */
3032static YYSIZE_T
3033yysyntax_error (char *yyresult, int yystate, int yychar)
3034{
3035 int yyn = yypact[yystate];
3036
3037 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3038 return 0;
3039 else
3040 {
3041 int yytype = YYTRANSLATE (yychar);
3042 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3043 YYSIZE_T yysize = yysize0;
3044 YYSIZE_T yysize1;
3045 int yysize_overflow = 0;
3046 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3047 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3048 int yyx;
3049
3050# if 0
3051 /* This is so xgettext sees the translatable formats that are
3052 constructed on the fly. */
3053 YY_("syntax error, unexpected %s");
3054 YY_("syntax error, unexpected %s, expecting %s");
3055 YY_("syntax error, unexpected %s, expecting %s or %s");
3056 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3057 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3058# endif
3059 char *yyfmt;
3060 char const *yyf;
3061 static char const yyunexpected[] = "syntax error, unexpected %s";
3062 static char const yyexpecting[] = ", expecting %s";
3063 static char const yyor[] = " or %s";
3064 char yyformat[sizeof yyunexpected
3065 + sizeof yyexpecting - 1
3066 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3067 * (sizeof yyor - 1))];
3068 char const *yyprefix = yyexpecting;
3069
3070 /* Start YYX at -YYN if negative to avoid negative indexes in
3071 YYCHECK. */
3072 int yyxbegin = yyn < 0 ? -yyn : 0;
3073
3074 /* Stay within bounds of both yycheck and yytname. */
3075 int yychecklim = YYLAST - yyn + 1;
3076 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3077 int yycount = 1;
3078
3079 yyarg[0] = yytname[yytype];
3080 yyfmt = yystpcpy (yyformat, yyunexpected);
3081
3082 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3083 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3084 {
3085 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3086 {
3087 yycount = 1;
3088 yysize = yysize0;
3089 yyformat[sizeof yyunexpected - 1] = '\0';
3090 break;
3091 }
3092 yyarg[yycount++] = yytname[yyx];
3093 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3094 yysize_overflow |= (yysize1 < yysize);
3095 yysize = yysize1;
3096 yyfmt = yystpcpy (yyfmt, yyprefix);
3097 yyprefix = yyor;
3098 }
3099
3100 yyf = YY_(yyformat);
3101 yysize1 = yysize + yystrlen (yyf);
3102 yysize_overflow |= (yysize1 < yysize);
3103 yysize = yysize1;
3104
3105 if (yysize_overflow)
3106 return YYSIZE_MAXIMUM;
3107
3108 if (yyresult)
3109 {
3110 /* Avoid sprintf, as that infringes on the user's name space.
3111 Don't have undefined behavior even if the translation
3112 produced a string with the wrong number of "%s"s. */
3113 char *yyp = yyresult;
3114 int yyi = 0;
3115 while ((*yyp = *yyf) != '\0')
3116 {
3117 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3118 {
3119 yyp += yytnamerr (yyp, yyarg[yyi++]);
3120 yyf += 2;
3121 }
3122 else
3123 {
3124 yyp++;
3125 yyf++;
3126 }
3127 }
3128 }
3129 return yysize;
3130 }
3131}
3132#endif /* YYERROR_VERBOSE */
3133
3134
3135/*-----------------------------------------------.
3136| Release the memory associated to this symbol. |
3137`-----------------------------------------------*/
3138
3139/*ARGSUSED*/
3140#if (defined __STDC__ || defined __C99__FUNC__ \
3141 || defined __cplusplus || defined _MSC_VER)
3142static void
3143yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3144#else
3145static void
3146yydestruct (yymsg, yytype, yyvaluep)
3147 const char *yymsg;
3148 int yytype;
3149 YYSTYPE *yyvaluep;
3150#endif
3151{
3152 YYUSE (yyvaluep);
3153
3154 if (!yymsg)
3155 yymsg = "Deleting";
3156 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3157
3158 switch (yytype)
3159 {
3160
3161 default:
3162 break;
3163 }
3164}
3165
3166
3167/* Prevent warnings from -Wmissing-prototypes. */
3168
3169#ifdef YYPARSE_PARAM
3170#if defined __STDC__ || defined __cplusplus
3171int yyparse (void *YYPARSE_PARAM);
3172#else
3173int yyparse ();
3174#endif
3175#else /* ! YYPARSE_PARAM */
3176#if defined __STDC__ || defined __cplusplus
David Greene5fd22a82007-09-04 18:46:50 +00003177int yyparse (void);
Scott Michel15dcd8e2008-01-30 03:10:00 +00003178#else
Chris Lattner38905612008-02-19 04:36:25 +00003179int yyparse ();
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00003180#endif
Chris Lattner38905612008-02-19 04:36:25 +00003181#endif /* ! YYPARSE_PARAM */
Anton Korobeynikovb9b977d2007-11-14 09:53:48 +00003182
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003183
Chris Lattner38905612008-02-19 04:36:25 +00003184
3185/* The look-ahead symbol. */
3186int yychar;
3187
3188/* The semantic value of the look-ahead symbol. */
3189YYSTYPE yylval;
3190
3191/* Number of syntax errors so far. */
3192int yynerrs;
3193
3194
3195
3196/*----------.
3197| yyparse. |
3198`----------*/
3199
3200#ifdef YYPARSE_PARAM
3201#if (defined __STDC__ || defined __C99__FUNC__ \
3202 || defined __cplusplus || defined _MSC_VER)
3203int
3204yyparse (void *YYPARSE_PARAM)
3205#else
3206int
3207yyparse (YYPARSE_PARAM)
3208 void *YYPARSE_PARAM;
3209#endif
3210#else /* ! YYPARSE_PARAM */
3211#if (defined __STDC__ || defined __C99__FUNC__ \
3212 || defined __cplusplus || defined _MSC_VER)
3213int
3214yyparse (void)
3215#else
3216int
3217yyparse ()
3218
Scott Michel15dcd8e2008-01-30 03:10:00 +00003219#endif
3220#endif
Chris Lattner38905612008-02-19 04:36:25 +00003221{
3222
3223 int yystate;
3224 int yyn;
3225 int yyresult;
3226 /* Number of tokens to shift before error messages enabled. */
3227 int yyerrstatus;
3228 /* Look-ahead token as an internal (translated) token number. */
3229 int yytoken = 0;
3230#if YYERROR_VERBOSE
3231 /* Buffer for error messages, and its allocated size. */
3232 char yymsgbuf[128];
3233 char *yymsg = yymsgbuf;
3234 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
Scott Michel15dcd8e2008-01-30 03:10:00 +00003235#endif
Scott Michel7f9ba9b2008-01-30 02:55:46 +00003236
Chris Lattner38905612008-02-19 04:36:25 +00003237 /* Three stacks and their tools:
3238 `yyss': related to states,
3239 `yyvs': related to semantic values,
3240 `yyls': related to locations.
3241
3242 Refer to the stacks thru separate pointers, to allow yyoverflow
3243 to reallocate them elsewhere. */
3244
3245 /* The state stack. */
3246 yytype_int16 yyssa[YYINITDEPTH];
3247 yytype_int16 *yyss = yyssa;
3248 yytype_int16 *yyssp;
3249
3250 /* The semantic value stack. */
3251 YYSTYPE yyvsa[YYINITDEPTH];
3252 YYSTYPE *yyvs = yyvsa;
3253 YYSTYPE *yyvsp;
3254
3255
3256
3257#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
3258
3259 YYSIZE_T yystacksize = YYINITDEPTH;
3260
3261 /* The variables used to return semantic value and location from the
3262 action routines. */
3263 YYSTYPE yyval;
3264
3265
3266 /* The number of symbols on the RHS of the reduced rule.
3267 Keep to zero when no symbol should be popped. */
3268 int yylen = 0;
3269
3270 YYDPRINTF ((stderr, "Starting parse\n"));
3271
Reid Spencer68a24bd2005-08-27 18:50:39 +00003272 yystate = 0;
3273 yyerrstatus = 0;
3274 yynerrs = 0;
3275 yychar = YYEMPTY; /* Cause a token to be read. */
3276
3277 /* Initialize stack pointers.
3278 Waste one element of value and location stack
3279 so that they stay on the same level as the state stack.
3280 The wasted elements are never initialized. */
3281
Chris Lattner38905612008-02-19 04:36:25 +00003282 yyssp = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003283 yyvsp = yyvs;
3284
Chris Lattner38905612008-02-19 04:36:25 +00003285 goto yysetstate;
Jeff Cohen66c5fd62005-10-23 04:37:20 +00003286
Chris Lattner38905612008-02-19 04:36:25 +00003287/*------------------------------------------------------------.
3288| yynewstate -- Push a new state, which is found in yystate. |
3289`------------------------------------------------------------*/
3290 yynewstate:
3291 /* In all cases, when you get here, the value and location stacks
3292 have just been pushed. So pushing a state here evens the stacks. */
3293 yyssp++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003294
Chris Lattner38905612008-02-19 04:36:25 +00003295 yysetstate:
3296 *yyssp = yystate;
3297
3298 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003299 {
3300 /* Get the current used size of the three stacks, in elements. */
Chris Lattner38905612008-02-19 04:36:25 +00003301 YYSIZE_T yysize = yyssp - yyss + 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003302
3303#ifdef yyoverflow
Chris Lattner38905612008-02-19 04:36:25 +00003304 {
3305 /* Give user a chance to reallocate the stack. Use copies of
3306 these so that the &'s don't force the real ones into
3307 memory. */
3308 YYSTYPE *yyvs1 = yyvs;
3309 yytype_int16 *yyss1 = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003310
Chris Lattner38905612008-02-19 04:36:25 +00003311
3312 /* Each stack pointer address is followed by the size of the
3313 data in use in that stack, in bytes. This used to be a
3314 conditional around just the two extra args, but that might
3315 be undefined if yyoverflow is a macro. */
3316 yyoverflow (YY_("memory exhausted"),
3317 &yyss1, yysize * sizeof (*yyssp),
3318 &yyvs1, yysize * sizeof (*yyvsp),
3319
3320 &yystacksize);
3321
3322 yyss = yyss1;
3323 yyvs = yyvs1;
3324 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00003325#else /* no yyoverflow */
Chris Lattner38905612008-02-19 04:36:25 +00003326# ifndef YYSTACK_RELOCATE
3327 goto yyexhaustedlab;
3328# else
Reid Spencer68a24bd2005-08-27 18:50:39 +00003329 /* Extend the stack our own way. */
Chris Lattner38905612008-02-19 04:36:25 +00003330 if (YYMAXDEPTH <= yystacksize)
3331 goto yyexhaustedlab;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003332 yystacksize *= 2;
Chris Lattner38905612008-02-19 04:36:25 +00003333 if (YYMAXDEPTH < yystacksize)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003334 yystacksize = YYMAXDEPTH;
Chris Lattner38905612008-02-19 04:36:25 +00003335
3336 {
3337 yytype_int16 *yyss1 = yyss;
3338 union yyalloc *yyptr =
3339 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3340 if (! yyptr)
3341 goto yyexhaustedlab;
3342 YYSTACK_RELOCATE (yyss);
3343 YYSTACK_RELOCATE (yyvs);
3344
3345# undef YYSTACK_RELOCATE
3346 if (yyss1 != yyssa)
3347 YYSTACK_FREE (yyss1);
3348 }
3349# endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00003350#endif /* no yyoverflow */
3351
Chris Lattner38905612008-02-19 04:36:25 +00003352 yyssp = yyss + yysize - 1;
3353 yyvsp = yyvs + yysize - 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003354
3355
Chris Lattner38905612008-02-19 04:36:25 +00003356 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3357 (unsigned long int) yystacksize));
3358
3359 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003360 YYABORT;
3361 }
3362
Chris Lattner38905612008-02-19 04:36:25 +00003363 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003364
3365 goto yybackup;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003366
Chris Lattner38905612008-02-19 04:36:25 +00003367/*-----------.
3368| yybackup. |
3369`-----------*/
3370yybackup:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003371
Chris Lattner38905612008-02-19 04:36:25 +00003372 /* Do appropriate processing given the current state. Read a
3373 look-ahead token if we need one and don't already have one. */
Reid Spencer7780acb2007-04-16 06:56:07 +00003374
Chris Lattner38905612008-02-19 04:36:25 +00003375 /* First try to decide what to do without reference to look-ahead token. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003376 yyn = yypact[yystate];
Chris Lattner38905612008-02-19 04:36:25 +00003377 if (yyn == YYPACT_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003378 goto yydefault;
3379
Chris Lattner38905612008-02-19 04:36:25 +00003380 /* Not known => get a look-ahead token if don't already have one. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003381
Chris Lattner38905612008-02-19 04:36:25 +00003382 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003383 if (yychar == YYEMPTY)
3384 {
Chris Lattner38905612008-02-19 04:36:25 +00003385 YYDPRINTF ((stderr, "Reading a token: "));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003386 yychar = YYLEX;
3387 }
3388
Chris Lattner38905612008-02-19 04:36:25 +00003389 if (yychar <= YYEOF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003390 {
Chris Lattner38905612008-02-19 04:36:25 +00003391 yychar = yytoken = YYEOF;
3392 YYDPRINTF ((stderr, "Now at end of input.\n"));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003393 }
3394 else
3395 {
Chris Lattner38905612008-02-19 04:36:25 +00003396 yytoken = YYTRANSLATE (yychar);
3397 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Reid Spencer68a24bd2005-08-27 18:50:39 +00003398 }
3399
Chris Lattner38905612008-02-19 04:36:25 +00003400 /* If the proper action on seeing token YYTOKEN is to reduce or to
3401 detect an error, take that action. */
3402 yyn += yytoken;
3403 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003404 goto yydefault;
3405 yyn = yytable[yyn];
Chris Lattner38905612008-02-19 04:36:25 +00003406 if (yyn <= 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003407 {
Chris Lattner38905612008-02-19 04:36:25 +00003408 if (yyn == 0 || yyn == YYTABLE_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003409 goto yyerrlab;
3410 yyn = -yyn;
3411 goto yyreduce;
3412 }
3413
3414 if (yyn == YYFINAL)
3415 YYACCEPT;
3416
Chris Lattner38905612008-02-19 04:36:25 +00003417 /* Count tokens shifted since error; after three, turn off error
3418 status. */
3419 if (yyerrstatus)
3420 yyerrstatus--;
Dale Johannesencdd509a2007-09-07 21:07:57 +00003421
Chris Lattner38905612008-02-19 04:36:25 +00003422 /* Shift the look-ahead token. */
3423 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003424
Chris Lattner38905612008-02-19 04:36:25 +00003425 /* Discard the shifted token unless it is eof. */
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003426 if (yychar != YYEOF)
3427 yychar = YYEMPTY;
3428
Scott Michel15dcd8e2008-01-30 03:10:00 +00003429 yystate = yyn;
Chris Lattner38905612008-02-19 04:36:25 +00003430 *++yyvsp = yylval;
3431
Reid Spencer68a24bd2005-08-27 18:50:39 +00003432 goto yynewstate;
3433
Scott Michel15dcd8e2008-01-30 03:10:00 +00003434
Chris Lattner38905612008-02-19 04:36:25 +00003435/*-----------------------------------------------------------.
3436| yydefault -- do the default action for the current state. |
3437`-----------------------------------------------------------*/
3438yydefault:
Reid Spencer68a24bd2005-08-27 18:50:39 +00003439 yyn = yydefact[yystate];
3440 if (yyn == 0)
3441 goto yyerrlab;
Chris Lattner38905612008-02-19 04:36:25 +00003442 goto yyreduce;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003443
Chris Lattner38905612008-02-19 04:36:25 +00003444
3445/*-----------------------------.
3446| yyreduce -- Do a reduction. |
3447`-----------------------------*/
Reid Spencer68a24bd2005-08-27 18:50:39 +00003448yyreduce:
Chris Lattner38905612008-02-19 04:36:25 +00003449 /* yyn is the number of a rule to reduce with. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003450 yylen = yyr2[yyn];
3451
Chris Lattner38905612008-02-19 04:36:25 +00003452 /* If YYLEN is nonzero, implement the default value of the action:
3453 `$$ = $1'.
3454
3455 Otherwise, the following line sets YYVAL to garbage.
3456 This behavior is undocumented and Bison
3457 users should not rely upon it. Assigning to YYVAL
3458 unconditionally makes the parser a bit smaller, and it avoids a
3459 GCC warning that YYVAL may be used uninitialized. */
3460 yyval = yyvsp[1-yylen];
3461
3462
3463 YY_REDUCE_PRINT (yyn);
3464 switch (yyn)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003465 {
Chris Lattner38905612008-02-19 04:36:25 +00003466 case 29:
Devang Patel4c3f8442008-02-20 19:13:10 +00003467#line 1119 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003468 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3469 break;
Reid Spencer41dff5e2007-01-26 08:05:27 +00003470
Chris Lattner38905612008-02-19 04:36:25 +00003471 case 30:
Devang Patel4c3f8442008-02-20 19:13:10 +00003472#line 1119 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003473 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
3474 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003475
Chris Lattner38905612008-02-19 04:36:25 +00003476 case 31:
Devang Patel4c3f8442008-02-20 19:13:10 +00003477#line 1120 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003478 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3479 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003480
Chris Lattner38905612008-02-19 04:36:25 +00003481 case 32:
Devang Patel4c3f8442008-02-20 19:13:10 +00003482#line 1120 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003483 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3484 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003485
Chris Lattner38905612008-02-19 04:36:25 +00003486 case 33:
Devang Patel4c3f8442008-02-20 19:13:10 +00003487#line 1121 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003488 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3489 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003490
Chris Lattner38905612008-02-19 04:36:25 +00003491 case 34:
Devang Patel4c3f8442008-02-20 19:13:10 +00003492#line 1121 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003493 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3494 break;
3495
3496 case 35:
Devang Patel4c3f8442008-02-20 19:13:10 +00003497#line 1122 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003498 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3499 break;
3500
3501 case 36:
Devang Patel4c3f8442008-02-20 19:13:10 +00003502#line 1122 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003503 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
3504 break;
3505
3506 case 37:
Devang Patel4c3f8442008-02-20 19:13:10 +00003507#line 1123 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003508 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
3509 break;
3510
3511 case 38:
Devang Patel4c3f8442008-02-20 19:13:10 +00003512#line 1123 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003513 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
3514 break;
3515
3516 case 39:
Devang Patel4c3f8442008-02-20 19:13:10 +00003517#line 1127 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003518 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
3519 break;
3520
3521 case 40:
Devang Patel4c3f8442008-02-20 19:13:10 +00003522#line 1127 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003523 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
3524 break;
3525
3526 case 41:
Devang Patel4c3f8442008-02-20 19:13:10 +00003527#line 1128 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003528 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
3529 break;
3530
3531 case 42:
Devang Patel4c3f8442008-02-20 19:13:10 +00003532#line 1128 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003533 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
3534 break;
3535
3536 case 43:
Devang Patel4c3f8442008-02-20 19:13:10 +00003537#line 1129 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003538 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
3539 break;
3540
3541 case 44:
Devang Patel4c3f8442008-02-20 19:13:10 +00003542#line 1129 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003543 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
3544 break;
3545
3546 case 45:
Devang Patel4c3f8442008-02-20 19:13:10 +00003547#line 1130 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003548 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
3549 break;
3550
3551 case 46:
Devang Patel4c3f8442008-02-20 19:13:10 +00003552#line 1130 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003553 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
3554 break;
3555
3556 case 47:
Devang Patel4c3f8442008-02-20 19:13:10 +00003557#line 1131 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003558 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
3559 break;
3560
3561 case 48:
Devang Patel4c3f8442008-02-20 19:13:10 +00003562#line 1131 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003563 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
3564 break;
3565
3566 case 49:
Devang Patel4c3f8442008-02-20 19:13:10 +00003567#line 1132 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003568 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
3569 break;
3570
3571 case 50:
Devang Patel4c3f8442008-02-20 19:13:10 +00003572#line 1132 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003573 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
3574 break;
3575
3576 case 51:
Devang Patel4c3f8442008-02-20 19:13:10 +00003577#line 1133 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003578 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
3579 break;
3580
3581 case 52:
Devang Patel4c3f8442008-02-20 19:13:10 +00003582#line 1133 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003583 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
3584 break;
3585
3586 case 53:
Devang Patel4c3f8442008-02-20 19:13:10 +00003587#line 1134 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003588 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
3589 break;
3590
3591 case 54:
Devang Patel4c3f8442008-02-20 19:13:10 +00003592#line 1135 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003593 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
3594 break;
3595
3596 case 65:
Devang Patel4c3f8442008-02-20 19:13:10 +00003597#line 1144 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003598 { (yyval.StrVal) = 0; ;}
3599 break;
3600
3601 case 66:
Devang Patel4c3f8442008-02-20 19:13:10 +00003602#line 1146 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003603 { (yyval.UIntVal)=(yyvsp[(3) - (4)].UInt64Val); ;}
3604 break;
3605
3606 case 67:
Devang Patel4c3f8442008-02-20 19:13:10 +00003607#line 1147 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003608 { (yyval.UIntVal)=0; ;}
3609 break;
3610
3611 case 68:
Devang Patel4c3f8442008-02-20 19:13:10 +00003612#line 1151 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003613 {
3614 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003615 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00003616 ;}
3617 break;
3618
3619 case 69:
Devang Patel4c3f8442008-02-20 19:13:10 +00003620#line 1155 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003621 {
3622 (yyval.StrVal) = 0;
Christopher Lambbf3348d2007-12-12 08:45:45 +00003623 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00003624 ;}
3625 break;
3626
3627 case 73:
Devang Patel4c3f8442008-02-20 19:13:10 +00003628#line 1163 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003629 {
3630 (yyval.StrVal) = 0;
Christopher Lambbf3348d2007-12-12 08:45:45 +00003631 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00003632 ;}
3633 break;
3634
3635 case 74:
Devang Patel4c3f8442008-02-20 19:13:10 +00003636#line 1168 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003637 {
3638 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00003639 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00003640 ;}
3641 break;
3642
3643 case 75:
Devang Patel4c3f8442008-02-20 19:13:10 +00003644#line 1174 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003645 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3646 break;
3647
3648 case 76:
Devang Patel4c3f8442008-02-20 19:13:10 +00003649#line 1175 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003650 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3651 break;
3652
3653 case 77:
Devang Patel4c3f8442008-02-20 19:13:10 +00003654#line 1176 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003655 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3656 break;
3657
3658 case 78:
Devang Patel4c3f8442008-02-20 19:13:10 +00003659#line 1177 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003660 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
3661 break;
3662
3663 case 79:
Devang Patel4c3f8442008-02-20 19:13:10 +00003664#line 1178 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003665 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3666 break;
3667
3668 case 80:
Devang Patel4c3f8442008-02-20 19:13:10 +00003669#line 1182 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003670 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3671 break;
3672
3673 case 81:
Devang Patel4c3f8442008-02-20 19:13:10 +00003674#line 1183 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003675 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3676 break;
3677
3678 case 82:
Devang Patel4c3f8442008-02-20 19:13:10 +00003679#line 1184 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003680 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3681 break;
3682
3683 case 83:
Devang Patel4c3f8442008-02-20 19:13:10 +00003684#line 1188 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003685 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3686 break;
3687
3688 case 84:
Devang Patel4c3f8442008-02-20 19:13:10 +00003689#line 1189 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003690 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
3691 break;
3692
3693 case 85:
Devang Patel4c3f8442008-02-20 19:13:10 +00003694#line 1190 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003695 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
3696 break;
3697
3698 case 86:
Devang Patel4c3f8442008-02-20 19:13:10 +00003699#line 1191 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003700 { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
3701 break;
3702
3703 case 87:
Devang Patel4c3f8442008-02-20 19:13:10 +00003704#line 1195 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003705 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3706 break;
3707
3708 case 88:
Devang Patel4c3f8442008-02-20 19:13:10 +00003709#line 1196 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003710 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3711 break;
3712
3713 case 89:
Devang Patel4c3f8442008-02-20 19:13:10 +00003714#line 1197 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003715 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
3716 break;
3717
3718 case 90:
Devang Patel4c3f8442008-02-20 19:13:10 +00003719#line 1201 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003720 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3721 break;
3722
3723 case 91:
Devang Patel4c3f8442008-02-20 19:13:10 +00003724#line 1202 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003725 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3726 break;
3727
3728 case 92:
Devang Patel4c3f8442008-02-20 19:13:10 +00003729#line 1203 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003730 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3731 break;
3732
3733 case 93:
Devang Patel4c3f8442008-02-20 19:13:10 +00003734#line 1204 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003735 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3736 break;
3737
3738 case 94:
Devang Patel4c3f8442008-02-20 19:13:10 +00003739#line 1205 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003740 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
3741 break;
3742
3743 case 95:
Devang Patel4c3f8442008-02-20 19:13:10 +00003744#line 1209 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003745 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3746 break;
3747
3748 case 96:
Devang Patel4c3f8442008-02-20 19:13:10 +00003749#line 1210 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003750 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
3751 break;
3752
3753 case 97:
Devang Patel4c3f8442008-02-20 19:13:10 +00003754#line 1211 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003755 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
3756 break;
3757
3758 case 98:
Devang Patel4c3f8442008-02-20 19:13:10 +00003759#line 1214 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003760 { (yyval.UIntVal) = CallingConv::C; ;}
3761 break;
3762
3763 case 99:
Devang Patel4c3f8442008-02-20 19:13:10 +00003764#line 1215 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003765 { (yyval.UIntVal) = CallingConv::C; ;}
3766 break;
3767
3768 case 100:
Devang Patel4c3f8442008-02-20 19:13:10 +00003769#line 1216 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003770 { (yyval.UIntVal) = CallingConv::Fast; ;}
3771 break;
3772
3773 case 101:
Devang Patel4c3f8442008-02-20 19:13:10 +00003774#line 1217 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003775 { (yyval.UIntVal) = CallingConv::Cold; ;}
3776 break;
3777
3778 case 102:
Devang Patel4c3f8442008-02-20 19:13:10 +00003779#line 1218 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003780 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3781 break;
3782
3783 case 103:
Devang Patel4c3f8442008-02-20 19:13:10 +00003784#line 1219 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003785 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3786 break;
3787
3788 case 104:
Devang Patel4c3f8442008-02-20 19:13:10 +00003789#line 1220 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003790 {
3791 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003792 GEN_ERROR("Calling conv too large");
Chris Lattner38905612008-02-19 04:36:25 +00003793 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003794 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00003795 ;}
3796 break;
3797
3798 case 105:
Devang Patel4c3f8442008-02-20 19:13:10 +00003799#line 1227 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003800 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3801 break;
3802
3803 case 106:
Devang Patel4c3f8442008-02-20 19:13:10 +00003804#line 1228 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003805 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3806 break;
3807
3808 case 107:
Devang Patel4c3f8442008-02-20 19:13:10 +00003809#line 1229 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003810 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3811 break;
3812
3813 case 108:
Devang Patel4c3f8442008-02-20 19:13:10 +00003814#line 1230 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003815 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3816 break;
3817
3818 case 109:
Devang Patel4c3f8442008-02-20 19:13:10 +00003819#line 1231 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003820 { (yyval.ParamAttrs) = ParamAttr::InReg; ;}
3821 break;
3822
3823 case 110:
Devang Patel4c3f8442008-02-20 19:13:10 +00003824#line 1232 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003825 { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
3826 break;
3827
3828 case 111:
Devang Patel4c3f8442008-02-20 19:13:10 +00003829#line 1233 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003830 { (yyval.ParamAttrs) = ParamAttr::NoAlias; ;}
3831 break;
3832
3833 case 112:
Devang Patel4c3f8442008-02-20 19:13:10 +00003834#line 1234 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003835 { (yyval.ParamAttrs) = ParamAttr::ByVal; ;}
3836 break;
3837
3838 case 113:
Devang Patel4c3f8442008-02-20 19:13:10 +00003839#line 1235 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003840 { (yyval.ParamAttrs) = ParamAttr::Nest; ;}
3841 break;
3842
3843 case 114:
Devang Patel4c3f8442008-02-20 19:13:10 +00003844#line 1238 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003845 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3846 break;
3847
3848 case 115:
Devang Patel4c3f8442008-02-20 19:13:10 +00003849#line 1239 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003850 {
3851 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3852 ;}
3853 break;
3854
3855 case 116:
Devang Patel4c3f8442008-02-20 19:13:10 +00003856#line 1244 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003857 { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
3858 break;
3859
3860 case 117:
Devang Patel4c3f8442008-02-20 19:13:10 +00003861#line 1245 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003862 { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
3863 break;
3864
3865 case 118:
Devang Patel4c3f8442008-02-20 19:13:10 +00003866#line 1246 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003867 { (yyval.ParamAttrs) = ParamAttr::ZExt; ;}
3868 break;
3869
3870 case 119:
Devang Patel4c3f8442008-02-20 19:13:10 +00003871#line 1247 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003872 { (yyval.ParamAttrs) = ParamAttr::SExt; ;}
3873 break;
3874
3875 case 120:
Devang Patel4c3f8442008-02-20 19:13:10 +00003876#line 1248 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003877 { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
3878 break;
3879
3880 case 121:
Devang Patel4c3f8442008-02-20 19:13:10 +00003881#line 1249 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003882 { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
3883 break;
3884
3885 case 122:
Devang Patel4c3f8442008-02-20 19:13:10 +00003886#line 1252 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003887 { (yyval.ParamAttrs) = ParamAttr::None; ;}
3888 break;
3889
3890 case 123:
Devang Patel4c3f8442008-02-20 19:13:10 +00003891#line 1253 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003892 {
3893 (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
3894 ;}
3895 break;
3896
3897 case 124:
Devang Patel4c3f8442008-02-20 19:13:10 +00003898#line 1258 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003899 { (yyval.StrVal) = 0; ;}
3900 break;
3901
3902 case 125:
Devang Patel4c3f8442008-02-20 19:13:10 +00003903#line 1259 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003904 {
3905 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3906 ;}
3907 break;
3908
3909 case 126:
Devang Patel4c3f8442008-02-20 19:13:10 +00003910#line 1266 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003911 { (yyval.UIntVal) = 0; ;}
3912 break;
3913
3914 case 127:
Devang Patel4c3f8442008-02-20 19:13:10 +00003915#line 1267 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003916 {
3917 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
3918 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003919 GEN_ERROR("Alignment must be a power of two");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003920 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00003921;}
3922 break;
3923
3924 case 128:
Devang Patel4c3f8442008-02-20 19:13:10 +00003925#line 1273 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003926 { (yyval.UIntVal) = 0; ;}
3927 break;
3928
3929 case 129:
Devang Patel4c3f8442008-02-20 19:13:10 +00003930#line 1274 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003931 {
3932 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
3933 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
Christopher Lambbf3348d2007-12-12 08:45:45 +00003934 GEN_ERROR("Alignment must be a power of two");
3935 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00003936;}
3937 break;
3938
3939 case 130:
Devang Patel4c3f8442008-02-20 19:13:10 +00003940#line 1283 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003941 {
3942 for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
3943 if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003944 GEN_ERROR("Invalid character in section name");
Chris Lattner38905612008-02-19 04:36:25 +00003945 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003946 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00003947;}
3948 break;
3949
3950 case 131:
Devang Patel4c3f8442008-02-20 19:13:10 +00003951#line 1291 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003952 { (yyval.StrVal) = 0; ;}
3953 break;
3954
3955 case 132:
Devang Patel4c3f8442008-02-20 19:13:10 +00003956#line 1292 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003957 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
3958 break;
3959
3960 case 133:
Devang Patel4c3f8442008-02-20 19:13:10 +00003961#line 1297 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003962 {;}
3963 break;
3964
3965 case 134:
Devang Patel4c3f8442008-02-20 19:13:10 +00003966#line 1298 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003967 {;}
3968 break;
3969
3970 case 135:
Devang Patel4c3f8442008-02-20 19:13:10 +00003971#line 1299 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003972 {
3973 CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
3974 delete (yyvsp[(1) - (1)].StrVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003975 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00003976 ;}
3977 break;
3978
3979 case 136:
Devang Patel4c3f8442008-02-20 19:13:10 +00003980#line 1304 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003981 {
3982 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00003983 GEN_ERROR("Alignment must be a power of two");
Chris Lattner38905612008-02-19 04:36:25 +00003984 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
Reid Spencer41dff5e2007-01-26 08:05:27 +00003985 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00003986 ;}
3987 break;
3988
3989 case 144:
Devang Patel4c3f8442008-02-20 19:13:10 +00003990#line 1320 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003991 {
3992 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00003993 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00003994 ;}
3995 break;
3996
3997 case 145:
Devang Patel4c3f8442008-02-20 19:13:10 +00003998#line 1324 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00003999 {
4000 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004001 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004002 ;}
4003 break;
4004
4005 case 146:
Devang Patel4c3f8442008-02-20 19:13:10 +00004006#line 1328 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004007 { // Pointer type?
4008 if (*(yyvsp[(1) - (3)].TypeVal) == Type::LabelTy)
Christopher Lambbf3348d2007-12-12 08:45:45 +00004009 GEN_ERROR("Cannot form a pointer to a basic block");
Chris Lattner38905612008-02-19 04:36:25 +00004010 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (3)].TypeVal), (yyvsp[(2) - (3)].UIntVal))));
4011 delete (yyvsp[(1) - (3)].TypeVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00004012 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004013 ;}
4014 break;
4015
4016 case 147:
Devang Patel4c3f8442008-02-20 19:13:10 +00004017#line 1335 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004018 { // Named types are also simple types...
4019 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
Christopher Lamba8ed9bf2007-12-11 09:02:08 +00004020 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004021 (yyval.TypeVal) = new PATypeHolder(tmp);
4022 ;}
4023 break;
4024
4025 case 148:
Devang Patel4c3f8442008-02-20 19:13:10 +00004026#line 1340 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004027 { // Type UpReference
4028 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004029 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Chris Lattner38905612008-02-19 04:36:25 +00004030 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
4031 (yyval.TypeVal) = new PATypeHolder(OT);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004032 UR_OUT("New Upreference!\n");
4033 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004034 ;}
4035 break;
4036
4037 case 149:
Devang Patel4c3f8442008-02-20 19:13:10 +00004038#line 1348 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004039 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004040 // Allow but ignore attributes on function types; this permits auto-upgrade.
4041 // FIXME: remove in LLVM 3.0.
Chris Lattner38905612008-02-19 04:36:25 +00004042 const Type* RetTy = *(yyvsp[(1) - (5)].TypeVal);
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004043 if (!(RetTy->isFirstClassType() || RetTy == Type::VoidTy ||
4044 isa<OpaqueType>(RetTy)))
Anton Korobeynikovc36284e2007-12-03 19:17:47 +00004045 GEN_ERROR("LLVM Functions cannot return aggregates");
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004046
Reid Spencer41dff5e2007-01-26 08:05:27 +00004047 std::vector<const Type*> Params;
Chris Lattner38905612008-02-19 04:36:25 +00004048 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00004049 for (; I != E; ++I ) {
Reid Spencer66728ef2007-03-20 01:13:36 +00004050 const Type *Ty = I->Ty->get();
Reid Spencer66728ef2007-03-20 01:13:36 +00004051 Params.push_back(Ty);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004052 }
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004053
Reid Spencer41dff5e2007-01-26 08:05:27 +00004054 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4055 if (isVarArg) Params.pop_back();
4056
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004057 for (unsigned i = 0; i != Params.size(); ++i)
4058 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4059 GEN_ERROR("Function arguments must be value types!");
4060
4061 CHECK_FOR_ERROR
4062
Anton Korobeynikovc36284e2007-12-03 19:17:47 +00004063 FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
Chris Lattner38905612008-02-19 04:36:25 +00004064 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4065 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
4066 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Reid Spencere4d87aa2006-12-23 06:05:41 +00004067 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004068 ;}
4069 break;
4070
4071 case 150:
Devang Patel4c3f8442008-02-20 19:13:10 +00004072#line 1378 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004073 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004074 // Allow but ignore attributes on function types; this permits auto-upgrade.
4075 // FIXME: remove in LLVM 3.0.
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004076 std::vector<const Type*> Params;
Chris Lattner38905612008-02-19 04:36:25 +00004077 TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00004078 for ( ; I != E; ++I ) {
Reid Spencer66728ef2007-03-20 01:13:36 +00004079 const Type* Ty = I->Ty->get();
Reid Spencer66728ef2007-03-20 01:13:36 +00004080 Params.push_back(Ty);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004081 }
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004082
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004083 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
4084 if (isVarArg) Params.pop_back();
4085
Anton Korobeynikov05e5a742007-12-03 21:01:29 +00004086 for (unsigned i = 0; i != Params.size(); ++i)
4087 if (!(Params[i]->isFirstClassType() || isa<OpaqueType>(Params[i])))
4088 GEN_ERROR("Function arguments must be value types!");
4089
4090 CHECK_FOR_ERROR
4091
Chris Lattner38905612008-02-19 04:36:25 +00004092 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
4093 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
4094 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004095 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004096 ;}
4097 break;
4098
4099 case 151:
Devang Patel4c3f8442008-02-20 19:13:10 +00004100#line 1403 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004101 { // Sized array type?
4102 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4103 delete (yyvsp[(4) - (5)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004104 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004105 ;}
4106 break;
4107
4108 case 152:
Devang Patel4c3f8442008-02-20 19:13:10 +00004109#line 1408 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004110 { // Vector type?
4111 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
4112 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004113 GEN_ERROR("Unsigned result not equal to signed result");
4114 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
4115 GEN_ERROR("Element type of a VectorType must be primitive");
Chris Lattner38905612008-02-19 04:36:25 +00004116 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
4117 delete (yyvsp[(4) - (5)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004118 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004119 ;}
4120 break;
4121
4122 case 153:
Devang Patel4c3f8442008-02-20 19:13:10 +00004123#line 1418 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004124 { // Structure type?
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004125 std::vector<const Type*> Elements;
Chris Lattner38905612008-02-19 04:36:25 +00004126 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
4127 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004128 Elements.push_back(*I);
4129
Chris Lattner38905612008-02-19 04:36:25 +00004130 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
4131 delete (yyvsp[(2) - (3)].TypeList);
Reid Spencer14310612006-12-31 05:40:51 +00004132 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004133 ;}
4134 break;
4135
4136 case 154:
Devang Patel4c3f8442008-02-20 19:13:10 +00004137#line 1428 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004138 { // Empty structure type?
4139 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Reid Spencer14310612006-12-31 05:40:51 +00004140 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004141 ;}
4142 break;
4143
4144 case 155:
Devang Patel4c3f8442008-02-20 19:13:10 +00004145#line 1432 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004146 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004147 std::vector<const Type*> Elements;
Chris Lattner38905612008-02-19 04:36:25 +00004148 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
4149 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004150 Elements.push_back(*I);
4151
Chris Lattner38905612008-02-19 04:36:25 +00004152 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
4153 delete (yyvsp[(3) - (5)].TypeList);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004154 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004155 ;}
4156 break;
4157
4158 case 156:
Devang Patel4c3f8442008-02-20 19:13:10 +00004159#line 1442 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004160 { // Empty structure type?
4161 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004162 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004163 ;}
4164 break;
4165
4166 case 157:
Devang Patel4c3f8442008-02-20 19:13:10 +00004167#line 1449 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004168 {
Duncan Sandsdc024672007-11-27 13:23:08 +00004169 // Allow but ignore attributes on function types; this permits auto-upgrade.
4170 // FIXME: remove in LLVM 3.0.
Chris Lattner38905612008-02-19 04:36:25 +00004171 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
4172 (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
4173 ;}
4174 break;
4175
4176 case 158:
Devang Patel4c3f8442008-02-20 19:13:10 +00004177#line 1458 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004178 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004179 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00004180 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
4181 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004182 GEN_ERROR("LLVM functions cannot return aggregate types");
Chris Lattner38905612008-02-19 04:36:25 +00004183 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
4184 ;}
4185 break;
4186
4187 case 159:
Devang Patel4c3f8442008-02-20 19:13:10 +00004188#line 1465 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004189 {
4190 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
4191 ;}
4192 break;
4193
4194 case 160:
Devang Patel4c3f8442008-02-20 19:13:10 +00004195#line 1470 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004196 {
4197 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
4198 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
Reid Spencer3da59db2006-11-27 01:05:10 +00004199 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004200 ;}
4201 break;
4202
4203 case 161:
Devang Patel4c3f8442008-02-20 19:13:10 +00004204#line 1475 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004205 {
4206 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004207 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004208 ;}
4209 break;
4210
4211 case 163:
Devang Patel4c3f8442008-02-20 19:13:10 +00004212#line 1483 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004213 {
4214 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
Reid Spencer18da0722007-04-11 02:44:20 +00004215 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
Reid Spencer41dff5e2007-01-26 08:05:27 +00004216 TWA.Ty = new PATypeHolder(Type::VoidTy);
Chris Lattner38905612008-02-19 04:36:25 +00004217 (yyval.TypeWithAttrsList)->push_back(TWA);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004218 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004219 ;}
4220 break;
4221
4222 case 164:
Devang Patel4c3f8442008-02-20 19:13:10 +00004223#line 1490 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004224 {
4225 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004226 TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
4227 TWA.Ty = new PATypeHolder(Type::VoidTy);
Chris Lattner38905612008-02-19 04:36:25 +00004228 (yyval.TypeWithAttrsList)->push_back(TWA);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004229 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004230 ;}
4231 break;
4232
4233 case 165:
Devang Patel4c3f8442008-02-20 19:13:10 +00004234#line 1497 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004235 {
4236 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004237 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004238 ;}
4239 break;
4240
4241 case 166:
Devang Patel4c3f8442008-02-20 19:13:10 +00004242#line 1505 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004243 {
4244 (yyval.TypeList) = new std::list<PATypeHolder>();
4245 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal));
4246 delete (yyvsp[(1) - (1)].TypeVal);
Reid Spencer3da59db2006-11-27 01:05:10 +00004247 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004248 ;}
4249 break;
4250
4251 case 167:
Devang Patel4c3f8442008-02-20 19:13:10 +00004252#line 1511 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004253 {
4254 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal));
4255 delete (yyvsp[(3) - (3)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004256 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004257 ;}
4258 break;
4259
4260 case 168:
Devang Patel4c3f8442008-02-20 19:13:10 +00004261#line 1523 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004262 { // Nonempty unsized arr
Reid Spencer14310612006-12-31 05:40:51 +00004263 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00004264 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4265 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004266 if (ATy == 0)
Reid Spencer61c83e02006-08-18 08:43:06 +00004267 GEN_ERROR("Cannot make array constant with type: '" +
Chris Lattner38905612008-02-19 04:36:25 +00004268 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004269 const Type *ETy = ATy->getElementType();
4270 int NumElements = ATy->getNumElements();
4271
4272 // Verify that we have the correct size...
Chris Lattner38905612008-02-19 04:36:25 +00004273 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004274 GEN_ERROR("Type mismatch: constant sized array initialized with " +
Chris Lattner38905612008-02-19 04:36:25 +00004275 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Reid Spencerb5334b02007-02-05 10:18:06 +00004276 itostr(NumElements) + "");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004277
4278 // Verify all elements are correct type!
Chris Lattner38905612008-02-19 04:36:25 +00004279 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4280 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004281 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4282 ETy->getDescription() +"' as required!\nIt is of type '"+
Chris Lattner38905612008-02-19 04:36:25 +00004283 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004284 }
4285
Chris Lattner38905612008-02-19 04:36:25 +00004286 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
4287 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004288 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004289 ;}
4290 break;
4291
4292 case 169:
Devang Patel4c3f8442008-02-20 19:13:10 +00004293#line 1551 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004294 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004295 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00004296 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4297 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004298 if (ATy == 0)
4299 GEN_ERROR("Cannot make array constant with type: '" +
Chris Lattner38905612008-02-19 04:36:25 +00004300 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004301
Andrew Lenharth6353e052006-12-08 18:07:09 +00004302 int NumElements = ATy->getNumElements();
4303 if (NumElements != -1 && NumElements != 0)
4304 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
Reid Spencerb5334b02007-02-05 10:18:06 +00004305 " arguments, but has size of " + itostr(NumElements) +"");
Chris Lattner38905612008-02-19 04:36:25 +00004306 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
4307 delete (yyvsp[(1) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00004308 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004309 ;}
4310 break;
4311
4312 case 170:
Devang Patel4c3f8442008-02-20 19:13:10 +00004313#line 1567 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004314 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004315 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00004316 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4317 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004318 if (ATy == 0)
4319 GEN_ERROR("Cannot make array constant with type: '" +
Chris Lattner38905612008-02-19 04:36:25 +00004320 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004321
4322 int NumElements = ATy->getNumElements();
4323 const Type *ETy = ATy->getElementType();
Chris Lattner38905612008-02-19 04:36:25 +00004324 if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004325 GEN_ERROR("Can't build string constant of size " +
Chris Lattner38905612008-02-19 04:36:25 +00004326 itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) +
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004327 " when array has size " + itostr(NumElements) + "");
4328 std::vector<Constant*> Vals;
4329 if (ETy == Type::Int8Ty) {
Chris Lattner38905612008-02-19 04:36:25 +00004330 for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
4331 Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004332 } else {
Chris Lattner38905612008-02-19 04:36:25 +00004333 delete (yyvsp[(3) - (3)].StrVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004334 GEN_ERROR("Cannot build string arrays of non byte sized elements");
4335 }
Chris Lattner38905612008-02-19 04:36:25 +00004336 delete (yyvsp[(3) - (3)].StrVal);
4337 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
4338 delete (yyvsp[(1) - (3)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004339 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004340 ;}
4341 break;
4342
4343 case 171:
Devang Patel4c3f8442008-02-20 19:13:10 +00004344#line 1594 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004345 { // Nonempty unsized arr
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004346 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00004347 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
4348 const VectorType *PTy = dyn_cast<VectorType>((yyvsp[(1) - (4)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004349 if (PTy == 0)
4350 GEN_ERROR("Cannot make packed constant with type: '" +
Chris Lattner38905612008-02-19 04:36:25 +00004351 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004352 const Type *ETy = PTy->getElementType();
4353 int NumElements = PTy->getNumElements();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004354
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004355 // Verify that we have the correct size...
Chris Lattner38905612008-02-19 04:36:25 +00004356 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004357 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
Chris Lattner38905612008-02-19 04:36:25 +00004358 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
Reid Spencerb5334b02007-02-05 10:18:06 +00004359 itostr(NumElements) + "");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004360
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004361 // Verify all elements are correct type!
Chris Lattner38905612008-02-19 04:36:25 +00004362 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
4363 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004364 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
4365 ETy->getDescription() +"' as required!\nIt is of type '"+
Chris Lattner38905612008-02-19 04:36:25 +00004366 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004367 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00004368
Chris Lattner38905612008-02-19 04:36:25 +00004369 (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4370 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004371 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004372 ;}
4373 break;
4374
4375 case 172:
Devang Patel4c3f8442008-02-20 19:13:10 +00004376#line 1622 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004377 {
4378 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004379 if (STy == 0)
4380 GEN_ERROR("Cannot make struct constant with type: '" +
Chris Lattner38905612008-02-19 04:36:25 +00004381 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004382
Chris Lattner38905612008-02-19 04:36:25 +00004383 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004384 GEN_ERROR("Illegal number of initializers for structure type");
4385
4386 // Check to ensure that constants are compatible with the type initializer!
Chris Lattner38905612008-02-19 04:36:25 +00004387 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4388 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004389 GEN_ERROR("Expected type '" +
4390 STy->getElementType(i)->getDescription() +
4391 "' for element #" + utostr(i) +
4392 " of structure initializer");
4393
4394 // Check to ensure that Type is not packed
4395 if (STy->isPacked())
4396 GEN_ERROR("Unpacked Initializer to vector type '" +
4397 STy->getDescription() + "'");
4398
Chris Lattner38905612008-02-19 04:36:25 +00004399 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4400 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004401 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004402 ;}
4403 break;
4404
4405 case 173:
Devang Patel4c3f8442008-02-20 19:13:10 +00004406#line 1648 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004407 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004408 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00004409 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4410 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004411 if (STy == 0)
4412 GEN_ERROR("Cannot make struct constant with type: '" +
Chris Lattner38905612008-02-19 04:36:25 +00004413 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004414
4415 if (STy->getNumContainedTypes() != 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00004416 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004417
4418 // Check to ensure that Type is not packed
4419 if (STy->isPacked())
Chris Lattner6cdc6822007-04-26 05:31:05 +00004420 GEN_ERROR("Unpacked Initializer to vector type '" +
4421 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004422
Chris Lattner38905612008-02-19 04:36:25 +00004423 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4424 delete (yyvsp[(1) - (3)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004425 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004426 ;}
4427 break;
4428
4429 case 174:
Devang Patel4c3f8442008-02-20 19:13:10 +00004430#line 1668 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004431 {
4432 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004433 if (STy == 0)
4434 GEN_ERROR("Cannot make struct constant with type: '" +
Chris Lattner38905612008-02-19 04:36:25 +00004435 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004436
Chris Lattner38905612008-02-19 04:36:25 +00004437 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
Reid Spencerb5334b02007-02-05 10:18:06 +00004438 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004439
4440 // Check to ensure that constants are compatible with the type initializer!
Chris Lattner38905612008-02-19 04:36:25 +00004441 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4442 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
Reid Spencer41dff5e2007-01-26 08:05:27 +00004443 GEN_ERROR("Expected type '" +
4444 STy->getElementType(i)->getDescription() +
4445 "' for element #" + utostr(i) +
Reid Spencerb5334b02007-02-05 10:18:06 +00004446 " of structure initializer");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004447
4448 // Check to ensure that Type is packed
4449 if (!STy->isPacked())
Chris Lattner32980692007-02-19 07:44:24 +00004450 GEN_ERROR("Vector initializer to non-vector type '" +
4451 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004452
Chris Lattner38905612008-02-19 04:36:25 +00004453 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4454 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004455 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004456 ;}
4457 break;
4458
4459 case 175:
Devang Patel4c3f8442008-02-20 19:13:10 +00004460#line 1694 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004461 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004462 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00004463 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4464 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004465 if (STy == 0)
4466 GEN_ERROR("Cannot make struct constant with type: '" +
Chris Lattner38905612008-02-19 04:36:25 +00004467 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004468
4469 if (STy->getNumContainedTypes() != 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00004470 GEN_ERROR("Illegal number of initializers for structure type");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004471
4472 // Check to ensure that Type is packed
4473 if (!STy->isPacked())
Chris Lattner32980692007-02-19 07:44:24 +00004474 GEN_ERROR("Vector initializer to non-vector type '" +
4475 STy->getDescription() + "'");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004476
Chris Lattner38905612008-02-19 04:36:25 +00004477 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
4478 delete (yyvsp[(1) - (5)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004479 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004480 ;}
4481 break;
4482
4483 case 176:
Devang Patel4c3f8442008-02-20 19:13:10 +00004484#line 1714 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004485 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004486 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00004487 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4488 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004489 if (PTy == 0)
4490 GEN_ERROR("Cannot make null pointer constant with type: '" +
Chris Lattner38905612008-02-19 04:36:25 +00004491 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004492
Chris Lattner38905612008-02-19 04:36:25 +00004493 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4494 delete (yyvsp[(1) - (2)].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004495 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004496 ;}
4497 break;
4498
4499 case 177:
Devang Patel4c3f8442008-02-20 19:13:10 +00004500#line 1726 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004501 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004502 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00004503 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4504 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4505 delete (yyvsp[(1) - (2)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004506 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004507 ;}
4508 break;
4509
4510 case 178:
Devang Patel4c3f8442008-02-20 19:13:10 +00004511#line 1733 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004512 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004513 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00004514 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4515 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004516 if (Ty == 0)
Devang Patel5a970972008-02-19 22:27:01 +00004517 GEN_ERROR("Global const reference must be a pointer type " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004518
4519 // ConstExprs can exist in the body of a function, thus creating
4520 // GlobalValues whenever they refer to a variable. Because we are in
Reid Spencer93c40032007-03-19 18:40:50 +00004521 // the context of a function, getExistingVal will search the functions
Reid Spencer68a24bd2005-08-27 18:50:39 +00004522 // symbol table instead of the module symbol table for the global symbol,
4523 // which throws things all off. To get around this, we just tell
Reid Spencer93c40032007-03-19 18:40:50 +00004524 // getExistingVal that we are at global scope here.
Reid Spencer68a24bd2005-08-27 18:50:39 +00004525 //
4526 Function *SavedCurFn = CurFun.CurrentFunction;
4527 CurFun.CurrentFunction = 0;
4528
Chris Lattner38905612008-02-19 04:36:25 +00004529 Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00004530 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00004531
4532 CurFun.CurrentFunction = SavedCurFn;
4533
4534 // If this is an initializer for a constant pointer, which is referencing a
4535 // (currently) undefined variable, create a stub now that shall be replaced
4536 // in the future with the right type of variable.
4537 //
4538 if (V == 0) {
Reid Spencera9720f52007-02-05 17:04:00 +00004539 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004540 const PointerType *PT = cast<PointerType>(Ty);
4541
4542 // First check to see if the forward references value is already created!
4543 PerModuleInfo::GlobalRefsType::iterator I =
Chris Lattner38905612008-02-19 04:36:25 +00004544 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004545
4546 if (I != CurModule.GlobalRefs.end()) {
4547 V = I->second; // Placeholder already exists, use it...
Chris Lattner38905612008-02-19 04:36:25 +00004548 (yyvsp[(2) - (2)].ValIDVal).destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +00004549 } else {
4550 std::string Name;
Chris Lattner38905612008-02-19 04:36:25 +00004551 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4552 Name = (yyvsp[(2) - (2)].ValIDVal).getName();
4553 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
Reid Spencer41dff5e2007-01-26 08:05:27 +00004554 GEN_ERROR("Invalid reference to global");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004555
4556 // Create the forward referenced global.
4557 GlobalValue *GV;
4558 if (const FunctionType *FTy =
4559 dyn_cast<FunctionType>(PT->getElementType())) {
Chris Lattner6cdc6822007-04-26 05:31:05 +00004560 GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name,
Reid Spencer68a24bd2005-08-27 18:50:39 +00004561 CurModule.CurrentModule);
4562 } else {
4563 GV = new GlobalVariable(PT->getElementType(), false,
Chris Lattner6cdc6822007-04-26 05:31:05 +00004564 GlobalValue::ExternalWeakLinkage, 0,
Reid Spencer68a24bd2005-08-27 18:50:39 +00004565 Name, CurModule.CurrentModule);
4566 }
4567
4568 // Keep track of the fact that we have a forward ref to recycle it
Chris Lattner38905612008-02-19 04:36:25 +00004569 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004570 V = GV;
4571 }
4572 }
4573
Chris Lattner38905612008-02-19 04:36:25 +00004574 (yyval.ConstVal) = cast<GlobalValue>(V);
4575 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
Reid Spencer61c83e02006-08-18 08:43:06 +00004576 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004577 ;}
4578 break;
4579
4580 case 179:
Devang Patel4c3f8442008-02-20 19:13:10 +00004581#line 1799 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004582 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004583 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00004584 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4585 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004586 GEN_ERROR("Mismatched types for constant expression: " +
Chris Lattner38905612008-02-19 04:36:25 +00004587 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4588 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4589 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004590 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004591 ;}
4592 break;
4593
4594 case 180:
Devang Patel4c3f8442008-02-20 19:13:10 +00004595#line 1809 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004596 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004597 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00004598 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4599 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004600 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4601 GEN_ERROR("Cannot create a null initialized value of this type");
Chris Lattner38905612008-02-19 04:36:25 +00004602 (yyval.ConstVal) = Constant::getNullValue(Ty);
4603 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004604 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004605 ;}
4606 break;
4607
4608 case 181:
Devang Patel4c3f8442008-02-20 19:13:10 +00004609#line 1819 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004610 { // integral constants
4611 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004612 GEN_ERROR("Constant value doesn't fit in type");
Chris Lattner38905612008-02-19 04:36:25 +00004613 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
Reid Spencer38c91a92007-02-28 02:24:54 +00004614 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004615 ;}
4616 break;
4617
4618 case 182:
Devang Patel4c3f8442008-02-20 19:13:10 +00004619#line 1825 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004620 { // arbitrary precision integer constants
4621 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4622 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004623 GEN_ERROR("Constant value does not fit in type");
4624 }
Chris Lattner38905612008-02-19 04:36:25 +00004625 (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
4626 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4627 delete (yyvsp[(2) - (2)].APIntVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004628 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004629 ;}
4630 break;
4631
4632 case 183:
Devang Patel4c3f8442008-02-20 19:13:10 +00004633#line 1835 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004634 { // integral constants
4635 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004636 GEN_ERROR("Constant value doesn't fit in type");
Chris Lattner38905612008-02-19 04:36:25 +00004637 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004638 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004639 ;}
4640 break;
4641
4642 case 184:
Devang Patel4c3f8442008-02-20 19:13:10 +00004643#line 1841 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004644 { // arbitrary precision integer constants
4645 uint32_t BitWidth = cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth();
4646 if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004647 GEN_ERROR("Constant value does not fit in type");
4648 }
Chris Lattner38905612008-02-19 04:36:25 +00004649 (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
4650 (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
4651 delete (yyvsp[(2) - (2)].APIntVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004652 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004653 ;}
4654 break;
4655
4656 case 185:
Devang Patel4c3f8442008-02-20 19:13:10 +00004657#line 1851 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004658 { // Boolean constants
4659 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4660 (yyval.ConstVal) = ConstantInt::getTrue();
Reid Spencer38c91a92007-02-28 02:24:54 +00004661 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004662 ;}
4663 break;
4664
4665 case 186:
Devang Patel4c3f8442008-02-20 19:13:10 +00004666#line 1856 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004667 { // Boolean constants
4668 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4669 (yyval.ConstVal) = ConstantInt::getFalse();
Reid Spencer6f407902007-01-13 05:00:46 +00004670 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004671 ;}
4672 break;
4673
4674 case 187:
Devang Patel4c3f8442008-02-20 19:13:10 +00004675#line 1861 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004676 { // Floating point constants
4677 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004678 GEN_ERROR("Floating point constant invalid for type");
Dale Johannesenc72cd7e2007-09-11 18:33:39 +00004679 // Lexer has no type info, so builds all float and double FP constants
4680 // as double. Fix this here. Long double is done right.
Chris Lattner38905612008-02-19 04:36:25 +00004681 if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
4682 (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
4683 (yyval.ConstVal) = ConstantFP::get((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal));
4684 delete (yyvsp[(2) - (2)].FPVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004685 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004686 ;}
4687 break;
4688
4689 case 188:
Devang Patel4c3f8442008-02-20 19:13:10 +00004690#line 1874 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004691 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004692 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00004693 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4694 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4695 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4696 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004697 GEN_ERROR("invalid cast opcode for cast from '" +
4698 Val->getType()->getDescription() + "' to '" +
4699 DestTy->getDescription() + "'");
Chris Lattner38905612008-02-19 04:36:25 +00004700 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4701 delete (yyvsp[(5) - (6)].TypeVal);
4702 ;}
4703 break;
4704
4705 case 189:
Devang Patel4c3f8442008-02-20 19:13:10 +00004706#line 1886 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004707 {
4708 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
Reid Spencerb5334b02007-02-05 10:18:06 +00004709 GEN_ERROR("GetElementPtr requires a pointer operand");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004710
4711 const Type *IdxTy =
Chris Lattner38905612008-02-19 04:36:25 +00004712 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end(),
Chris Lattner7d9801d2007-02-13 00:58:01 +00004713 true);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004714 if (!IdxTy)
Reid Spencerb5334b02007-02-05 10:18:06 +00004715 GEN_ERROR("Index list invalid for constant getelementptr");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004716
Chris Lattnerf7469af2007-01-31 04:44:08 +00004717 SmallVector<Constant*, 8> IdxVec;
Chris Lattner38905612008-02-19 04:36:25 +00004718 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4719 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004720 IdxVec.push_back(C);
4721 else
Reid Spencerb5334b02007-02-05 10:18:06 +00004722 GEN_ERROR("Indices to constant getelementptr must be constants");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004723
Chris Lattner38905612008-02-19 04:36:25 +00004724 delete (yyvsp[(4) - (5)].ValueList);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004725
Chris Lattner38905612008-02-19 04:36:25 +00004726 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
Andrew Lenharth6353e052006-12-08 18:07:09 +00004727 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004728 ;}
4729 break;
4730
4731 case 190:
Devang Patel4c3f8442008-02-20 19:13:10 +00004732#line 1908 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004733 {
4734 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004735 GEN_ERROR("Select condition must be of boolean type");
Chris Lattner38905612008-02-19 04:36:25 +00004736 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004737 GEN_ERROR("Select operand types must match");
Chris Lattner38905612008-02-19 04:36:25 +00004738 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004739 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004740 ;}
4741 break;
4742
4743 case 191:
Devang Patel4c3f8442008-02-20 19:13:10 +00004744#line 1916 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004745 {
4746 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004747 GEN_ERROR("Binary operator types must match");
4748 CHECK_FOR_ERROR;
Chris Lattner38905612008-02-19 04:36:25 +00004749 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
4750 ;}
4751 break;
4752
4753 case 192:
Devang Patel4c3f8442008-02-20 19:13:10 +00004754#line 1922 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004755 {
4756 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004757 GEN_ERROR("Logical operator types must match");
Chris Lattner38905612008-02-19 04:36:25 +00004758 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
4759 if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
4760 !cast<VectorType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004761 GEN_ERROR("Logical operator requires integral operands");
4762 }
Chris Lattner38905612008-02-19 04:36:25 +00004763 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004764 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004765 ;}
4766 break;
4767
4768 case 193:
Devang Patel4c3f8442008-02-20 19:13:10 +00004769#line 1933 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004770 {
4771 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004772 GEN_ERROR("icmp operand types must match");
Chris Lattner38905612008-02-19 04:36:25 +00004773 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4774 ;}
4775 break;
4776
4777 case 194:
Devang Patel4c3f8442008-02-20 19:13:10 +00004778#line 1938 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004779 {
4780 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004781 GEN_ERROR("fcmp operand types must match");
Chris Lattner38905612008-02-19 04:36:25 +00004782 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4783 ;}
4784 break;
4785
4786 case 195:
Devang Patel4c3f8442008-02-20 19:13:10 +00004787#line 1943 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004788 {
4789 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004790 GEN_ERROR("Invalid extractelement operands");
Chris Lattner38905612008-02-19 04:36:25 +00004791 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004792 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004793 ;}
4794 break;
4795
4796 case 196:
Devang Patel4c3f8442008-02-20 19:13:10 +00004797#line 1949 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004798 {
4799 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004800 GEN_ERROR("Invalid insertelement operands");
Chris Lattner38905612008-02-19 04:36:25 +00004801 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004802 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004803 ;}
4804 break;
4805
4806 case 197:
Devang Patel4c3f8442008-02-20 19:13:10 +00004807#line 1955 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004808 {
4809 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004810 GEN_ERROR("Invalid shufflevector operands");
Chris Lattner38905612008-02-19 04:36:25 +00004811 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004812 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004813 ;}
4814 break;
4815
4816 case 198:
Devang Patel4c3f8442008-02-20 19:13:10 +00004817#line 1964 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004818 {
4819 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004820 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004821 ;}
4822 break;
4823
4824 case 199:
Devang Patel4c3f8442008-02-20 19:13:10 +00004825#line 1968 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004826 {
4827 (yyval.ConstVector) = new std::vector<Constant*>();
4828 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004829 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004830 ;}
4831 break;
4832
4833 case 200:
Devang Patel4c3f8442008-02-20 19:13:10 +00004834#line 1976 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004835 { (yyval.BoolVal) = false; ;}
4836 break;
4837
4838 case 201:
Devang Patel4c3f8442008-02-20 19:13:10 +00004839#line 1976 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004840 { (yyval.BoolVal) = true; ;}
4841 break;
4842
4843 case 202:
Devang Patel4c3f8442008-02-20 19:13:10 +00004844#line 1979 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004845 { (yyval.BoolVal) = true; ;}
4846 break;
4847
4848 case 203:
Devang Patel4c3f8442008-02-20 19:13:10 +00004849#line 1979 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004850 { (yyval.BoolVal) = false; ;}
4851 break;
4852
4853 case 204:
Devang Patel4c3f8442008-02-20 19:13:10 +00004854#line 1982 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004855 {
4856 const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
4857 Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
Chris Lattner0275cff2007-08-06 21:00:46 +00004858 CHECK_FOR_ERROR
Anton Korobeynikov38e09802007-04-28 13:48:45 +00004859 GlobalValue* Aliasee = dyn_cast<GlobalValue>(V);
4860 if (!Aliasee)
4861 GEN_ERROR("Aliases can be created only to global values");
4862
Chris Lattner38905612008-02-19 04:36:25 +00004863 (yyval.ConstVal) = Aliasee;
Anton Korobeynikov38e09802007-04-28 13:48:45 +00004864 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004865 delete (yyvsp[(1) - (2)].TypeVal);
4866 ;}
4867 break;
4868
4869 case 205:
Devang Patel4c3f8442008-02-20 19:13:10 +00004870#line 1994 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004871 {
4872 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4873 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4874 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
Anton Korobeynikov38e09802007-04-28 13:48:45 +00004875 GEN_ERROR("invalid cast opcode for cast from '" +
4876 Val->getType()->getDescription() + "' to '" +
4877 DestTy->getDescription() + "'");
4878
Chris Lattner38905612008-02-19 04:36:25 +00004879 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
Anton Korobeynikov38e09802007-04-28 13:48:45 +00004880 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004881 delete (yyvsp[(5) - (6)].TypeVal);
4882 ;}
4883 break;
4884
4885 case 206:
Devang Patel4c3f8442008-02-20 19:13:10 +00004886#line 2015 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004887 {
4888 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004889 CurModule.ModuleDone();
4890 CHECK_FOR_ERROR;
Chris Lattner38905612008-02-19 04:36:25 +00004891 ;}
4892 break;
4893
4894 case 207:
Devang Patel4c3f8442008-02-20 19:13:10 +00004895#line 2020 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004896 {
4897 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
Christopher Lambbf3348d2007-12-12 08:45:45 +00004898 CurModule.ModuleDone();
4899 CHECK_FOR_ERROR;
Chris Lattner38905612008-02-19 04:36:25 +00004900 ;}
4901 break;
4902
4903 case 210:
Devang Patel4c3f8442008-02-20 19:13:10 +00004904#line 2033 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004905 { CurFun.isDeclare = false; ;}
4906 break;
4907
4908 case 211:
Devang Patel4c3f8442008-02-20 19:13:10 +00004909#line 2033 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004910 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004911 CurFun.FunctionDone();
4912 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004913 ;}
4914 break;
4915
4916 case 212:
Devang Patel4c3f8442008-02-20 19:13:10 +00004917#line 2037 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004918 { CurFun.isDeclare = true; ;}
4919 break;
4920
4921 case 213:
Devang Patel4c3f8442008-02-20 19:13:10 +00004922#line 2037 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004923 {
Gordon Henriksen80a75bf2007-12-10 03:18:06 +00004924 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004925 ;}
4926 break;
4927
4928 case 214:
Devang Patel4c3f8442008-02-20 19:13:10 +00004929#line 2040 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004930 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00004931 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004932 ;}
4933 break;
4934
4935 case 215:
Devang Patel4c3f8442008-02-20 19:13:10 +00004936#line 2043 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004937 {
Reid Spencer14310612006-12-31 05:40:51 +00004938 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00004939 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004940 // Eagerly resolve types. This is not an optimization, this is a
4941 // requirement that is due to the fact that we could have this:
4942 //
4943 // %list = type { %list * }
4944 // %list = type { %list * } ; repeated type decl
4945 //
4946 // If types are not resolved eagerly, then the two types will not be
4947 // determined to be the same type!
4948 //
Chris Lattner38905612008-02-19 04:36:25 +00004949 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004950
Chris Lattner38905612008-02-19 04:36:25 +00004951 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Reid Spencer5b7e7532006-09-28 19:28:24 +00004952 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00004953 // If this is a named type that is not a redefinition, add it to the slot
4954 // table.
Chris Lattner38905612008-02-19 04:36:25 +00004955 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004956 }
Reid Spencera132e042006-12-03 05:46:11 +00004957
Chris Lattner38905612008-02-19 04:36:25 +00004958 delete (yyvsp[(3) - (3)].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004959 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004960 ;}
4961 break;
Reid Spencerb8f85052007-07-31 03:50:36 +00004962
Chris Lattner38905612008-02-19 04:36:25 +00004963 case 216:
Devang Patel4c3f8442008-02-20 19:13:10 +00004964#line 2067 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004965 {
4966 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
4967
4968 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004969 CHECK_FOR_ERROR
4970 // If this is a named type that is not a redefinition, add it to the slot
4971 // table.
Chris Lattner38905612008-02-19 04:36:25 +00004972 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004973 }
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004974 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004975 ;}
4976 break;
4977
4978 case 217:
Devang Patel4c3f8442008-02-20 19:13:10 +00004979#line 2079 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004980 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004981 /* "Externally Visible" Linkage */
Chris Lattner38905612008-02-19 04:36:25 +00004982 if ((yyvsp[(5) - (6)].ConstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00004983 GEN_ERROR("Global value initializer is not a constant");
Chris Lattner38905612008-02-19 04:36:25 +00004984 CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), GlobalValue::ExternalLinkage,
4985 (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 +00004986 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00004987 ;}
4988 break;
4989
4990 case 218:
Devang Patel4c3f8442008-02-20 19:13:10 +00004991#line 2086 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004992 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00004993 CurGV = 0;
Chris Lattner38905612008-02-19 04:36:25 +00004994 ;}
4995 break;
4996
4997 case 219:
Devang Patel4c3f8442008-02-20 19:13:10 +00004998#line 2090 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00004999 {
5000 if ((yyvsp[(6) - (7)].ConstVal) == 0)
Christopher Lambbf3348d2007-12-12 08:45:45 +00005001 GEN_ERROR("Global value initializer is not a constant");
Chris Lattner38905612008-02-19 04:36:25 +00005002 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 +00005003 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005004 ;}
5005 break;
5006
5007 case 220:
Devang Patel4c3f8442008-02-20 19:13:10 +00005008#line 2095 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005009 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005010 CurGV = 0;
Chris Lattner38905612008-02-19 04:36:25 +00005011 ;}
5012 break;
5013
5014 case 221:
Devang Patel4c3f8442008-02-20 19:13:10 +00005015#line 2099 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005016 {
Christopher Lambbf3348d2007-12-12 08:45:45 +00005017 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00005018 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (7)].TypeVal))->getDescription());
5019 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 +00005020 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005021 delete (yyvsp[(6) - (7)].TypeVal);
5022 ;}
5023 break;
5024
5025 case 222:
Devang Patel4c3f8442008-02-20 19:13:10 +00005026#line 2105 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005027 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005028 CurGV = 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +00005029 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005030 ;}
5031 break;
5032
5033 case 223:
Devang Patel4c3f8442008-02-20 19:13:10 +00005034#line 2109 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005035 {
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005036 std::string Name;
Chris Lattner38905612008-02-19 04:36:25 +00005037 if ((yyvsp[(1) - (5)].StrVal)) {
5038 Name = *(yyvsp[(1) - (5)].StrVal);
5039 delete (yyvsp[(1) - (5)].StrVal);
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005040 }
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005041 if (Name.empty())
5042 GEN_ERROR("Alias name cannot be empty");
5043
Chris Lattner38905612008-02-19 04:36:25 +00005044 Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005045 if (Aliasee == 0)
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005046 GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005047
Chris Lattner38905612008-02-19 04:36:25 +00005048 GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005049 CurModule.CurrentModule);
Chris Lattner38905612008-02-19 04:36:25 +00005050 GA->setVisibility((yyvsp[(2) - (5)].Visibility));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005051 InsertValue(GA, CurModule.Values);
Chris Lattner569f7372007-09-10 23:24:14 +00005052
5053
5054 // If there was a forward reference of this alias, resolve it now.
5055
5056 ValID ID;
5057 if (!Name.empty())
5058 ID = ValID::createGlobalName(Name);
5059 else
5060 ID = ValID::createGlobalID(CurModule.Values.size()-1);
5061
5062 if (GlobalValue *FWGV =
5063 CurModule.GetForwardRefForGlobal(GA->getType(), ID)) {
5064 // Replace uses of the fwdref with the actual alias.
5065 FWGV->replaceAllUsesWith(GA);
5066 if (GlobalVariable *GV = dyn_cast<GlobalVariable>(FWGV))
5067 GV->eraseFromParent();
5068 else
5069 cast<Function>(FWGV)->eraseFromParent();
5070 }
5071 ID.destroy();
5072
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005073 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005074 ;}
5075 break;
5076
5077 case 224:
Devang Patel4c3f8442008-02-20 19:13:10 +00005078#line 2149 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005079 {
Anton Korobeynikov77d0f972007-04-25 14:29:12 +00005080 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005081 ;}
5082 break;
5083
5084 case 225:
Devang Patel4c3f8442008-02-20 19:13:10 +00005085#line 2152 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005086 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005087 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005088 ;}
5089 break;
5090
5091 case 226:
Devang Patel4c3f8442008-02-20 19:13:10 +00005092#line 2158 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005093 {
Chris Lattner66316012006-01-24 04:14:29 +00005094 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
Chris Lattner66316012006-01-24 04:14:29 +00005095 if (AsmSoFar.empty())
Chris Lattner38905612008-02-19 04:36:25 +00005096 CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
Chris Lattner66316012006-01-24 04:14:29 +00005097 else
Chris Lattner38905612008-02-19 04:36:25 +00005098 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
5099 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00005100 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005101;}
5102 break;
5103
5104 case 227:
Devang Patel4c3f8442008-02-20 19:13:10 +00005105#line 2168 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005106 {
5107 CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
5108 delete (yyvsp[(3) - (3)].StrVal);
5109 ;}
5110 break;
5111
5112 case 228:
Devang Patel4c3f8442008-02-20 19:13:10 +00005113#line 2172 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005114 {
5115 CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
5116 delete (yyvsp[(3) - (3)].StrVal);
5117 ;}
5118 break;
5119
5120 case 230:
Devang Patel4c3f8442008-02-20 19:13:10 +00005121#line 2179 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005122 {
5123 CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
5124 delete (yyvsp[(3) - (3)].StrVal);
Christopher Lambbf3348d2007-12-12 08:45:45 +00005125 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005126 ;}
5127 break;
5128
5129 case 231:
Devang Patel4c3f8442008-02-20 19:13:10 +00005130#line 2184 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005131 {
5132 CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
5133 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer1013b4d2007-07-31 14:41:17 +00005134 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005135 ;}
5136 break;
5137
5138 case 232:
Devang Patel4c3f8442008-02-20 19:13:10 +00005139#line 2189 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005140 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005141 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005142 ;}
5143 break;
5144
5145 case 233:
Devang Patel4c3f8442008-02-20 19:13:10 +00005146#line 2198 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005147 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005148 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00005149 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
5150 if (*(yyvsp[(3) - (5)].TypeVal) == Type::VoidTy)
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005151 GEN_ERROR("void typed arguments are invalid");
Chris Lattner38905612008-02-19 04:36:25 +00005152 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
5153 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
5154 (yyvsp[(1) - (5)].ArgList)->push_back(E);
Reid Spencer6f407902007-01-13 05:00:46 +00005155 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005156 ;}
5157 break;
5158
5159 case 234:
Devang Patel4c3f8442008-02-20 19:13:10 +00005160#line 2208 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005161 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005162 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00005163 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
5164 if (*(yyvsp[(1) - (3)].TypeVal) == Type::VoidTy)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005165 GEN_ERROR("void typed arguments are invalid");
Chris Lattner38905612008-02-19 04:36:25 +00005166 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
5167 (yyval.ArgList) = new ArgListType;
5168 (yyval.ArgList)->push_back(E);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005169 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005170 ;}
5171 break;
5172
5173 case 235:
Devang Patel4c3f8442008-02-20 19:13:10 +00005174#line 2219 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005175 {
5176 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005177 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005178 ;}
5179 break;
5180
5181 case 236:
Devang Patel4c3f8442008-02-20 19:13:10 +00005182#line 2223 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005183 {
5184 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005185 struct ArgListEntry E;
5186 E.Ty = new PATypeHolder(Type::VoidTy);
5187 E.Name = 0;
Reid Spencer18da0722007-04-11 02:44:20 +00005188 E.Attrs = ParamAttr::None;
Chris Lattner38905612008-02-19 04:36:25 +00005189 (yyval.ArgList)->push_back(E);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005190 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005191 ;}
5192 break;
5193
5194 case 237:
Devang Patel4c3f8442008-02-20 19:13:10 +00005195#line 2232 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005196 {
5197 (yyval.ArgList) = new ArgListType;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005198 struct ArgListEntry E;
5199 E.Ty = new PATypeHolder(Type::VoidTy);
5200 E.Name = 0;
5201 E.Attrs = ParamAttr::None;
Chris Lattner38905612008-02-19 04:36:25 +00005202 (yyval.ArgList)->push_back(E);
Reid Spencer61c83e02006-08-18 08:43:06 +00005203 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005204 ;}
5205 break;
5206
5207 case 238:
Devang Patel4c3f8442008-02-20 19:13:10 +00005208#line 2241 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005209 {
5210 (yyval.ArgList) = 0;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005211 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005212 ;}
5213 break;
5214
5215 case 239:
Devang Patel4c3f8442008-02-20 19:13:10 +00005216#line 2247 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005217 {
5218 std::string FunctionName(*(yyvsp[(3) - (10)].StrVal));
5219 delete (yyvsp[(3) - (10)].StrVal); // Free strdup'd memory!
Reid Spencer68a24bd2005-08-27 18:50:39 +00005220
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005221 // Check the function result for abstractness if this is a define. We should
5222 // have no abstract types at this point
Chris Lattner38905612008-02-19 04:36:25 +00005223 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal)))
5224 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription());
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005225
Reid Spencer68a24bd2005-08-27 18:50:39 +00005226 std::vector<const Type*> ParamTypeList;
Christopher Lamb5c104242007-04-22 20:09:11 +00005227 ParamAttrsVector Attrs;
Chris Lattner38905612008-02-19 04:36:25 +00005228 if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None) {
Duncan Sandsdc024672007-11-27 13:23:08 +00005229 ParamAttrsWithIndex PAWI;
5230 PAWI.index = 0;
Chris Lattner38905612008-02-19 04:36:25 +00005231 PAWI.attrs = (yyvsp[(7) - (10)].ParamAttrs);
Christopher Lamb5c104242007-04-22 20:09:11 +00005232 Attrs.push_back(PAWI);
5233 }
Chris Lattner38905612008-02-19 04:36:25 +00005234 if ((yyvsp[(5) - (10)].ArgList)) { // If there are arguments...
Reid Spencer7b5d4662007-04-09 06:16:21 +00005235 unsigned index = 1;
Chris Lattner38905612008-02-19 04:36:25 +00005236 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); I != (yyvsp[(5) - (10)].ArgList)->end(); ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00005237 const Type* Ty = I->Ty->get();
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00005238 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
5239 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
Reid Spencer14310612006-12-31 05:40:51 +00005240 ParamTypeList.push_back(Ty);
5241 if (Ty != Type::VoidTy)
Christopher Lamb5c104242007-04-22 20:09:11 +00005242 if (I->Attrs != ParamAttr::None) {
Duncan Sandsdc024672007-11-27 13:23:08 +00005243 ParamAttrsWithIndex PAWI;
5244 PAWI.index = index;
5245 PAWI.attrs = I->Attrs;
Christopher Lamb5c104242007-04-22 20:09:11 +00005246 Attrs.push_back(PAWI);
5247 }
Reid Spencer14310612006-12-31 05:40:51 +00005248 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005249 }
5250
5251 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
5252 if (isVarArg) ParamTypeList.pop_back();
5253
Duncan Sandsafa3b6d2007-11-28 17:07:01 +00005254 const ParamAttrsList *PAL = 0;
Christopher Lamb5c104242007-04-22 20:09:11 +00005255 if (!Attrs.empty())
5256 PAL = ParamAttrsList::get(Attrs);
Reid Spencer7b5d4662007-04-09 06:16:21 +00005257
Chris Lattner38905612008-02-19 04:36:25 +00005258 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00005259 const PointerType *PFT = PointerType::getUnqual(FT);
Chris Lattner38905612008-02-19 04:36:25 +00005260 delete (yyvsp[(2) - (10)].TypeVal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005261
5262 ValID ID;
5263 if (!FunctionName.empty()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005264 ID = ValID::createGlobalName((char*)FunctionName.c_str());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005265 } else {
Reid Spencer93c40032007-03-19 18:40:50 +00005266 ID = ValID::createGlobalID(CurModule.Values.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00005267 }
5268
5269 Function *Fn = 0;
5270 // See if this function was forward referenced. If so, recycle the object.
5271 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
5272 // Move the function to the end of the list, from whereever it was
5273 // previously inserted.
5274 Fn = cast<Function>(FWRef);
Duncan Sandsdc024672007-11-27 13:23:08 +00005275 assert(!Fn->getParamAttrs() && "Forward reference has parameter attributes!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005276 CurModule.CurrentModule->getFunctionList().remove(Fn);
5277 CurModule.CurrentModule->getFunctionList().push_back(Fn);
5278 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
Reid Spenceref9b9a72007-02-05 20:47:22 +00005279 (Fn = CurModule.CurrentModule->getFunction(FunctionName))) {
Duncan Sandsdc024672007-11-27 13:23:08 +00005280 if (Fn->getFunctionType() != FT ) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00005281 // The existing function doesn't have the same type. This is an overload
5282 // error.
5283 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Duncan Sandsdc024672007-11-27 13:23:08 +00005284 } else if (Fn->getParamAttrs() != PAL) {
5285 // The existing function doesn't have the same parameter attributes.
5286 // This is an overload error.
5287 GEN_ERROR("Overload of function '" + FunctionName + "' not permitted.");
Reid Spenceref9b9a72007-02-05 20:47:22 +00005288 } else if (!CurFun.isDeclare && !Fn->isDeclaration()) {
Chris Lattner6cdc6822007-04-26 05:31:05 +00005289 // Neither the existing or the current function is a declaration and they
5290 // have the same name and same type. Clearly this is a redefinition.
5291 GEN_ERROR("Redefinition of function '" + FunctionName + "'");
Duncan Sandsdc024672007-11-27 13:23:08 +00005292 } else if (Fn->isDeclaration()) {
Reid Spenceref9b9a72007-02-05 20:47:22 +00005293 // Make sure to strip off any argument names so we can't get conflicts.
Reid Spencer68a24bd2005-08-27 18:50:39 +00005294 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
5295 AI != AE; ++AI)
5296 AI->setName("");
Reid Spenceref9b9a72007-02-05 20:47:22 +00005297 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005298 } else { // Not already defined?
Chris Lattner6cdc6822007-04-26 05:31:05 +00005299 Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
Reid Spencer68a24bd2005-08-27 18:50:39 +00005300 CurModule.CurrentModule);
5301 InsertValue(Fn, CurModule.Values);
5302 }
5303
5304 CurFun.FunctionStart(Fn);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00005305
5306 if (CurFun.isDeclare) {
5307 // If we have declaration, always overwrite linkage. This will allow us to
5308 // correctly handle cases, when pointer to function is passed as argument to
5309 // another function.
5310 Fn->setLinkage(CurFun.Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005311 Fn->setVisibility(CurFun.Visibility);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00005312 }
Chris Lattner38905612008-02-19 04:36:25 +00005313 Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal));
Duncan Sandsdc024672007-11-27 13:23:08 +00005314 Fn->setParamAttrs(PAL);
Chris Lattner38905612008-02-19 04:36:25 +00005315 Fn->setAlignment((yyvsp[(9) - (10)].UIntVal));
5316 if ((yyvsp[(8) - (10)].StrVal)) {
5317 Fn->setSection(*(yyvsp[(8) - (10)].StrVal));
5318 delete (yyvsp[(8) - (10)].StrVal);
Gordon Henriksen80a75bf2007-12-10 03:18:06 +00005319 }
Chris Lattner38905612008-02-19 04:36:25 +00005320 if ((yyvsp[(10) - (10)].StrVal)) {
5321 Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str());
5322 delete (yyvsp[(10) - (10)].StrVal);
Chris Lattnere869eef2005-11-12 00:11:49 +00005323 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005324
5325 // Add all of the arguments we parsed to the function...
Chris Lattner38905612008-02-19 04:36:25 +00005326 if ((yyvsp[(5) - (10)].ArgList)) { // Is null if empty...
Reid Spencer68a24bd2005-08-27 18:50:39 +00005327 if (isVarArg) { // Nuke the last entry
Chris Lattner38905612008-02-19 04:36:25 +00005328 assert((yyvsp[(5) - (10)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (10)].ArgList)->back().Name == 0 &&
Reid Spencera9720f52007-02-05 17:04:00 +00005329 "Not a varargs marker!");
Chris Lattner38905612008-02-19 04:36:25 +00005330 delete (yyvsp[(5) - (10)].ArgList)->back().Ty;
5331 (yyvsp[(5) - (10)].ArgList)->pop_back(); // Delete the last entry
Reid Spencer68a24bd2005-08-27 18:50:39 +00005332 }
5333 Function::arg_iterator ArgIt = Fn->arg_begin();
Reid Spenceref9b9a72007-02-05 20:47:22 +00005334 Function::arg_iterator ArgEnd = Fn->arg_end();
Reid Spencer14310612006-12-31 05:40:51 +00005335 unsigned Idx = 1;
Chris Lattner38905612008-02-19 04:36:25 +00005336 for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin();
5337 I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
Reid Spencer14310612006-12-31 05:40:51 +00005338 delete I->Ty; // Delete the typeholder...
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005339 setValueName(ArgIt, I->Name); // Insert arg into symtab...
Reid Spencer5b7e7532006-09-28 19:28:24 +00005340 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005341 InsertValue(ArgIt);
Reid Spencer14310612006-12-31 05:40:51 +00005342 Idx++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005343 }
Reid Spencera132e042006-12-03 05:46:11 +00005344
Chris Lattner38905612008-02-19 04:36:25 +00005345 delete (yyvsp[(5) - (10)].ArgList); // We're now done with the argument list
Reid Spencer68a24bd2005-08-27 18:50:39 +00005346 }
Reid Spencer61c83e02006-08-18 08:43:06 +00005347 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005348;}
5349 break;
5350
5351 case 242:
Devang Patel4c3f8442008-02-20 19:13:10 +00005352#line 2382 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005353 {
5354 (yyval.FunctionVal) = CurFun.CurrentFunction;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005355
5356 // Make sure that we keep track of the linkage type even if there was a
5357 // previous "declare".
Chris Lattner38905612008-02-19 04:36:25 +00005358 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
5359 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
5360;}
5361 break;
5362
5363 case 245:
Devang Patel4c3f8442008-02-20 19:13:10 +00005364#line 2393 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005365 {
5366 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005367 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005368;}
5369 break;
5370
5371 case 246:
Devang Patel4c3f8442008-02-20 19:13:10 +00005372#line 2398 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005373 {
5374 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
5375 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
5376 (yyval.FunctionVal) = CurFun.CurrentFunction;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005377 CurFun.FunctionDone();
Reid Spencer41dff5e2007-01-26 08:05:27 +00005378 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005379 ;}
5380 break;
5381
5382 case 247:
Devang Patel4c3f8442008-02-20 19:13:10 +00005383#line 2410 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005384 {
5385 (yyval.BoolVal) = false;
Reid Spencer61c83e02006-08-18 08:43:06 +00005386 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005387 ;}
5388 break;
5389
5390 case 248:
Devang Patel4c3f8442008-02-20 19:13:10 +00005391#line 2414 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005392 {
5393 (yyval.BoolVal) = true;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005394 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005395 ;}
5396 break;
5397
5398 case 249:
Devang Patel4c3f8442008-02-20 19:13:10 +00005399#line 2419 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005400 { // A reference to a direct constant
5401 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005402 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005403 ;}
5404 break;
5405
5406 case 250:
Devang Patel4c3f8442008-02-20 19:13:10 +00005407#line 2423 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005408 {
5409 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005410 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005411 ;}
5412 break;
5413
5414 case 251:
Devang Patel4c3f8442008-02-20 19:13:10 +00005415#line 2427 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005416 { // Perhaps it's an FP constant?
5417 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00005418 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005419 ;}
5420 break;
5421
5422 case 252:
Devang Patel4c3f8442008-02-20 19:13:10 +00005423#line 2431 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005424 {
5425 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
Reid Spencere4d87aa2006-12-23 06:05:41 +00005426 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005427 ;}
5428 break;
5429
5430 case 253:
Devang Patel4c3f8442008-02-20 19:13:10 +00005431#line 2435 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005432 {
5433 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00005434 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005435 ;}
5436 break;
5437
5438 case 254:
Devang Patel4c3f8442008-02-20 19:13:10 +00005439#line 2439 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005440 {
5441 (yyval.ValIDVal) = ValID::createNull();
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00005442 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005443 ;}
5444 break;
5445
5446 case 255:
Devang Patel4c3f8442008-02-20 19:13:10 +00005447#line 2443 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005448 {
5449 (yyval.ValIDVal) = ValID::createUndef();
Reid Spencer61c83e02006-08-18 08:43:06 +00005450 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005451 ;}
5452 break;
5453
5454 case 256:
Devang Patel4c3f8442008-02-20 19:13:10 +00005455#line 2447 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005456 { // A vector zero constant.
5457 (yyval.ValIDVal) = ValID::createZeroInit();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005458 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005459 ;}
5460 break;
5461
5462 case 257:
Devang Patel4c3f8442008-02-20 19:13:10 +00005463#line 2451 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005464 { // Nonempty unsized packed vector
5465 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
5466 int NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Reid Spencer68a24bd2005-08-27 18:50:39 +00005467
Reid Spencer9d6565a2007-02-15 02:26:10 +00005468 VectorType* pt = VectorType::get(ETy, NumElements);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005469 PATypeHolder* PTy = new PATypeHolder(
Reid Spencera132e042006-12-03 05:46:11 +00005470 HandleUpRefs(
Reid Spencer9d6565a2007-02-15 02:26:10 +00005471 VectorType::get(
Reid Spencera132e042006-12-03 05:46:11 +00005472 ETy,
5473 NumElements)
5474 )
5475 );
Reid Spencer68a24bd2005-08-27 18:50:39 +00005476
5477 // Verify all elements are correct type!
Chris Lattner38905612008-02-19 04:36:25 +00005478 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
5479 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Reid Spencer61c83e02006-08-18 08:43:06 +00005480 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +00005481 ETy->getDescription() +"' as required!\nIt is of type '" +
Chris Lattner38905612008-02-19 04:36:25 +00005482 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005483 }
5484
Chris Lattner38905612008-02-19 04:36:25 +00005485 (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
5486 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
Reid Spencer832254e2007-02-02 02:16:23 +00005487 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005488 ;}
5489 break;
5490
5491 case 258:
Devang Patel4c3f8442008-02-20 19:13:10 +00005492#line 2476 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005493 {
5494 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
Reid Spencer832254e2007-02-02 02:16:23 +00005495 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005496 ;}
5497 break;
5498
5499 case 259:
Devang Patel4c3f8442008-02-20 19:13:10 +00005500#line 2480 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005501 {
5502 (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
5503 delete (yyvsp[(3) - (5)].StrVal);
5504 delete (yyvsp[(5) - (5)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005505 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005506 ;}
5507 break;
5508
5509 case 260:
Devang Patel4c3f8442008-02-20 19:13:10 +00005510#line 2490 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005511 { // Is it an integer reference...?
5512 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005513 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005514 ;}
5515 break;
5516
5517 case 261:
Devang Patel4c3f8442008-02-20 19:13:10 +00005518#line 2494 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005519 {
5520 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
Reid Spencer832254e2007-02-02 02:16:23 +00005521 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005522 ;}
5523 break;
5524
5525 case 262:
Devang Patel4c3f8442008-02-20 19:13:10 +00005526#line 2498 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005527 { // Is it a named reference...?
5528 (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
5529 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005530 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005531 ;}
5532 break;
5533
5534 case 263:
Devang Patel4c3f8442008-02-20 19:13:10 +00005535#line 2503 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005536 { // Is it a named reference...?
5537 (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
5538 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005539 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005540 ;}
5541 break;
5542
5543 case 266:
Devang Patel4c3f8442008-02-20 19:13:10 +00005544#line 2516 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005545 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005546 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00005547 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5548 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5549 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer832254e2007-02-02 02:16:23 +00005550 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005551 ;}
5552 break;
5553
5554 case 267:
Devang Patel4c3f8442008-02-20 19:13:10 +00005555#line 2525 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005556 {
5557 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005558 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005559 ;}
5560 break;
5561
5562 case 268:
Devang Patel4c3f8442008-02-20 19:13:10 +00005563#line 2529 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005564 { // Do not allow functions with 0 basic blocks
5565 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005566 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005567 ;}
5568 break;
5569
5570 case 269:
Devang Patel4c3f8442008-02-20 19:13:10 +00005571#line 2538 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005572 {
5573 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005574 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005575 InsertValue((yyvsp[(3) - (3)].TermInstVal));
5576 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
5577 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005578 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005579 ;}
5580 break;
5581
5582 case 270:
Devang Patel4c3f8442008-02-20 19:13:10 +00005583#line 2547 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005584 {
5585 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005586 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5587 if (CI2->getParent() == 0)
Chris Lattner38905612008-02-19 04:36:25 +00005588 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
5589 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
5590 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
Anton Korobeynikov38e09802007-04-28 13:48:45 +00005591 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005592 ;}
5593 break;
5594
5595 case 271:
Devang Patel4c3f8442008-02-20 19:13:10 +00005596#line 2556 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005597 { // Empty space between instruction lists
5598 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
Reid Spencered951ea2007-05-19 07:22:10 +00005599 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005600 ;}
5601 break;
5602
5603 case 272:
Devang Patel4c3f8442008-02-20 19:13:10 +00005604#line 2560 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005605 { // Labelled (named) basic block
5606 (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
5607 delete (yyvsp[(1) - (1)].StrVal);
Reid Spencered951ea2007-05-19 07:22:10 +00005608 CHECK_FOR_ERROR
Reid Spencer0a8a16b2007-05-22 18:52:55 +00005609
Chris Lattner38905612008-02-19 04:36:25 +00005610 ;}
5611 break;
Reid Spencerb8f85052007-07-31 03:50:36 +00005612
Chris Lattner38905612008-02-19 04:36:25 +00005613 case 273:
Devang Patel4c3f8442008-02-20 19:13:10 +00005614#line 2567 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005615 { // Return with a result...
5616 (yyval.TermInstVal) = new ReturnInst((yyvsp[(2) - (2)].ValueVal));
5617 CHECK_FOR_ERROR
5618 ;}
5619 break;
5620
5621 case 274:
Devang Patel4c3f8442008-02-20 19:13:10 +00005622#line 2571 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005623 { // Return with no result...
5624 (yyval.TermInstVal) = new ReturnInst();
5625 CHECK_FOR_ERROR
5626 ;}
5627 break;
5628
5629 case 275:
Devang Patel4c3f8442008-02-20 19:13:10 +00005630#line 2575 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005631 { // Unconditional Branch...
5632 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
5633 CHECK_FOR_ERROR
5634 (yyval.TermInstVal) = new BranchInst(tmpBB);
5635 ;}
5636 break;
5637
5638 case 276:
Devang Patel4c3f8442008-02-20 19:13:10 +00005639#line 2580 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005640 {
5641 assert(cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?");
5642 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5643 CHECK_FOR_ERROR
5644 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
5645 CHECK_FOR_ERROR
5646 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
5647 CHECK_FOR_ERROR
5648 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
5649 ;}
5650 break;
5651
5652 case 277:
Devang Patel4c3f8442008-02-20 19:13:10 +00005653#line 2590 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005654 {
5655 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
5656 CHECK_FOR_ERROR
5657 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
5658 CHECK_FOR_ERROR
5659 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
5660 (yyval.TermInstVal) = S;
5661
5662 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
5663 E = (yyvsp[(8) - (9)].JumpTable)->end();
Reid Spencer68a24bd2005-08-27 18:50:39 +00005664 for (; I != E; ++I) {
5665 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5666 S->addCase(CI, I->second);
5667 else
Reid Spencerb5334b02007-02-05 10:18:06 +00005668 GEN_ERROR("Switch case is constant, but not a simple integer");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005669 }
Chris Lattner38905612008-02-19 04:36:25 +00005670 delete (yyvsp[(8) - (9)].JumpTable);
Reid Spencer61c83e02006-08-18 08:43:06 +00005671 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005672 ;}
5673 break;
5674
5675 case 278:
Devang Patel4c3f8442008-02-20 19:13:10 +00005676#line 2609 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005677 {
5678 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005679 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005680 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005681 CHECK_FOR_ERROR
5682 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
Chris Lattner38905612008-02-19 04:36:25 +00005683 (yyval.TermInstVal) = S;
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005684 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005685 ;}
5686 break;
5687
5688 case 279:
Devang Patel4c3f8442008-02-20 19:13:10 +00005689#line 2619 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005690 {
Reid Spencer3822ff52006-11-08 06:47:33 +00005691
Reid Spencer14310612006-12-31 05:40:51 +00005692 // Handle the short syntax
5693 const PointerType *PFTy = 0;
5694 const FunctionType *Ty = 0;
Chris Lattner38905612008-02-19 04:36:25 +00005695 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
Reid Spencer68a24bd2005-08-27 18:50:39 +00005696 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5697 // Pull out the types of all of the arguments...
5698 std::vector<const Type*> ParamTypes;
Chris Lattner38905612008-02-19 04:36:25 +00005699 ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00005700 for (; I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00005701 const Type *Ty = I->Val->getType();
5702 if (Ty == Type::VoidTy)
5703 GEN_ERROR("Short call syntax cannot be used with varargs");
5704 ParamTypes.push_back(Ty);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005705 }
Chris Lattner38905612008-02-19 04:36:25 +00005706 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00005707 PFTy = PointerType::getUnqual(Ty);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005708 }
5709
Chris Lattner38905612008-02-19 04:36:25 +00005710 delete (yyvsp[(3) - (14)].TypeVal);
Reid Spencer66728ef2007-03-20 01:13:36 +00005711
Chris Lattner38905612008-02-19 04:36:25 +00005712 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00005713 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005714 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005715 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005716 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00005717 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005718
Duncan Sandsdc024672007-11-27 13:23:08 +00005719 ParamAttrsVector Attrs;
Chris Lattner38905612008-02-19 04:36:25 +00005720 if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None) {
5721 ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[(8) - (14)].ParamAttrs);
Duncan Sandsdc024672007-11-27 13:23:08 +00005722 Attrs.push_back(PAWI);
5723 }
5724
Reid Spencer14310612006-12-31 05:40:51 +00005725 // Check the arguments
5726 ValueList Args;
Chris Lattner38905612008-02-19 04:36:25 +00005727 if ((yyvsp[(6) - (14)].ParamList)->empty()) { // Has no arguments?
Reid Spencer14310612006-12-31 05:40:51 +00005728 // Make sure no arguments is a good thing!
5729 if (Ty->getNumParams() != 0)
5730 GEN_ERROR("No arguments passed to a function that "
Reid Spencerb5334b02007-02-05 10:18:06 +00005731 "expects arguments");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005732 } else { // Has arguments?
5733 // Loop through FunctionType's arguments and ensure they are specified
5734 // correctly!
Reid Spencer68a24bd2005-08-27 18:50:39 +00005735 FunctionType::param_iterator I = Ty->param_begin();
5736 FunctionType::param_iterator E = Ty->param_end();
Chris Lattner38905612008-02-19 04:36:25 +00005737 ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00005738 unsigned index = 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005739
Duncan Sandsdc024672007-11-27 13:23:08 +00005740 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00005741 if (ArgI->Val->getType() != *I)
5742 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00005743 (*I)->getDescription() + "'");
Reid Spencer14310612006-12-31 05:40:51 +00005744 Args.push_back(ArgI->Val);
Duncan Sandsdc024672007-11-27 13:23:08 +00005745 if (ArgI->Attrs != ParamAttr::None) {
5746 ParamAttrsWithIndex PAWI;
5747 PAWI.index = index;
5748 PAWI.attrs = ArgI->Attrs;
5749 Attrs.push_back(PAWI);
5750 }
Reid Spencer14310612006-12-31 05:40:51 +00005751 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005752
Reid Spencer14310612006-12-31 05:40:51 +00005753 if (Ty->isVarArg()) {
5754 if (I == E)
Chris Lattner38905612008-02-19 04:36:25 +00005755 for (; ArgI != ArgE; ++ArgI, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00005756 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner38905612008-02-19 04:36:25 +00005757 if (ArgI->Attrs != ParamAttr::None) {
5758 ParamAttrsWithIndex PAWI;
5759 PAWI.index = index;
5760 PAWI.attrs = ArgI->Attrs;
5761 Attrs.push_back(PAWI);
5762 }
5763 }
Reid Spencer14310612006-12-31 05:40:51 +00005764 } else if (I != E || ArgI != ArgE)
Reid Spencerb5334b02007-02-05 10:18:06 +00005765 GEN_ERROR("Invalid number of parameters detected");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005766 }
Reid Spencer14310612006-12-31 05:40:51 +00005767
Duncan Sandsafa3b6d2007-11-28 17:07:01 +00005768 const ParamAttrsList *PAL = 0;
Duncan Sandsdc024672007-11-27 13:23:08 +00005769 if (!Attrs.empty())
5770 PAL = ParamAttrsList::get(Attrs);
5771
Reid Spencer14310612006-12-31 05:40:51 +00005772 // Create the InvokeInst
Chris Lattnerd80fb8b2007-08-29 16:15:23 +00005773 InvokeInst *II = new InvokeInst(V, Normal, Except, Args.begin(), Args.end());
Chris Lattner38905612008-02-19 04:36:25 +00005774 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
Duncan Sandsdc024672007-11-27 13:23:08 +00005775 II->setParamAttrs(PAL);
Chris Lattner38905612008-02-19 04:36:25 +00005776 (yyval.TermInstVal) = II;
5777 delete (yyvsp[(6) - (14)].ParamList);
Andrew Lenharth6353e052006-12-08 18:07:09 +00005778 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005779 ;}
5780 break;
5781
5782 case 280:
Devang Patel4c3f8442008-02-20 19:13:10 +00005783#line 2709 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005784 {
5785 (yyval.TermInstVal) = new UnwindInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00005786 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005787 ;}
5788 break;
5789
5790 case 281:
Devang Patel4c3f8442008-02-20 19:13:10 +00005791#line 2713 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005792 {
5793 (yyval.TermInstVal) = new UnreachableInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00005794 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005795 ;}
5796 break;
5797
5798 case 282:
Devang Patel4c3f8442008-02-20 19:13:10 +00005799#line 2720 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005800 {
5801 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
5802 Constant *V = cast<Constant>(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005803 CHECK_FOR_ERROR
5804 if (V == 0)
5805 GEN_ERROR("May only switch on a constant pool value");
5806
Chris Lattner38905612008-02-19 04:36:25 +00005807 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005808 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005809 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5810 ;}
5811 break;
5812
5813 case 283:
Devang Patel4c3f8442008-02-20 19:13:10 +00005814#line 2731 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005815 {
5816 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5817 Constant *V = cast<Constant>(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005818 CHECK_FOR_ERROR
5819
5820 if (V == 0)
Reid Spencerb5334b02007-02-05 10:18:06 +00005821 GEN_ERROR("May only switch on a constant pool value");
Andrew Lenharth6353e052006-12-08 18:07:09 +00005822
Chris Lattner38905612008-02-19 04:36:25 +00005823 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005824 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005825 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5826 ;}
5827 break;
5828
5829 case 284:
Devang Patel4c3f8442008-02-20 19:13:10 +00005830#line 2744 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005831 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005832 // Is this definition named?? if so, assign the name...
Chris Lattner38905612008-02-19 04:36:25 +00005833 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005834 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005835 InsertValue((yyvsp[(2) - (2)].InstVal));
5836 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005837 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005838 ;}
5839 break;
5840
5841 case 285:
Devang Patel4c3f8442008-02-20 19:13:10 +00005842#line 2754 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005843 { // Used for PHI nodes
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005844 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00005845 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
5846 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5847 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
Reid Spencer6f407902007-01-13 05:00:46 +00005848 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005849 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005850 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005851 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5852 delete (yyvsp[(1) - (6)].TypeVal);
5853 ;}
5854 break;
5855
5856 case 286:
Devang Patel4c3f8442008-02-20 19:13:10 +00005857#line 2765 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005858 {
5859 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
5860 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005861 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005862 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005863 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005864 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5865 ;}
5866 break;
5867
5868 case 287:
Devang Patel4c3f8442008-02-20 19:13:10 +00005869#line 2775 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005870 {
Duncan Sandsdc024672007-11-27 13:23:08 +00005871 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005872 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00005873 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005874 // Used for call and invoke instructions
Chris Lattner38905612008-02-19 04:36:25 +00005875 (yyval.ParamList) = new ParamList();
5876 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
5877 (yyval.ParamList)->push_back(E);
5878 delete (yyvsp[(1) - (4)].TypeVal);
Duncan Sandsdc024672007-11-27 13:23:08 +00005879 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005880 ;}
5881 break;
5882
5883 case 288:
Devang Patel4c3f8442008-02-20 19:13:10 +00005884#line 2786 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005885 {
Duncan Sandsdc024672007-11-27 13:23:08 +00005886 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Dale Johanneseneb57ea72007-11-05 21:20:28 +00005887 // Labels are only valid in ASMs
Chris Lattner38905612008-02-19 04:36:25 +00005888 (yyval.ParamList) = new ParamList();
5889 ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
5890 (yyval.ParamList)->push_back(E);
Duncan Sandsdc024672007-11-27 13:23:08 +00005891 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005892 ;}
5893 break;
5894
5895 case 289:
Devang Patel4c3f8442008-02-20 19:13:10 +00005896#line 2794 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005897 {
Duncan Sandsdc024672007-11-27 13:23:08 +00005898 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005899 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00005900 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5901 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5902 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
5903 (yyval.ParamList)->push_back(E);
5904 delete (yyvsp[(3) - (6)].TypeVal);
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005905 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005906 ;}
5907 break;
5908
5909 case 290:
Devang Patel4c3f8442008-02-20 19:13:10 +00005910#line 2804 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005911 {
Duncan Sandsdc024672007-11-27 13:23:08 +00005912 // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
Chris Lattner38905612008-02-19 04:36:25 +00005913 (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
5914 ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
5915 (yyval.ParamList)->push_back(E);
Dale Johanneseneb57ea72007-11-05 21:20:28 +00005916 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005917 ;}
5918 break;
5919
5920 case 291:
Devang Patel4c3f8442008-02-20 19:13:10 +00005921#line 2811 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005922 { (yyval.ParamList) = new ParamList(); ;}
5923 break;
5924
5925 case 292:
Devang Patel4c3f8442008-02-20 19:13:10 +00005926#line 2814 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005927 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5928 break;
5929
5930 case 293:
Devang Patel4c3f8442008-02-20 19:13:10 +00005931#line 2815 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005932 {
5933 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
5934 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00005935 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005936 ;}
5937 break;
5938
5939 case 294:
Devang Patel4c3f8442008-02-20 19:13:10 +00005940#line 2822 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005941 {
5942 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00005943 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005944 ;}
5945 break;
5946
5947 case 295:
Devang Patel4c3f8442008-02-20 19:13:10 +00005948#line 2826 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005949 {
5950 (yyval.BoolVal) = false;
Andrew Lenharth6353e052006-12-08 18:07:09 +00005951 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005952 ;}
5953 break;
5954
5955 case 296:
Devang Patel4c3f8442008-02-20 19:13:10 +00005956#line 2831 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005957 {
Reid Spencer14310612006-12-31 05:40:51 +00005958 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00005959 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
5960 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
5961 !isa<VectorType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005962 GEN_ERROR(
5963 "Arithmetic operator requires integer, FP, or packed operands");
Chris Lattner38905612008-02-19 04:36:25 +00005964 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005965 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005966 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005967 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005968 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
5969 if ((yyval.InstVal) == 0)
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005970 GEN_ERROR("binary operator returned null");
Chris Lattner38905612008-02-19 04:36:25 +00005971 delete (yyvsp[(2) - (5)].TypeVal);
5972 ;}
5973 break;
5974
5975 case 297:
Devang Patel4c3f8442008-02-20 19:13:10 +00005976#line 2847 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005977 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005978 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00005979 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
5980 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
5981 if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa<VectorType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
5982 !cast<VectorType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005983 GEN_ERROR("Logical operator requires integral operands");
5984 }
Chris Lattner38905612008-02-19 04:36:25 +00005985 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005986 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005987 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005988 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00005989 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
5990 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00005991 GEN_ERROR("binary operator returned null");
Chris Lattner38905612008-02-19 04:36:25 +00005992 delete (yyvsp[(2) - (5)].TypeVal);
5993 ;}
5994 break;
5995
5996 case 298:
Devang Patel4c3f8442008-02-20 19:13:10 +00005997#line 2864 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00005998 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00005999 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00006000 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6001 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006002 GEN_ERROR("Vector types not supported by icmp instruction");
Chris Lattner38905612008-02-19 04:36:25 +00006003 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006004 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00006005 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006006 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00006007 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
6008 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006009 GEN_ERROR("icmp operator returned null");
Chris Lattner38905612008-02-19 04:36:25 +00006010 delete (yyvsp[(3) - (6)].TypeVal);
6011 ;}
6012 break;
6013
6014 case 299:
Devang Patel4c3f8442008-02-20 19:13:10 +00006015#line 2878 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00006016 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006017 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00006018 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
6019 if (isa<VectorType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006020 GEN_ERROR("Vector types not supported by fcmp instruction");
Chris Lattner38905612008-02-19 04:36:25 +00006021 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006022 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00006023 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006024 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00006025 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
6026 if ((yyval.InstVal) == 0)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006027 GEN_ERROR("fcmp operator returned null");
Chris Lattner38905612008-02-19 04:36:25 +00006028 delete (yyvsp[(3) - (6)].TypeVal);
6029 ;}
6030 break;
6031
6032 case 300:
Devang Patel4c3f8442008-02-20 19:13:10 +00006033#line 2892 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00006034 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006035 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00006036 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6037 Value* Val = (yyvsp[(2) - (4)].ValueVal);
6038 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
6039 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006040 GEN_ERROR("invalid cast opcode for cast from '" +
6041 Val->getType()->getDescription() + "' to '" +
6042 DestTy->getDescription() + "'");
Chris Lattner38905612008-02-19 04:36:25 +00006043 (yyval.InstVal) = CastInst::create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
6044 delete (yyvsp[(4) - (4)].TypeVal);
6045 ;}
6046 break;
6047
6048 case 301:
Devang Patel4c3f8442008-02-20 19:13:10 +00006049#line 2904 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00006050 {
6051 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006052 GEN_ERROR("select condition must be boolean");
Chris Lattner38905612008-02-19 04:36:25 +00006053 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006054 GEN_ERROR("select value types should match");
Chris Lattner38905612008-02-19 04:36:25 +00006055 (yyval.InstVal) = new SelectInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00006056 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00006057 ;}
6058 break;
6059
6060 case 302:
Devang Patel4c3f8442008-02-20 19:13:10 +00006061#line 2912 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00006062 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006063 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00006064 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
6065 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
6066 delete (yyvsp[(4) - (4)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006067 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00006068 ;}
6069 break;
6070
6071 case 303:
Devang Patel4c3f8442008-02-20 19:13:10 +00006072#line 2919 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00006073 {
6074 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006075 GEN_ERROR("Invalid extractelement operands");
Chris Lattner38905612008-02-19 04:36:25 +00006076 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006077 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00006078 ;}
6079 break;
6080
6081 case 304:
Devang Patel4c3f8442008-02-20 19:13:10 +00006082#line 2925 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00006083 {
6084 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006085 GEN_ERROR("Invalid insertelement operands");
Chris Lattner38905612008-02-19 04:36:25 +00006086 (yyval.InstVal) = new InsertElementInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006087 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00006088 ;}
6089 break;
6090
6091 case 305:
Devang Patel4c3f8442008-02-20 19:13:10 +00006092#line 2931 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00006093 {
6094 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006095 GEN_ERROR("Invalid shufflevector operands");
Chris Lattner38905612008-02-19 04:36:25 +00006096 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006097 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00006098 ;}
6099 break;
6100
6101 case 306:
Devang Patel4c3f8442008-02-20 19:13:10 +00006102#line 2937 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00006103 {
6104 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006105 if (!Ty->isFirstClassType())
6106 GEN_ERROR("PHI node operands must be of first class type");
Chris Lattner38905612008-02-19 04:36:25 +00006107 (yyval.InstVal) = new PHINode(Ty);
6108 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
6109 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
6110 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006111 GEN_ERROR("All elements of a PHI node must be of the same type");
Chris Lattner38905612008-02-19 04:36:25 +00006112 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
6113 (yyvsp[(2) - (2)].PHIList)->pop_front();
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006114 }
Chris Lattner38905612008-02-19 04:36:25 +00006115 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006116 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00006117 ;}
6118 break;
6119
6120 case 307:
Devang Patel4c3f8442008-02-20 19:13:10 +00006121#line 2953 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00006122 {
Reid Spencer14310612006-12-31 05:40:51 +00006123
6124 // Handle the short syntax
Andrew Lenharth6353e052006-12-08 18:07:09 +00006125 const PointerType *PFTy = 0;
6126 const FunctionType *Ty = 0;
Chris Lattner38905612008-02-19 04:36:25 +00006127 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
Andrew Lenharth6353e052006-12-08 18:07:09 +00006128 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
6129 // Pull out the types of all of the arguments...
6130 std::vector<const Type*> ParamTypes;
Chris Lattner38905612008-02-19 04:36:25 +00006131 ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006132 for (; I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00006133 const Type *Ty = I->Val->getType();
6134 if (Ty == Type::VoidTy)
6135 GEN_ERROR("Short call syntax cannot be used with varargs");
6136 ParamTypes.push_back(Ty);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006137 }
Chris Lattner38905612008-02-19 04:36:25 +00006138 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
Christopher Lamb4374f8e2007-12-17 01:17:35 +00006139 PFTy = PointerType::getUnqual(Ty);
Andrew Lenharth6353e052006-12-08 18:07:09 +00006140 }
Chris Lattner6cdc6822007-04-26 05:31:05 +00006141
Chris Lattner38905612008-02-19 04:36:25 +00006142 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00006143 CHECK_FOR_ERROR
Chris Lattner6cdc6822007-04-26 05:31:05 +00006144
Reid Spencer7780acb2007-04-16 06:56:07 +00006145 // Check for call to invalid intrinsic to avoid crashing later.
6146 if (Function *theF = dyn_cast<Function>(V)) {
Reid Spencered48de22007-04-16 22:02:23 +00006147 if (theF->hasName() && (theF->getValueName()->getKeyLength() >= 5) &&
Reid Spencer36fdde12007-04-16 20:35:38 +00006148 (0 == strncmp(theF->getValueName()->getKeyData(), "llvm.", 5)) &&
6149 !theF->getIntrinsicID(true))
Reid Spencer7780acb2007-04-16 06:56:07 +00006150 GEN_ERROR("Call to invalid LLVM intrinsic function '" +
6151 theF->getName() + "'");
6152 }
6153
Duncan Sandsdc024672007-11-27 13:23:08 +00006154 // Set up the ParamAttrs for the function
6155 ParamAttrsVector Attrs;
Chris Lattner38905612008-02-19 04:36:25 +00006156 if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None) {
Duncan Sandsdc024672007-11-27 13:23:08 +00006157 ParamAttrsWithIndex PAWI;
6158 PAWI.index = 0;
Chris Lattner38905612008-02-19 04:36:25 +00006159 PAWI.attrs = (yyvsp[(8) - (8)].ParamAttrs);
Duncan Sandsdc024672007-11-27 13:23:08 +00006160 Attrs.push_back(PAWI);
6161 }
Reid Spencer14310612006-12-31 05:40:51 +00006162 // Check the arguments
6163 ValueList Args;
Chris Lattner38905612008-02-19 04:36:25 +00006164 if ((yyvsp[(6) - (8)].ParamList)->empty()) { // Has no arguments?
Andrew Lenharth6353e052006-12-08 18:07:09 +00006165 // Make sure no arguments is a good thing!
6166 if (Ty->getNumParams() != 0)
6167 GEN_ERROR("No arguments passed to a function that "
Reid Spencerb5334b02007-02-05 10:18:06 +00006168 "expects arguments");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006169 } else { // Has arguments?
6170 // Loop through FunctionType's arguments and ensure they are specified
Duncan Sandsdc024672007-11-27 13:23:08 +00006171 // correctly. Also, gather any parameter attributes.
Andrew Lenharth6353e052006-12-08 18:07:09 +00006172 FunctionType::param_iterator I = Ty->param_begin();
6173 FunctionType::param_iterator E = Ty->param_end();
Chris Lattner38905612008-02-19 04:36:25 +00006174 ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
Duncan Sandsdc024672007-11-27 13:23:08 +00006175 unsigned index = 1;
Andrew Lenharth6353e052006-12-08 18:07:09 +00006176
Duncan Sandsdc024672007-11-27 13:23:08 +00006177 for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006178 if (ArgI->Val->getType() != *I)
6179 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Reid Spencerb5334b02007-02-05 10:18:06 +00006180 (*I)->getDescription() + "'");
Reid Spencer14310612006-12-31 05:40:51 +00006181 Args.push_back(ArgI->Val);
Duncan Sandsdc024672007-11-27 13:23:08 +00006182 if (ArgI->Attrs != ParamAttr::None) {
6183 ParamAttrsWithIndex PAWI;
6184 PAWI.index = index;
6185 PAWI.attrs = ArgI->Attrs;
6186 Attrs.push_back(PAWI);
6187 }
Reid Spencer14310612006-12-31 05:40:51 +00006188 }
6189 if (Ty->isVarArg()) {
6190 if (I == E)
Chris Lattner38905612008-02-19 04:36:25 +00006191 for (; ArgI != ArgE; ++ArgI, ++index) {
Reid Spencer14310612006-12-31 05:40:51 +00006192 Args.push_back(ArgI->Val); // push the remaining varargs
Chris Lattner38905612008-02-19 04:36:25 +00006193 if (ArgI->Attrs != ParamAttr::None) {
6194 ParamAttrsWithIndex PAWI;
6195 PAWI.index = index;
6196 PAWI.attrs = ArgI->Attrs;
6197 Attrs.push_back(PAWI);
6198 }
6199 }
Reid Spencer14310612006-12-31 05:40:51 +00006200 } else if (I != E || ArgI != ArgE)
Reid Spencerb5334b02007-02-05 10:18:06 +00006201 GEN_ERROR("Invalid number of parameters detected");
Andrew Lenharth6353e052006-12-08 18:07:09 +00006202 }
Duncan Sandsdc024672007-11-27 13:23:08 +00006203
6204 // Finish off the ParamAttrs and check them
Duncan Sandsafa3b6d2007-11-28 17:07:01 +00006205 const ParamAttrsList *PAL = 0;
Duncan Sandsdc024672007-11-27 13:23:08 +00006206 if (!Attrs.empty())
6207 PAL = ParamAttrsList::get(Attrs);
6208
Reid Spencer14310612006-12-31 05:40:51 +00006209 // Create the call node
David Greene718fda32007-08-01 03:59:32 +00006210 CallInst *CI = new CallInst(V, Args.begin(), Args.end());
Chris Lattner38905612008-02-19 04:36:25 +00006211 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
6212 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
Duncan Sandsdc024672007-11-27 13:23:08 +00006213 CI->setParamAttrs(PAL);
Chris Lattner38905612008-02-19 04:36:25 +00006214 (yyval.InstVal) = CI;
6215 delete (yyvsp[(6) - (8)].ParamList);
6216 delete (yyvsp[(3) - (8)].TypeVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00006217 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00006218 ;}
6219 break;
6220
6221 case 308:
Devang Patel4c3f8442008-02-20 19:13:10 +00006222#line 3050 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00006223 {
6224 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00006225 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00006226 ;}
6227 break;
6228
6229 case 309:
Devang Patel4c3f8442008-02-20 19:13:10 +00006230#line 3055 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00006231 {
6232 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00006233 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00006234 ;}
6235 break;
6236
6237 case 310:
Devang Patel4c3f8442008-02-20 19:13:10 +00006238#line 3059 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00006239 {
6240 (yyval.BoolVal) = false;
Reid Spencer61c83e02006-08-18 08:43:06 +00006241 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00006242 ;}
6243 break;
6244
6245 case 311:
Devang Patel4c3f8442008-02-20 19:13:10 +00006246#line 3066 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00006247 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006248 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00006249 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6250 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6251 delete (yyvsp[(2) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006252 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00006253 ;}
6254 break;
6255
6256 case 312:
Devang Patel4c3f8442008-02-20 19:13:10 +00006257#line 3073 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00006258 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006259 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00006260 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6261 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00006262 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00006263 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6264 delete (yyvsp[(2) - (6)].TypeVal);
6265 ;}
6266 break;
6267
6268 case 313:
Devang Patel4c3f8442008-02-20 19:13:10 +00006269#line 3081 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00006270 {
Reid Spencer14310612006-12-31 05:40:51 +00006271 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00006272 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
6273 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
6274 delete (yyvsp[(2) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00006275 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00006276 ;}
6277 break;
6278
6279 case 314:
Devang Patel4c3f8442008-02-20 19:13:10 +00006280#line 3088 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00006281 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006282 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00006283 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
6284 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006285 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00006286 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
6287 delete (yyvsp[(2) - (6)].TypeVal);
6288 ;}
6289 break;
6290
6291 case 315:
Devang Patel4c3f8442008-02-20 19:13:10 +00006292#line 3096 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00006293 {
6294 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006295 GEN_ERROR("Trying to free nonpointer type " +
Chris Lattner38905612008-02-19 04:36:25 +00006296 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
6297 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006298 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00006299 ;}
6300 break;
6301
6302 case 316:
Devang Patel4c3f8442008-02-20 19:13:10 +00006303#line 3104 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00006304 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006305 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00006306 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6307 if (!isa<PointerType>((yyvsp[(3) - (5)].TypeVal)->get()))
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006308 GEN_ERROR("Can't load from nonpointer type: " +
Chris Lattner38905612008-02-19 04:36:25 +00006309 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6310 if (!cast<PointerType>((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006311 GEN_ERROR("Can't load from pointer of non-first-class type: " +
Chris Lattner38905612008-02-19 04:36:25 +00006312 (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
6313 Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006314 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00006315 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
6316 delete (yyvsp[(3) - (5)].TypeVal);
6317 ;}
6318 break;
6319
6320 case 317:
Devang Patel4c3f8442008-02-20 19:13:10 +00006321#line 3118 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00006322 {
Lauro Ramos Venancioc7635522007-04-12 18:32:50 +00006323 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00006324 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
6325 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (7)].TypeVal)->get());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006326 if (!PT)
6327 GEN_ERROR("Can't store to a nonpointer type: " +
Chris Lattner38905612008-02-19 04:36:25 +00006328 (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006329 const Type *ElTy = PT->getElementType();
Chris Lattner38905612008-02-19 04:36:25 +00006330 if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
6331 GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006332 "' into space of type '" + ElTy->getDescription() + "'");
6333
Chris Lattner38905612008-02-19 04:36:25 +00006334 Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006335 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00006336 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
6337 delete (yyvsp[(5) - (7)].TypeVal);
6338 ;}
6339 break;
6340
6341 case 318:
Devang Patel4c3f8442008-02-20 19:13:10 +00006342#line 3135 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Devang Patel5a970972008-02-19 22:27:01 +00006343 {
6344 ValID TmpVID = ValID::createLocalName(*(yyvsp[(3) - (5)].StrVal));
6345 Value *TmpVal = getVal((yyvsp[(2) - (5)].TypeVal)->get(), TmpVID);
Devang Patel4c3f8442008-02-20 19:13:10 +00006346 if (!GetResultInst::isValidOperands(TmpVal, (yyvsp[(5) - (5)].UInt64Val)))
Devang Patel5a970972008-02-19 22:27:01 +00006347 GEN_ERROR("Invalid getresult operands");
Devang Patel4c3f8442008-02-20 19:13:10 +00006348 (yyval.InstVal) = new GetResultInst(TmpVal, (yyvsp[(5) - (5)].UInt64Val));
Devang Patel5a970972008-02-19 22:27:01 +00006349 CHECK_FOR_ERROR
6350 ;}
6351 break;
6352
6353 case 319:
Devang Patel4c3f8442008-02-20 19:13:10 +00006354#line 3143 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Chris Lattner38905612008-02-19 04:36:25 +00006355 {
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006356 if (!UpRefs.empty())
Chris Lattner38905612008-02-19 04:36:25 +00006357 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
6358 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
Reid Spencerb5334b02007-02-05 10:18:06 +00006359 GEN_ERROR("getelementptr insn requires pointer operand");
Reid Spencer68a24bd2005-08-27 18:50:39 +00006360
Chris Lattner38905612008-02-19 04:36:25 +00006361 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end(), true))
Reid Spencer61c83e02006-08-18 08:43:06 +00006362 GEN_ERROR("Invalid getelementptr indices for type '" +
Chris Lattner38905612008-02-19 04:36:25 +00006363 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
6364 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00006365 CHECK_FOR_ERROR
Chris Lattner38905612008-02-19 04:36:25 +00006366 (yyval.InstVal) = new GetElementPtrInst(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
6367 delete (yyvsp[(2) - (4)].TypeVal);
6368 delete (yyvsp[(4) - (4)].ValueList);
6369 ;}
6370 break;
Reid Spencer7780acb2007-04-16 06:56:07 +00006371
Chris Lattner38905612008-02-19 04:36:25 +00006372
6373/* Line 1267 of yacc.c. */
Anton Korobeynikovc70d7732008-02-20 12:10:37 +00006374#line 6375 "llvmAsmParser.tab.c"
Chris Lattner38905612008-02-19 04:36:25 +00006375 default: break;
Dale Johannesencdd509a2007-09-07 21:07:57 +00006376 }
Chris Lattner38905612008-02-19 04:36:25 +00006377 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
6378
6379 YYPOPSTACK (yylen);
6380 yylen = 0;
6381 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006382
6383 *++yyvsp = yyval;
6384
6385
Chris Lattner38905612008-02-19 04:36:25 +00006386 /* Now `shift' the result of the reduction. Determine what state
6387 that goes to, based on the state we popped back to and the rule
6388 number reduced by. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00006389
6390 yyn = yyr1[yyn];
6391
Chris Lattner38905612008-02-19 04:36:25 +00006392 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
6393 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00006394 yystate = yytable[yystate];
6395 else
Chris Lattner38905612008-02-19 04:36:25 +00006396 yystate = yydefgoto[yyn - YYNTOKENS];
Reid Spencer68a24bd2005-08-27 18:50:39 +00006397
6398 goto yynewstate;
6399
6400
Chris Lattner38905612008-02-19 04:36:25 +00006401/*------------------------------------.
6402| yyerrlab -- here on detecting error |
6403`------------------------------------*/
6404yyerrlab:
6405 /* If not already recovering from an error, report this error. */
6406 if (!yyerrstatus)
Reid Spencer68a24bd2005-08-27 18:50:39 +00006407 {
6408 ++yynerrs;
Chris Lattner38905612008-02-19 04:36:25 +00006409#if ! YYERROR_VERBOSE
6410 yyerror (YY_("syntax error"));
6411#else
6412 {
6413 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
6414 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
6415 {
6416 YYSIZE_T yyalloc = 2 * yysize;
6417 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
6418 yyalloc = YYSTACK_ALLOC_MAXIMUM;
6419 if (yymsg != yymsgbuf)
6420 YYSTACK_FREE (yymsg);
6421 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
6422 if (yymsg)
6423 yymsg_alloc = yyalloc;
6424 else
6425 {
6426 yymsg = yymsgbuf;
6427 yymsg_alloc = sizeof yymsgbuf;
6428 }
6429 }
Dale Johannesencdd509a2007-09-07 21:07:57 +00006430
Chris Lattner38905612008-02-19 04:36:25 +00006431 if (0 < yysize && yysize <= yymsg_alloc)
6432 {
6433 (void) yysyntax_error (yymsg, yystate, yychar);
6434 yyerror (yymsg);
6435 }
6436 else
6437 {
6438 yyerror (YY_("syntax error"));
6439 if (yysize != 0)
6440 goto yyexhaustedlab;
6441 }
6442 }
6443#endif
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006444 }
6445
Chris Lattner38905612008-02-19 04:36:25 +00006446
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006447
6448 if (yyerrstatus == 3)
6449 {
Chris Lattner38905612008-02-19 04:36:25 +00006450 /* If just tried and failed to reuse look-ahead token after an
6451 error, discard it. */
Anton Korobeynikovf52e6082007-04-29 18:38:24 +00006452
Chris Lattner38905612008-02-19 04:36:25 +00006453 if (yychar <= YYEOF)
6454 {
6455 /* Return failure if at end of input. */
6456 if (yychar == YYEOF)
6457 YYABORT;
6458 }
6459 else
6460 {
6461 yydestruct ("Error: discarding",
6462 yytoken, &yylval);
6463 yychar = YYEMPTY;
6464 }
6465 }
6466
6467 /* Else will try to reuse look-ahead token after shifting the error
6468 token. */
6469 goto yyerrlab1;
6470
6471
6472/*---------------------------------------------------.
6473| yyerrorlab -- error raised explicitly by YYERROR. |
6474`---------------------------------------------------*/
6475yyerrorlab:
6476
6477 /* Pacify compilers like GCC when the user code never invokes
6478 YYERROR and the label yyerrorlab therefore never appears in user
6479 code. */
6480 if (/*CONSTCOND*/ 0)
6481 goto yyerrorlab;
6482
6483 /* Do not reclaim the symbols of the rule which action triggered
6484 this YYERROR. */
6485 YYPOPSTACK (yylen);
6486 yylen = 0;
6487 YY_STACK_PRINT (yyss, yyssp);
6488 yystate = *yyssp;
6489 goto yyerrlab1;
6490
6491
6492/*-------------------------------------------------------------.
6493| yyerrlab1 -- common code for both syntax error and YYERROR. |
6494`-------------------------------------------------------------*/
6495yyerrlab1:
6496 yyerrstatus = 3; /* Each real token shifted decrements this. */
6497
6498 for (;;)
6499 {
6500 yyn = yypact[yystate];
6501 if (yyn != YYPACT_NINF)
6502 {
6503 yyn += YYTERROR;
6504 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
6505 {
6506 yyn = yytable[yyn];
6507 if (0 < yyn)
6508 break;
6509 }
6510 }
6511
6512 /* Pop the current state because it cannot handle the error token. */
6513 if (yyssp == yyss)
Reid Spencer68a24bd2005-08-27 18:50:39 +00006514 YYABORT;
6515
Dale Johannesencdd509a2007-09-07 21:07:57 +00006516
Chris Lattner38905612008-02-19 04:36:25 +00006517 yydestruct ("Error: popping",
6518 yystos[yystate], yyvsp);
6519 YYPOPSTACK (1);
6520 yystate = *yyssp;
6521 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006522 }
6523
6524 if (yyn == YYFINAL)
6525 YYACCEPT;
6526
Reid Spencer68a24bd2005-08-27 18:50:39 +00006527 *++yyvsp = yylval;
Chris Lattner38905612008-02-19 04:36:25 +00006528
6529
6530 /* Shift the error token. */
6531 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
Reid Spencerb8f85052007-07-31 03:50:36 +00006532
Reid Spencer68a24bd2005-08-27 18:50:39 +00006533 yystate = yyn;
6534 goto yynewstate;
6535
Scott Michel15dcd8e2008-01-30 03:10:00 +00006536
Chris Lattner38905612008-02-19 04:36:25 +00006537/*-------------------------------------.
6538| yyacceptlab -- YYACCEPT comes here. |
6539`-------------------------------------*/
6540yyacceptlab:
6541 yyresult = 0;
6542 goto yyreturn;
6543
6544/*-----------------------------------.
6545| yyabortlab -- YYABORT comes here. |
6546`-----------------------------------*/
6547yyabortlab:
6548 yyresult = 1;
6549 goto yyreturn;
6550
6551#ifndef yyoverflow
6552/*-------------------------------------------------.
6553| yyexhaustedlab -- memory exhaustion comes here. |
6554`-------------------------------------------------*/
6555yyexhaustedlab:
6556 yyerror (YY_("memory exhausted"));
6557 yyresult = 2;
6558 /* Fall through. */
Scott Michel7f9ba9b2008-01-30 02:55:46 +00006559#endif
Chris Lattner38905612008-02-19 04:36:25 +00006560
6561yyreturn:
6562 if (yychar != YYEOF && yychar != YYEMPTY)
6563 yydestruct ("Cleanup: discarding lookahead",
6564 yytoken, &yylval);
6565 /* Do not reclaim the symbols of the rule which action triggered
6566 this YYABORT or YYACCEPT. */
6567 YYPOPSTACK (yylen);
6568 YY_STACK_PRINT (yyss, yyssp);
6569 while (yyssp != yyss)
6570 {
6571 yydestruct ("Cleanup: popping",
6572 yystos[*yyssp], yyvsp);
6573 YYPOPSTACK (1);
Scott Michel15dcd8e2008-01-30 03:10:00 +00006574 }
Chris Lattner38905612008-02-19 04:36:25 +00006575#ifndef yyoverflow
6576 if (yyss != yyssa)
6577 YYSTACK_FREE (yyss);
6578#endif
6579#if YYERROR_VERBOSE
6580 if (yymsg != yymsgbuf)
6581 YYSTACK_FREE (yymsg);
6582#endif
6583 /* Make sure YYID is used. */
6584 return YYID (yyresult);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006585}
Chris Lattner38905612008-02-19 04:36:25 +00006586
6587
Devang Patel4c3f8442008-02-20 19:13:10 +00006588#line 3160 "/Volumes/Nanpura/w/llvm/lib/AsmParser/llvmAsmParser.y"
Reid Spencer61c83e02006-08-18 08:43:06 +00006589
6590
Reid Spencer14310612006-12-31 05:40:51 +00006591// common code from the two 'RunVMAsmParser' functions
6592static Module* RunParser(Module * M) {
Reid Spencer14310612006-12-31 05:40:51 +00006593 CurModule.CurrentModule = M;
Reid Spencer14310612006-12-31 05:40:51 +00006594 // Check to make sure the parser succeeded
6595 if (yyparse()) {
6596 if (ParserResult)
6597 delete ParserResult;
6598 return 0;
6599 }
6600
Reid Spencer0d60b5a2007-03-30 01:37:39 +00006601 // Emit an error if there are any unresolved types left.
6602 if (!CurModule.LateResolveTypes.empty()) {
6603 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
6604 if (DID.Type == ValID::LocalName) {
6605 GenerateError("Undefined type remains at eof: '"+DID.getName() + "'");
6606 } else {
6607 GenerateError("Undefined type remains at eof: #" + itostr(DID.Num));
6608 }
6609 if (ParserResult)
6610 delete ParserResult;
6611 return 0;
6612 }
6613
6614 // Emit an error if there are any unresolved values left.
6615 if (!CurModule.LateResolveValues.empty()) {
6616 Value *V = CurModule.LateResolveValues.back();
6617 std::map<Value*, std::pair<ValID, int> >::iterator I =
6618 CurModule.PlaceHolderInfo.find(V);
6619
6620 if (I != CurModule.PlaceHolderInfo.end()) {
6621 ValID &DID = I->second.first;
6622 if (DID.Type == ValID::LocalName) {
6623 GenerateError("Undefined value remains at eof: "+DID.getName() + "'");
6624 } else {
6625 GenerateError("Undefined value remains at eof: #" + itostr(DID.Num));
6626 }
6627 if (ParserResult)
6628 delete ParserResult;
6629 return 0;
6630 }
6631 }
6632
Reid Spencer14310612006-12-31 05:40:51 +00006633 // Check to make sure that parsing produced a result
6634 if (!ParserResult)
6635 return 0;
6636
6637 // Reset ParserResult variable while saving its value for the result.
6638 Module *Result = ParserResult;
6639 ParserResult = 0;
6640
6641 return Result;
6642}
6643
Reid Spencer61c83e02006-08-18 08:43:06 +00006644void llvm::GenerateError(const std::string &message, int LineNo) {
Duncan Sandsdc024672007-11-27 13:23:08 +00006645 if (LineNo == -1) LineNo = LLLgetLineNo();
Reid Spencer61c83e02006-08-18 08:43:06 +00006646 // TODO: column number in exception
6647 if (TheParseError)
Duncan Sandsdc024672007-11-27 13:23:08 +00006648 TheParseError->setError(LLLgetFilename(), message, LineNo);
Reid Spencer61c83e02006-08-18 08:43:06 +00006649 TriggerError = 1;
6650}
Reid Spencer68a24bd2005-08-27 18:50:39 +00006651
6652int yyerror(const char *ErrorMsg) {
Duncan Sandsdc024672007-11-27 13:23:08 +00006653 std::string where = LLLgetFilename() + ":" + utostr(LLLgetLineNo()) + ": ";
Reid Spenceref9b9a72007-02-05 20:47:22 +00006654 std::string errMsg = where + "error: " + std::string(ErrorMsg);
Duncan Sandsdc024672007-11-27 13:23:08 +00006655 if (yychar != YYEMPTY && yychar != 0) {
6656 errMsg += " while reading token: '";
6657 errMsg += std::string(LLLgetTokenStart(),
6658 LLLgetTokenStart()+LLLgetTokenLength()) + "'";
6659 }
Reid Spencer61c83e02006-08-18 08:43:06 +00006660 GenerateError(errMsg);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006661 return 0;
6662}
Chris Lattner38905612008-02-19 04:36:25 +00006663