blob: fdd664365baeef4b7b3cb4dd4a38470b14dac380 [file] [log] [blame]
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001/* A Bison parser, made by GNU Bison 2.3. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003/* Skeleton implementation for Bison's Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +00007
Reid Spencerb0fcf8f2007-01-17 02:48:45 +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.
Anton Korobeynikov178a3522007-01-12 19:22:51 +000012
Reid Spencerb0fcf8f2007-01-17 02:48:45 +000013 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
Reid Spencer41dff5e2007-01-26 08:05:27 +000020 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +000022
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +000023/* 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.
Reid Spencerb0fcf8f2007-01-17 02:48:45 +000032
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +000033 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. */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +000038
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. */
Reid Spencer41dff5e2007-01-26 08:05:27 +000047#define YYBISON 1
48
49/* Bison version. */
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +000050#define YYBISON_VERSION "2.3"
Reid Spencer41dff5e2007-01-26 08:05:27 +000051
52/* Skeleton name. */
53#define YYSKELETON_NAME "yacc.c"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +000054
55/* Pure parsers. */
Reid Spencer41dff5e2007-01-26 08:05:27 +000056#define YYPURE 0
Reid Spencerb0fcf8f2007-01-17 02:48:45 +000057
58/* Using locations. */
59#define YYLSP_NEEDED 0
60
Reid Spencer41dff5e2007-01-26 08:05:27 +000061/* Substitute the variable and function names. */
Reid Spencer68a24bd2005-08-27 18:50:39 +000062#define yyparse llvmAsmparse
Reid Spencerb0fcf8f2007-01-17 02:48:45 +000063#define yylex llvmAsmlex
Reid Spencer68a24bd2005-08-27 18:50:39 +000064#define yyerror llvmAsmerror
Reid Spencerb0fcf8f2007-01-17 02:48:45 +000065#define yylval llvmAsmlval
66#define yychar llvmAsmchar
Reid Spencer68a24bd2005-08-27 18:50:39 +000067#define yydebug llvmAsmdebug
68#define yynerrs llvmAsmnerrs
69
Reid Spencerb0fcf8f2007-01-17 02:48:45 +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,
Reid Spencer41dff5e2007-01-26 08:05:27 +000079 LOCALVAL_ID = 260,
80 GLOBALVAL_ID = 261,
Reid Spencerb0fcf8f2007-01-17 02:48:45 +000081 FPVAL = 262,
82 VOID = 263,
83 INTTYPE = 264,
84 FLOAT = 265,
85 DOUBLE = 266,
86 LABEL = 267,
87 TYPE = 268,
Reid Spencer41dff5e2007-01-26 08:05:27 +000088 LOCALVAR = 269,
89 GLOBALVAR = 270,
90 LABELSTR = 271,
91 STRINGCONSTANT = 272,
92 ATSTRINGCONSTANT = 273,
93 IMPLEMENTATION = 274,
94 ZEROINITIALIZER = 275,
95 TRUETOK = 276,
96 FALSETOK = 277,
97 BEGINTOK = 278,
98 ENDTOK = 279,
99 DECLARE = 280,
100 DEFINE = 281,
101 GLOBAL = 282,
102 CONSTANT = 283,
103 SECTION = 284,
104 VOLATILE = 285,
105 TO = 286,
106 DOTDOTDOT = 287,
107 NULL_TOK = 288,
108 UNDEF = 289,
109 INTERNAL = 290,
110 LINKONCE = 291,
111 WEAK = 292,
112 APPENDING = 293,
113 DLLIMPORT = 294,
114 DLLEXPORT = 295,
115 EXTERN_WEAK = 296,
116 OPAQUE = 297,
117 EXTERNAL = 298,
118 TARGET = 299,
119 TRIPLE = 300,
120 ALIGN = 301,
121 DEPLIBS = 302,
122 CALL = 303,
123 TAIL = 304,
124 ASM_TOK = 305,
125 MODULE = 306,
126 SIDEEFFECT = 307,
127 CC_TOK = 308,
128 CCC_TOK = 309,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +0000129 FASTCC_TOK = 310,
130 COLDCC_TOK = 311,
131 X86_STDCALLCC_TOK = 312,
132 X86_FASTCALLCC_TOK = 313,
133 DATALAYOUT = 314,
134 RET = 315,
135 BR = 316,
136 SWITCH = 317,
137 INVOKE = 318,
138 UNWIND = 319,
139 UNREACHABLE = 320,
140 ADD = 321,
141 SUB = 322,
142 MUL = 323,
143 UDIV = 324,
144 SDIV = 325,
145 FDIV = 326,
146 UREM = 327,
147 SREM = 328,
148 FREM = 329,
149 AND = 330,
150 OR = 331,
151 XOR = 332,
152 ICMP = 333,
153 FCMP = 334,
154 EQ = 335,
155 NE = 336,
156 SLT = 337,
157 SGT = 338,
158 SLE = 339,
159 SGE = 340,
160 ULT = 341,
161 UGT = 342,
162 ULE = 343,
163 UGE = 344,
164 OEQ = 345,
165 ONE = 346,
166 OLT = 347,
167 OGT = 348,
168 OLE = 349,
169 OGE = 350,
170 ORD = 351,
171 UNO = 352,
172 UEQ = 353,
173 UNE = 354,
174 MALLOC = 355,
175 ALLOCA = 356,
176 FREE = 357,
177 LOAD = 358,
178 STORE = 359,
179 GETELEMENTPTR = 360,
180 TRUNC = 361,
181 ZEXT = 362,
182 SEXT = 363,
183 FPTRUNC = 364,
184 FPEXT = 365,
185 BITCAST = 366,
186 UITOFP = 367,
187 SITOFP = 368,
188 FPTOUI = 369,
189 FPTOSI = 370,
190 INTTOPTR = 371,
191 PTRTOINT = 372,
192 PHI_TOK = 373,
193 SELECT = 374,
194 SHL = 375,
195 LSHR = 376,
196 ASHR = 377,
197 VAARG = 378,
198 EXTRACTELEMENT = 379,
199 INSERTELEMENT = 380,
200 SHUFFLEVECTOR = 381,
201 NORETURN = 382,
202 INREG = 383,
203 SRET = 384,
204 DEFAULT = 385,
205 HIDDEN = 386
Reid Spencerb0fcf8f2007-01-17 02:48:45 +0000206 };
207#endif
Reid Spencer41dff5e2007-01-26 08:05:27 +0000208/* Tokens. */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +0000209#define ESINT64VAL 258
210#define EUINT64VAL 259
Reid Spencer41dff5e2007-01-26 08:05:27 +0000211#define LOCALVAL_ID 260
212#define GLOBALVAL_ID 261
Reid Spencerb0fcf8f2007-01-17 02:48:45 +0000213#define FPVAL 262
214#define VOID 263
215#define INTTYPE 264
216#define FLOAT 265
217#define DOUBLE 266
218#define LABEL 267
219#define TYPE 268
Reid Spencer41dff5e2007-01-26 08:05:27 +0000220#define LOCALVAR 269
221#define GLOBALVAR 270
222#define LABELSTR 271
223#define STRINGCONSTANT 272
224#define ATSTRINGCONSTANT 273
225#define IMPLEMENTATION 274
226#define ZEROINITIALIZER 275
227#define TRUETOK 276
228#define FALSETOK 277
229#define BEGINTOK 278
230#define ENDTOK 279
231#define DECLARE 280
232#define DEFINE 281
233#define GLOBAL 282
234#define CONSTANT 283
235#define SECTION 284
236#define VOLATILE 285
237#define TO 286
238#define DOTDOTDOT 287
239#define NULL_TOK 288
240#define UNDEF 289
241#define INTERNAL 290
242#define LINKONCE 291
243#define WEAK 292
244#define APPENDING 293
245#define DLLIMPORT 294
246#define DLLEXPORT 295
247#define EXTERN_WEAK 296
248#define OPAQUE 297
249#define EXTERNAL 298
250#define TARGET 299
251#define TRIPLE 300
252#define ALIGN 301
253#define DEPLIBS 302
254#define CALL 303
255#define TAIL 304
256#define ASM_TOK 305
257#define MODULE 306
258#define SIDEEFFECT 307
259#define CC_TOK 308
260#define CCC_TOK 309
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +0000261#define FASTCC_TOK 310
262#define COLDCC_TOK 311
263#define X86_STDCALLCC_TOK 312
264#define X86_FASTCALLCC_TOK 313
265#define DATALAYOUT 314
266#define RET 315
267#define BR 316
268#define SWITCH 317
269#define INVOKE 318
270#define UNWIND 319
271#define UNREACHABLE 320
272#define ADD 321
273#define SUB 322
274#define MUL 323
275#define UDIV 324
276#define SDIV 325
277#define FDIV 326
278#define UREM 327
279#define SREM 328
280#define FREM 329
281#define AND 330
282#define OR 331
283#define XOR 332
284#define ICMP 333
285#define FCMP 334
286#define EQ 335
287#define NE 336
288#define SLT 337
289#define SGT 338
290#define SLE 339
291#define SGE 340
292#define ULT 341
293#define UGT 342
294#define ULE 343
295#define UGE 344
296#define OEQ 345
297#define ONE 346
298#define OLT 347
299#define OGT 348
300#define OLE 349
301#define OGE 350
302#define ORD 351
303#define UNO 352
304#define UEQ 353
305#define UNE 354
306#define MALLOC 355
307#define ALLOCA 356
308#define FREE 357
309#define LOAD 358
310#define STORE 359
311#define GETELEMENTPTR 360
312#define TRUNC 361
313#define ZEXT 362
314#define SEXT 363
315#define FPTRUNC 364
316#define FPEXT 365
317#define BITCAST 366
318#define UITOFP 367
319#define SITOFP 368
320#define FPTOUI 369
321#define FPTOSI 370
322#define INTTOPTR 371
323#define PTRTOINT 372
324#define PHI_TOK 373
325#define SELECT 374
326#define SHL 375
327#define LSHR 376
328#define ASHR 377
329#define VAARG 378
330#define EXTRACTELEMENT 379
331#define INSERTELEMENT 380
332#define SHUFFLEVECTOR 381
333#define NORETURN 382
334#define INREG 383
335#define SRET 384
336#define DEFAULT 385
337#define HIDDEN 386
Reid Spencerb0fcf8f2007-01-17 02:48:45 +0000338
339
340
341
342/* Copy the first part of user declarations. */
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +0000343#line 14 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000344
345#include "ParserInternals.h"
346#include "llvm/CallingConv.h"
Chris Lattner0e9c3762006-01-25 22:27:16 +0000347#include "llvm/InlineAsm.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000348#include "llvm/Instructions.h"
349#include "llvm/Module.h"
350#include "llvm/SymbolTable.h"
351#include "llvm/Support/GetElementPtrTypeIterator.h"
Reid Spencer14310612006-12-31 05:40:51 +0000352#include "llvm/Support/CommandLine.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000353#include "llvm/ADT/STLExtras.h"
Chris Lattner0019bbe2005-11-06 06:46:53 +0000354#include "llvm/Support/MathExtras.h"
Reid Spencer481169e2006-12-01 00:33:46 +0000355#include "llvm/Support/Streams.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000356#include <algorithm>
Reid Spencer68a24bd2005-08-27 18:50:39 +0000357#include <list>
358#include <utility>
Reid Spencer14310612006-12-31 05:40:51 +0000359#ifndef NDEBUG
360#define YYDEBUG 1
361#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000362
Reid Spencere4f47592006-08-18 17:32:55 +0000363// The following is a gross hack. In order to rid the libAsmParser library of
364// exceptions, we have to have a way of getting the yyparse function to go into
365// an error situation. So, whenever we want an error to occur, the GenerateError
366// function (see bottom of file) sets TriggerError. Then, at the end of each
367// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
368// (a goto) to put YACC in error state. Furthermore, several calls to
369// GenerateError are made from inside productions and they must simulate the
370// previous exception behavior by exiting the production immediately. We have
371// replaced these with the GEN_ERROR macro which calls GeneratError and then
372// immediately invokes YYERROR. This would be so much cleaner if it was a
373// recursive descent parser.
Reid Spencer61c83e02006-08-18 08:43:06 +0000374static bool TriggerError = false;
Reid Spencerf63697d2006-10-09 17:36:59 +0000375#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
Reid Spencer61c83e02006-08-18 08:43:06 +0000376#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
377
Reid Spencer68a24bd2005-08-27 18:50:39 +0000378int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
379int yylex(); // declaration" of xxx warnings.
380int yyparse();
381
382namespace llvm {
383 std::string CurFilename;
Reid Spencer14310612006-12-31 05:40:51 +0000384#if YYDEBUG
385static cl::opt<bool>
386Debug("debug-yacc", cl::desc("Print yacc debug state changes"),
387 cl::Hidden, cl::init(false));
388#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000389}
390using namespace llvm;
391
392static Module *ParserResult;
393
394// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
395// relating to upreferences in the input stream.
396//
397//#define DEBUG_UPREFS 1
398#ifdef DEBUG_UPREFS
Bill Wendlinge8156192006-12-07 01:30:32 +0000399#define UR_OUT(X) cerr << X
Reid Spencer68a24bd2005-08-27 18:50:39 +0000400#else
401#define UR_OUT(X)
402#endif
403
404#define YYERROR_VERBOSE 1
405
Chris Lattnerb475c422005-11-12 18:22:38 +0000406static GlobalVariable *CurGV;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000407
408
409// This contains info used when building the body of a function. It is
410// destroyed when the function is completed.
411//
412typedef std::vector<Value *> ValueList; // Numbered defs
Reid Spencer14310612006-12-31 05:40:51 +0000413
Reid Spencer68a24bd2005-08-27 18:50:39 +0000414static void
415ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers,
416 std::map<const Type *,ValueList> *FutureLateResolvers = 0);
417
418static struct PerModuleInfo {
419 Module *CurrentModule;
420 std::map<const Type *, ValueList> Values; // Module level numbered definitions
421 std::map<const Type *,ValueList> LateResolveValues;
Reid Spencer861d9d62006-11-28 07:29:44 +0000422 std::vector<PATypeHolder> Types;
423 std::map<ValID, PATypeHolder> LateResolveTypes;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000424
425 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
Chris Lattner0ad19702006-06-21 16:53:00 +0000426 /// how they were referenced and on which line of the input they came from so
Reid Spencer68a24bd2005-08-27 18:50:39 +0000427 /// that we can resolve them later and print error messages as appropriate.
428 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
429
430 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
431 // references to global values. Global values may be referenced before they
432 // are defined, and if so, the temporary object that they represent is held
433 // here. This is used for forward references of GlobalValues.
434 //
435 typedef std::map<std::pair<const PointerType *,
436 ValID>, GlobalValue*> GlobalRefsType;
437 GlobalRefsType GlobalRefs;
438
439 void ModuleDone() {
440 // If we could not resolve some functions at function compilation time
441 // (calls to functions before they are defined), resolve them now... Types
442 // are resolved when the constant pool has been completely parsed.
443 //
444 ResolveDefinitions(LateResolveValues);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000445 if (TriggerError)
446 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000447
448 // Check to make sure that all global value forward references have been
449 // resolved!
450 //
451 if (!GlobalRefs.empty()) {
452 std::string UndefinedReferences = "Unresolved global references exist:\n";
453
454 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
455 I != E; ++I) {
456 UndefinedReferences += " " + I->first.first->getDescription() + " " +
457 I->first.second.getName() + "\n";
458 }
Reid Spencer61c83e02006-08-18 08:43:06 +0000459 GenerateError(UndefinedReferences);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000460 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000461 }
462
463 Values.clear(); // Clear out function local definitions
464 Types.clear();
465 CurrentModule = 0;
466 }
467
Reid Spencer68a24bd2005-08-27 18:50:39 +0000468 // GetForwardRefForGlobal - Check to see if there is a forward reference
469 // for this global. If so, remove it from the GlobalRefs map and return it.
470 // If not, just return null.
471 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
472 // Check to see if there is a forward reference to this global variable...
473 // if there is, eliminate it and patch the reference to use the new def'n.
474 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
475 GlobalValue *Ret = 0;
476 if (I != GlobalRefs.end()) {
477 Ret = I->second;
478 GlobalRefs.erase(I);
479 }
480 return Ret;
481 }
Reid Spencer8c8a2dc2007-01-02 21:54:12 +0000482
483 bool TypeIsUnresolved(PATypeHolder* PATy) {
484 // If it isn't abstract, its resolved
485 const Type* Ty = PATy->get();
486 if (!Ty->isAbstract())
487 return false;
488 // Traverse the type looking for abstract types. If it isn't abstract then
489 // we don't need to traverse that leg of the type.
490 std::vector<const Type*> WorkList, SeenList;
491 WorkList.push_back(Ty);
492 while (!WorkList.empty()) {
493 const Type* Ty = WorkList.back();
494 SeenList.push_back(Ty);
495 WorkList.pop_back();
496 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
497 // Check to see if this is an unresolved type
498 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
499 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
500 for ( ; I != E; ++I) {
501 if (I->second.get() == OpTy)
502 return true;
503 }
504 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
505 const Type* TheTy = SeqTy->getElementType();
506 if (TheTy->isAbstract() && TheTy != Ty) {
507 std::vector<const Type*>::iterator I = SeenList.begin(),
508 E = SeenList.end();
509 for ( ; I != E; ++I)
510 if (*I == TheTy)
511 break;
512 if (I == E)
513 WorkList.push_back(TheTy);
514 }
515 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
516 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
517 const Type* TheTy = StrTy->getElementType(i);
518 if (TheTy->isAbstract() && TheTy != Ty) {
519 std::vector<const Type*>::iterator I = SeenList.begin(),
520 E = SeenList.end();
521 for ( ; I != E; ++I)
522 if (*I == TheTy)
523 break;
524 if (I == E)
525 WorkList.push_back(TheTy);
526 }
527 }
528 }
529 }
530 return false;
531 }
532
533
Reid Spencer68a24bd2005-08-27 18:50:39 +0000534} CurModule;
535
536static struct PerFunctionInfo {
537 Function *CurrentFunction; // Pointer to current function being created
538
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000539 std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
Reid Spencer68a24bd2005-08-27 18:50:39 +0000540 std::map<const Type*, ValueList> LateResolveValues;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000541 bool isDeclare; // Is this function a forward declararation?
542 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000543 GlobalValue::VisibilityTypes Visibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000544
545 /// BBForwardRefs - When we see forward references to basic blocks, keep
546 /// track of them here.
547 std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs;
548 std::vector<BasicBlock*> NumberedBlocks;
549 unsigned NextBBNum;
550
551 inline PerFunctionInfo() {
552 CurrentFunction = 0;
553 isDeclare = false;
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000554 Linkage = GlobalValue::ExternalLinkage;
555 Visibility = GlobalValue::DefaultVisibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000556 }
557
558 inline void FunctionStart(Function *M) {
559 CurrentFunction = M;
560 NextBBNum = 0;
561 }
562
563 void FunctionDone() {
564 NumberedBlocks.clear();
565
566 // Any forward referenced blocks left?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000567 if (!BBForwardRefs.empty()) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000568 GenerateError("Undefined reference to label " +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000569 BBForwardRefs.begin()->first->getName());
Reid Spencer5b7e7532006-09-28 19:28:24 +0000570 return;
571 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000572
573 // Resolve all forward references now.
574 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
575
576 Values.clear(); // Clear out function local definitions
577 CurrentFunction = 0;
578 isDeclare = false;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000579 Linkage = GlobalValue::ExternalLinkage;
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000580 Visibility = GlobalValue::DefaultVisibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000581 }
582} CurFun; // Info for the current function...
583
584static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
585
586
587//===----------------------------------------------------------------------===//
588// Code to handle definitions of all the types
589//===----------------------------------------------------------------------===//
590
591static int InsertValue(Value *V,
592 std::map<const Type*,ValueList> &ValueTab = CurFun.Values) {
593 if (V->hasName()) return -1; // Is this a numbered definition?
594
595 // Yes, insert the value into the value table...
596 ValueList &List = ValueTab[V->getType()];
597 List.push_back(V);
598 return List.size()-1;
599}
600
601static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
602 switch (D.Type) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000603 case ValID::LocalID: // Is it a numbered definition?
Reid Spencer68a24bd2005-08-27 18:50:39 +0000604 // Module constants occupy the lowest numbered slots...
Reid Spencer41dff5e2007-01-26 08:05:27 +0000605 if (D.Num < CurModule.Types.size())
606 return CurModule.Types[D.Num];
Reid Spencer68a24bd2005-08-27 18:50:39 +0000607 break;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000608 case ValID::LocalName: // Is it a named definition?
Reid Spencer68a24bd2005-08-27 18:50:39 +0000609 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
610 D.destroy(); // Free old strdup'd memory...
611 return N;
612 }
613 break;
614 default:
Reid Spencer61c83e02006-08-18 08:43:06 +0000615 GenerateError("Internal parser error: Invalid symbol type reference!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000616 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000617 }
618
619 // If we reached here, we referenced either a symbol that we don't know about
620 // or an id number that hasn't been read yet. We may be referencing something
621 // forward, so just create an entry to be resolved later and get to it...
622 //
623 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
624
625
626 if (inFunctionScope()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000627 if (D.Type == ValID::LocalName) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000628 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000629 return 0;
630 } else {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000631 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
Reid Spencer5b7e7532006-09-28 19:28:24 +0000632 return 0;
633 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000634 }
635
Reid Spencer861d9d62006-11-28 07:29:44 +0000636 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000637 if (I != CurModule.LateResolveTypes.end())
Reid Spencer861d9d62006-11-28 07:29:44 +0000638 return I->second;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000639
Reid Spencer861d9d62006-11-28 07:29:44 +0000640 Type *Typ = OpaqueType::get();
641 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
642 return Typ;
Reid Spencera132e042006-12-03 05:46:11 +0000643 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000644
Reid Spencer68a24bd2005-08-27 18:50:39 +0000645// getValNonImprovising - Look up the value specified by the provided type and
646// the provided ValID. If the value exists and has already been defined, return
647// it. Otherwise return null.
648//
649static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000650 if (isa<FunctionType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000651 GenerateError("Functions are not values and "
Reid Spencer68a24bd2005-08-27 18:50:39 +0000652 "must be referenced as pointers");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000653 return 0;
654 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000655
656 switch (D.Type) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000657 case ValID::LocalID: { // Is it a numbered definition?
658 // Module constants occupy the lowest numbered slots.
659 std::map<const Type*,ValueList>::iterator VI = CurFun.Values.find(Ty);
660 // Make sure that our type is within bounds.
Reid Spencer68a24bd2005-08-27 18:50:39 +0000661 if (VI == CurFun.Values.end()) return 0;
662
Reid Spencer41dff5e2007-01-26 08:05:27 +0000663 // Check that the number is within bounds.
664 if (D.Num >= VI->second.size()) return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000665
Reid Spencer41dff5e2007-01-26 08:05:27 +0000666 return VI->second[D.Num];
667 }
668 case ValID::GlobalID: { // Is it a numbered definition?
669 unsigned Num = D.Num;
670
671 // Module constants occupy the lowest numbered slots...
672 std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
673 if (VI == CurModule.Values.end()) return 0;
674 if (D.Num >= VI->second.size()) return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000675 return VI->second[Num];
676 }
Reid Spencer41dff5e2007-01-26 08:05:27 +0000677
678 case ValID::LocalName: { // Is it a named definition?
679 if (!inFunctionScope()) return 0;
680 SymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
681 Value *N = SymTab.lookup(Ty, D.Name);
682 if (N == 0) return 0;
683
684 D.destroy(); // Free old strdup'd memory...
685 return N;
686 }
687 case ValID::GlobalName: { // Is it a named definition?
688 SymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
689 Value *N = SymTab.lookup(Ty, D.Name);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000690 if (N == 0) return 0;
691
692 D.destroy(); // Free old strdup'd memory...
693 return N;
694 }
695
696 // Check to make sure that "Ty" is an integral type, and that our
697 // value will fit into the specified type...
698 case ValID::ConstSIntVal: // Is it a constant pool reference??
Reid Spencerb83eb642006-10-20 07:07:24 +0000699 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000700 GenerateError("Signed integral constant '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000701 itostr(D.ConstPool64) + "' is invalid for type '" +
702 Ty->getDescription() + "'!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000703 return 0;
704 }
Reid Spencerb83eb642006-10-20 07:07:24 +0000705 return ConstantInt::get(Ty, D.ConstPool64);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000706
707 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
Reid Spencerb83eb642006-10-20 07:07:24 +0000708 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
709 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000710 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000711 "' is invalid or out of range!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000712 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000713 } else { // This is really a signed reference. Transmogrify.
Reid Spencerb83eb642006-10-20 07:07:24 +0000714 return ConstantInt::get(Ty, D.ConstPool64);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000715 }
716 } else {
Reid Spencerb83eb642006-10-20 07:07:24 +0000717 return ConstantInt::get(Ty, D.UConstPool64);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000718 }
719
720 case ValID::ConstFPVal: // Is it a floating point const pool reference?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000721 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000722 GenerateError("FP constant invalid for type!!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000723 return 0;
724 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000725 return ConstantFP::get(Ty, D.ConstPoolFP);
726
727 case ValID::ConstNullVal: // Is it a null value?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000728 if (!isa<PointerType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000729 GenerateError("Cannot create a a non pointer null!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000730 return 0;
731 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000732 return ConstantPointerNull::get(cast<PointerType>(Ty));
733
734 case ValID::ConstUndefVal: // Is it an undef value?
735 return UndefValue::get(Ty);
736
Chris Lattner7aa61892005-12-21 17:53:23 +0000737 case ValID::ConstZeroVal: // Is it a zero value?
738 return Constant::getNullValue(Ty);
739
Reid Spencer68a24bd2005-08-27 18:50:39 +0000740 case ValID::ConstantVal: // Fully resolved constant?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000741 if (D.ConstantValue->getType() != Ty) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000742 GenerateError("Constant expression type different from required type!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000743 return 0;
744 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000745 return D.ConstantValue;
746
Chris Lattner0e9c3762006-01-25 22:27:16 +0000747 case ValID::InlineAsmVal: { // Inline asm expression
748 const PointerType *PTy = dyn_cast<PointerType>(Ty);
749 const FunctionType *FTy =
750 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000751 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000752 GenerateError("Invalid type for asm constraint string!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000753 return 0;
754 }
Chris Lattner0e9c3762006-01-25 22:27:16 +0000755 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
756 D.IAD->HasSideEffects);
757 D.destroy(); // Free InlineAsmDescriptor.
758 return IA;
759 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000760 default:
761 assert(0 && "Unhandled case!");
762 return 0;
763 } // End of switch
764
765 assert(0 && "Unhandled case!");
766 return 0;
767}
768
769// getVal - This function is identical to getValNonImprovising, except that if a
770// value is not already defined, it "improvises" by creating a placeholder var
771// that looks and acts just like the requested variable. When the value is
772// defined later, all uses of the placeholder variable are replaced with the
773// real thing.
774//
775static Value *getVal(const Type *Ty, const ValID &ID) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000776 if (Ty == Type::LabelTy) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000777 GenerateError("Cannot use a basic block here");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000778 return 0;
779 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000780
781 // See if the value has already been defined.
782 Value *V = getValNonImprovising(Ty, ID);
783 if (V) return V;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000784 if (TriggerError) return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000785
Reid Spencer5b7e7532006-09-28 19:28:24 +0000786 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000787 GenerateError("Invalid use of a composite type!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000788 return 0;
789 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000790
791 // If we reached here, we referenced either a symbol that we don't know about
792 // or an id number that hasn't been read yet. We may be referencing something
793 // forward, so just create an entry to be resolved later and get to it...
794 //
795 V = new Argument(Ty);
796
797 // Remember where this forward reference came from. FIXME, shouldn't we try
798 // to recycle these things??
799 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
800 llvmAsmlineno)));
801
802 if (inFunctionScope())
803 InsertValue(V, CurFun.LateResolveValues);
804 else
805 InsertValue(V, CurModule.LateResolveValues);
806 return V;
807}
808
809/// getBBVal - This is used for two purposes:
810/// * If isDefinition is true, a new basic block with the specified ID is being
811/// defined.
812/// * If isDefinition is true, this is a reference to a basic block, which may
813/// or may not be a forward reference.
814///
815static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
816 assert(inFunctionScope() && "Can't get basic block at global scope!");
817
818 std::string Name;
819 BasicBlock *BB = 0;
820 switch (ID.Type) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000821 default:
822 GenerateError("Illegal label reference " + ID.getName());
823 return 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000824 case ValID::LocalID: // Is it a numbered definition?
825 if (ID.Num >= CurFun.NumberedBlocks.size())
Reid Spencer68a24bd2005-08-27 18:50:39 +0000826 CurFun.NumberedBlocks.resize(ID.Num+1);
827 BB = CurFun.NumberedBlocks[ID.Num];
828 break;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000829 case ValID::LocalName: // Is it a named definition?
Reid Spencer68a24bd2005-08-27 18:50:39 +0000830 Name = ID.Name;
831 if (Value *N = CurFun.CurrentFunction->
Reid Spencer78d033e2007-01-06 07:24:44 +0000832 getValueSymbolTable().lookup(Type::LabelTy, Name))
Reid Spencer68a24bd2005-08-27 18:50:39 +0000833 BB = cast<BasicBlock>(N);
834 break;
835 }
836
837 // See if the block has already been defined.
838 if (BB) {
839 // If this is the definition of the block, make sure the existing value was
840 // just a forward reference. If it was a forward reference, there will be
841 // an entry for it in the PlaceHolderInfo map.
Reid Spencer5b7e7532006-09-28 19:28:24 +0000842 if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000843 // The existing value was a definition, not a forward reference.
Reid Spencer61c83e02006-08-18 08:43:06 +0000844 GenerateError("Redefinition of label " + ID.getName());
Reid Spencer5b7e7532006-09-28 19:28:24 +0000845 return 0;
846 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000847
848 ID.destroy(); // Free strdup'd memory.
849 return BB;
850 }
851
852 // Otherwise this block has not been seen before.
853 BB = new BasicBlock("", CurFun.CurrentFunction);
Reid Spencer41dff5e2007-01-26 08:05:27 +0000854 if (ID.Type == ValID::LocalName) {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000855 BB->setName(ID.Name);
856 } else {
857 CurFun.NumberedBlocks[ID.Num] = BB;
858 }
859
860 // If this is not a definition, keep track of it so we can use it as a forward
861 // reference.
862 if (!isDefinition) {
863 // Remember where this forward reference came from.
864 CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno);
865 } else {
866 // The forward declaration could have been inserted anywhere in the
867 // function: insert it into the correct place now.
868 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
869 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
870 }
871 ID.destroy();
872 return BB;
873}
874
875
876//===----------------------------------------------------------------------===//
877// Code to handle forward references in instructions
878//===----------------------------------------------------------------------===//
879//
880// This code handles the late binding needed with statements that reference
881// values not defined yet... for example, a forward branch, or the PHI node for
882// a loop body.
883//
884// This keeps a table (CurFun.LateResolveValues) of all such forward references
885// and back patchs after we are done.
886//
887
888// ResolveDefinitions - If we could not resolve some defs at parsing
889// time (forward branches, phi functions for loops, etc...) resolve the
890// defs now...
891//
892static void
893ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
894 std::map<const Type*,ValueList> *FutureLateResolvers) {
895 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
896 for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(),
897 E = LateResolvers.end(); LRI != E; ++LRI) {
898 ValueList &List = LRI->second;
899 while (!List.empty()) {
900 Value *V = List.back();
901 List.pop_back();
902
903 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
904 CurModule.PlaceHolderInfo.find(V);
905 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
906
907 ValID &DID = PHI->second.first;
908
909 Value *TheRealValue = getValNonImprovising(LRI->first, DID);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000910 if (TriggerError)
911 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000912 if (TheRealValue) {
913 V->replaceAllUsesWith(TheRealValue);
914 delete V;
915 CurModule.PlaceHolderInfo.erase(PHI);
916 } else if (FutureLateResolvers) {
917 // Functions have their unresolved items forwarded to the module late
918 // resolver table
919 InsertValue(V, *FutureLateResolvers);
920 } else {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000921 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000922 GenerateError("Reference to an invalid definition: '" +DID.getName()+
Reid Spencer68a24bd2005-08-27 18:50:39 +0000923 "' of type '" + V->getType()->getDescription() + "'",
924 PHI->second.second);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000925 return;
926 } else {
Reid Spencer61c83e02006-08-18 08:43:06 +0000927 GenerateError("Reference to an invalid definition: #" +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000928 itostr(DID.Num) + " of type '" +
929 V->getType()->getDescription() + "'",
930 PHI->second.second);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000931 return;
932 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000933 }
934 }
935 }
936
937 LateResolvers.clear();
938}
939
940// ResolveTypeTo - A brand new type was just declared. This means that (if
941// name is not null) things referencing Name can be resolved. Otherwise, things
942// refering to the number can be resolved. Do this now.
943//
944static void ResolveTypeTo(char *Name, const Type *ToTy) {
945 ValID D;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000946 if (Name) D = ValID::createLocalName(Name);
947 else D = ValID::createLocalID(CurModule.Types.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +0000948
Reid Spencer861d9d62006-11-28 07:29:44 +0000949 std::map<ValID, PATypeHolder>::iterator I =
Reid Spencer68a24bd2005-08-27 18:50:39 +0000950 CurModule.LateResolveTypes.find(D);
951 if (I != CurModule.LateResolveTypes.end()) {
Reid Spencer861d9d62006-11-28 07:29:44 +0000952 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000953 CurModule.LateResolveTypes.erase(I);
954 }
955}
956
957// setValueName - Set the specified value to the name given. The name may be
958// null potentially, in which case this is a noop. The string passed in is
959// assumed to be a malloc'd string buffer, and is free'd by this function.
960//
961static void setValueName(Value *V, char *NameStr) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000962 if (!NameStr) return;
963 std::string Name(NameStr); // Copy string
964 free(NameStr); // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +0000965
Reid Spencer41dff5e2007-01-26 08:05:27 +0000966 if (V->getType() == Type::VoidTy) {
967 GenerateError("Can't assign name '" + Name+"' to value with void type!");
968 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000969 }
Reid Spencer41dff5e2007-01-26 08:05:27 +0000970
971 assert(inFunctionScope() && "Must be in function scope!");
972 SymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
973 if (ST.lookup(V->getType(), Name)) {
974 GenerateError("Redefinition of value '" + Name + "' of type '" +
975 V->getType()->getDescription() + "'!");
976 return;
977 }
978
979 // Set the name.
980 V->setName(Name);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000981}
982
983/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
984/// this is a declaration, otherwise it is a definition.
Chris Lattnerb475c422005-11-12 18:22:38 +0000985static GlobalVariable *
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000986ParseGlobalVariable(char *NameStr,
987 GlobalValue::LinkageTypes Linkage,
988 GlobalValue::VisibilityTypes Visibility,
Chris Lattnerb475c422005-11-12 18:22:38 +0000989 bool isConstantGlobal, const Type *Ty,
990 Constant *Initializer) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000991 if (isa<FunctionType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000992 GenerateError("Cannot declare global vars of function type!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000993 return 0;
994 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000995
996 const PointerType *PTy = PointerType::get(Ty);
997
998 std::string Name;
999 if (NameStr) {
1000 Name = NameStr; // Copy string
1001 free(NameStr); // Free old string
1002 }
1003
1004 // See if this global value was forward referenced. If so, recycle the
1005 // object.
1006 ValID ID;
1007 if (!Name.empty()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00001008 ID = ValID::createGlobalName((char*)Name.c_str());
Reid Spencer68a24bd2005-08-27 18:50:39 +00001009 } else {
Reid Spencer41dff5e2007-01-26 08:05:27 +00001010 ID = ValID::createGlobalID(CurModule.Values[PTy].size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00001011 }
1012
1013 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1014 // Move the global to the end of the list, from whereever it was
1015 // previously inserted.
1016 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1017 CurModule.CurrentModule->getGlobalList().remove(GV);
1018 CurModule.CurrentModule->getGlobalList().push_back(GV);
1019 GV->setInitializer(Initializer);
1020 GV->setLinkage(Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001021 GV->setVisibility(Visibility);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001022 GV->setConstant(isConstantGlobal);
1023 InsertValue(GV, CurModule.Values);
Chris Lattnerb475c422005-11-12 18:22:38 +00001024 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001025 }
1026
1027 // If this global has a name, check to see if there is already a definition
Reid Spencer63c34452007-01-05 21:51:07 +00001028 // of this global in the module. If so, it is an error.
Reid Spencer68a24bd2005-08-27 18:50:39 +00001029 if (!Name.empty()) {
1030 // We are a simple redefinition of a value, check to see if it is defined
1031 // the same as the old one.
Reid Spencer63c34452007-01-05 21:51:07 +00001032 if (CurModule.CurrentModule->getGlobalVariable(Name, Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +00001033 GenerateError("Redefinition of global variable named '" + Name +
Reid Spencer63c34452007-01-05 21:51:07 +00001034 "' of type '" + Ty->getDescription() + "'!");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001035 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001036 }
1037 }
1038
1039 // Otherwise there is no existing GV to use, create one now.
1040 GlobalVariable *GV =
1041 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1042 CurModule.CurrentModule);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001043 GV->setVisibility(Visibility);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001044 InsertValue(GV, CurModule.Values);
Chris Lattnerb475c422005-11-12 18:22:38 +00001045 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001046}
1047
1048// setTypeName - Set the specified type to the name given. The name may be
1049// null potentially, in which case this is a noop. The string passed in is
1050// assumed to be a malloc'd string buffer, and is freed by this function.
1051//
1052// This function returns true if the type has already been defined, but is
1053// allowed to be redefined in the specified context. If the name is a new name
1054// for the type plane, it is inserted and false is returned.
1055static bool setTypeName(const Type *T, char *NameStr) {
1056 assert(!inFunctionScope() && "Can't give types function-local names!");
1057 if (NameStr == 0) return false;
1058
1059 std::string Name(NameStr); // Copy string
1060 free(NameStr); // Free old string
1061
1062 // We don't allow assigning names to void type
Reid Spencer5b7e7532006-09-28 19:28:24 +00001063 if (T == Type::VoidTy) {
Reid Spencer61c83e02006-08-18 08:43:06 +00001064 GenerateError("Can't assign name '" + Name + "' to the void type!");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001065 return false;
1066 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001067
1068 // Set the type name, checking for conflicts as we do so.
1069 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1070
1071 if (AlreadyExists) { // Inserting a name that is already defined???
1072 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1073 assert(Existing && "Conflict but no matching type?");
1074
1075 // There is only one case where this is allowed: when we are refining an
1076 // opaque type. In this case, Existing will be an opaque type.
1077 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1078 // We ARE replacing an opaque type!
1079 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1080 return true;
1081 }
1082
1083 // Otherwise, this is an attempt to redefine a type. That's okay if
1084 // the redefinition is identical to the original. This will be so if
1085 // Existing and T point to the same Type object. In this one case we
1086 // allow the equivalent redefinition.
1087 if (Existing == T) return true; // Yes, it's equal.
1088
1089 // Any other kind of (non-equivalent) redefinition is an error.
Reid Spencer63c34452007-01-05 21:51:07 +00001090 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1091 T->getDescription() + "'!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001092 }
1093
1094 return false;
1095}
1096
1097//===----------------------------------------------------------------------===//
1098// Code for handling upreferences in type names...
1099//
1100
1101// TypeContains - Returns true if Ty directly contains E in it.
1102//
1103static bool TypeContains(const Type *Ty, const Type *E) {
1104 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1105 E) != Ty->subtype_end();
1106}
1107
1108namespace {
1109 struct UpRefRecord {
1110 // NestingLevel - The number of nesting levels that need to be popped before
1111 // this type is resolved.
1112 unsigned NestingLevel;
1113
1114 // LastContainedTy - This is the type at the current binding level for the
1115 // type. Every time we reduce the nesting level, this gets updated.
1116 const Type *LastContainedTy;
1117
1118 // UpRefTy - This is the actual opaque type that the upreference is
1119 // represented with.
1120 OpaqueType *UpRefTy;
1121
1122 UpRefRecord(unsigned NL, OpaqueType *URTy)
1123 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1124 };
1125}
1126
1127// UpRefs - A list of the outstanding upreferences that need to be resolved.
1128static std::vector<UpRefRecord> UpRefs;
1129
1130/// HandleUpRefs - Every time we finish a new layer of types, this function is
1131/// called. It loops through the UpRefs vector, which is a list of the
1132/// currently active types. For each type, if the up reference is contained in
1133/// the newly completed type, we decrement the level count. When the level
1134/// count reaches zero, the upreferenced type is the type that is passed in:
1135/// thus we can complete the cycle.
1136///
1137static PATypeHolder HandleUpRefs(const Type *ty) {
Chris Lattner224f84f2006-08-18 17:34:45 +00001138 // If Ty isn't abstract, or if there are no up-references in it, then there is
1139 // nothing to resolve here.
1140 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1141
Reid Spencer68a24bd2005-08-27 18:50:39 +00001142 PATypeHolder Ty(ty);
1143 UR_OUT("Type '" << Ty->getDescription() <<
1144 "' newly formed. Resolving upreferences.\n" <<
1145 UpRefs.size() << " upreferences active!\n");
1146
1147 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1148 // to zero), we resolve them all together before we resolve them to Ty. At
1149 // the end of the loop, if there is anything to resolve to Ty, it will be in
1150 // this variable.
1151 OpaqueType *TypeToResolve = 0;
1152
1153 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1154 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1155 << UpRefs[i].second->getDescription() << ") = "
1156 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1157 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1158 // Decrement level of upreference
1159 unsigned Level = --UpRefs[i].NestingLevel;
1160 UpRefs[i].LastContainedTy = Ty;
1161 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1162 if (Level == 0) { // Upreference should be resolved!
1163 if (!TypeToResolve) {
1164 TypeToResolve = UpRefs[i].UpRefTy;
1165 } else {
1166 UR_OUT(" * Resolving upreference for "
1167 << UpRefs[i].second->getDescription() << "\n";
1168 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1169 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1170 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1171 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1172 }
1173 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1174 --i; // Do not skip the next element...
1175 }
1176 }
1177 }
1178
1179 if (TypeToResolve) {
1180 UR_OUT(" * Resolving upreference for "
1181 << UpRefs[i].second->getDescription() << "\n";
1182 std::string OldName = TypeToResolve->getDescription());
1183 TypeToResolve->refineAbstractTypeTo(Ty);
1184 }
1185
1186 return Ty;
1187}
1188
Reid Spencer68a24bd2005-08-27 18:50:39 +00001189//===----------------------------------------------------------------------===//
1190// RunVMAsmParser - Define an interface to this parser
1191//===----------------------------------------------------------------------===//
1192//
Reid Spencer14310612006-12-31 05:40:51 +00001193static Module* RunParser(Module * M);
1194
Reid Spencer68a24bd2005-08-27 18:50:39 +00001195Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1196 set_scan_file(F);
1197
1198 CurFilename = Filename;
1199 return RunParser(new Module(CurFilename));
1200}
1201
1202Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1203 set_scan_string(AsmString);
1204
1205 CurFilename = "from_memory";
1206 if (M == NULL) {
1207 return RunParser(new Module (CurFilename));
1208 } else {
1209 return RunParser(M);
1210 }
1211}
1212
1213
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001214
1215/* Enabling traces. */
1216#ifndef YYDEBUG
1217# define YYDEBUG 0
1218#endif
1219
1220/* Enabling verbose error messages. */
1221#ifdef YYERROR_VERBOSE
1222# undef YYERROR_VERBOSE
1223# define YYERROR_VERBOSE 1
1224#else
1225# define YYERROR_VERBOSE 0
1226#endif
1227
Reid Spencer41dff5e2007-01-26 08:05:27 +00001228/* Enabling the token table. */
1229#ifndef YYTOKEN_TABLE
1230# define YYTOKEN_TABLE 0
1231#endif
1232
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001233#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1234typedef union YYSTYPE
1235#line 885 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
1236{
Reid Spencer68a24bd2005-08-27 18:50:39 +00001237 llvm::Module *ModuleVal;
1238 llvm::Function *FunctionVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001239 llvm::BasicBlock *BasicBlockVal;
1240 llvm::TerminatorInst *TermInstVal;
1241 llvm::Instruction *InstVal;
Reid Spencera132e042006-12-03 05:46:11 +00001242 llvm::Constant *ConstVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001243
Reid Spencera132e042006-12-03 05:46:11 +00001244 const llvm::Type *PrimType;
Reid Spencer14310612006-12-31 05:40:51 +00001245 std::list<llvm::PATypeHolder> *TypeList;
Reid Spencera132e042006-12-03 05:46:11 +00001246 llvm::PATypeHolder *TypeVal;
1247 llvm::Value *ValueVal;
Reid Spencera132e042006-12-03 05:46:11 +00001248 std::vector<llvm::Value*> *ValueList;
Reid Spencer14310612006-12-31 05:40:51 +00001249 llvm::ArgListType *ArgList;
1250 llvm::TypeWithAttrs TypeWithAttrs;
1251 llvm::TypeWithAttrsList *TypeWithAttrsList;
1252 llvm::ValueRefList *ValueRefList;
1253
Reid Spencer68a24bd2005-08-27 18:50:39 +00001254 // Represent the RHS of PHI node
Reid Spencera132e042006-12-03 05:46:11 +00001255 std::list<std::pair<llvm::Value*,
1256 llvm::BasicBlock*> > *PHIList;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001257 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
Reid Spencera132e042006-12-03 05:46:11 +00001258 std::vector<llvm::Constant*> *ConstVector;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001259
1260 llvm::GlobalValue::LinkageTypes Linkage;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001261 llvm::GlobalValue::VisibilityTypes Visibility;
Reid Spencer14310612006-12-31 05:40:51 +00001262 llvm::FunctionType::ParameterAttributes ParamAttrs;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001263 int64_t SInt64Val;
1264 uint64_t UInt64Val;
1265 int SIntVal;
1266 unsigned UIntVal;
1267 double FPVal;
1268 bool BoolVal;
1269
1270 char *StrVal; // This memory is strdup'd!
Reid Spencer1628cec2006-10-26 06:15:43 +00001271 llvm::ValID ValIDVal; // strdup'd memory maybe!
Reid Spencer68a24bd2005-08-27 18:50:39 +00001272
Reid Spencera132e042006-12-03 05:46:11 +00001273 llvm::Instruction::BinaryOps BinaryOpVal;
1274 llvm::Instruction::TermOps TermOpVal;
1275 llvm::Instruction::MemoryOps MemOpVal;
1276 llvm::Instruction::CastOps CastOpVal;
1277 llvm::Instruction::OtherOps OtherOpVal;
Reid Spencera132e042006-12-03 05:46:11 +00001278 llvm::ICmpInst::Predicate IPredicate;
1279 llvm::FCmpInst::Predicate FPredicate;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001280}
1281/* Line 187 of yacc.c. */
1282#line 1283 "llvmAsmParser.tab.c"
1283 YYSTYPE;
Reid Spencer41dff5e2007-01-26 08:05:27 +00001284# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1285# define YYSTYPE_IS_DECLARED 1
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001286# define YYSTYPE_IS_TRIVIAL 1
Reid Spencer68a24bd2005-08-27 18:50:39 +00001287#endif
1288
Reid Spencer41dff5e2007-01-26 08:05:27 +00001289
Reid Spencer68a24bd2005-08-27 18:50:39 +00001290
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001291/* Copy the second part of user declarations. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001292
1293
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001294/* Line 216 of yacc.c. */
1295#line 1296 "llvmAsmParser.tab.c"
Reid Spencer41dff5e2007-01-26 08:05:27 +00001296
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001297#ifdef short
1298# undef short
Reid Spencer41dff5e2007-01-26 08:05:27 +00001299#endif
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001300
1301#ifdef YYTYPE_UINT8
1302typedef YYTYPE_UINT8 yytype_uint8;
1303#else
1304typedef unsigned char yytype_uint8;
Reid Spencer41dff5e2007-01-26 08:05:27 +00001305#endif
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001306
1307#ifdef YYTYPE_INT8
1308typedef YYTYPE_INT8 yytype_int8;
1309#elif (defined __STDC__ || defined __C99__FUNC__ \
1310 || defined __cplusplus || defined _MSC_VER)
1311typedef signed char yytype_int8;
1312#else
1313typedef short int yytype_int8;
Reid Spencer41dff5e2007-01-26 08:05:27 +00001314#endif
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001315
1316#ifdef YYTYPE_UINT16
1317typedef YYTYPE_UINT16 yytype_uint16;
1318#else
1319typedef unsigned short int yytype_uint16;
Reid Spencer41dff5e2007-01-26 08:05:27 +00001320#endif
1321
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001322#ifdef YYTYPE_INT16
1323typedef YYTYPE_INT16 yytype_int16;
1324#else
1325typedef short int yytype_int16;
1326#endif
1327
1328#ifndef YYSIZE_T
1329# ifdef __SIZE_TYPE__
1330# define YYSIZE_T __SIZE_TYPE__
1331# elif defined size_t
1332# define YYSIZE_T size_t
1333# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
1334 || defined __cplusplus || defined _MSC_VER)
1335# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1336# define YYSIZE_T size_t
1337# else
1338# define YYSIZE_T unsigned int
1339# endif
1340#endif
1341
1342#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1343
Reid Spencer41dff5e2007-01-26 08:05:27 +00001344#ifndef YY_
1345# if YYENABLE_NLS
1346# if ENABLE_NLS
1347# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1348# define YY_(msgid) dgettext ("bison-runtime", msgid)
1349# endif
1350# endif
1351# ifndef YY_
1352# define YY_(msgid) msgid
1353# endif
1354#endif
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001355
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001356/* Suppress unused-variable warnings by "using" E. */
1357#if ! defined lint || defined __GNUC__
1358# define YYUSE(e) ((void) (e))
1359#else
1360# define YYUSE(e) /* empty */
1361#endif
1362
1363/* Identity function, used to suppress warnings about constant conditions. */
1364#ifndef lint
1365# define YYID(n) (n)
1366#else
1367#if (defined __STDC__ || defined __C99__FUNC__ \
1368 || defined __cplusplus || defined _MSC_VER)
1369static int
1370YYID (int i)
1371#else
1372static int
1373YYID (i)
1374 int i;
1375#endif
1376{
1377 return i;
1378}
1379#endif
1380
1381#if ! defined yyoverflow || YYERROR_VERBOSE
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001382
1383/* The parser invokes alloca or malloc; define the necessary symbols. */
1384
Reid Spencer41dff5e2007-01-26 08:05:27 +00001385# ifdef YYSTACK_USE_ALLOCA
1386# if YYSTACK_USE_ALLOCA
1387# ifdef __GNUC__
1388# define YYSTACK_ALLOC __builtin_alloca
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001389# elif defined __BUILTIN_VA_ARG_INCR
1390# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1391# elif defined _AIX
1392# define YYSTACK_ALLOC __alloca
1393# elif defined _MSC_VER
1394# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1395# define alloca _alloca
Jeff Cohen361c3ef2007-01-21 19:19:31 +00001396# else
Reid Spencer41dff5e2007-01-26 08:05:27 +00001397# define YYSTACK_ALLOC alloca
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001398# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1399 || defined __cplusplus || defined _MSC_VER)
Reid Spencer41dff5e2007-01-26 08:05:27 +00001400# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001401# ifndef _STDLIB_H
1402# define _STDLIB_H 1
1403# endif
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001404# endif
1405# endif
1406# endif
1407# endif
1408
1409# ifdef YYSTACK_ALLOC
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001410 /* Pacify GCC's `empty if-body' warning. */
1411# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
Reid Spencer41dff5e2007-01-26 08:05:27 +00001412# ifndef YYSTACK_ALLOC_MAXIMUM
1413 /* The OS might guarantee only one guard page at the bottom of the stack,
1414 and a page size can be as small as 4096 bytes. So we cannot safely
1415 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1416 to allow for a few compiler-allocated temporary stack slots. */
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001417# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001418# endif
Reid Spencer41dff5e2007-01-26 08:05:27 +00001419# else
1420# define YYSTACK_ALLOC YYMALLOC
1421# define YYSTACK_FREE YYFREE
1422# ifndef YYSTACK_ALLOC_MAXIMUM
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001423# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
Reid Spencer41dff5e2007-01-26 08:05:27 +00001424# endif
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001425# if (defined __cplusplus && ! defined _STDLIB_H \
1426 && ! ((defined YYMALLOC || defined malloc) \
1427 && (defined YYFREE || defined free)))
1428# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1429# ifndef _STDLIB_H
1430# define _STDLIB_H 1
1431# endif
Reid Spencer41dff5e2007-01-26 08:05:27 +00001432# endif
1433# ifndef YYMALLOC
1434# define YYMALLOC malloc
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001435# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1436 || defined __cplusplus || defined _MSC_VER)
Reid Spencer41dff5e2007-01-26 08:05:27 +00001437void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1438# endif
1439# endif
1440# ifndef YYFREE
1441# define YYFREE free
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001442# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
1443 || defined __cplusplus || defined _MSC_VER)
Reid Spencer41dff5e2007-01-26 08:05:27 +00001444void free (void *); /* INFRINGES ON USER NAME SPACE */
1445# endif
1446# endif
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001447# endif
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001448#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001449
1450
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001451#if (! defined yyoverflow \
1452 && (! defined __cplusplus \
1453 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001454
1455/* A type that is properly aligned for any stack member. */
1456union yyalloc
1457{
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001458 yytype_int16 yyss;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001459 YYSTYPE yyvs;
1460 };
1461
1462/* The size of the maximum gap between one aligned stack and the next. */
Reid Spencer41dff5e2007-01-26 08:05:27 +00001463# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001464
1465/* The size of an array large to enough to hold all stacks, each with
1466 N elements. */
1467# define YYSTACK_BYTES(N) \
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001468 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
Reid Spencer41dff5e2007-01-26 08:05:27 +00001469 + YYSTACK_GAP_MAXIMUM)
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001470
1471/* Copy COUNT objects from FROM to TO. The source and destination do
1472 not overlap. */
1473# ifndef YYCOPY
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001474# if defined __GNUC__ && 1 < __GNUC__
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001475# define YYCOPY(To, From, Count) \
1476 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1477# else
1478# define YYCOPY(To, From, Count) \
1479 do \
1480 { \
Reid Spencer41dff5e2007-01-26 08:05:27 +00001481 YYSIZE_T yyi; \
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001482 for (yyi = 0; yyi < (Count); yyi++) \
Reid Spencer41dff5e2007-01-26 08:05:27 +00001483 (To)[yyi] = (From)[yyi]; \
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001484 } \
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001485 while (YYID (0))
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001486# endif
1487# endif
1488
1489/* Relocate STACK from its old location to the new one. The
1490 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1491 elements in the stack, and YYPTR gives the new location of the
1492 stack. Advance YYPTR to a properly aligned location for the next
1493 stack. */
1494# define YYSTACK_RELOCATE(Stack) \
1495 do \
1496 { \
1497 YYSIZE_T yynewbytes; \
1498 YYCOPY (&yyptr->Stack, Stack, yysize); \
1499 Stack = &yyptr->Stack; \
Reid Spencer41dff5e2007-01-26 08:05:27 +00001500 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001501 yyptr += yynewbytes / sizeof (*yyptr); \
1502 } \
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001503 while (YYID (0))
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001504
1505#endif
1506
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001507/* YYFINAL -- State number of the termination state. */
Reid Spencer41dff5e2007-01-26 08:05:27 +00001508#define YYFINAL 40
1509/* YYLAST -- Last index in YYTABLE. */
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001510#define YYLAST 1466
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001511
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001512/* YYNTOKENS -- Number of terminals. */
1513#define YYNTOKENS 146
1514/* YYNNTS -- Number of nonterminals. */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001515#define YYNNTS 79
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001516/* YYNRULES -- Number of rules. */
1517#define YYNRULES 286
1518/* YYNRULES -- Number of states. */
1519#define YYNSTATES 567
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001520
1521/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1522#define YYUNDEFTOK 2
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001523#define YYMAXUTOK 386
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001524
Reid Spencer41dff5e2007-01-26 08:05:27 +00001525#define YYTRANSLATE(YYX) \
1526 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001527
1528/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001529static const yytype_uint8 yytranslate[] =
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001530{
1531 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1532 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1533 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1534 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001535 136, 137, 134, 2, 133, 2, 2, 2, 2, 2,
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001536 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001537 141, 132, 142, 2, 2, 2, 2, 2, 2, 2,
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001538 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1539 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001540 2, 138, 135, 140, 2, 2, 2, 2, 2, 145,
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001541 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1542 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001543 139, 2, 2, 143, 2, 144, 2, 2, 2, 2,
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001544 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1545 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1546 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1547 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1548 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1549 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1550 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1551 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1552 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1553 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1554 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1555 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1556 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1557 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1558 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1559 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1560 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1561 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1562 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1563 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1564 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1565 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1566 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1567 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1568 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001569 125, 126, 127, 128, 129, 130, 131
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001570};
1571
1572#if YYDEBUG
1573/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1574 YYRHS. */
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001575static const yytype_uint16 yyprhs[] =
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001576{
1577 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1578 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1579 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1580 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1581 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1582 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
Reid Spencer41dff5e2007-01-26 08:05:27 +00001583 119, 121, 122, 125, 126, 128, 130, 133, 134, 136,
1584 138, 140, 142, 144, 146, 148, 150, 151, 153, 154,
1585 156, 158, 159, 161, 163, 165, 167, 168, 170, 172,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001586 174, 176, 178, 181, 183, 185, 187, 189, 190, 193,
1587 195, 197, 198, 201, 202, 205, 206, 210, 213, 214,
1588 216, 217, 221, 223, 226, 228, 230, 232, 234, 236,
1589 238, 241, 243, 246, 252, 258, 264, 270, 274, 277,
1590 283, 288, 291, 293, 295, 297, 301, 303, 307, 309,
1591 310, 312, 316, 321, 325, 329, 334, 339, 343, 350,
1592 356, 359, 362, 365, 368, 371, 374, 377, 380, 383,
1593 386, 393, 399, 408, 415, 422, 430, 438, 445, 452,
1594 461, 470, 474, 476, 478, 480, 482, 483, 485, 488,
1595 489, 493, 494, 498, 502, 504, 508, 512, 513, 520,
1596 521, 529, 530, 538, 541, 545, 547, 551, 555, 559,
1597 563, 565, 566, 572, 576, 578, 582, 584, 585, 595,
1598 597, 599, 604, 606, 608, 611, 615, 616, 618, 620,
1599 622, 624, 626, 628, 630, 632, 634, 638, 640, 646,
1600 648, 650, 652, 654, 656, 658, 661, 664, 667, 671,
1601 674, 675, 677, 680, 683, 687, 697, 707, 716, 731,
1602 733, 735, 742, 748, 751, 758, 766, 770, 776, 777,
1603 778, 782, 785, 787, 793, 799, 806, 813, 818, 823,
1604 830, 835, 840, 847, 854, 857, 866, 868, 870, 871,
1605 875, 882, 886, 893, 896, 901, 908
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001606};
1607
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001608/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1609static const yytype_int16 yyrhs[] =
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001610{
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001611 187, 0, -1, 66, -1, 67, -1, 68, -1, 69,
1612 -1, 70, -1, 71, -1, 72, -1, 73, -1, 74,
1613 -1, 75, -1, 76, -1, 77, -1, 106, -1, 107,
1614 -1, 108, -1, 109, -1, 110, -1, 111, -1, 112,
1615 -1, 113, -1, 114, -1, 115, -1, 116, -1, 117,
1616 -1, 120, -1, 121, -1, 122, -1, 80, -1, 81,
1617 -1, 82, -1, 83, -1, 84, -1, 85, -1, 86,
1618 -1, 87, -1, 88, -1, 89, -1, 90, -1, 91,
1619 -1, 92, -1, 93, -1, 94, -1, 95, -1, 96,
1620 -1, 97, -1, 98, -1, 99, -1, 86, -1, 87,
1621 -1, 88, -1, 89, -1, 21, -1, 22, -1, 9,
1622 -1, 10, -1, 11, -1, 14, -1, 17, -1, 155,
1623 -1, -1, 155, 132, -1, -1, 15, -1, 18, -1,
1624 158, 132, -1, -1, 35, -1, 37, -1, 36, -1,
Reid Spencer41dff5e2007-01-26 08:05:27 +00001625 38, -1, 40, -1, 39, -1, 41, -1, 43, -1,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001626 -1, 131, -1, -1, 39, -1, 41, -1, -1, 35,
Reid Spencer41dff5e2007-01-26 08:05:27 +00001627 -1, 36, -1, 37, -1, 40, -1, -1, 54, -1,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001628 55, -1, 56, -1, 57, -1, 58, -1, 53, 4,
1629 -1, 107, -1, 108, -1, 128, -1, 129, -1, -1,
1630 167, 166, -1, 127, -1, 166, -1, -1, 169, 168,
1631 -1, -1, 46, 4, -1, -1, 133, 46, 4, -1,
1632 29, 17, -1, -1, 172, -1, -1, 133, 175, 174,
1633 -1, 172, -1, 46, 4, -1, 9, -1, 10, -1,
1634 11, -1, 12, -1, 42, -1, 176, -1, 177, 134,
1635 -1, 209, -1, 135, 4, -1, 177, 136, 181, 137,
1636 169, -1, 8, 136, 181, 137, 169, -1, 138, 4,
1637 139, 177, 140, -1, 141, 4, 139, 177, 142, -1,
1638 143, 182, 144, -1, 143, 144, -1, 141, 143, 182,
1639 144, 142, -1, 141, 143, 144, 142, -1, 177, 167,
1640 -1, 177, -1, 8, -1, 178, -1, 180, 133, 178,
1641 -1, 180, -1, 180, 133, 32, -1, 32, -1, -1,
1642 177, -1, 182, 133, 177, -1, 177, 138, 185, 140,
1643 -1, 177, 138, 140, -1, 177, 145, 17, -1, 177,
1644 141, 185, 142, -1, 177, 143, 185, 144, -1, 177,
1645 143, 144, -1, 177, 141, 143, 185, 144, 142, -1,
1646 177, 141, 143, 144, 142, -1, 177, 33, -1, 177,
1647 34, -1, 177, 209, -1, 177, 184, -1, 177, 20,
1648 -1, 153, 3, -1, 153, 4, -1, 9, 21, -1,
1649 9, 22, -1, 154, 7, -1, 149, 136, 183, 31,
1650 177, 137, -1, 105, 136, 183, 220, 137, -1, 119,
1651 136, 183, 133, 183, 133, 183, 137, -1, 147, 136,
1652 183, 133, 183, 137, -1, 148, 136, 183, 133, 183,
1653 137, -1, 78, 151, 136, 183, 133, 183, 137, -1,
1654 79, 152, 136, 183, 133, 183, 137, -1, 150, 136,
1655 183, 133, 183, 137, -1, 124, 136, 183, 133, 183,
1656 137, -1, 125, 136, 183, 133, 183, 133, 183, 137,
1657 -1, 126, 136, 183, 133, 183, 133, 183, 137, -1,
1658 185, 133, 183, -1, 183, -1, 27, -1, 28, -1,
1659 188, -1, -1, 189, -1, 188, 189, -1, -1, 26,
1660 190, 205, -1, -1, 25, 191, 206, -1, 51, 50,
1661 195, -1, 19, -1, 157, 13, 177, -1, 157, 13,
1662 8, -1, -1, 159, 162, 186, 183, 192, 174, -1,
1663 -1, 159, 160, 162, 186, 183, 193, 174, -1, -1,
1664 159, 161, 162, 186, 177, 194, 174, -1, 44, 196,
1665 -1, 47, 132, 197, -1, 17, -1, 45, 132, 17,
1666 -1, 59, 132, 17, -1, 138, 198, 140, -1, 198,
1667 133, 17, -1, 17, -1, -1, 199, 133, 177, 167,
1668 156, -1, 177, 167, 156, -1, 199, -1, 199, 133,
1669 32, -1, 32, -1, -1, 165, 179, 158, 136, 200,
1670 137, 169, 173, 170, -1, 23, -1, 143, -1, 164,
1671 162, 201, 202, -1, 24, -1, 144, -1, 212, 204,
1672 -1, 163, 162, 201, -1, -1, 52, -1, 3, -1,
1673 4, -1, 7, -1, 21, -1, 22, -1, 33, -1,
1674 34, -1, 20, -1, 141, 185, 142, -1, 184, -1,
1675 50, 207, 17, 133, 17, -1, 5, -1, 6, -1,
1676 155, -1, 158, -1, 209, -1, 208, -1, 177, 210,
1677 -1, 212, 213, -1, 203, 213, -1, 214, 157, 215,
1678 -1, 214, 217, -1, -1, 16, -1, 60, 211, -1,
1679 60, 8, -1, 61, 12, 210, -1, 61, 9, 210,
1680 133, 12, 210, 133, 12, 210, -1, 62, 153, 210,
1681 133, 12, 210, 138, 216, 140, -1, 62, 153, 210,
1682 133, 12, 210, 138, 140, -1, 63, 165, 179, 210,
1683 136, 219, 137, 169, 31, 12, 210, 64, 12, 210,
1684 -1, 64, -1, 65, -1, 216, 153, 208, 133, 12,
1685 210, -1, 153, 208, 133, 12, 210, -1, 157, 222,
1686 -1, 177, 138, 210, 133, 210, 140, -1, 218, 133,
1687 138, 210, 133, 210, 140, -1, 177, 210, 167, -1,
1688 219, 133, 177, 210, 167, -1, -1, -1, 220, 133,
1689 211, -1, 49, 48, -1, 48, -1, 147, 177, 210,
1690 133, 210, -1, 148, 177, 210, 133, 210, -1, 78,
1691 151, 177, 210, 133, 210, -1, 79, 152, 177, 210,
1692 133, 210, -1, 150, 211, 133, 211, -1, 149, 211,
1693 31, 177, -1, 119, 211, 133, 211, 133, 211, -1,
1694 123, 211, 133, 177, -1, 124, 211, 133, 211, -1,
1695 125, 211, 133, 211, 133, 211, -1, 126, 211, 133,
1696 211, 133, 211, -1, 118, 218, -1, 221, 165, 179,
1697 210, 136, 219, 137, 169, -1, 224, -1, 30, -1,
1698 -1, 100, 177, 171, -1, 100, 177, 133, 9, 210,
1699 171, -1, 101, 177, 171, -1, 101, 177, 133, 9,
1700 210, 171, -1, 102, 211, -1, 223, 103, 177, 210,
1701 -1, 223, 104, 211, 133, 177, 210, -1, 105, 177,
1702 210, 220, -1
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001703};
1704
1705/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001706static const yytype_uint16 yyrline[] =
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001707{
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001708 0, 1031, 1031, 1031, 1031, 1031, 1031, 1031, 1031, 1031,
1709 1031, 1032, 1032, 1032, 1033, 1033, 1033, 1033, 1033, 1033,
1710 1034, 1034, 1034, 1034, 1034, 1034, 1035, 1035, 1035, 1037,
1711 1037, 1038, 1038, 1039, 1039, 1040, 1040, 1041, 1041, 1045,
1712 1045, 1046, 1046, 1047, 1047, 1048, 1048, 1049, 1049, 1050,
1713 1050, 1051, 1051, 1052, 1053, 1058, 1059, 1059, 1061, 1061,
1714 1062, 1062, 1066, 1070, 1075, 1075, 1077, 1081, 1087, 1088,
1715 1089, 1090, 1091, 1095, 1096, 1097, 1101, 1102, 1106, 1107,
1716 1108, 1112, 1113, 1114, 1115, 1116, 1119, 1120, 1121, 1122,
1717 1123, 1124, 1125, 1132, 1133, 1134, 1135, 1138, 1139, 1144,
1718 1145, 1148, 1149, 1156, 1157, 1163, 1164, 1172, 1180, 1181,
1719 1186, 1187, 1188, 1193, 1206, 1206, 1206, 1206, 1209, 1213,
1720 1217, 1224, 1229, 1237, 1255, 1273, 1278, 1290, 1300, 1304,
1721 1314, 1321, 1328, 1335, 1340, 1345, 1352, 1353, 1360, 1367,
1722 1375, 1380, 1391, 1419, 1435, 1464, 1492, 1517, 1536, 1561,
1723 1580, 1592, 1599, 1665, 1675, 1685, 1691, 1697, 1702, 1707,
1724 1715, 1727, 1748, 1756, 1762, 1773, 1778, 1783, 1792, 1798,
1725 1804, 1813, 1817, 1825, 1825, 1836, 1841, 1849, 1850, 1854,
1726 1854, 1858, 1858, 1861, 1864, 1876, 1900, 1911, 1911, 1921,
1727 1921, 1929, 1929, 1939, 1942, 1948, 1961, 1965, 1970, 1972,
1728 1977, 1982, 1991, 2001, 2012, 2016, 2025, 2034, 2039, 2145,
1729 2145, 2147, 2156, 2156, 2158, 2163, 2175, 2179, 2184, 2188,
1730 2192, 2196, 2200, 2204, 2208, 2212, 2216, 2241, 2245, 2259,
1731 2263, 2267, 2271, 2277, 2277, 2283, 2292, 2296, 2305, 2316,
1732 2325, 2337, 2350, 2354, 2358, 2363, 2373, 2392, 2401, 2468,
1733 2472, 2479, 2490, 2503, 2512, 2523, 2533, 2541, 2549, 2552,
1734 2553, 2560, 2564, 2569, 2590, 2607, 2620, 2633, 2642, 2654,
1735 2662, 2669, 2675, 2681, 2687, 2702, 2766, 2771, 2775, 2782,
1736 2789, 2797, 2804, 2812, 2820, 2834, 2851
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001737};
1738#endif
1739
Reid Spencer41dff5e2007-01-26 08:05:27 +00001740#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1741/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001742 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001743static const char *const yytname[] =
1744{
Reid Spencer41dff5e2007-01-26 08:05:27 +00001745 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL",
1746 "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE", "FLOAT",
1747 "DOUBLE", "LABEL", "TYPE", "LOCALVAR", "GLOBALVAR", "LABELSTR",
1748 "STRINGCONSTANT", "ATSTRINGCONSTANT", "IMPLEMENTATION",
1749 "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK",
1750 "DECLARE", "DEFINE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO",
1751 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1752 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1753 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "DEPLIBS", "CALL", "TAIL",
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001754 "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", "FASTCC_TOK",
1755 "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT",
1756 "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB",
1757 "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR",
1758 "XOR", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT",
1759 "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD",
1760 "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE",
1761 "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST",
1762 "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT",
1763 "PHI_TOK", "SELECT", "SHL", "LSHR", "ASHR", "VAARG", "EXTRACTELEMENT",
1764 "INSERTELEMENT", "SHUFFLEVECTOR", "NORETURN", "INREG", "SRET", "DEFAULT",
1765 "HIDDEN", "'='", "','", "'*'", "'\\\\'", "'('", "')'", "'['", "'x'",
1766 "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept", "ArithmeticOps",
1767 "LogicalOps", "CastOps", "ShiftOps", "IPredicates", "FPredicates",
1768 "IntType", "FPType", "LocalName", "OptLocalName", "OptLocalAssign",
1769 "GlobalName", "OptGlobalAssign", "GVInternalLinkage",
Reid Spencer41dff5e2007-01-26 08:05:27 +00001770 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1771 "FunctionDefineLinkage", "OptCallingConv", "ParamAttr", "OptParamAttrs",
1772 "FuncAttr", "OptFuncAttrs", "OptAlign", "OptCAlign", "SectionString",
1773 "OptSection", "GlobalVarAttributes", "GlobalVarAttribute", "PrimType",
1774 "Types", "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI",
1775 "TypeListI", "ConstVal", "ConstExpr", "ConstVector", "GlobalType",
1776 "Module", "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5",
1777 "AsmBlock", "TargetDefinition", "LibrariesDefinition", "LibList",
1778 "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader",
1779 "END", "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1780 "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList",
1781 "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst",
1782 "PHIList", "ValueRefList", "IndexList", "OptTailCall", "InstVal",
1783 "OptVolatile", "MemoryInst", 0
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001784};
1785#endif
1786
1787# ifdef YYPRINT
1788/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1789 token YYLEX-NUM. */
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001790static const yytype_uint16 yytoknum[] =
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001791{
1792 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1793 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1794 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1795 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1796 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1797 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1798 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1799 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1800 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1801 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1802 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1803 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1804 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001805 385, 386, 61, 44, 42, 92, 40, 41, 91, 120,
1806 93, 60, 62, 123, 125, 99
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001807};
1808# endif
1809
1810/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001811static const yytype_uint8 yyr1[] =
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001812{
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001813 0, 146, 147, 147, 147, 147, 147, 147, 147, 147,
1814 147, 148, 148, 148, 149, 149, 149, 149, 149, 149,
1815 149, 149, 149, 149, 149, 149, 150, 150, 150, 151,
1816 151, 151, 151, 151, 151, 151, 151, 151, 151, 152,
1817 152, 152, 152, 152, 152, 152, 152, 152, 152, 152,
1818 152, 152, 152, 152, 152, 153, 154, 154, 155, 155,
1819 156, 156, 157, 157, 158, 158, 159, 159, 160, 160,
1820 160, 160, 160, 161, 161, 161, 162, 162, 163, 163,
1821 163, 164, 164, 164, 164, 164, 165, 165, 165, 165,
1822 165, 165, 165, 166, 166, 166, 166, 167, 167, 168,
1823 168, 169, 169, 170, 170, 171, 171, 172, 173, 173,
1824 174, 174, 175, 175, 176, 176, 176, 176, 177, 177,
1825 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
1826 177, 178, 179, 179, 180, 180, 181, 181, 181, 181,
1827 182, 182, 183, 183, 183, 183, 183, 183, 183, 183,
Reid Spencer41dff5e2007-01-26 08:05:27 +00001828 183, 183, 183, 183, 183, 183, 183, 183, 183, 183,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001829 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
1830 184, 185, 185, 186, 186, 187, 187, 188, 188, 190,
1831 189, 191, 189, 189, 189, 189, 189, 192, 189, 193,
1832 189, 194, 189, 189, 189, 195, 196, 196, 197, 198,
1833 198, 198, 199, 199, 200, 200, 200, 200, 201, 202,
1834 202, 203, 204, 204, 205, 206, 207, 207, 208, 208,
1835 208, 208, 208, 208, 208, 208, 208, 208, 208, 209,
1836 209, 209, 209, 210, 210, 211, 212, 212, 213, 214,
1837 214, 214, 215, 215, 215, 215, 215, 215, 215, 215,
1838 215, 216, 216, 217, 218, 218, 219, 219, 219, 220,
1839 220, 221, 221, 222, 222, 222, 222, 222, 222, 222,
1840 222, 222, 222, 222, 222, 222, 222, 223, 223, 224,
1841 224, 224, 224, 224, 224, 224, 224
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001842};
1843
1844/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001845static const yytype_uint8 yyr2[] =
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001846{
1847 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1848 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1849 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1850 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1851 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1852 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Reid Spencer41dff5e2007-01-26 08:05:27 +00001853 1, 0, 2, 0, 1, 1, 2, 0, 1, 1,
1854 1, 1, 1, 1, 1, 1, 0, 1, 0, 1,
1855 1, 0, 1, 1, 1, 1, 0, 1, 1, 1,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001856 1, 1, 2, 1, 1, 1, 1, 0, 2, 1,
1857 1, 0, 2, 0, 2, 0, 3, 2, 0, 1,
1858 0, 3, 1, 2, 1, 1, 1, 1, 1, 1,
1859 2, 1, 2, 5, 5, 5, 5, 3, 2, 5,
1860 4, 2, 1, 1, 1, 3, 1, 3, 1, 0,
1861 1, 3, 4, 3, 3, 4, 4, 3, 6, 5,
1862 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1863 6, 5, 8, 6, 6, 7, 7, 6, 6, 8,
1864 8, 3, 1, 1, 1, 1, 0, 1, 2, 0,
1865 3, 0, 3, 3, 1, 3, 3, 0, 6, 0,
1866 7, 0, 7, 2, 3, 1, 3, 3, 3, 3,
1867 1, 0, 5, 3, 1, 3, 1, 0, 9, 1,
1868 1, 4, 1, 1, 2, 3, 0, 1, 1, 1,
1869 1, 1, 1, 1, 1, 1, 3, 1, 5, 1,
1870 1, 1, 1, 1, 1, 2, 2, 2, 3, 2,
1871 0, 1, 2, 2, 3, 9, 9, 8, 14, 1,
1872 1, 6, 5, 2, 6, 7, 3, 5, 0, 0,
1873 3, 2, 1, 5, 5, 6, 6, 4, 4, 6,
1874 4, 4, 6, 6, 2, 8, 1, 1, 0, 3,
1875 6, 3, 6, 2, 4, 6, 4
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001876};
1877
1878/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1879 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1880 means the default is an error. */
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001881static const yytype_uint16 yydefact[] =
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001882{
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001883 67, 58, 64, 59, 65, 184, 181, 179, 0, 0,
1884 0, 0, 0, 0, 76, 0, 67, 177, 78, 81,
1885 0, 0, 193, 0, 0, 62, 0, 66, 68, 70,
Reid Spencer41dff5e2007-01-26 08:05:27 +00001886 69, 71, 73, 72, 74, 75, 77, 76, 76, 0,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001887 1, 178, 79, 80, 76, 182, 82, 83, 84, 85,
1888 76, 240, 180, 240, 0, 0, 201, 194, 195, 183,
1889 229, 230, 186, 114, 115, 116, 117, 118, 0, 0,
1890 0, 0, 231, 232, 119, 185, 121, 0, 0, 173,
1891 174, 0, 86, 86, 241, 237, 63, 212, 213, 214,
1892 236, 196, 197, 200, 0, 139, 122, 0, 0, 0,
1893 0, 128, 140, 0, 120, 139, 0, 0, 114, 115,
1894 116, 0, 0, 0, 187, 0, 87, 88, 89, 90,
1895 91, 0, 215, 0, 278, 239, 0, 198, 138, 97,
1896 134, 136, 0, 0, 0, 0, 0, 0, 127, 0,
1897 189, 191, 157, 158, 155, 156, 159, 154, 150, 151,
1898 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1899 12, 13, 0, 0, 0, 14, 15, 16, 17, 18,
1900 19, 20, 21, 22, 23, 24, 25, 0, 26, 27,
1901 28, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1902 0, 0, 153, 152, 110, 92, 133, 132, 0, 209,
1903 210, 211, 277, 262, 0, 0, 0, 0, 86, 249,
1904 250, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1905 0, 0, 0, 0, 0, 0, 0, 238, 86, 253,
1906 0, 276, 199, 131, 0, 101, 0, 0, 130, 0,
1907 141, 101, 110, 110, 29, 30, 31, 32, 33, 34,
1908 35, 36, 37, 38, 0, 53, 54, 49, 50, 51,
1909 52, 39, 40, 41, 42, 43, 44, 45, 46, 47,
1910 48, 0, 0, 0, 0, 0, 0, 143, 172, 0,
1911 0, 0, 147, 0, 144, 0, 0, 0, 0, 0,
1912 188, 0, 261, 243, 0, 242, 0, 0, 55, 0,
1913 0, 0, 0, 105, 105, 283, 0, 0, 274, 0,
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001914 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001915 0, 93, 94, 95, 96, 98, 137, 135, 124, 125,
1916 126, 129, 123, 190, 192, 0, 0, 259, 0, 0,
1917 0, 0, 0, 142, 128, 140, 0, 145, 146, 0,
1918 0, 0, 0, 0, 0, 112, 110, 207, 218, 219,
1919 220, 225, 221, 222, 223, 224, 216, 0, 227, 234,
1920 233, 235, 0, 244, 0, 0, 0, 0, 0, 279,
1921 0, 281, 259, 0, 0, 0, 0, 0, 0, 0,
1922 0, 0, 0, 0, 0, 0, 0, 99, 100, 102,
1923 0, 0, 0, 0, 0, 0, 0, 171, 149, 0,
1924 0, 0, 0, 0, 107, 113, 111, 206, 97, 204,
1925 0, 217, 0, 0, 0, 0, 0, 0, 0, 0,
1926 0, 0, 286, 0, 0, 0, 270, 271, 0, 0,
1927 0, 0, 268, 267, 0, 284, 0, 0, 0, 0,
1928 161, 0, 0, 0, 0, 148, 0, 0, 0, 0,
1929 61, 0, 101, 0, 226, 0, 0, 258, 0, 0,
1930 105, 106, 105, 0, 0, 0, 0, 0, 263, 264,
1931 258, 0, 0, 0, 260, 0, 168, 0, 0, 163,
1932 164, 160, 167, 60, 203, 205, 97, 108, 0, 0,
1933 0, 0, 0, 265, 266, 0, 280, 282, 0, 0,
1934 269, 272, 273, 0, 285, 165, 166, 0, 0, 0,
1935 61, 109, 103, 228, 0, 0, 97, 0, 101, 254,
1936 0, 101, 162, 169, 170, 202, 0, 208, 0, 247,
1937 0, 0, 256, 0, 0, 255, 275, 104, 245, 0,
1938 246, 0, 97, 0, 0, 0, 257, 0, 0, 0,
1939 0, 252, 0, 0, 251, 0, 248
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001940};
1941
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001942/* YYDEFGOTO[NTERM-NUM]. */
1943static const yytype_int16 yydefgoto[] =
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001944{
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001945 -1, 188, 189, 190, 191, 254, 271, 111, 112, 72,
1946 494, 12, 73, 14, 37, 38, 39, 44, 50, 121,
1947 325, 233, 399, 328, 537, 379, 355, 522, 290, 356,
1948 74, 113, 130, 198, 131, 132, 103, 278, 368, 279,
1949 81, 15, 16, 17, 19, 18, 194, 242, 243, 59,
1950 22, 57, 94, 419, 420, 122, 201, 51, 89, 52,
1951 45, 422, 369, 76, 371, 295, 53, 85, 86, 227,
1952 541, 125, 308, 502, 402, 228, 229, 230, 231
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001953};
1954
1955/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1956 STATE-NUM. */
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001957#define YYPACT_NINF -386
1958static const yytype_int16 yypact[] =
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001959{
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001960 357, -386, -386, -386, -386, -386, -386, -386, 28, -112,
1961 61, -51, 136, 27, 288, 172, 594, -386, 209, 93,
1962 49, 75, -386, 48, 230, -386, 841, -386, -386, -386,
1963 -386, -386, -386, -386, -386, -386, -386, 129, 129, 229,
1964 -386, -386, -386, -386, 129, -386, -386, -386, -386, -386,
1965 129, 252, -386, 18, 257, 274, 279, -386, -386, -386,
1966 -386, -386, 161, -386, -386, -386, -386, -386, 294, 295,
1967 4, 13, -386, -386, -386, 137, -386, 229, 229, -386,
1968 -386, 1052, 228, 228, -386, -386, 110, -386, -386, -386,
1969 -386, -386, -386, -386, -65, 126, -386, 164, 165, 108,
1970 161, -386, 137, -49, -386, 126, 1052, 1192, 68, 298,
1971 299, 44, 300, 617, -386, 305, -386, -386, -386, -386,
1972 -386, 1206, -386, 9, 1340, -386, 293, -386, -386, 137,
1973 -386, 178, 175, 1192, 1192, 171, -45, 1192, -386, 177,
1974 -386, 137, -386, -386, -386, -386, -386, -386, -386, -386,
1975 -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,
1976 -386, -386, 264, 475, 179, -386, -386, -386, -386, -386,
1977 -386, -386, -386, -386, -386, -386, -386, 186, -386, -386,
1978 -386, 194, 202, 203, 803, 1241, 461, 325, 219, 222,
1979 237, 243, -386, -386, 236, -386, 161, 137, 226, -386,
1980 -386, -386, -386, -386, 332, 1256, 233, 372, 228, -386,
1981 -386, 264, 475, 1192, 1192, 1192, 1192, 1192, 1192, 1192,
1982 1192, 1192, 1192, 1192, 1192, 1192, 1192, -386, 228, -386,
1983 159, -386, -386, -64, 1095, -386, -33, 78, -386, 242,
1984 137, -386, 236, 236, -386, -386, -386, -386, -386, -386,
1985 -386, -386, -386, -386, 249, -386, -386, -386, -386, -386,
1986 -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,
1987 -386, 250, 1052, 1052, 1052, 1052, 1052, -386, -386, -57,
1988 518, -92, -386, -39, -386, 1052, 1052, 1052, 1052, 23,
1989 -386, 253, -386, 161, 760, -386, 885, 885, -386, 885,
1990 1206, 1192, 1192, 43, 77, -386, 760, 31, 255, 259,
1991 262, 263, 266, 267, 760, 760, 366, 269, 1206, 1192,
1992 1192, -386, -386, -386, -386, -386, -386, -386, -50, -386,
1993 -386, -386, -50, -386, -386, 1052, 1052, -386, 270, 272,
1994 276, 277, 1052, -386, 265, 617, -23, -386, -386, 278,
1995 287, 381, 289, 408, 423, -386, 236, 1134, -386, -386,
1996 -386, -386, -386, -386, -386, -386, 376, 1052, -386, -386,
1997 -386, -386, 296, -386, 297, 885, 760, 760, 3, -386,
1998 5, -386, -386, 885, 301, 1192, 1192, 1192, 1192, 1192,
1999 302, 304, 1192, 1192, 885, 760, 307, -386, -386, -386,
2000 308, 310, -40, 1052, 1052, 1052, 1052, -386, -386, 291,
2001 1052, 1052, 1192, 1052, -386, -386, -386, -386, 137, 311,
2002 309, -386, 421, -88, 433, 435, 312, 316, 320, 885,
2003 450, 885, 323, 324, 885, 326, 137, -386, 328, 329,
2004 885, 885, 137, -386, 322, -386, 1192, 1052, 1052, 1192,
2005 -386, 331, 337, 344, 347, -386, 348, 349, 101, 351,
2006 125, 1150, -386, 356, -386, 885, 885, 1192, 885, 885,
2007 358, -386, 358, 885, 362, 1192, 1192, 1192, -386, -386,
2008 1192, 760, 361, 364, -386, 1052, -386, 1052, 1052, -386,
2009 -386, -386, -386, -386, -386, -386, 137, 56, 448, 371,
2010 343, 760, -31, -386, -386, 438, -386, -386, 359, 885,
2011 -386, -386, -386, 37, -386, -386, -386, 368, 369, 370,
2012 125, -386, 462, -386, 497, 6, -386, 1192, -386, -386,
2013 373, -386, -386, -386, -386, -386, 506, -386, 885, -386,
2014 1009, 20, -64, 760, 151, -386, -50, -386, -386, 382,
2015 -386, 1009, -386, 502, 504, 384, -64, 885, 885, 507,
2016 454, -386, 885, 509, -386, 885, -386
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002017};
2018
2019/* YYPGOTO[NTERM-NUM]. */
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002020static const yytype_int16 yypgoto[] =
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002021{
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002022 -386, 398, 401, 407, 410, 327, 330, -204, -386, 0,
2023 17, 453, 10, -386, -386, -386, 54, -386, -386, -175,
2024 -319, -381, -386, -239, -386, -297, 46, -386, -203, -386,
2025 -386, -25, 306, -283, -386, 436, 445, -70, -109, -180,
2026 210, -386, -386, 529, -386, -386, -386, -386, -386, -386,
2027 -386, -386, -386, -386, -386, 464, -386, -386, -386, -386,
2028 -386, -386, -385, -75, 117, -159, -386, 496, -386, -386,
2029 -386, -386, -386, 70, 170, -386, -386, -386, -386
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002030};
2031
2032/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
2033 positive, shift that token. If negative, reduce the rule which
2034 number is the opposite. If zero, do what YYDEFACT says.
Reid Spencer41dff5e2007-01-26 08:05:27 +00002035 If YYTABLE_NINF, syntax error. */
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002036#define YYTABLE_NINF -177
2037static const yytype_int16 yytable[] =
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002038{
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002039 11, 75, 332, 299, 192, 281, 283, 381, 98, 398,
2040 13, 114, 429, 398, 431, 298, 11, 375, 60, 61,
2041 23, 100, 63, 64, 65, 66, 13, 1, 2, 298,
2042 3, 4, 199, 300, 84, 394, 140, 460, 193, 333,
2043 334, 342, 87, 321, 322, 342, 102, 144, 145, 430,
2044 347, 430, 353, 318, 464, 67, 305, 321, 322, 309,
2045 310, 311, 312, 313, 323, 324, 316, 317, 126, 354,
2046 129, -55, -55, 20, 102, 127, 342, 397, 323, 324,
2047 129, 25, 141, 343, 137, 353, 11, 21, 137, 142,
2048 143, 77, 78, 449, 342, 138, 197, 450, 82, 239,
2049 346, 104, 527, 105, 83, 348, 528, 329, 236, 237,
2050 342, 24, 240, 60, 61, 520, 100, 63, 64, 65,
2051 66, 409, 1, 2, 1, 3, 4, 3, 46, 47,
2052 48, 60, 61, 49, 100, 63, 64, 65, 66, 1,
2053 1, 2, 3, 3, 4, 542, 539, 99, 68, 26,
2054 67, 69, 200, 416, 70, 549, 71, 101, 128, 27,
2055 550, 396, 88, 321, 322, 104, 555, 105, 67, 383,
2056 527, 556, 40, 506, 531, 507, 378, 104, 398, 105,
2057 294, 54, 553, 397, 323, 324, 56, 423, 303, 304,
2058 294, 306, 307, 294, 294, 294, 294, 294, 314, 315,
2059 294, 294, 337, 338, 339, 340, 341, 55, 291, 129,
2060 380, 104, 104, 105, 105, 349, 350, 351, 352, 370,
2061 330, 370, 370, 497, 370, 398, 435, 398, 437, 438,
2062 439, 370, 321, 322, 443, 104, 192, 105, 491, 370,
2063 370, 2, 296, 68, 4, 297, 69, 58, 42, 70,
2064 43, 71, 135, 323, 324, 345, 79, 80, 321, 322,
2065 36, 68, 319, 320, 69, 400, 401, 70, 84, 71,
2066 193, 104, 407, 105, 91, 197, 376, 377, 397, 323,
2067 324, 115, 116, 117, 118, 119, 120, 106, 107, 544,
2068 484, 92, 546, 197, 395, 294, 93, 95, 96, 97,
2069 370, 370, 370, 133, 134, -56, -57, 146, 370, 195,
2070 232, 234, 235, 238, 241, 272, 510, 511, 512, 370,
2071 370, 540, 273, 28, 29, 30, 31, 32, 33, 34,
2072 274, 35, 418, 451, 452, 453, 454, 551, 275, 276,
2073 456, 457, 284, 459, 244, 245, 246, 247, 248, 249,
2074 250, 251, 252, 253, 370, 285, 370, -176, 286, 370,
2075 294, 436, 294, 294, 294, 370, 370, 442, 294, 289,
2076 -63, 1, 2, 287, 3, 4, 5, 482, 483, 288,
2077 292, 298, 6, 7, 331, 335, 336, 458, 384, 357,
2078 370, 370, 385, 370, 370, 386, 387, 392, 370, 388,
2079 389, 8, 393, 403, 9, 404, 370, 408, 10, 405,
2080 406, 410, 412, 372, 373, 517, 374, 518, 519, 36,
2081 411, 481, 413, 382, 294, 414, 370, 415, 421, 424,
2082 425, 390, 391, 455, 370, 440, 496, 441, 463, 434,
2083 446, 447, 501, 448, 461, 465, 462, 466, 467, 468,
2084 294, 294, 294, 469, 471, 501, 449, 473, 480, 475,
2085 493, 476, 477, 370, 485, 523, 60, 61, 370, 100,
2086 108, 109, 110, 66, 486, 1, 2, 487, 3, 4,
2087 488, 525, 370, 370, 430, 489, 490, 370, 492, 498,
2088 370, 505, 426, 427, 428, 509, 255, 256, 515, 529,
2089 433, 516, 543, 67, 524, 532, 533, 534, 536, 538,
2090 547, 444, 445, 545, 557, 554, 558, 559, 563, 562,
2091 493, 565, 223, 60, 61, 224, 100, 108, 109, 110,
2092 66, 225, 1, 2, 226, 3, 4, 535, 301, 124,
2093 327, 139, 302, 521, 136, 41, 470, 123, 472, 90,
2094 513, 474, 432, 0, 0, 0, 0, 478, 479, 0,
2095 67, 257, 258, 259, 260, 261, 262, 263, 264, 265,
2096 266, 267, 268, 269, 270, 0, 0, 0, 0, 0,
2097 0, 0, 499, 500, 0, 503, 504, 0, 0, 0,
2098 508, 0, 0, 0, -175, 0, 68, 0, 514, 69,
2099 0, 0, 70, 0, 71, 282, 0, -63, 1, 2,
2100 0, 3, 4, 5, 0, 0, 0, 0, 526, 6,
2101 7, 0, 60, 61, 0, 0, 530, 0, 0, 0,
2102 0, 1, 2, 0, 3, 4, 0, 147, 8, 0,
2103 0, 9, 0, 0, 0, 10, 0, 0, 0, 0,
2104 148, 149, 0, 68, 0, 548, 69, 0, 0, 70,
2105 552, 71, 344, 0, 0, 0, 0, 0, 0, 0,
2106 0, 0, 0, 0, 560, 561, 0, 0, 0, 564,
2107 0, 0, 566, 150, 151, 152, 153, 154, 155, 156,
2108 157, 158, 159, 160, 161, 162, 163, 0, 0, 0,
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002109 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002110 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002111 0, 0, 164, 165, 166, 167, 168, 169, 170, 171,
2112 172, 173, 174, 175, 176, 0, 177, 178, 179, 180,
2113 0, 181, 182, 183, 0, 0, 0, 0, 0, 0,
2114 0, 104, 0, 105, 0, 184, 0, 0, 185, 0,
2115 186, 0, 187, 358, 359, 60, 61, 360, 0, 0,
2116 0, 0, 0, 0, 1, 2, 0, 3, 4, 0,
2117 361, 362, 363, 0, 0, 0, 0, 0, 0, 0,
2118 0, 0, 0, 364, 365, 0, 0, 0, 0, 0,
2119 0, 0, 0, 0, 0, 0, 0, 0, 60, 61,
2120 366, 100, 108, 109, 110, 66, 0, 1, 2, 0,
2121 3, 4, 0, 0, 0, 0, 150, 151, 152, 153,
2122 154, 155, 156, 157, 158, 159, 160, 161, 162, 163,
2123 0, 0, 0, 0, 0, 67, 60, 61, 0, 62,
Reid Spencer41dff5e2007-01-26 08:05:27 +00002124 63, 64, 65, 66, 0, 1, 2, 0, 3, 4,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002125 0, 0, 0, 0, 0, 164, 165, 166, 167, 168,
2126 169, 170, 171, 172, 173, 174, 175, 176, 0, 177,
2127 178, 179, 180, 67, 181, 182, 183, 0, 358, 359,
2128 60, 61, 360, 0, 104, 0, 105, 0, 0, 1,
2129 2, 367, 3, 4, 0, 361, 362, 363, 0, 0,
2130 0, 0, 0, 0, 0, 0, 0, 0, 364, 365,
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002131 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002132 0, 0, 0, 0, 0, 366, 0, 0, 68, 0,
2133 0, 69, 0, 277, 70, 0, 71, 0, 0, 0,
2134 0, 150, 151, 152, 153, 154, 155, 156, 157, 158,
2135 159, 160, 161, 162, 163, 0, 0, 0, 0, 0,
2136 0, 0, 0, 0, 0, 0, 68, 0, 0, 69,
2137 0, 0, 70, 0, 71, 0, 0, 0, 0, 0,
2138 164, 165, 166, 167, 168, 169, 170, 171, 172, 173,
2139 174, 175, 176, 0, 177, 178, 179, 180, 0, 181,
2140 182, 183, 358, 359, 0, 0, 360, 0, 0, 0,
2141 0, 0, 0, 0, 0, 0, 367, 0, 0, 361,
2142 362, 363, 0, 0, 0, 0, 0, 0, 0, 0,
2143 0, 0, 364, 365, 0, 0, 0, 0, 0, 0,
2144 0, 0, 0, 0, 0, 0, 0, 60, 61, 366,
2145 100, 108, 109, 110, 66, 0, 1, 2, 0, 3,
2146 4, 0, 0, 0, 0, 150, 151, 152, 153, 154,
2147 155, 156, 157, 158, 159, 160, 161, 162, 163, 0,
2148 0, 0, 0, 0, 67, 0, 0, 0, 0, 0,
2149 60, 61, 0, 100, 63, 64, 65, 66, 0, 1,
2150 2, 0, 3, 4, 164, 165, 166, 167, 168, 169,
2151 170, 171, 172, 173, 174, 175, 176, 326, 177, 178,
2152 179, 180, 0, 181, 182, 183, 0, 67, 0, 60,
Reid Spencer41dff5e2007-01-26 08:05:27 +00002153 61, 0, 100, 63, 64, 65, 66, 0, 1, 2,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002154 367, 3, 4, 0, 0, 60, 61, 0, 100, 63,
2155 64, 65, 66, 0, 1, 2, 417, 3, 4, 0,
2156 0, 0, 0, 0, 0, 0, 67, 0, 0, 0,
2157 0, 0, 495, 0, 0, 0, 0, 68, 0, 0,
2158 69, 0, 67, 70, 0, 71, 0, 60, 61, 0,
2159 100, 63, 64, 65, 66, 0, 1, 2, 0, 3,
2160 4, 60, 61, 0, 196, 63, 64, 65, 66, 0,
2161 1, 2, 0, 3, 4, 0, 0, 0, 0, 0,
2162 68, 0, 0, 69, 67, 0, 70, 0, 71, 0,
2163 0, 0, 0, 0, 0, 0, 60, 61, 67, 100,
2164 108, 109, 110, 66, 0, 1, 2, 0, 3, 4,
2165 0, 60, 61, 0, 293, 63, 64, 65, 66, 68,
2166 1, 2, 69, 3, 4, 70, 0, 71, 0, 0,
2167 0, 0, 0, 67, 0, 68, 0, 0, 69, 0,
2168 0, 70, 0, 71, 0, 0, 0, 0, 67, 0,
2169 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2170 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencer41dff5e2007-01-26 08:05:27 +00002171 0, 0, 0, 0, 0, 0, 0, 68, 0, 0,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002172 69, 0, 0, 70, 0, 71, 0, 0, 0, 0,
Reid Spencer41dff5e2007-01-26 08:05:27 +00002173 0, 68, 0, 0, 69, 0, 0, 70, 0, 71,
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002174 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2175 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002176 202, 0, 0, 0, 0, 0, 68, 0, 0, 69,
2177 0, 0, 70, 0, 280, 0, 0, 0, 203, 204,
2178 0, 68, 0, 0, 69, 0, 0, 70, 0, 71,
2179 205, 206, 207, 208, 209, 210, 150, 151, 152, 153,
2180 154, 155, 156, 157, 158, 159, 160, 161, 211, 212,
2181 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2182 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2183 213, 214, 215, 0, 0, 216, 165, 166, 167, 168,
2184 169, 170, 171, 172, 173, 174, 175, 176, 217, 218,
2185 178, 179, 180, 219, 220, 221, 222
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002186};
2187
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002188static const yytype_int16 yycheck[] =
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002189{
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002190 0, 26, 241, 207, 113, 185, 186, 304, 4, 328,
2191 0, 81, 9, 332, 9, 9, 16, 300, 5, 6,
2192 132, 8, 9, 10, 11, 12, 16, 14, 15, 9,
2193 17, 18, 23, 208, 16, 318, 106, 418, 113, 242,
2194 243, 133, 24, 107, 108, 133, 71, 3, 4, 46,
2195 142, 46, 29, 228, 142, 42, 215, 107, 108, 218,
2196 219, 220, 221, 222, 128, 129, 225, 226, 133, 46,
2197 95, 3, 4, 45, 99, 140, 133, 127, 128, 129,
2198 105, 132, 107, 140, 133, 29, 86, 59, 133, 21,
2199 22, 37, 38, 133, 133, 144, 121, 137, 44, 144,
2200 280, 134, 133, 136, 50, 144, 137, 140, 133, 134,
2201 133, 50, 137, 5, 6, 496, 8, 9, 10, 11,
2202 12, 144, 14, 15, 14, 17, 18, 17, 35, 36,
2203 37, 5, 6, 40, 8, 9, 10, 11, 12, 14,
2204 14, 15, 17, 17, 18, 526, 140, 143, 135, 13,
2205 42, 138, 143, 356, 141, 540, 143, 144, 32, 132,
2206 140, 320, 144, 107, 108, 134, 551, 136, 42, 138,
2207 133, 552, 0, 470, 137, 472, 133, 134, 497, 136,
2208 205, 132, 31, 127, 128, 129, 138, 367, 213, 214,
Reid Spencer41dff5e2007-01-26 08:05:27 +00002209 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002210 225, 226, 272, 273, 274, 275, 276, 132, 198, 234,
2211 133, 134, 134, 136, 136, 285, 286, 287, 288, 294,
2212 142, 296, 297, 462, 299, 544, 385, 546, 387, 388,
2213 389, 306, 107, 108, 393, 134, 345, 136, 137, 314,
2214 315, 15, 9, 135, 18, 12, 138, 17, 39, 141,
2215 41, 143, 144, 128, 129, 280, 27, 28, 107, 108,
2216 131, 135, 103, 104, 138, 335, 336, 141, 16, 143,
2217 345, 134, 342, 136, 17, 300, 301, 302, 127, 128,
2218 129, 53, 54, 55, 56, 57, 58, 77, 78, 528,
2219 449, 17, 531, 318, 319, 320, 17, 136, 4, 4,
2220 375, 376, 377, 139, 139, 7, 7, 7, 383, 4,
2221 17, 133, 137, 142, 137, 136, 475, 476, 477, 394,
2222 395, 525, 136, 35, 36, 37, 38, 39, 40, 41,
2223 136, 43, 357, 403, 404, 405, 406, 541, 136, 136,
2224 410, 411, 17, 413, 80, 81, 82, 83, 84, 85,
2225 86, 87, 88, 89, 429, 136, 431, 0, 136, 434,
2226 385, 386, 387, 388, 389, 440, 441, 392, 393, 133,
2227 13, 14, 15, 136, 17, 18, 19, 447, 448, 136,
2228 48, 9, 25, 26, 142, 136, 136, 412, 133, 136,
2229 465, 466, 133, 468, 469, 133, 133, 31, 473, 133,
2230 133, 44, 133, 133, 47, 133, 481, 142, 51, 133,
2231 133, 133, 31, 296, 297, 485, 299, 487, 488, 131,
2232 133, 446, 133, 306, 449, 17, 501, 4, 52, 133,
2233 133, 314, 315, 142, 509, 133, 461, 133, 17, 138,
2234 133, 133, 467, 133, 133, 12, 137, 12, 136, 133,
2235 475, 476, 477, 133, 4, 480, 133, 133, 136, 133,
2236 460, 133, 133, 538, 133, 17, 5, 6, 543, 8,
2237 9, 10, 11, 12, 137, 14, 15, 133, 17, 18,
2238 133, 138, 557, 558, 46, 137, 137, 562, 137, 133,
2239 565, 133, 375, 376, 377, 133, 21, 22, 137, 140,
2240 383, 137, 527, 42, 133, 137, 137, 137, 46, 12,
2241 4, 394, 395, 140, 12, 133, 12, 133, 64, 12,
2242 520, 12, 124, 5, 6, 124, 8, 9, 10, 11,
2243 12, 124, 14, 15, 124, 17, 18, 520, 211, 86,
2244 234, 105, 212, 497, 99, 16, 429, 83, 431, 53,
2245 480, 434, 382, -1, -1, -1, -1, 440, 441, -1,
2246 42, 86, 87, 88, 89, 90, 91, 92, 93, 94,
2247 95, 96, 97, 98, 99, -1, -1, -1, -1, -1,
2248 -1, -1, 465, 466, -1, 468, 469, -1, -1, -1,
2249 473, -1, -1, -1, 0, -1, 135, -1, 481, 138,
2250 -1, -1, 141, -1, 143, 144, -1, 13, 14, 15,
2251 -1, 17, 18, 19, -1, -1, -1, -1, 501, 25,
2252 26, -1, 5, 6, -1, -1, 509, -1, -1, -1,
2253 -1, 14, 15, -1, 17, 18, -1, 20, 44, -1,
2254 -1, 47, -1, -1, -1, 51, -1, -1, -1, -1,
2255 33, 34, -1, 135, -1, 538, 138, -1, -1, 141,
2256 543, 143, 144, -1, -1, -1, -1, -1, -1, -1,
2257 -1, -1, -1, -1, 557, 558, -1, -1, -1, 562,
2258 -1, -1, 565, 66, 67, 68, 69, 70, 71, 72,
2259 73, 74, 75, 76, 77, 78, 79, -1, -1, -1,
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002260 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencer41dff5e2007-01-26 08:05:27 +00002261 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002262 -1, -1, 105, 106, 107, 108, 109, 110, 111, 112,
2263 113, 114, 115, 116, 117, -1, 119, 120, 121, 122,
2264 -1, 124, 125, 126, -1, -1, -1, -1, -1, -1,
2265 -1, 134, -1, 136, -1, 138, -1, -1, 141, -1,
2266 143, -1, 145, 3, 4, 5, 6, 7, -1, -1,
2267 -1, -1, -1, -1, 14, 15, -1, 17, 18, -1,
2268 20, 21, 22, -1, -1, -1, -1, -1, -1, -1,
2269 -1, -1, -1, 33, 34, -1, -1, -1, -1, -1,
2270 -1, -1, -1, -1, -1, -1, -1, -1, 5, 6,
2271 50, 8, 9, 10, 11, 12, -1, 14, 15, -1,
2272 17, 18, -1, -1, -1, -1, 66, 67, 68, 69,
2273 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2274 -1, -1, -1, -1, -1, 42, 5, 6, -1, 8,
Reid Spencer41dff5e2007-01-26 08:05:27 +00002275 9, 10, 11, 12, -1, 14, 15, -1, 17, 18,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002276 -1, -1, -1, -1, -1, 105, 106, 107, 108, 109,
2277 110, 111, 112, 113, 114, 115, 116, 117, -1, 119,
2278 120, 121, 122, 42, 124, 125, 126, -1, 3, 4,
2279 5, 6, 7, -1, 134, -1, 136, -1, -1, 14,
2280 15, 141, 17, 18, -1, 20, 21, 22, -1, -1,
2281 -1, -1, -1, -1, -1, -1, -1, -1, 33, 34,
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002282 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002283 -1, -1, -1, -1, -1, 50, -1, -1, 135, -1,
2284 -1, 138, -1, 140, 141, -1, 143, -1, -1, -1,
2285 -1, 66, 67, 68, 69, 70, 71, 72, 73, 74,
2286 75, 76, 77, 78, 79, -1, -1, -1, -1, -1,
2287 -1, -1, -1, -1, -1, -1, 135, -1, -1, 138,
2288 -1, -1, 141, -1, 143, -1, -1, -1, -1, -1,
2289 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
2290 115, 116, 117, -1, 119, 120, 121, 122, -1, 124,
2291 125, 126, 3, 4, -1, -1, 7, -1, -1, -1,
2292 -1, -1, -1, -1, -1, -1, 141, -1, -1, 20,
2293 21, 22, -1, -1, -1, -1, -1, -1, -1, -1,
2294 -1, -1, 33, 34, -1, -1, -1, -1, -1, -1,
2295 -1, -1, -1, -1, -1, -1, -1, 5, 6, 50,
2296 8, 9, 10, 11, 12, -1, 14, 15, -1, 17,
2297 18, -1, -1, -1, -1, 66, 67, 68, 69, 70,
2298 71, 72, 73, 74, 75, 76, 77, 78, 79, -1,
2299 -1, -1, -1, -1, 42, -1, -1, -1, -1, -1,
2300 5, 6, -1, 8, 9, 10, 11, 12, -1, 14,
2301 15, -1, 17, 18, 105, 106, 107, 108, 109, 110,
2302 111, 112, 113, 114, 115, 116, 117, 32, 119, 120,
2303 121, 122, -1, 124, 125, 126, -1, 42, -1, 5,
Reid Spencer41dff5e2007-01-26 08:05:27 +00002304 6, -1, 8, 9, 10, 11, 12, -1, 14, 15,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002305 141, 17, 18, -1, -1, 5, 6, -1, 8, 9,
Reid Spencer41dff5e2007-01-26 08:05:27 +00002306 10, 11, 12, -1, 14, 15, 32, 17, 18, -1,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002307 -1, -1, -1, -1, -1, -1, 42, -1, -1, -1,
2308 -1, -1, 32, -1, -1, -1, -1, 135, -1, -1,
2309 138, -1, 42, 141, -1, 143, -1, 5, 6, -1,
2310 8, 9, 10, 11, 12, -1, 14, 15, -1, 17,
2311 18, 5, 6, -1, 8, 9, 10, 11, 12, -1,
2312 14, 15, -1, 17, 18, -1, -1, -1, -1, -1,
2313 135, -1, -1, 138, 42, -1, 141, -1, 143, -1,
2314 -1, -1, -1, -1, -1, -1, 5, 6, 42, 8,
2315 9, 10, 11, 12, -1, 14, 15, -1, 17, 18,
2316 -1, 5, 6, -1, 8, 9, 10, 11, 12, 135,
2317 14, 15, 138, 17, 18, 141, -1, 143, -1, -1,
2318 -1, -1, -1, 42, -1, 135, -1, -1, 138, -1,
2319 -1, 141, -1, 143, -1, -1, -1, -1, 42, -1,
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002320 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2321 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002322 -1, -1, -1, -1, -1, -1, -1, 135, -1, -1,
2323 138, -1, -1, 141, -1, 143, -1, -1, -1, -1,
2324 -1, 135, -1, -1, 138, -1, -1, 141, -1, 143,
2325 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2326 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2327 30, -1, -1, -1, -1, -1, 135, -1, -1, 138,
2328 -1, -1, 141, -1, 143, -1, -1, -1, 48, 49,
2329 -1, 135, -1, -1, 138, -1, -1, 141, -1, 143,
2330 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
2331 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2332 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2333 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2334 100, 101, 102, -1, -1, 105, 106, 107, 108, 109,
2335 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
2336 120, 121, 122, 123, 124, 125, 126
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002337};
2338
2339/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2340 symbol of state STATE-NUM. */
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002341static const yytype_uint8 yystos[] =
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002342{
Reid Spencer41dff5e2007-01-26 08:05:27 +00002343 0, 14, 15, 17, 18, 19, 25, 26, 44, 47,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002344 51, 155, 157, 158, 159, 187, 188, 189, 191, 190,
2345 45, 59, 196, 132, 50, 132, 13, 132, 35, 36,
2346 37, 38, 39, 40, 41, 43, 131, 160, 161, 162,
2347 0, 189, 39, 41, 163, 206, 35, 36, 37, 40,
2348 164, 203, 205, 212, 132, 132, 138, 197, 17, 195,
2349 5, 6, 8, 9, 10, 11, 12, 42, 135, 138,
2350 141, 143, 155, 158, 176, 177, 209, 162, 162, 27,
2351 28, 186, 162, 162, 16, 213, 214, 24, 144, 204,
2352 213, 17, 17, 17, 198, 136, 4, 4, 4, 143,
2353 8, 144, 177, 182, 134, 136, 186, 186, 9, 10,
2354 11, 153, 154, 177, 183, 53, 54, 55, 56, 57,
2355 58, 165, 201, 201, 157, 217, 133, 140, 32, 177,
2356 178, 180, 181, 139, 139, 144, 182, 133, 144, 181,
2357 183, 177, 21, 22, 3, 4, 7, 20, 33, 34,
2358 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
2359 76, 77, 78, 79, 105, 106, 107, 108, 109, 110,
2360 111, 112, 113, 114, 115, 116, 117, 119, 120, 121,
2361 122, 124, 125, 126, 138, 141, 143, 145, 147, 148,
2362 149, 150, 184, 209, 192, 4, 8, 177, 179, 23,
2363 143, 202, 30, 48, 49, 60, 61, 62, 63, 64,
2364 65, 78, 79, 100, 101, 102, 105, 118, 119, 123,
2365 124, 125, 126, 147, 148, 149, 150, 215, 221, 222,
2366 223, 224, 17, 167, 133, 137, 177, 177, 142, 144,
2367 177, 137, 193, 194, 80, 81, 82, 83, 84, 85,
2368 86, 87, 88, 89, 151, 21, 22, 86, 87, 88,
Reid Spencer41dff5e2007-01-26 08:05:27 +00002369 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002370 99, 152, 136, 136, 136, 136, 136, 140, 183, 185,
2371 143, 185, 144, 185, 17, 136, 136, 136, 136, 133,
2372 174, 158, 48, 8, 177, 211, 9, 12, 9, 153,
2373 165, 151, 152, 177, 177, 211, 177, 177, 218, 211,
2374 211, 211, 211, 211, 177, 177, 211, 211, 165, 103,
2375 104, 107, 108, 128, 129, 166, 32, 178, 169, 140,
2376 142, 142, 169, 174, 174, 136, 136, 183, 183, 183,
2377 183, 183, 133, 140, 144, 177, 185, 142, 144, 183,
2378 183, 183, 183, 29, 46, 172, 175, 136, 3, 4,
2379 7, 20, 21, 22, 33, 34, 50, 141, 184, 208,
2380 209, 210, 210, 210, 210, 179, 177, 177, 133, 171,
2381 133, 171, 210, 138, 133, 133, 133, 133, 133, 133,
2382 210, 210, 31, 133, 179, 177, 211, 127, 166, 168,
2383 183, 183, 220, 133, 133, 133, 133, 183, 142, 144,
2384 133, 133, 31, 133, 17, 4, 174, 32, 177, 199,
2385 200, 52, 207, 185, 133, 133, 210, 210, 210, 9,
2386 46, 9, 220, 210, 138, 211, 177, 211, 211, 211,
2387 133, 133, 177, 211, 210, 210, 133, 133, 133, 133,
2388 137, 183, 183, 183, 183, 142, 183, 183, 177, 183,
2389 167, 133, 137, 17, 142, 12, 12, 136, 133, 133,
2390 210, 4, 210, 133, 210, 133, 133, 133, 210, 210,
2391 136, 177, 183, 183, 211, 133, 137, 133, 133, 137,
2392 137, 137, 137, 155, 156, 32, 177, 169, 133, 210,
2393 210, 177, 219, 210, 210, 133, 171, 171, 210, 133,
2394 211, 211, 211, 219, 210, 137, 137, 183, 183, 183,
2395 167, 172, 173, 17, 133, 138, 210, 133, 137, 140,
2396 210, 137, 137, 137, 137, 156, 46, 170, 12, 140,
2397 153, 216, 167, 177, 169, 140, 169, 4, 210, 208,
2398 140, 153, 210, 31, 133, 208, 167, 12, 12, 133,
2399 210, 210, 12, 64, 210, 12, 210
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002400};
Reid Spencer68a24bd2005-08-27 18:50:39 +00002401
2402#define yyerrok (yyerrstatus = 0)
2403#define yyclearin (yychar = YYEMPTY)
Reid Spencer41dff5e2007-01-26 08:05:27 +00002404#define YYEMPTY (-2)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002405#define YYEOF 0
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002406
Reid Spencer68a24bd2005-08-27 18:50:39 +00002407#define YYACCEPT goto yyacceptlab
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002408#define YYABORT goto yyabortlab
Reid Spencer41dff5e2007-01-26 08:05:27 +00002409#define YYERROR goto yyerrorlab
2410
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002411
2412/* Like YYERROR except do call yyerror. This remains here temporarily
2413 to ease the transition to the new meaning of YYERROR, for GCC.
Reid Spencer68a24bd2005-08-27 18:50:39 +00002414 Once GCC version 2 has supplanted version 1, this can go. */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002415
Reid Spencer68a24bd2005-08-27 18:50:39 +00002416#define YYFAIL goto yyerrlab
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002417
Reid Spencer68a24bd2005-08-27 18:50:39 +00002418#define YYRECOVERING() (!!yyerrstatus)
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002419
2420#define YYBACKUP(Token, Value) \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002421do \
2422 if (yychar == YYEMPTY && yylen == 1) \
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002423 { \
2424 yychar = (Token); \
2425 yylval = (Value); \
Reid Spencer41dff5e2007-01-26 08:05:27 +00002426 yytoken = YYTRANSLATE (yychar); \
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002427 YYPOPSTACK (1); \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002428 goto yybackup; \
2429 } \
2430 else \
Reid Spencer41dff5e2007-01-26 08:05:27 +00002431 { \
2432 yyerror (YY_("syntax error: cannot back up")); \
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002433 YYERROR; \
2434 } \
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002435while (YYID (0))
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002436
Reid Spencer41dff5e2007-01-26 08:05:27 +00002437
Reid Spencer68a24bd2005-08-27 18:50:39 +00002438#define YYTERROR 1
2439#define YYERRCODE 256
2440
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002441
Reid Spencer41dff5e2007-01-26 08:05:27 +00002442/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2443 If N is 0, then set CURRENT to the empty location which ends
2444 the previous symbol: RHS[0] (always defined). */
2445
2446#define YYRHSLOC(Rhs, K) ((Rhs)[K])
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002447#ifndef YYLLOC_DEFAULT
Reid Spencer41dff5e2007-01-26 08:05:27 +00002448# define YYLLOC_DEFAULT(Current, Rhs, N) \
2449 do \
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002450 if (YYID (N)) \
Reid Spencer41dff5e2007-01-26 08:05:27 +00002451 { \
2452 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2453 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2454 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2455 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2456 } \
2457 else \
2458 { \
2459 (Current).first_line = (Current).last_line = \
2460 YYRHSLOC (Rhs, 0).last_line; \
2461 (Current).first_column = (Current).last_column = \
2462 YYRHSLOC (Rhs, 0).last_column; \
2463 } \
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002464 while (YYID (0))
Reid Spencer68a24bd2005-08-27 18:50:39 +00002465#endif
2466
Reid Spencer41dff5e2007-01-26 08:05:27 +00002467
2468/* YY_LOCATION_PRINT -- Print the location on the stream.
2469 This macro was not mandated originally: define only if we know
2470 we won't break user code: when these are the locations we know. */
2471
2472#ifndef YY_LOCATION_PRINT
2473# if YYLTYPE_IS_TRIVIAL
2474# define YY_LOCATION_PRINT(File, Loc) \
2475 fprintf (File, "%d.%d-%d.%d", \
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002476 (Loc).first_line, (Loc).first_column, \
2477 (Loc).last_line, (Loc).last_column)
Reid Spencer41dff5e2007-01-26 08:05:27 +00002478# else
2479# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2480# endif
2481#endif
2482
2483
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002484/* YYLEX -- calling `yylex' with the right arguments. */
2485
Reid Spencer41dff5e2007-01-26 08:05:27 +00002486#ifdef YYLEX_PARAM
2487# define YYLEX yylex (YYLEX_PARAM)
2488#else
2489# define YYLEX yylex ()
2490#endif
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002491
2492/* Enable debugging if requested. */
2493#if YYDEBUG
2494
2495# ifndef YYFPRINTF
2496# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2497# define YYFPRINTF fprintf
2498# endif
2499
2500# define YYDPRINTF(Args) \
2501do { \
2502 if (yydebug) \
2503 YYFPRINTF Args; \
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002504} while (YYID (0))
Reid Spencer41dff5e2007-01-26 08:05:27 +00002505
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002506# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2507do { \
2508 if (yydebug) \
2509 { \
2510 YYFPRINTF (stderr, "%s ", Title); \
2511 yy_symbol_print (stderr, \
2512 Type, Value); \
2513 YYFPRINTF (stderr, "\n"); \
2514 } \
2515} while (YYID (0))
2516
2517
2518/*--------------------------------.
2519| Print this symbol on YYOUTPUT. |
2520`--------------------------------*/
2521
2522/*ARGSUSED*/
2523#if (defined __STDC__ || defined __C99__FUNC__ \
2524 || defined __cplusplus || defined _MSC_VER)
2525static void
2526yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2527#else
2528static void
2529yy_symbol_value_print (yyoutput, yytype, yyvaluep)
2530 FILE *yyoutput;
2531 int yytype;
2532 YYSTYPE const * const yyvaluep;
2533#endif
2534{
2535 if (!yyvaluep)
2536 return;
2537# ifdef YYPRINT
2538 if (yytype < YYNTOKENS)
2539 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2540# else
2541 YYUSE (yyoutput);
2542# endif
2543 switch (yytype)
2544 {
2545 default:
2546 break;
2547 }
2548}
2549
2550
2551/*--------------------------------.
2552| Print this symbol on YYOUTPUT. |
2553`--------------------------------*/
2554
2555#if (defined __STDC__ || defined __C99__FUNC__ \
2556 || defined __cplusplus || defined _MSC_VER)
2557static void
2558yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
2559#else
2560static void
2561yy_symbol_print (yyoutput, yytype, yyvaluep)
2562 FILE *yyoutput;
2563 int yytype;
2564 YYSTYPE const * const yyvaluep;
2565#endif
2566{
2567 if (yytype < YYNTOKENS)
2568 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2569 else
2570 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2571
2572 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
2573 YYFPRINTF (yyoutput, ")");
2574}
Reid Spencer41dff5e2007-01-26 08:05:27 +00002575
2576/*------------------------------------------------------------------.
2577| yy_stack_print -- Print the state stack from its BOTTOM up to its |
2578| TOP (included). |
2579`------------------------------------------------------------------*/
2580
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002581#if (defined __STDC__ || defined __C99__FUNC__ \
2582 || defined __cplusplus || defined _MSC_VER)
Reid Spencer41dff5e2007-01-26 08:05:27 +00002583static void
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002584yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
Reid Spencer41dff5e2007-01-26 08:05:27 +00002585#else
2586static void
2587yy_stack_print (bottom, top)
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002588 yytype_int16 *bottom;
2589 yytype_int16 *top;
Reid Spencer41dff5e2007-01-26 08:05:27 +00002590#endif
2591{
2592 YYFPRINTF (stderr, "Stack now");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002593 for (; bottom <= top; ++bottom)
Reid Spencer41dff5e2007-01-26 08:05:27 +00002594 YYFPRINTF (stderr, " %d", *bottom);
2595 YYFPRINTF (stderr, "\n");
2596}
2597
2598# define YY_STACK_PRINT(Bottom, Top) \
2599do { \
2600 if (yydebug) \
2601 yy_stack_print ((Bottom), (Top)); \
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002602} while (YYID (0))
Reid Spencer41dff5e2007-01-26 08:05:27 +00002603
2604
2605/*------------------------------------------------.
2606| Report that the YYRULE is going to be reduced. |
2607`------------------------------------------------*/
2608
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002609#if (defined __STDC__ || defined __C99__FUNC__ \
2610 || defined __cplusplus || defined _MSC_VER)
Reid Spencer41dff5e2007-01-26 08:05:27 +00002611static void
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002612yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
Reid Spencer41dff5e2007-01-26 08:05:27 +00002613#else
2614static void
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002615yy_reduce_print (yyvsp, yyrule)
2616 YYSTYPE *yyvsp;
Reid Spencer41dff5e2007-01-26 08:05:27 +00002617 int yyrule;
2618#endif
2619{
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002620 int yynrhs = yyr2[yyrule];
Reid Spencer41dff5e2007-01-26 08:05:27 +00002621 int yyi;
2622 unsigned long int yylno = yyrline[yyrule];
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002623 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2624 yyrule - 1, yylno);
2625 /* The symbols being reduced. */
2626 for (yyi = 0; yyi < yynrhs; yyi++)
2627 {
2628 fprintf (stderr, " $%d = ", yyi + 1);
2629 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
2630 &(yyvsp[(yyi + 1) - (yynrhs)])
2631 );
2632 fprintf (stderr, "\n");
2633 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00002634}
2635
2636# define YY_REDUCE_PRINT(Rule) \
2637do { \
2638 if (yydebug) \
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002639 yy_reduce_print (yyvsp, Rule); \
2640} while (YYID (0))
Reid Spencer41dff5e2007-01-26 08:05:27 +00002641
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002642/* Nonzero means print parse trace. It is left uninitialized so that
2643 multiple parsers can coexist. */
2644int yydebug;
2645#else /* !YYDEBUG */
2646# define YYDPRINTF(Args)
Reid Spencer41dff5e2007-01-26 08:05:27 +00002647# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2648# define YY_STACK_PRINT(Bottom, Top)
2649# define YY_REDUCE_PRINT(Rule)
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002650#endif /* !YYDEBUG */
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002651
Reid Spencer41dff5e2007-01-26 08:05:27 +00002652
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002653/* YYINITDEPTH -- initial size of the parser's stacks. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002654#ifndef YYINITDEPTH
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002655# define YYINITDEPTH 200
Reid Spencer68a24bd2005-08-27 18:50:39 +00002656#endif
2657
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002658/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2659 if the built-in stack extension method is used).
Reid Spencer68a24bd2005-08-27 18:50:39 +00002660
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002661 Do not make this value too large; the results are undefined if
Reid Spencer41dff5e2007-01-26 08:05:27 +00002662 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002663 evaluated with infinite-precision integer arithmetic. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002664
2665#ifndef YYMAXDEPTH
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002666# define YYMAXDEPTH 10000
Reid Spencer68a24bd2005-08-27 18:50:39 +00002667#endif
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002668
Reid Spencer68a24bd2005-08-27 18:50:39 +00002669
2670
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002671#if YYERROR_VERBOSE
Reid Spencer68a24bd2005-08-27 18:50:39 +00002672
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002673# ifndef yystrlen
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002674# if defined __GLIBC__ && defined _STRING_H
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002675# define yystrlen strlen
2676# else
2677/* Return the length of YYSTR. */
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002678#if (defined __STDC__ || defined __C99__FUNC__ \
2679 || defined __cplusplus || defined _MSC_VER)
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002680static YYSIZE_T
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002681yystrlen (const char *yystr)
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002682#else
2683static YYSIZE_T
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002684yystrlen (yystr)
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002685 const char *yystr;
2686#endif
Chris Lattnerb25c4ca2007-01-15 02:12:07 +00002687{
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002688 YYSIZE_T yylen;
2689 for (yylen = 0; yystr[yylen]; yylen++)
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002690 continue;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002691 return yylen;
Chris Lattnerb25c4ca2007-01-15 02:12:07 +00002692}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002693# endif
2694# endif
Chris Lattnerb25c4ca2007-01-15 02:12:07 +00002695
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002696# ifndef yystpcpy
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002697# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002698# define yystpcpy stpcpy
2699# else
2700/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2701 YYDEST. */
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002702#if (defined __STDC__ || defined __C99__FUNC__ \
2703 || defined __cplusplus || defined _MSC_VER)
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002704static char *
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002705yystpcpy (char *yydest, const char *yysrc)
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002706#else
2707static char *
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002708yystpcpy (yydest, yysrc)
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002709 char *yydest;
2710 const char *yysrc;
2711#endif
Chris Lattnerb25c4ca2007-01-15 02:12:07 +00002712{
Reid Spencer41dff5e2007-01-26 08:05:27 +00002713 char *yyd = yydest;
2714 const char *yys = yysrc;
Chris Lattnerb25c4ca2007-01-15 02:12:07 +00002715
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002716 while ((*yyd++ = *yys++) != '\0')
2717 continue;
2718
2719 return yyd - 1;
Chris Lattnerb25c4ca2007-01-15 02:12:07 +00002720}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002721# endif
2722# endif
Chris Lattnerb25c4ca2007-01-15 02:12:07 +00002723
Reid Spencer41dff5e2007-01-26 08:05:27 +00002724# ifndef yytnamerr
2725/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2726 quotes and backslashes, so that it's suitable for yyerror. The
2727 heuristic is that double-quoting is unnecessary unless the string
2728 contains an apostrophe, a comma, or backslash (other than
2729 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2730 null, do not copy; instead, return the length of what the result
2731 would have been. */
2732static YYSIZE_T
2733yytnamerr (char *yyres, const char *yystr)
2734{
2735 if (*yystr == '"')
2736 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002737 YYSIZE_T yyn = 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +00002738 char const *yyp = yystr;
2739
2740 for (;;)
2741 switch (*++yyp)
2742 {
2743 case '\'':
2744 case ',':
2745 goto do_not_strip_quotes;
2746
2747 case '\\':
2748 if (*++yyp != '\\')
2749 goto do_not_strip_quotes;
2750 /* Fall through. */
2751 default:
2752 if (yyres)
2753 yyres[yyn] = *yyp;
2754 yyn++;
2755 break;
2756
2757 case '"':
2758 if (yyres)
2759 yyres[yyn] = '\0';
2760 return yyn;
2761 }
2762 do_not_strip_quotes: ;
2763 }
2764
2765 if (! yyres)
2766 return yystrlen (yystr);
2767
2768 return yystpcpy (yyres, yystr) - yyres;
2769}
2770# endif
2771
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002772/* Copy into YYRESULT an error message about the unexpected token
2773 YYCHAR while in state YYSTATE. Return the number of bytes copied,
2774 including the terminating null byte. If YYRESULT is null, do not
2775 copy anything; just return the number of bytes that would be
2776 copied. As a special case, return 0 if an ordinary "syntax error"
2777 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
2778 size calculation. */
2779static YYSIZE_T
2780yysyntax_error (char *yyresult, int yystate, int yychar)
2781{
2782 int yyn = yypact[yystate];
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002783
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002784 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
2785 return 0;
2786 else
2787 {
2788 int yytype = YYTRANSLATE (yychar);
2789 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
2790 YYSIZE_T yysize = yysize0;
2791 YYSIZE_T yysize1;
2792 int yysize_overflow = 0;
2793 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
2794 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
2795 int yyx;
2796
2797# if 0
2798 /* This is so xgettext sees the translatable formats that are
2799 constructed on the fly. */
2800 YY_("syntax error, unexpected %s");
2801 YY_("syntax error, unexpected %s, expecting %s");
2802 YY_("syntax error, unexpected %s, expecting %s or %s");
2803 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
2804 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
2805# endif
2806 char *yyfmt;
2807 char const *yyf;
2808 static char const yyunexpected[] = "syntax error, unexpected %s";
2809 static char const yyexpecting[] = ", expecting %s";
2810 static char const yyor[] = " or %s";
2811 char yyformat[sizeof yyunexpected
2812 + sizeof yyexpecting - 1
2813 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
2814 * (sizeof yyor - 1))];
2815 char const *yyprefix = yyexpecting;
2816
2817 /* Start YYX at -YYN if negative to avoid negative indexes in
2818 YYCHECK. */
2819 int yyxbegin = yyn < 0 ? -yyn : 0;
2820
2821 /* Stay within bounds of both yycheck and yytname. */
2822 int yychecklim = YYLAST - yyn + 1;
2823 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
2824 int yycount = 1;
2825
2826 yyarg[0] = yytname[yytype];
2827 yyfmt = yystpcpy (yyformat, yyunexpected);
2828
2829 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
2830 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2831 {
2832 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
2833 {
2834 yycount = 1;
2835 yysize = yysize0;
2836 yyformat[sizeof yyunexpected - 1] = '\0';
2837 break;
2838 }
2839 yyarg[yycount++] = yytname[yyx];
2840 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
2841 yysize_overflow |= (yysize1 < yysize);
2842 yysize = yysize1;
2843 yyfmt = yystpcpy (yyfmt, yyprefix);
2844 yyprefix = yyor;
2845 }
2846
2847 yyf = YY_(yyformat);
2848 yysize1 = yysize + yystrlen (yyf);
2849 yysize_overflow |= (yysize1 < yysize);
2850 yysize = yysize1;
2851
2852 if (yysize_overflow)
2853 return YYSIZE_MAXIMUM;
2854
2855 if (yyresult)
2856 {
2857 /* Avoid sprintf, as that infringes on the user's name space.
2858 Don't have undefined behavior even if the translation
2859 produced a string with the wrong number of "%s"s. */
2860 char *yyp = yyresult;
2861 int yyi = 0;
2862 while ((*yyp = *yyf) != '\0')
2863 {
2864 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
2865 {
2866 yyp += yytnamerr (yyp, yyarg[yyi++]);
2867 yyf += 2;
2868 }
2869 else
2870 {
2871 yyp++;
2872 yyf++;
2873 }
2874 }
2875 }
2876 return yysize;
2877 }
2878}
2879#endif /* YYERROR_VERBOSE */
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002880
2881
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002882/*-----------------------------------------------.
2883| Release the memory associated to this symbol. |
2884`-----------------------------------------------*/
2885
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002886/*ARGSUSED*/
2887#if (defined __STDC__ || defined __C99__FUNC__ \
2888 || defined __cplusplus || defined _MSC_VER)
Reid Spencer41dff5e2007-01-26 08:05:27 +00002889static void
2890yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002891#else
Reid Spencer41dff5e2007-01-26 08:05:27 +00002892static void
2893yydestruct (yymsg, yytype, yyvaluep)
2894 const char *yymsg;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002895 int yytype;
Reid Spencer41dff5e2007-01-26 08:05:27 +00002896 YYSTYPE *yyvaluep;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002897#endif
2898{
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002899 YYUSE (yyvaluep);
Reid Spencer41dff5e2007-01-26 08:05:27 +00002900
2901 if (!yymsg)
2902 yymsg = "Deleting";
2903 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002904
2905 switch (yytype)
2906 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00002907
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002908 default:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002909 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002910 }
2911}
2912
2913
Reid Spencer41dff5e2007-01-26 08:05:27 +00002914/* Prevent warnings from -Wmissing-prototypes. */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002915
2916#ifdef YYPARSE_PARAM
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002917#if defined __STDC__ || defined __cplusplus
Reid Spencer41dff5e2007-01-26 08:05:27 +00002918int yyparse (void *YYPARSE_PARAM);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002919#else
Reid Spencer41dff5e2007-01-26 08:05:27 +00002920int yyparse ();
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002921#endif
Reid Spencer41dff5e2007-01-26 08:05:27 +00002922#else /* ! YYPARSE_PARAM */
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002923#if defined __STDC__ || defined __cplusplus
Reid Spencere812fb22006-01-19 01:21:04 +00002924int yyparse (void);
Reid Spencer41dff5e2007-01-26 08:05:27 +00002925#else
2926int yyparse ();
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002927#endif
Reid Spencer41dff5e2007-01-26 08:05:27 +00002928#endif /* ! YYPARSE_PARAM */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002929
2930
Reid Spencer41dff5e2007-01-26 08:05:27 +00002931
2932/* The look-ahead symbol. */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002933int yychar;
2934
Reid Spencer41dff5e2007-01-26 08:05:27 +00002935/* The semantic value of the look-ahead symbol. */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002936YYSTYPE yylval;
2937
Reid Spencer41dff5e2007-01-26 08:05:27 +00002938/* Number of syntax errors so far. */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002939int yynerrs;
2940
2941
Reid Spencer41dff5e2007-01-26 08:05:27 +00002942
2943/*----------.
2944| yyparse. |
2945`----------*/
2946
2947#ifdef YYPARSE_PARAM
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002948#if (defined __STDC__ || defined __C99__FUNC__ \
2949 || defined __cplusplus || defined _MSC_VER)
2950int
2951yyparse (void *YYPARSE_PARAM)
2952#else
2953int
2954yyparse (YYPARSE_PARAM)
2955 void *YYPARSE_PARAM;
2956#endif
Reid Spencer41dff5e2007-01-26 08:05:27 +00002957#else /* ! YYPARSE_PARAM */
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002958#if (defined __STDC__ || defined __C99__FUNC__ \
2959 || defined __cplusplus || defined _MSC_VER)
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002960int
Reid Spencer41dff5e2007-01-26 08:05:27 +00002961yyparse (void)
2962#else
2963int
2964yyparse ()
2965
2966#endif
2967#endif
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002968{
2969
Reid Spencer41dff5e2007-01-26 08:05:27 +00002970 int yystate;
2971 int yyn;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002972 int yyresult;
2973 /* Number of tokens to shift before error messages enabled. */
2974 int yyerrstatus;
Reid Spencer41dff5e2007-01-26 08:05:27 +00002975 /* Look-ahead token as an internal (translated) token number. */
2976 int yytoken = 0;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002977#if YYERROR_VERBOSE
2978 /* Buffer for error messages, and its allocated size. */
2979 char yymsgbuf[128];
2980 char *yymsg = yymsgbuf;
2981 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
2982#endif
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002983
2984 /* Three stacks and their tools:
2985 `yyss': related to states,
2986 `yyvs': related to semantic values,
2987 `yyls': related to locations.
2988
2989 Refer to the stacks thru separate pointers, to allow yyoverflow
2990 to reallocate them elsewhere. */
2991
2992 /* The state stack. */
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002993 yytype_int16 yyssa[YYINITDEPTH];
2994 yytype_int16 *yyss = yyssa;
2995 yytype_int16 *yyssp;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002996
2997 /* The semantic value stack. */
2998 YYSTYPE yyvsa[YYINITDEPTH];
2999 YYSTYPE *yyvs = yyvsa;
Reid Spencer41dff5e2007-01-26 08:05:27 +00003000 YYSTYPE *yyvsp;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003001
3002
3003
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003004#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003005
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003006 YYSIZE_T yystacksize = YYINITDEPTH;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003007
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003008 /* The variables used to return semantic value and location from the
3009 action routines. */
3010 YYSTYPE yyval;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003011
3012
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003013 /* The number of symbols on the RHS of the reduced rule.
3014 Keep to zero when no symbol should be popped. */
3015 int yylen = 0;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003016
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003017 YYDPRINTF ((stderr, "Starting parse\n"));
Anton Korobeynikov178a3522007-01-12 19:22:51 +00003018
Reid Spencer68a24bd2005-08-27 18:50:39 +00003019 yystate = 0;
3020 yyerrstatus = 0;
3021 yynerrs = 0;
3022 yychar = YYEMPTY; /* Cause a token to be read. */
3023
3024 /* Initialize stack pointers.
3025 Waste one element of value and location stack
3026 so that they stay on the same level as the state stack.
3027 The wasted elements are never initialized. */
3028
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003029 yyssp = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003030 yyvsp = yyvs;
3031
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003032 goto yysetstate;
Jeff Cohen66c5fd62005-10-23 04:37:20 +00003033
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003034/*------------------------------------------------------------.
3035| yynewstate -- Push a new state, which is found in yystate. |
3036`------------------------------------------------------------*/
3037 yynewstate:
3038 /* In all cases, when you get here, the value and location stacks
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003039 have just been pushed. So pushing a state here evens the stacks. */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003040 yyssp++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003041
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003042 yysetstate:
3043 *yyssp = yystate;
3044
Reid Spencer41dff5e2007-01-26 08:05:27 +00003045 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003046 {
3047 /* Get the current used size of the three stacks, in elements. */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003048 YYSIZE_T yysize = yyssp - yyss + 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003049
3050#ifdef yyoverflow
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003051 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003052 /* Give user a chance to reallocate the stack. Use copies of
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003053 these so that the &'s don't force the real ones into
3054 memory. */
3055 YYSTYPE *yyvs1 = yyvs;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003056 yytype_int16 *yyss1 = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003057
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003058
3059 /* Each stack pointer address is followed by the size of the
3060 data in use in that stack, in bytes. This used to be a
3061 conditional around just the two extra args, but that might
3062 be undefined if yyoverflow is a macro. */
Reid Spencer41dff5e2007-01-26 08:05:27 +00003063 yyoverflow (YY_("memory exhausted"),
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003064 &yyss1, yysize * sizeof (*yyssp),
3065 &yyvs1, yysize * sizeof (*yyvsp),
3066
3067 &yystacksize);
3068
3069 yyss = yyss1;
3070 yyvs = yyvs1;
3071 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00003072#else /* no yyoverflow */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003073# ifndef YYSTACK_RELOCATE
Reid Spencer41dff5e2007-01-26 08:05:27 +00003074 goto yyexhaustedlab;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003075# else
Reid Spencer68a24bd2005-08-27 18:50:39 +00003076 /* Extend the stack our own way. */
Reid Spencer41dff5e2007-01-26 08:05:27 +00003077 if (YYMAXDEPTH <= yystacksize)
3078 goto yyexhaustedlab;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003079 yystacksize *= 2;
Reid Spencer41dff5e2007-01-26 08:05:27 +00003080 if (YYMAXDEPTH < yystacksize)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003081 yystacksize = YYMAXDEPTH;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003082
3083 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003084 yytype_int16 *yyss1 = yyss;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003085 union yyalloc *yyptr =
3086 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3087 if (! yyptr)
Reid Spencer41dff5e2007-01-26 08:05:27 +00003088 goto yyexhaustedlab;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003089 YYSTACK_RELOCATE (yyss);
3090 YYSTACK_RELOCATE (yyvs);
3091
3092# undef YYSTACK_RELOCATE
3093 if (yyss1 != yyssa)
3094 YYSTACK_FREE (yyss1);
3095 }
3096# endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00003097#endif /* no yyoverflow */
3098
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003099 yyssp = yyss + yysize - 1;
3100 yyvsp = yyvs + yysize - 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003101
3102
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003103 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3104 (unsigned long int) yystacksize));
3105
Reid Spencer41dff5e2007-01-26 08:05:27 +00003106 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003107 YYABORT;
3108 }
3109
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003110 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003111
3112 goto yybackup;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003113
3114/*-----------.
3115| yybackup. |
3116`-----------*/
3117yybackup:
Reid Spencer68a24bd2005-08-27 18:50:39 +00003118
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003119 /* Do appropriate processing given the current state. Read a
3120 look-ahead token if we need one and don't already have one. */
Andrew Lenharth6353e052006-12-08 18:07:09 +00003121
Reid Spencer41dff5e2007-01-26 08:05:27 +00003122 /* First try to decide what to do without reference to look-ahead token. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003123 yyn = yypact[yystate];
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003124 if (yyn == YYPACT_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003125 goto yydefault;
3126
Reid Spencer41dff5e2007-01-26 08:05:27 +00003127 /* Not known => get a look-ahead token if don't already have one. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003128
Reid Spencer41dff5e2007-01-26 08:05:27 +00003129 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003130 if (yychar == YYEMPTY)
3131 {
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003132 YYDPRINTF ((stderr, "Reading a token: "));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003133 yychar = YYLEX;
3134 }
3135
Reid Spencer41dff5e2007-01-26 08:05:27 +00003136 if (yychar <= YYEOF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003137 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00003138 yychar = yytoken = YYEOF;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003139 YYDPRINTF ((stderr, "Now at end of input.\n"));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003140 }
3141 else
3142 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00003143 yytoken = YYTRANSLATE (yychar);
3144 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Reid Spencer68a24bd2005-08-27 18:50:39 +00003145 }
3146
Reid Spencer41dff5e2007-01-26 08:05:27 +00003147 /* If the proper action on seeing token YYTOKEN is to reduce or to
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003148 detect an error, take that action. */
Reid Spencer41dff5e2007-01-26 08:05:27 +00003149 yyn += yytoken;
3150 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003151 goto yydefault;
3152 yyn = yytable[yyn];
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003153 if (yyn <= 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003154 {
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003155 if (yyn == 0 || yyn == YYTABLE_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003156 goto yyerrlab;
3157 yyn = -yyn;
3158 goto yyreduce;
3159 }
3160
3161 if (yyn == YYFINAL)
3162 YYACCEPT;
3163
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003164 /* Count tokens shifted since error; after three, turn off error
3165 status. */
3166 if (yyerrstatus)
3167 yyerrstatus--;
Chris Lattner0fab59c2007-01-12 18:33:30 +00003168
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003169 /* Shift the look-ahead token. */
3170 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3171
3172 /* Discard the shifted token unless it is eof. */
3173 if (yychar != YYEOF)
3174 yychar = YYEMPTY;
3175
Reid Spencer68a24bd2005-08-27 18:50:39 +00003176 yystate = yyn;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003177 *++yyvsp = yylval;
3178
Reid Spencer68a24bd2005-08-27 18:50:39 +00003179 goto yynewstate;
3180
Chris Lattnerb25c4ca2007-01-15 02:12:07 +00003181
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003182/*-----------------------------------------------------------.
3183| yydefault -- do the default action for the current state. |
3184`-----------------------------------------------------------*/
3185yydefault:
Reid Spencer68a24bd2005-08-27 18:50:39 +00003186 yyn = yydefact[yystate];
3187 if (yyn == 0)
3188 goto yyerrlab;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003189 goto yyreduce;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003190
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003191
3192/*-----------------------------.
3193| yyreduce -- Do a reduction. |
3194`-----------------------------*/
Reid Spencer68a24bd2005-08-27 18:50:39 +00003195yyreduce:
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003196 /* yyn is the number of a rule to reduce with. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00003197 yylen = yyr2[yyn];
3198
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003199 /* If YYLEN is nonzero, implement the default value of the action:
3200 `$$ = $1'.
3201
3202 Otherwise, the following line sets YYVAL to garbage.
3203 This behavior is undocumented and Bison
3204 users should not rely upon it. Assigning to YYVAL
3205 unconditionally makes the parser a bit smaller, and it avoids a
3206 GCC warning that YYVAL may be used uninitialized. */
3207 yyval = yyvsp[1-yylen];
3208
3209
Reid Spencer41dff5e2007-01-26 08:05:27 +00003210 YY_REDUCE_PRINT (yyn);
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003211 switch (yyn)
Reid Spencer68a24bd2005-08-27 18:50:39 +00003212 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00003213 case 29:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003214#line 1037 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003215 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
3216 break;
3217
3218 case 30:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003219#line 1037 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003220 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003221 break;
3222
3223 case 31:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003224#line 1038 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003225 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003226 break;
3227
3228 case 32:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003229#line 1038 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003230 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003231 break;
3232
3233 case 33:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003234#line 1039 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003235 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003236 break;
3237
3238 case 34:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003239#line 1039 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003240 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003241 break;
3242
3243 case 35:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003244#line 1040 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003245 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003246 break;
3247
3248 case 36:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003249#line 1040 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003250 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003251 break;
3252
3253 case 37:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003254#line 1041 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003255 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003256 break;
3257
3258 case 38:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003259#line 1041 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003260 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003261 break;
3262
3263 case 39:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003264#line 1045 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003265 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003266 break;
3267
3268 case 40:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003269#line 1045 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003270 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003271 break;
3272
3273 case 41:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003274#line 1046 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003275 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003276 break;
3277
3278 case 42:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003279#line 1046 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003280 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003281 break;
3282
3283 case 43:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003284#line 1047 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003285 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003286 break;
3287
3288 case 44:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003289#line 1047 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003290 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003291 break;
3292
3293 case 45:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003294#line 1048 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003295 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003296 break;
3297
3298 case 46:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003299#line 1048 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003300 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003301 break;
3302
3303 case 47:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003304#line 1049 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003305 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003306 break;
3307
3308 case 48:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003309#line 1049 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003310 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003311 break;
3312
3313 case 49:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003314#line 1050 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003315 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003316 break;
3317
3318 case 50:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003319#line 1050 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003320 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003321 break;
3322
3323 case 51:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003324#line 1051 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003325 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003326 break;
3327
3328 case 52:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003329#line 1051 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003330 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003331 break;
3332
3333 case 53:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003334#line 1052 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003335 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003336 break;
3337
3338 case 54:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003339#line 1053 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003340 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003341 break;
3342
3343 case 61:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003344#line 1062 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003345 { (yyval.StrVal) = 0; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003346 break;
3347
3348 case 62:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003349#line 1066 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003350 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003351 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003352 CHECK_FOR_ERROR
3353 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003354 break;
3355
3356 case 63:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003357#line 1070 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003358 {
3359 (yyval.StrVal) = 0;
3360 CHECK_FOR_ERROR
3361 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003362 break;
3363
3364 case 66:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003365#line 1077 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003366 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003367 (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003368 CHECK_FOR_ERROR
3369 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003370 break;
3371
3372 case 67:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003373#line 1081 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003374 {
3375 (yyval.StrVal) = 0;
3376 CHECK_FOR_ERROR
3377 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003378 break;
3379
3380 case 68:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003381#line 1087 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003382 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003383 break;
3384
3385 case 69:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003386#line 1088 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003387 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003388 break;
3389
3390 case 70:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003391#line 1089 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003392 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003393 break;
3394
3395 case 71:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003396#line 1090 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003397 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003398 break;
3399
3400 case 72:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003401#line 1091 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003402 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003403 break;
3404
3405 case 73:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003406#line 1095 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003407 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003408 break;
3409
3410 case 74:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003411#line 1096 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003412 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003413 break;
3414
3415 case 75:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003416#line 1097 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003417 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003418 break;
3419
3420 case 76:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003421#line 1101 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003422 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003423 break;
3424
3425 case 77:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003426#line 1102 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003427 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003428 break;
3429
3430 case 78:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003431#line 1106 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003432 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003433 break;
3434
3435 case 79:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003436#line 1107 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003437 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003438 break;
3439
3440 case 80:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003441#line 1108 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003442 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003443 break;
3444
3445 case 81:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003446#line 1112 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003447 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003448 break;
3449
3450 case 82:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003451#line 1113 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003452 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003453 break;
3454
3455 case 83:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003456#line 1114 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003457 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003458 break;
3459
3460 case 84:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003461#line 1115 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003462 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003463 break;
3464
3465 case 85:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003466#line 1116 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003467 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003468 break;
3469
3470 case 86:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003471#line 1119 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003472 { (yyval.UIntVal) = CallingConv::C; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003473 break;
3474
3475 case 87:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003476#line 1120 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003477 { (yyval.UIntVal) = CallingConv::C; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003478 break;
3479
3480 case 88:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003481#line 1121 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003482 { (yyval.UIntVal) = CallingConv::Fast; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003483 break;
3484
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003485 case 89:
3486#line 1122 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003487 { (yyval.UIntVal) = CallingConv::Cold; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003488 break;
3489
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003490 case 90:
3491#line 1123 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003492 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003493 break;
3494
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003495 case 91:
3496#line 1124 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003497 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3498 break;
3499
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003500 case 92:
3501#line 1125 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003502 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003503 if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
Reid Spencer41dff5e2007-01-26 08:05:27 +00003504 GEN_ERROR("Calling conv too large!");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003505 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003506 CHECK_FOR_ERROR
3507 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003508 break;
3509
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003510 case 93:
3511#line 1132 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3512 { (yyval.ParamAttrs) = FunctionType::ZExtAttribute; ;}
3513 break;
3514
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003515 case 94:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003516#line 1133 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3517 { (yyval.ParamAttrs) = FunctionType::SExtAttribute; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003518 break;
3519
3520 case 95:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003521#line 1134 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3522 { (yyval.ParamAttrs) = FunctionType::InRegAttribute; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003523 break;
3524
3525 case 96:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003526#line 1135 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3527 { (yyval.ParamAttrs) = FunctionType::StructRetAttribute; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003528 break;
3529
3530 case 97:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003531#line 1138 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003532 { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003533 break;
3534
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003535 case 98:
3536#line 1139 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003537 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003538 (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs));
Reid Spencer41dff5e2007-01-26 08:05:27 +00003539 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003540 break;
3541
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003542 case 99:
3543#line 1144 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3544 { (yyval.ParamAttrs) = FunctionType::NoReturnAttribute; ;}
3545 break;
3546
3547 case 101:
3548#line 1148 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3549 { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;}
3550 break;
3551
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003552 case 102:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003553#line 1149 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3554 {
3555 (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs));
3556 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003557 break;
3558
3559 case 103:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003560#line 1156 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003561 { (yyval.UIntVal) = 0; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003562 break;
3563
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003564 case 104:
3565#line 1157 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003566 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003567 (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003568 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3569 GEN_ERROR("Alignment must be a power of two!");
3570 CHECK_FOR_ERROR
3571;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003572 break;
3573
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003574 case 105:
3575#line 1163 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3576 { (yyval.UIntVal) = 0; ;}
3577 break;
3578
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003579 case 106:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003580#line 1164 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003581 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003582 (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
3583 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3584 GEN_ERROR("Alignment must be a power of two!");
Reid Spencer41dff5e2007-01-26 08:05:27 +00003585 CHECK_FOR_ERROR
3586;}
3587 break;
3588
3589 case 107:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003590#line 1172 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3591 {
3592 for (unsigned i = 0, e = strlen((yyvsp[(2) - (2)].StrVal)); i != e; ++i)
3593 if ((yyvsp[(2) - (2)].StrVal)[i] == '"' || (yyvsp[(2) - (2)].StrVal)[i] == '\\')
3594 GEN_ERROR("Invalid character in section name!");
3595 (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
3596 CHECK_FOR_ERROR
3597;}
Reid Spencer41dff5e2007-01-26 08:05:27 +00003598 break;
3599
3600 case 108:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003601#line 1180 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3602 { (yyval.StrVal) = 0; ;}
Reid Spencer41dff5e2007-01-26 08:05:27 +00003603 break;
3604
3605 case 109:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003606#line 1181 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3607 { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
Reid Spencer41dff5e2007-01-26 08:05:27 +00003608 break;
3609
3610 case 110:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003611#line 1186 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003612 {;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003613 break;
3614
3615 case 111:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003616#line 1187 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3617 {;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003618 break;
3619
3620 case 112:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003621#line 1188 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003622 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003623 CurGV->setSection((yyvsp[(1) - (1)].StrVal));
3624 free((yyvsp[(1) - (1)].StrVal));
Reid Spencer6f407902007-01-13 05:00:46 +00003625 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00003626 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003627 break;
3628
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003629 case 113:
3630#line 1193 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3631 {
3632 if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
3633 GEN_ERROR("Alignment must be a power of two!");
3634 CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
3635 CHECK_FOR_ERROR
3636 ;}
3637 break;
3638
3639 case 118:
3640#line 1209 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003641 {
3642 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3643 CHECK_FOR_ERROR
3644 ;}
3645 break;
3646
Reid Spencer41dff5e2007-01-26 08:05:27 +00003647 case 119:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003648#line 1213 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3649 {
3650 (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
Reid Spencer41dff5e2007-01-26 08:05:27 +00003651 CHECK_FOR_ERROR
3652 ;}
3653 break;
3654
3655 case 120:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003656#line 1217 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3657 { // Pointer type?
3658 if (*(yyvsp[(1) - (2)].TypeVal) == Type::LabelTy)
3659 GEN_ERROR("Cannot form a pointer to a basic block");
3660 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (2)].TypeVal))));
3661 delete (yyvsp[(1) - (2)].TypeVal);
3662 CHECK_FOR_ERROR
3663 ;}
3664 break;
3665
3666 case 121:
3667#line 1224 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003668 { // Named types are also simple types...
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003669 const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00003670 CHECK_FOR_ERROR
3671 (yyval.TypeVal) = new PATypeHolder(tmp);
3672 ;}
3673 break;
3674
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003675 case 122:
3676#line 1229 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003677 { // Type UpReference
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003678 if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!");
Reid Spencer41dff5e2007-01-26 08:05:27 +00003679 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003680 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector...
Reid Spencer41dff5e2007-01-26 08:05:27 +00003681 (yyval.TypeVal) = new PATypeHolder(OT);
3682 UR_OUT("New Upreference!\n");
3683 CHECK_FOR_ERROR
3684 ;}
3685 break;
3686
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003687 case 123:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003688#line 1237 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003689 {
3690 std::vector<const Type*> Params;
3691 std::vector<FunctionType::ParameterAttributes> Attrs;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003692 Attrs.push_back((yyvsp[(5) - (5)].ParamAttrs));
3693 for (TypeWithAttrsList::iterator I=(yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E=(yyvsp[(3) - (5)].TypeWithAttrsList)->end(); I != E; ++I) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00003694 Params.push_back(I->Ty->get());
3695 if (I->Ty->get() != Type::VoidTy)
3696 Attrs.push_back(I->Attrs);
3697 }
3698 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3699 if (isVarArg) Params.pop_back();
3700
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003701 FunctionType *FT = FunctionType::get(*(yyvsp[(1) - (5)].TypeVal), Params, isVarArg, Attrs);
3702 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
3703 delete (yyvsp[(1) - (5)].TypeVal); // Delete the return type handle
Reid Spencer41dff5e2007-01-26 08:05:27 +00003704 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Reid Spencere4d87aa2006-12-23 06:05:41 +00003705 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00003706 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003707 break;
3708
3709 case 124:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003710#line 1255 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3711 {
3712 std::vector<const Type*> Params;
3713 std::vector<FunctionType::ParameterAttributes> Attrs;
3714 Attrs.push_back((yyvsp[(5) - (5)].ParamAttrs));
3715 for (TypeWithAttrsList::iterator I=(yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E=(yyvsp[(3) - (5)].TypeWithAttrsList)->end(); I != E; ++I) {
3716 Params.push_back(I->Ty->get());
3717 if (I->Ty->get() != Type::VoidTy)
3718 Attrs.push_back(I->Attrs);
3719 }
3720 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3721 if (isVarArg) Params.pop_back();
3722
3723 FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg, Attrs);
3724 delete (yyvsp[(3) - (5)].TypeWithAttrsList); // Delete the argument list
3725 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Reid Spencer41dff5e2007-01-26 08:05:27 +00003726 CHECK_FOR_ERROR
3727 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003728 break;
3729
3730 case 125:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003731#line 1273 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3732 { // Sized array type?
3733 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
3734 delete (yyvsp[(4) - (5)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003735 CHECK_FOR_ERROR
3736 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003737 break;
3738
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003739 case 126:
3740#line 1278 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3741 { // Packed array type?
3742 const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
3743 if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
3744 GEN_ERROR("Unsigned result not equal to signed result");
3745 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
3746 GEN_ERROR("Element type of a PackedType must be primitive");
3747 if (!isPowerOf2_32((yyvsp[(2) - (5)].UInt64Val)))
3748 GEN_ERROR("Vector length should be a power of 2!");
3749 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
3750 delete (yyvsp[(4) - (5)].TypeVal);
3751 CHECK_FOR_ERROR
3752 ;}
3753 break;
3754
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003755 case 127:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003756#line 1290 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3757 { // Structure type?
3758 std::vector<const Type*> Elements;
3759 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
3760 E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
3761 Elements.push_back(*I);
3762
3763 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3764 delete (yyvsp[(2) - (3)].TypeList);
3765 CHECK_FOR_ERROR
3766 ;}
3767 break;
3768
3769 case 128:
3770#line 1300 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003771 { // Empty structure type?
3772 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Reid Spencer14310612006-12-31 05:40:51 +00003773 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00003774 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003775 break;
3776
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003777 case 129:
3778#line 1304 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003779 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00003780 std::vector<const Type*> Elements;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003781 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
3782 E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
Reid Spencer41dff5e2007-01-26 08:05:27 +00003783 Elements.push_back(*I);
3784
3785 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003786 delete (yyvsp[(3) - (5)].TypeList);
Reid Spencer14310612006-12-31 05:40:51 +00003787 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00003788 ;}
3789 break;
3790
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003791 case 130:
3792#line 1314 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003793 { // Empty structure type?
3794 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3795 CHECK_FOR_ERROR
3796 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003797 break;
3798
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003799 case 131:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003800#line 1321 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3801 {
3802 (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal);
3803 (yyval.TypeWithAttrs).Attrs = (yyvsp[(2) - (2)].ParamAttrs);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003804 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003805 break;
3806
3807 case 132:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003808#line 1328 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3809 {
3810 if (!UpRefs.empty())
3811 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
3812 if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType())
3813 GEN_ERROR("LLVM functions cannot return aggregate types!");
3814 (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
3815 ;}
3816 break;
3817
3818 case 133:
3819#line 1335 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003820 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00003821 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
3822 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003823 break;
3824
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003825 case 134:
3826#line 1340 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003827 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00003828 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003829 (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
Reid Spencer6f407902007-01-13 05:00:46 +00003830 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00003831 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003832 break;
3833
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003834 case 135:
3835#line 1345 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003836 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003837 ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
Reid Spencer3da59db2006-11-27 01:05:10 +00003838 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00003839 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003840 break;
3841
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003842 case 137:
3843#line 1353 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003844 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003845 (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003846 TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet;
3847 TWA.Ty = new PATypeHolder(Type::VoidTy);
3848 (yyval.TypeWithAttrsList)->push_back(TWA);
3849 CHECK_FOR_ERROR
3850 ;}
3851 break;
3852
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003853 case 138:
3854#line 1360 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003855 {
3856 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
3857 TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet;
3858 TWA.Ty = new PATypeHolder(Type::VoidTy);
3859 (yyval.TypeWithAttrsList)->push_back(TWA);
3860 CHECK_FOR_ERROR
3861 ;}
3862 break;
3863
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003864 case 139:
3865#line 1367 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003866 {
3867 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3868 CHECK_FOR_ERROR
3869 ;}
3870 break;
3871
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003872 case 140:
3873#line 1375 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003874 {
3875 (yyval.TypeList) = new std::list<PATypeHolder>();
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003876 (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal)); delete (yyvsp[(1) - (1)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003877 CHECK_FOR_ERROR
3878 ;}
3879 break;
3880
3881 case 141:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003882#line 1380 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3883 {
3884 ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal)); delete (yyvsp[(3) - (3)].TypeVal);
Reid Spencer3da59db2006-11-27 01:05:10 +00003885 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00003886 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003887 break;
3888
Reid Spencer41dff5e2007-01-26 08:05:27 +00003889 case 142:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003890#line 1391 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3891 { // Nonempty unsized arr
Reid Spencer14310612006-12-31 05:40:51 +00003892 if (!UpRefs.empty())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003893 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
3894 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (4)].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00003895 if (ATy == 0)
Reid Spencer61c83e02006-08-18 08:43:06 +00003896 GEN_ERROR("Cannot make array constant with type: '" +
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003897 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'!");
3898 const Type *ETy = ATy->getElementType();
3899 int NumElements = ATy->getNumElements();
3900
3901 // Verify that we have the correct size...
3902 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
3903 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3904 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
3905 itostr(NumElements) + "!");
3906
3907 // Verify all elements are correct type!
3908 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
3909 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
3910 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3911 ETy->getDescription() +"' as required!\nIt is of type '"+
3912 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
3913 }
3914
3915 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
3916 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
3917 CHECK_FOR_ERROR
3918 ;}
3919 break;
3920
3921 case 143:
3922#line 1419 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3923 {
3924 if (!UpRefs.empty())
3925 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
3926 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
3927 if (ATy == 0)
3928 GEN_ERROR("Cannot make array constant with type: '" +
3929 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00003930
Andrew Lenharth6353e052006-12-08 18:07:09 +00003931 int NumElements = ATy->getNumElements();
3932 if (NumElements != -1 && NumElements != 0)
3933 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3934 " arguments, but has size of " + itostr(NumElements) +"!");
Reid Spencer41dff5e2007-01-26 08:05:27 +00003935 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003936 delete (yyvsp[(1) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00003937 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00003938 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003939 break;
3940
Reid Spencer41dff5e2007-01-26 08:05:27 +00003941 case 144:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003942#line 1435 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3943 {
Reid Spencer14310612006-12-31 05:40:51 +00003944 if (!UpRefs.empty())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003945 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
3946 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[(1) - (3)].TypeVal)->get());
3947 if (ATy == 0)
3948 GEN_ERROR("Cannot make array constant with type: '" +
3949 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'!");
Reid Spencer61c83e02006-08-18 08:43:06 +00003950
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003951 int NumElements = ATy->getNumElements();
3952 const Type *ETy = ATy->getElementType();
3953 char *EndStr = UnEscapeLexed((yyvsp[(3) - (3)].StrVal), true);
3954 if (NumElements != -1 && NumElements != (EndStr-(yyvsp[(3) - (3)].StrVal)))
3955 GEN_ERROR("Can't build string constant of size " +
3956 itostr((int)(EndStr-(yyvsp[(3) - (3)].StrVal))) +
3957 " when array has size " + itostr(NumElements) + "!");
3958 std::vector<Constant*> Vals;
3959 if (ETy == Type::Int8Ty) {
3960 for (unsigned char *C = (unsigned char *)(yyvsp[(3) - (3)].StrVal);
3961 C != (unsigned char*)EndStr; ++C)
3962 Vals.push_back(ConstantInt::get(ETy, *C));
3963 } else {
3964 free((yyvsp[(3) - (3)].StrVal));
3965 GEN_ERROR("Cannot build string arrays of non byte sized elements!");
Andrew Lenharth6353e052006-12-08 18:07:09 +00003966 }
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003967 free((yyvsp[(3) - (3)].StrVal));
3968 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
3969 delete (yyvsp[(1) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00003970 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00003971 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003972 break;
3973
3974 case 145:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003975#line 1464 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
3976 { // Nonempty unsized arr
3977 if (!UpRefs.empty())
3978 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
3979 const PackedType *PTy = dyn_cast<PackedType>((yyvsp[(1) - (4)].TypeVal)->get());
3980 if (PTy == 0)
3981 GEN_ERROR("Cannot make packed constant with type: '" +
3982 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'!");
3983 const Type *ETy = PTy->getElementType();
3984 int NumElements = PTy->getNumElements();
Reid Spencer41dff5e2007-01-26 08:05:27 +00003985
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003986 // Verify that we have the correct size...
3987 if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
3988 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3989 utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " +
3990 itostr(NumElements) + "!");
Reid Spencer41dff5e2007-01-26 08:05:27 +00003991
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003992 // Verify all elements are correct type!
3993 for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
3994 if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
3995 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3996 ETy->getDescription() +"' as required!\nIt is of type '"+
3997 (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
3998 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00003999
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004000 (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
4001 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004002 CHECK_FOR_ERROR
4003 ;}
4004 break;
4005
4006 case 146:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004007#line 1492 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004008 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004009 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (4)].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004010 if (STy == 0)
4011 GEN_ERROR("Cannot make struct constant with type: '" +
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004012 (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'!");
4013
4014 if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
4015 GEN_ERROR("Illegal number of initializers for structure type!");
4016
4017 // Check to ensure that constants are compatible with the type initializer!
4018 for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
4019 if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
4020 GEN_ERROR("Expected type '" +
4021 STy->getElementType(i)->getDescription() +
4022 "' for element #" + utostr(i) +
4023 " of structure initializer!");
4024
4025 // Check to ensure that Type is not packed
4026 if (STy->isPacked())
4027 GEN_ERROR("Unpacked Initializer to packed type '" + STy->getDescription() + "'");
4028
4029 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
4030 delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
4031 CHECK_FOR_ERROR
4032 ;}
4033 break;
4034
4035 case 147:
4036#line 1517 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4037 {
4038 if (!UpRefs.empty())
4039 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4040 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (3)].TypeVal)->get());
4041 if (STy == 0)
4042 GEN_ERROR("Cannot make struct constant with type: '" +
4043 (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'!");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004044
4045 if (STy->getNumContainedTypes() != 0)
4046 GEN_ERROR("Illegal number of initializers for structure type!");
4047
4048 // Check to ensure that Type is not packed
4049 if (STy->isPacked())
4050 GEN_ERROR("Unpacked Initializer to packed type '" + STy->getDescription() + "'");
4051
4052 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004053 delete (yyvsp[(1) - (3)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004054 CHECK_FOR_ERROR
4055 ;}
4056 break;
4057
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004058 case 148:
4059#line 1536 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004060 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004061 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (6)].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004062 if (STy == 0)
4063 GEN_ERROR("Cannot make struct constant with type: '" +
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004064 (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'!");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004065
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004066 if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
Reid Spencer41dff5e2007-01-26 08:05:27 +00004067 GEN_ERROR("Illegal number of initializers for structure type!");
4068
4069 // Check to ensure that constants are compatible with the type initializer!
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004070 for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
4071 if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
Reid Spencer41dff5e2007-01-26 08:05:27 +00004072 GEN_ERROR("Expected type '" +
4073 STy->getElementType(i)->getDescription() +
4074 "' for element #" + utostr(i) +
4075 " of structure initializer!");
4076
4077 // Check to ensure that Type is packed
4078 if (!STy->isPacked())
4079 GEN_ERROR("Packed Initializer to unpacked type '" + STy->getDescription() + "'");
4080
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004081 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
4082 delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004083 CHECK_FOR_ERROR
4084 ;}
4085 break;
4086
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004087 case 149:
4088#line 1561 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004089 {
4090 if (!UpRefs.empty())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004091 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
4092 const StructType *STy = dyn_cast<StructType>((yyvsp[(1) - (5)].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004093 if (STy == 0)
4094 GEN_ERROR("Cannot make struct constant with type: '" +
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004095 (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'!");
Reid Spencer41dff5e2007-01-26 08:05:27 +00004096
4097 if (STy->getNumContainedTypes() != 0)
4098 GEN_ERROR("Illegal number of initializers for structure type!");
4099
4100 // Check to ensure that Type is packed
4101 if (!STy->isPacked())
4102 GEN_ERROR("Packed Initializer to unpacked type '" + STy->getDescription() + "'");
4103
4104 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004105 delete (yyvsp[(1) - (5)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004106 CHECK_FOR_ERROR
4107 ;}
4108 break;
4109
4110 case 150:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004111#line 1580 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004112 {
4113 if (!UpRefs.empty())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004114 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4115 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
4116 if (PTy == 0)
4117 GEN_ERROR("Cannot make null pointer constant with type: '" +
4118 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'!");
4119
4120 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
4121 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004122 CHECK_FOR_ERROR
4123 ;}
4124 break;
4125
4126 case 151:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004127#line 1592 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004128 {
4129 if (!UpRefs.empty())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004130 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4131 (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
4132 delete (yyvsp[(1) - (2)].TypeVal);
4133 CHECK_FOR_ERROR
4134 ;}
4135 break;
4136
4137 case 152:
4138#line 1599 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4139 {
4140 if (!UpRefs.empty())
4141 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4142 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[(1) - (2)].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004143 if (Ty == 0)
Reid Spencer61c83e02006-08-18 08:43:06 +00004144 GEN_ERROR("Global const reference must be a pointer type!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004145
4146 // ConstExprs can exist in the body of a function, thus creating
4147 // GlobalValues whenever they refer to a variable. Because we are in
4148 // the context of a function, getValNonImprovising will search the functions
4149 // symbol table instead of the module symbol table for the global symbol,
4150 // which throws things all off. To get around this, we just tell
4151 // getValNonImprovising that we are at global scope here.
4152 //
4153 Function *SavedCurFn = CurFun.CurrentFunction;
4154 CurFun.CurrentFunction = 0;
4155
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004156 Value *V = getValNonImprovising(Ty, (yyvsp[(2) - (2)].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00004157 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00004158
4159 CurFun.CurrentFunction = SavedCurFn;
4160
4161 // If this is an initializer for a constant pointer, which is referencing a
4162 // (currently) undefined variable, create a stub now that shall be replaced
4163 // in the future with the right type of variable.
4164 //
4165 if (V == 0) {
4166 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
4167 const PointerType *PT = cast<PointerType>(Ty);
4168
4169 // First check to see if the forward references value is already created!
4170 PerModuleInfo::GlobalRefsType::iterator I =
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004171 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004172
4173 if (I != CurModule.GlobalRefs.end()) {
4174 V = I->second; // Placeholder already exists, use it...
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004175 (yyvsp[(2) - (2)].ValIDVal).destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +00004176 } else {
4177 std::string Name;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004178 if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
4179 Name = (yyvsp[(2) - (2)].ValIDVal).Name;
4180 else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
Reid Spencer41dff5e2007-01-26 08:05:27 +00004181 GEN_ERROR("Invalid reference to global");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004182
4183 // Create the forward referenced global.
4184 GlobalValue *GV;
4185 if (const FunctionType *FTy =
4186 dyn_cast<FunctionType>(PT->getElementType())) {
4187 GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
4188 CurModule.CurrentModule);
4189 } else {
4190 GV = new GlobalVariable(PT->getElementType(), false,
4191 GlobalValue::ExternalLinkage, 0,
4192 Name, CurModule.CurrentModule);
4193 }
4194
4195 // Keep track of the fact that we have a forward ref to recycle it
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004196 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004197 V = GV;
4198 }
4199 }
4200
Reid Spencer41dff5e2007-01-26 08:05:27 +00004201 (yyval.ConstVal) = cast<GlobalValue>(V);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004202 delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle
Reid Spencer61c83e02006-08-18 08:43:06 +00004203 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004204 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004205 break;
4206
4207 case 153:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004208#line 1665 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004209 {
Reid Spencer14310612006-12-31 05:40:51 +00004210 if (!UpRefs.empty())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004211 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4212 if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
4213 GEN_ERROR("Mismatched types for constant expression: " +
4214 (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
4215 (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
4216 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004217 CHECK_FOR_ERROR
4218 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004219 break;
4220
4221 case 154:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004222#line 1675 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4223 {
4224 if (!UpRefs.empty())
4225 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
4226 const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
4227 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4228 GEN_ERROR("Cannot create a null initialized value of this type!");
4229 (yyval.ConstVal) = Constant::getNullValue(Ty);
4230 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004231 CHECK_FOR_ERROR
4232 ;}
4233 break;
4234
4235 case 155:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004236#line 1685 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004237 { // integral constants
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004238 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
Reid Spencer41dff5e2007-01-26 08:05:27 +00004239 GEN_ERROR("Constant value doesn't fit in type!");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004240 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004241 CHECK_FOR_ERROR
4242 ;}
4243 break;
4244
4245 case 156:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004246#line 1691 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4247 { // integral constants
4248 if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
4249 GEN_ERROR("Constant value doesn't fit in type!");
4250 (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004251 CHECK_FOR_ERROR
4252 ;}
4253 break;
4254
4255 case 157:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004256#line 1697 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4257 { // Boolean constants
4258 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4259 (yyval.ConstVal) = ConstantInt::getTrue();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004260 CHECK_FOR_ERROR
4261 ;}
4262 break;
4263
4264 case 158:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004265#line 1702 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4266 { // Boolean constants
4267 assert(cast<IntegerType>((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
4268 (yyval.ConstVal) = ConstantInt::getFalse();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004269 CHECK_FOR_ERROR
4270 ;}
4271 break;
4272
4273 case 159:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004274#line 1707 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4275 { // Float & Double constants
4276 if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].FPVal)))
4277 GEN_ERROR("Floating point constant invalid for type!!");
4278 (yyval.ConstVal) = ConstantFP::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].FPVal));
Reid Spencer6f407902007-01-13 05:00:46 +00004279 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004280 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004281 break;
4282
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004283 case 160:
4284#line 1715 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004285 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004286 if (!UpRefs.empty())
4287 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
4288 Constant *Val = (yyvsp[(3) - (6)].ConstVal);
4289 const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
4290 if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
4291 GEN_ERROR("invalid cast opcode for cast from '" +
4292 Val->getType()->getDescription() + "' to '" +
4293 DestTy->getDescription() + "'!");
4294 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
4295 delete (yyvsp[(5) - (6)].TypeVal);
4296 ;}
4297 break;
4298
4299 case 161:
4300#line 1727 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4301 {
4302 if (!isa<PointerType>((yyvsp[(3) - (5)].ConstVal)->getType()))
4303 GEN_ERROR("GetElementPtr requires a pointer operand!");
4304
4305 const Type *IdxTy =
4306 GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), *(yyvsp[(4) - (5)].ValueList), true);
4307 if (!IdxTy)
4308 GEN_ERROR("Index list invalid for constant getelementptr!");
4309
4310 std::vector<Constant*> IdxVec;
4311 for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
4312 if (Constant *C = dyn_cast<Constant>((*(yyvsp[(4) - (5)].ValueList))[i]))
4313 IdxVec.push_back(C);
4314 else
4315 GEN_ERROR("Indices to constant getelementptr must be constants!");
4316
4317 delete (yyvsp[(4) - (5)].ValueList);
4318
4319 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), IdxVec);
Andrew Lenharth6353e052006-12-08 18:07:09 +00004320 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004321 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004322 break;
4323
4324 case 162:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004325#line 1748 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004326 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004327 if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
4328 GEN_ERROR("Select condition must be of boolean type!");
4329 if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
4330 GEN_ERROR("Select operand types must match!");
4331 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
4332 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004333 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004334 break;
4335
4336 case 163:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004337#line 1756 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004338 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004339 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4340 GEN_ERROR("Binary operator types must match!");
4341 CHECK_FOR_ERROR;
4342 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004343 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004344 break;
4345
4346 case 164:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004347#line 1762 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004348 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004349 if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
4350 GEN_ERROR("Logical operator types must match!");
4351 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
4352 if (!isa<PackedType>((yyvsp[(3) - (6)].ConstVal)->getType()) ||
4353 !cast<PackedType>((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
4354 GEN_ERROR("Logical operator requires integral operands!");
4355 }
4356 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004357 CHECK_FOR_ERROR
4358 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004359 break;
4360
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004361 case 165:
4362#line 1773 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004363 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004364 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4365 GEN_ERROR("icmp operand types must match!");
4366 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4367 ;}
4368 break;
4369
4370 case 166:
4371#line 1778 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4372 {
4373 if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
4374 GEN_ERROR("fcmp operand types must match!");
4375 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
4376 ;}
4377 break;
4378
4379 case 167:
4380#line 1783 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4381 {
4382 if ((yyvsp[(5) - (6)].ConstVal)->getType() != Type::Int8Ty)
4383 GEN_ERROR("Shift count for shift constant must be i8 type!");
4384 if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger())
4385 GEN_ERROR("Shift constant expression requires integer operand!");
4386 CHECK_FOR_ERROR;
4387 (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004388 CHECK_FOR_ERROR
4389 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004390 break;
4391
4392 case 168:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004393#line 1792 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004394 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004395 if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
4396 GEN_ERROR("Invalid extractelement operands!");
4397 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004398 CHECK_FOR_ERROR
4399 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004400 break;
4401
4402 case 169:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004403#line 1798 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004404 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004405 if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4406 GEN_ERROR("Invalid insertelement operands!");
4407 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004408 CHECK_FOR_ERROR
4409 ;}
4410 break;
4411
4412 case 170:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004413#line 1804 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004414 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004415 if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
4416 GEN_ERROR("Invalid shufflevector operands!");
4417 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004418 CHECK_FOR_ERROR
4419 ;}
4420 break;
4421
4422 case 171:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004423#line 1813 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004424 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004425 ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004426 CHECK_FOR_ERROR
4427 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004428 break;
4429
4430 case 172:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004431#line 1817 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4432 {
4433 (yyval.ConstVector) = new std::vector<Constant*>();
4434 (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
4435 CHECK_FOR_ERROR
4436 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004437 break;
4438
4439 case 173:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004440#line 1825 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4441 { (yyval.BoolVal) = false; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004442 break;
4443
4444 case 174:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004445#line 1825 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4446 { (yyval.BoolVal) = true; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004447 break;
4448
4449 case 175:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004450#line 1836 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004451 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004452 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4453 CurModule.ModuleDone();
4454 CHECK_FOR_ERROR;
4455 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004456 break;
4457
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004458 case 176:
4459#line 1841 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4460 {
4461 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4462 CurModule.ModuleDone();
4463 CHECK_FOR_ERROR;
4464 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004465 break;
4466
Reid Spencer41dff5e2007-01-26 08:05:27 +00004467 case 179:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004468#line 1854 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4469 { CurFun.isDeclare = false; ;}
4470 break;
4471
4472 case 180:
4473#line 1854 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004474 {
4475 CurFun.FunctionDone();
4476 CHECK_FOR_ERROR
4477 ;}
4478 break;
4479
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004480 case 181:
4481#line 1858 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004482 { CurFun.isDeclare = true; ;}
4483 break;
4484
Reid Spencer41dff5e2007-01-26 08:05:27 +00004485 case 182:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004486#line 1858 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004487 {
4488 CHECK_FOR_ERROR
4489 ;}
4490 break;
4491
4492 case 183:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004493#line 1861 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4494 {
4495 CHECK_FOR_ERROR
4496 ;}
4497 break;
4498
4499 case 184:
4500#line 1864 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004501 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00004502 // Emit an error if there are any unresolved types left.
4503 if (!CurModule.LateResolveTypes.empty()) {
4504 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
Reid Spencer41dff5e2007-01-26 08:05:27 +00004505 if (DID.Type == ValID::LocalName) {
Reid Spencer61c83e02006-08-18 08:43:06 +00004506 GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'");
4507 } else {
4508 GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num));
4509 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00004510 }
Reid Spencer61c83e02006-08-18 08:43:06 +00004511 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004512 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004513 break;
4514
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004515 case 185:
4516#line 1876 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004517 {
Reid Spencer14310612006-12-31 05:40:51 +00004518 if (!UpRefs.empty())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004519 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004520 // Eagerly resolve types. This is not an optimization, this is a
4521 // requirement that is due to the fact that we could have this:
4522 //
4523 // %list = type { %list * }
4524 // %list = type { %list * } ; repeated type decl
4525 //
4526 // If types are not resolved eagerly, then the two types will not be
4527 // determined to be the same type!
4528 //
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004529 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004530
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004531 if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
Reid Spencer5b7e7532006-09-28 19:28:24 +00004532 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00004533 // If this is a named type that is not a redefinition, add it to the slot
4534 // table.
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004535 CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004536 }
Reid Spencera132e042006-12-03 05:46:11 +00004537
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004538 delete (yyvsp[(3) - (3)].TypeVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00004539 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004540 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004541 break;
4542
4543 case 186:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004544#line 1900 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4545 {
4546 ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
4547
4548 if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
4549 CHECK_FOR_ERROR
4550 // If this is a named type that is not a redefinition, add it to the slot
4551 // table.
4552 CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
4553 }
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004554 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004555 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004556 break;
4557
4558 case 187:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004559#line 1911 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4560 {
4561 /* "Externally Visible" Linkage */
4562 if ((yyvsp[(4) - (4)].ConstVal) == 0)
4563 GEN_ERROR("Global value initializer is not a constant!");
4564 CurGV = ParseGlobalVariable((yyvsp[(1) - (4)].StrVal), GlobalValue::ExternalLinkage,
4565 (yyvsp[(2) - (4)].Visibility), (yyvsp[(3) - (4)].BoolVal), (yyvsp[(4) - (4)].ConstVal)->getType(), (yyvsp[(4) - (4)].ConstVal));
4566 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004567 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004568 break;
4569
4570 case 188:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004571#line 1918 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004572 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004573 CurGV = 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +00004574 ;}
4575 break;
4576
4577 case 189:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004578#line 1921 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004579 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004580 if ((yyvsp[(5) - (5)].ConstVal) == 0)
4581 GEN_ERROR("Global value initializer is not a constant!");
4582 CurGV = ParseGlobalVariable((yyvsp[(1) - (5)].StrVal), (yyvsp[(2) - (5)].Linkage), (yyvsp[(3) - (5)].Visibility), (yyvsp[(4) - (5)].BoolVal), (yyvsp[(5) - (5)].ConstVal)->getType(), (yyvsp[(5) - (5)].ConstVal));
4583 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004584 ;}
4585 break;
4586
4587 case 190:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004588#line 1926 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004589 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004590 CurGV = 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +00004591 ;}
4592 break;
4593
4594 case 191:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004595#line 1929 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004596 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004597 if (!UpRefs.empty())
4598 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (5)].TypeVal))->getDescription());
4599 CurGV = ParseGlobalVariable((yyvsp[(1) - (5)].StrVal), (yyvsp[(2) - (5)].Linkage), (yyvsp[(3) - (5)].Visibility), (yyvsp[(4) - (5)].BoolVal), *(yyvsp[(5) - (5)].TypeVal), 0);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004600 CHECK_FOR_ERROR
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004601 delete (yyvsp[(5) - (5)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004602 ;}
4603 break;
4604
4605 case 192:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004606#line 1935 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4607 {
4608 CurGV = 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +00004609 CHECK_FOR_ERROR
4610 ;}
4611 break;
4612
4613 case 193:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004614#line 1939 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4615 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004616 CHECK_FOR_ERROR
4617 ;}
4618 break;
4619
4620 case 194:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004621#line 1942 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4622 {
4623 CHECK_FOR_ERROR
4624 ;}
4625 break;
4626
4627 case 195:
4628#line 1948 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004629 {
Chris Lattner66316012006-01-24 04:14:29 +00004630 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004631 char *EndStr = UnEscapeLexed((yyvsp[(1) - (1)].StrVal), true);
4632 std::string NewAsm((yyvsp[(1) - (1)].StrVal), EndStr);
4633 free((yyvsp[(1) - (1)].StrVal));
Chris Lattner66316012006-01-24 04:14:29 +00004634
4635 if (AsmSoFar.empty())
4636 CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
4637 else
4638 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
Reid Spencer61c83e02006-08-18 08:43:06 +00004639 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004640;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004641 break;
4642
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004643 case 196:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004644#line 1961 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004645 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004646 CurModule.CurrentModule->setTargetTriple((yyvsp[(3) - (3)].StrVal));
4647 free((yyvsp[(3) - (3)].StrVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004648 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004649 break;
4650
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004651 case 197:
4652#line 1965 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004653 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004654 CurModule.CurrentModule->setDataLayout((yyvsp[(3) - (3)].StrVal));
4655 free((yyvsp[(3) - (3)].StrVal));
4656 ;}
Reid Spencer41dff5e2007-01-26 08:05:27 +00004657 break;
4658
4659 case 199:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004660#line 1972 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004661 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004662 CurModule.CurrentModule->addLibrary((yyvsp[(3) - (3)].StrVal));
4663 free((yyvsp[(3) - (3)].StrVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004664 CHECK_FOR_ERROR
4665 ;}
4666 break;
4667
4668 case 200:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004669#line 1977 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004670 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004671 CurModule.CurrentModule->addLibrary((yyvsp[(1) - (1)].StrVal));
4672 free((yyvsp[(1) - (1)].StrVal));
Reid Spencera54b7cb2007-01-12 07:05:14 +00004673 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004674 ;}
4675 break;
4676
4677 case 201:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004678#line 1982 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004679 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004680 CHECK_FOR_ERROR
4681 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004682 break;
4683
4684 case 202:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004685#line 1991 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004686 {
4687 if (!UpRefs.empty())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004688 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
4689 if (*(yyvsp[(3) - (5)].TypeVal) == Type::VoidTy)
Reid Spencer41dff5e2007-01-26 08:05:27 +00004690 GEN_ERROR("void typed arguments are invalid!");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004691 ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
4692 (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
4693 (yyvsp[(1) - (5)].ArgList)->push_back(E);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004694 CHECK_FOR_ERROR
4695 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004696 break;
4697
4698 case 203:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004699#line 2001 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004700 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004701 if (!UpRefs.empty())
4702 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
4703 if (*(yyvsp[(1) - (3)].TypeVal) == Type::VoidTy)
4704 GEN_ERROR("void typed arguments are invalid!");
4705 ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
4706 (yyval.ArgList) = new ArgListType;
Reid Spencer41dff5e2007-01-26 08:05:27 +00004707 (yyval.ArgList)->push_back(E);
Reid Spencer61c83e02006-08-18 08:43:06 +00004708 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004709 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004710 break;
4711
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004712 case 204:
4713#line 2012 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004714 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004715 (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
4716 CHECK_FOR_ERROR
4717 ;}
4718 break;
4719
4720 case 205:
4721#line 2016 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4722 {
4723 (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004724 struct ArgListEntry E;
4725 E.Ty = new PATypeHolder(Type::VoidTy);
4726 E.Name = 0;
4727 E.Attrs = FunctionType::NoAttributeSet;
4728 (yyval.ArgList)->push_back(E);
Reid Spencer6f407902007-01-13 05:00:46 +00004729 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004730 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004731 break;
4732
4733 case 206:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004734#line 2025 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4735 {
4736 (yyval.ArgList) = new ArgListType;
4737 struct ArgListEntry E;
4738 E.Ty = new PATypeHolder(Type::VoidTy);
4739 E.Name = 0;
4740 E.Attrs = FunctionType::NoAttributeSet;
4741 (yyval.ArgList)->push_back(E);
4742 CHECK_FOR_ERROR
4743 ;}
4744 break;
4745
4746 case 207:
4747#line 2034 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004748 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004749 (yyval.ArgList) = 0;
Reid Spencer61c83e02006-08-18 08:43:06 +00004750 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004751 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004752 break;
4753
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004754 case 208:
4755#line 2040 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004756 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004757 UnEscapeLexed((yyvsp[(3) - (9)].StrVal));
4758 std::string FunctionName((yyvsp[(3) - (9)].StrVal));
4759 free((yyvsp[(3) - (9)].StrVal)); // Free strdup'd memory!
Reid Spencer68a24bd2005-08-27 18:50:39 +00004760
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00004761 // Check the function result for abstractness if this is a define. We should
4762 // have no abstract types at this point
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004763 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (9)].TypeVal)))
4764 GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (9)].TypeVal)->get()->getDescription());
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00004765
Reid Spencer68a24bd2005-08-27 18:50:39 +00004766 std::vector<const Type*> ParamTypeList;
Reid Spencer14310612006-12-31 05:40:51 +00004767 std::vector<FunctionType::ParameterAttributes> ParamAttrs;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004768 ParamAttrs.push_back((yyvsp[(7) - (9)].ParamAttrs));
4769 if ((yyvsp[(5) - (9)].ArgList)) { // If there are arguments...
4770 for (ArgListType::iterator I = (yyvsp[(5) - (9)].ArgList)->begin(); I != (yyvsp[(5) - (9)].ArgList)->end(); ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00004771 const Type* Ty = I->Ty->get();
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00004772 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
4773 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
Reid Spencer14310612006-12-31 05:40:51 +00004774 ParamTypeList.push_back(Ty);
4775 if (Ty != Type::VoidTy)
4776 ParamAttrs.push_back(I->Attrs);
4777 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00004778 }
4779
4780 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4781 if (isVarArg) ParamTypeList.pop_back();
4782
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004783 FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (9)].TypeVal), ParamTypeList, isVarArg,
Reid Spencer14310612006-12-31 05:40:51 +00004784 ParamAttrs);
Reid Spencer68a24bd2005-08-27 18:50:39 +00004785 const PointerType *PFT = PointerType::get(FT);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004786 delete (yyvsp[(2) - (9)].TypeVal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00004787
4788 ValID ID;
4789 if (!FunctionName.empty()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004790 ID = ValID::createGlobalName((char*)FunctionName.c_str());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004791 } else {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004792 ID = ValID::createGlobalID(CurModule.Values[PFT].size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004793 }
4794
4795 Function *Fn = 0;
4796 // See if this function was forward referenced. If so, recycle the object.
4797 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4798 // Move the function to the end of the list, from whereever it was
4799 // previously inserted.
4800 Fn = cast<Function>(FWRef);
4801 CurModule.CurrentModule->getFunctionList().remove(Fn);
4802 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4803 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4804 (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) {
4805 // If this is the case, either we need to be a forward decl, or it needs
4806 // to be.
4807 if (!CurFun.isDeclare && !Fn->isExternal())
Reid Spencer61c83e02006-08-18 08:43:06 +00004808 GEN_ERROR("Redefinition of function '" + FunctionName + "'!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004809
4810 // Make sure to strip off any argument names so we can't get conflicts.
4811 if (Fn->isExternal())
4812 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4813 AI != AE; ++AI)
4814 AI->setName("");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004815 } else { // Not already defined?
4816 Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
4817 CurModule.CurrentModule);
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +00004818
Reid Spencer68a24bd2005-08-27 18:50:39 +00004819 InsertValue(Fn, CurModule.Values);
4820 }
4821
4822 CurFun.FunctionStart(Fn);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00004823
4824 if (CurFun.isDeclare) {
4825 // If we have declaration, always overwrite linkage. This will allow us to
4826 // correctly handle cases, when pointer to function is passed as argument to
4827 // another function.
4828 Fn->setLinkage(CurFun.Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004829 Fn->setVisibility(CurFun.Visibility);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00004830 }
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004831 Fn->setCallingConv((yyvsp[(1) - (9)].UIntVal));
4832 Fn->setAlignment((yyvsp[(9) - (9)].UIntVal));
4833 if ((yyvsp[(8) - (9)].StrVal)) {
4834 Fn->setSection((yyvsp[(8) - (9)].StrVal));
4835 free((yyvsp[(8) - (9)].StrVal));
Chris Lattnere869eef2005-11-12 00:11:49 +00004836 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00004837
4838 // Add all of the arguments we parsed to the function...
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004839 if ((yyvsp[(5) - (9)].ArgList)) { // Is null if empty...
Reid Spencer68a24bd2005-08-27 18:50:39 +00004840 if (isVarArg) { // Nuke the last entry
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004841 assert((yyvsp[(5) - (9)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (9)].ArgList)->back().Name == 0&&
Reid Spencera132e042006-12-03 05:46:11 +00004842 "Not a varargs marker!");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004843 delete (yyvsp[(5) - (9)].ArgList)->back().Ty;
4844 (yyvsp[(5) - (9)].ArgList)->pop_back(); // Delete the last entry
Reid Spencer68a24bd2005-08-27 18:50:39 +00004845 }
4846 Function::arg_iterator ArgIt = Fn->arg_begin();
Reid Spencer14310612006-12-31 05:40:51 +00004847 unsigned Idx = 1;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004848 for (ArgListType::iterator I = (yyvsp[(5) - (9)].ArgList)->begin(); I != (yyvsp[(5) - (9)].ArgList)->end(); ++I, ++ArgIt) {
Reid Spencer14310612006-12-31 05:40:51 +00004849 delete I->Ty; // Delete the typeholder...
4850 setValueName(ArgIt, I->Name); // Insert arg into symtab...
Reid Spencer5b7e7532006-09-28 19:28:24 +00004851 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00004852 InsertValue(ArgIt);
Reid Spencer14310612006-12-31 05:40:51 +00004853 Idx++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00004854 }
Reid Spencera132e042006-12-03 05:46:11 +00004855
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004856 delete (yyvsp[(5) - (9)].ArgList); // We're now done with the argument list
Reid Spencer68a24bd2005-08-27 18:50:39 +00004857 }
Reid Spencer61c83e02006-08-18 08:43:06 +00004858 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004859;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004860 break;
4861
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004862 case 211:
4863#line 2147 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004864 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004865 (yyval.FunctionVal) = CurFun.CurrentFunction;
Reid Spencer68a24bd2005-08-27 18:50:39 +00004866
4867 // Make sure that we keep track of the linkage type even if there was a
4868 // previous "declare".
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004869 (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
4870 (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004871;}
4872 break;
4873
4874 case 214:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004875#line 2158 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004876 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004877 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
4878 CHECK_FOR_ERROR
4879;}
4880 break;
4881
4882 case 215:
4883#line 2163 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4884 {
4885 CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
4886 CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004887 (yyval.FunctionVal) = CurFun.CurrentFunction;
4888 CurFun.FunctionDone();
4889 CHECK_FOR_ERROR
4890 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004891 break;
4892
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004893 case 216:
4894#line 2175 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004895 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004896 (yyval.BoolVal) = false;
4897 CHECK_FOR_ERROR
4898 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004899 break;
4900
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004901 case 217:
4902#line 2179 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004903 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004904 (yyval.BoolVal) = true;
Reid Spencer61c83e02006-08-18 08:43:06 +00004905 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004906 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004907 break;
4908
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004909 case 218:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004910#line 2184 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4911 { // A reference to a direct constant
4912 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
Reid Spencere4d87aa2006-12-23 06:05:41 +00004913 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004914 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004915 break;
4916
4917 case 219:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004918#line 2188 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4919 {
4920 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
Reid Spencer6f407902007-01-13 05:00:46 +00004921 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004922 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004923 break;
4924
4925 case 220:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004926#line 2192 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
4927 { // Perhaps it's an FP constant?
4928 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
4929 CHECK_FOR_ERROR
4930 ;}
4931 break;
4932
4933 case 221:
4934#line 2196 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004935 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004936 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
Reid Spencere4d87aa2006-12-23 06:05:41 +00004937 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004938 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004939 break;
4940
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004941 case 222:
4942#line 2200 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004943 {
4944 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
Reid Spencere4d87aa2006-12-23 06:05:41 +00004945 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004946 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004947 break;
4948
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004949 case 223:
4950#line 2204 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004951 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004952 (yyval.ValIDVal) = ValID::createNull();
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00004953 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004954 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004955 break;
4956
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004957 case 224:
4958#line 2208 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004959 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004960 (yyval.ValIDVal) = ValID::createUndef();
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00004961 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004962 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004963 break;
4964
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004965 case 225:
4966#line 2212 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004967 { // A vector zero constant.
4968 (yyval.ValIDVal) = ValID::createZeroInit();
Reid Spencer61c83e02006-08-18 08:43:06 +00004969 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004970 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004971 break;
4972
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004973 case 226:
4974#line 2216 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004975 { // Nonempty unsized packed vector
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004976 const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
4977 int NumElements = (yyvsp[(2) - (3)].ConstVector)->size();
Reid Spencer68a24bd2005-08-27 18:50:39 +00004978
4979 PackedType* pt = PackedType::get(ETy, NumElements);
4980 PATypeHolder* PTy = new PATypeHolder(
Reid Spencera132e042006-12-03 05:46:11 +00004981 HandleUpRefs(
4982 PackedType::get(
4983 ETy,
4984 NumElements)
4985 )
4986 );
Reid Spencer68a24bd2005-08-27 18:50:39 +00004987
4988 // Verify all elements are correct type!
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004989 for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
4990 if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
Reid Spencer61c83e02006-08-18 08:43:06 +00004991 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +00004992 ETy->getDescription() +"' as required!\nIt is of type '" +
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004993 (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004994 }
4995
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004996 (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
4997 delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004998 CHECK_FOR_ERROR
4999 ;}
5000 break;
5001
5002 case 227:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005003#line 2241 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00005004 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005005 (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00005006 CHECK_FOR_ERROR
5007 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005008 break;
Reid Spencer6f407902007-01-13 05:00:46 +00005009
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005010 case 228:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005011#line 2245 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5012 {
5013 char *End = UnEscapeLexed((yyvsp[(3) - (5)].StrVal), true);
5014 std::string AsmStr = std::string((yyvsp[(3) - (5)].StrVal), End);
5015 End = UnEscapeLexed((yyvsp[(5) - (5)].StrVal), true);
5016 std::string Constraints = std::string((yyvsp[(5) - (5)].StrVal), End);
5017 (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[(2) - (5)].BoolVal));
5018 free((yyvsp[(3) - (5)].StrVal));
5019 free((yyvsp[(5) - (5)].StrVal));
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005020 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005021 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005022 break;
5023
5024 case 229:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005025#line 2259 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5026 { // Is it an integer reference...?
5027 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005028 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005029 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005030 break;
5031
5032 case 230:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005033#line 2263 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5034 {
5035 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005036 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005037 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005038 break;
5039
5040 case 231:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005041#line 2267 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005042 { // Is it a named reference...?
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005043 (yyval.ValIDVal) = ValID::createLocalName((yyvsp[(1) - (1)].StrVal));
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005044 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005045 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005046 break;
5047
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005048 case 232:
5049#line 2271 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5050 { // Is it a named reference...?
5051 (yyval.ValIDVal) = ValID::createGlobalName((yyvsp[(1) - (1)].StrVal));
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005052 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005053 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005054 break;
5055
5056 case 235:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005057#line 2283 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005058 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005059 if (!UpRefs.empty())
5060 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
5061 (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal));
5062 delete (yyvsp[(1) - (2)].TypeVal);
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005063 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005064 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005065 break;
5066
5067 case 236:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005068#line 2292 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5069 {
5070 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005071 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005072 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005073 break;
5074
5075 case 237:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005076#line 2296 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5077 { // Do not allow functions with 0 basic blocks
5078 (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005079 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005080 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005081 break;
5082
5083 case 238:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005084#line 2305 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005085 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005086 setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
5087 CHECK_FOR_ERROR
5088 InsertValue((yyvsp[(3) - (3)].TermInstVal));
5089
5090 (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
5091 InsertValue((yyvsp[(1) - (3)].BasicBlockVal));
5092 (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00005093 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005094 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005095 break;
5096
5097 case 239:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005098#line 2316 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5099 {
5100 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[(2) - (2)].InstVal)))
5101 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
5102 if (CI2->getParent() == 0)
5103 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
5104 (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
5105 (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
5106 CHECK_FOR_ERROR
5107 ;}
5108 break;
5109
5110 case 240:
5111#line 2325 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005112 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005113 (yyval.BasicBlockVal) = getBBVal(ValID::createLocalID(CurFun.NextBBNum++), true);
Reid Spencere4d87aa2006-12-23 06:05:41 +00005114 CHECK_FOR_ERROR
5115
5116 // Make sure to move the basic block to the correct location in the
5117 // function, instead of leaving it inserted wherever it was first
5118 // referenced.
5119 Function::BasicBlockListType &BBL =
5120 CurFun.CurrentFunction->getBasicBlockList();
Reid Spencer41dff5e2007-01-26 08:05:27 +00005121 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00005122 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005123 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005124 break;
5125
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005126 case 241:
5127#line 2337 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005128 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005129 (yyval.BasicBlockVal) = getBBVal(ValID::createLocalName((yyvsp[(1) - (1)].StrVal)), true);
Reid Spencere4d87aa2006-12-23 06:05:41 +00005130 CHECK_FOR_ERROR
5131
5132 // Make sure to move the basic block to the correct location in the
5133 // function, instead of leaving it inserted wherever it was first
5134 // referenced.
5135 Function::BasicBlockListType &BBL =
5136 CurFun.CurrentFunction->getBasicBlockList();
Reid Spencer41dff5e2007-01-26 08:05:27 +00005137 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
Reid Spencer3822ff52006-11-08 06:47:33 +00005138 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005139 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005140 break;
Reid Spencer3822ff52006-11-08 06:47:33 +00005141
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005142 case 242:
5143#line 2350 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005144 { // Return with a result...
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005145 (yyval.TermInstVal) = new ReturnInst((yyvsp[(2) - (2)].ValueVal));
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005146 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005147 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005148 break;
5149
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005150 case 243:
5151#line 2354 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005152 { // Return with no result...
Reid Spencer41dff5e2007-01-26 08:05:27 +00005153 (yyval.TermInstVal) = new ReturnInst();
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005154 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005155 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005156 break;
5157
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005158 case 244:
5159#line 2358 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005160 { // Unconditional Branch...
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005161 BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005162 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005163 (yyval.TermInstVal) = new BranchInst(tmpBB);
5164 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005165 break;
5166
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005167 case 245:
5168#line 2363 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005169 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005170 assert(cast<IntegerType>((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?");
5171 BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005172 CHECK_FOR_ERROR
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005173 BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005174 CHECK_FOR_ERROR
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005175 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005176 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005177 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
5178 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005179 break;
5180
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005181 case 246:
5182#line 2373 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005183 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005184 Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005185 CHECK_FOR_ERROR
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005186 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005187 CHECK_FOR_ERROR
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005188 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
Reid Spencer41dff5e2007-01-26 08:05:27 +00005189 (yyval.TermInstVal) = S;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005190
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005191 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
5192 E = (yyvsp[(8) - (9)].JumpTable)->end();
Reid Spencer68a24bd2005-08-27 18:50:39 +00005193 for (; I != E; ++I) {
5194 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
5195 S->addCase(CI, I->second);
5196 else
Reid Spencer61c83e02006-08-18 08:43:06 +00005197 GEN_ERROR("Switch case is constant, but not a simple integer!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005198 }
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005199 delete (yyvsp[(8) - (9)].JumpTable);
Reid Spencer61c83e02006-08-18 08:43:06 +00005200 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005201 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005202 break;
5203
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005204 case 247:
5205#line 2392 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005206 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005207 Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005208 CHECK_FOR_ERROR
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005209 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005210 CHECK_FOR_ERROR
5211 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
Reid Spencer41dff5e2007-01-26 08:05:27 +00005212 (yyval.TermInstVal) = S;
Reid Spencer61c83e02006-08-18 08:43:06 +00005213 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005214 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005215 break;
5216
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005217 case 248:
5218#line 2402 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005219 {
Reid Spencer3822ff52006-11-08 06:47:33 +00005220
Reid Spencer14310612006-12-31 05:40:51 +00005221 // Handle the short syntax
5222 const PointerType *PFTy = 0;
5223 const FunctionType *Ty = 0;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005224 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (14)].TypeVal)->get())) ||
Reid Spencer68a24bd2005-08-27 18:50:39 +00005225 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5226 // Pull out the types of all of the arguments...
5227 std::vector<const Type*> ParamTypes;
Reid Spencer14310612006-12-31 05:40:51 +00005228 FunctionType::ParamAttrsList ParamAttrs;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005229 ParamAttrs.push_back((yyvsp[(8) - (14)].ParamAttrs));
5230 for (ValueRefList::iterator I = (yyvsp[(6) - (14)].ValueRefList)->begin(), E = (yyvsp[(6) - (14)].ValueRefList)->end(); I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00005231 const Type *Ty = I->Val->getType();
5232 if (Ty == Type::VoidTy)
5233 GEN_ERROR("Short call syntax cannot be used with varargs");
5234 ParamTypes.push_back(Ty);
5235 ParamAttrs.push_back(I->Attrs);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005236 }
5237
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005238 Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false, ParamAttrs);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005239 PFTy = PointerType::get(Ty);
5240 }
5241
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005242 Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00005243 CHECK_FOR_ERROR
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005244 BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005245 CHECK_FOR_ERROR
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005246 BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00005247 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005248
Reid Spencer14310612006-12-31 05:40:51 +00005249 // Check the arguments
5250 ValueList Args;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005251 if ((yyvsp[(6) - (14)].ValueRefList)->empty()) { // Has no arguments?
Reid Spencer14310612006-12-31 05:40:51 +00005252 // Make sure no arguments is a good thing!
5253 if (Ty->getNumParams() != 0)
5254 GEN_ERROR("No arguments passed to a function that "
5255 "expects arguments!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005256 } else { // Has arguments?
5257 // Loop through FunctionType's arguments and ensure they are specified
5258 // correctly!
Reid Spencer68a24bd2005-08-27 18:50:39 +00005259 FunctionType::param_iterator I = Ty->param_begin();
5260 FunctionType::param_iterator E = Ty->param_end();
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005261 ValueRefList::iterator ArgI = (yyvsp[(6) - (14)].ValueRefList)->begin(), ArgE = (yyvsp[(6) - (14)].ValueRefList)->end();
Reid Spencer68a24bd2005-08-27 18:50:39 +00005262
Reid Spencer14310612006-12-31 05:40:51 +00005263 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5264 if (ArgI->Val->getType() != *I)
5265 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Reid Spencera132e042006-12-03 05:46:11 +00005266 (*I)->getDescription() + "'!");
Reid Spencer14310612006-12-31 05:40:51 +00005267 Args.push_back(ArgI->Val);
5268 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005269
Reid Spencer14310612006-12-31 05:40:51 +00005270 if (Ty->isVarArg()) {
5271 if (I == E)
5272 for (; ArgI != ArgE; ++ArgI)
5273 Args.push_back(ArgI->Val); // push the remaining varargs
5274 } else if (I != E || ArgI != ArgE)
Reid Spencer61c83e02006-08-18 08:43:06 +00005275 GEN_ERROR("Invalid number of parameters detected!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005276 }
Reid Spencer14310612006-12-31 05:40:51 +00005277
5278 // Create the InvokeInst
5279 InvokeInst *II = new InvokeInst(V, Normal, Except, Args);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005280 II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00005281 (yyval.TermInstVal) = II;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005282 delete (yyvsp[(6) - (14)].ValueRefList);
Andrew Lenharth6353e052006-12-08 18:07:09 +00005283 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005284 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005285 break;
5286
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005287 case 249:
5288#line 2468 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005289 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005290 (yyval.TermInstVal) = new UnwindInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00005291 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005292 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005293 break;
5294
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005295 case 250:
5296#line 2472 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005297 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005298 (yyval.TermInstVal) = new UnreachableInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00005299 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005300 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005301 break;
5302
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005303 case 251:
5304#line 2479 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005305 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005306 (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
5307 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005308 CHECK_FOR_ERROR
5309 if (V == 0)
5310 GEN_ERROR("May only switch on a constant pool value!");
5311
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005312 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005313 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005314 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5315 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005316 break;
5317
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005318 case 252:
5319#line 2490 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005320 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005321 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005322 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005323 CHECK_FOR_ERROR
5324
5325 if (V == 0)
5326 GEN_ERROR("May only switch on a constant pool value!");
5327
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005328 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005329 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005330 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5331 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005332 break;
5333
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005334 case 253:
5335#line 2503 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005336 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00005337 // Is this definition named?? if so, assign the name...
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005338 setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005339 CHECK_FOR_ERROR
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005340 InsertValue((yyvsp[(2) - (2)].InstVal));
5341 (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
Andrew Lenharth6353e052006-12-08 18:07:09 +00005342 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005343;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005344 break;
5345
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005346 case 254:
5347#line 2512 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005348 { // Used for PHI nodes
Reid Spencer14310612006-12-31 05:40:51 +00005349 if (!UpRefs.empty())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005350 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
Reid Spencer41dff5e2007-01-26 08:05:27 +00005351 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005352 Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005353 CHECK_FOR_ERROR
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005354 BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005355 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005356 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005357 delete (yyvsp[(1) - (6)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00005358 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005359 break;
5360
5361 case 255:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005362#line 2523 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5363 {
5364 (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
5365 Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
5366 CHECK_FOR_ERROR
5367 BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
5368 CHECK_FOR_ERROR
5369 (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
Reid Spencer41dff5e2007-01-26 08:05:27 +00005370 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005371 break;
5372
5373 case 256:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005374#line 2533 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5375 {
5376 if (!UpRefs.empty())
5377 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
5378 // Used for call and invoke instructions
5379 (yyval.ValueRefList) = new ValueRefList();
5380 ValueRefListEntry E; E.Attrs = (yyvsp[(3) - (3)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (3)].TypeVal)->get(), (yyvsp[(2) - (3)].ValIDVal));
5381 (yyval.ValueRefList)->push_back(E);
5382 ;}
5383 break;
5384
5385 case 257:
5386#line 2541 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005387 {
Reid Spencer14310612006-12-31 05:40:51 +00005388 if (!UpRefs.empty())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005389 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
5390 (yyval.ValueRefList) = (yyvsp[(1) - (5)].ValueRefList);
5391 ValueRefListEntry E; E.Attrs = (yyvsp[(5) - (5)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (5)].TypeVal)->get(), (yyvsp[(4) - (5)].ValIDVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00005392 (yyval.ValueRefList)->push_back(E);
Reid Spencer6f407902007-01-13 05:00:46 +00005393 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005394 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005395 break;
5396
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005397 case 258:
5398#line 2549 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00005399 { (yyval.ValueRefList) = new ValueRefList(); ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005400 break;
5401
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005402 case 259:
5403#line 2552 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00005404 { (yyval.ValueList) = new std::vector<Value*>(); ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005405 break;
5406
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005407 case 260:
5408#line 2553 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005409 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005410 (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
5411 (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
Reid Spencer14310612006-12-31 05:40:51 +00005412 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005413 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005414 break;
5415
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005416 case 261:
5417#line 2560 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005418 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005419 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00005420 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005421 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005422 break;
5423
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005424 case 262:
5425#line 2564 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005426 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005427 (yyval.BoolVal) = false;
Reid Spencere4d87aa2006-12-23 06:05:41 +00005428 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005429 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005430 break;
5431
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005432 case 263:
5433#line 2569 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005434 {
Reid Spencer14310612006-12-31 05:40:51 +00005435 if (!UpRefs.empty())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005436 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
5437 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() &&
5438 !isa<PackedType>((*(yyvsp[(2) - (5)].TypeVal)).get()))
Reid Spencere4d87aa2006-12-23 06:05:41 +00005439 GEN_ERROR(
5440 "Arithmetic operator requires integer, FP, or packed operands!");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005441 if (isa<PackedType>((*(yyvsp[(2) - (5)].TypeVal)).get()) &&
5442 ((yyvsp[(1) - (5)].BinaryOpVal) == Instruction::URem ||
5443 (yyvsp[(1) - (5)].BinaryOpVal) == Instruction::SRem ||
5444 (yyvsp[(1) - (5)].BinaryOpVal) == Instruction::FRem))
Reid Spencere4d87aa2006-12-23 06:05:41 +00005445 GEN_ERROR("U/S/FRem not supported on packed types!");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005446 Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005447 CHECK_FOR_ERROR
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005448 Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005449 CHECK_FOR_ERROR
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005450 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
Reid Spencer41dff5e2007-01-26 08:05:27 +00005451 if ((yyval.InstVal) == 0)
Reid Spencere4d87aa2006-12-23 06:05:41 +00005452 GEN_ERROR("binary operator returned null!");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005453 delete (yyvsp[(2) - (5)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00005454 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005455 break;
5456
5457 case 264:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005458#line 2590 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005459 {
Reid Spencer14310612006-12-31 05:40:51 +00005460 if (!UpRefs.empty())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005461 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
5462 if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
5463 if (!isa<PackedType>((yyvsp[(2) - (5)].TypeVal)->get()) ||
5464 !cast<PackedType>((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
5465 GEN_ERROR("Logical operator requires integral operands!");
5466 }
5467 Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
5468 CHECK_FOR_ERROR
5469 Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
5470 CHECK_FOR_ERROR
5471 (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
5472 if ((yyval.InstVal) == 0)
5473 GEN_ERROR("binary operator returned null!");
5474 delete (yyvsp[(2) - (5)].TypeVal);
5475 ;}
5476 break;
5477
5478 case 265:
5479#line 2607 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5480 {
5481 if (!UpRefs.empty())
5482 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5483 if (isa<PackedType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Reid Spencerac4a1dd2007-01-04 02:57:52 +00005484 GEN_ERROR("Packed types not supported by icmp instruction");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005485 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005486 CHECK_FOR_ERROR
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005487 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005488 CHECK_FOR_ERROR
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005489 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
Reid Spencer41dff5e2007-01-26 08:05:27 +00005490 if ((yyval.InstVal) == 0)
Andrew Lenharth6353e052006-12-08 18:07:09 +00005491 GEN_ERROR("icmp operator returned null!");
Reid Spencer41dff5e2007-01-26 08:05:27 +00005492 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005493 break;
5494
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005495 case 266:
5496#line 2620 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005497 {
Reid Spencer14310612006-12-31 05:40:51 +00005498 if (!UpRefs.empty())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005499 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
5500 if (isa<PackedType>((*(yyvsp[(3) - (6)].TypeVal)).get()))
Reid Spencerac4a1dd2007-01-04 02:57:52 +00005501 GEN_ERROR("Packed types not supported by fcmp instruction");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005502 Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005503 CHECK_FOR_ERROR
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005504 Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005505 CHECK_FOR_ERROR
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005506 (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
Reid Spencer41dff5e2007-01-26 08:05:27 +00005507 if ((yyval.InstVal) == 0)
Andrew Lenharth6353e052006-12-08 18:07:09 +00005508 GEN_ERROR("fcmp operator returned null!");
Reid Spencer41dff5e2007-01-26 08:05:27 +00005509 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005510 break;
5511
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005512 case 267:
5513#line 2633 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005514 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005515 if ((yyvsp[(4) - (4)].ValueVal)->getType() != Type::Int8Ty)
Reid Spencer14310612006-12-31 05:40:51 +00005516 GEN_ERROR("Shift amount must be i8 type!");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005517 if (!(yyvsp[(2) - (4)].ValueVal)->getType()->isInteger())
Andrew Lenharth6353e052006-12-08 18:07:09 +00005518 GEN_ERROR("Shift constant expression requires integer operand!");
5519 CHECK_FOR_ERROR;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005520 (yyval.InstVal) = new ShiftInst((yyvsp[(1) - (4)].OtherOpVal), (yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005521 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005522 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005523 break;
5524
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005525 case 268:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005526#line 2642 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005527 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005528 if (!UpRefs.empty())
5529 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
5530 Value* Val = (yyvsp[(2) - (4)].ValueVal);
5531 const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
5532 if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
5533 GEN_ERROR("invalid cast opcode for cast from '" +
5534 Val->getType()->getDescription() + "' to '" +
5535 DestTy->getDescription() + "'!");
5536 (yyval.InstVal) = CastInst::create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
5537 delete (yyvsp[(4) - (4)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00005538 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005539 break;
5540
5541 case 269:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005542#line 2654 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005543 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005544 if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
5545 GEN_ERROR("select condition must be boolean!");
5546 if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
5547 GEN_ERROR("select value types should match!");
5548 (yyval.InstVal) = new SelectInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005549 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005550 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005551 break;
5552
5553 case 270:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005554#line 2662 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005555 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005556 if (!UpRefs.empty())
5557 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
5558 (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
5559 delete (yyvsp[(4) - (4)].TypeVal);
Andrew Lenharth6353e052006-12-08 18:07:09 +00005560 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005561 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005562 break;
5563
5564 case 271:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005565#line 2669 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005566 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005567 if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
5568 GEN_ERROR("Invalid extractelement operands!");
5569 (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005570 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005571 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005572 break;
5573
5574 case 272:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005575#line 2675 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005576 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005577 if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
5578 GEN_ERROR("Invalid insertelement operands!");
5579 (yyval.InstVal) = new InsertElementInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005580 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005581 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005582 break;
5583
5584 case 273:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005585#line 2681 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005586 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005587 if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
5588 GEN_ERROR("Invalid shufflevector operands!");
5589 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00005590 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005591 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005592 break;
5593
5594 case 274:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005595#line 2687 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5596 {
5597 const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
5598 if (!Ty->isFirstClassType())
5599 GEN_ERROR("PHI node operands must be of first class type!");
5600 (yyval.InstVal) = new PHINode(Ty);
5601 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
5602 while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
5603 if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty)
5604 GEN_ERROR("All elements of a PHI node must be of the same type!");
5605 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
5606 (yyvsp[(2) - (2)].PHIList)->pop_front();
5607 }
5608 delete (yyvsp[(2) - (2)].PHIList); // Free the list...
5609 CHECK_FOR_ERROR
5610 ;}
5611 break;
5612
5613 case 275:
5614#line 2703 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005615 {
Reid Spencer14310612006-12-31 05:40:51 +00005616
5617 // Handle the short syntax
Andrew Lenharth6353e052006-12-08 18:07:09 +00005618 const PointerType *PFTy = 0;
5619 const FunctionType *Ty = 0;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005620 if (!(PFTy = dyn_cast<PointerType>((yyvsp[(3) - (8)].TypeVal)->get())) ||
Andrew Lenharth6353e052006-12-08 18:07:09 +00005621 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5622 // Pull out the types of all of the arguments...
5623 std::vector<const Type*> ParamTypes;
Reid Spencer14310612006-12-31 05:40:51 +00005624 FunctionType::ParamAttrsList ParamAttrs;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005625 ParamAttrs.push_back((yyvsp[(8) - (8)].ParamAttrs));
5626 for (ValueRefList::iterator I = (yyvsp[(6) - (8)].ValueRefList)->begin(), E = (yyvsp[(6) - (8)].ValueRefList)->end(); I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00005627 const Type *Ty = I->Val->getType();
5628 if (Ty == Type::VoidTy)
5629 GEN_ERROR("Short call syntax cannot be used with varargs");
5630 ParamTypes.push_back(Ty);
5631 ParamAttrs.push_back(I->Attrs);
Andrew Lenharth6353e052006-12-08 18:07:09 +00005632 }
5633
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005634 Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false, ParamAttrs);
Andrew Lenharth6353e052006-12-08 18:07:09 +00005635 PFTy = PointerType::get(Ty);
5636 }
5637
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005638 Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00005639 CHECK_FOR_ERROR
5640
Reid Spencer14310612006-12-31 05:40:51 +00005641 // Check the arguments
5642 ValueList Args;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005643 if ((yyvsp[(6) - (8)].ValueRefList)->empty()) { // Has no arguments?
Andrew Lenharth6353e052006-12-08 18:07:09 +00005644 // Make sure no arguments is a good thing!
5645 if (Ty->getNumParams() != 0)
5646 GEN_ERROR("No arguments passed to a function that "
5647 "expects arguments!");
Andrew Lenharth6353e052006-12-08 18:07:09 +00005648 } else { // Has arguments?
5649 // Loop through FunctionType's arguments and ensure they are specified
5650 // correctly!
5651 //
5652 FunctionType::param_iterator I = Ty->param_begin();
5653 FunctionType::param_iterator E = Ty->param_end();
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005654 ValueRefList::iterator ArgI = (yyvsp[(6) - (8)].ValueRefList)->begin(), ArgE = (yyvsp[(6) - (8)].ValueRefList)->end();
Andrew Lenharth6353e052006-12-08 18:07:09 +00005655
Reid Spencer14310612006-12-31 05:40:51 +00005656 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5657 if (ArgI->Val->getType() != *I)
5658 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Andrew Lenharth6353e052006-12-08 18:07:09 +00005659 (*I)->getDescription() + "'!");
Reid Spencer14310612006-12-31 05:40:51 +00005660 Args.push_back(ArgI->Val);
5661 }
5662 if (Ty->isVarArg()) {
5663 if (I == E)
5664 for (; ArgI != ArgE; ++ArgI)
5665 Args.push_back(ArgI->Val); // push the remaining varargs
5666 } else if (I != E || ArgI != ArgE)
Andrew Lenharth6353e052006-12-08 18:07:09 +00005667 GEN_ERROR("Invalid number of parameters detected!");
Andrew Lenharth6353e052006-12-08 18:07:09 +00005668 }
Reid Spencer14310612006-12-31 05:40:51 +00005669 // Create the call node
5670 CallInst *CI = new CallInst(V, Args);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005671 CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
5672 CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00005673 (yyval.InstVal) = CI;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005674 delete (yyvsp[(6) - (8)].ValueRefList);
5675 delete (yyvsp[(3) - (8)].TypeVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00005676 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005677 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005678 break;
5679
5680 case 276:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005681#line 2766 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5682 {
5683 (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
5684 CHECK_FOR_ERROR
5685 ;}
5686 break;
5687
5688 case 277:
5689#line 2771 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005690 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005691 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00005692 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005693 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005694 break;
5695
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005696 case 278:
5697#line 2775 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005698 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005699 (yyval.BoolVal) = false;
Reid Spencere4d87aa2006-12-23 06:05:41 +00005700 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005701 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005702 break;
5703
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005704 case 279:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005705#line 2782 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005706 {
Reid Spencer6f407902007-01-13 05:00:46 +00005707 if (!UpRefs.empty())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005708 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
5709 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
5710 delete (yyvsp[(2) - (3)].TypeVal);
Reid Spencer6f407902007-01-13 05:00:46 +00005711 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005712 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005713 break;
5714
5715 case 280:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005716#line 2789 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005717 {
Reid Spencer14310612006-12-31 05:40:51 +00005718 if (!UpRefs.empty())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005719 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
5720 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00005721 CHECK_FOR_ERROR
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005722 (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
5723 delete (yyvsp[(2) - (6)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00005724 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005725 break;
5726
5727 case 281:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005728#line 2797 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005729 {
Reid Spencer14310612006-12-31 05:40:51 +00005730 if (!UpRefs.empty())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005731 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
5732 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
5733 delete (yyvsp[(2) - (3)].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00005734 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005735 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005736 break;
5737
5738 case 282:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005739#line 2804 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005740 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005741 if (!UpRefs.empty())
5742 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
5743 Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00005744 CHECK_FOR_ERROR
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005745 (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
5746 delete (yyvsp[(2) - (6)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00005747 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005748 break;
5749
5750 case 283:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005751#line 2812 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005752 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005753 if (!isa<PointerType>((yyvsp[(2) - (2)].ValueVal)->getType()))
5754 GEN_ERROR("Trying to free nonpointer type " +
5755 (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "!");
5756 (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00005757 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005758 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005759 break;
5760
5761 case 284:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005762#line 2820 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005763 {
Reid Spencer14310612006-12-31 05:40:51 +00005764 if (!UpRefs.empty())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005765 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (4)].TypeVal))->getDescription());
5766 if (!isa<PointerType>((yyvsp[(3) - (4)].TypeVal)->get()))
5767 GEN_ERROR("Can't load from nonpointer type: " +
5768 (*(yyvsp[(3) - (4)].TypeVal))->getDescription());
5769 if (!cast<PointerType>((yyvsp[(3) - (4)].TypeVal)->get())->getElementType()->isFirstClassType())
5770 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5771 (*(yyvsp[(3) - (4)].TypeVal))->getDescription());
5772 Value* tmpVal = getVal(*(yyvsp[(3) - (4)].TypeVal), (yyvsp[(4) - (4)].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00005773 CHECK_FOR_ERROR
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005774 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (4)].BoolVal));
5775 delete (yyvsp[(3) - (4)].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00005776 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005777 break;
5778
5779 case 285:
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005780#line 2834 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005781 {
Reid Spencer14310612006-12-31 05:40:51 +00005782 if (!UpRefs.empty())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005783 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
5784 const PointerType *PT = dyn_cast<PointerType>((yyvsp[(5) - (6)].TypeVal)->get());
5785 if (!PT)
5786 GEN_ERROR("Can't store to a nonpointer type: " +
5787 (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
5788 const Type *ElTy = PT->getElementType();
5789 if (ElTy != (yyvsp[(3) - (6)].ValueVal)->getType())
5790 GEN_ERROR("Can't store '" + (yyvsp[(3) - (6)].ValueVal)->getType()->getDescription() +
5791 "' into space of type '" + ElTy->getDescription() + "'!");
5792
5793 Value* tmpVal = getVal(*(yyvsp[(5) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
5794 CHECK_FOR_ERROR
5795 (yyval.InstVal) = new StoreInst((yyvsp[(3) - (6)].ValueVal), tmpVal, (yyvsp[(1) - (6)].BoolVal));
5796 delete (yyvsp[(5) - (6)].TypeVal);
5797 ;}
5798 break;
5799
5800 case 286:
5801#line 2851 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
5802 {
5803 if (!UpRefs.empty())
5804 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
5805 if (!isa<PointerType>((yyvsp[(2) - (4)].TypeVal)->get()))
Reid Spencer61c83e02006-08-18 08:43:06 +00005806 GEN_ERROR("getelementptr insn requires pointer operand!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005807
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005808 if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), *(yyvsp[(4) - (4)].ValueList), true))
Reid Spencer61c83e02006-08-18 08:43:06 +00005809 GEN_ERROR("Invalid getelementptr indices for type '" +
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005810 (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'!");
5811 Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00005812 CHECK_FOR_ERROR
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005813 (yyval.InstVal) = new GetElementPtrInst(tmpVal, *(yyvsp[(4) - (4)].ValueList));
5814 delete (yyvsp[(2) - (4)].TypeVal);
5815 delete (yyvsp[(4) - (4)].ValueList);
Reid Spencer41dff5e2007-01-26 08:05:27 +00005816 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005817 break;
5818
5819
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005820/* Line 1267 of yacc.c. */
5821#line 5822 "llvmAsmParser.tab.c"
Reid Spencer41dff5e2007-01-26 08:05:27 +00005822 default: break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005823 }
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005824 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005825
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005826 YYPOPSTACK (yylen);
5827 yylen = 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +00005828 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005829
5830 *++yyvsp = yyval;
5831
5832
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005833 /* Now `shift' the result of the reduction. Determine what state
5834 that goes to, based on the state we popped back to and the rule
5835 number reduced by. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00005836
5837 yyn = yyr1[yyn];
5838
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005839 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5840 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00005841 yystate = yytable[yystate];
5842 else
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005843 yystate = yydefgoto[yyn - YYNTOKENS];
Reid Spencer68a24bd2005-08-27 18:50:39 +00005844
5845 goto yynewstate;
5846
5847
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005848/*------------------------------------.
5849| yyerrlab -- here on detecting error |
5850`------------------------------------*/
5851yyerrlab:
5852 /* If not already recovering from an error, report this error. */
5853 if (!yyerrstatus)
Reid Spencer68a24bd2005-08-27 18:50:39 +00005854 {
5855 ++yynerrs;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005856#if ! YYERROR_VERBOSE
5857 yyerror (YY_("syntax error"));
5858#else
5859 {
5860 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
5861 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
5862 {
5863 YYSIZE_T yyalloc = 2 * yysize;
5864 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
5865 yyalloc = YYSTACK_ALLOC_MAXIMUM;
5866 if (yymsg != yymsgbuf)
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005867 YYSTACK_FREE (yymsg);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005868 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
5869 if (yymsg)
5870 yymsg_alloc = yyalloc;
5871 else
5872 {
5873 yymsg = yymsgbuf;
5874 yymsg_alloc = sizeof yymsgbuf;
5875 }
5876 }
5877
5878 if (0 < yysize && yysize <= yymsg_alloc)
5879 {
5880 (void) yysyntax_error (yymsg, yystate, yychar);
5881 yyerror (yymsg);
5882 }
5883 else
5884 {
5885 yyerror (YY_("syntax error"));
5886 if (yysize != 0)
Reid Spencer41dff5e2007-01-26 08:05:27 +00005887 goto yyexhaustedlab;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005888 }
5889 }
5890#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00005891 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00005892
5893
5894
5895 if (yyerrstatus == 3)
5896 {
5897 /* If just tried and failed to reuse look-ahead token after an
5898 error, discard it. */
5899
5900 if (yychar <= YYEOF)
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005901 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005902 /* Return failure if at end of input. */
5903 if (yychar == YYEOF)
5904 YYABORT;
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005905 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00005906 else
5907 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005908 yydestruct ("Error: discarding",
5909 yytoken, &yylval);
Reid Spencer41dff5e2007-01-26 08:05:27 +00005910 yychar = YYEMPTY;
5911 }
5912 }
5913
5914 /* Else will try to reuse look-ahead token after shifting the error
5915 token. */
Jeff Cohen361c3ef2007-01-21 19:19:31 +00005916 goto yyerrlab1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005917
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005918
Reid Spencer41dff5e2007-01-26 08:05:27 +00005919/*---------------------------------------------------.
5920| yyerrorlab -- error raised explicitly by YYERROR. |
5921`---------------------------------------------------*/
5922yyerrorlab:
5923
5924 /* Pacify compilers like GCC when the user code never invokes
5925 YYERROR and the label yyerrorlab therefore never appears in user
5926 code. */
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005927 if (/*CONSTCOND*/ 0)
Reid Spencer41dff5e2007-01-26 08:05:27 +00005928 goto yyerrorlab;
5929
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005930 /* Do not reclaim the symbols of the rule which action triggered
5931 this YYERROR. */
5932 YYPOPSTACK (yylen);
5933 yylen = 0;
5934 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer41dff5e2007-01-26 08:05:27 +00005935 yystate = *yyssp;
5936 goto yyerrlab1;
5937
5938
5939/*-------------------------------------------------------------.
5940| yyerrlab1 -- common code for both syntax error and YYERROR. |
5941`-------------------------------------------------------------*/
Jeff Cohen361c3ef2007-01-21 19:19:31 +00005942yyerrlab1:
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005943 yyerrstatus = 3; /* Each real token shifted decrements this. */
5944
5945 for (;;)
5946 {
5947 yyn = yypact[yystate];
5948 if (yyn != YYPACT_NINF)
5949 {
5950 yyn += YYTERROR;
5951 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5952 {
5953 yyn = yytable[yyn];
5954 if (0 < yyn)
5955 break;
5956 }
5957 }
5958
5959 /* Pop the current state because it cannot handle the error token. */
5960 if (yyssp == yyss)
Reid Spencer68a24bd2005-08-27 18:50:39 +00005961 YYABORT;
5962
Reid Spencere4d87aa2006-12-23 06:05:41 +00005963
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005964 yydestruct ("Error: popping",
5965 yystos[yystate], yyvsp);
5966 YYPOPSTACK (1);
Reid Spencer41dff5e2007-01-26 08:05:27 +00005967 yystate = *yyssp;
5968 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005969 }
5970
5971 if (yyn == YYFINAL)
5972 YYACCEPT;
5973
Reid Spencer68a24bd2005-08-27 18:50:39 +00005974 *++yyvsp = yylval;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005975
5976
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005977 /* Shift the error token. */
Reid Spencer41dff5e2007-01-26 08:05:27 +00005978 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
5979
Reid Spencer68a24bd2005-08-27 18:50:39 +00005980 yystate = yyn;
5981 goto yynewstate;
5982
Chris Lattnerb25c4ca2007-01-15 02:12:07 +00005983
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005984/*-------------------------------------.
5985| yyacceptlab -- YYACCEPT comes here. |
5986`-------------------------------------*/
5987yyacceptlab:
5988 yyresult = 0;
5989 goto yyreturn;
5990
5991/*-----------------------------------.
5992| yyabortlab -- YYABORT comes here. |
5993`-----------------------------------*/
5994yyabortlab:
5995 yyresult = 1;
5996 goto yyreturn;
5997
5998#ifndef yyoverflow
Reid Spencer41dff5e2007-01-26 08:05:27 +00005999/*-------------------------------------------------.
6000| yyexhaustedlab -- memory exhaustion comes here. |
6001`-------------------------------------------------*/
6002yyexhaustedlab:
6003 yyerror (YY_("memory exhausted"));
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00006004 yyresult = 2;
6005 /* Fall through. */
Chris Lattnerb25c4ca2007-01-15 02:12:07 +00006006#endif
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00006007
6008yyreturn:
Reid Spencer41dff5e2007-01-26 08:05:27 +00006009 if (yychar != YYEOF && yychar != YYEMPTY)
6010 yydestruct ("Cleanup: discarding lookahead",
6011 yytoken, &yylval);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006012 /* Do not reclaim the symbols of the rule which action triggered
6013 this YYABORT or YYACCEPT. */
6014 YYPOPSTACK (yylen);
6015 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer41dff5e2007-01-26 08:05:27 +00006016 while (yyssp != yyss)
6017 {
6018 yydestruct ("Cleanup: popping",
6019 yystos[*yyssp], yyvsp);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006020 YYPOPSTACK (1);
Reid Spencer41dff5e2007-01-26 08:05:27 +00006021 }
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00006022#ifndef yyoverflow
6023 if (yyss != yyssa)
6024 YYSTACK_FREE (yyss);
6025#endif
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006026#if YYERROR_VERBOSE
6027 if (yymsg != yymsgbuf)
6028 YYSTACK_FREE (yymsg);
6029#endif
6030 /* Make sure YYID is used. */
6031 return YYID (yyresult);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006032}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00006033
6034
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00006035#line 2868 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y"
Reid Spencer61c83e02006-08-18 08:43:06 +00006036
6037
Reid Spencer14310612006-12-31 05:40:51 +00006038// common code from the two 'RunVMAsmParser' functions
6039static Module* RunParser(Module * M) {
6040
6041 llvmAsmlineno = 1; // Reset the current line number...
6042 CurModule.CurrentModule = M;
6043#if YYDEBUG
6044 yydebug = Debug;
6045#endif
6046
6047 // Check to make sure the parser succeeded
6048 if (yyparse()) {
6049 if (ParserResult)
6050 delete ParserResult;
6051 return 0;
6052 }
6053
6054 // Check to make sure that parsing produced a result
6055 if (!ParserResult)
6056 return 0;
6057
6058 // Reset ParserResult variable while saving its value for the result.
6059 Module *Result = ParserResult;
6060 ParserResult = 0;
6061
6062 return Result;
6063}
6064
Reid Spencer61c83e02006-08-18 08:43:06 +00006065void llvm::GenerateError(const std::string &message, int LineNo) {
6066 if (LineNo == -1) LineNo = llvmAsmlineno;
6067 // TODO: column number in exception
6068 if (TheParseError)
6069 TheParseError->setError(CurFilename, message, LineNo);
6070 TriggerError = 1;
6071}
Reid Spencer68a24bd2005-08-27 18:50:39 +00006072
6073int yyerror(const char *ErrorMsg) {
6074 std::string where
6075 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
6076 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
6077 std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading ";
6078 if (yychar == YYEMPTY || yychar == 0)
6079 errMsg += "end-of-file.";
6080 else
6081 errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'";
Reid Spencer61c83e02006-08-18 08:43:06 +00006082 GenerateError(errMsg);
Reid Spencer68a24bd2005-08-27 18:50:39 +00006083 return 0;
6084}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00006085