blob: e78dc6fe1286c9d8889151a02a480e0d6644cb38 [file] [log] [blame]
Reid Spencere4d87aa2006-12-23 06:05:41 +00001/* A Bison parser, made by GNU Bison 2.1. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002
Andrew Lenharth6353e052006-12-08 18:07:09 +00003/* Skeleton parser for Yacc-like parsing with Bison,
Reid Spencere4d87aa2006-12-23 06:05:41 +00004 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Reid Spencer68a24bd2005-08-27 18:50:39 +00005
Reid Spencer3822ff52006-11-08 06:47:33 +00006 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +000010
Reid Spencer3822ff52006-11-08 06:47:33 +000011 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
Reid Spencere4d87aa2006-12-23 06:05:41 +000018 Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA. */
Reid Spencer3822ff52006-11-08 06:47:33 +000020
Andrew Lenharth6353e052006-12-08 18:07:09 +000021/* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
Reid Spencer3822ff52006-11-08 06:47:33 +000025
Andrew Lenharth6353e052006-12-08 18:07:09 +000026/* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
Reid Spencer3822ff52006-11-08 06:47:33 +000028
29/* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
35
36/* Identify Bison output. */
37#define YYBISON 1
38
Reid Spencere4d87aa2006-12-23 06:05:41 +000039/* Bison version. */
40#define YYBISON_VERSION "2.1"
41
Reid Spencer3822ff52006-11-08 06:47:33 +000042/* Skeleton name. */
43#define YYSKELETON_NAME "yacc.c"
44
45/* Pure parsers. */
46#define YYPURE 0
47
48/* Using locations. */
49#define YYLSP_NEEDED 0
50
Reid Spencere4d87aa2006-12-23 06:05:41 +000051/* Substitute the variable and function names. */
Reid Spencer68a24bd2005-08-27 18:50:39 +000052#define yyparse llvmAsmparse
Reid Spencer3822ff52006-11-08 06:47:33 +000053#define yylex llvmAsmlex
Reid Spencer68a24bd2005-08-27 18:50:39 +000054#define yyerror llvmAsmerror
Reid Spencer3822ff52006-11-08 06:47:33 +000055#define yylval llvmAsmlval
56#define yychar llvmAsmchar
Reid Spencer68a24bd2005-08-27 18:50:39 +000057#define yydebug llvmAsmdebug
58#define yynerrs llvmAsmnerrs
59
Reid Spencer3822ff52006-11-08 06:47:33 +000060
61/* Tokens. */
62#ifndef YYTOKENTYPE
63# define YYTOKENTYPE
64 /* Put the tokens into the symbol table, so that GDB and other debuggers
65 know about them. */
66 enum yytokentype {
67 ESINT64VAL = 258,
68 EUINT64VAL = 259,
69 SINTVAL = 260,
70 UINTVAL = 261,
71 FPVAL = 262,
72 VOID = 263,
73 BOOL = 264,
Reid Spencer14310612006-12-31 05:40:51 +000074 INT8 = 265,
75 INT16 = 266,
76 INT32 = 267,
77 INT64 = 268,
78 FLOAT = 269,
79 DOUBLE = 270,
80 LABEL = 271,
81 TYPE = 272,
82 VAR_ID = 273,
83 LABELSTR = 274,
84 STRINGCONSTANT = 275,
85 IMPLEMENTATION = 276,
86 ZEROINITIALIZER = 277,
87 TRUETOK = 278,
88 FALSETOK = 279,
89 BEGINTOK = 280,
90 ENDTOK = 281,
91 DECLARE = 282,
92 DEFINE = 283,
93 GLOBAL = 284,
94 CONSTANT = 285,
95 SECTION = 286,
96 VOLATILE = 287,
97 TO = 288,
98 DOTDOTDOT = 289,
99 NULL_TOK = 290,
100 UNDEF = 291,
101 INTERNAL = 292,
102 LINKONCE = 293,
103 WEAK = 294,
104 APPENDING = 295,
105 DLLIMPORT = 296,
106 DLLEXPORT = 297,
107 EXTERN_WEAK = 298,
108 OPAQUE = 299,
109 NOT = 300,
110 EXTERNAL = 301,
111 TARGET = 302,
112 TRIPLE = 303,
113 ENDIAN = 304,
114 POINTERSIZE = 305,
115 LITTLE = 306,
116 BIG = 307,
117 ALIGN = 308,
118 DEPLIBS = 309,
119 CALL = 310,
120 TAIL = 311,
121 ASM_TOK = 312,
122 MODULE = 313,
123 SIDEEFFECT = 314,
124 CC_TOK = 315,
125 CCC_TOK = 316,
126 CSRETCC_TOK = 317,
127 FASTCC_TOK = 318,
128 COLDCC_TOK = 319,
129 X86_STDCALLCC_TOK = 320,
130 X86_FASTCALLCC_TOK = 321,
131 DATALAYOUT = 322,
132 RET = 323,
133 BR = 324,
134 SWITCH = 325,
135 INVOKE = 326,
136 UNWIND = 327,
137 UNREACHABLE = 328,
138 ADD = 329,
139 SUB = 330,
140 MUL = 331,
141 UDIV = 332,
142 SDIV = 333,
143 FDIV = 334,
144 UREM = 335,
145 SREM = 336,
146 FREM = 337,
147 AND = 338,
148 OR = 339,
149 XOR = 340,
150 ICMP = 341,
151 FCMP = 342,
152 EQ = 343,
153 NE = 344,
154 SLT = 345,
155 SGT = 346,
156 SLE = 347,
157 SGE = 348,
158 ULT = 349,
159 UGT = 350,
160 ULE = 351,
161 UGE = 352,
162 OEQ = 353,
163 ONE = 354,
164 OLT = 355,
165 OGT = 356,
166 OLE = 357,
167 OGE = 358,
168 ORD = 359,
169 UNO = 360,
170 UEQ = 361,
171 UNE = 362,
172 MALLOC = 363,
173 ALLOCA = 364,
174 FREE = 365,
175 LOAD = 366,
176 STORE = 367,
177 GETELEMENTPTR = 368,
178 TRUNC = 369,
179 ZEXT = 370,
180 SEXT = 371,
181 FPTRUNC = 372,
182 FPEXT = 373,
183 BITCAST = 374,
184 UITOFP = 375,
185 SITOFP = 376,
186 FPTOUI = 377,
187 FPTOSI = 378,
188 INTTOPTR = 379,
189 PTRTOINT = 380,
190 PHI_TOK = 381,
191 SELECT = 382,
192 SHL = 383,
193 LSHR = 384,
194 ASHR = 385,
195 VAARG = 386,
196 EXTRACTELEMENT = 387,
197 INSERTELEMENT = 388,
Reid Spencer218ded22007-01-05 17:07:23 +0000198 SHUFFLEVECTOR = 389,
199 NORETURN = 390
Reid Spencer3822ff52006-11-08 06:47:33 +0000200 };
201#endif
Reid Spencere4d87aa2006-12-23 06:05:41 +0000202/* Tokens. */
Reid Spencer3822ff52006-11-08 06:47:33 +0000203#define ESINT64VAL 258
204#define EUINT64VAL 259
205#define SINTVAL 260
206#define UINTVAL 261
207#define FPVAL 262
208#define VOID 263
209#define BOOL 264
Reid Spencer14310612006-12-31 05:40:51 +0000210#define INT8 265
211#define INT16 266
212#define INT32 267
213#define INT64 268
214#define FLOAT 269
215#define DOUBLE 270
216#define LABEL 271
217#define TYPE 272
218#define VAR_ID 273
219#define LABELSTR 274
220#define STRINGCONSTANT 275
221#define IMPLEMENTATION 276
222#define ZEROINITIALIZER 277
223#define TRUETOK 278
224#define FALSETOK 279
225#define BEGINTOK 280
226#define ENDTOK 281
227#define DECLARE 282
228#define DEFINE 283
229#define GLOBAL 284
230#define CONSTANT 285
231#define SECTION 286
232#define VOLATILE 287
233#define TO 288
234#define DOTDOTDOT 289
235#define NULL_TOK 290
236#define UNDEF 291
237#define INTERNAL 292
238#define LINKONCE 293
239#define WEAK 294
240#define APPENDING 295
241#define DLLIMPORT 296
242#define DLLEXPORT 297
243#define EXTERN_WEAK 298
244#define OPAQUE 299
245#define NOT 300
246#define EXTERNAL 301
247#define TARGET 302
248#define TRIPLE 303
249#define ENDIAN 304
250#define POINTERSIZE 305
251#define LITTLE 306
252#define BIG 307
253#define ALIGN 308
254#define DEPLIBS 309
255#define CALL 310
256#define TAIL 311
257#define ASM_TOK 312
258#define MODULE 313
259#define SIDEEFFECT 314
260#define CC_TOK 315
261#define CCC_TOK 316
262#define CSRETCC_TOK 317
263#define FASTCC_TOK 318
264#define COLDCC_TOK 319
265#define X86_STDCALLCC_TOK 320
266#define X86_FASTCALLCC_TOK 321
267#define DATALAYOUT 322
268#define RET 323
269#define BR 324
270#define SWITCH 325
271#define INVOKE 326
272#define UNWIND 327
273#define UNREACHABLE 328
274#define ADD 329
275#define SUB 330
276#define MUL 331
277#define UDIV 332
278#define SDIV 333
279#define FDIV 334
280#define UREM 335
281#define SREM 336
282#define FREM 337
283#define AND 338
284#define OR 339
285#define XOR 340
286#define ICMP 341
287#define FCMP 342
288#define EQ 343
289#define NE 344
290#define SLT 345
291#define SGT 346
292#define SLE 347
293#define SGE 348
294#define ULT 349
295#define UGT 350
296#define ULE 351
297#define UGE 352
298#define OEQ 353
299#define ONE 354
300#define OLT 355
301#define OGT 356
302#define OLE 357
303#define OGE 358
304#define ORD 359
305#define UNO 360
306#define UEQ 361
307#define UNE 362
308#define MALLOC 363
309#define ALLOCA 364
310#define FREE 365
311#define LOAD 366
312#define STORE 367
313#define GETELEMENTPTR 368
314#define TRUNC 369
315#define ZEXT 370
316#define SEXT 371
317#define FPTRUNC 372
318#define FPEXT 373
319#define BITCAST 374
320#define UITOFP 375
321#define SITOFP 376
322#define FPTOUI 377
323#define FPTOSI 378
324#define INTTOPTR 379
325#define PTRTOINT 380
326#define PHI_TOK 381
327#define SELECT 382
328#define SHL 383
329#define LSHR 384
330#define ASHR 385
331#define VAARG 386
332#define EXTRACTELEMENT 387
333#define INSERTELEMENT 388
334#define SHUFFLEVECTOR 389
Reid Spencer218ded22007-01-05 17:07:23 +0000335#define NORETURN 390
Reid Spencer3822ff52006-11-08 06:47:33 +0000336
337
338
339
340/* Copy the first part of user declarations. */
Reid Spencer14310612006-12-31 05:40:51 +0000341#line 14 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000342
343#include "ParserInternals.h"
344#include "llvm/CallingConv.h"
Chris Lattner0e9c3762006-01-25 22:27:16 +0000345#include "llvm/InlineAsm.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000346#include "llvm/Instructions.h"
347#include "llvm/Module.h"
348#include "llvm/SymbolTable.h"
349#include "llvm/Support/GetElementPtrTypeIterator.h"
Reid Spencer14310612006-12-31 05:40:51 +0000350#include "llvm/Support/CommandLine.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000351#include "llvm/ADT/STLExtras.h"
Chris Lattner0019bbe2005-11-06 06:46:53 +0000352#include "llvm/Support/MathExtras.h"
Reid Spencer481169e2006-12-01 00:33:46 +0000353#include "llvm/Support/Streams.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000354#include <algorithm>
Reid Spencer68a24bd2005-08-27 18:50:39 +0000355#include <list>
356#include <utility>
Reid Spencer14310612006-12-31 05:40:51 +0000357#ifndef NDEBUG
358#define YYDEBUG 1
359#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000360
Reid Spencere4f47592006-08-18 17:32:55 +0000361// The following is a gross hack. In order to rid the libAsmParser library of
362// exceptions, we have to have a way of getting the yyparse function to go into
363// an error situation. So, whenever we want an error to occur, the GenerateError
364// function (see bottom of file) sets TriggerError. Then, at the end of each
365// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
366// (a goto) to put YACC in error state. Furthermore, several calls to
367// GenerateError are made from inside productions and they must simulate the
368// previous exception behavior by exiting the production immediately. We have
369// replaced these with the GEN_ERROR macro which calls GeneratError and then
370// immediately invokes YYERROR. This would be so much cleaner if it was a
371// recursive descent parser.
Reid Spencer61c83e02006-08-18 08:43:06 +0000372static bool TriggerError = false;
Reid Spencerf63697d2006-10-09 17:36:59 +0000373#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
Reid Spencer61c83e02006-08-18 08:43:06 +0000374#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
375
Reid Spencer68a24bd2005-08-27 18:50:39 +0000376int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
377int yylex(); // declaration" of xxx warnings.
378int yyparse();
379
380namespace llvm {
381 std::string CurFilename;
Reid Spencer14310612006-12-31 05:40:51 +0000382#if YYDEBUG
383static cl::opt<bool>
384Debug("debug-yacc", cl::desc("Print yacc debug state changes"),
385 cl::Hidden, cl::init(false));
386#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000387}
388using namespace llvm;
389
390static Module *ParserResult;
391
392// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
393// relating to upreferences in the input stream.
394//
395//#define DEBUG_UPREFS 1
396#ifdef DEBUG_UPREFS
Bill Wendlinge8156192006-12-07 01:30:32 +0000397#define UR_OUT(X) cerr << X
Reid Spencer68a24bd2005-08-27 18:50:39 +0000398#else
399#define UR_OUT(X)
400#endif
401
402#define YYERROR_VERBOSE 1
403
Chris Lattnerb475c422005-11-12 18:22:38 +0000404static GlobalVariable *CurGV;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000405
406
407// This contains info used when building the body of a function. It is
408// destroyed when the function is completed.
409//
410typedef std::vector<Value *> ValueList; // Numbered defs
Reid Spencer14310612006-12-31 05:40:51 +0000411
Reid Spencer68a24bd2005-08-27 18:50:39 +0000412static void
413ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers,
414 std::map<const Type *,ValueList> *FutureLateResolvers = 0);
415
416static struct PerModuleInfo {
417 Module *CurrentModule;
418 std::map<const Type *, ValueList> Values; // Module level numbered definitions
419 std::map<const Type *,ValueList> LateResolveValues;
Reid Spencer861d9d62006-11-28 07:29:44 +0000420 std::vector<PATypeHolder> Types;
421 std::map<ValID, PATypeHolder> LateResolveTypes;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000422
423 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
Chris Lattner0ad19702006-06-21 16:53:00 +0000424 /// how they were referenced and on which line of the input they came from so
Reid Spencer68a24bd2005-08-27 18:50:39 +0000425 /// that we can resolve them later and print error messages as appropriate.
426 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
427
428 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
429 // references to global values. Global values may be referenced before they
430 // are defined, and if so, the temporary object that they represent is held
431 // here. This is used for forward references of GlobalValues.
432 //
433 typedef std::map<std::pair<const PointerType *,
434 ValID>, GlobalValue*> GlobalRefsType;
435 GlobalRefsType GlobalRefs;
436
437 void ModuleDone() {
438 // If we could not resolve some functions at function compilation time
439 // (calls to functions before they are defined), resolve them now... Types
440 // are resolved when the constant pool has been completely parsed.
441 //
442 ResolveDefinitions(LateResolveValues);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000443 if (TriggerError)
444 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000445
446 // Check to make sure that all global value forward references have been
447 // resolved!
448 //
449 if (!GlobalRefs.empty()) {
450 std::string UndefinedReferences = "Unresolved global references exist:\n";
451
452 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
453 I != E; ++I) {
454 UndefinedReferences += " " + I->first.first->getDescription() + " " +
455 I->first.second.getName() + "\n";
456 }
Reid Spencer61c83e02006-08-18 08:43:06 +0000457 GenerateError(UndefinedReferences);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000458 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000459 }
460
461 Values.clear(); // Clear out function local definitions
462 Types.clear();
463 CurrentModule = 0;
464 }
465
Reid Spencer68a24bd2005-08-27 18:50:39 +0000466 // GetForwardRefForGlobal - Check to see if there is a forward reference
467 // for this global. If so, remove it from the GlobalRefs map and return it.
468 // If not, just return null.
469 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
470 // Check to see if there is a forward reference to this global variable...
471 // if there is, eliminate it and patch the reference to use the new def'n.
472 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
473 GlobalValue *Ret = 0;
474 if (I != GlobalRefs.end()) {
475 Ret = I->second;
476 GlobalRefs.erase(I);
477 }
478 return Ret;
479 }
Reid Spencer8c8a2dc2007-01-02 21:54:12 +0000480
481 bool TypeIsUnresolved(PATypeHolder* PATy) {
482 // If it isn't abstract, its resolved
483 const Type* Ty = PATy->get();
484 if (!Ty->isAbstract())
485 return false;
486 // Traverse the type looking for abstract types. If it isn't abstract then
487 // we don't need to traverse that leg of the type.
488 std::vector<const Type*> WorkList, SeenList;
489 WorkList.push_back(Ty);
490 while (!WorkList.empty()) {
491 const Type* Ty = WorkList.back();
492 SeenList.push_back(Ty);
493 WorkList.pop_back();
494 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
495 // Check to see if this is an unresolved type
496 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
497 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
498 for ( ; I != E; ++I) {
499 if (I->second.get() == OpTy)
500 return true;
501 }
502 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
503 const Type* TheTy = SeqTy->getElementType();
504 if (TheTy->isAbstract() && TheTy != Ty) {
505 std::vector<const Type*>::iterator I = SeenList.begin(),
506 E = SeenList.end();
507 for ( ; I != E; ++I)
508 if (*I == TheTy)
509 break;
510 if (I == E)
511 WorkList.push_back(TheTy);
512 }
513 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
514 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
515 const Type* TheTy = StrTy->getElementType(i);
516 if (TheTy->isAbstract() && TheTy != Ty) {
517 std::vector<const Type*>::iterator I = SeenList.begin(),
518 E = SeenList.end();
519 for ( ; I != E; ++I)
520 if (*I == TheTy)
521 break;
522 if (I == E)
523 WorkList.push_back(TheTy);
524 }
525 }
526 }
527 }
528 return false;
529 }
530
531
Reid Spencer68a24bd2005-08-27 18:50:39 +0000532} CurModule;
533
534static struct PerFunctionInfo {
535 Function *CurrentFunction; // Pointer to current function being created
536
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000537 std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
Reid Spencer68a24bd2005-08-27 18:50:39 +0000538 std::map<const Type*, ValueList> LateResolveValues;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000539 bool isDeclare; // Is this function a forward declararation?
540 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
Reid Spencer68a24bd2005-08-27 18:50:39 +0000541
542 /// BBForwardRefs - When we see forward references to basic blocks, keep
543 /// track of them here.
544 std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs;
545 std::vector<BasicBlock*> NumberedBlocks;
546 unsigned NextBBNum;
547
548 inline PerFunctionInfo() {
549 CurrentFunction = 0;
550 isDeclare = false;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000551 Linkage = GlobalValue::ExternalLinkage;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000552 }
553
554 inline void FunctionStart(Function *M) {
555 CurrentFunction = M;
556 NextBBNum = 0;
557 }
558
559 void FunctionDone() {
560 NumberedBlocks.clear();
561
562 // Any forward referenced blocks left?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000563 if (!BBForwardRefs.empty()) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000564 GenerateError("Undefined reference to label " +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000565 BBForwardRefs.begin()->first->getName());
Reid Spencer5b7e7532006-09-28 19:28:24 +0000566 return;
567 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000568
569 // Resolve all forward references now.
570 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
571
572 Values.clear(); // Clear out function local definitions
573 CurrentFunction = 0;
574 isDeclare = false;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000575 Linkage = GlobalValue::ExternalLinkage;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000576 }
577} CurFun; // Info for the current function...
578
579static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
580
581
582//===----------------------------------------------------------------------===//
583// Code to handle definitions of all the types
584//===----------------------------------------------------------------------===//
585
586static int InsertValue(Value *V,
587 std::map<const Type*,ValueList> &ValueTab = CurFun.Values) {
588 if (V->hasName()) return -1; // Is this a numbered definition?
589
590 // Yes, insert the value into the value table...
591 ValueList &List = ValueTab[V->getType()];
592 List.push_back(V);
593 return List.size()-1;
594}
595
596static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
597 switch (D.Type) {
598 case ValID::NumberVal: // Is it a numbered definition?
599 // Module constants occupy the lowest numbered slots...
600 if ((unsigned)D.Num < CurModule.Types.size())
Reid Spencer861d9d62006-11-28 07:29:44 +0000601 return CurModule.Types[(unsigned)D.Num];
Reid Spencer68a24bd2005-08-27 18:50:39 +0000602 break;
603 case ValID::NameVal: // Is it a named definition?
604 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
605 D.destroy(); // Free old strdup'd memory...
606 return N;
607 }
608 break;
609 default:
Reid Spencer61c83e02006-08-18 08:43:06 +0000610 GenerateError("Internal parser error: Invalid symbol type reference!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000611 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000612 }
613
614 // If we reached here, we referenced either a symbol that we don't know about
615 // or an id number that hasn't been read yet. We may be referencing something
616 // forward, so just create an entry to be resolved later and get to it...
617 //
618 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
619
620
621 if (inFunctionScope()) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000622 if (D.Type == ValID::NameVal) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000623 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000624 return 0;
625 } else {
Reid Spencer61c83e02006-08-18 08:43:06 +0000626 GenerateError("Reference to an undefined type: #" + itostr(D.Num));
Reid Spencer5b7e7532006-09-28 19:28:24 +0000627 return 0;
628 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000629 }
630
Reid Spencer861d9d62006-11-28 07:29:44 +0000631 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000632 if (I != CurModule.LateResolveTypes.end())
Reid Spencer861d9d62006-11-28 07:29:44 +0000633 return I->second;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000634
Reid Spencer861d9d62006-11-28 07:29:44 +0000635 Type *Typ = OpaqueType::get();
636 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
637 return Typ;
Reid Spencera132e042006-12-03 05:46:11 +0000638 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000639
640static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) {
641 SymbolTable &SymTab =
642 inFunctionScope() ? CurFun.CurrentFunction->getSymbolTable() :
643 CurModule.CurrentModule->getSymbolTable();
644 return SymTab.lookup(Ty, Name);
645}
646
647// getValNonImprovising - Look up the value specified by the provided type and
648// the provided ValID. If the value exists and has already been defined, return
649// it. Otherwise return null.
650//
651static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000652 if (isa<FunctionType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000653 GenerateError("Functions are not values and "
Reid Spencer68a24bd2005-08-27 18:50:39 +0000654 "must be referenced as pointers");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000655 return 0;
656 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000657
658 switch (D.Type) {
659 case ValID::NumberVal: { // Is it a numbered definition?
660 unsigned Num = (unsigned)D.Num;
661
662 // Module constants occupy the lowest numbered slots...
663 std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
664 if (VI != CurModule.Values.end()) {
665 if (Num < VI->second.size())
666 return VI->second[Num];
667 Num -= VI->second.size();
668 }
669
670 // Make sure that our type is within bounds
671 VI = CurFun.Values.find(Ty);
672 if (VI == CurFun.Values.end()) return 0;
673
674 // Check that the number is within bounds...
675 if (VI->second.size() <= Num) return 0;
676
677 return VI->second[Num];
678 }
679
680 case ValID::NameVal: { // Is it a named definition?
681 Value *N = lookupInSymbolTable(Ty, std::string(D.Name));
682 if (N == 0) return 0;
683
684 D.destroy(); // Free old strdup'd memory...
685 return N;
686 }
687
688 // Check to make sure that "Ty" is an integral type, and that our
689 // value will fit into the specified type...
690 case ValID::ConstSIntVal: // Is it a constant pool reference??
Reid Spencerb83eb642006-10-20 07:07:24 +0000691 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000692 GenerateError("Signed integral constant '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000693 itostr(D.ConstPool64) + "' is invalid for type '" +
694 Ty->getDescription() + "'!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000695 return 0;
696 }
Reid Spencerb83eb642006-10-20 07:07:24 +0000697 return ConstantInt::get(Ty, D.ConstPool64);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000698
699 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
Reid Spencerb83eb642006-10-20 07:07:24 +0000700 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
701 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000702 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000703 "' is invalid or out of range!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000704 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000705 } else { // This is really a signed reference. Transmogrify.
Reid Spencerb83eb642006-10-20 07:07:24 +0000706 return ConstantInt::get(Ty, D.ConstPool64);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000707 }
708 } else {
Reid Spencerb83eb642006-10-20 07:07:24 +0000709 return ConstantInt::get(Ty, D.UConstPool64);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000710 }
711
712 case ValID::ConstFPVal: // Is it a floating point const pool reference?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000713 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000714 GenerateError("FP constant invalid for type!!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000715 return 0;
716 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000717 return ConstantFP::get(Ty, D.ConstPoolFP);
718
719 case ValID::ConstNullVal: // Is it a null value?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000720 if (!isa<PointerType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000721 GenerateError("Cannot create a a non pointer null!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000722 return 0;
723 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000724 return ConstantPointerNull::get(cast<PointerType>(Ty));
725
726 case ValID::ConstUndefVal: // Is it an undef value?
727 return UndefValue::get(Ty);
728
Chris Lattner7aa61892005-12-21 17:53:23 +0000729 case ValID::ConstZeroVal: // Is it a zero value?
730 return Constant::getNullValue(Ty);
731
Reid Spencer68a24bd2005-08-27 18:50:39 +0000732 case ValID::ConstantVal: // Fully resolved constant?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000733 if (D.ConstantValue->getType() != Ty) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000734 GenerateError("Constant expression type different from required type!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000735 return 0;
736 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000737 return D.ConstantValue;
738
Chris Lattner0e9c3762006-01-25 22:27:16 +0000739 case ValID::InlineAsmVal: { // Inline asm expression
740 const PointerType *PTy = dyn_cast<PointerType>(Ty);
741 const FunctionType *FTy =
742 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000743 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000744 GenerateError("Invalid type for asm constraint string!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000745 return 0;
746 }
Chris Lattner0e9c3762006-01-25 22:27:16 +0000747 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
748 D.IAD->HasSideEffects);
749 D.destroy(); // Free InlineAsmDescriptor.
750 return IA;
751 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000752 default:
753 assert(0 && "Unhandled case!");
754 return 0;
755 } // End of switch
756
757 assert(0 && "Unhandled case!");
758 return 0;
759}
760
761// getVal - This function is identical to getValNonImprovising, except that if a
762// value is not already defined, it "improvises" by creating a placeholder var
763// that looks and acts just like the requested variable. When the value is
764// defined later, all uses of the placeholder variable are replaced with the
765// real thing.
766//
767static Value *getVal(const Type *Ty, const ValID &ID) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000768 if (Ty == Type::LabelTy) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000769 GenerateError("Cannot use a basic block here");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000770 return 0;
771 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000772
773 // See if the value has already been defined.
774 Value *V = getValNonImprovising(Ty, ID);
775 if (V) return V;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000776 if (TriggerError) return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000777
Reid Spencer5b7e7532006-09-28 19:28:24 +0000778 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000779 GenerateError("Invalid use of a composite type!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000780 return 0;
781 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000782
783 // If we reached here, we referenced either a symbol that we don't know about
784 // or an id number that hasn't been read yet. We may be referencing something
785 // forward, so just create an entry to be resolved later and get to it...
786 //
787 V = new Argument(Ty);
788
789 // Remember where this forward reference came from. FIXME, shouldn't we try
790 // to recycle these things??
791 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
792 llvmAsmlineno)));
793
794 if (inFunctionScope())
795 InsertValue(V, CurFun.LateResolveValues);
796 else
797 InsertValue(V, CurModule.LateResolveValues);
798 return V;
799}
800
801/// getBBVal - This is used for two purposes:
802/// * If isDefinition is true, a new basic block with the specified ID is being
803/// defined.
804/// * If isDefinition is true, this is a reference to a basic block, which may
805/// or may not be a forward reference.
806///
807static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
808 assert(inFunctionScope() && "Can't get basic block at global scope!");
809
810 std::string Name;
811 BasicBlock *BB = 0;
812 switch (ID.Type) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000813 default:
814 GenerateError("Illegal label reference " + ID.getName());
815 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000816 case ValID::NumberVal: // Is it a numbered definition?
817 if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size())
818 CurFun.NumberedBlocks.resize(ID.Num+1);
819 BB = CurFun.NumberedBlocks[ID.Num];
820 break;
821 case ValID::NameVal: // Is it a named definition?
822 Name = ID.Name;
823 if (Value *N = CurFun.CurrentFunction->
824 getSymbolTable().lookup(Type::LabelTy, Name))
825 BB = cast<BasicBlock>(N);
826 break;
827 }
828
829 // See if the block has already been defined.
830 if (BB) {
831 // If this is the definition of the block, make sure the existing value was
832 // just a forward reference. If it was a forward reference, there will be
833 // an entry for it in the PlaceHolderInfo map.
Reid Spencer5b7e7532006-09-28 19:28:24 +0000834 if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000835 // The existing value was a definition, not a forward reference.
Reid Spencer61c83e02006-08-18 08:43:06 +0000836 GenerateError("Redefinition of label " + ID.getName());
Reid Spencer5b7e7532006-09-28 19:28:24 +0000837 return 0;
838 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000839
840 ID.destroy(); // Free strdup'd memory.
841 return BB;
842 }
843
844 // Otherwise this block has not been seen before.
845 BB = new BasicBlock("", CurFun.CurrentFunction);
846 if (ID.Type == ValID::NameVal) {
847 BB->setName(ID.Name);
848 } else {
849 CurFun.NumberedBlocks[ID.Num] = BB;
850 }
851
852 // If this is not a definition, keep track of it so we can use it as a forward
853 // reference.
854 if (!isDefinition) {
855 // Remember where this forward reference came from.
856 CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno);
857 } else {
858 // The forward declaration could have been inserted anywhere in the
859 // function: insert it into the correct place now.
860 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
861 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
862 }
863 ID.destroy();
864 return BB;
865}
866
867
868//===----------------------------------------------------------------------===//
869// Code to handle forward references in instructions
870//===----------------------------------------------------------------------===//
871//
872// This code handles the late binding needed with statements that reference
873// values not defined yet... for example, a forward branch, or the PHI node for
874// a loop body.
875//
876// This keeps a table (CurFun.LateResolveValues) of all such forward references
877// and back patchs after we are done.
878//
879
880// ResolveDefinitions - If we could not resolve some defs at parsing
881// time (forward branches, phi functions for loops, etc...) resolve the
882// defs now...
883//
884static void
885ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
886 std::map<const Type*,ValueList> *FutureLateResolvers) {
887 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
888 for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(),
889 E = LateResolvers.end(); LRI != E; ++LRI) {
890 ValueList &List = LRI->second;
891 while (!List.empty()) {
892 Value *V = List.back();
893 List.pop_back();
894
895 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
896 CurModule.PlaceHolderInfo.find(V);
897 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
898
899 ValID &DID = PHI->second.first;
900
901 Value *TheRealValue = getValNonImprovising(LRI->first, DID);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000902 if (TriggerError)
903 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000904 if (TheRealValue) {
905 V->replaceAllUsesWith(TheRealValue);
906 delete V;
907 CurModule.PlaceHolderInfo.erase(PHI);
908 } else if (FutureLateResolvers) {
909 // Functions have their unresolved items forwarded to the module late
910 // resolver table
911 InsertValue(V, *FutureLateResolvers);
912 } else {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000913 if (DID.Type == ValID::NameVal) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000914 GenerateError("Reference to an invalid definition: '" +DID.getName()+
Reid Spencer68a24bd2005-08-27 18:50:39 +0000915 "' of type '" + V->getType()->getDescription() + "'",
916 PHI->second.second);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000917 return;
918 } else {
Reid Spencer61c83e02006-08-18 08:43:06 +0000919 GenerateError("Reference to an invalid definition: #" +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000920 itostr(DID.Num) + " of type '" +
921 V->getType()->getDescription() + "'",
922 PHI->second.second);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000923 return;
924 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000925 }
926 }
927 }
928
929 LateResolvers.clear();
930}
931
932// ResolveTypeTo - A brand new type was just declared. This means that (if
933// name is not null) things referencing Name can be resolved. Otherwise, things
934// refering to the number can be resolved. Do this now.
935//
936static void ResolveTypeTo(char *Name, const Type *ToTy) {
937 ValID D;
938 if (Name) D = ValID::create(Name);
939 else D = ValID::create((int)CurModule.Types.size());
940
Reid Spencer861d9d62006-11-28 07:29:44 +0000941 std::map<ValID, PATypeHolder>::iterator I =
Reid Spencer68a24bd2005-08-27 18:50:39 +0000942 CurModule.LateResolveTypes.find(D);
943 if (I != CurModule.LateResolveTypes.end()) {
Reid Spencer861d9d62006-11-28 07:29:44 +0000944 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000945 CurModule.LateResolveTypes.erase(I);
946 }
947}
948
949// setValueName - Set the specified value to the name given. The name may be
950// null potentially, in which case this is a noop. The string passed in is
951// assumed to be a malloc'd string buffer, and is free'd by this function.
952//
953static void setValueName(Value *V, char *NameStr) {
954 if (NameStr) {
955 std::string Name(NameStr); // Copy string
956 free(NameStr); // Free old string
957
Reid Spencer5b7e7532006-09-28 19:28:24 +0000958 if (V->getType() == Type::VoidTy) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000959 GenerateError("Can't assign name '" + Name+"' to value with void type!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000960 return;
961 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000962
963 assert(inFunctionScope() && "Must be in function scope!");
964 SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable();
Reid Spencer5b7e7532006-09-28 19:28:24 +0000965 if (ST.lookup(V->getType(), Name)) {
Reid Spencer63c34452007-01-05 21:51:07 +0000966 GenerateError("Redefinition of value '" + Name + "' of type '" +
967 V->getType()->getDescription() + "'!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000968 return;
969 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000970
971 // Set the name.
972 V->setName(Name);
973 }
974}
975
976/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
977/// this is a declaration, otherwise it is a definition.
Chris Lattnerb475c422005-11-12 18:22:38 +0000978static GlobalVariable *
979ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage,
980 bool isConstantGlobal, const Type *Ty,
981 Constant *Initializer) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000982 if (isa<FunctionType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000983 GenerateError("Cannot declare global vars of function type!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000984 return 0;
985 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000986
987 const PointerType *PTy = PointerType::get(Ty);
988
989 std::string Name;
990 if (NameStr) {
991 Name = NameStr; // Copy string
992 free(NameStr); // Free old string
993 }
994
995 // See if this global value was forward referenced. If so, recycle the
996 // object.
997 ValID ID;
998 if (!Name.empty()) {
999 ID = ValID::create((char*)Name.c_str());
1000 } else {
1001 ID = ValID::create((int)CurModule.Values[PTy].size());
1002 }
1003
1004 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1005 // Move the global to the end of the list, from whereever it was
1006 // previously inserted.
1007 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1008 CurModule.CurrentModule->getGlobalList().remove(GV);
1009 CurModule.CurrentModule->getGlobalList().push_back(GV);
1010 GV->setInitializer(Initializer);
1011 GV->setLinkage(Linkage);
1012 GV->setConstant(isConstantGlobal);
1013 InsertValue(GV, CurModule.Values);
Chris Lattnerb475c422005-11-12 18:22:38 +00001014 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001015 }
1016
1017 // If this global has a name, check to see if there is already a definition
Reid Spencer63c34452007-01-05 21:51:07 +00001018 // of this global in the module. If so, it is an error.
Reid Spencer68a24bd2005-08-27 18:50:39 +00001019 if (!Name.empty()) {
1020 // We are a simple redefinition of a value, check to see if it is defined
1021 // the same as the old one.
Reid Spencer63c34452007-01-05 21:51:07 +00001022 if (CurModule.CurrentModule->getGlobalVariable(Name, Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +00001023 GenerateError("Redefinition of global variable named '" + Name +
Reid Spencer63c34452007-01-05 21:51:07 +00001024 "' of type '" + Ty->getDescription() + "'!");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001025 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001026 }
1027 }
1028
1029 // Otherwise there is no existing GV to use, create one now.
1030 GlobalVariable *GV =
1031 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1032 CurModule.CurrentModule);
1033 InsertValue(GV, CurModule.Values);
Chris Lattnerb475c422005-11-12 18:22:38 +00001034 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001035}
1036
1037// setTypeName - Set the specified type to the name given. The name may be
1038// null potentially, in which case this is a noop. The string passed in is
1039// assumed to be a malloc'd string buffer, and is freed by this function.
1040//
1041// This function returns true if the type has already been defined, but is
1042// allowed to be redefined in the specified context. If the name is a new name
1043// for the type plane, it is inserted and false is returned.
1044static bool setTypeName(const Type *T, char *NameStr) {
1045 assert(!inFunctionScope() && "Can't give types function-local names!");
1046 if (NameStr == 0) return false;
1047
1048 std::string Name(NameStr); // Copy string
1049 free(NameStr); // Free old string
1050
1051 // We don't allow assigning names to void type
Reid Spencer5b7e7532006-09-28 19:28:24 +00001052 if (T == Type::VoidTy) {
Reid Spencer61c83e02006-08-18 08:43:06 +00001053 GenerateError("Can't assign name '" + Name + "' to the void type!");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001054 return false;
1055 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001056
1057 // Set the type name, checking for conflicts as we do so.
1058 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1059
1060 if (AlreadyExists) { // Inserting a name that is already defined???
1061 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1062 assert(Existing && "Conflict but no matching type?");
1063
1064 // There is only one case where this is allowed: when we are refining an
1065 // opaque type. In this case, Existing will be an opaque type.
1066 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1067 // We ARE replacing an opaque type!
1068 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1069 return true;
1070 }
1071
1072 // Otherwise, this is an attempt to redefine a type. That's okay if
1073 // the redefinition is identical to the original. This will be so if
1074 // Existing and T point to the same Type object. In this one case we
1075 // allow the equivalent redefinition.
1076 if (Existing == T) return true; // Yes, it's equal.
1077
1078 // Any other kind of (non-equivalent) redefinition is an error.
Reid Spencer63c34452007-01-05 21:51:07 +00001079 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1080 T->getDescription() + "'!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001081 }
1082
1083 return false;
1084}
1085
1086//===----------------------------------------------------------------------===//
1087// Code for handling upreferences in type names...
1088//
1089
1090// TypeContains - Returns true if Ty directly contains E in it.
1091//
1092static bool TypeContains(const Type *Ty, const Type *E) {
1093 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1094 E) != Ty->subtype_end();
1095}
1096
1097namespace {
1098 struct UpRefRecord {
1099 // NestingLevel - The number of nesting levels that need to be popped before
1100 // this type is resolved.
1101 unsigned NestingLevel;
1102
1103 // LastContainedTy - This is the type at the current binding level for the
1104 // type. Every time we reduce the nesting level, this gets updated.
1105 const Type *LastContainedTy;
1106
1107 // UpRefTy - This is the actual opaque type that the upreference is
1108 // represented with.
1109 OpaqueType *UpRefTy;
1110
1111 UpRefRecord(unsigned NL, OpaqueType *URTy)
1112 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1113 };
1114}
1115
1116// UpRefs - A list of the outstanding upreferences that need to be resolved.
1117static std::vector<UpRefRecord> UpRefs;
1118
1119/// HandleUpRefs - Every time we finish a new layer of types, this function is
1120/// called. It loops through the UpRefs vector, which is a list of the
1121/// currently active types. For each type, if the up reference is contained in
1122/// the newly completed type, we decrement the level count. When the level
1123/// count reaches zero, the upreferenced type is the type that is passed in:
1124/// thus we can complete the cycle.
1125///
1126static PATypeHolder HandleUpRefs(const Type *ty) {
Chris Lattner224f84f2006-08-18 17:34:45 +00001127 // If Ty isn't abstract, or if there are no up-references in it, then there is
1128 // nothing to resolve here.
1129 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1130
Reid Spencer68a24bd2005-08-27 18:50:39 +00001131 PATypeHolder Ty(ty);
1132 UR_OUT("Type '" << Ty->getDescription() <<
1133 "' newly formed. Resolving upreferences.\n" <<
1134 UpRefs.size() << " upreferences active!\n");
1135
1136 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1137 // to zero), we resolve them all together before we resolve them to Ty. At
1138 // the end of the loop, if there is anything to resolve to Ty, it will be in
1139 // this variable.
1140 OpaqueType *TypeToResolve = 0;
1141
1142 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1143 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1144 << UpRefs[i].second->getDescription() << ") = "
1145 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1146 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1147 // Decrement level of upreference
1148 unsigned Level = --UpRefs[i].NestingLevel;
1149 UpRefs[i].LastContainedTy = Ty;
1150 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1151 if (Level == 0) { // Upreference should be resolved!
1152 if (!TypeToResolve) {
1153 TypeToResolve = UpRefs[i].UpRefTy;
1154 } else {
1155 UR_OUT(" * Resolving upreference for "
1156 << UpRefs[i].second->getDescription() << "\n";
1157 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1158 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1159 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1160 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1161 }
1162 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1163 --i; // Do not skip the next element...
1164 }
1165 }
1166 }
1167
1168 if (TypeToResolve) {
1169 UR_OUT(" * Resolving upreference for "
1170 << UpRefs[i].second->getDescription() << "\n";
1171 std::string OldName = TypeToResolve->getDescription());
1172 TypeToResolve->refineAbstractTypeTo(Ty);
1173 }
1174
1175 return Ty;
1176}
1177
Reid Spencer68a24bd2005-08-27 18:50:39 +00001178//===----------------------------------------------------------------------===//
1179// RunVMAsmParser - Define an interface to this parser
1180//===----------------------------------------------------------------------===//
1181//
Reid Spencer14310612006-12-31 05:40:51 +00001182static Module* RunParser(Module * M);
1183
Reid Spencer68a24bd2005-08-27 18:50:39 +00001184Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1185 set_scan_file(F);
1186
1187 CurFilename = Filename;
1188 return RunParser(new Module(CurFilename));
1189}
1190
1191Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1192 set_scan_string(AsmString);
1193
1194 CurFilename = "from_memory";
1195 if (M == NULL) {
1196 return RunParser(new Module (CurFilename));
1197 } else {
1198 return RunParser(M);
1199 }
1200}
1201
1202
Reid Spencer3822ff52006-11-08 06:47:33 +00001203
1204/* Enabling traces. */
1205#ifndef YYDEBUG
1206# define YYDEBUG 0
1207#endif
1208
1209/* Enabling verbose error messages. */
1210#ifdef YYERROR_VERBOSE
1211# undef YYERROR_VERBOSE
1212# define YYERROR_VERBOSE 1
1213#else
1214# define YYERROR_VERBOSE 0
1215#endif
1216
Reid Spencere4d87aa2006-12-23 06:05:41 +00001217/* Enabling the token table. */
1218#ifndef YYTOKEN_TABLE
1219# define YYTOKEN_TABLE 0
1220#endif
1221
Andrew Lenharth6353e052006-12-08 18:07:09 +00001222#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
Reid Spencer63c34452007-01-05 21:51:07 +00001223#line 876 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00001224typedef union YYSTYPE {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001225 llvm::Module *ModuleVal;
1226 llvm::Function *FunctionVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001227 llvm::BasicBlock *BasicBlockVal;
1228 llvm::TerminatorInst *TermInstVal;
1229 llvm::Instruction *InstVal;
Reid Spencera132e042006-12-03 05:46:11 +00001230 llvm::Constant *ConstVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001231
Reid Spencera132e042006-12-03 05:46:11 +00001232 const llvm::Type *PrimType;
Reid Spencer14310612006-12-31 05:40:51 +00001233 std::list<llvm::PATypeHolder> *TypeList;
Reid Spencera132e042006-12-03 05:46:11 +00001234 llvm::PATypeHolder *TypeVal;
1235 llvm::Value *ValueVal;
Reid Spencera132e042006-12-03 05:46:11 +00001236 std::vector<llvm::Value*> *ValueList;
Reid Spencer14310612006-12-31 05:40:51 +00001237 llvm::ArgListType *ArgList;
1238 llvm::TypeWithAttrs TypeWithAttrs;
1239 llvm::TypeWithAttrsList *TypeWithAttrsList;
1240 llvm::ValueRefList *ValueRefList;
1241
Reid Spencer68a24bd2005-08-27 18:50:39 +00001242 // Represent the RHS of PHI node
Reid Spencera132e042006-12-03 05:46:11 +00001243 std::list<std::pair<llvm::Value*,
1244 llvm::BasicBlock*> > *PHIList;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001245 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
Reid Spencera132e042006-12-03 05:46:11 +00001246 std::vector<llvm::Constant*> *ConstVector;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001247
1248 llvm::GlobalValue::LinkageTypes Linkage;
Reid Spencer14310612006-12-31 05:40:51 +00001249 llvm::FunctionType::ParameterAttributes ParamAttrs;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001250 int64_t SInt64Val;
1251 uint64_t UInt64Val;
1252 int SIntVal;
1253 unsigned UIntVal;
1254 double FPVal;
1255 bool BoolVal;
1256
1257 char *StrVal; // This memory is strdup'd!
Reid Spencer1628cec2006-10-26 06:15:43 +00001258 llvm::ValID ValIDVal; // strdup'd memory maybe!
Reid Spencer68a24bd2005-08-27 18:50:39 +00001259
Reid Spencera132e042006-12-03 05:46:11 +00001260 llvm::Instruction::BinaryOps BinaryOpVal;
1261 llvm::Instruction::TermOps TermOpVal;
1262 llvm::Instruction::MemoryOps MemOpVal;
1263 llvm::Instruction::CastOps CastOpVal;
1264 llvm::Instruction::OtherOps OtherOpVal;
Reid Spencer1628cec2006-10-26 06:15:43 +00001265 llvm::Module::Endianness Endianness;
Reid Spencera132e042006-12-03 05:46:11 +00001266 llvm::ICmpInst::Predicate IPredicate;
1267 llvm::FCmpInst::Predicate FPredicate;
Andrew Lenharth6353e052006-12-08 18:07:09 +00001268} YYSTYPE;
Reid Spencere4d87aa2006-12-23 06:05:41 +00001269/* Line 196 of yacc.c. */
Reid Spencer63c34452007-01-05 21:51:07 +00001270#line 1271 "llvmAsmParser.tab.c"
Reid Spencer3822ff52006-11-08 06:47:33 +00001271# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1272# define YYSTYPE_IS_DECLARED 1
1273# define YYSTYPE_IS_TRIVIAL 1
Reid Spencer68a24bd2005-08-27 18:50:39 +00001274#endif
1275
1276
1277
Reid Spencer3822ff52006-11-08 06:47:33 +00001278/* Copy the second part of user declarations. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001279
1280
Reid Spencere4d87aa2006-12-23 06:05:41 +00001281/* Line 219 of yacc.c. */
Reid Spencer63c34452007-01-05 21:51:07 +00001282#line 1283 "llvmAsmParser.tab.c"
Reid Spencere4d87aa2006-12-23 06:05:41 +00001283
1284#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1285# define YYSIZE_T __SIZE_TYPE__
1286#endif
1287#if ! defined (YYSIZE_T) && defined (size_t)
1288# define YYSIZE_T size_t
1289#endif
1290#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1291# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1292# define YYSIZE_T size_t
1293#endif
1294#if ! defined (YYSIZE_T)
1295# define YYSIZE_T unsigned int
1296#endif
1297
1298#ifndef YY_
1299# if YYENABLE_NLS
1300# if ENABLE_NLS
1301# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1302# define YY_(msgid) dgettext ("bison-runtime", msgid)
1303# endif
1304# endif
1305# ifndef YY_
1306# define YY_(msgid) msgid
1307# endif
1308#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00001309
Andrew Lenharth6353e052006-12-08 18:07:09 +00001310#if ! defined (yyoverflow) || YYERROR_VERBOSE
Bill Wendlinge8156192006-12-07 01:30:32 +00001311
Reid Spencer3822ff52006-11-08 06:47:33 +00001312/* The parser invokes alloca or malloc; define the necessary symbols. */
1313
1314# ifdef YYSTACK_USE_ALLOCA
1315# if YYSTACK_USE_ALLOCA
1316# ifdef __GNUC__
1317# define YYSTACK_ALLOC __builtin_alloca
Reid Spencere4d87aa2006-12-23 06:05:41 +00001318# else
1319# define YYSTACK_ALLOC alloca
1320# if defined (__STDC__) || defined (__cplusplus)
1321# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1322# define YYINCLUDED_STDLIB_H
1323# endif
Reid Spencer3822ff52006-11-08 06:47:33 +00001324# endif
1325# endif
1326# endif
1327
1328# ifdef YYSTACK_ALLOC
Andrew Lenharth6353e052006-12-08 18:07:09 +00001329 /* Pacify GCC's `empty if-body' warning. */
1330# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
Reid Spencere4d87aa2006-12-23 06:05:41 +00001331# ifndef YYSTACK_ALLOC_MAXIMUM
1332 /* The OS might guarantee only one guard page at the bottom of the stack,
1333 and a page size can be as small as 4096 bytes. So we cannot safely
1334 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1335 to allow for a few compiler-allocated temporary stack slots. */
1336# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
Andrew Lenharth6353e052006-12-08 18:07:09 +00001337# endif
Reid Spencere4d87aa2006-12-23 06:05:41 +00001338# else
Reid Spencer3822ff52006-11-08 06:47:33 +00001339# define YYSTACK_ALLOC YYMALLOC
1340# define YYSTACK_FREE YYFREE
Reid Spencere4d87aa2006-12-23 06:05:41 +00001341# ifndef YYSTACK_ALLOC_MAXIMUM
1342# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
1343# endif
1344# ifdef __cplusplus
1345extern "C" {
1346# endif
1347# ifndef YYMALLOC
1348# define YYMALLOC malloc
1349# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1350 && (defined (__STDC__) || defined (__cplusplus)))
1351void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1352# endif
1353# endif
1354# ifndef YYFREE
1355# define YYFREE free
1356# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1357 && (defined (__STDC__) || defined (__cplusplus)))
1358void free (void *); /* INFRINGES ON USER NAME SPACE */
1359# endif
1360# endif
1361# ifdef __cplusplus
1362}
1363# endif
Reid Spencer3822ff52006-11-08 06:47:33 +00001364# endif
Andrew Lenharth6353e052006-12-08 18:07:09 +00001365#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
Reid Spencer3822ff52006-11-08 06:47:33 +00001366
1367
Andrew Lenharth6353e052006-12-08 18:07:09 +00001368#if (! defined (yyoverflow) \
1369 && (! defined (__cplusplus) \
1370 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
Reid Spencer3822ff52006-11-08 06:47:33 +00001371
1372/* A type that is properly aligned for any stack member. */
1373union yyalloc
1374{
Reid Spencere4d87aa2006-12-23 06:05:41 +00001375 short int yyss;
Reid Spencer3822ff52006-11-08 06:47:33 +00001376 YYSTYPE yyvs;
1377 };
1378
1379/* The size of the maximum gap between one aligned stack and the next. */
1380# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1381
1382/* The size of an array large to enough to hold all stacks, each with
1383 N elements. */
1384# define YYSTACK_BYTES(N) \
Reid Spencere4d87aa2006-12-23 06:05:41 +00001385 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
Reid Spencer3822ff52006-11-08 06:47:33 +00001386 + YYSTACK_GAP_MAXIMUM)
1387
1388/* Copy COUNT objects from FROM to TO. The source and destination do
1389 not overlap. */
1390# ifndef YYCOPY
Andrew Lenharth6353e052006-12-08 18:07:09 +00001391# if defined (__GNUC__) && 1 < __GNUC__
Reid Spencer3822ff52006-11-08 06:47:33 +00001392# define YYCOPY(To, From, Count) \
1393 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1394# else
1395# define YYCOPY(To, From, Count) \
1396 do \
1397 { \
Reid Spencere4d87aa2006-12-23 06:05:41 +00001398 YYSIZE_T yyi; \
Reid Spencer3822ff52006-11-08 06:47:33 +00001399 for (yyi = 0; yyi < (Count); yyi++) \
1400 (To)[yyi] = (From)[yyi]; \
1401 } \
Andrew Lenharth6353e052006-12-08 18:07:09 +00001402 while (0)
Reid Spencer3822ff52006-11-08 06:47:33 +00001403# endif
1404# endif
1405
1406/* Relocate STACK from its old location to the new one. The
1407 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1408 elements in the stack, and YYPTR gives the new location of the
1409 stack. Advance YYPTR to a properly aligned location for the next
1410 stack. */
1411# define YYSTACK_RELOCATE(Stack) \
1412 do \
1413 { \
1414 YYSIZE_T yynewbytes; \
1415 YYCOPY (&yyptr->Stack, Stack, yysize); \
1416 Stack = &yyptr->Stack; \
1417 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1418 yyptr += yynewbytes / sizeof (*yyptr); \
1419 } \
Andrew Lenharth6353e052006-12-08 18:07:09 +00001420 while (0)
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +00001421
1422#endif
1423
Andrew Lenharth6353e052006-12-08 18:07:09 +00001424#if defined (__STDC__) || defined (__cplusplus)
1425 typedef signed char yysigned_char;
1426#else
Reid Spencere4d87aa2006-12-23 06:05:41 +00001427 typedef short int yysigned_char;
Andrew Lenharth6353e052006-12-08 18:07:09 +00001428#endif
1429
1430/* YYFINAL -- State number of the termination state. */
Reid Spencer6fd36ab2006-12-29 20:35:03 +00001431#define YYFINAL 37
Reid Spencer3822ff52006-11-08 06:47:33 +00001432/* YYLAST -- Last index in YYTABLE. */
Reid Spencer218ded22007-01-05 17:07:23 +00001433#define YYLAST 1405
Reid Spencer3822ff52006-11-08 06:47:33 +00001434
Andrew Lenharth6353e052006-12-08 18:07:09 +00001435/* YYNTOKENS -- Number of terminals. */
Reid Spencer14310612006-12-31 05:40:51 +00001436#define YYNTOKENS 150
Andrew Lenharth6353e052006-12-08 18:07:09 +00001437/* YYNNTS -- Number of nonterminals. */
Reid Spencer218ded22007-01-05 17:07:23 +00001438#define YYNNTS 78
Andrew Lenharth6353e052006-12-08 18:07:09 +00001439/* YYNRULES -- Number of rules. */
Reid Spencer218ded22007-01-05 17:07:23 +00001440#define YYNRULES 289
Andrew Lenharth6353e052006-12-08 18:07:09 +00001441/* YYNRULES -- Number of states. */
Reid Spencer218ded22007-01-05 17:07:23 +00001442#define YYNSTATES 569
Reid Spencer3822ff52006-11-08 06:47:33 +00001443
1444/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1445#define YYUNDEFTOK 2
Reid Spencer218ded22007-01-05 17:07:23 +00001446#define YYMAXUTOK 390
Reid Spencer3822ff52006-11-08 06:47:33 +00001447
Reid Spencere4d87aa2006-12-23 06:05:41 +00001448#define YYTRANSLATE(YYX) \
Reid Spencer3822ff52006-11-08 06:47:33 +00001449 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1450
1451/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
Andrew Lenharth6353e052006-12-08 18:07:09 +00001452static const unsigned char yytranslate[] =
Reid Spencer3822ff52006-11-08 06:47:33 +00001453{
1454 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1455 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1456 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1457 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Reid Spencer218ded22007-01-05 17:07:23 +00001458 140, 141, 138, 2, 137, 2, 2, 2, 2, 2,
Reid Spencer3822ff52006-11-08 06:47:33 +00001459 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Reid Spencer218ded22007-01-05 17:07:23 +00001460 145, 136, 146, 2, 2, 2, 2, 2, 2, 2,
Reid Spencer3822ff52006-11-08 06:47:33 +00001461 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1462 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Reid Spencer218ded22007-01-05 17:07:23 +00001463 2, 142, 139, 144, 2, 2, 2, 2, 2, 149,
Reid Spencer3822ff52006-11-08 06:47:33 +00001464 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1465 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Reid Spencer14310612006-12-31 05:40:51 +00001466 143, 2, 2, 147, 2, 148, 2, 2, 2, 2,
Reid Spencer3822ff52006-11-08 06:47:33 +00001467 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1468 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1469 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1470 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1471 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1472 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1473 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1474 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1475 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1476 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1477 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1478 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1479 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1480 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1481 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1482 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1483 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1484 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1485 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1486 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1487 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1488 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1489 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
Reid Spencer3da59db2006-11-27 01:05:10 +00001490 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
Reid Spencera132e042006-12-03 05:46:11 +00001491 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
Reid Spencer218ded22007-01-05 17:07:23 +00001492 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1493 135
Reid Spencer3822ff52006-11-08 06:47:33 +00001494};
1495
1496#if YYDEBUG
1497/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1498 YYRHS. */
Reid Spencere4d87aa2006-12-23 06:05:41 +00001499static const unsigned short int yyprhs[] =
Reid Spencer3822ff52006-11-08 06:47:33 +00001500{
1501 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1502 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1503 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1504 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
Reid Spencer3da59db2006-11-27 01:05:10 +00001505 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
Reid Spencera132e042006-12-03 05:46:11 +00001506 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
Reid Spencer14310612006-12-31 05:40:51 +00001507 119, 121, 123, 125, 128, 129, 131, 133, 135, 137,
1508 139, 141, 143, 145, 146, 148, 150, 151, 153, 155,
1509 157, 159, 160, 162, 164, 166, 168, 170, 172, 175,
Reid Spencer218ded22007-01-05 17:07:23 +00001510 177, 179, 180, 183, 185, 187, 188, 191, 192, 195,
1511 196, 200, 203, 204, 206, 207, 211, 213, 216, 218,
1512 220, 222, 224, 226, 228, 230, 232, 234, 236, 239,
1513 241, 244, 250, 256, 262, 268, 272, 275, 281, 286,
1514 289, 291, 293, 295, 299, 301, 305, 307, 308, 310,
1515 314, 319, 323, 327, 332, 337, 341, 344, 347, 350,
1516 353, 356, 359, 362, 365, 368, 371, 378, 384, 393,
1517 400, 407, 415, 423, 430, 437, 446, 455, 459, 461,
1518 463, 465, 467, 468, 470, 473, 474, 478, 479, 483,
1519 487, 489, 493, 497, 498, 504, 505, 512, 513, 520,
1520 523, 527, 529, 531, 533, 537, 541, 545, 549, 553,
1521 557, 559, 560, 562, 564, 566, 567, 573, 577, 579,
1522 583, 585, 586, 596, 598, 600, 604, 606, 608, 611,
1523 614, 615, 617, 619, 621, 623, 625, 627, 629, 631,
1524 633, 637, 639, 645, 647, 649, 651, 653, 656, 659,
1525 662, 666, 669, 670, 672, 675, 678, 682, 692, 702,
1526 711, 726, 728, 730, 737, 743, 746, 753, 761, 765,
1527 771, 772, 773, 777, 780, 782, 788, 794, 801, 808,
1528 811, 816, 821, 828, 833, 838, 845, 852, 855, 864,
1529 866, 868, 869, 873, 880, 884, 891, 894, 899, 906
Reid Spencer3822ff52006-11-08 06:47:33 +00001530};
1531
Andrew Lenharth6353e052006-12-08 18:07:09 +00001532/* YYRHS -- A `-1'-separated list of the rules' RHS. */
Reid Spencere4d87aa2006-12-23 06:05:41 +00001533static const short int yyrhs[] =
Reid Spencer3822ff52006-11-08 06:47:33 +00001534{
Reid Spencer218ded22007-01-05 17:07:23 +00001535 187, 0, -1, 5, -1, 6, -1, 74, -1, 75,
Reid Spencer14310612006-12-31 05:40:51 +00001536 -1, 76, -1, 77, -1, 78, -1, 79, -1, 80,
Reid Spencer6fd36ab2006-12-29 20:35:03 +00001537 -1, 81, -1, 82, -1, 83, -1, 84, -1, 85,
Reid Spencer14310612006-12-31 05:40:51 +00001538 -1, 114, -1, 115, -1, 116, -1, 117, -1, 118,
Reid Spencer6fd36ab2006-12-29 20:35:03 +00001539 -1, 119, -1, 120, -1, 121, -1, 122, -1, 123,
Reid Spencer14310612006-12-31 05:40:51 +00001540 -1, 124, -1, 125, -1, 128, -1, 129, -1, 130,
1541 -1, 88, -1, 89, -1, 90, -1, 91, -1, 92,
Reid Spencer6fd36ab2006-12-29 20:35:03 +00001542 -1, 93, -1, 94, -1, 95, -1, 96, -1, 97,
1543 -1, 98, -1, 99, -1, 100, -1, 101, -1, 102,
1544 -1, 103, -1, 104, -1, 105, -1, 106, -1, 107,
Reid Spencer14310612006-12-31 05:40:51 +00001545 -1, 94, -1, 95, -1, 96, -1, 97, -1, 23,
1546 -1, 24, -1, 13, -1, 12, -1, 11, -1, 10,
Reid Spencer218ded22007-01-05 17:07:23 +00001547 -1, 14, -1, 15, -1, 200, 136, -1, -1, 37,
Reid Spencer14310612006-12-31 05:40:51 +00001548 -1, 39, -1, 38, -1, 40, -1, 42, -1, 41,
1549 -1, 43, -1, 46, -1, -1, 41, -1, 43, -1,
1550 -1, 37, -1, 38, -1, 39, -1, 42, -1, -1,
1551 61, -1, 62, -1, 63, -1, 64, -1, 65, -1,
Reid Spencer218ded22007-01-05 17:07:23 +00001552 66, -1, 60, 4, -1, 115, -1, 116, -1, -1,
1553 167, 166, -1, 135, -1, 166, -1, -1, 169, 168,
1554 -1, -1, 53, 4, -1, -1, 137, 53, 4, -1,
1555 31, 20, -1, -1, 172, -1, -1, 137, 175, 174,
1556 -1, 172, -1, 53, 4, -1, 9, -1, 10, -1,
1557 11, -1, 12, -1, 13, -1, 14, -1, 15, -1,
1558 16, -1, 44, -1, 176, -1, 177, 138, -1, 212,
1559 -1, 139, 4, -1, 177, 140, 181, 141, 169, -1,
1560 8, 140, 181, 141, 169, -1, 142, 4, 143, 177,
1561 144, -1, 145, 4, 143, 177, 146, -1, 147, 182,
1562 148, -1, 147, 148, -1, 145, 147, 182, 148, 146,
1563 -1, 145, 147, 148, 146, -1, 177, 167, -1, 177,
1564 -1, 8, -1, 178, -1, 180, 137, 178, -1, 180,
1565 -1, 180, 137, 34, -1, 34, -1, -1, 177, -1,
1566 182, 137, 177, -1, 177, 142, 185, 144, -1, 177,
1567 142, 144, -1, 177, 149, 20, -1, 177, 145, 185,
1568 146, -1, 177, 147, 185, 148, -1, 177, 147, 148,
1569 -1, 177, 35, -1, 177, 36, -1, 177, 212, -1,
1570 177, 184, -1, 177, 22, -1, 158, 3, -1, 158,
1571 4, -1, 9, 23, -1, 9, 24, -1, 159, 7,
1572 -1, 154, 140, 183, 33, 177, 141, -1, 113, 140,
1573 183, 223, 141, -1, 127, 140, 183, 137, 183, 137,
1574 183, 141, -1, 152, 140, 183, 137, 183, 141, -1,
1575 153, 140, 183, 137, 183, 141, -1, 86, 156, 140,
1576 183, 137, 183, 141, -1, 87, 157, 140, 183, 137,
1577 183, 141, -1, 155, 140, 183, 137, 183, 141, -1,
1578 132, 140, 183, 137, 183, 141, -1, 133, 140, 183,
1579 137, 183, 137, 183, 141, -1, 134, 140, 183, 137,
1580 183, 137, 183, 141, -1, 185, 137, 183, -1, 183,
1581 -1, 29, -1, 30, -1, 188, -1, -1, 189, -1,
1582 188, 189, -1, -1, 28, 190, 208, -1, -1, 27,
1583 191, 209, -1, 58, 57, 195, -1, 21, -1, 160,
1584 17, 177, -1, 160, 17, 8, -1, -1, 160, 186,
1585 183, 192, 174, -1, -1, 160, 161, 186, 183, 193,
1586 174, -1, -1, 160, 162, 186, 177, 194, 174, -1,
1587 47, 197, -1, 54, 136, 198, -1, 20, -1, 52,
1588 -1, 51, -1, 49, 136, 196, -1, 50, 136, 4,
1589 -1, 48, 136, 20, -1, 67, 136, 20, -1, 142,
1590 199, 144, -1, 199, 137, 20, -1, 20, -1, -1,
1591 18, -1, 20, -1, 200, -1, -1, 202, 137, 177,
1592 167, 201, -1, 177, 167, 201, -1, 202, -1, 202,
1593 137, 34, -1, 34, -1, -1, 165, 179, 200, 140,
1594 203, 141, 169, 173, 170, -1, 25, -1, 147, -1,
1595 164, 204, 205, -1, 26, -1, 148, -1, 215, 207,
1596 -1, 163, 204, -1, -1, 59, -1, 3, -1, 4,
1597 -1, 7, -1, 23, -1, 24, -1, 35, -1, 36,
1598 -1, 22, -1, 145, 185, 146, -1, 184, -1, 57,
1599 210, 20, 137, 20, -1, 151, -1, 200, -1, 212,
1600 -1, 211, -1, 177, 213, -1, 215, 216, -1, 206,
1601 216, -1, 217, 160, 218, -1, 217, 220, -1, -1,
1602 19, -1, 68, 214, -1, 68, 8, -1, 69, 16,
1603 213, -1, 69, 9, 213, 137, 16, 213, 137, 16,
1604 213, -1, 70, 158, 213, 137, 16, 213, 142, 219,
1605 144, -1, 70, 158, 213, 137, 16, 213, 142, 144,
1606 -1, 71, 165, 179, 213, 140, 222, 141, 169, 33,
1607 16, 213, 72, 16, 213, -1, 72, -1, 73, -1,
1608 219, 158, 211, 137, 16, 213, -1, 158, 211, 137,
1609 16, 213, -1, 160, 225, -1, 177, 142, 213, 137,
1610 213, 144, -1, 221, 137, 142, 213, 137, 213, 144,
1611 -1, 177, 213, 167, -1, 222, 137, 177, 213, 167,
1612 -1, -1, -1, 223, 137, 214, -1, 56, 55, -1,
1613 55, -1, 152, 177, 213, 137, 213, -1, 153, 177,
1614 213, 137, 213, -1, 86, 156, 177, 213, 137, 213,
1615 -1, 87, 157, 177, 213, 137, 213, -1, 45, 214,
1616 -1, 155, 214, 137, 214, -1, 154, 214, 33, 177,
1617 -1, 127, 214, 137, 214, 137, 214, -1, 131, 214,
1618 137, 177, -1, 132, 214, 137, 214, -1, 133, 214,
1619 137, 214, 137, 214, -1, 134, 214, 137, 214, 137,
1620 214, -1, 126, 221, -1, 224, 165, 179, 213, 140,
1621 222, 141, 169, -1, 227, -1, 32, -1, -1, 108,
1622 177, 171, -1, 108, 177, 137, 12, 213, 171, -1,
1623 109, 177, 171, -1, 109, 177, 137, 12, 213, 171,
1624 -1, 110, 214, -1, 226, 111, 177, 213, -1, 226,
1625 112, 214, 137, 177, 213, -1, 113, 177, 213, 223,
1626 -1
Reid Spencer3822ff52006-11-08 06:47:33 +00001627};
1628
1629/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
Reid Spencere4d87aa2006-12-23 06:05:41 +00001630static const unsigned short int yyrline[] =
Reid Spencer3822ff52006-11-08 06:47:33 +00001631{
Reid Spencer63c34452007-01-05 21:51:07 +00001632 0, 1019, 1019, 1020, 1030, 1030, 1030, 1030, 1030, 1030,
1633 1030, 1030, 1030, 1031, 1031, 1031, 1032, 1032, 1032, 1032,
1634 1032, 1032, 1033, 1033, 1033, 1033, 1033, 1033, 1034, 1034,
1635 1034, 1036, 1036, 1037, 1037, 1038, 1038, 1039, 1039, 1040,
1636 1040, 1044, 1044, 1045, 1045, 1046, 1046, 1047, 1047, 1048,
1637 1048, 1049, 1049, 1050, 1050, 1051, 1052, 1057, 1057, 1057,
1638 1057, 1058, 1058, 1061, 1065, 1071, 1072, 1073, 1074, 1075,
1639 1079, 1080, 1081, 1085, 1086, 1087, 1091, 1092, 1093, 1094,
1640 1095, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1112,
1641 1113, 1116, 1117, 1122, 1123, 1126, 1127, 1134, 1135, 1141,
1642 1142, 1150, 1158, 1159, 1164, 1165, 1166, 1171, 1184, 1184,
1643 1184, 1184, 1184, 1184, 1184, 1184, 1187, 1191, 1195, 1202,
1644 1207, 1215, 1233, 1251, 1256, 1268, 1278, 1282, 1292, 1299,
1645 1306, 1313, 1318, 1323, 1330, 1331, 1338, 1345, 1353, 1358,
1646 1369, 1397, 1413, 1442, 1470, 1491, 1506, 1518, 1525, 1588,
1647 1598, 1608, 1614, 1620, 1624, 1628, 1636, 1650, 1671, 1679,
1648 1685, 1696, 1701, 1706, 1715, 1721, 1727, 1736, 1740, 1748,
1649 1748, 1759, 1764, 1772, 1773, 1777, 1777, 1781, 1781, 1784,
1650 1787, 1799, 1823, 1834, 1834, 1843, 1843, 1851, 1851, 1861,
1651 1864, 1870, 1883, 1884, 1886, 1890, 1899, 1903, 1908, 1910,
1652 1915, 1920, 1929, 1929, 1930, 1930, 1932, 1942, 1953, 1957,
1653 1966, 1975, 1980, 2085, 2085, 2087, 2095, 2095, 2097, 2102,
1654 2113, 2117, 2122, 2126, 2130, 2134, 2138, 2142, 2146, 2150,
1655 2154, 2179, 2183, 2197, 2201, 2207, 2207, 2213, 2222, 2226,
1656 2235, 2246, 2255, 2267, 2280, 2284, 2288, 2293, 2302, 2321,
1657 2330, 2397, 2401, 2408, 2419, 2432, 2441, 2452, 2462, 2470,
1658 2478, 2481, 2482, 2489, 2493, 2498, 2519, 2536, 2549, 2562,
1659 2575, 2584, 2597, 2605, 2612, 2618, 2624, 2630, 2645, 2708,
1660 2713, 2717, 2724, 2731, 2739, 2746, 2754, 2762, 2776, 2793
Reid Spencer3822ff52006-11-08 06:47:33 +00001661};
1662#endif
1663
Reid Spencere4d87aa2006-12-23 06:05:41 +00001664#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1665/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
Andrew Lenharth6353e052006-12-08 18:07:09 +00001666 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
Reid Spencer3822ff52006-11-08 06:47:33 +00001667static const char *const yytname[] =
1668{
1669 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL",
Reid Spencer14310612006-12-31 05:40:51 +00001670 "UINTVAL", "FPVAL", "VOID", "BOOL", "INT8", "INT16", "INT32", "INT64",
1671 "FLOAT", "DOUBLE", "LABEL", "TYPE", "VAR_ID", "LABELSTR",
1672 "STRINGCONSTANT", "IMPLEMENTATION", "ZEROINITIALIZER", "TRUETOK",
1673 "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
1674 "CONSTANT", "SECTION", "VOLATILE", "TO", "DOTDOTDOT", "NULL_TOK",
1675 "UNDEF", "INTERNAL", "LINKONCE", "WEAK", "APPENDING", "DLLIMPORT",
1676 "DLLEXPORT", "EXTERN_WEAK", "OPAQUE", "NOT", "EXTERNAL", "TARGET",
1677 "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE", "BIG", "ALIGN", "DEPLIBS",
1678 "CALL", "TAIL", "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK",
1679 "CSRETCC_TOK", "FASTCC_TOK", "COLDCC_TOK", "X86_STDCALLCC_TOK",
1680 "X86_FASTCALLCC_TOK", "DATALAYOUT", "RET", "BR", "SWITCH", "INVOKE",
1681 "UNWIND", "UNREACHABLE", "ADD", "SUB", "MUL", "UDIV", "SDIV", "FDIV",
1682 "UREM", "SREM", "FREM", "AND", "OR", "XOR", "ICMP", "FCMP", "EQ", "NE",
1683 "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE",
1684 "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC",
1685 "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT",
1686 "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI",
1687 "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK", "SELECT", "SHL", "LSHR",
1688 "ASHR", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR",
Reid Spencer218ded22007-01-05 17:07:23 +00001689 "NORETURN", "'='", "','", "'*'", "'\\\\'", "'('", "')'", "'['", "'x'",
1690 "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept", "INTVAL",
1691 "ArithmeticOps", "LogicalOps", "CastOps", "ShiftOps", "IPredicates",
1692 "FPredicates", "IntType", "FPType", "OptAssign", "GVInternalLinkage",
Reid Spencer14310612006-12-31 05:40:51 +00001693 "GVExternalLinkage", "FunctionDeclareLinkage", "FunctionDefineLinkage",
Reid Spencer218ded22007-01-05 17:07:23 +00001694 "OptCallingConv", "ParamAttr", "OptParamAttrs", "FuncAttr",
1695 "OptFuncAttrs", "OptAlign", "OptCAlign", "SectionString", "OptSection",
Reid Spencer14310612006-12-31 05:40:51 +00001696 "GlobalVarAttributes", "GlobalVarAttribute", "PrimType", "Types",
Reid Spencer218ded22007-01-05 17:07:23 +00001697 "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI", "TypeListI",
Reid Spencer14310612006-12-31 05:40:51 +00001698 "ConstVal", "ConstExpr", "ConstVector", "GlobalType", "Module",
1699 "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
1700 "BigOrLittle", "TargetDefinition", "LibrariesDefinition", "LibList",
1701 "Name", "OptName", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN",
Reid Spencer6fd36ab2006-12-29 20:35:03 +00001702 "FunctionHeader", "END", "Function", "FunctionProto", "OptSideEffect",
1703 "ConstValueRef", "SymbolicValueRef", "ValueRef", "ResolvedVal",
1704 "BasicBlockList", "BasicBlock", "InstructionList", "BBTerminatorInst",
Reid Spencer14310612006-12-31 05:40:51 +00001705 "JumpTable", "Inst", "PHIList", "ValueRefList", "IndexList",
1706 "OptTailCall", "InstVal", "OptVolatile", "MemoryInst", 0
Reid Spencer3822ff52006-11-08 06:47:33 +00001707};
1708#endif
1709
1710# ifdef YYPRINT
1711/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1712 token YYLEX-NUM. */
Reid Spencere4d87aa2006-12-23 06:05:41 +00001713static const unsigned short int yytoknum[] =
Reid Spencer3822ff52006-11-08 06:47:33 +00001714{
1715 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1716 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1717 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1718 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1719 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1720 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1721 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1722 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1723 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1724 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1725 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
Reid Spencer3da59db2006-11-27 01:05:10 +00001726 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
Reid Spencera132e042006-12-03 05:46:11 +00001727 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
Reid Spencer218ded22007-01-05 17:07:23 +00001728 385, 386, 387, 388, 389, 390, 61, 44, 42, 92,
1729 40, 41, 91, 120, 93, 60, 62, 123, 125, 99
Reid Spencer3822ff52006-11-08 06:47:33 +00001730};
1731# endif
1732
1733/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
Andrew Lenharth6353e052006-12-08 18:07:09 +00001734static const unsigned char yyr1[] =
Reid Spencer3822ff52006-11-08 06:47:33 +00001735{
Reid Spencer14310612006-12-31 05:40:51 +00001736 0, 150, 151, 151, 152, 152, 152, 152, 152, 152,
1737 152, 152, 152, 153, 153, 153, 154, 154, 154, 154,
1738 154, 154, 154, 154, 154, 154, 154, 154, 155, 155,
1739 155, 156, 156, 156, 156, 156, 156, 156, 156, 156,
1740 156, 157, 157, 157, 157, 157, 157, 157, 157, 157,
1741 157, 157, 157, 157, 157, 157, 157, 158, 158, 158,
1742 158, 159, 159, 160, 160, 161, 161, 161, 161, 161,
1743 162, 162, 162, 163, 163, 163, 164, 164, 164, 164,
1744 164, 165, 165, 165, 165, 165, 165, 165, 165, 166,
Reid Spencer218ded22007-01-05 17:07:23 +00001745 166, 167, 167, 168, 168, 169, 169, 170, 170, 171,
1746 171, 172, 173, 173, 174, 174, 175, 175, 176, 176,
1747 176, 176, 176, 176, 176, 176, 177, 177, 177, 177,
1748 177, 177, 177, 177, 177, 177, 177, 177, 177, 178,
1749 179, 179, 180, 180, 181, 181, 181, 181, 182, 182,
1750 183, 183, 183, 183, 183, 183, 183, 183, 183, 183,
1751 183, 183, 183, 183, 183, 183, 184, 184, 184, 184,
1752 184, 184, 184, 184, 184, 184, 184, 185, 185, 186,
1753 186, 187, 187, 188, 188, 190, 189, 191, 189, 189,
1754 189, 189, 189, 192, 189, 193, 189, 194, 189, 189,
1755 189, 195, 196, 196, 197, 197, 197, 197, 198, 199,
1756 199, 199, 200, 200, 201, 201, 202, 202, 203, 203,
1757 203, 203, 204, 205, 205, 206, 207, 207, 208, 209,
1758 210, 210, 211, 211, 211, 211, 211, 211, 211, 211,
1759 211, 211, 211, 212, 212, 213, 213, 214, 215, 215,
1760 216, 217, 217, 217, 218, 218, 218, 218, 218, 218,
1761 218, 218, 218, 219, 219, 220, 221, 221, 222, 222,
1762 222, 223, 223, 224, 224, 225, 225, 225, 225, 225,
1763 225, 225, 225, 225, 225, 225, 225, 225, 225, 225,
1764 226, 226, 227, 227, 227, 227, 227, 227, 227, 227
Reid Spencer3822ff52006-11-08 06:47:33 +00001765};
1766
1767/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
Andrew Lenharth6353e052006-12-08 18:07:09 +00001768static const unsigned char yyr2[] =
Reid Spencer3822ff52006-11-08 06:47:33 +00001769{
1770 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1771 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1772 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Reid Spencer3822ff52006-11-08 06:47:33 +00001773 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Reid Spencer3da59db2006-11-27 01:05:10 +00001774 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Reid Spencer3da59db2006-11-27 01:05:10 +00001775 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Reid Spencer14310612006-12-31 05:40:51 +00001776 1, 1, 1, 2, 0, 1, 1, 1, 1, 1,
1777 1, 1, 1, 0, 1, 1, 0, 1, 1, 1,
1778 1, 0, 1, 1, 1, 1, 1, 1, 2, 1,
Reid Spencer218ded22007-01-05 17:07:23 +00001779 1, 0, 2, 1, 1, 0, 2, 0, 2, 0,
1780 3, 2, 0, 1, 0, 3, 1, 2, 1, 1,
1781 1, 1, 1, 1, 1, 1, 1, 1, 2, 1,
1782 2, 5, 5, 5, 5, 3, 2, 5, 4, 2,
1783 1, 1, 1, 3, 1, 3, 1, 0, 1, 3,
1784 4, 3, 3, 4, 4, 3, 2, 2, 2, 2,
1785 2, 2, 2, 2, 2, 2, 6, 5, 8, 6,
1786 6, 7, 7, 6, 6, 8, 8, 3, 1, 1,
1787 1, 1, 0, 1, 2, 0, 3, 0, 3, 3,
1788 1, 3, 3, 0, 5, 0, 6, 0, 6, 2,
1789 3, 1, 1, 1, 3, 3, 3, 3, 3, 3,
1790 1, 0, 1, 1, 1, 0, 5, 3, 1, 3,
1791 1, 0, 9, 1, 1, 3, 1, 1, 2, 2,
1792 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1793 3, 1, 5, 1, 1, 1, 1, 2, 2, 2,
1794 3, 2, 0, 1, 2, 2, 3, 9, 9, 8,
1795 14, 1, 1, 6, 5, 2, 6, 7, 3, 5,
1796 0, 0, 3, 2, 1, 5, 5, 6, 6, 2,
1797 4, 4, 6, 4, 4, 6, 6, 2, 8, 1,
1798 1, 0, 3, 6, 3, 6, 2, 4, 6, 4
Reid Spencer3822ff52006-11-08 06:47:33 +00001799};
1800
1801/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1802 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1803 means the default is an error. */
Reid Spencere4d87aa2006-12-23 06:05:41 +00001804static const unsigned short int yydefact[] =
Reid Spencer3822ff52006-11-08 06:47:33 +00001805{
Reid Spencer218ded22007-01-05 17:07:23 +00001806 64, 202, 203, 180, 177, 175, 0, 0, 0, 0,
1807 0, 64, 173, 0, 73, 76, 0, 0, 0, 0,
1808 189, 0, 0, 0, 169, 170, 65, 67, 66, 68,
1809 70, 69, 71, 72, 0, 0, 0, 1, 174, 63,
1810 74, 75, 81, 178, 77, 78, 79, 80, 81, 242,
1811 176, 242, 0, 0, 0, 0, 201, 190, 191, 179,
1812 2, 3, 182, 108, 109, 110, 111, 112, 113, 114,
1813 115, 116, 0, 0, 0, 0, 233, 117, 181, 234,
1814 119, 0, 0, 0, 108, 109, 110, 111, 112, 113,
1815 114, 0, 0, 0, 183, 0, 82, 83, 84, 85,
1816 86, 87, 0, 219, 0, 243, 239, 64, 216, 217,
1817 218, 238, 196, 193, 192, 194, 195, 197, 200, 0,
1818 137, 120, 0, 0, 0, 126, 138, 0, 118, 137,
1819 185, 187, 153, 154, 151, 152, 155, 150, 146, 147,
1820 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
1821 14, 15, 0, 0, 0, 16, 17, 18, 19, 20,
1822 21, 22, 23, 24, 25, 26, 27, 0, 28, 29,
1823 30, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1824 0, 0, 149, 148, 104, 88, 131, 130, 0, 213,
1825 214, 215, 281, 241, 0, 198, 136, 91, 132, 134,
1826 0, 0, 0, 0, 0, 0, 125, 0, 104, 104,
1827 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
1828 0, 55, 56, 51, 52, 53, 54, 41, 42, 43,
1829 44, 45, 46, 47, 48, 49, 50, 0, 0, 0,
1830 0, 0, 0, 141, 168, 0, 0, 145, 0, 142,
1831 0, 0, 0, 0, 0, 184, 0, 280, 0, 264,
1832 0, 0, 0, 0, 81, 251, 252, 0, 0, 0,
Reid Spencer3822ff52006-11-08 06:47:33 +00001833 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencer218ded22007-01-05 17:07:23 +00001834 0, 0, 0, 240, 81, 255, 0, 279, 199, 129,
1835 0, 95, 0, 0, 128, 0, 139, 95, 186, 188,
1836 0, 0, 261, 0, 0, 0, 0, 0, 140, 143,
1837 144, 0, 0, 0, 0, 0, 0, 106, 104, 211,
1838 0, 269, 263, 245, 244, 0, 0, 60, 59, 58,
1839 57, 0, 0, 0, 0, 99, 99, 286, 0, 0,
1840 277, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1841 0, 0, 0, 89, 90, 92, 135, 133, 122, 123,
1842 124, 127, 121, 0, 0, 0, 0, 0, 0, 0,
1843 167, 0, 0, 0, 0, 101, 107, 105, 210, 91,
1844 208, 0, 222, 223, 224, 229, 225, 226, 227, 228,
1845 220, 0, 231, 236, 235, 237, 0, 246, 0, 0,
1846 0, 0, 0, 282, 0, 284, 261, 0, 0, 0,
1847 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1848 0, 93, 94, 96, 0, 0, 0, 157, 0, 0,
1849 0, 0, 0, 0, 0, 0, 205, 0, 95, 221,
1850 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1851 289, 0, 0, 0, 273, 274, 0, 0, 0, 0,
1852 271, 270, 0, 287, 0, 0, 0, 262, 0, 164,
1853 0, 0, 159, 160, 156, 163, 204, 207, 209, 91,
1854 102, 0, 230, 0, 0, 260, 0, 0, 99, 100,
1855 99, 0, 0, 0, 0, 0, 265, 266, 260, 0,
1856 161, 162, 0, 0, 0, 205, 103, 97, 0, 0,
1857 0, 0, 0, 267, 268, 0, 283, 285, 0, 0,
1858 272, 275, 276, 0, 288, 158, 165, 166, 206, 0,
1859 212, 232, 0, 0, 91, 0, 95, 256, 0, 95,
1860 98, 0, 249, 0, 0, 258, 0, 0, 257, 278,
1861 247, 0, 248, 0, 91, 0, 0, 0, 259, 0,
1862 0, 0, 0, 254, 0, 0, 253, 0, 250
Reid Spencer3822ff52006-11-08 06:47:33 +00001863};
1864
Andrew Lenharth6353e052006-12-08 18:07:09 +00001865/* YYDEFGOTO[NTERM-NUM]. */
Reid Spencere4d87aa2006-12-23 06:05:41 +00001866static const short int yydefgoto[] =
Reid Spencer3822ff52006-11-08 06:47:33 +00001867{
Reid Spencer218ded22007-01-05 17:07:23 +00001868 -1, 76, 178, 179, 180, 181, 220, 237, 91, 92,
1869 9, 34, 35, 42, 48, 102, 355, 289, 423, 358,
1870 530, 403, 317, 507, 255, 318, 77, 93, 198, 188,
1871 199, 200, 127, 244, 392, 245, 36, 10, 11, 12,
1872 15, 14, 184, 208, 209, 59, 115, 20, 57, 119,
1873 79, 477, 380, 381, 103, 191, 49, 110, 50, 43,
1874 440, 393, 80, 395, 321, 51, 106, 107, 283, 544,
1875 193, 340, 512, 365, 284, 285, 286, 287
Reid Spencer3822ff52006-11-08 06:47:33 +00001876};
1877
1878/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1879 STATE-NUM. */
Reid Spencer218ded22007-01-05 17:07:23 +00001880#define YYPACT_NINF -468
Reid Spencere4d87aa2006-12-23 06:05:41 +00001881static const short int yypact[] =
Reid Spencer3822ff52006-11-08 06:47:33 +00001882{
Reid Spencer218ded22007-01-05 17:07:23 +00001883 384, -468, -468, -468, -468, -468, 23, -99, -3, 74,
1884 78, 507, -468, -66, 129, 148, -26, 0, 26, 31,
1885 -468, 6, 156, 1114, -468, -468, -468, -468, -468, -468,
1886 -468, -468, -468, -468, 66, 66, 1130, -468, -468, -468,
1887 -468, -468, 138, -468, -468, -468, -468, -468, 138, 172,
1888 -468, 20, 163, 104, 208, 196, 202, -468, -468, -468,
1889 -468, -468, 90, -468, -468, -468, -468, -468, -468, -468,
1890 -468, -468, 258, 262, 4, 18, -468, -468, -89, -468,
1891 -468, 1130, 1167, 90, 216, 240, 257, 261, 266, 264,
1892 277, 270, 278, 495, -468, 283, -468, -468, -468, -468,
1893 -468, -468, 1183, -468, -14, -468, -468, 119, -468, -468,
1894 -468, -468, -468, -468, -468, -468, -468, -468, -468, -19,
1895 749, -468, 145, 147, 357, -468, -89, -87, -468, 749,
1896 -468, -89, -468, -468, -468, -468, -468, -468, -468, -468,
1897 -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,
1898 -468, -468, 557, 804, 157, -468, -468, -468, -468, -468,
1899 -468, -468, -468, -468, -468, -468, -468, 158, -468, -468,
1900 -468, 167, 168, 173, 853, 1130, 582, 282, 174, 175,
1901 176, 177, -468, -468, 181, -468, 90, -89, 119, -468,
1902 -468, -468, 1271, -468, 292, -468, -468, -89, -468, 183,
1903 180, 1167, 1167, 185, -63, 1167, -468, 182, 181, 181,
1904 -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,
1905 186, -468, -468, -468, -468, -468, -468, -468, -468, -468,
1906 -468, -468, -468, -468, -468, -468, -468, 192, 1130, 1130,
1907 1130, 1130, 1130, -468, -468, -13, -44, -468, -43, -468,
1908 1130, 1130, 1130, 1130, 12, -468, 193, -468, 1167, -468,
1909 267, 1230, 126, 214, 138, -468, -468, 557, 804, 1167,
1910 1167, 1167, 1167, 1167, 1167, 1167, 1167, 1167, 1167, 1167,
1911 1167, 1167, 1167, -468, 138, -468, 164, -468, -468, 162,
1912 1024, -468, 5, -8, -468, 188, -89, -468, -468, -468,
1913 1130, 1130, -468, 198, 199, 201, 203, 1130, -468, -468,
1914 -468, 204, 205, 306, 206, 324, 343, -468, 181, 1070,
1915 657, -468, -468, 90, -468, 800, 800, -468, -468, -468,
1916 -468, 800, 1183, 1167, 1167, 56, 91, -468, 657, 35,
1917 211, 212, 215, 218, 219, 220, 657, 657, 318, 221,
1918 1183, 1167, 1167, -468, -468, -468, -468, -468, -71, -468,
1919 -468, -468, -71, 222, 224, 51, 1130, 1130, 1130, 1130,
1920 -468, 1130, 1130, 1167, 1130, -468, -468, -468, -468, -89,
1921 227, 233, -468, -468, -468, -468, -468, -468, -468, -468,
1922 317, 1130, -468, -468, -468, -468, 241, -468, 242, 800,
1923 657, 657, 10, -468, 13, -468, -468, 800, 238, 1167,
1924 1167, 1167, 1167, 1167, 244, 246, 1167, 1167, 800, 657,
1925 248, -468, -468, -468, 1130, 1130, 1167, -468, 254, 251,
1926 259, 260, 268, 269, 96, 272, 38, 1087, -468, -468,
1927 362, -39, 379, 391, 275, 271, 279, 800, 419, 800,
1928 289, 291, 800, 293, -89, -468, 295, 296, 800, 800,
1929 -89, -468, 294, -468, 1167, 288, 298, -468, 1130, -468,
1930 1130, 1130, -468, -468, -468, -468, -468, -468, -468, -89,
1931 11, 299, -468, 800, 800, 1167, 800, 800, 303, -468,
1932 303, 800, 307, 1167, 1167, 1167, -468, -468, 1167, 657,
1933 -468, -468, 302, 304, 308, 38, -468, 382, 427, 313,
1934 310, 657, 70, -468, -468, 400, -468, -468, 311, 800,
1935 -468, -468, -468, 73, -468, -468, -468, -468, -468, 450,
1936 -468, -468, 440, 3, -468, 1167, -468, -468, 315, -468,
1937 -468, 800, -468, 932, 8, 162, 657, -16, -468, -71,
1938 -468, 323, -468, 932, -468, 445, 447, 327, 162, 800,
1939 800, 449, 394, -468, 800, 451, -468, 800, -468
Reid Spencer3822ff52006-11-08 06:47:33 +00001940};
1941
1942/* YYPGOTO[NTERM-NUM]. */
Reid Spencere4d87aa2006-12-23 06:05:41 +00001943static const short int yypgoto[] =
Reid Spencer3822ff52006-11-08 06:47:33 +00001944{
Reid Spencer218ded22007-01-05 17:07:23 +00001945 -468, -468, 276, 281, 284, 287, 207, 213, -261, -468,
1946 373, -468, -468, -468, -468, -229, -352, -370, -468, -294,
1947 -468, -329, -11, -468, -168, -468, -468, -23, 194, -275,
1948 -468, 358, 364, 53, 396, -171, 245, -468, -468, 480,
1949 -468, -468, -468, -468, -468, -468, -468, -468, -468, -468,
1950 1, -12, -468, -468, 444, -468, -468, -468, -468, -468,
1951 -468, -467, -1, -278, -194, -468, 443, -468, -468, -468,
1952 -468, -468, 16, 89, -468, -468, -468, -468
Reid Spencer3822ff52006-11-08 06:47:33 +00001953};
1954
1955/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1956 positive, shift that token. If negative, reduce the rule which
1957 number is the opposite. If zero, do what YYDEFACT says.
1958 If YYTABLE_NINF, syntax error. */
Reid Spencer218ded22007-01-05 17:07:23 +00001959#define YYTABLE_NINF -173
Reid Spencere4d87aa2006-12-23 06:05:41 +00001960static const short int yytable[] =
Reid Spencer3822ff52006-11-08 06:47:33 +00001961{
Reid Spencer218ded22007-01-05 17:07:23 +00001962 78, 13, 331, 362, 246, 248, 422, 405, 123, 436,
1963 422, 189, 13, 327, 328, 329, 330, 555, 327, 328,
1964 329, 330, 447, 60, 61, 449, 83, 63, 64, 65,
1965 66, 67, 68, 69, 70, 332, 1, 21, 2, 105,
1966 298, 299, 315, 315, 353, 354, 108, 396, 397, 128,
1967 205, 129, 126, 398, 22, 350, 1, 399, 2, 131,
1968 406, 206, 71, 448, 421, 316, 448, 324, 414, 415,
1969 39, 16, 17, 18, 205, 418, 551, 337, 37, 187,
1970 341, 342, 343, 344, 345, 295, 557, 348, 349, 94,
1971 19, 23, 183, 307, 307, 24, 25, 197, 307, 353,
1972 354, 126, 309, 24, 25, 310, 197, 482, 13, 505,
1973 52, 26, 27, 28, 29, 30, 31, 32, 194, 421,
1974 33, 444, 445, 446, 307, 195, 353, 354, 422, 451,
1975 128, 308, 129, 190, 130, 325, 53, 1, 360, 2,
1976 462, 463, 326, 128, 480, 129, 421, 542, 56, 359,
1977 377, 124, 552, 353, 354, 113, 114, 72, 420, 516,
1978 73, 517, 54, 74, 545, 75, 125, 55, 109, 488,
1979 40, 490, 41, 128, 492, 129, 58, 407, 292, 293,
1980 496, 497, 296, 112, 558, 44, 45, 46, 426, 256,
1981 47, 105, 427, 402, 128, 422, 129, 422, 95, 96,
1982 97, 98, 99, 100, 101, 509, 510, 535, 513, 514,
1983 535, 536, 116, 518, 539, 453, 117, 455, 456, 457,
1984 441, 524, 118, 461, 327, 328, 329, 330, 404, 128,
1985 120, 129, 467, 534, 128, 320, 129, 474, 320, 132,
1986 133, 538, 547, -60, -60, 549, 335, 336, 320, 338,
1987 339, 320, 320, 320, 320, 320, 346, 347, 320, 320,
1988 -59, -59, 121, 550, -58, -58, 122, 197, 554, -57,
1989 -57, -61, 543, 134, 135, 351, 352, 353, 354, 81,
1990 82, 562, 563, 553, -62, 136, 566, 185, 201, 568,
1991 202, 302, 303, 304, 305, 306, 379, 238, 239, 520,
1992 521, 522, 249, 311, 312, 313, 314, 240, 241, 187,
1993 400, 401, 288, 242, 250, 251, 252, 253, 254, 394,
1994 290, 291, 322, 297, 394, 394, 300, 187, 419, 320,
1995 394, 294, 301, 319, 361, 366, 367, 394, 368, 373,
1996 369, 371, 372, 374, 375, 394, 394, 376, 408, 409,
1997 434, 416, 410, 363, 364, 411, 412, 413, 417, 424,
1998 370, 425, 60, 61, 437, 83, 63, 64, 65, 66,
1999 67, 68, 69, 70, 438, 1, 439, 2, 442, 443,
2000 452, 458, 481, 459, -172, 464, 320, 454, 320, 320,
2001 320, 468, 469, 460, 320, 483, 470, 471, 394, 394,
2002 394, 71, 1, 320, 2, 3, 394, 484, 486, 472,
2003 473, 4, 5, 475, 479, 485, 487, 394, 394, 428,
2004 429, 430, 431, 489, 432, 433, 426, 435, 491, 500,
2005 493, 6, 494, 495, 498, 529, 508, 476, 7, 501,
2006 515, 499, 8, 525, 519, 526, 394, 531, 394, 527,
2007 532, 394, 533, 448, 540, 537, 541, 394, 394, 548,
2008 556, 559, 511, 560, 561, 564, 565, 567, 279, 506,
2009 320, 320, 320, 280, 333, 511, 281, 465, 466, 282,
2010 192, 334, 394, 394, 357, 394, 394, 207, 204, 182,
2011 394, 38, 104, 528, 111, 450, 72, 0, 394, 73,
2012 60, 61, 74, 0, 75, 203, 476, -171, 0, 0,
2013 394, 0, 546, 1, 523, 2, 0, 137, 394, 0,
2014 0, 502, 0, 503, 504, 1, 0, 2, 3, 0,
2015 138, 139, 0, 0, 4, 5, 0, 0, 0, 0,
2016 394, 0, 0, 0, 0, 394, 0, 0, 0, 0,
2017 0, 0, 0, 0, 6, 0, 0, 0, 394, 394,
2018 0, 7, 0, 394, 0, 8, 394, 0, 0, 140,
Reid Spencer14310612006-12-31 05:40:51 +00002019 141, 142, 143, 144, 145, 146, 147, 148, 149, 150,
Reid Spencer218ded22007-01-05 17:07:23 +00002020 151, 152, 153, 0, 0, 0, 0, 60, 61, 0,
2021 83, 84, 85, 86, 87, 88, 89, 90, 70, 0,
2022 1, 0, 2, 0, 0, 0, 0, 0, 154, 155,
Reid Spencer14310612006-12-31 05:40:51 +00002023 156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
Reid Spencer218ded22007-01-05 17:07:23 +00002024 166, 0, 167, 168, 169, 170, 71, 171, 172, 173,
2025 0, 0, 0, 128, 0, 129, 0, 174, 0, 0,
2026 175, 0, 176, 0, 177, 210, 211, 212, 213, 214,
2027 215, 216, 217, 218, 219, 0, 0, 0, 0, 0,
2028 382, 383, 60, 61, 384, 0, 0, 0, 0, 0,
2029 0, 0, 0, 0, 0, 1, 0, 2, 0, 385,
2030 386, 387, 0, 0, 0, 0, 0, 0, 0, 0,
2031 0, 0, 388, 389, 0, 0, 0, 0, 0, 0,
2032 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2033 0, 0, 0, 0, 390, 0, 0, 0, 0, 0,
2034 0, 72, 0, 0, 73, 0, 0, 74, 0, 75,
2035 247, 140, 141, 142, 143, 144, 145, 146, 147, 148,
2036 149, 150, 151, 152, 153, 0, 0, 0, 0, 0,
2037 0, 0, 0, 0, 60, 61, 0, 83, 63, 64,
Reid Spencer14310612006-12-31 05:40:51 +00002038 65, 66, 67, 68, 69, 70, 0, 1, 0, 2,
Reid Spencer218ded22007-01-05 17:07:23 +00002039 154, 155, 156, 157, 158, 159, 160, 161, 162, 163,
2040 164, 165, 166, 196, 167, 168, 169, 170, 0, 171,
2041 172, 173, 0, 71, 0, 128, 0, 129, 0, 0,
2042 0, 0, 391, 382, 383, 60, 61, 384, 0, 0,
2043 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
2044 2, 0, 385, 386, 387, 0, 0, 221, 222, 0,
2045 0, 0, 0, 0, 0, 388, 389, 0, 0, 0,
Reid Spencer14310612006-12-31 05:40:51 +00002046 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencer218ded22007-01-05 17:07:23 +00002047 0, 0, 0, 0, 0, 0, 0, 390, 60, 61,
2048 0, 83, 84, 85, 86, 87, 88, 89, 90, 70,
2049 0, 1, 0, 2, 140, 141, 142, 143, 144, 145,
2050 146, 147, 148, 149, 150, 151, 152, 153, 72, 0,
2051 0, 73, 0, 0, 74, 0, 75, 71, 223, 224,
2052 225, 226, 227, 228, 229, 230, 231, 232, 233, 234,
2053 235, 236, 0, 154, 155, 156, 157, 158, 159, 160,
2054 161, 162, 163, 164, 165, 166, 0, 167, 168, 169,
2055 170, 0, 171, 172, 173, 382, 383, 0, 0, 384,
2056 0, 0, 0, 0, 0, 391, 0, 0, 0, 0,
2057 0, 0, 0, 0, 385, 386, 387, 0, 0, 0,
2058 0, 0, 0, 0, 0, 0, 0, 388, 389, 0,
Reid Spencer14310612006-12-31 05:40:51 +00002059 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencer218ded22007-01-05 17:07:23 +00002060 0, 0, 0, 0, 0, 0, 0, 0, 0, 390,
2061 0, 0, 72, 0, 0, 73, 0, 243, 74, 0,
2062 75, 0, 0, 0, 0, 0, 140, 141, 142, 143,
2063 144, 145, 146, 147, 148, 149, 150, 151, 152, 153,
2064 0, 0, 0, 0, 0, 0, 0, 0, 0, 60,
2065 61, 0, 83, 63, 64, 65, 66, 67, 68, 69,
2066 70, 0, 1, 0, 2, 154, 155, 156, 157, 158,
2067 159, 160, 161, 162, 163, 164, 165, 166, 356, 167,
2068 168, 169, 170, 0, 171, 172, 173, 0, 71, 0,
2069 0, 0, 0, 0, 0, 60, 61, 391, 83, 63,
2070 64, 65, 66, 67, 68, 69, 70, 0, 1, 0,
2071 2, 0, 60, 61, 0, 83, 63, 64, 65, 66,
2072 67, 68, 69, 70, 378, 1, 0, 2, 0, 0,
2073 0, 0, 0, 0, 71, 0, 0, 0, 0, 60,
2074 61, 478, 62, 63, 64, 65, 66, 67, 68, 69,
2075 70, 71, 1, 0, 2, 60, 61, 0, 83, 84,
2076 85, 86, 87, 88, 89, 90, 70, 0, 1, 0,
2077 2, 0, 0, 0, 0, 0, 0, 0, 71, 0,
2078 0, 0, 0, 72, 0, 0, 73, 0, 0, 74,
2079 0, 75, 60, 61, 71, 83, 63, 64, 65, 66,
2080 67, 68, 69, 70, 0, 1, 0, 2, 60, 61,
2081 0, 186, 63, 64, 65, 66, 67, 68, 69, 70,
2082 0, 1, 0, 2, 0, 0, 0, 0, 0, 72,
2083 0, 71, 73, 0, 0, 74, 0, 75, 0, 0,
2084 0, 0, 0, 0, 0, 0, 72, 71, 0, 73,
2085 0, 0, 74, 0, 75, 60, 61, 0, 323, 63,
2086 64, 65, 66, 67, 68, 69, 70, 0, 1, 0,
2087 2, 0, 0, 72, 0, 0, 73, 0, 0, 74,
2088 0, 75, 0, 0, 0, 0, 0, 0, 0, 72,
2089 0, 0, 73, 0, 71, 74, 0, 75, 0, 0,
Reid Spencer6fd36ab2006-12-29 20:35:03 +00002090 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2091 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencer218ded22007-01-05 17:07:23 +00002092 0, 0, 0, 257, 0, 0, 72, 0, 0, 73,
2093 0, 0, 74, 0, 75, 0, 258, 0, 0, 0,
2094 0, 0, 72, 0, 0, 73, 259, 260, 74, 0,
2095 75, 0, 0, 0, 0, 0, 0, 0, 0, 261,
2096 262, 263, 264, 265, 266, 140, 141, 142, 143, 144,
2097 145, 146, 147, 148, 149, 150, 151, 267, 268, 0,
2098 0, 0, 0, 0, 0, 0, 0, 0, 0, 72,
2099 0, 0, 73, 0, 0, 74, 0, 75, 0, 269,
2100 270, 271, 0, 0, 272, 155, 156, 157, 158, 159,
2101 160, 161, 162, 163, 164, 165, 166, 273, 274, 168,
2102 169, 170, 275, 276, 277, 278
Reid Spencer3822ff52006-11-08 06:47:33 +00002103};
2104
Reid Spencere4d87aa2006-12-23 06:05:41 +00002105static const short int yycheck[] =
Reid Spencer3822ff52006-11-08 06:47:33 +00002106{
Reid Spencer218ded22007-01-05 17:07:23 +00002107 23, 0, 263, 297, 175, 176, 358, 336, 4, 379,
2108 362, 25, 11, 10, 11, 12, 13, 33, 10, 11,
2109 12, 13, 12, 5, 6, 12, 8, 9, 10, 11,
2110 12, 13, 14, 15, 16, 264, 18, 136, 20, 19,
2111 208, 209, 31, 31, 115, 116, 26, 325, 326, 138,
2112 137, 140, 75, 331, 57, 284, 18, 332, 20, 82,
2113 338, 148, 44, 53, 135, 53, 53, 261, 346, 347,
2114 136, 48, 49, 50, 137, 350, 543, 271, 0, 102,
2115 274, 275, 276, 277, 278, 148, 553, 281, 282, 36,
2116 67, 17, 93, 137, 137, 29, 30, 120, 137, 115,
2117 116, 124, 146, 29, 30, 148, 129, 146, 107, 479,
2118 136, 37, 38, 39, 40, 41, 42, 43, 137, 135,
2119 46, 399, 400, 401, 137, 144, 115, 116, 480, 407,
2120 138, 144, 140, 147, 81, 9, 136, 18, 146, 20,
2121 418, 419, 16, 138, 438, 140, 135, 144, 142, 144,
2122 318, 147, 144, 115, 116, 51, 52, 139, 352, 488,
2123 142, 490, 136, 145, 534, 147, 148, 136, 148, 447,
2124 41, 449, 43, 138, 452, 140, 20, 142, 201, 202,
2125 458, 459, 205, 20, 554, 37, 38, 39, 137, 188,
2126 42, 19, 141, 137, 138, 547, 140, 549, 60, 61,
2127 62, 63, 64, 65, 66, 483, 484, 137, 486, 487,
2128 137, 141, 4, 491, 141, 409, 20, 411, 412, 413,
2129 391, 499, 20, 417, 10, 11, 12, 13, 137, 138,
2130 140, 140, 426, 511, 138, 258, 140, 141, 261, 23,
2131 24, 519, 536, 3, 4, 539, 269, 270, 271, 272,
Reid Spencer14310612006-12-31 05:40:51 +00002132 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
Reid Spencer218ded22007-01-05 17:07:23 +00002133 3, 4, 4, 541, 3, 4, 4, 290, 546, 3,
2134 4, 7, 533, 3, 4, 111, 112, 115, 116, 34,
2135 35, 559, 560, 544, 7, 7, 564, 4, 143, 567,
2136 143, 238, 239, 240, 241, 242, 319, 140, 140, 493,
2137 494, 495, 20, 250, 251, 252, 253, 140, 140, 332,
2138 333, 334, 20, 140, 140, 140, 140, 140, 137, 320,
2139 137, 141, 55, 141, 325, 326, 140, 350, 351, 352,
2140 331, 146, 140, 140, 146, 137, 137, 338, 137, 33,
2141 137, 137, 137, 137, 20, 346, 347, 4, 137, 137,
2142 373, 33, 137, 300, 301, 137, 137, 137, 137, 137,
2143 307, 137, 5, 6, 137, 8, 9, 10, 11, 12,
2144 13, 14, 15, 16, 141, 18, 59, 20, 137, 137,
2145 142, 137, 20, 137, 0, 137, 409, 410, 411, 412,
2146 413, 137, 141, 416, 417, 16, 137, 137, 399, 400,
2147 401, 44, 18, 426, 20, 21, 407, 16, 137, 141,
2148 141, 27, 28, 141, 437, 140, 137, 418, 419, 366,
2149 367, 368, 369, 4, 371, 372, 137, 374, 137, 141,
2150 137, 47, 137, 137, 140, 53, 137, 436, 54, 141,
2151 137, 464, 58, 141, 137, 141, 447, 20, 449, 141,
2152 137, 452, 142, 53, 4, 144, 16, 458, 459, 144,
2153 137, 16, 485, 16, 137, 16, 72, 16, 192, 480,
2154 493, 494, 495, 192, 267, 498, 192, 424, 425, 192,
2155 107, 268, 483, 484, 290, 486, 487, 129, 124, 93,
2156 491, 11, 48, 505, 51, 406, 139, -1, 499, 142,
2157 5, 6, 145, -1, 147, 148, 505, 0, -1, -1,
2158 511, -1, 535, 18, 498, 20, -1, 22, 519, -1,
2159 -1, 468, -1, 470, 471, 18, -1, 20, 21, -1,
2160 35, 36, -1, -1, 27, 28, -1, -1, -1, -1,
2161 541, -1, -1, -1, -1, 546, -1, -1, -1, -1,
2162 -1, -1, -1, -1, 47, -1, -1, -1, 559, 560,
2163 -1, 54, -1, 564, -1, 58, 567, -1, -1, 74,
Reid Spencer14310612006-12-31 05:40:51 +00002164 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
Reid Spencer218ded22007-01-05 17:07:23 +00002165 85, 86, 87, -1, -1, -1, -1, 5, 6, -1,
2166 8, 9, 10, 11, 12, 13, 14, 15, 16, -1,
2167 18, -1, 20, -1, -1, -1, -1, -1, 113, 114,
Reid Spencer14310612006-12-31 05:40:51 +00002168 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
Reid Spencer218ded22007-01-05 17:07:23 +00002169 125, -1, 127, 128, 129, 130, 44, 132, 133, 134,
2170 -1, -1, -1, 138, -1, 140, -1, 142, -1, -1,
2171 145, -1, 147, -1, 149, 88, 89, 90, 91, 92,
2172 93, 94, 95, 96, 97, -1, -1, -1, -1, -1,
2173 3, 4, 5, 6, 7, -1, -1, -1, -1, -1,
2174 -1, -1, -1, -1, -1, 18, -1, 20, -1, 22,
2175 23, 24, -1, -1, -1, -1, -1, -1, -1, -1,
2176 -1, -1, 35, 36, -1, -1, -1, -1, -1, -1,
Reid Spencer14310612006-12-31 05:40:51 +00002177 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencer218ded22007-01-05 17:07:23 +00002178 -1, -1, -1, -1, 57, -1, -1, -1, -1, -1,
2179 -1, 139, -1, -1, 142, -1, -1, 145, -1, 147,
2180 148, 74, 75, 76, 77, 78, 79, 80, 81, 82,
2181 83, 84, 85, 86, 87, -1, -1, -1, -1, -1,
2182 -1, -1, -1, -1, 5, 6, -1, 8, 9, 10,
Reid Spencer14310612006-12-31 05:40:51 +00002183 11, 12, 13, 14, 15, 16, -1, 18, -1, 20,
Reid Spencer218ded22007-01-05 17:07:23 +00002184 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
2185 123, 124, 125, 34, 127, 128, 129, 130, -1, 132,
2186 133, 134, -1, 44, -1, 138, -1, 140, -1, -1,
2187 -1, -1, 145, 3, 4, 5, 6, 7, -1, -1,
2188 -1, -1, -1, -1, -1, -1, -1, -1, 18, -1,
2189 20, -1, 22, 23, 24, -1, -1, 23, 24, -1,
2190 -1, -1, -1, -1, -1, 35, 36, -1, -1, -1,
Reid Spencer14310612006-12-31 05:40:51 +00002191 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencer218ded22007-01-05 17:07:23 +00002192 -1, -1, -1, -1, -1, -1, -1, 57, 5, 6,
Reid Spencere4d87aa2006-12-23 06:05:41 +00002193 -1, 8, 9, 10, 11, 12, 13, 14, 15, 16,
Reid Spencer218ded22007-01-05 17:07:23 +00002194 -1, 18, -1, 20, 74, 75, 76, 77, 78, 79,
2195 80, 81, 82, 83, 84, 85, 86, 87, 139, -1,
2196 -1, 142, -1, -1, 145, -1, 147, 44, 94, 95,
2197 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
2198 106, 107, -1, 113, 114, 115, 116, 117, 118, 119,
2199 120, 121, 122, 123, 124, 125, -1, 127, 128, 129,
2200 130, -1, 132, 133, 134, 3, 4, -1, -1, 7,
2201 -1, -1, -1, -1, -1, 145, -1, -1, -1, -1,
2202 -1, -1, -1, -1, 22, 23, 24, -1, -1, -1,
2203 -1, -1, -1, -1, -1, -1, -1, 35, 36, -1,
2204 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2205 -1, -1, -1, -1, -1, -1, -1, -1, -1, 57,
2206 -1, -1, 139, -1, -1, 142, -1, 144, 145, -1,
2207 147, -1, -1, -1, -1, -1, 74, 75, 76, 77,
2208 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2209 -1, -1, -1, -1, -1, -1, -1, -1, -1, 5,
2210 6, -1, 8, 9, 10, 11, 12, 13, 14, 15,
2211 16, -1, 18, -1, 20, 113, 114, 115, 116, 117,
2212 118, 119, 120, 121, 122, 123, 124, 125, 34, 127,
2213 128, 129, 130, -1, 132, 133, 134, -1, 44, -1,
2214 -1, -1, -1, -1, -1, 5, 6, 145, 8, 9,
2215 10, 11, 12, 13, 14, 15, 16, -1, 18, -1,
2216 20, -1, 5, 6, -1, 8, 9, 10, 11, 12,
2217 13, 14, 15, 16, 34, 18, -1, 20, -1, -1,
2218 -1, -1, -1, -1, 44, -1, -1, -1, -1, 5,
2219 6, 34, 8, 9, 10, 11, 12, 13, 14, 15,
2220 16, 44, 18, -1, 20, 5, 6, -1, 8, 9,
2221 10, 11, 12, 13, 14, 15, 16, -1, 18, -1,
2222 20, -1, -1, -1, -1, -1, -1, -1, 44, -1,
2223 -1, -1, -1, 139, -1, -1, 142, -1, -1, 145,
2224 -1, 147, 5, 6, 44, 8, 9, 10, 11, 12,
2225 13, 14, 15, 16, -1, 18, -1, 20, 5, 6,
2226 -1, 8, 9, 10, 11, 12, 13, 14, 15, 16,
2227 -1, 18, -1, 20, -1, -1, -1, -1, -1, 139,
2228 -1, 44, 142, -1, -1, 145, -1, 147, -1, -1,
2229 -1, -1, -1, -1, -1, -1, 139, 44, -1, 142,
2230 -1, -1, 145, -1, 147, 5, 6, -1, 8, 9,
2231 10, 11, 12, 13, 14, 15, 16, -1, 18, -1,
2232 20, -1, -1, 139, -1, -1, 142, -1, -1, 145,
2233 -1, 147, -1, -1, -1, -1, -1, -1, -1, 139,
2234 -1, -1, 142, -1, 44, 145, -1, 147, -1, -1,
Reid Spencere4d87aa2006-12-23 06:05:41 +00002235 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencer6fd36ab2006-12-29 20:35:03 +00002236 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencer218ded22007-01-05 17:07:23 +00002237 -1, -1, -1, 32, -1, -1, 139, -1, -1, 142,
2238 -1, -1, 145, -1, 147, -1, 45, -1, -1, -1,
2239 -1, -1, 139, -1, -1, 142, 55, 56, 145, -1,
2240 147, -1, -1, -1, -1, -1, -1, -1, -1, 68,
2241 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
2242 79, 80, 81, 82, 83, 84, 85, 86, 87, -1,
2243 -1, -1, -1, -1, -1, -1, -1, -1, -1, 139,
2244 -1, -1, 142, -1, -1, 145, -1, 147, -1, 108,
2245 109, 110, -1, -1, 113, 114, 115, 116, 117, 118,
2246 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
2247 129, 130, 131, 132, 133, 134
Reid Spencer3822ff52006-11-08 06:47:33 +00002248};
2249
2250/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2251 symbol of state STATE-NUM. */
Andrew Lenharth6353e052006-12-08 18:07:09 +00002252static const unsigned char yystos[] =
Reid Spencer3822ff52006-11-08 06:47:33 +00002253{
Reid Spencer14310612006-12-31 05:40:51 +00002254 0, 18, 20, 21, 27, 28, 47, 54, 58, 160,
Reid Spencer218ded22007-01-05 17:07:23 +00002255 187, 188, 189, 200, 191, 190, 48, 49, 50, 67,
2256 197, 136, 57, 17, 29, 30, 37, 38, 39, 40,
2257 41, 42, 43, 46, 161, 162, 186, 0, 189, 136,
2258 41, 43, 163, 209, 37, 38, 39, 42, 164, 206,
2259 208, 215, 136, 136, 136, 136, 142, 198, 20, 195,
Reid Spencer6fd36ab2006-12-29 20:35:03 +00002260 5, 6, 8, 9, 10, 11, 12, 13, 14, 15,
Reid Spencer218ded22007-01-05 17:07:23 +00002261 16, 44, 139, 142, 145, 147, 151, 176, 177, 200,
2262 212, 186, 186, 8, 9, 10, 11, 12, 13, 14,
2263 15, 158, 159, 177, 183, 60, 61, 62, 63, 64,
2264 65, 66, 165, 204, 204, 19, 216, 217, 26, 148,
2265 207, 216, 20, 51, 52, 196, 4, 20, 20, 199,
2266 140, 4, 4, 4, 147, 148, 177, 182, 138, 140,
2267 183, 177, 23, 24, 3, 4, 7, 22, 35, 36,
2268 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2269 84, 85, 86, 87, 113, 114, 115, 116, 117, 118,
2270 119, 120, 121, 122, 123, 124, 125, 127, 128, 129,
2271 130, 132, 133, 134, 142, 145, 147, 149, 152, 153,
2272 154, 155, 184, 212, 192, 4, 8, 177, 179, 25,
2273 147, 205, 160, 220, 137, 144, 34, 177, 178, 180,
2274 181, 143, 143, 148, 182, 137, 148, 181, 193, 194,
2275 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
2276 156, 23, 24, 94, 95, 96, 97, 98, 99, 100,
2277 101, 102, 103, 104, 105, 106, 107, 157, 140, 140,
2278 140, 140, 140, 144, 183, 185, 185, 148, 185, 20,
2279 140, 140, 140, 140, 137, 174, 200, 32, 45, 55,
2280 56, 68, 69, 70, 71, 72, 73, 86, 87, 108,
2281 109, 110, 113, 126, 127, 131, 132, 133, 134, 152,
2282 153, 154, 155, 218, 224, 225, 226, 227, 20, 167,
2283 137, 141, 177, 177, 146, 148, 177, 141, 174, 174,
2284 140, 140, 183, 183, 183, 183, 183, 137, 144, 146,
2285 148, 183, 183, 183, 183, 31, 53, 172, 175, 140,
2286 177, 214, 55, 8, 214, 9, 16, 10, 11, 12,
2287 13, 158, 165, 156, 157, 177, 177, 214, 177, 177,
2288 221, 214, 214, 214, 214, 214, 177, 177, 214, 214,
2289 165, 111, 112, 115, 116, 166, 34, 178, 169, 144,
2290 146, 146, 169, 183, 183, 223, 137, 137, 137, 137,
2291 183, 137, 137, 33, 137, 20, 4, 174, 34, 177,
2292 202, 203, 3, 4, 7, 22, 23, 24, 35, 36,
2293 57, 145, 184, 211, 212, 213, 213, 213, 213, 179,
2294 177, 177, 137, 171, 137, 171, 213, 142, 137, 137,
2295 137, 137, 137, 137, 213, 213, 33, 137, 179, 177,
2296 214, 135, 166, 168, 137, 137, 137, 141, 183, 183,
2297 183, 183, 183, 183, 177, 183, 167, 137, 141, 59,
2298 210, 185, 137, 137, 213, 213, 213, 12, 53, 12,
2299 223, 213, 142, 214, 177, 214, 214, 214, 137, 137,
2300 177, 214, 213, 213, 137, 183, 183, 214, 137, 141,
2301 137, 137, 141, 141, 141, 141, 200, 201, 34, 177,
2302 169, 20, 146, 16, 16, 140, 137, 137, 213, 4,
2303 213, 137, 213, 137, 137, 137, 213, 213, 140, 177,
2304 141, 141, 183, 183, 183, 167, 172, 173, 137, 213,
2305 213, 177, 222, 213, 213, 137, 171, 171, 213, 137,
2306 214, 214, 214, 222, 213, 141, 141, 141, 201, 53,
2307 170, 20, 137, 142, 213, 137, 141, 144, 213, 141,
2308 4, 16, 144, 158, 219, 167, 177, 169, 144, 169,
2309 213, 211, 144, 158, 213, 33, 137, 211, 167, 16,
2310 16, 137, 213, 213, 16, 72, 213, 16, 213
Reid Spencer3822ff52006-11-08 06:47:33 +00002311};
Reid Spencer68a24bd2005-08-27 18:50:39 +00002312
2313#define yyerrok (yyerrstatus = 0)
2314#define yyclearin (yychar = YYEMPTY)
Reid Spencer3822ff52006-11-08 06:47:33 +00002315#define YYEMPTY (-2)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002316#define YYEOF 0
Reid Spencer3822ff52006-11-08 06:47:33 +00002317
Reid Spencer68a24bd2005-08-27 18:50:39 +00002318#define YYACCEPT goto yyacceptlab
Reid Spencer3822ff52006-11-08 06:47:33 +00002319#define YYABORT goto yyabortlab
2320#define YYERROR goto yyerrorlab
2321
2322
2323/* Like YYERROR except do call yyerror. This remains here temporarily
2324 to ease the transition to the new meaning of YYERROR, for GCC.
Reid Spencer68a24bd2005-08-27 18:50:39 +00002325 Once GCC version 2 has supplanted version 1, this can go. */
Reid Spencer3822ff52006-11-08 06:47:33 +00002326
Reid Spencer68a24bd2005-08-27 18:50:39 +00002327#define YYFAIL goto yyerrlab
Reid Spencer3822ff52006-11-08 06:47:33 +00002328
Reid Spencer68a24bd2005-08-27 18:50:39 +00002329#define YYRECOVERING() (!!yyerrstatus)
Reid Spencer3822ff52006-11-08 06:47:33 +00002330
2331#define YYBACKUP(Token, Value) \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002332do \
2333 if (yychar == YYEMPTY && yylen == 1) \
Reid Spencer3822ff52006-11-08 06:47:33 +00002334 { \
2335 yychar = (Token); \
2336 yylval = (Value); \
2337 yytoken = YYTRANSLATE (yychar); \
Andrew Lenharth6353e052006-12-08 18:07:09 +00002338 YYPOPSTACK; \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002339 goto yybackup; \
2340 } \
2341 else \
Reid Spencere4d87aa2006-12-23 06:05:41 +00002342 { \
2343 yyerror (YY_("syntax error: cannot back up")); \
Reid Spencer3822ff52006-11-08 06:47:33 +00002344 YYERROR; \
2345 } \
Andrew Lenharth6353e052006-12-08 18:07:09 +00002346while (0)
Reid Spencer3822ff52006-11-08 06:47:33 +00002347
Reid Spencere4d87aa2006-12-23 06:05:41 +00002348
Reid Spencer68a24bd2005-08-27 18:50:39 +00002349#define YYTERROR 1
2350#define YYERRCODE 256
2351
Reid Spencer3822ff52006-11-08 06:47:33 +00002352
Reid Spencere4d87aa2006-12-23 06:05:41 +00002353/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2354 If N is 0, then set CURRENT to the empty location which ends
2355 the previous symbol: RHS[0] (always defined). */
2356
2357#define YYRHSLOC(Rhs, K) ((Rhs)[K])
Reid Spencer3822ff52006-11-08 06:47:33 +00002358#ifndef YYLLOC_DEFAULT
Reid Spencere4d87aa2006-12-23 06:05:41 +00002359# define YYLLOC_DEFAULT(Current, Rhs, N) \
2360 do \
2361 if (N) \
2362 { \
2363 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2364 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2365 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2366 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2367 } \
2368 else \
2369 { \
2370 (Current).first_line = (Current).last_line = \
2371 YYRHSLOC (Rhs, 0).last_line; \
2372 (Current).first_column = (Current).last_column = \
2373 YYRHSLOC (Rhs, 0).last_column; \
2374 } \
2375 while (0)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002376#endif
2377
Reid Spencere4d87aa2006-12-23 06:05:41 +00002378
2379/* YY_LOCATION_PRINT -- Print the location on the stream.
2380 This macro was not mandated originally: define only if we know
2381 we won't break user code: when these are the locations we know. */
2382
2383#ifndef YY_LOCATION_PRINT
2384# if YYLTYPE_IS_TRIVIAL
2385# define YY_LOCATION_PRINT(File, Loc) \
2386 fprintf (File, "%d.%d-%d.%d", \
2387 (Loc).first_line, (Loc).first_column, \
2388 (Loc).last_line, (Loc).last_column)
2389# else
2390# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2391# endif
2392#endif
2393
2394
Reid Spencer3822ff52006-11-08 06:47:33 +00002395/* YYLEX -- calling `yylex' with the right arguments. */
2396
Reid Spencer68a24bd2005-08-27 18:50:39 +00002397#ifdef YYLEX_PARAM
Reid Spencer3822ff52006-11-08 06:47:33 +00002398# define YYLEX yylex (YYLEX_PARAM)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002399#else
Reid Spencer3822ff52006-11-08 06:47:33 +00002400# define YYLEX yylex ()
Chris Lattnerf49c1762006-11-08 05:58:47 +00002401#endif
Reid Spencer3822ff52006-11-08 06:47:33 +00002402
2403/* Enable debugging if requested. */
2404#if YYDEBUG
2405
2406# ifndef YYFPRINTF
2407# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2408# define YYFPRINTF fprintf
2409# endif
2410
2411# define YYDPRINTF(Args) \
2412do { \
2413 if (yydebug) \
2414 YYFPRINTF Args; \
Andrew Lenharth6353e052006-12-08 18:07:09 +00002415} while (0)
Reid Spencer3822ff52006-11-08 06:47:33 +00002416
Reid Spencere4d87aa2006-12-23 06:05:41 +00002417# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
Andrew Lenharth6353e052006-12-08 18:07:09 +00002418do { \
2419 if (yydebug) \
2420 { \
2421 YYFPRINTF (stderr, "%s ", Title); \
Reid Spencere4d87aa2006-12-23 06:05:41 +00002422 yysymprint (stderr, \
2423 Type, Value); \
Andrew Lenharth6353e052006-12-08 18:07:09 +00002424 YYFPRINTF (stderr, "\n"); \
2425 } \
2426} while (0)
Reid Spencer3822ff52006-11-08 06:47:33 +00002427
2428/*------------------------------------------------------------------.
2429| yy_stack_print -- Print the state stack from its BOTTOM up to its |
2430| TOP (included). |
2431`------------------------------------------------------------------*/
2432
Andrew Lenharth6353e052006-12-08 18:07:09 +00002433#if defined (__STDC__) || defined (__cplusplus)
Reid Spencer3822ff52006-11-08 06:47:33 +00002434static void
Reid Spencere4d87aa2006-12-23 06:05:41 +00002435yy_stack_print (short int *bottom, short int *top)
Chris Lattnerf49c1762006-11-08 05:58:47 +00002436#else
Reid Spencer3822ff52006-11-08 06:47:33 +00002437static void
2438yy_stack_print (bottom, top)
Reid Spencere4d87aa2006-12-23 06:05:41 +00002439 short int *bottom;
2440 short int *top;
Chris Lattnerf49c1762006-11-08 05:58:47 +00002441#endif
Reid Spencer3822ff52006-11-08 06:47:33 +00002442{
2443 YYFPRINTF (stderr, "Stack now");
Andrew Lenharth6353e052006-12-08 18:07:09 +00002444 for (/* Nothing. */; bottom <= top; ++bottom)
Reid Spencer3822ff52006-11-08 06:47:33 +00002445 YYFPRINTF (stderr, " %d", *bottom);
2446 YYFPRINTF (stderr, "\n");
2447}
2448
2449# define YY_STACK_PRINT(Bottom, Top) \
2450do { \
2451 if (yydebug) \
2452 yy_stack_print ((Bottom), (Top)); \
Andrew Lenharth6353e052006-12-08 18:07:09 +00002453} while (0)
Reid Spencer3822ff52006-11-08 06:47:33 +00002454
2455
2456/*------------------------------------------------.
2457| Report that the YYRULE is going to be reduced. |
2458`------------------------------------------------*/
2459
Andrew Lenharth6353e052006-12-08 18:07:09 +00002460#if defined (__STDC__) || defined (__cplusplus)
Reid Spencer3822ff52006-11-08 06:47:33 +00002461static void
Andrew Lenharth6353e052006-12-08 18:07:09 +00002462yy_reduce_print (int yyrule)
Reid Spencer3822ff52006-11-08 06:47:33 +00002463#else
2464static void
Andrew Lenharth6353e052006-12-08 18:07:09 +00002465yy_reduce_print (yyrule)
Reid Spencer3822ff52006-11-08 06:47:33 +00002466 int yyrule;
Chris Lattner1ae022f2006-10-22 06:08:13 +00002467#endif
Reid Spencer3822ff52006-11-08 06:47:33 +00002468{
2469 int yyi;
Reid Spencere4d87aa2006-12-23 06:05:41 +00002470 unsigned long int yylno = yyrline[yyrule];
2471 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
Andrew Lenharth6353e052006-12-08 18:07:09 +00002472 yyrule - 1, yylno);
2473 /* Print the symbols being reduced, and their result. */
2474 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
Reid Spencere4d87aa2006-12-23 06:05:41 +00002475 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2476 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
Reid Spencer3822ff52006-11-08 06:47:33 +00002477}
Reid Spencer21be8652006-10-22 07:03:43 +00002478
Reid Spencer3822ff52006-11-08 06:47:33 +00002479# define YY_REDUCE_PRINT(Rule) \
2480do { \
2481 if (yydebug) \
Andrew Lenharth6353e052006-12-08 18:07:09 +00002482 yy_reduce_print (Rule); \
2483} while (0)
Reid Spencer21be8652006-10-22 07:03:43 +00002484
Reid Spencer3822ff52006-11-08 06:47:33 +00002485/* Nonzero means print parse trace. It is left uninitialized so that
2486 multiple parsers can coexist. */
2487int yydebug;
2488#else /* !YYDEBUG */
2489# define YYDPRINTF(Args)
Reid Spencere4d87aa2006-12-23 06:05:41 +00002490# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
Reid Spencer3822ff52006-11-08 06:47:33 +00002491# define YY_STACK_PRINT(Bottom, Top)
2492# define YY_REDUCE_PRINT(Rule)
2493#endif /* !YYDEBUG */
Reid Spencer21be8652006-10-22 07:03:43 +00002494
Reid Spencer21be8652006-10-22 07:03:43 +00002495
Reid Spencer3822ff52006-11-08 06:47:33 +00002496/* YYINITDEPTH -- initial size of the parser's stacks. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002497#ifndef YYINITDEPTH
Reid Spencer3822ff52006-11-08 06:47:33 +00002498# define YYINITDEPTH 200
Reid Spencer68a24bd2005-08-27 18:50:39 +00002499#endif
2500
Reid Spencer3822ff52006-11-08 06:47:33 +00002501/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2502 if the built-in stack extension method is used).
Reid Spencer68a24bd2005-08-27 18:50:39 +00002503
Reid Spencer3822ff52006-11-08 06:47:33 +00002504 Do not make this value too large; the results are undefined if
Reid Spencere4d87aa2006-12-23 06:05:41 +00002505 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
Reid Spencer3822ff52006-11-08 06:47:33 +00002506 evaluated with infinite-precision integer arithmetic. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002507
2508#ifndef YYMAXDEPTH
Reid Spencer3822ff52006-11-08 06:47:33 +00002509# define YYMAXDEPTH 10000
Reid Spencer68a24bd2005-08-27 18:50:39 +00002510#endif
Reid Spencer3822ff52006-11-08 06:47:33 +00002511
Reid Spencer68a24bd2005-08-27 18:50:39 +00002512
2513
Reid Spencer3822ff52006-11-08 06:47:33 +00002514#if YYERROR_VERBOSE
Reid Spencer68a24bd2005-08-27 18:50:39 +00002515
Reid Spencer3822ff52006-11-08 06:47:33 +00002516# ifndef yystrlen
Andrew Lenharth6353e052006-12-08 18:07:09 +00002517# if defined (__GLIBC__) && defined (_STRING_H)
Reid Spencer3822ff52006-11-08 06:47:33 +00002518# define yystrlen strlen
2519# else
2520/* Return the length of YYSTR. */
2521static YYSIZE_T
Andrew Lenharth6353e052006-12-08 18:07:09 +00002522# if defined (__STDC__) || defined (__cplusplus)
Reid Spencer3822ff52006-11-08 06:47:33 +00002523yystrlen (const char *yystr)
Andrew Lenharth6353e052006-12-08 18:07:09 +00002524# else
Reid Spencer3822ff52006-11-08 06:47:33 +00002525yystrlen (yystr)
Andrew Lenharth6353e052006-12-08 18:07:09 +00002526 const char *yystr;
2527# endif
Chris Lattnerf49c1762006-11-08 05:58:47 +00002528{
Reid Spencere4d87aa2006-12-23 06:05:41 +00002529 const char *yys = yystr;
Andrew Lenharth6353e052006-12-08 18:07:09 +00002530
2531 while (*yys++ != '\0')
Reid Spencer3822ff52006-11-08 06:47:33 +00002532 continue;
Andrew Lenharth6353e052006-12-08 18:07:09 +00002533
2534 return yys - yystr - 1;
Chris Lattnerf49c1762006-11-08 05:58:47 +00002535}
Reid Spencer3822ff52006-11-08 06:47:33 +00002536# endif
2537# endif
Chris Lattnerf49c1762006-11-08 05:58:47 +00002538
Reid Spencer3822ff52006-11-08 06:47:33 +00002539# ifndef yystpcpy
Andrew Lenharth6353e052006-12-08 18:07:09 +00002540# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
Reid Spencer3822ff52006-11-08 06:47:33 +00002541# define yystpcpy stpcpy
2542# else
2543/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2544 YYDEST. */
2545static char *
Andrew Lenharth6353e052006-12-08 18:07:09 +00002546# if defined (__STDC__) || defined (__cplusplus)
Reid Spencer3822ff52006-11-08 06:47:33 +00002547yystpcpy (char *yydest, const char *yysrc)
Andrew Lenharth6353e052006-12-08 18:07:09 +00002548# else
Reid Spencer3822ff52006-11-08 06:47:33 +00002549yystpcpy (yydest, yysrc)
Andrew Lenharth6353e052006-12-08 18:07:09 +00002550 char *yydest;
2551 const char *yysrc;
2552# endif
Chris Lattnerf49c1762006-11-08 05:58:47 +00002553{
Reid Spencere4d87aa2006-12-23 06:05:41 +00002554 char *yyd = yydest;
2555 const char *yys = yysrc;
Chris Lattnerf49c1762006-11-08 05:58:47 +00002556
Reid Spencer3822ff52006-11-08 06:47:33 +00002557 while ((*yyd++ = *yys++) != '\0')
2558 continue;
2559
2560 return yyd - 1;
Chris Lattnerf49c1762006-11-08 05:58:47 +00002561}
Reid Spencer3822ff52006-11-08 06:47:33 +00002562# endif
2563# endif
Chris Lattnerf49c1762006-11-08 05:58:47 +00002564
Reid Spencere4d87aa2006-12-23 06:05:41 +00002565# ifndef yytnamerr
2566/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2567 quotes and backslashes, so that it's suitable for yyerror. The
2568 heuristic is that double-quoting is unnecessary unless the string
2569 contains an apostrophe, a comma, or backslash (other than
2570 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2571 null, do not copy; instead, return the length of what the result
2572 would have been. */
2573static YYSIZE_T
2574yytnamerr (char *yyres, const char *yystr)
2575{
2576 if (*yystr == '"')
2577 {
2578 size_t yyn = 0;
2579 char const *yyp = yystr;
2580
2581 for (;;)
2582 switch (*++yyp)
2583 {
2584 case '\'':
2585 case ',':
2586 goto do_not_strip_quotes;
2587
2588 case '\\':
2589 if (*++yyp != '\\')
2590 goto do_not_strip_quotes;
2591 /* Fall through. */
2592 default:
2593 if (yyres)
2594 yyres[yyn] = *yyp;
2595 yyn++;
2596 break;
2597
2598 case '"':
2599 if (yyres)
2600 yyres[yyn] = '\0';
2601 return yyn;
2602 }
2603 do_not_strip_quotes: ;
2604 }
2605
2606 if (! yyres)
2607 return yystrlen (yystr);
2608
2609 return yystpcpy (yyres, yystr) - yyres;
2610}
2611# endif
2612
2613#endif /* YYERROR_VERBOSE */
Reid Spencer3822ff52006-11-08 06:47:33 +00002614
Reid Spencer21be8652006-10-22 07:03:43 +00002615
2616
Andrew Lenharth6353e052006-12-08 18:07:09 +00002617#if YYDEBUG
2618/*--------------------------------.
2619| Print this symbol on YYOUTPUT. |
2620`--------------------------------*/
Reid Spencer3822ff52006-11-08 06:47:33 +00002621
Andrew Lenharth6353e052006-12-08 18:07:09 +00002622#if defined (__STDC__) || defined (__cplusplus)
Reid Spencer3822ff52006-11-08 06:47:33 +00002623static void
Andrew Lenharth6353e052006-12-08 18:07:09 +00002624yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
Reid Spencer3822ff52006-11-08 06:47:33 +00002625#else
2626static void
Andrew Lenharth6353e052006-12-08 18:07:09 +00002627yysymprint (yyoutput, yytype, yyvaluep)
2628 FILE *yyoutput;
Reid Spencer3822ff52006-11-08 06:47:33 +00002629 int yytype;
2630 YYSTYPE *yyvaluep;
2631#endif
2632{
Andrew Lenharth6353e052006-12-08 18:07:09 +00002633 /* Pacify ``unused variable'' warnings. */
2634 (void) yyvaluep;
Reid Spencer3822ff52006-11-08 06:47:33 +00002635
Andrew Lenharth6353e052006-12-08 18:07:09 +00002636 if (yytype < YYNTOKENS)
Reid Spencere4d87aa2006-12-23 06:05:41 +00002637 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
Andrew Lenharth6353e052006-12-08 18:07:09 +00002638 else
2639 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2640
Reid Spencere4d87aa2006-12-23 06:05:41 +00002641
2642# ifdef YYPRINT
2643 if (yytype < YYNTOKENS)
2644 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2645# endif
Andrew Lenharth6353e052006-12-08 18:07:09 +00002646 switch (yytype)
2647 {
2648 default:
2649 break;
2650 }
2651 YYFPRINTF (yyoutput, ")");
2652}
2653
2654#endif /* ! YYDEBUG */
2655/*-----------------------------------------------.
2656| Release the memory associated to this symbol. |
2657`-----------------------------------------------*/
2658
2659#if defined (__STDC__) || defined (__cplusplus)
2660static void
Reid Spencere4d87aa2006-12-23 06:05:41 +00002661yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
Andrew Lenharth6353e052006-12-08 18:07:09 +00002662#else
2663static void
Reid Spencere4d87aa2006-12-23 06:05:41 +00002664yydestruct (yymsg, yytype, yyvaluep)
2665 const char *yymsg;
Andrew Lenharth6353e052006-12-08 18:07:09 +00002666 int yytype;
2667 YYSTYPE *yyvaluep;
2668#endif
2669{
2670 /* Pacify ``unused variable'' warnings. */
2671 (void) yyvaluep;
Reid Spencer3822ff52006-11-08 06:47:33 +00002672
Reid Spencere4d87aa2006-12-23 06:05:41 +00002673 if (!yymsg)
2674 yymsg = "Deleting";
2675 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2676
Reid Spencer3822ff52006-11-08 06:47:33 +00002677 switch (yytype)
2678 {
2679
2680 default:
Andrew Lenharth6353e052006-12-08 18:07:09 +00002681 break;
Reid Spencer3822ff52006-11-08 06:47:33 +00002682 }
2683}
2684
2685
2686/* Prevent warnings from -Wmissing-prototypes. */
2687
2688#ifdef YYPARSE_PARAM
Andrew Lenharth6353e052006-12-08 18:07:09 +00002689# if defined (__STDC__) || defined (__cplusplus)
Reid Spencer3822ff52006-11-08 06:47:33 +00002690int yyparse (void *YYPARSE_PARAM);
Andrew Lenharth6353e052006-12-08 18:07:09 +00002691# else
Reid Spencer3822ff52006-11-08 06:47:33 +00002692int yyparse ();
Andrew Lenharth6353e052006-12-08 18:07:09 +00002693# endif
Reid Spencer3822ff52006-11-08 06:47:33 +00002694#else /* ! YYPARSE_PARAM */
Andrew Lenharth6353e052006-12-08 18:07:09 +00002695#if defined (__STDC__) || defined (__cplusplus)
Reid Spencere812fb22006-01-19 01:21:04 +00002696int yyparse (void);
Chris Lattnerf49c1762006-11-08 05:58:47 +00002697#else
Reid Spencer3822ff52006-11-08 06:47:33 +00002698int yyparse ();
2699#endif
2700#endif /* ! YYPARSE_PARAM */
2701
2702
2703
Reid Spencere4d87aa2006-12-23 06:05:41 +00002704/* The look-ahead symbol. */
Reid Spencer3822ff52006-11-08 06:47:33 +00002705int yychar;
2706
Reid Spencere4d87aa2006-12-23 06:05:41 +00002707/* The semantic value of the look-ahead symbol. */
Reid Spencer3822ff52006-11-08 06:47:33 +00002708YYSTYPE yylval;
2709
2710/* Number of syntax errors so far. */
2711int yynerrs;
2712
2713
2714
2715/*----------.
2716| yyparse. |
2717`----------*/
2718
2719#ifdef YYPARSE_PARAM
Andrew Lenharth6353e052006-12-08 18:07:09 +00002720# if defined (__STDC__) || defined (__cplusplus)
2721int yyparse (void *YYPARSE_PARAM)
2722# else
2723int yyparse (YYPARSE_PARAM)
2724 void *YYPARSE_PARAM;
2725# endif
Reid Spencer3822ff52006-11-08 06:47:33 +00002726#else /* ! YYPARSE_PARAM */
Andrew Lenharth6353e052006-12-08 18:07:09 +00002727#if defined (__STDC__) || defined (__cplusplus)
Reid Spencer3822ff52006-11-08 06:47:33 +00002728int
2729yyparse (void)
2730#else
2731int
2732yyparse ()
2733
2734#endif
2735#endif
2736{
2737
Reid Spencere4d87aa2006-12-23 06:05:41 +00002738 int yystate;
2739 int yyn;
Reid Spencer3822ff52006-11-08 06:47:33 +00002740 int yyresult;
2741 /* Number of tokens to shift before error messages enabled. */
2742 int yyerrstatus;
Reid Spencere4d87aa2006-12-23 06:05:41 +00002743 /* Look-ahead token as an internal (translated) token number. */
Reid Spencer3822ff52006-11-08 06:47:33 +00002744 int yytoken = 0;
2745
2746 /* Three stacks and their tools:
2747 `yyss': related to states,
2748 `yyvs': related to semantic values,
2749 `yyls': related to locations.
2750
2751 Refer to the stacks thru separate pointers, to allow yyoverflow
2752 to reallocate them elsewhere. */
2753
2754 /* The state stack. */
Reid Spencere4d87aa2006-12-23 06:05:41 +00002755 short int yyssa[YYINITDEPTH];
2756 short int *yyss = yyssa;
2757 short int *yyssp;
Reid Spencer3822ff52006-11-08 06:47:33 +00002758
2759 /* The semantic value stack. */
2760 YYSTYPE yyvsa[YYINITDEPTH];
2761 YYSTYPE *yyvs = yyvsa;
Reid Spencere4d87aa2006-12-23 06:05:41 +00002762 YYSTYPE *yyvsp;
Reid Spencer3822ff52006-11-08 06:47:33 +00002763
2764
2765
Andrew Lenharth6353e052006-12-08 18:07:09 +00002766#define YYPOPSTACK (yyvsp--, yyssp--)
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +00002767
Reid Spencer3822ff52006-11-08 06:47:33 +00002768 YYSIZE_T yystacksize = YYINITDEPTH;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +00002769
Reid Spencer3822ff52006-11-08 06:47:33 +00002770 /* The variables used to return semantic value and location from the
2771 action routines. */
2772 YYSTYPE yyval;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +00002773
2774
Andrew Lenharth6353e052006-12-08 18:07:09 +00002775 /* When reducing, the number of symbols on the RHS of the reduced
2776 rule. */
2777 int yylen;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +00002778
Reid Spencer3822ff52006-11-08 06:47:33 +00002779 YYDPRINTF ((stderr, "Starting parse\n"));
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +00002780
Reid Spencer68a24bd2005-08-27 18:50:39 +00002781 yystate = 0;
2782 yyerrstatus = 0;
2783 yynerrs = 0;
2784 yychar = YYEMPTY; /* Cause a token to be read. */
2785
2786 /* Initialize stack pointers.
2787 Waste one element of value and location stack
2788 so that they stay on the same level as the state stack.
2789 The wasted elements are never initialized. */
2790
Reid Spencer3822ff52006-11-08 06:47:33 +00002791 yyssp = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002792 yyvsp = yyvs;
2793
Reid Spencer3822ff52006-11-08 06:47:33 +00002794 goto yysetstate;
Jeff Cohen66c5fd62005-10-23 04:37:20 +00002795
Reid Spencer3822ff52006-11-08 06:47:33 +00002796/*------------------------------------------------------------.
2797| yynewstate -- Push a new state, which is found in yystate. |
2798`------------------------------------------------------------*/
2799 yynewstate:
2800 /* In all cases, when you get here, the value and location stacks
Andrew Lenharth6353e052006-12-08 18:07:09 +00002801 have just been pushed. so pushing a state here evens the stacks.
2802 */
Reid Spencer3822ff52006-11-08 06:47:33 +00002803 yyssp++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002804
Reid Spencer3822ff52006-11-08 06:47:33 +00002805 yysetstate:
2806 *yyssp = yystate;
2807
2808 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002809 {
2810 /* Get the current used size of the three stacks, in elements. */
Reid Spencer3822ff52006-11-08 06:47:33 +00002811 YYSIZE_T yysize = yyssp - yyss + 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002812
2813#ifdef yyoverflow
Reid Spencer3822ff52006-11-08 06:47:33 +00002814 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00002815 /* Give user a chance to reallocate the stack. Use copies of
Reid Spencer3822ff52006-11-08 06:47:33 +00002816 these so that the &'s don't force the real ones into
2817 memory. */
2818 YYSTYPE *yyvs1 = yyvs;
Reid Spencere4d87aa2006-12-23 06:05:41 +00002819 short int *yyss1 = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002820
Reid Spencer3822ff52006-11-08 06:47:33 +00002821
2822 /* Each stack pointer address is followed by the size of the
2823 data in use in that stack, in bytes. This used to be a
2824 conditional around just the two extra args, but that might
2825 be undefined if yyoverflow is a macro. */
Reid Spencere4d87aa2006-12-23 06:05:41 +00002826 yyoverflow (YY_("memory exhausted"),
Reid Spencer3822ff52006-11-08 06:47:33 +00002827 &yyss1, yysize * sizeof (*yyssp),
2828 &yyvs1, yysize * sizeof (*yyvsp),
2829
2830 &yystacksize);
2831
2832 yyss = yyss1;
2833 yyvs = yyvs1;
2834 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00002835#else /* no yyoverflow */
Reid Spencer3822ff52006-11-08 06:47:33 +00002836# ifndef YYSTACK_RELOCATE
Reid Spencere4d87aa2006-12-23 06:05:41 +00002837 goto yyexhaustedlab;
Reid Spencer3822ff52006-11-08 06:47:33 +00002838# else
Reid Spencer68a24bd2005-08-27 18:50:39 +00002839 /* Extend the stack our own way. */
Reid Spencer3822ff52006-11-08 06:47:33 +00002840 if (YYMAXDEPTH <= yystacksize)
Reid Spencere4d87aa2006-12-23 06:05:41 +00002841 goto yyexhaustedlab;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002842 yystacksize *= 2;
Reid Spencer3822ff52006-11-08 06:47:33 +00002843 if (YYMAXDEPTH < yystacksize)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002844 yystacksize = YYMAXDEPTH;
Reid Spencer3822ff52006-11-08 06:47:33 +00002845
2846 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00002847 short int *yyss1 = yyss;
Reid Spencer3822ff52006-11-08 06:47:33 +00002848 union yyalloc *yyptr =
2849 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2850 if (! yyptr)
Reid Spencere4d87aa2006-12-23 06:05:41 +00002851 goto yyexhaustedlab;
Reid Spencer3822ff52006-11-08 06:47:33 +00002852 YYSTACK_RELOCATE (yyss);
2853 YYSTACK_RELOCATE (yyvs);
2854
2855# undef YYSTACK_RELOCATE
2856 if (yyss1 != yyssa)
2857 YYSTACK_FREE (yyss1);
2858 }
2859# endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00002860#endif /* no yyoverflow */
2861
Reid Spencer3822ff52006-11-08 06:47:33 +00002862 yyssp = yyss + yysize - 1;
2863 yyvsp = yyvs + yysize - 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002864
2865
Reid Spencer3822ff52006-11-08 06:47:33 +00002866 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2867 (unsigned long int) yystacksize));
2868
2869 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002870 YYABORT;
2871 }
2872
Reid Spencer3822ff52006-11-08 06:47:33 +00002873 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Reid Spencer68a24bd2005-08-27 18:50:39 +00002874
2875 goto yybackup;
Reid Spencer3822ff52006-11-08 06:47:33 +00002876
2877/*-----------.
2878| yybackup. |
2879`-----------*/
2880yybackup:
Reid Spencer68a24bd2005-08-27 18:50:39 +00002881
Andrew Lenharth6353e052006-12-08 18:07:09 +00002882/* Do appropriate processing given the current state. */
Reid Spencere4d87aa2006-12-23 06:05:41 +00002883/* Read a look-ahead token if we need one and don't already have one. */
Andrew Lenharth6353e052006-12-08 18:07:09 +00002884/* yyresume: */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002885
Reid Spencere4d87aa2006-12-23 06:05:41 +00002886 /* First try to decide what to do without reference to look-ahead token. */
Andrew Lenharth6353e052006-12-08 18:07:09 +00002887
Reid Spencer68a24bd2005-08-27 18:50:39 +00002888 yyn = yypact[yystate];
Reid Spencer3822ff52006-11-08 06:47:33 +00002889 if (yyn == YYPACT_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002890 goto yydefault;
2891
Reid Spencere4d87aa2006-12-23 06:05:41 +00002892 /* Not known => get a look-ahead token if don't already have one. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002893
Reid Spencere4d87aa2006-12-23 06:05:41 +00002894 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002895 if (yychar == YYEMPTY)
2896 {
Reid Spencer3822ff52006-11-08 06:47:33 +00002897 YYDPRINTF ((stderr, "Reading a token: "));
Reid Spencer68a24bd2005-08-27 18:50:39 +00002898 yychar = YYLEX;
2899 }
2900
Reid Spencer3822ff52006-11-08 06:47:33 +00002901 if (yychar <= YYEOF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002902 {
Reid Spencer3822ff52006-11-08 06:47:33 +00002903 yychar = yytoken = YYEOF;
2904 YYDPRINTF ((stderr, "Now at end of input.\n"));
Reid Spencer68a24bd2005-08-27 18:50:39 +00002905 }
2906 else
2907 {
Reid Spencer3822ff52006-11-08 06:47:33 +00002908 yytoken = YYTRANSLATE (yychar);
Reid Spencere4d87aa2006-12-23 06:05:41 +00002909 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Reid Spencer68a24bd2005-08-27 18:50:39 +00002910 }
2911
Reid Spencer3822ff52006-11-08 06:47:33 +00002912 /* If the proper action on seeing token YYTOKEN is to reduce or to
2913 detect an error, take that action. */
2914 yyn += yytoken;
2915 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002916 goto yydefault;
2917 yyn = yytable[yyn];
Reid Spencer3822ff52006-11-08 06:47:33 +00002918 if (yyn <= 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002919 {
Reid Spencer3822ff52006-11-08 06:47:33 +00002920 if (yyn == 0 || yyn == YYTABLE_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002921 goto yyerrlab;
2922 yyn = -yyn;
2923 goto yyreduce;
2924 }
2925
2926 if (yyn == YYFINAL)
2927 YYACCEPT;
2928
Reid Spencere4d87aa2006-12-23 06:05:41 +00002929 /* Shift the look-ahead token. */
2930 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
Andrew Lenharth6353e052006-12-08 18:07:09 +00002931
2932 /* Discard the token being shifted unless it is eof. */
2933 if (yychar != YYEOF)
2934 yychar = YYEMPTY;
2935
2936 *++yyvsp = yylval;
2937
2938
Reid Spencer3822ff52006-11-08 06:47:33 +00002939 /* Count tokens shifted since error; after three, turn off error
2940 status. */
2941 if (yyerrstatus)
2942 yyerrstatus--;
Chris Lattner224f84f2006-08-18 17:34:45 +00002943
Reid Spencer68a24bd2005-08-27 18:50:39 +00002944 yystate = yyn;
2945 goto yynewstate;
2946
Chris Lattnerf49c1762006-11-08 05:58:47 +00002947
Reid Spencer3822ff52006-11-08 06:47:33 +00002948/*-----------------------------------------------------------.
2949| yydefault -- do the default action for the current state. |
2950`-----------------------------------------------------------*/
2951yydefault:
Reid Spencer68a24bd2005-08-27 18:50:39 +00002952 yyn = yydefact[yystate];
2953 if (yyn == 0)
2954 goto yyerrlab;
Reid Spencer3822ff52006-11-08 06:47:33 +00002955 goto yyreduce;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002956
Reid Spencer3822ff52006-11-08 06:47:33 +00002957
2958/*-----------------------------.
2959| yyreduce -- Do a reduction. |
2960`-----------------------------*/
Reid Spencer68a24bd2005-08-27 18:50:39 +00002961yyreduce:
Reid Spencer3822ff52006-11-08 06:47:33 +00002962 /* yyn is the number of a rule to reduce with. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002963 yylen = yyr2[yyn];
2964
Reid Spencer3822ff52006-11-08 06:47:33 +00002965 /* If YYLEN is nonzero, implement the default value of the action:
2966 `$$ = $1'.
2967
2968 Otherwise, the following line sets YYVAL to garbage.
2969 This behavior is undocumented and Bison
2970 users should not rely upon it. Assigning to YYVAL
2971 unconditionally makes the parser a bit smaller, and it avoids a
2972 GCC warning that YYVAL may be used uninitialized. */
2973 yyval = yyvsp[1-yylen];
2974
2975
2976 YY_REDUCE_PRINT (yyn);
2977 switch (yyn)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002978 {
Reid Spencer3822ff52006-11-08 06:47:33 +00002979 case 3:
Reid Spencer63c34452007-01-05 21:51:07 +00002980#line 1020 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00002981 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00002982 if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range!
Reid Spencer61c83e02006-08-18 08:43:06 +00002983 GEN_ERROR("Value too large for type!");
Reid Spencere4d87aa2006-12-23 06:05:41 +00002984 (yyval.SIntVal) = (int32_t)(yyvsp[0].UIntVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00002985 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00002986;}
2987 break;
2988
Reid Spencere4d87aa2006-12-23 06:05:41 +00002989 case 31:
Reid Spencer63c34452007-01-05 21:51:07 +00002990#line 1036 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00002991 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
2992 break;
2993
2994 case 32:
Reid Spencer63c34452007-01-05 21:51:07 +00002995#line 1036 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00002996 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
2997 break;
2998
2999 case 33:
Reid Spencer63c34452007-01-05 21:51:07 +00003000#line 1037 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003001 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
3002 break;
3003
3004 case 34:
Reid Spencer63c34452007-01-05 21:51:07 +00003005#line 1037 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003006 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
3007 break;
3008
3009 case 35:
Reid Spencer63c34452007-01-05 21:51:07 +00003010#line 1038 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003011 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
3012 break;
3013
3014 case 36:
Reid Spencer63c34452007-01-05 21:51:07 +00003015#line 1038 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003016 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
3017 break;
3018
3019 case 37:
Reid Spencer63c34452007-01-05 21:51:07 +00003020#line 1039 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003021 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
3022 break;
3023
3024 case 38:
Reid Spencer63c34452007-01-05 21:51:07 +00003025#line 1039 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003026 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003027 break;
3028
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003029 case 39:
Reid Spencer63c34452007-01-05 21:51:07 +00003030#line 1040 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003031 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003032 break;
3033
3034 case 40:
Reid Spencer63c34452007-01-05 21:51:07 +00003035#line 1040 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003036 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003037 break;
3038
3039 case 41:
Reid Spencer63c34452007-01-05 21:51:07 +00003040#line 1044 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003041 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003042 break;
3043
3044 case 42:
Reid Spencer63c34452007-01-05 21:51:07 +00003045#line 1044 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003046 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003047 break;
3048
3049 case 43:
Reid Spencer63c34452007-01-05 21:51:07 +00003050#line 1045 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003051 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003052 break;
3053
3054 case 44:
Reid Spencer63c34452007-01-05 21:51:07 +00003055#line 1045 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003056 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003057 break;
3058
3059 case 45:
Reid Spencer63c34452007-01-05 21:51:07 +00003060#line 1046 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003061 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003062 break;
3063
3064 case 46:
Reid Spencer63c34452007-01-05 21:51:07 +00003065#line 1046 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003066 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003067 break;
3068
3069 case 47:
Reid Spencer63c34452007-01-05 21:51:07 +00003070#line 1047 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003071 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003072 break;
3073
3074 case 48:
Reid Spencer63c34452007-01-05 21:51:07 +00003075#line 1047 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003076 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003077 break;
3078
3079 case 49:
Reid Spencer63c34452007-01-05 21:51:07 +00003080#line 1048 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003081 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003082 break;
3083
3084 case 50:
Reid Spencer63c34452007-01-05 21:51:07 +00003085#line 1048 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003086 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003087 break;
3088
3089 case 51:
Reid Spencer63c34452007-01-05 21:51:07 +00003090#line 1049 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003091 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003092 break;
3093
3094 case 52:
Reid Spencer63c34452007-01-05 21:51:07 +00003095#line 1049 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003096 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003097 break;
3098
3099 case 53:
Reid Spencer63c34452007-01-05 21:51:07 +00003100#line 1050 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003101 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003102 break;
3103
3104 case 54:
Reid Spencer63c34452007-01-05 21:51:07 +00003105#line 1050 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003106 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003107 break;
3108
3109 case 55:
Reid Spencer63c34452007-01-05 21:51:07 +00003110#line 1051 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003111 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003112 break;
3113
3114 case 56:
Reid Spencer63c34452007-01-05 21:51:07 +00003115#line 1052 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003116 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003117 break;
3118
Reid Spencer14310612006-12-31 05:40:51 +00003119 case 63:
Reid Spencer63c34452007-01-05 21:51:07 +00003120#line 1061 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003121 {
3122 (yyval.StrVal) = (yyvsp[-1].StrVal);
3123 CHECK_FOR_ERROR
3124 ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003125 break;
3126
Reid Spencer14310612006-12-31 05:40:51 +00003127 case 64:
Reid Spencer63c34452007-01-05 21:51:07 +00003128#line 1065 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003129 {
3130 (yyval.StrVal) = 0;
3131 CHECK_FOR_ERROR
3132 ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003133 break;
3134
Reid Spencer14310612006-12-31 05:40:51 +00003135 case 65:
Reid Spencer63c34452007-01-05 21:51:07 +00003136#line 1071 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003137 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003138 break;
3139
Reid Spencer14310612006-12-31 05:40:51 +00003140 case 66:
Reid Spencer63c34452007-01-05 21:51:07 +00003141#line 1072 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003142 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003143 break;
3144
Reid Spencer14310612006-12-31 05:40:51 +00003145 case 67:
Reid Spencer63c34452007-01-05 21:51:07 +00003146#line 1073 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003147 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
3148 break;
3149
Reid Spencer14310612006-12-31 05:40:51 +00003150 case 68:
Reid Spencer63c34452007-01-05 21:51:07 +00003151#line 1074 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003152 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003153 break;
3154
Reid Spencer14310612006-12-31 05:40:51 +00003155 case 69:
Reid Spencer63c34452007-01-05 21:51:07 +00003156#line 1075 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003157 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003158 break;
3159
Reid Spencer14310612006-12-31 05:40:51 +00003160 case 70:
Reid Spencer63c34452007-01-05 21:51:07 +00003161#line 1079 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003162 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
3163 break;
3164
Reid Spencer14310612006-12-31 05:40:51 +00003165 case 71:
Reid Spencer63c34452007-01-05 21:51:07 +00003166#line 1080 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003167 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003168 break;
3169
Reid Spencer14310612006-12-31 05:40:51 +00003170 case 72:
Reid Spencer63c34452007-01-05 21:51:07 +00003171#line 1081 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003172 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003173 break;
3174
Reid Spencer14310612006-12-31 05:40:51 +00003175 case 73:
Reid Spencer63c34452007-01-05 21:51:07 +00003176#line 1085 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer14310612006-12-31 05:40:51 +00003177 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003178 break;
3179
Reid Spencer14310612006-12-31 05:40:51 +00003180 case 74:
Reid Spencer63c34452007-01-05 21:51:07 +00003181#line 1086 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer14310612006-12-31 05:40:51 +00003182 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003183 break;
3184
Reid Spencer14310612006-12-31 05:40:51 +00003185 case 75:
Reid Spencer63c34452007-01-05 21:51:07 +00003186#line 1087 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer14310612006-12-31 05:40:51 +00003187 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003188 break;
3189
Reid Spencer14310612006-12-31 05:40:51 +00003190 case 76:
Reid Spencer63c34452007-01-05 21:51:07 +00003191#line 1091 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer14310612006-12-31 05:40:51 +00003192 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
3193 break;
3194
3195 case 77:
Reid Spencer63c34452007-01-05 21:51:07 +00003196#line 1092 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003197 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003198 break;
3199
Reid Spencer14310612006-12-31 05:40:51 +00003200 case 78:
Reid Spencer63c34452007-01-05 21:51:07 +00003201#line 1093 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003202 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003203 break;
3204
Reid Spencer14310612006-12-31 05:40:51 +00003205 case 79:
Reid Spencer63c34452007-01-05 21:51:07 +00003206#line 1094 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003207 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003208 break;
3209
Reid Spencer14310612006-12-31 05:40:51 +00003210 case 80:
Reid Spencer63c34452007-01-05 21:51:07 +00003211#line 1095 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003212 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003213 break;
3214
Reid Spencer14310612006-12-31 05:40:51 +00003215 case 81:
Reid Spencer63c34452007-01-05 21:51:07 +00003216#line 1098 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003217 { (yyval.UIntVal) = CallingConv::C; ;}
3218 break;
3219
Reid Spencer14310612006-12-31 05:40:51 +00003220 case 82:
Reid Spencer63c34452007-01-05 21:51:07 +00003221#line 1099 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003222 { (yyval.UIntVal) = CallingConv::C; ;}
3223 break;
3224
Reid Spencer14310612006-12-31 05:40:51 +00003225 case 83:
Reid Spencer63c34452007-01-05 21:51:07 +00003226#line 1100 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003227 { (yyval.UIntVal) = CallingConv::CSRet; ;}
3228 break;
3229
Reid Spencer14310612006-12-31 05:40:51 +00003230 case 84:
Reid Spencer63c34452007-01-05 21:51:07 +00003231#line 1101 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003232 { (yyval.UIntVal) = CallingConv::Fast; ;}
3233 break;
3234
Reid Spencer14310612006-12-31 05:40:51 +00003235 case 85:
Reid Spencer63c34452007-01-05 21:51:07 +00003236#line 1102 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003237 { (yyval.UIntVal) = CallingConv::Cold; ;}
3238 break;
3239
Reid Spencer14310612006-12-31 05:40:51 +00003240 case 86:
Reid Spencer63c34452007-01-05 21:51:07 +00003241#line 1103 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003242 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
3243 break;
3244
Reid Spencer14310612006-12-31 05:40:51 +00003245 case 87:
Reid Spencer63c34452007-01-05 21:51:07 +00003246#line 1104 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003247 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3248 break;
3249
Reid Spencer14310612006-12-31 05:40:51 +00003250 case 88:
Reid Spencer63c34452007-01-05 21:51:07 +00003251#line 1105 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003252 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00003253 if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val))
Reid Spencer61c83e02006-08-18 08:43:06 +00003254 GEN_ERROR("Calling conv too large!");
Reid Spencere4d87aa2006-12-23 06:05:41 +00003255 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
Reid Spencer61c83e02006-08-18 08:43:06 +00003256 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003257 ;}
3258 break;
3259
Reid Spencer14310612006-12-31 05:40:51 +00003260 case 89:
Reid Spencer63c34452007-01-05 21:51:07 +00003261#line 1112 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer14310612006-12-31 05:40:51 +00003262 { (yyval.ParamAttrs) = FunctionType::ZExtAttribute; ;}
3263 break;
3264
3265 case 90:
Reid Spencer63c34452007-01-05 21:51:07 +00003266#line 1113 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer14310612006-12-31 05:40:51 +00003267 { (yyval.ParamAttrs) = FunctionType::SExtAttribute; ;}
3268 break;
3269
3270 case 91:
Reid Spencer63c34452007-01-05 21:51:07 +00003271#line 1116 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer218ded22007-01-05 17:07:23 +00003272 { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;}
Reid Spencer14310612006-12-31 05:40:51 +00003273 break;
3274
3275 case 92:
Reid Spencer63c34452007-01-05 21:51:07 +00003276#line 1117 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer14310612006-12-31 05:40:51 +00003277 {
Reid Spencer218ded22007-01-05 17:07:23 +00003278 (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs));
Reid Spencer14310612006-12-31 05:40:51 +00003279 ;}
3280 break;
3281
3282 case 93:
Reid Spencer63c34452007-01-05 21:51:07 +00003283#line 1122 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer218ded22007-01-05 17:07:23 +00003284 { (yyval.ParamAttrs) = FunctionType::NoReturnAttribute; ;}
Reid Spencer14310612006-12-31 05:40:51 +00003285 break;
3286
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003287 case 95:
Reid Spencer63c34452007-01-05 21:51:07 +00003288#line 1126 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer218ded22007-01-05 17:07:23 +00003289 { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;}
Reid Spencere4d87aa2006-12-23 06:05:41 +00003290 break;
3291
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003292 case 96:
Reid Spencer63c34452007-01-05 21:51:07 +00003293#line 1127 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer218ded22007-01-05 17:07:23 +00003294 {
3295 (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs));
3296 ;}
Reid Spencere4d87aa2006-12-23 06:05:41 +00003297 break;
3298
Reid Spencer14310612006-12-31 05:40:51 +00003299 case 97:
Reid Spencer63c34452007-01-05 21:51:07 +00003300#line 1134 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer14310612006-12-31 05:40:51 +00003301 { (yyval.UIntVal) = 0; ;}
3302 break;
3303
Reid Spencer218ded22007-01-05 17:07:23 +00003304 case 98:
Reid Spencer63c34452007-01-05 21:51:07 +00003305#line 1135 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer14310612006-12-31 05:40:51 +00003306 {
3307 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3308 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3309 GEN_ERROR("Alignment must be a power of two!");
3310 CHECK_FOR_ERROR
3311;}
3312 break;
3313
Reid Spencer218ded22007-01-05 17:07:23 +00003314 case 99:
Reid Spencer63c34452007-01-05 21:51:07 +00003315#line 1141 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer218ded22007-01-05 17:07:23 +00003316 { (yyval.UIntVal) = 0; ;}
3317 break;
3318
Reid Spencer14310612006-12-31 05:40:51 +00003319 case 100:
Reid Spencer63c34452007-01-05 21:51:07 +00003320#line 1142 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003321 {
Reid Spencer218ded22007-01-05 17:07:23 +00003322 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
3323 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3324 GEN_ERROR("Alignment must be a power of two!");
3325 CHECK_FOR_ERROR
3326;}
3327 break;
3328
3329 case 101:
Reid Spencer63c34452007-01-05 21:51:07 +00003330#line 1150 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer218ded22007-01-05 17:07:23 +00003331 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00003332 for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i)
3333 if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\')
3334 GEN_ERROR("Invalid character in section name!");
3335 (yyval.StrVal) = (yyvsp[0].StrVal);
3336 CHECK_FOR_ERROR
3337;}
3338 break;
3339
Reid Spencer218ded22007-01-05 17:07:23 +00003340 case 102:
Reid Spencer63c34452007-01-05 21:51:07 +00003341#line 1158 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003342 { (yyval.StrVal) = 0; ;}
3343 break;
3344
Reid Spencer218ded22007-01-05 17:07:23 +00003345 case 103:
Reid Spencer63c34452007-01-05 21:51:07 +00003346#line 1159 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003347 { (yyval.StrVal) = (yyvsp[0].StrVal); ;}
3348 break;
3349
Reid Spencer6fd36ab2006-12-29 20:35:03 +00003350 case 104:
Reid Spencer63c34452007-01-05 21:51:07 +00003351#line 1164 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer14310612006-12-31 05:40:51 +00003352 {;}
3353 break;
3354
3355 case 105:
Reid Spencer63c34452007-01-05 21:51:07 +00003356#line 1165 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer218ded22007-01-05 17:07:23 +00003357 {;}
3358 break;
3359
3360 case 106:
Reid Spencer63c34452007-01-05 21:51:07 +00003361#line 1166 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003362 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00003363 CurGV->setSection((yyvsp[0].StrVal));
3364 free((yyvsp[0].StrVal));
3365 CHECK_FOR_ERROR
3366 ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003367 break;
3368
Reid Spencer218ded22007-01-05 17:07:23 +00003369 case 107:
Reid Spencer63c34452007-01-05 21:51:07 +00003370#line 1171 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003371 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00003372 if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val)))
3373 GEN_ERROR("Alignment must be a power of two!");
3374 CurGV->setAlignment((yyvsp[0].UInt64Val));
3375 CHECK_FOR_ERROR
3376 ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003377 break;
3378
Reid Spencer218ded22007-01-05 17:07:23 +00003379 case 116:
Reid Spencer63c34452007-01-05 21:51:07 +00003380#line 1187 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencera132e042006-12-03 05:46:11 +00003381 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00003382 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
Reid Spencera132e042006-12-03 05:46:11 +00003383 CHECK_FOR_ERROR
3384 ;}
3385 break;
3386
Reid Spencer218ded22007-01-05 17:07:23 +00003387 case 117:
Reid Spencer63c34452007-01-05 21:51:07 +00003388#line 1191 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencera132e042006-12-03 05:46:11 +00003389 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00003390 (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType));
Reid Spencera132e042006-12-03 05:46:11 +00003391 CHECK_FOR_ERROR
3392 ;}
3393 break;
3394
Reid Spencer218ded22007-01-05 17:07:23 +00003395 case 118:
Reid Spencer63c34452007-01-05 21:51:07 +00003396#line 1195 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer14310612006-12-31 05:40:51 +00003397 { // Pointer type?
3398 if (*(yyvsp[-1].TypeVal) == Type::LabelTy)
3399 GEN_ERROR("Cannot form a pointer to a basic block");
3400 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal))));
3401 delete (yyvsp[-1].TypeVal);
3402 CHECK_FOR_ERROR
3403 ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003404 break;
3405
Reid Spencer218ded22007-01-05 17:07:23 +00003406 case 119:
Reid Spencer63c34452007-01-05 21:51:07 +00003407#line 1202 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer14310612006-12-31 05:40:51 +00003408 { // Named types are also simple types...
3409 const Type* tmp = getTypeVal((yyvsp[0].ValIDVal));
3410 CHECK_FOR_ERROR
3411 (yyval.TypeVal) = new PATypeHolder(tmp);
3412 ;}
3413 break;
3414
Reid Spencer218ded22007-01-05 17:07:23 +00003415 case 120:
Reid Spencer63c34452007-01-05 21:51:07 +00003416#line 1207 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3da59db2006-11-27 01:05:10 +00003417 { // Type UpReference
Reid Spencere4d87aa2006-12-23 06:05:41 +00003418 if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!");
Reid Spencer3da59db2006-11-27 01:05:10 +00003419 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Reid Spencere4d87aa2006-12-23 06:05:41 +00003420 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector...
3421 (yyval.TypeVal) = new PATypeHolder(OT);
Reid Spencer3da59db2006-11-27 01:05:10 +00003422 UR_OUT("New Upreference!\n");
Reid Spencer61c83e02006-08-18 08:43:06 +00003423 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003424 ;}
3425 break;
3426
Reid Spencer218ded22007-01-05 17:07:23 +00003427 case 121:
Reid Spencer63c34452007-01-05 21:51:07 +00003428#line 1215 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer14310612006-12-31 05:40:51 +00003429 {
Reid Spencer3da59db2006-11-27 01:05:10 +00003430 std::vector<const Type*> Params;
Reid Spencer14310612006-12-31 05:40:51 +00003431 std::vector<FunctionType::ParameterAttributes> Attrs;
Reid Spencer218ded22007-01-05 17:07:23 +00003432 Attrs.push_back((yyvsp[0].ParamAttrs));
3433 for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00003434 Params.push_back(I->Ty->get());
3435 if (I->Ty->get() != Type::VoidTy)
3436 Attrs.push_back(I->Attrs);
3437 }
Reid Spencer3da59db2006-11-27 01:05:10 +00003438 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3439 if (isVarArg) Params.pop_back();
3440
Reid Spencer14310612006-12-31 05:40:51 +00003441 FunctionType *FT = FunctionType::get(*(yyvsp[-4].TypeVal), Params, isVarArg, Attrs);
Reid Spencer218ded22007-01-05 17:07:23 +00003442 delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list
Reid Spencer14310612006-12-31 05:40:51 +00003443 delete (yyvsp[-4].TypeVal); // Delete the return type handle
3444 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Reid Spencere4d87aa2006-12-23 06:05:41 +00003445 CHECK_FOR_ERROR
3446 ;}
3447 break;
3448
Reid Spencer218ded22007-01-05 17:07:23 +00003449 case 122:
Reid Spencer63c34452007-01-05 21:51:07 +00003450#line 1233 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer14310612006-12-31 05:40:51 +00003451 {
3452 std::vector<const Type*> Params;
3453 std::vector<FunctionType::ParameterAttributes> Attrs;
Reid Spencer218ded22007-01-05 17:07:23 +00003454 Attrs.push_back((yyvsp[0].ParamAttrs));
3455 for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00003456 Params.push_back(I->Ty->get());
3457 if (I->Ty->get() != Type::VoidTy)
3458 Attrs.push_back(I->Attrs);
3459 }
3460 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3461 if (isVarArg) Params.pop_back();
3462
3463 FunctionType *FT = FunctionType::get((yyvsp[-4].PrimType), Params, isVarArg, Attrs);
Reid Spencer218ded22007-01-05 17:07:23 +00003464 delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list
Reid Spencer14310612006-12-31 05:40:51 +00003465 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
3466 CHECK_FOR_ERROR
3467 ;}
3468 break;
3469
Reid Spencer218ded22007-01-05 17:07:23 +00003470 case 123:
Reid Spencer63c34452007-01-05 21:51:07 +00003471#line 1251 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003472 { // Sized array type?
3473 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3474 delete (yyvsp[-1].TypeVal);
3475 CHECK_FOR_ERROR
3476 ;}
3477 break;
3478
Reid Spencer218ded22007-01-05 17:07:23 +00003479 case 124:
Reid Spencer63c34452007-01-05 21:51:07 +00003480#line 1256 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003481 { // Packed array type?
3482 const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get();
3483 if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val))
3484 GEN_ERROR("Unsigned result not equal to signed result");
3485 if (!ElemTy->isPrimitiveType())
3486 GEN_ERROR("Elemental type of a PackedType must be primitive");
3487 if (!isPowerOf2_32((yyvsp[-3].UInt64Val)))
3488 GEN_ERROR("Vector length should be a power of 2!");
3489 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3490 delete (yyvsp[-1].TypeVal);
3491 CHECK_FOR_ERROR
3492 ;}
3493 break;
3494
Reid Spencer218ded22007-01-05 17:07:23 +00003495 case 125:
Reid Spencer63c34452007-01-05 21:51:07 +00003496#line 1268 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003497 { // Structure type?
3498 std::vector<const Type*> Elements;
3499 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3500 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
3501 Elements.push_back(*I);
3502
3503 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3504 delete (yyvsp[-1].TypeList);
3505 CHECK_FOR_ERROR
3506 ;}
3507 break;
3508
Reid Spencer218ded22007-01-05 17:07:23 +00003509 case 126:
Reid Spencer63c34452007-01-05 21:51:07 +00003510#line 1278 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003511 { // Empty structure type?
3512 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
3513 CHECK_FOR_ERROR
3514 ;}
3515 break;
3516
Reid Spencer218ded22007-01-05 17:07:23 +00003517 case 127:
Reid Spencer63c34452007-01-05 21:51:07 +00003518#line 1282 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003519 {
3520 std::vector<const Type*> Elements;
3521 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-2].TypeList)->begin(),
3522 E = (yyvsp[-2].TypeList)->end(); I != E; ++I)
3523 Elements.push_back(*I);
3524
3525 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3526 delete (yyvsp[-2].TypeList);
3527 CHECK_FOR_ERROR
3528 ;}
3529 break;
3530
Reid Spencer218ded22007-01-05 17:07:23 +00003531 case 128:
Reid Spencer63c34452007-01-05 21:51:07 +00003532#line 1292 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003533 { // Empty structure type?
3534 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3535 CHECK_FOR_ERROR
3536 ;}
3537 break;
3538
Reid Spencer218ded22007-01-05 17:07:23 +00003539 case 129:
Reid Spencer63c34452007-01-05 21:51:07 +00003540#line 1299 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer14310612006-12-31 05:40:51 +00003541 {
3542 (yyval.TypeWithAttrs).Ty = (yyvsp[-1].TypeVal);
3543 (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs);
3544 ;}
3545 break;
3546
Reid Spencer14310612006-12-31 05:40:51 +00003547 case 130:
Reid Spencer63c34452007-01-05 21:51:07 +00003548#line 1306 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer14310612006-12-31 05:40:51 +00003549 {
Reid Spencer218ded22007-01-05 17:07:23 +00003550 if (!UpRefs.empty())
3551 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
3552 if (!(*(yyvsp[0].TypeVal))->isFirstClassType())
3553 GEN_ERROR("LLVM functions cannot return aggregate types!");
3554 (yyval.TypeVal) = (yyvsp[0].TypeVal);
Reid Spencer14310612006-12-31 05:40:51 +00003555 ;}
3556 break;
3557
3558 case 131:
Reid Spencer63c34452007-01-05 21:51:07 +00003559#line 1313 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer218ded22007-01-05 17:07:23 +00003560 {
3561 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
3562 ;}
3563 break;
3564
3565 case 132:
Reid Spencer63c34452007-01-05 21:51:07 +00003566#line 1318 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer14310612006-12-31 05:40:51 +00003567 {
3568 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3569 (yyval.TypeWithAttrsList)->push_back((yyvsp[0].TypeWithAttrs));
3570 CHECK_FOR_ERROR
3571 ;}
3572 break;
3573
Reid Spencer218ded22007-01-05 17:07:23 +00003574 case 133:
Reid Spencer63c34452007-01-05 21:51:07 +00003575#line 1323 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer14310612006-12-31 05:40:51 +00003576 {
3577 ((yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList))->push_back((yyvsp[0].TypeWithAttrs));
3578 CHECK_FOR_ERROR
3579 ;}
3580 break;
3581
Reid Spencer218ded22007-01-05 17:07:23 +00003582 case 135:
Reid Spencer63c34452007-01-05 21:51:07 +00003583#line 1331 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer14310612006-12-31 05:40:51 +00003584 {
3585 (yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList);
3586 TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet;
3587 TWA.Ty = new PATypeHolder(Type::VoidTy);
3588 (yyval.TypeWithAttrsList)->push_back(TWA);
Reid Spencere4d87aa2006-12-23 06:05:41 +00003589 CHECK_FOR_ERROR
3590 ;}
3591 break;
3592
Reid Spencer218ded22007-01-05 17:07:23 +00003593 case 136:
Reid Spencer63c34452007-01-05 21:51:07 +00003594#line 1338 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer14310612006-12-31 05:40:51 +00003595 {
3596 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
3597 TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet;
3598 TWA.Ty = new PATypeHolder(Type::VoidTy);
3599 (yyval.TypeWithAttrsList)->push_back(TWA);
3600 CHECK_FOR_ERROR
3601 ;}
3602 break;
3603
Reid Spencer218ded22007-01-05 17:07:23 +00003604 case 137:
Reid Spencer63c34452007-01-05 21:51:07 +00003605#line 1345 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer14310612006-12-31 05:40:51 +00003606 {
3607 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3608 CHECK_FOR_ERROR
3609 ;}
3610 break;
3611
Reid Spencer218ded22007-01-05 17:07:23 +00003612 case 138:
Reid Spencer63c34452007-01-05 21:51:07 +00003613#line 1353 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003614 {
3615 (yyval.TypeList) = new std::list<PATypeHolder>();
3616 (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
Reid Spencer3da59db2006-11-27 01:05:10 +00003617 CHECK_FOR_ERROR
3618 ;}
3619 break;
3620
Reid Spencer218ded22007-01-05 17:07:23 +00003621 case 139:
Reid Spencer63c34452007-01-05 21:51:07 +00003622#line 1358 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003623 {
3624 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
Reid Spencer3da59db2006-11-27 01:05:10 +00003625 CHECK_FOR_ERROR
3626 ;}
3627 break;
3628
Reid Spencer218ded22007-01-05 17:07:23 +00003629 case 140:
Reid Spencer63c34452007-01-05 21:51:07 +00003630#line 1369 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003631 { // Nonempty unsized arr
Reid Spencer14310612006-12-31 05:40:51 +00003632 if (!UpRefs.empty())
3633 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
Reid Spencere4d87aa2006-12-23 06:05:41 +00003634 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get());
3635 if (ATy == 0)
3636 GEN_ERROR("Cannot make array constant with type: '" +
3637 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
3638 const Type *ETy = ATy->getElementType();
3639 int NumElements = ATy->getNumElements();
3640
3641 // Verify that we have the correct size...
3642 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
3643 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3644 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
3645 itostr(NumElements) + "!");
3646
3647 // Verify all elements are correct type!
3648 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3649 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
3650 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3651 ETy->getDescription() +"' as required!\nIt is of type '"+
3652 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
3653 }
3654
3655 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector));
3656 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
Reid Spencer3da59db2006-11-27 01:05:10 +00003657 CHECK_FOR_ERROR
3658 ;}
3659 break;
3660
Reid Spencer218ded22007-01-05 17:07:23 +00003661 case 141:
Reid Spencer63c34452007-01-05 21:51:07 +00003662#line 1397 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3da59db2006-11-27 01:05:10 +00003663 {
Reid Spencer14310612006-12-31 05:40:51 +00003664 if (!UpRefs.empty())
3665 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
Reid Spencere4d87aa2006-12-23 06:05:41 +00003666 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00003667 if (ATy == 0)
Reid Spencer61c83e02006-08-18 08:43:06 +00003668 GEN_ERROR("Cannot make array constant with type: '" +
Reid Spencere4d87aa2006-12-23 06:05:41 +00003669 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00003670
Andrew Lenharth6353e052006-12-08 18:07:09 +00003671 int NumElements = ATy->getNumElements();
3672 if (NumElements != -1 && NumElements != 0)
3673 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3674 " arguments, but has size of " + itostr(NumElements) +"!");
Reid Spencere4d87aa2006-12-23 06:05:41 +00003675 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
3676 delete (yyvsp[-2].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00003677 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003678 ;}
3679 break;
3680
Reid Spencer218ded22007-01-05 17:07:23 +00003681 case 142:
Reid Spencer63c34452007-01-05 21:51:07 +00003682#line 1413 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003683 {
Reid Spencer14310612006-12-31 05:40:51 +00003684 if (!UpRefs.empty())
3685 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
Reid Spencere4d87aa2006-12-23 06:05:41 +00003686 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
Andrew Lenharth6353e052006-12-08 18:07:09 +00003687 if (ATy == 0)
3688 GEN_ERROR("Cannot make array constant with type: '" +
Reid Spencere4d87aa2006-12-23 06:05:41 +00003689 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
Reid Spencer61c83e02006-08-18 08:43:06 +00003690
Andrew Lenharth6353e052006-12-08 18:07:09 +00003691 int NumElements = ATy->getNumElements();
3692 const Type *ETy = ATy->getElementType();
Reid Spencere4d87aa2006-12-23 06:05:41 +00003693 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
3694 if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal)))
Andrew Lenharth6353e052006-12-08 18:07:09 +00003695 GEN_ERROR("Can't build string constant of size " +
Reid Spencere4d87aa2006-12-23 06:05:41 +00003696 itostr((int)(EndStr-(yyvsp[0].StrVal))) +
Andrew Lenharth6353e052006-12-08 18:07:09 +00003697 " when array has size " + itostr(NumElements) + "!");
3698 std::vector<Constant*> Vals;
Reid Spencer14310612006-12-31 05:40:51 +00003699 if (ETy == Type::Int8Ty) {
Reid Spencere4d87aa2006-12-23 06:05:41 +00003700 for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal);
Reid Spencer14310612006-12-31 05:40:51 +00003701 C != (unsigned char*)EndStr; ++C)
3702 Vals.push_back(ConstantInt::get(ETy, *C));
Andrew Lenharth6353e052006-12-08 18:07:09 +00003703 } else {
Reid Spencere4d87aa2006-12-23 06:05:41 +00003704 free((yyvsp[0].StrVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00003705 GEN_ERROR("Cannot build string arrays of non byte sized elements!");
3706 }
Reid Spencere4d87aa2006-12-23 06:05:41 +00003707 free((yyvsp[0].StrVal));
3708 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
3709 delete (yyvsp[-2].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00003710 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003711 ;}
3712 break;
3713
Reid Spencer218ded22007-01-05 17:07:23 +00003714 case 143:
Reid Spencer63c34452007-01-05 21:51:07 +00003715#line 1442 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00003716 { // Nonempty unsized arr
Reid Spencer14310612006-12-31 05:40:51 +00003717 if (!UpRefs.empty())
3718 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
Reid Spencere4d87aa2006-12-23 06:05:41 +00003719 const PackedType *PTy = dyn_cast<PackedType>((yyvsp[-3].TypeVal)->get());
Andrew Lenharth6353e052006-12-08 18:07:09 +00003720 if (PTy == 0)
3721 GEN_ERROR("Cannot make packed constant with type: '" +
Reid Spencere4d87aa2006-12-23 06:05:41 +00003722 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
Andrew Lenharth6353e052006-12-08 18:07:09 +00003723 const Type *ETy = PTy->getElementType();
3724 int NumElements = PTy->getNumElements();
Reid Spencer68a24bd2005-08-27 18:50:39 +00003725
Andrew Lenharth6353e052006-12-08 18:07:09 +00003726 // Verify that we have the correct size...
Reid Spencere4d87aa2006-12-23 06:05:41 +00003727 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
Andrew Lenharth6353e052006-12-08 18:07:09 +00003728 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
Reid Spencere4d87aa2006-12-23 06:05:41 +00003729 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
Andrew Lenharth6353e052006-12-08 18:07:09 +00003730 itostr(NumElements) + "!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00003731
Andrew Lenharth6353e052006-12-08 18:07:09 +00003732 // Verify all elements are correct type!
Reid Spencere4d87aa2006-12-23 06:05:41 +00003733 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3734 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
Andrew Lenharth6353e052006-12-08 18:07:09 +00003735 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3736 ETy->getDescription() +"' as required!\nIt is of type '"+
Reid Spencere4d87aa2006-12-23 06:05:41 +00003737 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
Andrew Lenharth6353e052006-12-08 18:07:09 +00003738 }
3739
Reid Spencere4d87aa2006-12-23 06:05:41 +00003740 (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[-1].ConstVector));
3741 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
Reid Spencer61c83e02006-08-18 08:43:06 +00003742 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003743 ;}
3744 break;
3745
Reid Spencer218ded22007-01-05 17:07:23 +00003746 case 144:
Reid Spencer63c34452007-01-05 21:51:07 +00003747#line 1470 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003748 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00003749 const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get());
Andrew Lenharth6353e052006-12-08 18:07:09 +00003750 if (STy == 0)
3751 GEN_ERROR("Cannot make struct constant with type: '" +
Reid Spencere4d87aa2006-12-23 06:05:41 +00003752 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00003753
Reid Spencere4d87aa2006-12-23 06:05:41 +00003754 if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes())
Andrew Lenharth6353e052006-12-08 18:07:09 +00003755 GEN_ERROR("Illegal number of initializers for structure type!");
3756
3757 // Check to ensure that constants are compatible with the type initializer!
Reid Spencere4d87aa2006-12-23 06:05:41 +00003758 for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i)
3759 if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i))
Andrew Lenharth6353e052006-12-08 18:07:09 +00003760 GEN_ERROR("Expected type '" +
3761 STy->getElementType(i)->getDescription() +
3762 "' for element #" + utostr(i) +
3763 " of structure initializer!");
3764
Reid Spencere4d87aa2006-12-23 06:05:41 +00003765 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector));
3766 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
Reid Spencer61c83e02006-08-18 08:43:06 +00003767 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003768 ;}
3769 break;
3770
Reid Spencer218ded22007-01-05 17:07:23 +00003771 case 145:
Reid Spencer63c34452007-01-05 21:51:07 +00003772#line 1491 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003773 {
Reid Spencer14310612006-12-31 05:40:51 +00003774 if (!UpRefs.empty())
3775 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
Reid Spencere4d87aa2006-12-23 06:05:41 +00003776 const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get());
Andrew Lenharth6353e052006-12-08 18:07:09 +00003777 if (STy == 0)
3778 GEN_ERROR("Cannot make struct constant with type: '" +
Reid Spencere4d87aa2006-12-23 06:05:41 +00003779 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
Andrew Lenharth6353e052006-12-08 18:07:09 +00003780
3781 if (STy->getNumContainedTypes() != 0)
3782 GEN_ERROR("Illegal number of initializers for structure type!");
3783
Reid Spencere4d87aa2006-12-23 06:05:41 +00003784 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
3785 delete (yyvsp[-2].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00003786 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003787 ;}
3788 break;
3789
Reid Spencer218ded22007-01-05 17:07:23 +00003790 case 146:
Reid Spencer63c34452007-01-05 21:51:07 +00003791#line 1506 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003792 {
Reid Spencer14310612006-12-31 05:40:51 +00003793 if (!UpRefs.empty())
3794 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
Reid Spencere4d87aa2006-12-23 06:05:41 +00003795 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
Andrew Lenharth6353e052006-12-08 18:07:09 +00003796 if (PTy == 0)
3797 GEN_ERROR("Cannot make null pointer constant with type: '" +
Reid Spencere4d87aa2006-12-23 06:05:41 +00003798 (*(yyvsp[-1].TypeVal))->getDescription() + "'!");
Andrew Lenharth6353e052006-12-08 18:07:09 +00003799
Reid Spencere4d87aa2006-12-23 06:05:41 +00003800 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
3801 delete (yyvsp[-1].TypeVal);
Andrew Lenharth6353e052006-12-08 18:07:09 +00003802 CHECK_FOR_ERROR
3803 ;}
3804 break;
3805
Reid Spencer218ded22007-01-05 17:07:23 +00003806 case 147:
Reid Spencer63c34452007-01-05 21:51:07 +00003807#line 1518 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00003808 {
Reid Spencer14310612006-12-31 05:40:51 +00003809 if (!UpRefs.empty())
3810 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
Reid Spencere4d87aa2006-12-23 06:05:41 +00003811 (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get());
3812 delete (yyvsp[-1].TypeVal);
Andrew Lenharth6353e052006-12-08 18:07:09 +00003813 CHECK_FOR_ERROR
3814 ;}
3815 break;
3816
Reid Spencer218ded22007-01-05 17:07:23 +00003817 case 148:
Reid Spencer63c34452007-01-05 21:51:07 +00003818#line 1525 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00003819 {
Reid Spencer14310612006-12-31 05:40:51 +00003820 if (!UpRefs.empty())
3821 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
Reid Spencere4d87aa2006-12-23 06:05:41 +00003822 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00003823 if (Ty == 0)
Reid Spencer61c83e02006-08-18 08:43:06 +00003824 GEN_ERROR("Global const reference must be a pointer type!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00003825
3826 // ConstExprs can exist in the body of a function, thus creating
3827 // GlobalValues whenever they refer to a variable. Because we are in
3828 // the context of a function, getValNonImprovising will search the functions
3829 // symbol table instead of the module symbol table for the global symbol,
3830 // which throws things all off. To get around this, we just tell
3831 // getValNonImprovising that we are at global scope here.
3832 //
3833 Function *SavedCurFn = CurFun.CurrentFunction;
3834 CurFun.CurrentFunction = 0;
3835
Reid Spencere4d87aa2006-12-23 06:05:41 +00003836 Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00003837 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00003838
3839 CurFun.CurrentFunction = SavedCurFn;
3840
3841 // If this is an initializer for a constant pointer, which is referencing a
3842 // (currently) undefined variable, create a stub now that shall be replaced
3843 // in the future with the right type of variable.
3844 //
3845 if (V == 0) {
3846 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3847 const PointerType *PT = cast<PointerType>(Ty);
3848
3849 // First check to see if the forward references value is already created!
3850 PerModuleInfo::GlobalRefsType::iterator I =
Reid Spencere4d87aa2006-12-23 06:05:41 +00003851 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal)));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003852
3853 if (I != CurModule.GlobalRefs.end()) {
3854 V = I->second; // Placeholder already exists, use it...
Reid Spencere4d87aa2006-12-23 06:05:41 +00003855 (yyvsp[0].ValIDVal).destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +00003856 } else {
3857 std::string Name;
Reid Spencere4d87aa2006-12-23 06:05:41 +00003858 if ((yyvsp[0].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[0].ValIDVal).Name;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003859
3860 // Create the forward referenced global.
3861 GlobalValue *GV;
3862 if (const FunctionType *FTy =
3863 dyn_cast<FunctionType>(PT->getElementType())) {
3864 GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
3865 CurModule.CurrentModule);
3866 } else {
3867 GV = new GlobalVariable(PT->getElementType(), false,
3868 GlobalValue::ExternalLinkage, 0,
3869 Name, CurModule.CurrentModule);
3870 }
3871
3872 // Keep track of the fact that we have a forward ref to recycle it
Reid Spencere4d87aa2006-12-23 06:05:41 +00003873 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003874 V = GV;
3875 }
3876 }
3877
Reid Spencere4d87aa2006-12-23 06:05:41 +00003878 (yyval.ConstVal) = cast<GlobalValue>(V);
3879 delete (yyvsp[-1].TypeVal); // Free the type handle
3880 CHECK_FOR_ERROR
3881 ;}
3882 break;
3883
Reid Spencer218ded22007-01-05 17:07:23 +00003884 case 149:
Reid Spencer63c34452007-01-05 21:51:07 +00003885#line 1588 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003886 {
Reid Spencer14310612006-12-31 05:40:51 +00003887 if (!UpRefs.empty())
3888 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
Reid Spencere4d87aa2006-12-23 06:05:41 +00003889 if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType())
Reid Spencere68853b2007-01-04 00:06:14 +00003890 GEN_ERROR("Mismatched types for constant expression: " +
3891 (*(yyvsp[-1].TypeVal))->getDescription() + " and " + (yyvsp[0].ConstVal)->getType()->getDescription());
Reid Spencere4d87aa2006-12-23 06:05:41 +00003892 (yyval.ConstVal) = (yyvsp[0].ConstVal);
3893 delete (yyvsp[-1].TypeVal);
3894 CHECK_FOR_ERROR
3895 ;}
3896 break;
3897
Reid Spencer218ded22007-01-05 17:07:23 +00003898 case 150:
Reid Spencer63c34452007-01-05 21:51:07 +00003899#line 1598 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003900 {
Reid Spencer14310612006-12-31 05:40:51 +00003901 if (!UpRefs.empty())
3902 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
Reid Spencere4d87aa2006-12-23 06:05:41 +00003903 const Type *Ty = (yyvsp[-1].TypeVal)->get();
3904 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
3905 GEN_ERROR("Cannot create a null initialized value of this type!");
3906 (yyval.ConstVal) = Constant::getNullValue(Ty);
3907 delete (yyvsp[-1].TypeVal);
3908 CHECK_FOR_ERROR
3909 ;}
3910 break;
3911
Reid Spencer218ded22007-01-05 17:07:23 +00003912 case 151:
Reid Spencer63c34452007-01-05 21:51:07 +00003913#line 1608 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer14310612006-12-31 05:40:51 +00003914 { // integral constants
3915 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)))
3916 GEN_ERROR("Constant value doesn't fit in type!");
3917 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val));
3918 CHECK_FOR_ERROR
3919 ;}
3920 break;
3921
Reid Spencer218ded22007-01-05 17:07:23 +00003922 case 152:
Reid Spencer63c34452007-01-05 21:51:07 +00003923#line 1614 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer14310612006-12-31 05:40:51 +00003924 { // integral constants
3925 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)))
3926 GEN_ERROR("Constant value doesn't fit in type!");
3927 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val));
3928 CHECK_FOR_ERROR
3929 ;}
3930 break;
3931
Reid Spencer218ded22007-01-05 17:07:23 +00003932 case 153:
Reid Spencer63c34452007-01-05 21:51:07 +00003933#line 1620 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003934 { // Boolean constants
3935 (yyval.ConstVal) = ConstantBool::getTrue();
3936 CHECK_FOR_ERROR
3937 ;}
3938 break;
3939
Reid Spencer218ded22007-01-05 17:07:23 +00003940 case 154:
Reid Spencer63c34452007-01-05 21:51:07 +00003941#line 1624 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003942 { // Boolean constants
3943 (yyval.ConstVal) = ConstantBool::getFalse();
Reid Spencer61c83e02006-08-18 08:43:06 +00003944 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003945 ;}
3946 break;
3947
Reid Spencer218ded22007-01-05 17:07:23 +00003948 case 155:
Reid Spencer63c34452007-01-05 21:51:07 +00003949#line 1628 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00003950 { // Float & Double constants
3951 if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal)))
3952 GEN_ERROR("Floating point constant invalid for type!!");
3953 (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00003954 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003955 ;}
3956 break;
3957
Reid Spencer218ded22007-01-05 17:07:23 +00003958 case 156:
Reid Spencer63c34452007-01-05 21:51:07 +00003959#line 1636 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00003960 {
Reid Spencer14310612006-12-31 05:40:51 +00003961 if (!UpRefs.empty())
3962 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
Reid Spencere4d87aa2006-12-23 06:05:41 +00003963 Constant *Val = (yyvsp[-3].ConstVal);
3964 const Type *Ty = (yyvsp[-1].TypeVal)->get();
Reid Spencer3da59db2006-11-27 01:05:10 +00003965 if (!Val->getType()->isFirstClassType())
Reid Spencer61c83e02006-08-18 08:43:06 +00003966 GEN_ERROR("cast constant expression from a non-primitive type: '" +
Reid Spencer3da59db2006-11-27 01:05:10 +00003967 Val->getType()->getDescription() + "'!");
3968 if (!Ty->isFirstClassType())
Reid Spencer61c83e02006-08-18 08:43:06 +00003969 GEN_ERROR("cast constant expression to a non-primitive type: '" +
Reid Spencer3da59db2006-11-27 01:05:10 +00003970 Ty->getDescription() + "'!");
Reid Spencere4d87aa2006-12-23 06:05:41 +00003971 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].TypeVal)->get());
3972 delete (yyvsp[-1].TypeVal);
Reid Spencer3822ff52006-11-08 06:47:33 +00003973 ;}
3974 break;
3975
Reid Spencer218ded22007-01-05 17:07:23 +00003976 case 157:
Reid Spencer63c34452007-01-05 21:51:07 +00003977#line 1650 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003978 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00003979 if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType()))
Andrew Lenharth6353e052006-12-08 18:07:09 +00003980 GEN_ERROR("GetElementPtr requires a pointer operand!");
3981
3982 const Type *IdxTy =
Reid Spencere4d87aa2006-12-23 06:05:41 +00003983 GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), *(yyvsp[-1].ValueList), true);
Andrew Lenharth6353e052006-12-08 18:07:09 +00003984 if (!IdxTy)
3985 GEN_ERROR("Index list invalid for constant getelementptr!");
3986
3987 std::vector<Constant*> IdxVec;
Reid Spencere4d87aa2006-12-23 06:05:41 +00003988 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i)
3989 if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i]))
Andrew Lenharth6353e052006-12-08 18:07:09 +00003990 IdxVec.push_back(C);
3991 else
3992 GEN_ERROR("Indices to constant getelementptr must be constants!");
3993
Reid Spencere4d87aa2006-12-23 06:05:41 +00003994 delete (yyvsp[-1].ValueList);
Andrew Lenharth6353e052006-12-08 18:07:09 +00003995
Reid Spencere4d87aa2006-12-23 06:05:41 +00003996 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), IdxVec);
3997 CHECK_FOR_ERROR
3998 ;}
3999 break;
4000
Reid Spencer218ded22007-01-05 17:07:23 +00004001 case 158:
Reid Spencer63c34452007-01-05 21:51:07 +00004002#line 1671 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004003 {
4004 if ((yyvsp[-5].ConstVal)->getType() != Type::BoolTy)
4005 GEN_ERROR("Select condition must be of boolean type!");
4006 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4007 GEN_ERROR("Select operand types must match!");
4008 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4009 CHECK_FOR_ERROR
4010 ;}
4011 break;
4012
Reid Spencer218ded22007-01-05 17:07:23 +00004013 case 159:
Reid Spencer63c34452007-01-05 21:51:07 +00004014#line 1679 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004015 {
4016 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4017 GEN_ERROR("Binary operator types must match!");
4018 CHECK_FOR_ERROR;
4019 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4020 ;}
4021 break;
4022
Reid Spencer218ded22007-01-05 17:07:23 +00004023 case 160:
Reid Spencer63c34452007-01-05 21:51:07 +00004024#line 1685 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004025 {
4026 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4027 GEN_ERROR("Logical operator types must match!");
4028 if (!(yyvsp[-3].ConstVal)->getType()->isIntegral()) {
4029 if (!isa<PackedType>((yyvsp[-3].ConstVal)->getType()) ||
4030 !cast<PackedType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isIntegral())
4031 GEN_ERROR("Logical operator requires integral operands!");
4032 }
4033 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4034 CHECK_FOR_ERROR
4035 ;}
4036 break;
4037
Reid Spencer218ded22007-01-05 17:07:23 +00004038 case 161:
Reid Spencer63c34452007-01-05 21:51:07 +00004039#line 1696 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004040 {
4041 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4042 GEN_ERROR("icmp operand types must match!");
4043 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4044 ;}
4045 break;
4046
Reid Spencer218ded22007-01-05 17:07:23 +00004047 case 162:
Reid Spencer63c34452007-01-05 21:51:07 +00004048#line 1701 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004049 {
4050 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
4051 GEN_ERROR("fcmp operand types must match!");
4052 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4053 ;}
4054 break;
4055
Reid Spencer218ded22007-01-05 17:07:23 +00004056 case 163:
Reid Spencer63c34452007-01-05 21:51:07 +00004057#line 1706 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004058 {
Reid Spencer14310612006-12-31 05:40:51 +00004059 if ((yyvsp[-1].ConstVal)->getType() != Type::Int8Ty)
4060 GEN_ERROR("Shift count for shift constant must be i8 type!");
Reid Spencere4d87aa2006-12-23 06:05:41 +00004061 if (!(yyvsp[-3].ConstVal)->getType()->isInteger())
4062 GEN_ERROR("Shift constant expression requires integer operand!");
4063 CHECK_FOR_ERROR;
4064 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00004065 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004066 ;}
4067 break;
4068
Reid Spencer218ded22007-01-05 17:07:23 +00004069 case 164:
Reid Spencer63c34452007-01-05 21:51:07 +00004070#line 1715 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004071 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00004072 if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4073 GEN_ERROR("Invalid extractelement operands!");
4074 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00004075 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004076 ;}
4077 break;
4078
Reid Spencer218ded22007-01-05 17:07:23 +00004079 case 165:
Reid Spencer63c34452007-01-05 21:51:07 +00004080#line 1721 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004081 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00004082 if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4083 GEN_ERROR("Invalid insertelement operands!");
4084 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
4085 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004086 ;}
4087 break;
4088
Reid Spencer218ded22007-01-05 17:07:23 +00004089 case 166:
Reid Spencer63c34452007-01-05 21:51:07 +00004090#line 1727 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004091 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00004092 if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
4093 GEN_ERROR("Invalid shufflevector operands!");
4094 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00004095 CHECK_FOR_ERROR
Reid Spencera132e042006-12-03 05:46:11 +00004096 ;}
4097 break;
4098
Reid Spencer218ded22007-01-05 17:07:23 +00004099 case 167:
Reid Spencer63c34452007-01-05 21:51:07 +00004100#line 1736 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencera132e042006-12-03 05:46:11 +00004101 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00004102 ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00004103 CHECK_FOR_ERROR
Reid Spencera132e042006-12-03 05:46:11 +00004104 ;}
4105 break;
4106
Reid Spencer218ded22007-01-05 17:07:23 +00004107 case 168:
Reid Spencer63c34452007-01-05 21:51:07 +00004108#line 1740 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencera132e042006-12-03 05:46:11 +00004109 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00004110 (yyval.ConstVector) = new std::vector<Constant*>();
4111 (yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
4112 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004113 ;}
4114 break;
4115
Reid Spencer218ded22007-01-05 17:07:23 +00004116 case 169:
Reid Spencer63c34452007-01-05 21:51:07 +00004117#line 1748 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004118 { (yyval.BoolVal) = false; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00004119 break;
4120
Reid Spencer218ded22007-01-05 17:07:23 +00004121 case 170:
Reid Spencer63c34452007-01-05 21:51:07 +00004122#line 1748 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004123 { (yyval.BoolVal) = true; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00004124 break;
4125
Reid Spencer14310612006-12-31 05:40:51 +00004126 case 171:
Reid Spencer63c34452007-01-05 21:51:07 +00004127#line 1759 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer14310612006-12-31 05:40:51 +00004128 {
4129 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4130 CurModule.ModuleDone();
4131 CHECK_FOR_ERROR;
4132 ;}
4133 break;
4134
Reid Spencer218ded22007-01-05 17:07:23 +00004135 case 172:
Reid Spencer63c34452007-01-05 21:51:07 +00004136#line 1764 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer218ded22007-01-05 17:07:23 +00004137 {
4138 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4139 CurModule.ModuleDone();
4140 CHECK_FOR_ERROR;
4141 ;}
Reid Spencer6fd36ab2006-12-29 20:35:03 +00004142 break;
4143
Reid Spencer14310612006-12-31 05:40:51 +00004144 case 175:
Reid Spencer63c34452007-01-05 21:51:07 +00004145#line 1777 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer218ded22007-01-05 17:07:23 +00004146 { CurFun.isDeclare = false ;}
4147 break;
4148
4149 case 176:
Reid Spencer63c34452007-01-05 21:51:07 +00004150#line 1777 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer6fd36ab2006-12-29 20:35:03 +00004151 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00004152 CurFun.FunctionDone();
Reid Spencer61c83e02006-08-18 08:43:06 +00004153 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004154 ;}
4155 break;
4156
Reid Spencer218ded22007-01-05 17:07:23 +00004157 case 177:
Reid Spencer63c34452007-01-05 21:51:07 +00004158#line 1781 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer6fd36ab2006-12-29 20:35:03 +00004159 { CurFun.isDeclare = true; ;}
4160 break;
4161
Reid Spencer14310612006-12-31 05:40:51 +00004162 case 178:
Reid Spencer63c34452007-01-05 21:51:07 +00004163#line 1781 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004164 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00004165 CHECK_FOR_ERROR
4166 ;}
4167 break;
4168
Reid Spencer14310612006-12-31 05:40:51 +00004169 case 179:
Reid Spencer63c34452007-01-05 21:51:07 +00004170#line 1784 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer218ded22007-01-05 17:07:23 +00004171 {
4172 CHECK_FOR_ERROR
4173 ;}
4174 break;
4175
4176 case 180:
Reid Spencer63c34452007-01-05 21:51:07 +00004177#line 1787 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00004178 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00004179 // Emit an error if there are any unresolved types left.
4180 if (!CurModule.LateResolveTypes.empty()) {
4181 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
Reid Spencer61c83e02006-08-18 08:43:06 +00004182 if (DID.Type == ValID::NameVal) {
4183 GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'");
4184 } else {
4185 GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num));
4186 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00004187 }
Reid Spencer61c83e02006-08-18 08:43:06 +00004188 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004189 ;}
4190 break;
4191
Reid Spencer218ded22007-01-05 17:07:23 +00004192 case 181:
Reid Spencer63c34452007-01-05 21:51:07 +00004193#line 1799 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004194 {
Reid Spencer14310612006-12-31 05:40:51 +00004195 if (!UpRefs.empty())
4196 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004197 // Eagerly resolve types. This is not an optimization, this is a
4198 // requirement that is due to the fact that we could have this:
4199 //
4200 // %list = type { %list * }
4201 // %list = type { %list * } ; repeated type decl
4202 //
4203 // If types are not resolved eagerly, then the two types will not be
4204 // determined to be the same type!
4205 //
Reid Spencere4d87aa2006-12-23 06:05:41 +00004206 ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004207
Reid Spencere4d87aa2006-12-23 06:05:41 +00004208 if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
Reid Spencer5b7e7532006-09-28 19:28:24 +00004209 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00004210 // If this is a named type that is not a redefinition, add it to the slot
4211 // table.
Reid Spencere4d87aa2006-12-23 06:05:41 +00004212 CurModule.Types.push_back(*(yyvsp[0].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004213 }
Reid Spencera132e042006-12-03 05:46:11 +00004214
Reid Spencere4d87aa2006-12-23 06:05:41 +00004215 delete (yyvsp[0].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00004216 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004217 ;}
4218 break;
4219
Reid Spencer218ded22007-01-05 17:07:23 +00004220 case 182:
Reid Spencer63c34452007-01-05 21:51:07 +00004221#line 1823 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer14310612006-12-31 05:40:51 +00004222 {
4223 ResolveTypeTo((yyvsp[-2].StrVal), (yyvsp[0].PrimType));
4224
4225 if (!setTypeName((yyvsp[0].PrimType), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
4226 CHECK_FOR_ERROR
4227 // If this is a named type that is not a redefinition, add it to the slot
4228 // table.
4229 CurModule.Types.push_back((yyvsp[0].PrimType));
4230 }
4231 CHECK_FOR_ERROR
4232 ;}
4233 break;
4234
Reid Spencer218ded22007-01-05 17:07:23 +00004235 case 183:
Reid Spencer63c34452007-01-05 21:51:07 +00004236#line 1834 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer6fd36ab2006-12-29 20:35:03 +00004237 { /* "Externally Visible" Linkage */
4238 if ((yyvsp[0].ConstVal) == 0)
4239 GEN_ERROR("Global value initializer is not a constant!");
4240 CurGV = ParseGlobalVariable((yyvsp[-2].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal),
4241 (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00004242 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004243 ;}
4244 break;
4245
Reid Spencer218ded22007-01-05 17:07:23 +00004246 case 184:
Reid Spencer63c34452007-01-05 21:51:07 +00004247#line 1840 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer6fd36ab2006-12-29 20:35:03 +00004248 {
4249 CurGV = 0;
Reid Spencer3822ff52006-11-08 06:47:33 +00004250 ;}
4251 break;
4252
Reid Spencer218ded22007-01-05 17:07:23 +00004253 case 185:
Reid Spencer63c34452007-01-05 21:51:07 +00004254#line 1843 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004255 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00004256 if ((yyvsp[0].ConstVal) == 0)
Andrew Lenharth6353e052006-12-08 18:07:09 +00004257 GEN_ERROR("Global value initializer is not a constant!");
Reid Spencere4d87aa2006-12-23 06:05:41 +00004258 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), (yyvsp[-2].Linkage), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
4259 CHECK_FOR_ERROR
4260 ;}
4261 break;
4262
Reid Spencer218ded22007-01-05 17:07:23 +00004263 case 186:
Reid Spencer63c34452007-01-05 21:51:07 +00004264#line 1848 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004265 {
4266 CurGV = 0;
4267 ;}
4268 break;
4269
Reid Spencer218ded22007-01-05 17:07:23 +00004270 case 187:
Reid Spencer63c34452007-01-05 21:51:07 +00004271#line 1851 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004272 {
Reid Spencer14310612006-12-31 05:40:51 +00004273 if (!UpRefs.empty())
4274 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
Reid Spencer6fd36ab2006-12-29 20:35:03 +00004275 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), (yyvsp[-2].Linkage), (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
Reid Spencere4d87aa2006-12-23 06:05:41 +00004276 CHECK_FOR_ERROR
4277 delete (yyvsp[0].TypeVal);
4278 ;}
4279 break;
4280
Reid Spencer218ded22007-01-05 17:07:23 +00004281 case 188:
Reid Spencer63c34452007-01-05 21:51:07 +00004282#line 1857 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004283 {
4284 CurGV = 0;
4285 CHECK_FOR_ERROR
4286 ;}
4287 break;
4288
Reid Spencer14310612006-12-31 05:40:51 +00004289 case 189:
Reid Spencer63c34452007-01-05 21:51:07 +00004290#line 1861 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer218ded22007-01-05 17:07:23 +00004291 {
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004292 CHECK_FOR_ERROR
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004293 ;}
4294 break;
4295
Reid Spencer14310612006-12-31 05:40:51 +00004296 case 190:
Reid Spencer63c34452007-01-05 21:51:07 +00004297#line 1864 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004298 {
Reid Spencer218ded22007-01-05 17:07:23 +00004299 CHECK_FOR_ERROR
4300 ;}
4301 break;
4302
4303 case 191:
Reid Spencer63c34452007-01-05 21:51:07 +00004304#line 1870 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer218ded22007-01-05 17:07:23 +00004305 {
Chris Lattner66316012006-01-24 04:14:29 +00004306 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
Reid Spencere4d87aa2006-12-23 06:05:41 +00004307 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
4308 std::string NewAsm((yyvsp[0].StrVal), EndStr);
4309 free((yyvsp[0].StrVal));
Chris Lattner66316012006-01-24 04:14:29 +00004310
4311 if (AsmSoFar.empty())
4312 CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
4313 else
4314 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
Reid Spencer61c83e02006-08-18 08:43:06 +00004315 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004316;}
4317 break;
4318
Reid Spencer218ded22007-01-05 17:07:23 +00004319 case 192:
Reid Spencer63c34452007-01-05 21:51:07 +00004320#line 1883 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004321 { (yyval.Endianness) = Module::BigEndian; ;}
4322 break;
4323
Reid Spencer218ded22007-01-05 17:07:23 +00004324 case 193:
Reid Spencer63c34452007-01-05 21:51:07 +00004325#line 1884 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004326 { (yyval.Endianness) = Module::LittleEndian; ;}
4327 break;
4328
Reid Spencer218ded22007-01-05 17:07:23 +00004329 case 194:
Reid Spencer63c34452007-01-05 21:51:07 +00004330#line 1886 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004331 {
4332 CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness));
4333 CHECK_FOR_ERROR
4334 ;}
4335 break;
4336
Reid Spencer218ded22007-01-05 17:07:23 +00004337 case 195:
Reid Spencer63c34452007-01-05 21:51:07 +00004338#line 1890 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004339 {
4340 if ((yyvsp[0].UInt64Val) == 32)
4341 CurModule.CurrentModule->setPointerSize(Module::Pointer32);
4342 else if ((yyvsp[0].UInt64Val) == 64)
4343 CurModule.CurrentModule->setPointerSize(Module::Pointer64);
4344 else
4345 GEN_ERROR("Invalid pointer size: '" + utostr((yyvsp[0].UInt64Val)) + "'!");
4346 CHECK_FOR_ERROR
4347 ;}
4348 break;
4349
Reid Spencer218ded22007-01-05 17:07:23 +00004350 case 196:
Reid Spencer63c34452007-01-05 21:51:07 +00004351#line 1899 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004352 {
4353 CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal));
4354 free((yyvsp[0].StrVal));
4355 ;}
4356 break;
4357
Reid Spencer218ded22007-01-05 17:07:23 +00004358 case 197:
Reid Spencer63c34452007-01-05 21:51:07 +00004359#line 1903 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004360 {
4361 CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal));
4362 free((yyvsp[0].StrVal));
4363 ;}
4364 break;
4365
Reid Spencer14310612006-12-31 05:40:51 +00004366 case 199:
Reid Spencer63c34452007-01-05 21:51:07 +00004367#line 1910 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer6fd36ab2006-12-29 20:35:03 +00004368 {
4369 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4370 free((yyvsp[0].StrVal));
4371 CHECK_FOR_ERROR
4372 ;}
4373 break;
4374
Reid Spencer14310612006-12-31 05:40:51 +00004375 case 200:
Reid Spencer63c34452007-01-05 21:51:07 +00004376#line 1915 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer218ded22007-01-05 17:07:23 +00004377 {
4378 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4379 free((yyvsp[0].StrVal));
4380 CHECK_FOR_ERROR
4381 ;}
4382 break;
4383
4384 case 201:
Reid Spencer63c34452007-01-05 21:51:07 +00004385#line 1920 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer6fd36ab2006-12-29 20:35:03 +00004386 {
4387 CHECK_FOR_ERROR
4388 ;}
4389 break;
4390
Reid Spencer218ded22007-01-05 17:07:23 +00004391 case 205:
Reid Spencer63c34452007-01-05 21:51:07 +00004392#line 1930 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer6fd36ab2006-12-29 20:35:03 +00004393 { (yyval.StrVal) = 0; ;}
4394 break;
4395
Reid Spencer218ded22007-01-05 17:07:23 +00004396 case 206:
Reid Spencer63c34452007-01-05 21:51:07 +00004397#line 1932 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00004398 {
Reid Spencer14310612006-12-31 05:40:51 +00004399 if (!UpRefs.empty())
4400 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4401 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
4402 GEN_ERROR("void typed arguments are invalid!");
4403 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4404 (yyval.ArgList) = (yyvsp[-4].ArgList);
4405 (yyvsp[-4].ArgList)->push_back(E);
Reid Spencer61c83e02006-08-18 08:43:06 +00004406 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004407 ;}
4408 break;
4409
Reid Spencer218ded22007-01-05 17:07:23 +00004410 case 207:
Reid Spencer63c34452007-01-05 21:51:07 +00004411#line 1942 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004412 {
Reid Spencer14310612006-12-31 05:40:51 +00004413 if (!UpRefs.empty())
4414 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4415 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
4416 GEN_ERROR("void typed arguments are invalid!");
4417 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4418 (yyval.ArgList) = new ArgListType;
4419 (yyval.ArgList)->push_back(E);
Reid Spencer61c83e02006-08-18 08:43:06 +00004420 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004421 ;}
4422 break;
4423
Reid Spencer218ded22007-01-05 17:07:23 +00004424 case 208:
Reid Spencer63c34452007-01-05 21:51:07 +00004425#line 1953 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004426 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00004427 (yyval.ArgList) = (yyvsp[0].ArgList);
Reid Spencer61c83e02006-08-18 08:43:06 +00004428 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004429 ;}
4430 break;
4431
Reid Spencer218ded22007-01-05 17:07:23 +00004432 case 209:
Reid Spencer63c34452007-01-05 21:51:07 +00004433#line 1957 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004434 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00004435 (yyval.ArgList) = (yyvsp[-2].ArgList);
Reid Spencer14310612006-12-31 05:40:51 +00004436 struct ArgListEntry E;
4437 E.Ty = new PATypeHolder(Type::VoidTy);
4438 E.Name = 0;
4439 E.Attrs = FunctionType::NoAttributeSet;
4440 (yyval.ArgList)->push_back(E);
Reid Spencer61c83e02006-08-18 08:43:06 +00004441 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004442 ;}
4443 break;
4444
Reid Spencer218ded22007-01-05 17:07:23 +00004445 case 210:
Reid Spencer63c34452007-01-05 21:51:07 +00004446#line 1966 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004447 {
Reid Spencer14310612006-12-31 05:40:51 +00004448 (yyval.ArgList) = new ArgListType;
4449 struct ArgListEntry E;
4450 E.Ty = new PATypeHolder(Type::VoidTy);
4451 E.Name = 0;
4452 E.Attrs = FunctionType::NoAttributeSet;
4453 (yyval.ArgList)->push_back(E);
Andrew Lenharth6353e052006-12-08 18:07:09 +00004454 CHECK_FOR_ERROR
4455 ;}
4456 break;
4457
Reid Spencer218ded22007-01-05 17:07:23 +00004458 case 211:
Reid Spencer63c34452007-01-05 21:51:07 +00004459#line 1975 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00004460 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00004461 (yyval.ArgList) = 0;
Andrew Lenharth6353e052006-12-08 18:07:09 +00004462 CHECK_FOR_ERROR
4463 ;}
4464 break;
4465
Reid Spencer218ded22007-01-05 17:07:23 +00004466 case 212:
Reid Spencer63c34452007-01-05 21:51:07 +00004467#line 1981 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00004468 {
Reid Spencer218ded22007-01-05 17:07:23 +00004469 UnEscapeLexed((yyvsp[-6].StrVal));
4470 std::string FunctionName((yyvsp[-6].StrVal));
4471 free((yyvsp[-6].StrVal)); // Free strdup'd memory!
Reid Spencer68a24bd2005-08-27 18:50:39 +00004472
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00004473 // Check the function result for abstractness if this is a define. We should
4474 // have no abstract types at this point
Reid Spencer218ded22007-01-05 17:07:23 +00004475 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[-7].TypeVal)))
4476 GEN_ERROR("Reference to abstract result: "+ (yyvsp[-7].TypeVal)->get()->getDescription());
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00004477
Reid Spencer68a24bd2005-08-27 18:50:39 +00004478 std::vector<const Type*> ParamTypeList;
Reid Spencer14310612006-12-31 05:40:51 +00004479 std::vector<FunctionType::ParameterAttributes> ParamAttrs;
Reid Spencer218ded22007-01-05 17:07:23 +00004480 ParamAttrs.push_back((yyvsp[-2].ParamAttrs));
4481 if ((yyvsp[-4].ArgList)) { // If there are arguments...
4482 for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); I != (yyvsp[-4].ArgList)->end(); ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00004483 const Type* Ty = I->Ty->get();
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00004484 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
4485 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
Reid Spencer14310612006-12-31 05:40:51 +00004486 ParamTypeList.push_back(Ty);
4487 if (Ty != Type::VoidTy)
4488 ParamAttrs.push_back(I->Attrs);
4489 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00004490 }
4491
4492 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4493 if (isVarArg) ParamTypeList.pop_back();
4494
Reid Spencer218ded22007-01-05 17:07:23 +00004495 FunctionType *FT = FunctionType::get(*(yyvsp[-7].TypeVal), ParamTypeList, isVarArg,
Reid Spencer14310612006-12-31 05:40:51 +00004496 ParamAttrs);
Reid Spencer68a24bd2005-08-27 18:50:39 +00004497 const PointerType *PFT = PointerType::get(FT);
Reid Spencer218ded22007-01-05 17:07:23 +00004498 delete (yyvsp[-7].TypeVal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00004499
4500 ValID ID;
4501 if (!FunctionName.empty()) {
4502 ID = ValID::create((char*)FunctionName.c_str());
4503 } else {
4504 ID = ValID::create((int)CurModule.Values[PFT].size());
4505 }
4506
4507 Function *Fn = 0;
4508 // See if this function was forward referenced. If so, recycle the object.
4509 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4510 // Move the function to the end of the list, from whereever it was
4511 // previously inserted.
4512 Fn = cast<Function>(FWRef);
4513 CurModule.CurrentModule->getFunctionList().remove(Fn);
4514 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4515 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4516 (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) {
4517 // If this is the case, either we need to be a forward decl, or it needs
4518 // to be.
4519 if (!CurFun.isDeclare && !Fn->isExternal())
Reid Spencer61c83e02006-08-18 08:43:06 +00004520 GEN_ERROR("Redefinition of function '" + FunctionName + "'!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004521
4522 // Make sure to strip off any argument names so we can't get conflicts.
4523 if (Fn->isExternal())
4524 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4525 AI != AE; ++AI)
4526 AI->setName("");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004527 } else { // Not already defined?
4528 Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
4529 CurModule.CurrentModule);
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +00004530
Reid Spencer68a24bd2005-08-27 18:50:39 +00004531 InsertValue(Fn, CurModule.Values);
4532 }
4533
4534 CurFun.FunctionStart(Fn);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00004535
4536 if (CurFun.isDeclare) {
4537 // If we have declaration, always overwrite linkage. This will allow us to
4538 // correctly handle cases, when pointer to function is passed as argument to
4539 // another function.
4540 Fn->setLinkage(CurFun.Linkage);
4541 }
Reid Spencer218ded22007-01-05 17:07:23 +00004542 Fn->setCallingConv((yyvsp[-8].UIntVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00004543 Fn->setAlignment((yyvsp[0].UIntVal));
4544 if ((yyvsp[-1].StrVal)) {
4545 Fn->setSection((yyvsp[-1].StrVal));
4546 free((yyvsp[-1].StrVal));
Chris Lattnere869eef2005-11-12 00:11:49 +00004547 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00004548
4549 // Add all of the arguments we parsed to the function...
Reid Spencer218ded22007-01-05 17:07:23 +00004550 if ((yyvsp[-4].ArgList)) { // Is null if empty...
Reid Spencer68a24bd2005-08-27 18:50:39 +00004551 if (isVarArg) { // Nuke the last entry
Reid Spencer218ded22007-01-05 17:07:23 +00004552 assert((yyvsp[-4].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[-4].ArgList)->back().Name == 0&&
Reid Spencera132e042006-12-03 05:46:11 +00004553 "Not a varargs marker!");
Reid Spencer218ded22007-01-05 17:07:23 +00004554 delete (yyvsp[-4].ArgList)->back().Ty;
4555 (yyvsp[-4].ArgList)->pop_back(); // Delete the last entry
Reid Spencer68a24bd2005-08-27 18:50:39 +00004556 }
4557 Function::arg_iterator ArgIt = Fn->arg_begin();
Reid Spencer14310612006-12-31 05:40:51 +00004558 unsigned Idx = 1;
Reid Spencer218ded22007-01-05 17:07:23 +00004559 for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); I != (yyvsp[-4].ArgList)->end(); ++I, ++ArgIt) {
Reid Spencer14310612006-12-31 05:40:51 +00004560 delete I->Ty; // Delete the typeholder...
4561 setValueName(ArgIt, I->Name); // Insert arg into symtab...
Reid Spencer5b7e7532006-09-28 19:28:24 +00004562 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00004563 InsertValue(ArgIt);
Reid Spencer14310612006-12-31 05:40:51 +00004564 Idx++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00004565 }
Reid Spencera132e042006-12-03 05:46:11 +00004566
Reid Spencer218ded22007-01-05 17:07:23 +00004567 delete (yyvsp[-4].ArgList); // We're now done with the argument list
Reid Spencer68a24bd2005-08-27 18:50:39 +00004568 }
Reid Spencer61c83e02006-08-18 08:43:06 +00004569 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004570;}
4571 break;
4572
Reid Spencer218ded22007-01-05 17:07:23 +00004573 case 215:
Reid Spencer63c34452007-01-05 21:51:07 +00004574#line 2087 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004575 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00004576 (yyval.FunctionVal) = CurFun.CurrentFunction;
Reid Spencer68a24bd2005-08-27 18:50:39 +00004577
4578 // Make sure that we keep track of the linkage type even if there was a
4579 // previous "declare".
Reid Spencere4d87aa2006-12-23 06:05:41 +00004580 (yyval.FunctionVal)->setLinkage((yyvsp[-2].Linkage));
Reid Spencer3822ff52006-11-08 06:47:33 +00004581;}
4582 break;
4583
Reid Spencer218ded22007-01-05 17:07:23 +00004584 case 218:
Reid Spencer63c34452007-01-05 21:51:07 +00004585#line 2097 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00004586 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00004587 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
Andrew Lenharth6353e052006-12-08 18:07:09 +00004588 CHECK_FOR_ERROR
4589;}
Reid Spencer3822ff52006-11-08 06:47:33 +00004590 break;
4591
Reid Spencer218ded22007-01-05 17:07:23 +00004592 case 219:
Reid Spencer63c34452007-01-05 21:51:07 +00004593#line 2102 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004594 {
Reid Spencer14310612006-12-31 05:40:51 +00004595 CurFun.CurrentFunction->setLinkage((yyvsp[-1].Linkage));
Reid Spencere4d87aa2006-12-23 06:05:41 +00004596 (yyval.FunctionVal) = CurFun.CurrentFunction;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +00004597 CurFun.FunctionDone();
Reid Spencer61c83e02006-08-18 08:43:06 +00004598 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004599 ;}
4600 break;
4601
Reid Spencer218ded22007-01-05 17:07:23 +00004602 case 220:
Reid Spencer63c34452007-01-05 21:51:07 +00004603#line 2113 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00004604 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00004605 (yyval.BoolVal) = false;
4606 CHECK_FOR_ERROR
4607 ;}
4608 break;
4609
Reid Spencer218ded22007-01-05 17:07:23 +00004610 case 221:
Reid Spencer63c34452007-01-05 21:51:07 +00004611#line 2117 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004612 {
4613 (yyval.BoolVal) = true;
4614 CHECK_FOR_ERROR
4615 ;}
4616 break;
4617
Reid Spencer218ded22007-01-05 17:07:23 +00004618 case 222:
Reid Spencer63c34452007-01-05 21:51:07 +00004619#line 2122 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004620 { // A reference to a direct constant
4621 (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val));
4622 CHECK_FOR_ERROR
4623 ;}
4624 break;
4625
Reid Spencer218ded22007-01-05 17:07:23 +00004626 case 223:
Reid Spencer63c34452007-01-05 21:51:07 +00004627#line 2126 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004628 {
4629 (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val));
4630 CHECK_FOR_ERROR
4631 ;}
4632 break;
4633
Reid Spencer218ded22007-01-05 17:07:23 +00004634 case 224:
Reid Spencer63c34452007-01-05 21:51:07 +00004635#line 2130 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004636 { // Perhaps it's an FP constant?
4637 (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal));
4638 CHECK_FOR_ERROR
4639 ;}
4640 break;
4641
Reid Spencer218ded22007-01-05 17:07:23 +00004642 case 225:
Reid Spencer63c34452007-01-05 21:51:07 +00004643#line 2134 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004644 {
4645 (yyval.ValIDVal) = ValID::create(ConstantBool::getTrue());
4646 CHECK_FOR_ERROR
4647 ;}
4648 break;
4649
Reid Spencer218ded22007-01-05 17:07:23 +00004650 case 226:
Reid Spencer63c34452007-01-05 21:51:07 +00004651#line 2138 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004652 {
4653 (yyval.ValIDVal) = ValID::create(ConstantBool::getFalse());
4654 CHECK_FOR_ERROR
4655 ;}
4656 break;
4657
Reid Spencer218ded22007-01-05 17:07:23 +00004658 case 227:
Reid Spencer63c34452007-01-05 21:51:07 +00004659#line 2142 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004660 {
4661 (yyval.ValIDVal) = ValID::createNull();
Reid Spencer61c83e02006-08-18 08:43:06 +00004662 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004663 ;}
4664 break;
4665
Reid Spencer218ded22007-01-05 17:07:23 +00004666 case 228:
Reid Spencer63c34452007-01-05 21:51:07 +00004667#line 2146 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004668 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00004669 (yyval.ValIDVal) = ValID::createUndef();
Reid Spencer61c83e02006-08-18 08:43:06 +00004670 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004671 ;}
4672 break;
4673
Reid Spencer218ded22007-01-05 17:07:23 +00004674 case 229:
Reid Spencer63c34452007-01-05 21:51:07 +00004675#line 2150 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004676 { // A vector zero constant.
4677 (yyval.ValIDVal) = ValID::createZeroInit();
Reid Spencer61c83e02006-08-18 08:43:06 +00004678 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004679 ;}
4680 break;
4681
Reid Spencer218ded22007-01-05 17:07:23 +00004682 case 230:
Reid Spencer63c34452007-01-05 21:51:07 +00004683#line 2154 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004684 { // Nonempty unsized packed vector
Reid Spencere4d87aa2006-12-23 06:05:41 +00004685 const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType();
4686 int NumElements = (yyvsp[-1].ConstVector)->size();
Reid Spencer68a24bd2005-08-27 18:50:39 +00004687
4688 PackedType* pt = PackedType::get(ETy, NumElements);
4689 PATypeHolder* PTy = new PATypeHolder(
Reid Spencera132e042006-12-03 05:46:11 +00004690 HandleUpRefs(
4691 PackedType::get(
4692 ETy,
4693 NumElements)
4694 )
4695 );
Reid Spencer68a24bd2005-08-27 18:50:39 +00004696
4697 // Verify all elements are correct type!
Reid Spencere4d87aa2006-12-23 06:05:41 +00004698 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
4699 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
Reid Spencer61c83e02006-08-18 08:43:06 +00004700 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +00004701 ETy->getDescription() +"' as required!\nIt is of type '" +
Reid Spencere4d87aa2006-12-23 06:05:41 +00004702 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004703 }
4704
Reid Spencere4d87aa2006-12-23 06:05:41 +00004705 (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[-1].ConstVector)));
4706 delete PTy; delete (yyvsp[-1].ConstVector);
4707 CHECK_FOR_ERROR
4708 ;}
4709 break;
4710
Reid Spencer218ded22007-01-05 17:07:23 +00004711 case 231:
Reid Spencer63c34452007-01-05 21:51:07 +00004712#line 2179 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004713 {
4714 (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal));
4715 CHECK_FOR_ERROR
4716 ;}
4717 break;
4718
Reid Spencer218ded22007-01-05 17:07:23 +00004719 case 232:
Reid Spencer63c34452007-01-05 21:51:07 +00004720#line 2183 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004721 {
4722 char *End = UnEscapeLexed((yyvsp[-2].StrVal), true);
4723 std::string AsmStr = std::string((yyvsp[-2].StrVal), End);
4724 End = UnEscapeLexed((yyvsp[0].StrVal), true);
4725 std::string Constraints = std::string((yyvsp[0].StrVal), End);
4726 (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal));
4727 free((yyvsp[-2].StrVal));
4728 free((yyvsp[0].StrVal));
4729 CHECK_FOR_ERROR
4730 ;}
4731 break;
4732
Reid Spencer218ded22007-01-05 17:07:23 +00004733 case 233:
Reid Spencer63c34452007-01-05 21:51:07 +00004734#line 2197 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004735 { // Is it an integer reference...?
4736 (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal));
4737 CHECK_FOR_ERROR
4738 ;}
4739 break;
4740
Reid Spencer218ded22007-01-05 17:07:23 +00004741 case 234:
Reid Spencer63c34452007-01-05 21:51:07 +00004742#line 2201 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004743 { // Is it a named reference...?
4744 (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal));
4745 CHECK_FOR_ERROR
4746 ;}
4747 break;
4748
Reid Spencer218ded22007-01-05 17:07:23 +00004749 case 237:
Reid Spencer63c34452007-01-05 21:51:07 +00004750#line 2213 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004751 {
Reid Spencer14310612006-12-31 05:40:51 +00004752 if (!UpRefs.empty())
4753 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4754 (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
4755 delete (yyvsp[-1].TypeVal);
Reid Spencer21be8652006-10-22 07:03:43 +00004756 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004757 ;}
4758 break;
4759
Reid Spencer218ded22007-01-05 17:07:23 +00004760 case 238:
Reid Spencer63c34452007-01-05 21:51:07 +00004761#line 2222 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00004762 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00004763 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
Reid Spencer3822ff52006-11-08 06:47:33 +00004764 CHECK_FOR_ERROR
4765 ;}
4766 break;
4767
Reid Spencer218ded22007-01-05 17:07:23 +00004768 case 239:
Reid Spencer63c34452007-01-05 21:51:07 +00004769#line 2226 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004770 { // Do not allow functions with 0 basic blocks
4771 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
Andrew Lenharth6353e052006-12-08 18:07:09 +00004772 CHECK_FOR_ERROR
4773 ;}
4774 break;
4775
Reid Spencer218ded22007-01-05 17:07:23 +00004776 case 240:
Reid Spencer63c34452007-01-05 21:51:07 +00004777#line 2235 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004778 {
4779 setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal));
4780 CHECK_FOR_ERROR
4781 InsertValue((yyvsp[0].TermInstVal));
4782
4783 (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal));
4784 InsertValue((yyvsp[-2].BasicBlockVal));
4785 (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal);
Andrew Lenharth6353e052006-12-08 18:07:09 +00004786 CHECK_FOR_ERROR
4787 ;}
4788 break;
4789
Reid Spencer218ded22007-01-05 17:07:23 +00004790 case 241:
Reid Spencer63c34452007-01-05 21:51:07 +00004791#line 2246 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004792 {
4793 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal)))
4794 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4795 if (CI2->getParent() == 0)
4796 (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2);
4797 (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal));
4798 (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal);
4799 CHECK_FOR_ERROR
4800 ;}
4801 break;
4802
Reid Spencer218ded22007-01-05 17:07:23 +00004803 case 242:
Reid Spencer63c34452007-01-05 21:51:07 +00004804#line 2255 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004805 {
4806 (yyval.BasicBlockVal) = getBBVal(ValID::create((int)CurFun.NextBBNum++), true);
4807 CHECK_FOR_ERROR
4808
4809 // Make sure to move the basic block to the correct location in the
4810 // function, instead of leaving it inserted wherever it was first
4811 // referenced.
4812 Function::BasicBlockListType &BBL =
4813 CurFun.CurrentFunction->getBasicBlockList();
4814 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
4815 CHECK_FOR_ERROR
4816 ;}
4817 break;
4818
Reid Spencer218ded22007-01-05 17:07:23 +00004819 case 243:
Reid Spencer63c34452007-01-05 21:51:07 +00004820#line 2267 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004821 {
4822 (yyval.BasicBlockVal) = getBBVal(ValID::create((yyvsp[0].StrVal)), true);
4823 CHECK_FOR_ERROR
4824
4825 // Make sure to move the basic block to the correct location in the
4826 // function, instead of leaving it inserted wherever it was first
4827 // referenced.
4828 Function::BasicBlockListType &BBL =
4829 CurFun.CurrentFunction->getBasicBlockList();
4830 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
Reid Spencer3822ff52006-11-08 06:47:33 +00004831 CHECK_FOR_ERROR
4832 ;}
4833 break;
4834
Reid Spencer218ded22007-01-05 17:07:23 +00004835 case 244:
Reid Spencer63c34452007-01-05 21:51:07 +00004836#line 2280 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004837 { // Return with a result...
4838 (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal));
Reid Spencer3822ff52006-11-08 06:47:33 +00004839 CHECK_FOR_ERROR
4840 ;}
4841 break;
4842
Reid Spencer218ded22007-01-05 17:07:23 +00004843 case 245:
Reid Spencer63c34452007-01-05 21:51:07 +00004844#line 2284 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004845 { // Return with no result...
4846 (yyval.TermInstVal) = new ReturnInst();
Reid Spencer3822ff52006-11-08 06:47:33 +00004847 CHECK_FOR_ERROR
4848 ;}
4849 break;
4850
Reid Spencer218ded22007-01-05 17:07:23 +00004851 case 246:
Reid Spencer63c34452007-01-05 21:51:07 +00004852#line 2288 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004853 { // Unconditional Branch...
4854 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
Reid Spencer3822ff52006-11-08 06:47:33 +00004855 CHECK_FOR_ERROR
Reid Spencere4d87aa2006-12-23 06:05:41 +00004856 (yyval.TermInstVal) = new BranchInst(tmpBB);
Reid Spencer3822ff52006-11-08 06:47:33 +00004857 ;}
4858 break;
4859
Reid Spencer218ded22007-01-05 17:07:23 +00004860 case 247:
Reid Spencer63c34452007-01-05 21:51:07 +00004861#line 2293 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00004862 {
4863 BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00004864 CHECK_FOR_ERROR
Reid Spencere4d87aa2006-12-23 06:05:41 +00004865 BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00004866 CHECK_FOR_ERROR
Reid Spencere4d87aa2006-12-23 06:05:41 +00004867 Value* tmpVal = getVal(Type::BoolTy, (yyvsp[-6].ValIDVal));
4868 CHECK_FOR_ERROR
4869 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
Reid Spencer3822ff52006-11-08 06:47:33 +00004870 ;}
4871 break;
4872
Reid Spencer218ded22007-01-05 17:07:23 +00004873 case 248:
Reid Spencer63c34452007-01-05 21:51:07 +00004874#line 2302 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004875 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00004876 Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00004877 CHECK_FOR_ERROR
Reid Spencere4d87aa2006-12-23 06:05:41 +00004878 BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal));
4879 CHECK_FOR_ERROR
4880 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size());
4881 (yyval.TermInstVal) = S;
Andrew Lenharth6353e052006-12-08 18:07:09 +00004882
Reid Spencere4d87aa2006-12-23 06:05:41 +00004883 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(),
4884 E = (yyvsp[-1].JumpTable)->end();
Reid Spencer68a24bd2005-08-27 18:50:39 +00004885 for (; I != E; ++I) {
4886 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
4887 S->addCase(CI, I->second);
4888 else
Reid Spencer61c83e02006-08-18 08:43:06 +00004889 GEN_ERROR("Switch case is constant, but not a simple integer!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004890 }
Reid Spencere4d87aa2006-12-23 06:05:41 +00004891 delete (yyvsp[-1].JumpTable);
Reid Spencer61c83e02006-08-18 08:43:06 +00004892 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004893 ;}
4894 break;
4895
Reid Spencer218ded22007-01-05 17:07:23 +00004896 case 249:
Reid Spencer63c34452007-01-05 21:51:07 +00004897#line 2321 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004898 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00004899 Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00004900 CHECK_FOR_ERROR
Reid Spencere4d87aa2006-12-23 06:05:41 +00004901 BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00004902 CHECK_FOR_ERROR
4903 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
Reid Spencere4d87aa2006-12-23 06:05:41 +00004904 (yyval.TermInstVal) = S;
Reid Spencer61c83e02006-08-18 08:43:06 +00004905 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004906 ;}
4907 break;
4908
Reid Spencer218ded22007-01-05 17:07:23 +00004909 case 250:
Reid Spencer63c34452007-01-05 21:51:07 +00004910#line 2331 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004911 {
Reid Spencer3822ff52006-11-08 06:47:33 +00004912
Reid Spencer14310612006-12-31 05:40:51 +00004913 // Handle the short syntax
4914 const PointerType *PFTy = 0;
4915 const FunctionType *Ty = 0;
Reid Spencer218ded22007-01-05 17:07:23 +00004916 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-11].TypeVal)->get())) ||
Reid Spencer68a24bd2005-08-27 18:50:39 +00004917 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4918 // Pull out the types of all of the arguments...
4919 std::vector<const Type*> ParamTypes;
Reid Spencer14310612006-12-31 05:40:51 +00004920 FunctionType::ParamAttrsList ParamAttrs;
Reid Spencer218ded22007-01-05 17:07:23 +00004921 ParamAttrs.push_back((yyvsp[-6].ParamAttrs));
4922 for (ValueRefList::iterator I = (yyvsp[-8].ValueRefList)->begin(), E = (yyvsp[-8].ValueRefList)->end(); I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00004923 const Type *Ty = I->Val->getType();
4924 if (Ty == Type::VoidTy)
4925 GEN_ERROR("Short call syntax cannot be used with varargs");
4926 ParamTypes.push_back(Ty);
4927 ParamAttrs.push_back(I->Attrs);
Reid Spencer68a24bd2005-08-27 18:50:39 +00004928 }
4929
Reid Spencer218ded22007-01-05 17:07:23 +00004930 Ty = FunctionType::get((yyvsp[-11].TypeVal)->get(), ParamTypes, false, ParamAttrs);
Reid Spencer68a24bd2005-08-27 18:50:39 +00004931 PFTy = PointerType::get(Ty);
4932 }
4933
Reid Spencer218ded22007-01-05 17:07:23 +00004934 Value *V = getVal(PFTy, (yyvsp[-10].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00004935 CHECK_FOR_ERROR
Reid Spencere4d87aa2006-12-23 06:05:41 +00004936 BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00004937 CHECK_FOR_ERROR
Reid Spencere4d87aa2006-12-23 06:05:41 +00004938 BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00004939 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00004940
Reid Spencer14310612006-12-31 05:40:51 +00004941 // Check the arguments
4942 ValueList Args;
Reid Spencer218ded22007-01-05 17:07:23 +00004943 if ((yyvsp[-8].ValueRefList)->empty()) { // Has no arguments?
Reid Spencer14310612006-12-31 05:40:51 +00004944 // Make sure no arguments is a good thing!
4945 if (Ty->getNumParams() != 0)
4946 GEN_ERROR("No arguments passed to a function that "
4947 "expects arguments!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004948 } else { // Has arguments?
4949 // Loop through FunctionType's arguments and ensure they are specified
4950 // correctly!
Reid Spencer68a24bd2005-08-27 18:50:39 +00004951 FunctionType::param_iterator I = Ty->param_begin();
4952 FunctionType::param_iterator E = Ty->param_end();
Reid Spencer218ded22007-01-05 17:07:23 +00004953 ValueRefList::iterator ArgI = (yyvsp[-8].ValueRefList)->begin(), ArgE = (yyvsp[-8].ValueRefList)->end();
Reid Spencer68a24bd2005-08-27 18:50:39 +00004954
Reid Spencer14310612006-12-31 05:40:51 +00004955 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
4956 if (ArgI->Val->getType() != *I)
4957 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Reid Spencera132e042006-12-03 05:46:11 +00004958 (*I)->getDescription() + "'!");
Reid Spencer14310612006-12-31 05:40:51 +00004959 Args.push_back(ArgI->Val);
4960 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00004961
Reid Spencer14310612006-12-31 05:40:51 +00004962 if (Ty->isVarArg()) {
4963 if (I == E)
4964 for (; ArgI != ArgE; ++ArgI)
4965 Args.push_back(ArgI->Val); // push the remaining varargs
4966 } else if (I != E || ArgI != ArgE)
Reid Spencer61c83e02006-08-18 08:43:06 +00004967 GEN_ERROR("Invalid number of parameters detected!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004968 }
Reid Spencer14310612006-12-31 05:40:51 +00004969
4970 // Create the InvokeInst
4971 InvokeInst *II = new InvokeInst(V, Normal, Except, Args);
Reid Spencer218ded22007-01-05 17:07:23 +00004972 II->setCallingConv((yyvsp[-12].UIntVal));
Reid Spencer14310612006-12-31 05:40:51 +00004973 (yyval.TermInstVal) = II;
Reid Spencer218ded22007-01-05 17:07:23 +00004974 delete (yyvsp[-8].ValueRefList);
Andrew Lenharth6353e052006-12-08 18:07:09 +00004975 CHECK_FOR_ERROR
4976 ;}
4977 break;
4978
Reid Spencer218ded22007-01-05 17:07:23 +00004979 case 251:
Reid Spencer63c34452007-01-05 21:51:07 +00004980#line 2397 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00004981 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00004982 (yyval.TermInstVal) = new UnwindInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00004983 CHECK_FOR_ERROR
4984 ;}
4985 break;
4986
Reid Spencer218ded22007-01-05 17:07:23 +00004987 case 252:
Reid Spencer63c34452007-01-05 21:51:07 +00004988#line 2401 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00004989 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00004990 (yyval.TermInstVal) = new UnreachableInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00004991 CHECK_FOR_ERROR
4992 ;}
4993 break;
4994
Reid Spencer218ded22007-01-05 17:07:23 +00004995 case 253:
Reid Spencer63c34452007-01-05 21:51:07 +00004996#line 2408 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00004997 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00004998 (yyval.JumpTable) = (yyvsp[-5].JumpTable);
4999 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005000 CHECK_FOR_ERROR
5001 if (V == 0)
5002 GEN_ERROR("May only switch on a constant pool value!");
5003
Reid Spencere4d87aa2006-12-23 06:05:41 +00005004 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005005 CHECK_FOR_ERROR
Reid Spencere4d87aa2006-12-23 06:05:41 +00005006 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005007 ;}
5008 break;
5009
Reid Spencer218ded22007-01-05 17:07:23 +00005010 case 254:
Reid Spencer63c34452007-01-05 21:51:07 +00005011#line 2419 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00005012 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00005013 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
5014 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005015 CHECK_FOR_ERROR
5016
5017 if (V == 0)
5018 GEN_ERROR("May only switch on a constant pool value!");
5019
Reid Spencere4d87aa2006-12-23 06:05:41 +00005020 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005021 CHECK_FOR_ERROR
Reid Spencere4d87aa2006-12-23 06:05:41 +00005022 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005023 ;}
5024 break;
5025
Reid Spencer218ded22007-01-05 17:07:23 +00005026 case 255:
Reid Spencer63c34452007-01-05 21:51:07 +00005027#line 2432 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00005028 {
5029 // Is this definition named?? if so, assign the name...
Reid Spencere4d87aa2006-12-23 06:05:41 +00005030 setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005031 CHECK_FOR_ERROR
Reid Spencere4d87aa2006-12-23 06:05:41 +00005032 InsertValue((yyvsp[0].InstVal));
5033 (yyval.InstVal) = (yyvsp[0].InstVal);
Andrew Lenharth6353e052006-12-08 18:07:09 +00005034 CHECK_FOR_ERROR
5035;}
5036 break;
5037
Reid Spencer218ded22007-01-05 17:07:23 +00005038 case 256:
Reid Spencer63c34452007-01-05 21:51:07 +00005039#line 2441 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00005040 { // Used for PHI nodes
Reid Spencer14310612006-12-31 05:40:51 +00005041 if (!UpRefs.empty())
5042 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-5].TypeVal))->getDescription());
Reid Spencere4d87aa2006-12-23 06:05:41 +00005043 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
5044 Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005045 CHECK_FOR_ERROR
Reid Spencere4d87aa2006-12-23 06:05:41 +00005046 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005047 CHECK_FOR_ERROR
Reid Spencere4d87aa2006-12-23 06:05:41 +00005048 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5049 delete (yyvsp[-5].TypeVal);
5050 ;}
5051 break;
5052
Reid Spencer218ded22007-01-05 17:07:23 +00005053 case 257:
Reid Spencer63c34452007-01-05 21:51:07 +00005054#line 2452 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00005055 {
5056 (yyval.PHIList) = (yyvsp[-6].PHIList);
5057 Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal));
5058 CHECK_FOR_ERROR
5059 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
5060 CHECK_FOR_ERROR
5061 (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
5062 ;}
5063 break;
5064
Reid Spencer218ded22007-01-05 17:07:23 +00005065 case 258:
Reid Spencer63c34452007-01-05 21:51:07 +00005066#line 2462 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer14310612006-12-31 05:40:51 +00005067 {
5068 if (!UpRefs.empty())
5069 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5070 // Used for call and invoke instructions
5071 (yyval.ValueRefList) = new ValueRefList();
5072 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
5073 (yyval.ValueRefList)->push_back(E);
Reid Spencere4d87aa2006-12-23 06:05:41 +00005074 ;}
5075 break;
5076
Reid Spencer218ded22007-01-05 17:07:23 +00005077 case 259:
Reid Spencer63c34452007-01-05 21:51:07 +00005078#line 2470 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00005079 {
Reid Spencer14310612006-12-31 05:40:51 +00005080 if (!UpRefs.empty())
5081 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5082 (yyval.ValueRefList) = (yyvsp[-4].ValueRefList);
5083 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
5084 (yyval.ValueRefList)->push_back(E);
Reid Spencere4d87aa2006-12-23 06:05:41 +00005085 CHECK_FOR_ERROR
5086 ;}
5087 break;
5088
Reid Spencer218ded22007-01-05 17:07:23 +00005089 case 260:
Reid Spencer63c34452007-01-05 21:51:07 +00005090#line 2478 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer14310612006-12-31 05:40:51 +00005091 { (yyval.ValueRefList) = new ValueRefList(); ;}
Reid Spencere4d87aa2006-12-23 06:05:41 +00005092 break;
5093
Reid Spencer218ded22007-01-05 17:07:23 +00005094 case 261:
Reid Spencer63c34452007-01-05 21:51:07 +00005095#line 2481 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer14310612006-12-31 05:40:51 +00005096 { (yyval.ValueList) = new std::vector<Value*>(); ;}
5097 break;
5098
Reid Spencer218ded22007-01-05 17:07:23 +00005099 case 262:
Reid Spencer63c34452007-01-05 21:51:07 +00005100#line 2482 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer14310612006-12-31 05:40:51 +00005101 {
5102 (yyval.ValueList) = (yyvsp[-2].ValueList);
5103 (yyval.ValueList)->push_back((yyvsp[0].ValueVal));
5104 CHECK_FOR_ERROR
5105 ;}
5106 break;
5107
Reid Spencer218ded22007-01-05 17:07:23 +00005108 case 263:
Reid Spencer63c34452007-01-05 21:51:07 +00005109#line 2489 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00005110 {
5111 (yyval.BoolVal) = true;
5112 CHECK_FOR_ERROR
5113 ;}
5114 break;
5115
Reid Spencer218ded22007-01-05 17:07:23 +00005116 case 264:
Reid Spencer63c34452007-01-05 21:51:07 +00005117#line 2493 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00005118 {
5119 (yyval.BoolVal) = false;
5120 CHECK_FOR_ERROR
Andrew Lenharth6353e052006-12-08 18:07:09 +00005121 ;}
5122 break;
5123
Reid Spencer218ded22007-01-05 17:07:23 +00005124 case 265:
Reid Spencer63c34452007-01-05 21:51:07 +00005125#line 2498 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00005126 {
Reid Spencer14310612006-12-31 05:40:51 +00005127 if (!UpRefs.empty())
5128 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
Reid Spencere4d87aa2006-12-23 06:05:41 +00005129 if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() &&
5130 !isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5131 GEN_ERROR(
5132 "Arithmetic operator requires integer, FP, or packed operands!");
5133 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()) &&
5134 ((yyvsp[-4].BinaryOpVal) == Instruction::URem ||
5135 (yyvsp[-4].BinaryOpVal) == Instruction::SRem ||
5136 (yyvsp[-4].BinaryOpVal) == Instruction::FRem))
5137 GEN_ERROR("U/S/FRem not supported on packed types!");
5138 Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005139 CHECK_FOR_ERROR
Reid Spencere4d87aa2006-12-23 06:05:41 +00005140 Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005141 CHECK_FOR_ERROR
Reid Spencere4d87aa2006-12-23 06:05:41 +00005142 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2);
5143 if ((yyval.InstVal) == 0)
5144 GEN_ERROR("binary operator returned null!");
5145 delete (yyvsp[-3].TypeVal);
Andrew Lenharth6353e052006-12-08 18:07:09 +00005146 ;}
5147 break;
5148
Reid Spencer218ded22007-01-05 17:07:23 +00005149 case 266:
Reid Spencer63c34452007-01-05 21:51:07 +00005150#line 2519 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00005151 {
Reid Spencer14310612006-12-31 05:40:51 +00005152 if (!UpRefs.empty())
5153 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
Reid Spencere4d87aa2006-12-23 06:05:41 +00005154 if (!(*(yyvsp[-3].TypeVal))->isIntegral()) {
5155 if (!isa<PackedType>((yyvsp[-3].TypeVal)->get()) ||
5156 !cast<PackedType>((yyvsp[-3].TypeVal)->get())->getElementType()->isIntegral())
5157 GEN_ERROR("Logical operator requires integral operands!");
5158 }
5159 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
5160 CHECK_FOR_ERROR
5161 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
5162 CHECK_FOR_ERROR
5163 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
5164 if ((yyval.InstVal) == 0)
5165 GEN_ERROR("binary operator returned null!");
5166 delete (yyvsp[-3].TypeVal);
Andrew Lenharth6353e052006-12-08 18:07:09 +00005167 ;}
5168 break;
5169
Reid Spencer218ded22007-01-05 17:07:23 +00005170 case 267:
Reid Spencer63c34452007-01-05 21:51:07 +00005171#line 2536 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00005172 {
Reid Spencer14310612006-12-31 05:40:51 +00005173 if (!UpRefs.empty())
5174 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
Reid Spencerac4a1dd2007-01-04 02:57:52 +00005175 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5176 GEN_ERROR("Packed types not supported by icmp instruction");
Reid Spencere4d87aa2006-12-23 06:05:41 +00005177 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005178 CHECK_FOR_ERROR
Reid Spencere4d87aa2006-12-23 06:05:41 +00005179 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005180 CHECK_FOR_ERROR
Reid Spencere4d87aa2006-12-23 06:05:41 +00005181 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2);
5182 if ((yyval.InstVal) == 0)
Andrew Lenharth6353e052006-12-08 18:07:09 +00005183 GEN_ERROR("icmp operator returned null!");
5184 ;}
5185 break;
5186
Reid Spencer218ded22007-01-05 17:07:23 +00005187 case 268:
Reid Spencer63c34452007-01-05 21:51:07 +00005188#line 2549 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00005189 {
Reid Spencer14310612006-12-31 05:40:51 +00005190 if (!UpRefs.empty())
5191 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
Reid Spencerac4a1dd2007-01-04 02:57:52 +00005192 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
5193 GEN_ERROR("Packed types not supported by fcmp instruction");
Reid Spencere4d87aa2006-12-23 06:05:41 +00005194 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005195 CHECK_FOR_ERROR
Reid Spencere4d87aa2006-12-23 06:05:41 +00005196 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005197 CHECK_FOR_ERROR
Reid Spencere4d87aa2006-12-23 06:05:41 +00005198 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2);
5199 if ((yyval.InstVal) == 0)
Andrew Lenharth6353e052006-12-08 18:07:09 +00005200 GEN_ERROR("fcmp operator returned null!");
5201 ;}
5202 break;
5203
Reid Spencer218ded22007-01-05 17:07:23 +00005204 case 269:
Reid Spencer63c34452007-01-05 21:51:07 +00005205#line 2562 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00005206 {
5207 cerr << "WARNING: Use of eliminated 'not' instruction:"
5208 << " Replacing with 'xor'.\n";
5209
Reid Spencere4d87aa2006-12-23 06:05:41 +00005210 Value *Ones = ConstantIntegral::getAllOnesValue((yyvsp[0].ValueVal)->getType());
Andrew Lenharth6353e052006-12-08 18:07:09 +00005211 if (Ones == 0)
5212 GEN_ERROR("Expected integral type for not instruction!");
5213
Reid Spencere4d87aa2006-12-23 06:05:41 +00005214 (yyval.InstVal) = BinaryOperator::create(Instruction::Xor, (yyvsp[0].ValueVal), Ones);
5215 if ((yyval.InstVal) == 0)
Andrew Lenharth6353e052006-12-08 18:07:09 +00005216 GEN_ERROR("Could not create a xor instruction!");
5217 CHECK_FOR_ERROR
5218 ;}
5219 break;
5220
Reid Spencer218ded22007-01-05 17:07:23 +00005221 case 270:
Reid Spencer63c34452007-01-05 21:51:07 +00005222#line 2575 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00005223 {
Reid Spencer14310612006-12-31 05:40:51 +00005224 if ((yyvsp[0].ValueVal)->getType() != Type::Int8Ty)
5225 GEN_ERROR("Shift amount must be i8 type!");
Reid Spencere4d87aa2006-12-23 06:05:41 +00005226 if (!(yyvsp[-2].ValueVal)->getType()->isInteger())
Andrew Lenharth6353e052006-12-08 18:07:09 +00005227 GEN_ERROR("Shift constant expression requires integer operand!");
5228 CHECK_FOR_ERROR;
Reid Spencere4d87aa2006-12-23 06:05:41 +00005229 (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005230 CHECK_FOR_ERROR
5231 ;}
5232 break;
5233
Reid Spencer218ded22007-01-05 17:07:23 +00005234 case 271:
Reid Spencer63c34452007-01-05 21:51:07 +00005235#line 2584 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00005236 {
Reid Spencer14310612006-12-31 05:40:51 +00005237 if (!UpRefs.empty())
5238 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
Reid Spencere4d87aa2006-12-23 06:05:41 +00005239 Value* Val = (yyvsp[-2].ValueVal);
5240 const Type* Ty = (yyvsp[0].TypeVal)->get();
Andrew Lenharth6353e052006-12-08 18:07:09 +00005241 if (!Val->getType()->isFirstClassType())
5242 GEN_ERROR("cast from a non-primitive type: '" +
5243 Val->getType()->getDescription() + "'!");
5244 if (!Ty->isFirstClassType())
5245 GEN_ERROR("cast to a non-primitive type: '" + Ty->getDescription() +"'!");
Reid Spencer14310612006-12-31 05:40:51 +00005246 (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), Val, (yyvsp[0].TypeVal)->get());
Reid Spencere4d87aa2006-12-23 06:05:41 +00005247 delete (yyvsp[0].TypeVal);
Andrew Lenharth6353e052006-12-08 18:07:09 +00005248 ;}
5249 break;
5250
Reid Spencer218ded22007-01-05 17:07:23 +00005251 case 272:
Reid Spencer63c34452007-01-05 21:51:07 +00005252#line 2597 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00005253 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00005254 if ((yyvsp[-4].ValueVal)->getType() != Type::BoolTy)
Andrew Lenharth6353e052006-12-08 18:07:09 +00005255 GEN_ERROR("select condition must be boolean!");
Reid Spencere4d87aa2006-12-23 06:05:41 +00005256 if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType())
Andrew Lenharth6353e052006-12-08 18:07:09 +00005257 GEN_ERROR("select value types should match!");
Reid Spencere4d87aa2006-12-23 06:05:41 +00005258 (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005259 CHECK_FOR_ERROR
5260 ;}
5261 break;
5262
Reid Spencer218ded22007-01-05 17:07:23 +00005263 case 273:
Reid Spencer63c34452007-01-05 21:51:07 +00005264#line 2605 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00005265 {
Reid Spencer14310612006-12-31 05:40:51 +00005266 if (!UpRefs.empty())
5267 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
Reid Spencere4d87aa2006-12-23 06:05:41 +00005268 (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
5269 delete (yyvsp[0].TypeVal);
Andrew Lenharth6353e052006-12-08 18:07:09 +00005270 CHECK_FOR_ERROR
5271 ;}
5272 break;
5273
Reid Spencer218ded22007-01-05 17:07:23 +00005274 case 274:
Reid Spencer63c34452007-01-05 21:51:07 +00005275#line 2612 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00005276 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00005277 if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
Andrew Lenharth6353e052006-12-08 18:07:09 +00005278 GEN_ERROR("Invalid extractelement operands!");
Reid Spencere4d87aa2006-12-23 06:05:41 +00005279 (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005280 CHECK_FOR_ERROR
5281 ;}
5282 break;
5283
Reid Spencer218ded22007-01-05 17:07:23 +00005284 case 275:
Reid Spencer63c34452007-01-05 21:51:07 +00005285#line 2618 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00005286 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00005287 if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
Andrew Lenharth6353e052006-12-08 18:07:09 +00005288 GEN_ERROR("Invalid insertelement operands!");
Reid Spencere4d87aa2006-12-23 06:05:41 +00005289 (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005290 CHECK_FOR_ERROR
5291 ;}
5292 break;
5293
Reid Spencer218ded22007-01-05 17:07:23 +00005294 case 276:
Reid Spencer63c34452007-01-05 21:51:07 +00005295#line 2624 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00005296 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00005297 if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
Andrew Lenharth6353e052006-12-08 18:07:09 +00005298 GEN_ERROR("Invalid shufflevector operands!");
Reid Spencere4d87aa2006-12-23 06:05:41 +00005299 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00005300 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00005301 ;}
5302 break;
5303
Reid Spencer218ded22007-01-05 17:07:23 +00005304 case 277:
Reid Spencer63c34452007-01-05 21:51:07 +00005305#line 2630 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00005306 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00005307 const Type *Ty = (yyvsp[0].PHIList)->front().first->getType();
Andrew Lenharth6353e052006-12-08 18:07:09 +00005308 if (!Ty->isFirstClassType())
5309 GEN_ERROR("PHI node operands must be of first class type!");
Reid Spencere4d87aa2006-12-23 06:05:41 +00005310 (yyval.InstVal) = new PHINode(Ty);
5311 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size());
5312 while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) {
5313 if ((yyvsp[0].PHIList)->front().first->getType() != Ty)
Andrew Lenharth6353e052006-12-08 18:07:09 +00005314 GEN_ERROR("All elements of a PHI node must be of the same type!");
Reid Spencere4d87aa2006-12-23 06:05:41 +00005315 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second);
5316 (yyvsp[0].PHIList)->pop_front();
Andrew Lenharth6353e052006-12-08 18:07:09 +00005317 }
Reid Spencere4d87aa2006-12-23 06:05:41 +00005318 delete (yyvsp[0].PHIList); // Free the list...
Reid Spencer61c83e02006-08-18 08:43:06 +00005319 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00005320 ;}
5321 break;
5322
Reid Spencer218ded22007-01-05 17:07:23 +00005323 case 278:
Reid Spencer63c34452007-01-05 21:51:07 +00005324#line 2646 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00005325 {
Reid Spencer14310612006-12-31 05:40:51 +00005326
5327 // Handle the short syntax
Andrew Lenharth6353e052006-12-08 18:07:09 +00005328 const PointerType *PFTy = 0;
5329 const FunctionType *Ty = 0;
Reid Spencer218ded22007-01-05 17:07:23 +00005330 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-5].TypeVal)->get())) ||
Andrew Lenharth6353e052006-12-08 18:07:09 +00005331 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5332 // Pull out the types of all of the arguments...
5333 std::vector<const Type*> ParamTypes;
Reid Spencer14310612006-12-31 05:40:51 +00005334 FunctionType::ParamAttrsList ParamAttrs;
Reid Spencer218ded22007-01-05 17:07:23 +00005335 ParamAttrs.push_back((yyvsp[0].ParamAttrs));
5336 for (ValueRefList::iterator I = (yyvsp[-2].ValueRefList)->begin(), E = (yyvsp[-2].ValueRefList)->end(); I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00005337 const Type *Ty = I->Val->getType();
5338 if (Ty == Type::VoidTy)
5339 GEN_ERROR("Short call syntax cannot be used with varargs");
5340 ParamTypes.push_back(Ty);
5341 ParamAttrs.push_back(I->Attrs);
Andrew Lenharth6353e052006-12-08 18:07:09 +00005342 }
5343
Reid Spencer218ded22007-01-05 17:07:23 +00005344 Ty = FunctionType::get((yyvsp[-5].TypeVal)->get(), ParamTypes, false, ParamAttrs);
Andrew Lenharth6353e052006-12-08 18:07:09 +00005345 PFTy = PointerType::get(Ty);
5346 }
5347
Reid Spencer218ded22007-01-05 17:07:23 +00005348 Value *V = getVal(PFTy, (yyvsp[-4].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00005349 CHECK_FOR_ERROR
5350
Reid Spencer14310612006-12-31 05:40:51 +00005351 // Check the arguments
5352 ValueList Args;
Reid Spencer218ded22007-01-05 17:07:23 +00005353 if ((yyvsp[-2].ValueRefList)->empty()) { // Has no arguments?
Andrew Lenharth6353e052006-12-08 18:07:09 +00005354 // Make sure no arguments is a good thing!
5355 if (Ty->getNumParams() != 0)
5356 GEN_ERROR("No arguments passed to a function that "
5357 "expects arguments!");
Andrew Lenharth6353e052006-12-08 18:07:09 +00005358 } else { // Has arguments?
5359 // Loop through FunctionType's arguments and ensure they are specified
5360 // correctly!
5361 //
5362 FunctionType::param_iterator I = Ty->param_begin();
5363 FunctionType::param_iterator E = Ty->param_end();
Reid Spencer218ded22007-01-05 17:07:23 +00005364 ValueRefList::iterator ArgI = (yyvsp[-2].ValueRefList)->begin(), ArgE = (yyvsp[-2].ValueRefList)->end();
Andrew Lenharth6353e052006-12-08 18:07:09 +00005365
Reid Spencer14310612006-12-31 05:40:51 +00005366 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5367 if (ArgI->Val->getType() != *I)
5368 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Andrew Lenharth6353e052006-12-08 18:07:09 +00005369 (*I)->getDescription() + "'!");
Reid Spencer14310612006-12-31 05:40:51 +00005370 Args.push_back(ArgI->Val);
5371 }
5372 if (Ty->isVarArg()) {
5373 if (I == E)
5374 for (; ArgI != ArgE; ++ArgI)
5375 Args.push_back(ArgI->Val); // push the remaining varargs
5376 } else if (I != E || ArgI != ArgE)
Andrew Lenharth6353e052006-12-08 18:07:09 +00005377 GEN_ERROR("Invalid number of parameters detected!");
Andrew Lenharth6353e052006-12-08 18:07:09 +00005378 }
Reid Spencer14310612006-12-31 05:40:51 +00005379 // Create the call node
5380 CallInst *CI = new CallInst(V, Args);
Reid Spencer218ded22007-01-05 17:07:23 +00005381 CI->setTailCall((yyvsp[-7].BoolVal));
5382 CI->setCallingConv((yyvsp[-6].UIntVal));
Reid Spencer14310612006-12-31 05:40:51 +00005383 (yyval.InstVal) = CI;
Reid Spencer218ded22007-01-05 17:07:23 +00005384 delete (yyvsp[-2].ValueRefList);
Reid Spencere4d87aa2006-12-23 06:05:41 +00005385 CHECK_FOR_ERROR
5386 ;}
5387 break;
5388
Reid Spencer218ded22007-01-05 17:07:23 +00005389 case 279:
Reid Spencer63c34452007-01-05 21:51:07 +00005390#line 2708 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00005391 {
5392 (yyval.InstVal) = (yyvsp[0].InstVal);
5393 CHECK_FOR_ERROR
5394 ;}
5395 break;
5396
Reid Spencer218ded22007-01-05 17:07:23 +00005397 case 280:
Reid Spencer63c34452007-01-05 21:51:07 +00005398#line 2713 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00005399 {
5400 (yyval.BoolVal) = true;
5401 CHECK_FOR_ERROR
5402 ;}
5403 break;
5404
Reid Spencer218ded22007-01-05 17:07:23 +00005405 case 281:
Reid Spencer63c34452007-01-05 21:51:07 +00005406#line 2717 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00005407 {
5408 (yyval.BoolVal) = false;
5409 CHECK_FOR_ERROR
5410 ;}
5411 break;
5412
Reid Spencer218ded22007-01-05 17:07:23 +00005413 case 282:
Reid Spencer63c34452007-01-05 21:51:07 +00005414#line 2724 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00005415 {
Reid Spencer14310612006-12-31 05:40:51 +00005416 if (!UpRefs.empty())
5417 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
Reid Spencere4d87aa2006-12-23 06:05:41 +00005418 (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5419 delete (yyvsp[-1].TypeVal);
5420 CHECK_FOR_ERROR
5421 ;}
5422 break;
5423
Reid Spencer218ded22007-01-05 17:07:23 +00005424 case 283:
Reid Spencer63c34452007-01-05 21:51:07 +00005425#line 2731 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00005426 {
Reid Spencer14310612006-12-31 05:40:51 +00005427 if (!UpRefs.empty())
5428 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
Reid Spencere4d87aa2006-12-23 06:05:41 +00005429 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
5430 CHECK_FOR_ERROR
5431 (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5432 delete (yyvsp[-4].TypeVal);
5433 ;}
5434 break;
5435
Reid Spencer218ded22007-01-05 17:07:23 +00005436 case 284:
Reid Spencer63c34452007-01-05 21:51:07 +00005437#line 2739 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00005438 {
Reid Spencer14310612006-12-31 05:40:51 +00005439 if (!UpRefs.empty())
5440 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
Reid Spencere4d87aa2006-12-23 06:05:41 +00005441 (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5442 delete (yyvsp[-1].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00005443 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00005444 ;}
5445 break;
5446
Reid Spencer218ded22007-01-05 17:07:23 +00005447 case 285:
Reid Spencer63c34452007-01-05 21:51:07 +00005448#line 2746 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Andrew Lenharth6353e052006-12-08 18:07:09 +00005449 {
Reid Spencer14310612006-12-31 05:40:51 +00005450 if (!UpRefs.empty())
5451 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
Reid Spencere4d87aa2006-12-23 06:05:41 +00005452 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00005453 CHECK_FOR_ERROR
Reid Spencere4d87aa2006-12-23 06:05:41 +00005454 (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5455 delete (yyvsp[-4].TypeVal);
Reid Spencer3822ff52006-11-08 06:47:33 +00005456 ;}
5457 break;
5458
Reid Spencer218ded22007-01-05 17:07:23 +00005459 case 286:
Reid Spencer63c34452007-01-05 21:51:07 +00005460#line 2754 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00005461 {
5462 if (!isa<PointerType>((yyvsp[0].ValueVal)->getType()))
5463 GEN_ERROR("Trying to free nonpointer type " +
5464 (yyvsp[0].ValueVal)->getType()->getDescription() + "!");
5465 (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00005466 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00005467 ;}
5468 break;
5469
Reid Spencer218ded22007-01-05 17:07:23 +00005470 case 287:
Reid Spencer63c34452007-01-05 21:51:07 +00005471#line 2762 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencere4d87aa2006-12-23 06:05:41 +00005472 {
Reid Spencer14310612006-12-31 05:40:51 +00005473 if (!UpRefs.empty())
5474 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
Reid Spencere4d87aa2006-12-23 06:05:41 +00005475 if (!isa<PointerType>((yyvsp[-1].TypeVal)->get()))
5476 GEN_ERROR("Can't load from nonpointer type: " +
5477 (*(yyvsp[-1].TypeVal))->getDescription());
5478 if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType())
5479 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5480 (*(yyvsp[-1].TypeVal))->getDescription());
5481 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00005482 CHECK_FOR_ERROR
Reid Spencere4d87aa2006-12-23 06:05:41 +00005483 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal));
5484 delete (yyvsp[-1].TypeVal);
Reid Spencer3822ff52006-11-08 06:47:33 +00005485 ;}
5486 break;
5487
Reid Spencer218ded22007-01-05 17:07:23 +00005488 case 288:
Reid Spencer63c34452007-01-05 21:51:07 +00005489#line 2776 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00005490 {
Reid Spencer14310612006-12-31 05:40:51 +00005491 if (!UpRefs.empty())
5492 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
Reid Spencere4d87aa2006-12-23 06:05:41 +00005493 const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
5494 if (!PT)
5495 GEN_ERROR("Can't store to a nonpointer type: " +
5496 (*(yyvsp[-1].TypeVal))->getDescription());
5497 const Type *ElTy = PT->getElementType();
5498 if (ElTy != (yyvsp[-3].ValueVal)->getType())
5499 GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() +
5500 "' into space of type '" + ElTy->getDescription() + "'!");
5501
5502 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00005503 CHECK_FOR_ERROR
Reid Spencere4d87aa2006-12-23 06:05:41 +00005504 (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal));
5505 delete (yyvsp[-1].TypeVal);
Reid Spencer3822ff52006-11-08 06:47:33 +00005506 ;}
5507 break;
5508
Reid Spencer218ded22007-01-05 17:07:23 +00005509 case 289:
Reid Spencer63c34452007-01-05 21:51:07 +00005510#line 2793 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00005511 {
Reid Spencer14310612006-12-31 05:40:51 +00005512 if (!UpRefs.empty())
5513 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
Reid Spencere4d87aa2006-12-23 06:05:41 +00005514 if (!isa<PointerType>((yyvsp[-2].TypeVal)->get()))
Reid Spencer61c83e02006-08-18 08:43:06 +00005515 GEN_ERROR("getelementptr insn requires pointer operand!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005516
Reid Spencere4d87aa2006-12-23 06:05:41 +00005517 if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), *(yyvsp[0].ValueList), true))
Reid Spencer61c83e02006-08-18 08:43:06 +00005518 GEN_ERROR("Invalid getelementptr indices for type '" +
Reid Spencere4d87aa2006-12-23 06:05:41 +00005519 (*(yyvsp[-2].TypeVal))->getDescription()+ "'!");
5520 Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00005521 CHECK_FOR_ERROR
Reid Spencere4d87aa2006-12-23 06:05:41 +00005522 (yyval.InstVal) = new GetElementPtrInst(tmpVal, *(yyvsp[0].ValueList));
5523 delete (yyvsp[-2].TypeVal);
5524 delete (yyvsp[0].ValueList);
Reid Spencer3822ff52006-11-08 06:47:33 +00005525 ;}
5526 break;
5527
5528
Reid Spencere4d87aa2006-12-23 06:05:41 +00005529 default: break;
Reid Spencer3822ff52006-11-08 06:47:33 +00005530 }
5531
Reid Spencere4d87aa2006-12-23 06:05:41 +00005532/* Line 1126 of yacc.c. */
Reid Spencer63c34452007-01-05 21:51:07 +00005533#line 5534 "llvmAsmParser.tab.c"
Andrew Lenharth6353e052006-12-08 18:07:09 +00005534
5535 yyvsp -= yylen;
5536 yyssp -= yylen;
5537
5538
Reid Spencer3822ff52006-11-08 06:47:33 +00005539 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005540
5541 *++yyvsp = yyval;
5542
5543
Reid Spencer3822ff52006-11-08 06:47:33 +00005544 /* Now `shift' the result of the reduction. Determine what state
5545 that goes to, based on the state we popped back to and the rule
5546 number reduced by. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00005547
5548 yyn = yyr1[yyn];
5549
Reid Spencer3822ff52006-11-08 06:47:33 +00005550 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5551 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00005552 yystate = yytable[yystate];
5553 else
Reid Spencer3822ff52006-11-08 06:47:33 +00005554 yystate = yydefgoto[yyn - YYNTOKENS];
Reid Spencer68a24bd2005-08-27 18:50:39 +00005555
5556 goto yynewstate;
5557
5558
Reid Spencer3822ff52006-11-08 06:47:33 +00005559/*------------------------------------.
5560| yyerrlab -- here on detecting error |
5561`------------------------------------*/
5562yyerrlab:
5563 /* If not already recovering from an error, report this error. */
5564 if (!yyerrstatus)
Reid Spencer68a24bd2005-08-27 18:50:39 +00005565 {
5566 ++yynerrs;
Andrew Lenharth6353e052006-12-08 18:07:09 +00005567#if YYERROR_VERBOSE
5568 yyn = yypact[yystate];
Bill Wendlinge8156192006-12-07 01:30:32 +00005569
Andrew Lenharth6353e052006-12-08 18:07:09 +00005570 if (YYPACT_NINF < yyn && yyn < YYLAST)
5571 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00005572 int yytype = YYTRANSLATE (yychar);
Reid Spencere4d87aa2006-12-23 06:05:41 +00005573 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
5574 YYSIZE_T yysize = yysize0;
5575 YYSIZE_T yysize1;
5576 int yysize_overflow = 0;
5577 char *yymsg = 0;
5578# define YYERROR_VERBOSE_ARGS_MAXIMUM 5
5579 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
Andrew Lenharth6353e052006-12-08 18:07:09 +00005580 int yyx;
5581
Reid Spencere4d87aa2006-12-23 06:05:41 +00005582#if 0
5583 /* This is so xgettext sees the translatable formats that are
5584 constructed on the fly. */
5585 YY_("syntax error, unexpected %s");
5586 YY_("syntax error, unexpected %s, expecting %s");
5587 YY_("syntax error, unexpected %s, expecting %s or %s");
5588 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
5589 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
5590#endif
5591 char *yyfmt;
5592 char const *yyf;
5593 static char const yyunexpected[] = "syntax error, unexpected %s";
5594 static char const yyexpecting[] = ", expecting %s";
5595 static char const yyor[] = " or %s";
5596 char yyformat[sizeof yyunexpected
5597 + sizeof yyexpecting - 1
5598 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
5599 * (sizeof yyor - 1))];
5600 char const *yyprefix = yyexpecting;
5601
Andrew Lenharth6353e052006-12-08 18:07:09 +00005602 /* Start YYX at -YYN if negative to avoid negative indexes in
5603 YYCHECK. */
5604 int yyxbegin = yyn < 0 ? -yyn : 0;
5605
5606 /* Stay within bounds of both yycheck and yytname. */
5607 int yychecklim = YYLAST - yyn;
5608 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
Reid Spencere4d87aa2006-12-23 06:05:41 +00005609 int yycount = 1;
Andrew Lenharth6353e052006-12-08 18:07:09 +00005610
Reid Spencere4d87aa2006-12-23 06:05:41 +00005611 yyarg[0] = yytname[yytype];
5612 yyfmt = yystpcpy (yyformat, yyunexpected);
5613
Andrew Lenharth6353e052006-12-08 18:07:09 +00005614 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5615 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5616 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00005617 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
Andrew Lenharth6353e052006-12-08 18:07:09 +00005618 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00005619 yycount = 1;
5620 yysize = yysize0;
5621 yyformat[sizeof yyunexpected - 1] = '\0';
Andrew Lenharth6353e052006-12-08 18:07:09 +00005622 break;
5623 }
Reid Spencere4d87aa2006-12-23 06:05:41 +00005624 yyarg[yycount++] = yytname[yyx];
5625 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
5626 yysize_overflow |= yysize1 < yysize;
5627 yysize = yysize1;
5628 yyfmt = yystpcpy (yyfmt, yyprefix);
5629 yyprefix = yyor;
Andrew Lenharth6353e052006-12-08 18:07:09 +00005630 }
Andrew Lenharth6353e052006-12-08 18:07:09 +00005631
Reid Spencere4d87aa2006-12-23 06:05:41 +00005632 yyf = YY_(yyformat);
5633 yysize1 = yysize + yystrlen (yyf);
5634 yysize_overflow |= yysize1 < yysize;
5635 yysize = yysize1;
5636
5637 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
5638 yymsg = (char *) YYSTACK_ALLOC (yysize);
5639 if (yymsg)
5640 {
5641 /* Avoid sprintf, as that infringes on the user's name space.
5642 Don't have undefined behavior even if the translation
5643 produced a string with the wrong number of "%s"s. */
5644 char *yyp = yymsg;
5645 int yyi = 0;
5646 while ((*yyp = *yyf))
Andrew Lenharth6353e052006-12-08 18:07:09 +00005647 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00005648 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
5649 {
5650 yyp += yytnamerr (yyp, yyarg[yyi++]);
5651 yyf += 2;
5652 }
5653 else
5654 {
5655 yyp++;
5656 yyf++;
5657 }
Andrew Lenharth6353e052006-12-08 18:07:09 +00005658 }
5659 yyerror (yymsg);
5660 YYSTACK_FREE (yymsg);
5661 }
5662 else
Reid Spencere4d87aa2006-12-23 06:05:41 +00005663 {
5664 yyerror (YY_("syntax error"));
5665 goto yyexhaustedlab;
5666 }
Andrew Lenharth6353e052006-12-08 18:07:09 +00005667 }
5668 else
5669#endif /* YYERROR_VERBOSE */
Reid Spencere4d87aa2006-12-23 06:05:41 +00005670 yyerror (YY_("syntax error"));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005671 }
5672
Reid Spencer3822ff52006-11-08 06:47:33 +00005673
Reid Spencer68a24bd2005-08-27 18:50:39 +00005674
5675 if (yyerrstatus == 3)
5676 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00005677 /* If just tried and failed to reuse look-ahead token after an
Reid Spencer3822ff52006-11-08 06:47:33 +00005678 error, discard it. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00005679
Reid Spencer3822ff52006-11-08 06:47:33 +00005680 if (yychar <= YYEOF)
Andrew Lenharth6353e052006-12-08 18:07:09 +00005681 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00005682 /* Return failure if at end of input. */
Reid Spencer3822ff52006-11-08 06:47:33 +00005683 if (yychar == YYEOF)
Reid Spencere4d87aa2006-12-23 06:05:41 +00005684 YYABORT;
Andrew Lenharth6353e052006-12-08 18:07:09 +00005685 }
Reid Spencer3822ff52006-11-08 06:47:33 +00005686 else
5687 {
Reid Spencere4d87aa2006-12-23 06:05:41 +00005688 yydestruct ("Error: discarding", yytoken, &yylval);
Reid Spencer3822ff52006-11-08 06:47:33 +00005689 yychar = YYEMPTY;
5690 }
5691 }
5692
Reid Spencere4d87aa2006-12-23 06:05:41 +00005693 /* Else will try to reuse look-ahead token after shifting the error
Reid Spencer3822ff52006-11-08 06:47:33 +00005694 token. */
5695 goto yyerrlab1;
5696
5697
5698/*---------------------------------------------------.
5699| yyerrorlab -- error raised explicitly by YYERROR. |
5700`---------------------------------------------------*/
5701yyerrorlab:
5702
Reid Spencere4d87aa2006-12-23 06:05:41 +00005703 /* Pacify compilers like GCC when the user code never invokes
5704 YYERROR and the label yyerrorlab therefore never appears in user
5705 code. */
Andrew Lenharth6353e052006-12-08 18:07:09 +00005706 if (0)
Reid Spencer3822ff52006-11-08 06:47:33 +00005707 goto yyerrorlab;
5708
Reid Spencere4d87aa2006-12-23 06:05:41 +00005709yyvsp -= yylen;
Andrew Lenharth6353e052006-12-08 18:07:09 +00005710 yyssp -= yylen;
Reid Spencer3822ff52006-11-08 06:47:33 +00005711 yystate = *yyssp;
5712 goto yyerrlab1;
5713
5714
5715/*-------------------------------------------------------------.
5716| yyerrlab1 -- common code for both syntax error and YYERROR. |
5717`-------------------------------------------------------------*/
5718yyerrlab1:
5719 yyerrstatus = 3; /* Each real token shifted decrements this. */
5720
5721 for (;;)
5722 {
5723 yyn = yypact[yystate];
5724 if (yyn != YYPACT_NINF)
5725 {
5726 yyn += YYTERROR;
5727 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5728 {
5729 yyn = yytable[yyn];
5730 if (0 < yyn)
5731 break;
5732 }
5733 }
5734
5735 /* Pop the current state because it cannot handle the error token. */
5736 if (yyssp == yyss)
Reid Spencer68a24bd2005-08-27 18:50:39 +00005737 YYABORT;
5738
Reid Spencere4d87aa2006-12-23 06:05:41 +00005739
5740 yydestruct ("Error: popping", yystos[yystate], yyvsp);
Andrew Lenharth6353e052006-12-08 18:07:09 +00005741 YYPOPSTACK;
Reid Spencer3822ff52006-11-08 06:47:33 +00005742 yystate = *yyssp;
5743 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005744 }
5745
5746 if (yyn == YYFINAL)
5747 YYACCEPT;
5748
Reid Spencer68a24bd2005-08-27 18:50:39 +00005749 *++yyvsp = yylval;
Reid Spencer3822ff52006-11-08 06:47:33 +00005750
5751
Reid Spencere4d87aa2006-12-23 06:05:41 +00005752 /* Shift the error token. */
5753 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
5754
Reid Spencer68a24bd2005-08-27 18:50:39 +00005755 yystate = yyn;
5756 goto yynewstate;
5757
Chris Lattnerf49c1762006-11-08 05:58:47 +00005758
Reid Spencer3822ff52006-11-08 06:47:33 +00005759/*-------------------------------------.
5760| yyacceptlab -- YYACCEPT comes here. |
5761`-------------------------------------*/
5762yyacceptlab:
5763 yyresult = 0;
5764 goto yyreturn;
5765
5766/*-----------------------------------.
5767| yyabortlab -- YYABORT comes here. |
5768`-----------------------------------*/
5769yyabortlab:
5770 yyresult = 1;
5771 goto yyreturn;
5772
5773#ifndef yyoverflow
Reid Spencere4d87aa2006-12-23 06:05:41 +00005774/*-------------------------------------------------.
5775| yyexhaustedlab -- memory exhaustion comes here. |
5776`-------------------------------------------------*/
5777yyexhaustedlab:
5778 yyerror (YY_("memory exhausted"));
Reid Spencer3822ff52006-11-08 06:47:33 +00005779 yyresult = 2;
5780 /* Fall through. */
Chris Lattnerf49c1762006-11-08 05:58:47 +00005781#endif
Reid Spencer3822ff52006-11-08 06:47:33 +00005782
5783yyreturn:
Reid Spencere4d87aa2006-12-23 06:05:41 +00005784 if (yychar != YYEOF && yychar != YYEMPTY)
5785 yydestruct ("Cleanup: discarding lookahead",
5786 yytoken, &yylval);
5787 while (yyssp != yyss)
5788 {
5789 yydestruct ("Cleanup: popping",
5790 yystos[*yyssp], yyvsp);
5791 YYPOPSTACK;
5792 }
Reid Spencer3822ff52006-11-08 06:47:33 +00005793#ifndef yyoverflow
5794 if (yyss != yyssa)
5795 YYSTACK_FREE (yyss);
5796#endif
Andrew Lenharth6353e052006-12-08 18:07:09 +00005797 return yyresult;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005798}
Reid Spencer3822ff52006-11-08 06:47:33 +00005799
5800
Reid Spencer63c34452007-01-05 21:51:07 +00005801#line 2810 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
Reid Spencer61c83e02006-08-18 08:43:06 +00005802
5803
Reid Spencer14310612006-12-31 05:40:51 +00005804// common code from the two 'RunVMAsmParser' functions
5805static Module* RunParser(Module * M) {
5806
5807 llvmAsmlineno = 1; // Reset the current line number...
5808 CurModule.CurrentModule = M;
5809#if YYDEBUG
5810 yydebug = Debug;
5811#endif
5812
5813 // Check to make sure the parser succeeded
5814 if (yyparse()) {
5815 if (ParserResult)
5816 delete ParserResult;
5817 return 0;
5818 }
5819
5820 // Check to make sure that parsing produced a result
5821 if (!ParserResult)
5822 return 0;
5823
5824 // Reset ParserResult variable while saving its value for the result.
5825 Module *Result = ParserResult;
5826 ParserResult = 0;
5827
5828 return Result;
5829}
5830
Reid Spencer61c83e02006-08-18 08:43:06 +00005831void llvm::GenerateError(const std::string &message, int LineNo) {
5832 if (LineNo == -1) LineNo = llvmAsmlineno;
5833 // TODO: column number in exception
5834 if (TheParseError)
5835 TheParseError->setError(CurFilename, message, LineNo);
5836 TriggerError = 1;
5837}
Reid Spencer68a24bd2005-08-27 18:50:39 +00005838
5839int yyerror(const char *ErrorMsg) {
5840 std::string where
5841 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5842 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5843 std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading ";
5844 if (yychar == YYEMPTY || yychar == 0)
5845 errMsg += "end-of-file.";
5846 else
5847 errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'";
Reid Spencer61c83e02006-08-18 08:43:06 +00005848 GenerateError(errMsg);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005849 return 0;
5850}
Reid Spencer3822ff52006-11-08 06:47:33 +00005851