blob: 955fb871f5d93a4e9e0965965ec640d9ec616fce [file] [log] [blame]
Andrew Lenharth6353e052006-12-08 18:07:09 +00001/* A Bison parser, made by GNU Bison 1.875c. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002
Andrew Lenharth6353e052006-12-08 18:07:09 +00003/* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 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
Andrew Lenharth6353e052006-12-08 18:07:09 +000018 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, 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 Spencer3822ff52006-11-08 06:47:33 +000039/* Skeleton name. */
40#define YYSKELETON_NAME "yacc.c"
41
42/* Pure parsers. */
43#define YYPURE 0
44
45/* Using locations. */
46#define YYLSP_NEEDED 0
47
Andrew Lenharth6353e052006-12-08 18:07:09 +000048/* If NAME_PREFIX is specified substitute the variables and functions
49 names. */
Reid Spencer68a24bd2005-08-27 18:50:39 +000050#define yyparse llvmAsmparse
Reid Spencer3822ff52006-11-08 06:47:33 +000051#define yylex llvmAsmlex
Reid Spencer68a24bd2005-08-27 18:50:39 +000052#define yyerror llvmAsmerror
Reid Spencer3822ff52006-11-08 06:47:33 +000053#define yylval llvmAsmlval
54#define yychar llvmAsmchar
Reid Spencer68a24bd2005-08-27 18:50:39 +000055#define yydebug llvmAsmdebug
56#define yynerrs llvmAsmnerrs
57
Reid Spencer3822ff52006-11-08 06:47:33 +000058
59/* Tokens. */
60#ifndef YYTOKENTYPE
61# define YYTOKENTYPE
62 /* Put the tokens into the symbol table, so that GDB and other debuggers
63 know about them. */
64 enum yytokentype {
65 ESINT64VAL = 258,
66 EUINT64VAL = 259,
67 SINTVAL = 260,
68 UINTVAL = 261,
69 FPVAL = 262,
70 VOID = 263,
71 BOOL = 264,
72 SBYTE = 265,
73 UBYTE = 266,
74 SHORT = 267,
75 USHORT = 268,
76 INT = 269,
77 UINT = 270,
78 LONG = 271,
79 ULONG = 272,
80 FLOAT = 273,
81 DOUBLE = 274,
82 TYPE = 275,
83 LABEL = 276,
84 VAR_ID = 277,
85 LABELSTR = 278,
86 STRINGCONSTANT = 279,
87 IMPLEMENTATION = 280,
88 ZEROINITIALIZER = 281,
89 TRUETOK = 282,
90 FALSETOK = 283,
91 BEGINTOK = 284,
92 ENDTOK = 285,
93 DECLARE = 286,
94 GLOBAL = 287,
95 CONSTANT = 288,
96 SECTION = 289,
97 VOLATILE = 290,
98 TO = 291,
99 DOTDOTDOT = 292,
100 NULL_TOK = 293,
101 UNDEF = 294,
102 CONST = 295,
103 INTERNAL = 296,
104 LINKONCE = 297,
105 WEAK = 298,
106 APPENDING = 299,
107 DLLIMPORT = 300,
108 DLLEXPORT = 301,
109 EXTERN_WEAK = 302,
110 OPAQUE = 303,
111 NOT = 304,
112 EXTERNAL = 305,
113 TARGET = 306,
114 TRIPLE = 307,
115 ENDIAN = 308,
116 POINTERSIZE = 309,
117 LITTLE = 310,
118 BIG = 311,
119 ALIGN = 312,
120 DEPLIBS = 313,
121 CALL = 314,
122 TAIL = 315,
123 ASM_TOK = 316,
124 MODULE = 317,
125 SIDEEFFECT = 318,
126 CC_TOK = 319,
127 CCC_TOK = 320,
128 CSRETCC_TOK = 321,
129 FASTCC_TOK = 322,
130 COLDCC_TOK = 323,
131 X86_STDCALLCC_TOK = 324,
132 X86_FASTCALLCC_TOK = 325,
133 DATALAYOUT = 326,
134 RET = 327,
135 BR = 328,
136 SWITCH = 329,
137 INVOKE = 330,
138 UNWIND = 331,
139 UNREACHABLE = 332,
140 ADD = 333,
141 SUB = 334,
142 MUL = 335,
143 UDIV = 336,
144 SDIV = 337,
145 FDIV = 338,
146 UREM = 339,
147 SREM = 340,
148 FREM = 341,
149 AND = 342,
150 OR = 343,
151 XOR = 344,
152 SETLE = 345,
153 SETGE = 346,
154 SETLT = 347,
155 SETGT = 348,
156 SETEQ = 349,
157 SETNE = 350,
Reid Spencera132e042006-12-03 05:46:11 +0000158 ICMP = 351,
159 FCMP = 352,
160 EQ = 353,
161 NE = 354,
162 SLT = 355,
163 SGT = 356,
164 SLE = 357,
165 SGE = 358,
166 ULT = 359,
167 UGT = 360,
168 ULE = 361,
169 UGE = 362,
Reid Spencer6e18b7d2006-12-03 06:59:29 +0000170 OEQ = 363,
171 ONE = 364,
172 OLT = 365,
173 OGT = 366,
174 OLE = 367,
175 OGE = 368,
Reid Spencera132e042006-12-03 05:46:11 +0000176 ORD = 369,
177 UNO = 370,
Reid Spencer6e18b7d2006-12-03 06:59:29 +0000178 UEQ = 371,
179 UNE = 372,
180 MALLOC = 373,
181 ALLOCA = 374,
182 FREE = 375,
183 LOAD = 376,
184 STORE = 377,
185 GETELEMENTPTR = 378,
186 TRUNC = 379,
187 ZEXT = 380,
188 SEXT = 381,
189 FPTRUNC = 382,
190 FPEXT = 383,
191 BITCAST = 384,
192 UITOFP = 385,
193 SITOFP = 386,
194 FPTOUI = 387,
195 FPTOSI = 388,
196 INTTOPTR = 389,
197 PTRTOINT = 390,
198 PHI_TOK = 391,
199 SELECT = 392,
200 SHL = 393,
201 LSHR = 394,
202 ASHR = 395,
203 VAARG = 396,
204 EXTRACTELEMENT = 397,
205 INSERTELEMENT = 398,
Reid Spencercd42c582006-12-05 23:29:42 +0000206 SHUFFLEVECTOR = 399
Reid Spencer3822ff52006-11-08 06:47:33 +0000207 };
208#endif
Reid Spencer3822ff52006-11-08 06:47:33 +0000209#define ESINT64VAL 258
210#define EUINT64VAL 259
211#define SINTVAL 260
212#define UINTVAL 261
213#define FPVAL 262
214#define VOID 263
215#define BOOL 264
216#define SBYTE 265
217#define UBYTE 266
218#define SHORT 267
219#define USHORT 268
220#define INT 269
221#define UINT 270
222#define LONG 271
223#define ULONG 272
224#define FLOAT 273
225#define DOUBLE 274
226#define TYPE 275
227#define LABEL 276
228#define VAR_ID 277
229#define LABELSTR 278
230#define STRINGCONSTANT 279
231#define IMPLEMENTATION 280
232#define ZEROINITIALIZER 281
233#define TRUETOK 282
234#define FALSETOK 283
235#define BEGINTOK 284
236#define ENDTOK 285
237#define DECLARE 286
238#define GLOBAL 287
239#define CONSTANT 288
240#define SECTION 289
241#define VOLATILE 290
242#define TO 291
243#define DOTDOTDOT 292
244#define NULL_TOK 293
245#define UNDEF 294
246#define CONST 295
247#define INTERNAL 296
248#define LINKONCE 297
249#define WEAK 298
250#define APPENDING 299
251#define DLLIMPORT 300
252#define DLLEXPORT 301
253#define EXTERN_WEAK 302
254#define OPAQUE 303
255#define NOT 304
256#define EXTERNAL 305
257#define TARGET 306
258#define TRIPLE 307
259#define ENDIAN 308
260#define POINTERSIZE 309
261#define LITTLE 310
262#define BIG 311
263#define ALIGN 312
264#define DEPLIBS 313
265#define CALL 314
266#define TAIL 315
267#define ASM_TOK 316
268#define MODULE 317
269#define SIDEEFFECT 318
270#define CC_TOK 319
271#define CCC_TOK 320
272#define CSRETCC_TOK 321
273#define FASTCC_TOK 322
274#define COLDCC_TOK 323
275#define X86_STDCALLCC_TOK 324
276#define X86_FASTCALLCC_TOK 325
277#define DATALAYOUT 326
278#define RET 327
279#define BR 328
280#define SWITCH 329
281#define INVOKE 330
282#define UNWIND 331
283#define UNREACHABLE 332
284#define ADD 333
285#define SUB 334
286#define MUL 335
287#define UDIV 336
288#define SDIV 337
289#define FDIV 338
290#define UREM 339
291#define SREM 340
292#define FREM 341
293#define AND 342
294#define OR 343
295#define XOR 344
296#define SETLE 345
297#define SETGE 346
298#define SETLT 347
299#define SETGT 348
300#define SETEQ 349
301#define SETNE 350
Reid Spencera132e042006-12-03 05:46:11 +0000302#define ICMP 351
303#define FCMP 352
304#define EQ 353
305#define NE 354
306#define SLT 355
307#define SGT 356
308#define SLE 357
309#define SGE 358
310#define ULT 359
311#define UGT 360
312#define ULE 361
313#define UGE 362
Reid Spencer6e18b7d2006-12-03 06:59:29 +0000314#define OEQ 363
315#define ONE 364
316#define OLT 365
317#define OGT 366
318#define OLE 367
319#define OGE 368
Reid Spencera132e042006-12-03 05:46:11 +0000320#define ORD 369
321#define UNO 370
Reid Spencer6e18b7d2006-12-03 06:59:29 +0000322#define UEQ 371
323#define UNE 372
324#define MALLOC 373
325#define ALLOCA 374
326#define FREE 375
327#define LOAD 376
328#define STORE 377
329#define GETELEMENTPTR 378
330#define TRUNC 379
331#define ZEXT 380
332#define SEXT 381
333#define FPTRUNC 382
334#define FPEXT 383
335#define BITCAST 384
336#define UITOFP 385
337#define SITOFP 386
338#define FPTOUI 387
339#define FPTOSI 388
340#define INTTOPTR 389
341#define PTRTOINT 390
342#define PHI_TOK 391
343#define SELECT 392
344#define SHL 393
345#define LSHR 394
346#define ASHR 395
347#define VAARG 396
348#define EXTRACTELEMENT 397
349#define INSERTELEMENT 398
350#define SHUFFLEVECTOR 399
Reid Spencer3822ff52006-11-08 06:47:33 +0000351
352
353
354
355/* Copy the first part of user declarations. */
Andrew Lenharth6353e052006-12-08 18:07:09 +0000356#line 14 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000357
358#include "ParserInternals.h"
359#include "llvm/CallingConv.h"
Chris Lattner0e9c3762006-01-25 22:27:16 +0000360#include "llvm/InlineAsm.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000361#include "llvm/Instructions.h"
362#include "llvm/Module.h"
363#include "llvm/SymbolTable.h"
364#include "llvm/Support/GetElementPtrTypeIterator.h"
365#include "llvm/ADT/STLExtras.h"
Chris Lattner0019bbe2005-11-06 06:46:53 +0000366#include "llvm/Support/MathExtras.h"
Reid Spencer481169e2006-12-01 00:33:46 +0000367#include "llvm/Support/Streams.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000368#include <algorithm>
Reid Spencer68a24bd2005-08-27 18:50:39 +0000369#include <list>
370#include <utility>
371
Reid Spencere4f47592006-08-18 17:32:55 +0000372// The following is a gross hack. In order to rid the libAsmParser library of
373// exceptions, we have to have a way of getting the yyparse function to go into
374// an error situation. So, whenever we want an error to occur, the GenerateError
375// function (see bottom of file) sets TriggerError. Then, at the end of each
376// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
377// (a goto) to put YACC in error state. Furthermore, several calls to
378// GenerateError are made from inside productions and they must simulate the
379// previous exception behavior by exiting the production immediately. We have
380// replaced these with the GEN_ERROR macro which calls GeneratError and then
381// immediately invokes YYERROR. This would be so much cleaner if it was a
382// recursive descent parser.
Reid Spencer61c83e02006-08-18 08:43:06 +0000383static bool TriggerError = false;
Reid Spencerf63697d2006-10-09 17:36:59 +0000384#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
Reid Spencer61c83e02006-08-18 08:43:06 +0000385#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
386
Reid Spencer68a24bd2005-08-27 18:50:39 +0000387int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
388int yylex(); // declaration" of xxx warnings.
389int yyparse();
390
391namespace llvm {
392 std::string CurFilename;
393}
394using namespace llvm;
395
396static Module *ParserResult;
397
398// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
399// relating to upreferences in the input stream.
400//
401//#define DEBUG_UPREFS 1
402#ifdef DEBUG_UPREFS
Bill Wendlinge8156192006-12-07 01:30:32 +0000403#define UR_OUT(X) cerr << X
Reid Spencer68a24bd2005-08-27 18:50:39 +0000404#else
405#define UR_OUT(X)
406#endif
407
408#define YYERROR_VERBOSE 1
409
Chris Lattnerb475c422005-11-12 18:22:38 +0000410static GlobalVariable *CurGV;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000411
412
413// This contains info used when building the body of a function. It is
414// destroyed when the function is completed.
415//
416typedef std::vector<Value *> ValueList; // Numbered defs
417static void
418ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers,
419 std::map<const Type *,ValueList> *FutureLateResolvers = 0);
420
421static struct PerModuleInfo {
422 Module *CurrentModule;
423 std::map<const Type *, ValueList> Values; // Module level numbered definitions
424 std::map<const Type *,ValueList> LateResolveValues;
Reid Spencer861d9d62006-11-28 07:29:44 +0000425 std::vector<PATypeHolder> Types;
426 std::map<ValID, PATypeHolder> LateResolveTypes;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000427
428 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
Chris Lattner0ad19702006-06-21 16:53:00 +0000429 /// how they were referenced and on which line of the input they came from so
Reid Spencer68a24bd2005-08-27 18:50:39 +0000430 /// that we can resolve them later and print error messages as appropriate.
431 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
432
433 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
434 // references to global values. Global values may be referenced before they
435 // are defined, and if so, the temporary object that they represent is held
436 // here. This is used for forward references of GlobalValues.
437 //
438 typedef std::map<std::pair<const PointerType *,
439 ValID>, GlobalValue*> GlobalRefsType;
440 GlobalRefsType GlobalRefs;
441
442 void ModuleDone() {
443 // If we could not resolve some functions at function compilation time
444 // (calls to functions before they are defined), resolve them now... Types
445 // are resolved when the constant pool has been completely parsed.
446 //
447 ResolveDefinitions(LateResolveValues);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000448 if (TriggerError)
449 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000450
451 // Check to make sure that all global value forward references have been
452 // resolved!
453 //
454 if (!GlobalRefs.empty()) {
455 std::string UndefinedReferences = "Unresolved global references exist:\n";
456
457 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
458 I != E; ++I) {
459 UndefinedReferences += " " + I->first.first->getDescription() + " " +
460 I->first.second.getName() + "\n";
461 }
Reid Spencer61c83e02006-08-18 08:43:06 +0000462 GenerateError(UndefinedReferences);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000463 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000464 }
465
466 Values.clear(); // Clear out function local definitions
467 Types.clear();
468 CurrentModule = 0;
469 }
470
Reid Spencer68a24bd2005-08-27 18:50:39 +0000471 // GetForwardRefForGlobal - Check to see if there is a forward reference
472 // for this global. If so, remove it from the GlobalRefs map and return it.
473 // If not, just return null.
474 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
475 // Check to see if there is a forward reference to this global variable...
476 // if there is, eliminate it and patch the reference to use the new def'n.
477 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
478 GlobalValue *Ret = 0;
479 if (I != GlobalRefs.end()) {
480 Ret = I->second;
481 GlobalRefs.erase(I);
482 }
483 return Ret;
484 }
485} CurModule;
486
487static struct PerFunctionInfo {
488 Function *CurrentFunction; // Pointer to current function being created
489
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000490 std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
Reid Spencer68a24bd2005-08-27 18:50:39 +0000491 std::map<const Type*, ValueList> LateResolveValues;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000492 bool isDeclare; // Is this function a forward declararation?
493 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
Reid Spencer68a24bd2005-08-27 18:50:39 +0000494
495 /// BBForwardRefs - When we see forward references to basic blocks, keep
496 /// track of them here.
497 std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs;
498 std::vector<BasicBlock*> NumberedBlocks;
499 unsigned NextBBNum;
500
501 inline PerFunctionInfo() {
502 CurrentFunction = 0;
503 isDeclare = false;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000504 Linkage = GlobalValue::ExternalLinkage;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000505 }
506
507 inline void FunctionStart(Function *M) {
508 CurrentFunction = M;
509 NextBBNum = 0;
510 }
511
512 void FunctionDone() {
513 NumberedBlocks.clear();
514
515 // Any forward referenced blocks left?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000516 if (!BBForwardRefs.empty()) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000517 GenerateError("Undefined reference to label " +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000518 BBForwardRefs.begin()->first->getName());
Reid Spencer5b7e7532006-09-28 19:28:24 +0000519 return;
520 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000521
522 // Resolve all forward references now.
523 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
524
525 Values.clear(); // Clear out function local definitions
526 CurrentFunction = 0;
527 isDeclare = false;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000528 Linkage = GlobalValue::ExternalLinkage;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000529 }
530} CurFun; // Info for the current function...
531
532static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
533
534
535//===----------------------------------------------------------------------===//
536// Code to handle definitions of all the types
537//===----------------------------------------------------------------------===//
538
539static int InsertValue(Value *V,
540 std::map<const Type*,ValueList> &ValueTab = CurFun.Values) {
541 if (V->hasName()) return -1; // Is this a numbered definition?
542
543 // Yes, insert the value into the value table...
544 ValueList &List = ValueTab[V->getType()];
545 List.push_back(V);
546 return List.size()-1;
547}
548
549static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
550 switch (D.Type) {
551 case ValID::NumberVal: // Is it a numbered definition?
552 // Module constants occupy the lowest numbered slots...
553 if ((unsigned)D.Num < CurModule.Types.size())
Reid Spencer861d9d62006-11-28 07:29:44 +0000554 return CurModule.Types[(unsigned)D.Num];
Reid Spencer68a24bd2005-08-27 18:50:39 +0000555 break;
556 case ValID::NameVal: // Is it a named definition?
557 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
558 D.destroy(); // Free old strdup'd memory...
559 return N;
560 }
561 break;
562 default:
Reid Spencer61c83e02006-08-18 08:43:06 +0000563 GenerateError("Internal parser error: Invalid symbol type reference!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000564 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000565 }
566
567 // If we reached here, we referenced either a symbol that we don't know about
568 // or an id number that hasn't been read yet. We may be referencing something
569 // forward, so just create an entry to be resolved later and get to it...
570 //
571 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
572
573
574 if (inFunctionScope()) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000575 if (D.Type == ValID::NameVal) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000576 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000577 return 0;
578 } else {
Reid Spencer61c83e02006-08-18 08:43:06 +0000579 GenerateError("Reference to an undefined type: #" + itostr(D.Num));
Reid Spencer5b7e7532006-09-28 19:28:24 +0000580 return 0;
581 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000582 }
583
Reid Spencer861d9d62006-11-28 07:29:44 +0000584 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000585 if (I != CurModule.LateResolveTypes.end())
Reid Spencer861d9d62006-11-28 07:29:44 +0000586 return I->second;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000587
Reid Spencer861d9d62006-11-28 07:29:44 +0000588 Type *Typ = OpaqueType::get();
589 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
590 return Typ;
Reid Spencera132e042006-12-03 05:46:11 +0000591 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000592
593static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) {
594 SymbolTable &SymTab =
595 inFunctionScope() ? CurFun.CurrentFunction->getSymbolTable() :
596 CurModule.CurrentModule->getSymbolTable();
597 return SymTab.lookup(Ty, Name);
598}
599
600// getValNonImprovising - Look up the value specified by the provided type and
601// the provided ValID. If the value exists and has already been defined, return
602// it. Otherwise return null.
603//
604static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000605 if (isa<FunctionType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000606 GenerateError("Functions are not values and "
Reid Spencer68a24bd2005-08-27 18:50:39 +0000607 "must be referenced as pointers");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000608 return 0;
609 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000610
611 switch (D.Type) {
612 case ValID::NumberVal: { // Is it a numbered definition?
613 unsigned Num = (unsigned)D.Num;
614
615 // Module constants occupy the lowest numbered slots...
616 std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
617 if (VI != CurModule.Values.end()) {
618 if (Num < VI->second.size())
619 return VI->second[Num];
620 Num -= VI->second.size();
621 }
622
623 // Make sure that our type is within bounds
624 VI = CurFun.Values.find(Ty);
625 if (VI == CurFun.Values.end()) return 0;
626
627 // Check that the number is within bounds...
628 if (VI->second.size() <= Num) return 0;
629
630 return VI->second[Num];
631 }
632
633 case ValID::NameVal: { // Is it a named definition?
634 Value *N = lookupInSymbolTable(Ty, std::string(D.Name));
635 if (N == 0) return 0;
636
637 D.destroy(); // Free old strdup'd memory...
638 return N;
639 }
640
641 // Check to make sure that "Ty" is an integral type, and that our
642 // value will fit into the specified type...
643 case ValID::ConstSIntVal: // Is it a constant pool reference??
Reid Spencerb83eb642006-10-20 07:07:24 +0000644 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000645 GenerateError("Signed integral constant '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000646 itostr(D.ConstPool64) + "' is invalid for type '" +
647 Ty->getDescription() + "'!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000648 return 0;
649 }
Reid Spencerb83eb642006-10-20 07:07:24 +0000650 return ConstantInt::get(Ty, D.ConstPool64);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000651
652 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
Reid Spencerb83eb642006-10-20 07:07:24 +0000653 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
654 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000655 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000656 "' is invalid or out of range!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000657 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000658 } else { // This is really a signed reference. Transmogrify.
Reid Spencerb83eb642006-10-20 07:07:24 +0000659 return ConstantInt::get(Ty, D.ConstPool64);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000660 }
661 } else {
Reid Spencerb83eb642006-10-20 07:07:24 +0000662 return ConstantInt::get(Ty, D.UConstPool64);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000663 }
664
665 case ValID::ConstFPVal: // Is it a floating point const pool reference?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000666 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000667 GenerateError("FP constant invalid for type!!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000668 return 0;
669 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000670 return ConstantFP::get(Ty, D.ConstPoolFP);
671
672 case ValID::ConstNullVal: // Is it a null value?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000673 if (!isa<PointerType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000674 GenerateError("Cannot create a a non pointer null!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000675 return 0;
676 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000677 return ConstantPointerNull::get(cast<PointerType>(Ty));
678
679 case ValID::ConstUndefVal: // Is it an undef value?
680 return UndefValue::get(Ty);
681
Chris Lattner7aa61892005-12-21 17:53:23 +0000682 case ValID::ConstZeroVal: // Is it a zero value?
683 return Constant::getNullValue(Ty);
684
Reid Spencer68a24bd2005-08-27 18:50:39 +0000685 case ValID::ConstantVal: // Fully resolved constant?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000686 if (D.ConstantValue->getType() != Ty) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000687 GenerateError("Constant expression type different from required type!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000688 return 0;
689 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000690 return D.ConstantValue;
691
Chris Lattner0e9c3762006-01-25 22:27:16 +0000692 case ValID::InlineAsmVal: { // Inline asm expression
693 const PointerType *PTy = dyn_cast<PointerType>(Ty);
694 const FunctionType *FTy =
695 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000696 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000697 GenerateError("Invalid type for asm constraint string!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000698 return 0;
699 }
Chris Lattner0e9c3762006-01-25 22:27:16 +0000700 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
701 D.IAD->HasSideEffects);
702 D.destroy(); // Free InlineAsmDescriptor.
703 return IA;
704 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000705 default:
706 assert(0 && "Unhandled case!");
707 return 0;
708 } // End of switch
709
710 assert(0 && "Unhandled case!");
711 return 0;
712}
713
714// getVal - This function is identical to getValNonImprovising, except that if a
715// value is not already defined, it "improvises" by creating a placeholder var
716// that looks and acts just like the requested variable. When the value is
717// defined later, all uses of the placeholder variable are replaced with the
718// real thing.
719//
720static Value *getVal(const Type *Ty, const ValID &ID) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000721 if (Ty == Type::LabelTy) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000722 GenerateError("Cannot use a basic block here");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000723 return 0;
724 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000725
726 // See if the value has already been defined.
727 Value *V = getValNonImprovising(Ty, ID);
728 if (V) return V;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000729 if (TriggerError) return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000730
Reid Spencer5b7e7532006-09-28 19:28:24 +0000731 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000732 GenerateError("Invalid use of a composite type!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000733 return 0;
734 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000735
736 // If we reached here, we referenced either a symbol that we don't know about
737 // or an id number that hasn't been read yet. We may be referencing something
738 // forward, so just create an entry to be resolved later and get to it...
739 //
740 V = new Argument(Ty);
741
742 // Remember where this forward reference came from. FIXME, shouldn't we try
743 // to recycle these things??
744 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
745 llvmAsmlineno)));
746
747 if (inFunctionScope())
748 InsertValue(V, CurFun.LateResolveValues);
749 else
750 InsertValue(V, CurModule.LateResolveValues);
751 return V;
752}
753
754/// getBBVal - This is used for two purposes:
755/// * If isDefinition is true, a new basic block with the specified ID is being
756/// defined.
757/// * If isDefinition is true, this is a reference to a basic block, which may
758/// or may not be a forward reference.
759///
760static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
761 assert(inFunctionScope() && "Can't get basic block at global scope!");
762
763 std::string Name;
764 BasicBlock *BB = 0;
765 switch (ID.Type) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000766 default:
767 GenerateError("Illegal label reference " + ID.getName());
768 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000769 case ValID::NumberVal: // Is it a numbered definition?
770 if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size())
771 CurFun.NumberedBlocks.resize(ID.Num+1);
772 BB = CurFun.NumberedBlocks[ID.Num];
773 break;
774 case ValID::NameVal: // Is it a named definition?
775 Name = ID.Name;
776 if (Value *N = CurFun.CurrentFunction->
777 getSymbolTable().lookup(Type::LabelTy, Name))
778 BB = cast<BasicBlock>(N);
779 break;
780 }
781
782 // See if the block has already been defined.
783 if (BB) {
784 // If this is the definition of the block, make sure the existing value was
785 // just a forward reference. If it was a forward reference, there will be
786 // an entry for it in the PlaceHolderInfo map.
Reid Spencer5b7e7532006-09-28 19:28:24 +0000787 if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000788 // The existing value was a definition, not a forward reference.
Reid Spencer61c83e02006-08-18 08:43:06 +0000789 GenerateError("Redefinition of label " + ID.getName());
Reid Spencer5b7e7532006-09-28 19:28:24 +0000790 return 0;
791 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000792
793 ID.destroy(); // Free strdup'd memory.
794 return BB;
795 }
796
797 // Otherwise this block has not been seen before.
798 BB = new BasicBlock("", CurFun.CurrentFunction);
799 if (ID.Type == ValID::NameVal) {
800 BB->setName(ID.Name);
801 } else {
802 CurFun.NumberedBlocks[ID.Num] = BB;
803 }
804
805 // If this is not a definition, keep track of it so we can use it as a forward
806 // reference.
807 if (!isDefinition) {
808 // Remember where this forward reference came from.
809 CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno);
810 } else {
811 // The forward declaration could have been inserted anywhere in the
812 // function: insert it into the correct place now.
813 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
814 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
815 }
816 ID.destroy();
817 return BB;
818}
819
820
821//===----------------------------------------------------------------------===//
822// Code to handle forward references in instructions
823//===----------------------------------------------------------------------===//
824//
825// This code handles the late binding needed with statements that reference
826// values not defined yet... for example, a forward branch, or the PHI node for
827// a loop body.
828//
829// This keeps a table (CurFun.LateResolveValues) of all such forward references
830// and back patchs after we are done.
831//
832
833// ResolveDefinitions - If we could not resolve some defs at parsing
834// time (forward branches, phi functions for loops, etc...) resolve the
835// defs now...
836//
837static void
838ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
839 std::map<const Type*,ValueList> *FutureLateResolvers) {
840 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
841 for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(),
842 E = LateResolvers.end(); LRI != E; ++LRI) {
843 ValueList &List = LRI->second;
844 while (!List.empty()) {
845 Value *V = List.back();
846 List.pop_back();
847
848 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
849 CurModule.PlaceHolderInfo.find(V);
850 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
851
852 ValID &DID = PHI->second.first;
853
854 Value *TheRealValue = getValNonImprovising(LRI->first, DID);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000855 if (TriggerError)
856 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000857 if (TheRealValue) {
858 V->replaceAllUsesWith(TheRealValue);
859 delete V;
860 CurModule.PlaceHolderInfo.erase(PHI);
861 } else if (FutureLateResolvers) {
862 // Functions have their unresolved items forwarded to the module late
863 // resolver table
864 InsertValue(V, *FutureLateResolvers);
865 } else {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000866 if (DID.Type == ValID::NameVal) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000867 GenerateError("Reference to an invalid definition: '" +DID.getName()+
Reid Spencer68a24bd2005-08-27 18:50:39 +0000868 "' of type '" + V->getType()->getDescription() + "'",
869 PHI->second.second);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000870 return;
871 } else {
Reid Spencer61c83e02006-08-18 08:43:06 +0000872 GenerateError("Reference to an invalid definition: #" +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000873 itostr(DID.Num) + " of type '" +
874 V->getType()->getDescription() + "'",
875 PHI->second.second);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000876 return;
877 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000878 }
879 }
880 }
881
882 LateResolvers.clear();
883}
884
885// ResolveTypeTo - A brand new type was just declared. This means that (if
886// name is not null) things referencing Name can be resolved. Otherwise, things
887// refering to the number can be resolved. Do this now.
888//
889static void ResolveTypeTo(char *Name, const Type *ToTy) {
890 ValID D;
891 if (Name) D = ValID::create(Name);
892 else D = ValID::create((int)CurModule.Types.size());
893
Reid Spencer861d9d62006-11-28 07:29:44 +0000894 std::map<ValID, PATypeHolder>::iterator I =
Reid Spencer68a24bd2005-08-27 18:50:39 +0000895 CurModule.LateResolveTypes.find(D);
896 if (I != CurModule.LateResolveTypes.end()) {
Reid Spencer861d9d62006-11-28 07:29:44 +0000897 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000898 CurModule.LateResolveTypes.erase(I);
899 }
900}
901
902// setValueName - Set the specified value to the name given. The name may be
903// null potentially, in which case this is a noop. The string passed in is
904// assumed to be a malloc'd string buffer, and is free'd by this function.
905//
906static void setValueName(Value *V, char *NameStr) {
907 if (NameStr) {
908 std::string Name(NameStr); // Copy string
909 free(NameStr); // Free old string
910
Reid Spencer5b7e7532006-09-28 19:28:24 +0000911 if (V->getType() == Type::VoidTy) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000912 GenerateError("Can't assign name '" + Name+"' to value with void type!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000913 return;
914 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000915
916 assert(inFunctionScope() && "Must be in function scope!");
917 SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable();
Reid Spencer5b7e7532006-09-28 19:28:24 +0000918 if (ST.lookup(V->getType(), Name)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000919 GenerateError("Redefinition of value named '" + Name + "' in the '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000920 V->getType()->getDescription() + "' type plane!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000921 return;
922 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000923
924 // Set the name.
925 V->setName(Name);
926 }
927}
928
929/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
930/// this is a declaration, otherwise it is a definition.
Chris Lattnerb475c422005-11-12 18:22:38 +0000931static GlobalVariable *
932ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage,
933 bool isConstantGlobal, const Type *Ty,
934 Constant *Initializer) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000935 if (isa<FunctionType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000936 GenerateError("Cannot declare global vars of function type!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000937 return 0;
938 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000939
940 const PointerType *PTy = PointerType::get(Ty);
941
942 std::string Name;
943 if (NameStr) {
944 Name = NameStr; // Copy string
945 free(NameStr); // Free old string
946 }
947
948 // See if this global value was forward referenced. If so, recycle the
949 // object.
950 ValID ID;
951 if (!Name.empty()) {
952 ID = ValID::create((char*)Name.c_str());
953 } else {
954 ID = ValID::create((int)CurModule.Values[PTy].size());
955 }
956
957 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
958 // Move the global to the end of the list, from whereever it was
959 // previously inserted.
960 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
961 CurModule.CurrentModule->getGlobalList().remove(GV);
962 CurModule.CurrentModule->getGlobalList().push_back(GV);
963 GV->setInitializer(Initializer);
964 GV->setLinkage(Linkage);
965 GV->setConstant(isConstantGlobal);
966 InsertValue(GV, CurModule.Values);
Chris Lattnerb475c422005-11-12 18:22:38 +0000967 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000968 }
969
970 // If this global has a name, check to see if there is already a definition
971 // of this global in the module. If so, merge as appropriate. Note that
972 // this is really just a hack around problems in the CFE. :(
973 if (!Name.empty()) {
974 // We are a simple redefinition of a value, check to see if it is defined
975 // the same as the old one.
976 if (GlobalVariable *EGV =
977 CurModule.CurrentModule->getGlobalVariable(Name, Ty)) {
978 // We are allowed to redefine a global variable in two circumstances:
979 // 1. If at least one of the globals is uninitialized or
980 // 2. If both initializers have the same value.
981 //
982 if (!EGV->hasInitializer() || !Initializer ||
983 EGV->getInitializer() == Initializer) {
984
985 // Make sure the existing global version gets the initializer! Make
986 // sure that it also gets marked const if the new version is.
987 if (Initializer && !EGV->hasInitializer())
988 EGV->setInitializer(Initializer);
989 if (isConstantGlobal)
990 EGV->setConstant(true);
991 EGV->setLinkage(Linkage);
Chris Lattnerb475c422005-11-12 18:22:38 +0000992 return EGV;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000993 }
994
Reid Spencer61c83e02006-08-18 08:43:06 +0000995 GenerateError("Redefinition of global variable named '" + Name +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000996 "' in the '" + Ty->getDescription() + "' type plane!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000997 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000998 }
999 }
1000
1001 // Otherwise there is no existing GV to use, create one now.
1002 GlobalVariable *GV =
1003 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1004 CurModule.CurrentModule);
1005 InsertValue(GV, CurModule.Values);
Chris Lattnerb475c422005-11-12 18:22:38 +00001006 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001007}
1008
1009// setTypeName - Set the specified type to the name given. The name may be
1010// null potentially, in which case this is a noop. The string passed in is
1011// assumed to be a malloc'd string buffer, and is freed by this function.
1012//
1013// This function returns true if the type has already been defined, but is
1014// allowed to be redefined in the specified context. If the name is a new name
1015// for the type plane, it is inserted and false is returned.
1016static bool setTypeName(const Type *T, char *NameStr) {
1017 assert(!inFunctionScope() && "Can't give types function-local names!");
1018 if (NameStr == 0) return false;
1019
1020 std::string Name(NameStr); // Copy string
1021 free(NameStr); // Free old string
1022
1023 // We don't allow assigning names to void type
Reid Spencer5b7e7532006-09-28 19:28:24 +00001024 if (T == Type::VoidTy) {
Reid Spencer61c83e02006-08-18 08:43:06 +00001025 GenerateError("Can't assign name '" + Name + "' to the void type!");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001026 return false;
1027 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001028
1029 // Set the type name, checking for conflicts as we do so.
1030 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1031
1032 if (AlreadyExists) { // Inserting a name that is already defined???
1033 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1034 assert(Existing && "Conflict but no matching type?");
1035
1036 // There is only one case where this is allowed: when we are refining an
1037 // opaque type. In this case, Existing will be an opaque type.
1038 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1039 // We ARE replacing an opaque type!
1040 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1041 return true;
1042 }
1043
1044 // Otherwise, this is an attempt to redefine a type. That's okay if
1045 // the redefinition is identical to the original. This will be so if
1046 // Existing and T point to the same Type object. In this one case we
1047 // allow the equivalent redefinition.
1048 if (Existing == T) return true; // Yes, it's equal.
1049
1050 // Any other kind of (non-equivalent) redefinition is an error.
Reid Spencer61c83e02006-08-18 08:43:06 +00001051 GenerateError("Redefinition of type named '" + Name + "' in the '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +00001052 T->getDescription() + "' type plane!");
1053 }
1054
1055 return false;
1056}
1057
1058//===----------------------------------------------------------------------===//
1059// Code for handling upreferences in type names...
1060//
1061
1062// TypeContains - Returns true if Ty directly contains E in it.
1063//
1064static bool TypeContains(const Type *Ty, const Type *E) {
1065 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1066 E) != Ty->subtype_end();
1067}
1068
1069namespace {
1070 struct UpRefRecord {
1071 // NestingLevel - The number of nesting levels that need to be popped before
1072 // this type is resolved.
1073 unsigned NestingLevel;
1074
1075 // LastContainedTy - This is the type at the current binding level for the
1076 // type. Every time we reduce the nesting level, this gets updated.
1077 const Type *LastContainedTy;
1078
1079 // UpRefTy - This is the actual opaque type that the upreference is
1080 // represented with.
1081 OpaqueType *UpRefTy;
1082
1083 UpRefRecord(unsigned NL, OpaqueType *URTy)
1084 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1085 };
1086}
1087
1088// UpRefs - A list of the outstanding upreferences that need to be resolved.
1089static std::vector<UpRefRecord> UpRefs;
1090
1091/// HandleUpRefs - Every time we finish a new layer of types, this function is
1092/// called. It loops through the UpRefs vector, which is a list of the
1093/// currently active types. For each type, if the up reference is contained in
1094/// the newly completed type, we decrement the level count. When the level
1095/// count reaches zero, the upreferenced type is the type that is passed in:
1096/// thus we can complete the cycle.
1097///
1098static PATypeHolder HandleUpRefs(const Type *ty) {
Chris Lattner224f84f2006-08-18 17:34:45 +00001099 // If Ty isn't abstract, or if there are no up-references in it, then there is
1100 // nothing to resolve here.
1101 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1102
Reid Spencer68a24bd2005-08-27 18:50:39 +00001103 PATypeHolder Ty(ty);
1104 UR_OUT("Type '" << Ty->getDescription() <<
1105 "' newly formed. Resolving upreferences.\n" <<
1106 UpRefs.size() << " upreferences active!\n");
1107
1108 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1109 // to zero), we resolve them all together before we resolve them to Ty. At
1110 // the end of the loop, if there is anything to resolve to Ty, it will be in
1111 // this variable.
1112 OpaqueType *TypeToResolve = 0;
1113
1114 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1115 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1116 << UpRefs[i].second->getDescription() << ") = "
1117 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1118 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1119 // Decrement level of upreference
1120 unsigned Level = --UpRefs[i].NestingLevel;
1121 UpRefs[i].LastContainedTy = Ty;
1122 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1123 if (Level == 0) { // Upreference should be resolved!
1124 if (!TypeToResolve) {
1125 TypeToResolve = UpRefs[i].UpRefTy;
1126 } else {
1127 UR_OUT(" * Resolving upreference for "
1128 << UpRefs[i].second->getDescription() << "\n";
1129 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1130 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1131 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1132 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1133 }
1134 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1135 --i; // Do not skip the next element...
1136 }
1137 }
1138 }
1139
1140 if (TypeToResolve) {
1141 UR_OUT(" * Resolving upreference for "
1142 << UpRefs[i].second->getDescription() << "\n";
1143 std::string OldName = TypeToResolve->getDescription());
1144 TypeToResolve->refineAbstractTypeTo(Ty);
1145 }
1146
1147 return Ty;
1148}
1149
Reid Spencer68a24bd2005-08-27 18:50:39 +00001150// common code from the two 'RunVMAsmParser' functions
Reid Spencer5b7e7532006-09-28 19:28:24 +00001151static Module* RunParser(Module * M) {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001152
1153 llvmAsmlineno = 1; // Reset the current line number...
Reid Spencer68a24bd2005-08-27 18:50:39 +00001154 CurModule.CurrentModule = M;
Reid Spencerf63697d2006-10-09 17:36:59 +00001155
1156 // Check to make sure the parser succeeded
1157 if (yyparse()) {
1158 if (ParserResult)
1159 delete ParserResult;
1160 return 0;
1161 }
1162
1163 // Check to make sure that parsing produced a result
Reid Spencer61c83e02006-08-18 08:43:06 +00001164 if (!ParserResult)
1165 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001166
Reid Spencerf63697d2006-10-09 17:36:59 +00001167 // Reset ParserResult variable while saving its value for the result.
Reid Spencer68a24bd2005-08-27 18:50:39 +00001168 Module *Result = ParserResult;
1169 ParserResult = 0;
1170
Reid Spencer68a24bd2005-08-27 18:50:39 +00001171 return Result;
Reid Spencer5b7e7532006-09-28 19:28:24 +00001172}
Reid Spencer68a24bd2005-08-27 18:50:39 +00001173
1174//===----------------------------------------------------------------------===//
1175// RunVMAsmParser - Define an interface to this parser
1176//===----------------------------------------------------------------------===//
1177//
1178Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1179 set_scan_file(F);
1180
1181 CurFilename = Filename;
1182 return RunParser(new Module(CurFilename));
1183}
1184
1185Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1186 set_scan_string(AsmString);
1187
1188 CurFilename = "from_memory";
1189 if (M == NULL) {
1190 return RunParser(new Module (CurFilename));
1191 } else {
1192 return RunParser(M);
1193 }
1194}
1195
1196
Reid Spencer3822ff52006-11-08 06:47:33 +00001197
1198/* Enabling traces. */
1199#ifndef YYDEBUG
1200# define YYDEBUG 0
1201#endif
1202
1203/* Enabling verbose error messages. */
1204#ifdef YYERROR_VERBOSE
1205# undef YYERROR_VERBOSE
1206# define YYERROR_VERBOSE 1
1207#else
1208# define YYERROR_VERBOSE 0
1209#endif
1210
Andrew Lenharth6353e052006-12-08 18:07:09 +00001211#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1212#line 855 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
1213typedef union YYSTYPE {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001214 llvm::Module *ModuleVal;
1215 llvm::Function *FunctionVal;
Reid Spencera132e042006-12-03 05:46:11 +00001216 std::pair<llvm::PATypeHolder*, char*> *ArgVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001217 llvm::BasicBlock *BasicBlockVal;
1218 llvm::TerminatorInst *TermInstVal;
1219 llvm::Instruction *InstVal;
Reid Spencera132e042006-12-03 05:46:11 +00001220 llvm::Constant *ConstVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001221
Reid Spencera132e042006-12-03 05:46:11 +00001222 const llvm::Type *PrimType;
1223 llvm::PATypeHolder *TypeVal;
1224 llvm::Value *ValueVal;
1225
1226 std::vector<std::pair<llvm::PATypeHolder*,char*> > *ArgList;
1227 std::vector<llvm::Value*> *ValueList;
1228 std::list<llvm::PATypeHolder> *TypeList;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001229 // Represent the RHS of PHI node
Reid Spencera132e042006-12-03 05:46:11 +00001230 std::list<std::pair<llvm::Value*,
1231 llvm::BasicBlock*> > *PHIList;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001232 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
Reid Spencera132e042006-12-03 05:46:11 +00001233 std::vector<llvm::Constant*> *ConstVector;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001234
1235 llvm::GlobalValue::LinkageTypes Linkage;
1236 int64_t SInt64Val;
1237 uint64_t UInt64Val;
1238 int SIntVal;
1239 unsigned UIntVal;
1240 double FPVal;
1241 bool BoolVal;
1242
1243 char *StrVal; // This memory is strdup'd!
Reid Spencer1628cec2006-10-26 06:15:43 +00001244 llvm::ValID ValIDVal; // strdup'd memory maybe!
Reid Spencer68a24bd2005-08-27 18:50:39 +00001245
Reid Spencera132e042006-12-03 05:46:11 +00001246 llvm::Instruction::BinaryOps BinaryOpVal;
1247 llvm::Instruction::TermOps TermOpVal;
1248 llvm::Instruction::MemoryOps MemOpVal;
1249 llvm::Instruction::CastOps CastOpVal;
1250 llvm::Instruction::OtherOps OtherOpVal;
Reid Spencer1628cec2006-10-26 06:15:43 +00001251 llvm::Module::Endianness Endianness;
Reid Spencera132e042006-12-03 05:46:11 +00001252 llvm::ICmpInst::Predicate IPredicate;
1253 llvm::FCmpInst::Predicate FPredicate;
Andrew Lenharth6353e052006-12-08 18:07:09 +00001254} YYSTYPE;
1255/* Line 191 of yacc.c. */
1256#line 1257 "llvmAsmParser.tab.c"
Reid Spencer3822ff52006-11-08 06:47:33 +00001257# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1258# define YYSTYPE_IS_DECLARED 1
1259# define YYSTYPE_IS_TRIVIAL 1
Reid Spencer68a24bd2005-08-27 18:50:39 +00001260#endif
1261
1262
1263
Reid Spencer3822ff52006-11-08 06:47:33 +00001264/* Copy the second part of user declarations. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001265
1266
Andrew Lenharth6353e052006-12-08 18:07:09 +00001267/* Line 214 of yacc.c. */
1268#line 1269 "llvmAsmParser.tab.c"
Reid Spencer68a24bd2005-08-27 18:50:39 +00001269
Andrew Lenharth6353e052006-12-08 18:07:09 +00001270#if ! defined (yyoverflow) || YYERROR_VERBOSE
Bill Wendlinge8156192006-12-07 01:30:32 +00001271
Andrew Lenharth6353e052006-12-08 18:07:09 +00001272# ifndef YYFREE
1273# define YYFREE free
Bill Wendlinge8156192006-12-07 01:30:32 +00001274# endif
Andrew Lenharth6353e052006-12-08 18:07:09 +00001275# ifndef YYMALLOC
1276# define YYMALLOC malloc
Reid Spencer3822ff52006-11-08 06:47:33 +00001277# endif
Reid Spencer3822ff52006-11-08 06:47:33 +00001278
1279/* The parser invokes alloca or malloc; define the necessary symbols. */
1280
1281# ifdef YYSTACK_USE_ALLOCA
1282# if YYSTACK_USE_ALLOCA
Andrew Lenharth6353e052006-12-08 18:07:09 +00001283# define YYSTACK_ALLOC alloca
1284# endif
1285# else
1286# if defined (alloca) || defined (_ALLOCA_H)
1287# define YYSTACK_ALLOC alloca
1288# else
Reid Spencer3822ff52006-11-08 06:47:33 +00001289# ifdef __GNUC__
1290# define YYSTACK_ALLOC __builtin_alloca
Reid Spencer3822ff52006-11-08 06:47:33 +00001291# endif
1292# endif
1293# endif
1294
1295# ifdef YYSTACK_ALLOC
Andrew Lenharth6353e052006-12-08 18:07:09 +00001296 /* Pacify GCC's `empty if-body' warning. */
1297# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
Reid Spencer3822ff52006-11-08 06:47:33 +00001298# else
Andrew Lenharth6353e052006-12-08 18:07:09 +00001299# if defined (__STDC__) || defined (__cplusplus)
1300# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1301# define YYSIZE_T size_t
1302# endif
Reid Spencer3822ff52006-11-08 06:47:33 +00001303# define YYSTACK_ALLOC YYMALLOC
1304# define YYSTACK_FREE YYFREE
Reid Spencer3822ff52006-11-08 06:47:33 +00001305# endif
Andrew Lenharth6353e052006-12-08 18:07:09 +00001306#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
Reid Spencer3822ff52006-11-08 06:47:33 +00001307
1308
Andrew Lenharth6353e052006-12-08 18:07:09 +00001309#if (! defined (yyoverflow) \
1310 && (! defined (__cplusplus) \
1311 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
Reid Spencer3822ff52006-11-08 06:47:33 +00001312
1313/* A type that is properly aligned for any stack member. */
1314union yyalloc
1315{
Andrew Lenharth6353e052006-12-08 18:07:09 +00001316 short yyss;
Reid Spencer3822ff52006-11-08 06:47:33 +00001317 YYSTYPE yyvs;
1318 };
1319
1320/* The size of the maximum gap between one aligned stack and the next. */
1321# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1322
1323/* The size of an array large to enough to hold all stacks, each with
1324 N elements. */
1325# define YYSTACK_BYTES(N) \
Andrew Lenharth6353e052006-12-08 18:07:09 +00001326 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
Reid Spencer3822ff52006-11-08 06:47:33 +00001327 + YYSTACK_GAP_MAXIMUM)
1328
1329/* Copy COUNT objects from FROM to TO. The source and destination do
1330 not overlap. */
1331# ifndef YYCOPY
Andrew Lenharth6353e052006-12-08 18:07:09 +00001332# if defined (__GNUC__) && 1 < __GNUC__
Reid Spencer3822ff52006-11-08 06:47:33 +00001333# define YYCOPY(To, From, Count) \
1334 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1335# else
1336# define YYCOPY(To, From, Count) \
1337 do \
1338 { \
Andrew Lenharth6353e052006-12-08 18:07:09 +00001339 register YYSIZE_T yyi; \
Reid Spencer3822ff52006-11-08 06:47:33 +00001340 for (yyi = 0; yyi < (Count); yyi++) \
1341 (To)[yyi] = (From)[yyi]; \
1342 } \
Andrew Lenharth6353e052006-12-08 18:07:09 +00001343 while (0)
Reid Spencer3822ff52006-11-08 06:47:33 +00001344# endif
1345# endif
1346
1347/* Relocate STACK from its old location to the new one. The
1348 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1349 elements in the stack, and YYPTR gives the new location of the
1350 stack. Advance YYPTR to a properly aligned location for the next
1351 stack. */
1352# define YYSTACK_RELOCATE(Stack) \
1353 do \
1354 { \
1355 YYSIZE_T yynewbytes; \
1356 YYCOPY (&yyptr->Stack, Stack, yysize); \
1357 Stack = &yyptr->Stack; \
1358 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1359 yyptr += yynewbytes / sizeof (*yyptr); \
1360 } \
Andrew Lenharth6353e052006-12-08 18:07:09 +00001361 while (0)
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +00001362
1363#endif
1364
Andrew Lenharth6353e052006-12-08 18:07:09 +00001365#if defined (__STDC__) || defined (__cplusplus)
1366 typedef signed char yysigned_char;
1367#else
1368 typedef short yysigned_char;
1369#endif
1370
1371/* YYFINAL -- State number of the termination state. */
Reid Spencer3822ff52006-11-08 06:47:33 +00001372#define YYFINAL 4
1373/* YYLAST -- Last index in YYTABLE. */
Andrew Lenharth6353e052006-12-08 18:07:09 +00001374#define YYLAST 1476
Reid Spencer3822ff52006-11-08 06:47:33 +00001375
Andrew Lenharth6353e052006-12-08 18:07:09 +00001376/* YYNTOKENS -- Number of terminals. */
Reid Spencercd42c582006-12-05 23:29:42 +00001377#define YYNTOKENS 159
Andrew Lenharth6353e052006-12-08 18:07:09 +00001378/* YYNNTS -- Number of nonterminals. */
Reid Spencera132e042006-12-03 05:46:11 +00001379#define YYNNTS 78
Andrew Lenharth6353e052006-12-08 18:07:09 +00001380/* YYNRULES -- Number of rules. */
1381#define YYNRULES 299
1382/* YYNRULES -- Number of states. */
1383#define YYNSTATES 584
Reid Spencer3822ff52006-11-08 06:47:33 +00001384
1385/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1386#define YYUNDEFTOK 2
Reid Spencercd42c582006-12-05 23:29:42 +00001387#define YYMAXUTOK 399
Reid Spencer3822ff52006-11-08 06:47:33 +00001388
Andrew Lenharth6353e052006-12-08 18:07:09 +00001389#define YYTRANSLATE(YYX) \
Reid Spencer3822ff52006-11-08 06:47:33 +00001390 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1391
1392/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
Andrew Lenharth6353e052006-12-08 18:07:09 +00001393static const unsigned char yytranslate[] =
Reid Spencer3822ff52006-11-08 06:47:33 +00001394{
1395 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1396 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1397 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1398 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Reid Spencercd42c582006-12-05 23:29:42 +00001399 148, 149, 157, 2, 146, 2, 2, 2, 2, 2,
Reid Spencer3822ff52006-11-08 06:47:33 +00001400 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Reid Spencercd42c582006-12-05 23:29:42 +00001401 153, 145, 154, 2, 2, 2, 2, 2, 2, 2,
Reid Spencer3822ff52006-11-08 06:47:33 +00001402 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1403 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Reid Spencercd42c582006-12-05 23:29:42 +00001404 2, 150, 147, 152, 2, 2, 2, 2, 2, 158,
Reid Spencer3822ff52006-11-08 06:47:33 +00001405 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1406 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Reid Spencercd42c582006-12-05 23:29:42 +00001407 151, 2, 2, 155, 2, 156, 2, 2, 2, 2,
Reid Spencer3822ff52006-11-08 06:47:33 +00001408 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1409 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1410 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1411 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1412 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1413 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1414 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1415 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1416 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1417 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1418 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1419 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1420 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1421 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1422 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1423 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1424 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1425 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1426 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1427 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1428 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1429 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1430 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
Reid Spencer3da59db2006-11-27 01:05:10 +00001431 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
Reid Spencera132e042006-12-03 05:46:11 +00001432 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1433 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
Reid Spencercd42c582006-12-05 23:29:42 +00001434 135, 136, 137, 138, 139, 140, 141, 142, 143, 144
Reid Spencer3822ff52006-11-08 06:47:33 +00001435};
1436
1437#if YYDEBUG
1438/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1439 YYRHS. */
Andrew Lenharth6353e052006-12-08 18:07:09 +00001440static const unsigned short yyprhs[] =
Reid Spencer3822ff52006-11-08 06:47:33 +00001441{
1442 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1443 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1444 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1445 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
Reid Spencer3da59db2006-11-27 01:05:10 +00001446 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
Reid Spencera132e042006-12-03 05:46:11 +00001447 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
1448 119, 121, 123, 125, 127, 129, 131, 133, 135, 137,
Reid Spencer6e18b7d2006-12-03 06:59:29 +00001449 139, 141, 143, 145, 147, 149, 151, 153, 156, 157,
1450 159, 161, 163, 165, 167, 169, 171, 172, 173, 175,
1451 177, 179, 181, 183, 185, 188, 189, 192, 193, 197,
1452 200, 201, 203, 204, 208, 210, 213, 215, 217, 219,
Reid Spencera132e042006-12-03 05:46:11 +00001453 221, 223, 225, 227, 229, 231, 233, 235, 237, 239,
Reid Spencer6e18b7d2006-12-03 06:59:29 +00001454 241, 243, 245, 247, 249, 251, 253, 255, 258, 263,
Andrew Lenharth6353e052006-12-08 18:07:09 +00001455 269, 275, 279, 282, 288, 293, 296, 298, 302, 304,
1456 308, 310, 311, 316, 320, 324, 329, 334, 338, 341,
1457 344, 347, 350, 353, 356, 359, 362, 365, 368, 375,
1458 381, 390, 397, 404, 411, 419, 427, 434, 441, 450,
1459 459, 463, 465, 467, 469, 471, 474, 477, 482, 485,
1460 487, 492, 495, 500, 501, 509, 510, 518, 519, 527,
1461 528, 536, 540, 545, 546, 548, 550, 552, 556, 560,
1462 564, 568, 572, 576, 578, 579, 581, 583, 585, 586,
1463 589, 593, 595, 597, 601, 603, 604, 613, 615, 617,
1464 621, 623, 625, 628, 629, 631, 633, 634, 639, 640,
1465 642, 644, 646, 648, 650, 652, 654, 656, 658, 662,
1466 664, 670, 672, 674, 676, 678, 681, 684, 687, 691,
1467 694, 695, 697, 700, 703, 707, 717, 727, 736, 750,
1468 752, 754, 761, 767, 770, 777, 785, 787, 791, 793,
1469 794, 797, 799, 805, 811, 817, 824, 831, 834, 839,
1470 844, 851, 856, 861, 868, 875, 878, 886, 888, 891,
1471 892, 894, 895, 899, 906, 910, 917, 920, 925, 932
Reid Spencer3822ff52006-11-08 06:47:33 +00001472};
1473
Andrew Lenharth6353e052006-12-08 18:07:09 +00001474/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1475static const short yyrhs[] =
Reid Spencer3822ff52006-11-08 06:47:33 +00001476{
Reid Spencercd42c582006-12-05 23:29:42 +00001477 193, 0, -1, 5, -1, 6, -1, 3, -1, 4,
Reid Spencer3822ff52006-11-08 06:47:33 +00001478 -1, 78, -1, 79, -1, 80, -1, 81, -1, 82,
1479 -1, 83, -1, 84, -1, 85, -1, 86, -1, 87,
1480 -1, 88, -1, 89, -1, 90, -1, 91, -1, 92,
Reid Spencer6e18b7d2006-12-03 06:59:29 +00001481 -1, 93, -1, 94, -1, 95, -1, 124, -1, 125,
1482 -1, 126, -1, 127, -1, 128, -1, 129, -1, 130,
1483 -1, 131, -1, 132, -1, 133, -1, 134, -1, 135,
1484 -1, 138, -1, 139, -1, 140, -1, 98, -1, 99,
Reid Spencera132e042006-12-03 05:46:11 +00001485 -1, 100, -1, 101, -1, 102, -1, 103, -1, 104,
1486 -1, 105, -1, 106, -1, 107, -1, 108, -1, 109,
1487 -1, 110, -1, 111, -1, 112, -1, 113, -1, 114,
Reid Spencer6e18b7d2006-12-03 06:59:29 +00001488 -1, 115, -1, 116, -1, 117, -1, 104, -1, 105,
1489 -1, 106, -1, 107, -1, 27, -1, 28, -1, 16,
1490 -1, 14, -1, 12, -1, 10, -1, 17, -1, 15,
Reid Spencercd42c582006-12-05 23:29:42 +00001491 -1, 13, -1, 11, -1, 169, -1, 170, -1, 18,
1492 -1, 19, -1, 205, 145, -1, -1, 41, -1, 42,
Reid Spencer6e18b7d2006-12-03 06:59:29 +00001493 -1, 43, -1, 44, -1, 45, -1, 46, -1, 47,
1494 -1, -1, -1, 65, -1, 66, -1, 67, -1, 68,
1495 -1, 69, -1, 70, -1, 64, 4, -1, -1, 57,
Reid Spencercd42c582006-12-05 23:29:42 +00001496 4, -1, -1, 146, 57, 4, -1, 34, 24, -1,
1497 -1, 178, -1, -1, 146, 181, 180, -1, 178, -1,
1498 57, 4, -1, 184, -1, 8, -1, 186, -1, 8,
1499 -1, 186, -1, 9, -1, 10, -1, 11, -1, 12,
Reid Spencer6e18b7d2006-12-03 06:59:29 +00001500 -1, 13, -1, 14, -1, 15, -1, 16, -1, 17,
1501 -1, 18, -1, 19, -1, 20, -1, 21, -1, 48,
Reid Spencercd42c582006-12-05 23:29:42 +00001502 -1, 185, -1, 220, -1, 147, 4, -1, 183, 148,
1503 188, 149, -1, 150, 4, 151, 186, 152, -1, 153,
1504 4, 151, 186, 154, -1, 155, 187, 156, -1, 155,
Andrew Lenharth6353e052006-12-08 18:07:09 +00001505 156, -1, 153, 155, 187, 156, 154, -1, 153, 155,
1506 156, 154, -1, 186, 157, -1, 186, -1, 187, 146,
1507 186, -1, 187, -1, 187, 146, 37, -1, 37, -1,
1508 -1, 184, 150, 191, 152, -1, 184, 150, 152, -1,
1509 184, 158, 24, -1, 184, 153, 191, 154, -1, 184,
1510 155, 191, 156, -1, 184, 155, 156, -1, 184, 38,
1511 -1, 184, 39, -1, 184, 220, -1, 184, 190, -1,
1512 184, 26, -1, 169, 161, -1, 170, 4, -1, 9,
1513 27, -1, 9, 28, -1, 172, 7, -1, 165, 148,
1514 189, 36, 184, 149, -1, 123, 148, 189, 234, 149,
1515 -1, 137, 148, 189, 146, 189, 146, 189, 149, -1,
1516 162, 148, 189, 146, 189, 149, -1, 163, 148, 189,
1517 146, 189, 149, -1, 164, 148, 189, 146, 189, 149,
1518 -1, 96, 167, 148, 189, 146, 189, 149, -1, 97,
1519 168, 148, 189, 146, 189, 149, -1, 166, 148, 189,
1520 146, 189, 149, -1, 142, 148, 189, 146, 189, 149,
1521 -1, 143, 148, 189, 146, 189, 146, 189, 149, -1,
1522 144, 148, 189, 146, 189, 146, 189, 149, -1, 191,
1523 146, 189, -1, 189, -1, 32, -1, 33, -1, 194,
1524 -1, 194, 214, -1, 194, 216, -1, 194, 62, 61,
1525 200, -1, 194, 25, -1, 195, -1, 195, 173, 20,
1526 182, -1, 195, 216, -1, 195, 62, 61, 200, -1,
1527 -1, 195, 173, 174, 192, 189, 196, 180, -1, -1,
1528 195, 173, 50, 192, 184, 197, 180, -1, -1, 195,
1529 173, 45, 192, 184, 198, 180, -1, -1, 195, 173,
1530 47, 192, 184, 199, 180, -1, 195, 51, 202, -1,
1531 195, 58, 145, 203, -1, -1, 24, -1, 56, -1,
1532 55, -1, 53, 145, 201, -1, 54, 145, 4, -1,
1533 52, 145, 24, -1, 71, 145, 24, -1, 150, 204,
1534 152, -1, 204, 146, 24, -1, 24, -1, -1, 22,
1535 -1, 24, -1, 205, -1, -1, 184, 206, -1, 208,
1536 146, 207, -1, 207, -1, 208, -1, 208, 146, 37,
1537 -1, 37, -1, -1, 175, 182, 205, 148, 209, 149,
1538 179, 176, -1, 29, -1, 155, -1, 174, 210, 211,
1539 -1, 30, -1, 156, -1, 223, 213, -1, -1, 45,
1540 -1, 47, -1, -1, 31, 217, 215, 210, -1, -1,
1541 63, -1, 3, -1, 4, -1, 7, -1, 27, -1,
1542 28, -1, 38, -1, 39, -1, 26, -1, 153, 191,
1543 154, -1, 190, -1, 61, 218, 24, 146, 24, -1,
1544 160, -1, 205, -1, 220, -1, 219, -1, 184, 221,
1545 -1, 223, 224, -1, 212, 224, -1, 225, 173, 226,
1546 -1, 225, 228, -1, -1, 23, -1, 72, 222, -1,
1547 72, 8, -1, 73, 21, 221, -1, 73, 9, 221,
1548 146, 21, 221, 146, 21, 221, -1, 74, 171, 221,
1549 146, 21, 221, 150, 227, 152, -1, 74, 171, 221,
1550 146, 21, 221, 150, 152, -1, 75, 175, 182, 221,
1551 148, 231, 149, 36, 21, 221, 76, 21, 221, -1,
1552 76, -1, 77, -1, 227, 171, 219, 146, 21, 221,
1553 -1, 171, 219, 146, 21, 221, -1, 173, 233, -1,
1554 184, 150, 221, 146, 221, 152, -1, 229, 146, 150,
1555 221, 146, 221, 152, -1, 222, -1, 230, 146, 222,
1556 -1, 230, -1, -1, 60, 59, -1, 59, -1, 162,
1557 184, 221, 146, 221, -1, 163, 184, 221, 146, 221,
1558 -1, 164, 184, 221, 146, 221, -1, 96, 167, 184,
1559 221, 146, 221, -1, 97, 168, 184, 221, 146, 221,
1560 -1, 49, 222, -1, 166, 222, 146, 222, -1, 165,
1561 222, 36, 184, -1, 137, 222, 146, 222, 146, 222,
1562 -1, 141, 222, 146, 184, -1, 142, 222, 146, 222,
1563 -1, 143, 222, 146, 222, 146, 222, -1, 144, 222,
1564 146, 222, 146, 222, -1, 136, 229, -1, 232, 175,
1565 182, 221, 148, 231, 149, -1, 236, -1, 146, 230,
1566 -1, -1, 35, -1, -1, 118, 184, 177, -1, 118,
1567 184, 146, 15, 221, 177, -1, 119, 184, 177, -1,
1568 119, 184, 146, 15, 221, 177, -1, 120, 222, -1,
1569 235, 121, 184, 221, -1, 235, 122, 222, 146, 184,
1570 221, -1, 123, 184, 221, 234, -1
Reid Spencer3822ff52006-11-08 06:47:33 +00001571};
1572
1573/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
Andrew Lenharth6353e052006-12-08 18:07:09 +00001574static const unsigned short yyrline[] =
Reid Spencer3822ff52006-11-08 06:47:33 +00001575{
Reid Spencerb25389c2006-12-05 23:50:48 +00001576 0, 990, 990, 991, 999, 1000, 1010, 1010, 1010, 1010,
1577 1010, 1010, 1010, 1010, 1010, 1011, 1011, 1011, 1012, 1012,
1578 1012, 1012, 1012, 1012, 1013, 1013, 1013, 1013, 1013, 1013,
1579 1014, 1014, 1014, 1014, 1014, 1014, 1015, 1015, 1015, 1017,
1580 1017, 1018, 1018, 1019, 1019, 1020, 1020, 1021, 1021, 1025,
1581 1025, 1026, 1026, 1027, 1027, 1028, 1028, 1029, 1029, 1030,
1582 1030, 1031, 1031, 1032, 1033, 1038, 1038, 1038, 1038, 1039,
1583 1039, 1039, 1039, 1040, 1040, 1041, 1041, 1044, 1048, 1053,
1584 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1062, 1063, 1064,
1585 1065, 1066, 1067, 1068, 1069, 1078, 1079, 1085, 1086, 1094,
1586 1102, 1103, 1108, 1109, 1110, 1115, 1129, 1129, 1130, 1130,
1587 1132, 1142, 1142, 1142, 1142, 1142, 1142, 1142, 1143, 1143,
1588 1143, 1143, 1143, 1143, 1144, 1148, 1152, 1160, 1168, 1181,
Andrew Lenharth6353e052006-12-08 18:07:09 +00001589 1186, 1198, 1208, 1212, 1222, 1226, 1237, 1242, 1248, 1249,
1590 1253, 1257, 1268, 1294, 1308, 1338, 1364, 1385, 1398, 1408,
1591 1413, 1474, 1481, 1489, 1495, 1501, 1505, 1509, 1517, 1529,
1592 1550, 1558, 1564, 1575, 1581, 1586, 1591, 1600, 1606, 1612,
1593 1621, 1625, 1633, 1633, 1643, 1651, 1656, 1660, 1664, 1668,
1594 1683, 1705, 1708, 1711, 1711, 1719, 1719, 1727, 1727, 1735,
1595 1735, 1744, 1747, 1750, 1754, 1767, 1768, 1770, 1774, 1783,
1596 1787, 1792, 1794, 1799, 1804, 1813, 1813, 1814, 1814, 1816,
1597 1823, 1829, 1836, 1840, 1846, 1851, 1856, 1951, 1951, 1953,
1598 1961, 1961, 1963, 1968, 1969, 1970, 1972, 1972, 1982, 1986,
1599 1991, 1995, 1999, 2003, 2007, 2011, 2015, 2019, 2023, 2048,
1600 2052, 2066, 2070, 2076, 2076, 2082, 2087, 2091, 2100, 2111,
1601 2120, 2132, 2145, 2149, 2153, 2158, 2167, 2186, 2195, 2251,
1602 2255, 2262, 2273, 2286, 2295, 2304, 2314, 2318, 2325, 2325,
1603 2327, 2331, 2336, 2355, 2370, 2384, 2395, 2406, 2419, 2428,
1604 2439, 2447, 2452, 2458, 2464, 2470, 2485, 2544, 2551, 2554,
1605 2559, 2563, 2570, 2575, 2581, 2586, 2592, 2600, 2612, 2627
Reid Spencer3822ff52006-11-08 06:47:33 +00001606};
1607#endif
1608
Andrew Lenharth6353e052006-12-08 18:07:09 +00001609#if YYDEBUG || YYERROR_VERBOSE
1610/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1611 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
Reid Spencer3822ff52006-11-08 06:47:33 +00001612static const char *const yytname[] =
1613{
1614 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL",
1615 "UINTVAL", "FPVAL", "VOID", "BOOL", "SBYTE", "UBYTE", "SHORT", "USHORT",
1616 "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE", "TYPE", "LABEL",
1617 "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION",
1618 "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK",
1619 "DECLARE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO",
1620 "DOTDOTDOT", "NULL_TOK", "UNDEF", "CONST", "INTERNAL", "LINKONCE",
1621 "WEAK", "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1622 "NOT", "EXTERNAL", "TARGET", "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE",
1623 "BIG", "ALIGN", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE",
1624 "SIDEEFFECT", "CC_TOK", "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK",
1625 "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT",
1626 "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB",
1627 "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR",
Reid Spencera132e042006-12-03 05:46:11 +00001628 "XOR", "SETLE", "SETGE", "SETLT", "SETGT", "SETEQ", "SETNE", "ICMP",
1629 "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
Reid Spencer6e18b7d2006-12-03 06:59:29 +00001630 "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
1631 "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
1632 "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
1633 "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
1634 "SELECT", "SHL", "LSHR", "ASHR", "VAARG", "EXTRACTELEMENT",
Reid Spencercd42c582006-12-05 23:29:42 +00001635 "INSERTELEMENT", "SHUFFLEVECTOR", "'='", "','", "'\\\\'", "'('", "')'",
1636 "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'*'", "'c'", "$accept",
1637 "INTVAL", "EINT64VAL", "ArithmeticOps", "LogicalOps", "SetCondOps",
1638 "CastOps", "ShiftOps", "IPredicates", "FPredicates", "SIntType",
1639 "UIntType", "IntType", "FPType", "OptAssign", "OptLinkage",
1640 "OptCallingConv", "OptAlign", "OptCAlign", "SectionString", "OptSection",
1641 "GlobalVarAttributes", "GlobalVarAttribute", "TypesV", "UpRTypesV",
1642 "Types", "PrimType", "UpRTypes", "TypeListI", "ArgTypeListI", "ConstVal",
1643 "ConstExpr", "ConstVector", "GlobalType", "Module", "FunctionList",
1644 "ConstPool", "@1", "@2", "@3", "@4", "AsmBlock", "BigOrLittle",
1645 "TargetDefinition", "LibrariesDefinition", "LibList", "Name", "OptName",
1646 "ArgVal", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN",
1647 "FunctionHeader", "END", "Function", "FnDeclareLinkage", "FunctionProto",
1648 "@5", "OptSideEffect", "ConstValueRef", "SymbolicValueRef", "ValueRef",
1649 "ResolvedVal", "BasicBlockList", "BasicBlock", "InstructionList",
1650 "BBTerminatorInst", "JumpTable", "Inst", "PHIList", "ValueRefList",
1651 "ValueRefListE", "OptTailCall", "InstVal", "IndexList", "OptVolatile",
1652 "MemoryInst", 0
Reid Spencer3822ff52006-11-08 06:47:33 +00001653};
1654#endif
1655
1656# ifdef YYPRINT
1657/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1658 token YYLEX-NUM. */
Andrew Lenharth6353e052006-12-08 18:07:09 +00001659static const unsigned short yytoknum[] =
Reid Spencer3822ff52006-11-08 06:47:33 +00001660{
1661 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1662 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1663 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1664 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1665 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1666 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1667 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1668 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1669 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1670 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1671 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
Reid Spencer3da59db2006-11-27 01:05:10 +00001672 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
Reid Spencera132e042006-12-03 05:46:11 +00001673 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1674 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
Reid Spencercd42c582006-12-05 23:29:42 +00001675 395, 396, 397, 398, 399, 61, 44, 92, 40, 41,
1676 91, 120, 93, 60, 62, 123, 125, 42, 99
Reid Spencer3822ff52006-11-08 06:47:33 +00001677};
1678# endif
1679
1680/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
Andrew Lenharth6353e052006-12-08 18:07:09 +00001681static const unsigned char yyr1[] =
Reid Spencer3822ff52006-11-08 06:47:33 +00001682{
Reid Spencercd42c582006-12-05 23:29:42 +00001683 0, 159, 160, 160, 161, 161, 162, 162, 162, 162,
1684 162, 162, 162, 162, 162, 163, 163, 163, 164, 164,
1685 164, 164, 164, 164, 165, 165, 165, 165, 165, 165,
1686 165, 165, 165, 165, 165, 165, 166, 166, 166, 167,
1687 167, 167, 167, 167, 167, 167, 167, 167, 167, 168,
1688 168, 168, 168, 168, 168, 168, 168, 168, 168, 168,
1689 168, 168, 168, 168, 168, 169, 169, 169, 169, 170,
1690 170, 170, 170, 171, 171, 172, 172, 173, 173, 174,
1691 174, 174, 174, 174, 174, 174, 174, 175, 175, 175,
1692 175, 175, 175, 175, 175, 176, 176, 177, 177, 178,
1693 179, 179, 180, 180, 181, 181, 182, 182, 183, 183,
1694 184, 185, 185, 185, 185, 185, 185, 185, 185, 185,
1695 185, 185, 185, 185, 186, 186, 186, 186, 186, 186,
Andrew Lenharth6353e052006-12-08 18:07:09 +00001696 186, 186, 186, 186, 186, 186, 187, 187, 188, 188,
1697 188, 188, 189, 189, 189, 189, 189, 189, 189, 189,
1698 189, 189, 189, 189, 189, 189, 189, 189, 190, 190,
1699 190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
1700 191, 191, 192, 192, 193, 194, 194, 194, 194, 194,
1701 195, 195, 195, 196, 195, 197, 195, 198, 195, 199,
1702 195, 195, 195, 195, 200, 201, 201, 202, 202, 202,
1703 202, 203, 204, 204, 204, 205, 205, 206, 206, 207,
1704 208, 208, 209, 209, 209, 209, 210, 211, 211, 212,
1705 213, 213, 214, 215, 215, 215, 217, 216, 218, 218,
1706 219, 219, 219, 219, 219, 219, 219, 219, 219, 219,
1707 219, 220, 220, 221, 221, 222, 223, 223, 224, 225,
1708 225, 225, 226, 226, 226, 226, 226, 226, 226, 226,
1709 226, 227, 227, 228, 229, 229, 230, 230, 231, 231,
1710 232, 232, 233, 233, 233, 233, 233, 233, 233, 233,
1711 233, 233, 233, 233, 233, 233, 233, 233, 234, 234,
1712 235, 235, 236, 236, 236, 236, 236, 236, 236, 236
Reid Spencer3822ff52006-11-08 06:47:33 +00001713};
1714
1715/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
Andrew Lenharth6353e052006-12-08 18:07:09 +00001716static const unsigned char yyr2[] =
Reid Spencer3822ff52006-11-08 06:47:33 +00001717{
1718 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1719 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1720 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Reid Spencer3822ff52006-11-08 06:47:33 +00001721 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Reid Spencer3da59db2006-11-27 01:05:10 +00001722 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Reid Spencer3da59db2006-11-27 01:05:10 +00001723 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1724 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Reid Spencer6e18b7d2006-12-03 06:59:29 +00001725 1, 1, 1, 1, 1, 1, 1, 2, 0, 1,
1726 1, 1, 1, 1, 1, 1, 0, 0, 1, 1,
1727 1, 1, 1, 1, 2, 0, 2, 0, 3, 2,
1728 0, 1, 0, 3, 1, 2, 1, 1, 1, 1,
Reid Spencera132e042006-12-03 05:46:11 +00001729 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Reid Spencer6e18b7d2006-12-03 06:59:29 +00001730 1, 1, 1, 1, 1, 1, 1, 2, 4, 5,
Andrew Lenharth6353e052006-12-08 18:07:09 +00001731 5, 3, 2, 5, 4, 2, 1, 3, 1, 3,
1732 1, 0, 4, 3, 3, 4, 4, 3, 2, 2,
1733 2, 2, 2, 2, 2, 2, 2, 2, 6, 5,
1734 8, 6, 6, 6, 7, 7, 6, 6, 8, 8,
1735 3, 1, 1, 1, 1, 2, 2, 4, 2, 1,
1736 4, 2, 4, 0, 7, 0, 7, 0, 7, 0,
1737 7, 3, 4, 0, 1, 1, 1, 3, 3, 3,
1738 3, 3, 3, 1, 0, 1, 1, 1, 0, 2,
1739 3, 1, 1, 3, 1, 0, 8, 1, 1, 3,
1740 1, 1, 2, 0, 1, 1, 0, 4, 0, 1,
1741 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
1742 5, 1, 1, 1, 1, 2, 2, 2, 3, 2,
1743 0, 1, 2, 2, 3, 9, 9, 8, 13, 1,
1744 1, 6, 5, 2, 6, 7, 1, 3, 1, 0,
1745 2, 1, 5, 5, 5, 6, 6, 2, 4, 4,
1746 6, 4, 4, 6, 6, 2, 7, 1, 2, 0,
1747 1, 0, 3, 6, 3, 6, 2, 4, 6, 4
Reid Spencer3822ff52006-11-08 06:47:33 +00001748};
1749
1750/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1751 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1752 means the default is an error. */
Andrew Lenharth6353e052006-12-08 18:07:09 +00001753static const unsigned short yydefact[] =
Reid Spencer3822ff52006-11-08 06:47:33 +00001754{
Andrew Lenharth6353e052006-12-08 18:07:09 +00001755 193, 0, 86, 179, 1, 178, 226, 79, 80, 81,
1756 82, 83, 84, 85, 0, 87, 250, 175, 176, 250,
1757 205, 206, 0, 0, 0, 86, 0, 181, 223, 0,
1758 0, 88, 89, 90, 91, 92, 93, 0, 0, 251,
1759 247, 78, 220, 221, 222, 246, 0, 0, 0, 0,
1760 191, 0, 0, 0, 0, 0, 0, 0, 77, 224,
1761 225, 87, 194, 177, 94, 2, 3, 107, 111, 112,
Reid Spencer6e18b7d2006-12-03 06:59:29 +00001762 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
Andrew Lenharth6353e052006-12-08 18:07:09 +00001763 123, 124, 0, 0, 0, 0, 241, 0, 0, 106,
1764 125, 110, 242, 126, 217, 218, 219, 291, 249, 0,
1765 0, 0, 0, 204, 192, 182, 180, 172, 173, 0,
1766 0, 0, 0, 227, 127, 0, 0, 0, 109, 132,
1767 136, 0, 0, 141, 135, 290, 0, 271, 0, 0,
1768 0, 0, 87, 259, 260, 6, 7, 8, 9, 10,
1769 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1770 21, 22, 23, 0, 0, 0, 0, 0, 0, 24,
1771 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1772 35, 0, 0, 36, 37, 38, 0, 0, 0, 0,
1773 0, 0, 0, 0, 0, 248, 87, 263, 0, 287,
1774 199, 196, 195, 197, 198, 200, 203, 0, 187, 189,
1775 185, 111, 112, 113, 114, 115, 116, 117, 118, 119,
1776 120, 121, 0, 0, 0, 0, 183, 0, 0, 0,
1777 0, 0, 131, 215, 140, 138, 0, 0, 277, 270,
1778 253, 252, 0, 0, 68, 72, 67, 71, 66, 70,
1779 65, 69, 73, 74, 0, 0, 39, 40, 41, 42,
1780 43, 44, 45, 46, 47, 48, 0, 63, 64, 59,
1781 60, 61, 62, 49, 50, 51, 52, 53, 54, 55,
1782 56, 57, 58, 0, 97, 97, 296, 0, 0, 285,
Reid Spencer3822ff52006-11-08 06:47:33 +00001783 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Andrew Lenharth6353e052006-12-08 18:07:09 +00001784 0, 0, 0, 0, 201, 102, 102, 102, 155, 156,
1785 4, 5, 153, 154, 157, 152, 148, 149, 0, 0,
Reid Spencer3822ff52006-11-08 06:47:33 +00001786 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Andrew Lenharth6353e052006-12-08 18:07:09 +00001787 0, 0, 0, 0, 151, 150, 102, 108, 108, 134,
1788 0, 137, 214, 208, 211, 212, 0, 0, 128, 230,
1789 231, 232, 237, 233, 234, 235, 236, 228, 0, 239,
1790 244, 243, 245, 0, 254, 0, 0, 0, 0, 0,
1791 292, 0, 294, 289, 0, 0, 0, 0, 0, 0,
1792 0, 0, 0, 0, 0, 0, 0, 0, 0, 202,
1793 0, 188, 190, 186, 0, 0, 0, 0, 0, 0,
1794 0, 143, 171, 0, 0, 147, 0, 144, 0, 0,
1795 0, 0, 0, 184, 129, 130, 133, 207, 209, 0,
1796 100, 139, 229, 0, 0, 0, 0, 0, 0, 0,
1797 0, 0, 0, 0, 299, 0, 0, 0, 281, 282,
1798 0, 0, 0, 0, 0, 279, 278, 0, 297, 0,
1799 0, 0, 104, 102, 0, 0, 289, 0, 0, 0,
1800 0, 0, 142, 145, 146, 0, 0, 0, 0, 0,
1801 213, 210, 101, 95, 0, 238, 0, 0, 269, 0,
1802 0, 97, 98, 97, 266, 288, 0, 0, 0, 0,
1803 0, 272, 273, 274, 269, 0, 99, 105, 103, 0,
1804 0, 0, 0, 0, 0, 0, 170, 0, 0, 0,
1805 0, 0, 0, 216, 0, 0, 0, 268, 0, 275,
1806 276, 0, 293, 295, 0, 0, 0, 280, 283, 284,
1807 0, 298, 0, 0, 159, 0, 0, 0, 0, 0,
1808 0, 0, 0, 0, 96, 240, 0, 0, 0, 267,
1809 264, 0, 286, 0, 0, 0, 167, 0, 0, 161,
1810 162, 163, 158, 166, 0, 257, 0, 0, 0, 265,
1811 164, 165, 0, 0, 0, 255, 0, 256, 0, 0,
1812 160, 168, 169, 0, 0, 0, 0, 0, 0, 262,
1813 0, 0, 261, 258
Reid Spencer3822ff52006-11-08 06:47:33 +00001814};
1815
Andrew Lenharth6353e052006-12-08 18:07:09 +00001816/* YYDEFGOTO[NTERM-NUM]. */
1817static const short yydefgoto[] =
Reid Spencer3822ff52006-11-08 06:47:33 +00001818{
Andrew Lenharth6353e052006-12-08 18:07:09 +00001819 -1, 86, 302, 319, 320, 321, 322, 323, 256, 273,
1820 212, 213, 244, 214, 25, 15, 37, 503, 360, 442,
1821 463, 381, 443, 87, 88, 215, 90, 91, 121, 226,
1822 392, 349, 393, 109, 1, 2, 3, 326, 297, 295,
1823 296, 63, 193, 50, 104, 197, 92, 408, 334, 335,
1824 336, 38, 96, 16, 44, 17, 61, 18, 28, 413,
1825 350, 93, 352, 474, 19, 40, 41, 185, 557, 98,
1826 279, 507, 508, 186, 187, 424, 188, 189
Reid Spencer3822ff52006-11-08 06:47:33 +00001827};
1828
1829/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1830 STATE-NUM. */
Andrew Lenharth6353e052006-12-08 18:07:09 +00001831#define YYPACT_NINF -529
1832static const short yypact[] =
Reid Spencer3822ff52006-11-08 06:47:33 +00001833{
Andrew Lenharth6353e052006-12-08 18:07:09 +00001834 -529, 21, 408, 495, -529, -529, -529, -529, -529, -529,
1835 -529, -529, -529, -529, -24, 145, 43, -529, -529, -8,
1836 -529, -529, -20, -63, 30, 137, -51, -529, 152, 73,
1837 147, -529, -529, -529, -529, -529, -529, 1211, -3, -529,
1838 -529, 176, -529, -529, -529, -529, -32, 57, 71, 72,
1839 -529, 35, 73, 1211, 46, 46, 46, 46, -529, -529,
1840 -529, 145, -529, -529, -529, -529, -529, 74, -529, -529,
1841 -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,
1842 -529, -529, 217, 219, 4, 90, -529, 176, 77, -529,
1843 -529, -105, -529, -529, -529, -529, -529, 1316, -529, 202,
1844 67, 223, 204, 205, -529, -529, -529, -529, -529, 1231,
1845 1231, 1231, 1276, -529, -529, 82, 83, 637, -529, -529,
1846 -105, -117, 87, 1018, -529, -529, 1231, -529, 179, 1321,
1847 15, 178, 145, -529, -529, -529, -529, -529, -529, -529,
1848 -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,
1849 -529, -529, -529, 195, 378, 1231, 1231, 1231, 1231, -529,
1850 -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,
1851 -529, 1231, 1231, -529, -529, -529, 1231, 1231, 1231, 1231,
1852 1231, 1231, 1231, 1231, 1231, -529, 145, -529, 11, -529,
1853 -529, -529, -529, -529, -529, -529, -529, -98, -529, -529,
1854 -529, 109, 157, 235, 168, 238, 173, 240, 201, 244,
1855 245, 250, 203, 254, 252, 544, -529, 1231, 1231, 106,
1856 -111, 1231, -529, 1059, -529, 115, 113, 730, -529, -529,
1857 74, -529, 730, 730, -529, -529, -529, -529, -529, -529,
1858 -529, -529, -529, -529, 730, 1211, -529, -529, -529, -529,
1859 -529, -529, -529, -529, -529, -529, 1231, -529, -529, -529,
1860 -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,
1861 -529, -529, -529, 1231, 117, 124, -529, 730, 121, 129,
1862 135, 136, 139, 140, 141, 730, 730, 730, 267, 158,
1863 1211, 1231, 1231, 282, -529, 161, 161, 161, -529, -529,
1864 -529, -529, -529, -529, -529, -529, -529, -529, 195, 378,
1865 160, 162, 163, 164, 165, 965, 1276, 695, 285, 167,
1866 170, 171, 172, 174, -529, -529, 161, -64, -87, -529,
1867 169, -105, -529, 176, -529, 175, 190, 1116, -529, -529,
1868 -529, -529, -529, -529, -529, -529, -529, 253, 1276, -529,
1869 -529, -529, -529, 182, -529, 194, 730, 730, 730, -1,
1870 -529, 5, -529, 196, 730, 193, 1231, 1231, 1231, 1231,
1871 1231, 198, 199, 200, 1231, 1231, 730, 730, 207, -529,
1872 -11, -529, -529, -529, 206, 208, 1276, 1276, 1276, 1276,
1873 1276, -529, -529, -66, -78, -529, -85, -529, 1276, 1276,
1874 1276, 1276, 1276, -529, -529, -529, -529, -529, -529, 1170,
1875 290, -529, -529, 323, -77, 327, 328, 209, 212, 216,
1876 730, 346, 730, 1231, -529, 218, 730, 220, -529, -529,
1877 222, 224, 730, 730, 730, -529, -529, 215, -529, 1231,
1878 331, 347, -529, 161, 1276, 1276, 196, 225, 227, 229,
1879 230, 1276, -529, -529, -529, 231, 234, 246, 329, 247,
1880 -529, -529, -529, 312, 248, -529, 730, 730, 1231, 730,
1881 730, 255, -529, 255, -529, 257, 730, 264, 1231, 1231,
1882 1231, -529, -529, -529, 1231, 730, -529, -529, -529, 265,
1883 268, 232, 1276, 1276, 1276, 1276, -529, 1276, 1276, 1276,
1884 1231, 1276, 386, -529, 375, 269, 270, 257, 251, -529,
1885 -529, 361, -529, -529, 1231, 271, 730, -529, -529, -529,
1886 272, -529, 1276, 1276, -529, 273, 275, 276, 279, 277,
1887 281, 283, 287, 291, -529, -529, 407, 114, 398, -529,
1888 -529, 292, -529, 296, 297, 1276, -529, 1276, 1276, -529,
1889 -529, -529, -529, -529, 730, -529, 872, 153, 427, -529,
1890 -529, -529, 307, 308, 309, -529, 313, -529, 872, 730,
1891 -529, -529, -529, 440, 318, 389, 730, 446, 447, -529,
1892 730, 730, -529, -529
Reid Spencer3822ff52006-11-08 06:47:33 +00001893};
1894
1895/* YYPGOTO[NTERM-NUM]. */
Andrew Lenharth6353e052006-12-08 18:07:09 +00001896static const short yypgoto[] =
Reid Spencer3822ff52006-11-08 06:47:33 +00001897{
Andrew Lenharth6353e052006-12-08 18:07:09 +00001898 -529, -529, -529, 372, 374, 379, 381, 382, 188, 166,
1899 -130, -128, -510, -529, 439, 456, -123, -529, -270, 88,
1900 -529, -285, -529, -49, -529, -37, -529, -68, -36, -529,
1901 -110, 284, -298, 60, -529, -529, -529, -529, -529, -529,
1902 -529, 445, -529, -529, -529, -529, 3, -529, 91, -529,
1903 -529, 441, -529, -529, -529, -529, -529, 498, -529, -529,
1904 -528, -202, 40, -119, -529, 484, -529, -529, -529, -529,
1905 -529, 81, 24, -529, -529, 59, -529, -529
Reid Spencer3822ff52006-11-08 06:47:33 +00001906};
1907
1908/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1909 positive, shift that token. If negative, reduce the rule which
1910 number is the opposite. If zero, do what YYDEFACT says.
1911 If YYTABLE_NINF, syntax error. */
Andrew Lenharth6353e052006-12-08 18:07:09 +00001912#define YYTABLE_NINF -175
1913static const short yytable[] =
Reid Spencer3822ff52006-11-08 06:47:33 +00001914{
Andrew Lenharth6353e052006-12-08 18:07:09 +00001915 89, 242, 216, 243, 106, 362, 26, 228, 116, 245,
1916 231, 382, 383, 325, 420, 39, 89, 120, 394, 396,
1917 422, 4, 42, 440, 232, 351, 94, 556, 566, 221,
1918 351, 351, 46, 47, 48, 221, 233, 29, 276, 222,
1919 574, 403, 351, -108, 26, 330, 441, 568, 293, 120,
1920 414, 49, 124, 280, 294, 120, 421, 281, 282, 283,
1921 284, 451, 421, 290, 288, 289, 39, 405, 451, 451,
1922 124, 454, 198, 199, 200, 351, 453, 465, 107, 108,
1923 451, 220, 51, 351, 351, 351, 452, 225, 404, 227,
1924 122, 52, 227, 124, 58, 65, 66, 62, 118, 68,
Reid Spencercd42c582006-12-05 23:29:42 +00001925 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
Andrew Lenharth6353e052006-12-08 18:07:09 +00001926 79, 80, 20, 99, 21, 110, 111, 112, 274, 275,
1927 227, 277, 191, 192, 234, 235, 236, 237, 238, 239,
1928 240, 241, 291, 292, 278, 227, 298, 299, 81, 227,
1929 227, 227, 227, 285, 286, 287, 227, 227, 43, 327,
1930 328, 64, 95, 331, 351, 351, 351, 53, 488, 117,
1931 -68, -68, 351, 234, 235, 236, 237, 238, 239, 240,
1932 241, -67, -67, 378, 351, 351, -66, -66, 7, 8,
1933 9, 10, 54, 12, 55, 103, 333, 56, 234, 235,
1934 236, 237, 238, 239, 240, 241, 356, 59, 20, 60,
1935 21, 512, 100, 513, -65, -65, 300, 301, 89, 30,
1936 31, 32, 33, 34, 35, 36, 101, 102, 351, 357,
1937 351, 114, -109, 115, 351, 123, 190, 194, 195, 196,
1938 351, 351, 351, 217, 218, 223, 358, 82, 229, -72,
1939 83, 376, -71, 84, -70, 85, 119, 427, -69, 429,
1940 430, 431, -75, 89, 377, 227, 436, -76, 303, 304,
1941 329, 337, 338, 359, 351, 351, 555, 351, 351, 331,
1942 361, 364, 353, 354, 351, 365, 446, 447, 448, 449,
1943 450, 366, 367, 351, 355, 368, 369, 370, 455, 456,
1944 457, 458, 459, 246, 247, 248, 249, 250, 251, 252,
1945 253, 254, 255, 374, 375, 567, 379, 380, 386, 397,
1946 387, 388, 389, 390, 351, 398, 412, 363, 399, 400,
1947 401, 409, 402, 406, 440, 371, 372, 373, 415, 227,
1948 428, 227, 227, 227, 489, 490, 407, 435, 227, 410,
1949 416, 496, 423, 426, 432, 433, 434, 464, 466, 467,
1950 472, 487, 351, 439, 444, 486, 445, 468, 469, 517,
1951 518, 519, 470, 484, 476, 500, 478, 351, 479, 502,
1952 480, 492, 333, 493, 351, 494, 495, 497, 351, 351,
1953 498, 524, 525, 526, 527, 528, 227, 529, 530, 531,
1954 534, 533, 499, 501, 504, 539, 417, 418, 419, 535,
1955 538, 511, 485, 514, 425, 257, 258, 242, -174, 243,
1956 516, 522, 543, 544, 523, 536, 437, 438, 421, 545,
1957 537, 542, 547, 540, 546, 548, 549, 242, 554, 243,
1958 550, 227, 551, 5, 558, 562, 552, 563, 564, 6,
1959 553, 227, 227, 227, 559, 560, 561, 227, 569, 7,
1960 8, 9, 10, 11, 12, 13, 570, 571, 572, 573,
1961 471, 576, 473, 532, 577, 578, 477, 580, 581, 180,
1962 14, 181, 481, 482, 483, 385, 182, 227, 183, 184,
1963 97, 57, 259, 260, 261, 262, 263, 264, 265, 266,
1964 267, 268, 269, 270, 271, 272, 384, 105, 462, 324,
1965 461, 27, 113, 45, 475, 491, 505, 506, 520, 509,
1966 510, 0, 0, 0, 0, -78, 515, 20, 0, 21,
1967 0, 0, 0, 0, 0, 521, 6, -78, -78, 0,
1968 0, 0, 0, 0, 0, 0, -78, -78, -78, -78,
1969 -78, -78, -78, 0, 0, -78, 22, 0, 0, 65,
1970 66, 0, 0, 23, 0, 0, 541, 24, 0, 0,
1971 0, 0, 0, 0, 0, 0, 20, 0, 21, 0,
1972 305, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1973 0, 0, 306, 307, 0, 0, 0, 0, 0, 0,
1974 0, 0, 0, 0, 565, 0, 0, 0, 0, 0,
1975 0, 0, 0, 0, 0, 0, 0, 0, 0, 575,
1976 0, 0, 0, 0, 0, 0, 579, 0, 0, 0,
1977 582, 583, 135, 136, 137, 138, 139, 140, 141, 142,
1978 143, 144, 145, 146, 147, 148, 149, 150, 151, 152,
1979 308, 309, 65, 66, 0, 118, 68, 69, 70, 71,
1980 72, 73, 74, 75, 76, 77, 78, 79, 80, 20,
1981 0, 21, 0, 0, 0, 0, 0, 310, 159, 160,
1982 161, 162, 163, 164, 165, 166, 167, 168, 169, 170,
1983 0, 311, 173, 174, 175, 81, 312, 313, 314, 0,
1984 0, 0, 0, 0, 315, 0, 0, 316, 0, 317,
1985 65, 66, 318, 118, 201, 202, 203, 204, 205, 206,
1986 207, 208, 209, 210, 211, 79, 80, 20, 0, 21,
1987 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1988 0, 0, 0, 339, 340, 65, 66, 341, 0, 0,
1989 0, 0, 0, 81, 0, 0, 0, 0, 0, 0,
1990 0, 0, 20, 0, 21, 0, 342, 343, 344, 0,
1991 0, 0, 0, 0, 0, 0, 0, 0, 345, 346,
1992 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1993 0, 0, 0, 0, 82, 0, 0, 83, 0, 0,
1994 84, 347, 85, 219, 0, 0, 0, 0, 0, 0,
1995 0, 0, 0, 0, 0, 0, 0, 0, 135, 136,
1996 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
1997 147, 148, 149, 150, 151, 152, 308, 309, 0, 0,
1998 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1999 0, 0, 82, 0, 0, 83, 0, 0, 84, 0,
2000 85, 395, 0, 310, 159, 160, 161, 162, 163, 164,
2001 165, 166, 167, 168, 169, 170, 0, 311, 173, 174,
2002 175, 0, 312, 313, 314, 339, 340, 0, 0, 341,
2003 0, 0, 0, 348, 0, 0, 0, 0, 0, 0,
2004 0, 0, 0, 0, 0, 0, 0, 0, 342, 343,
2005 344, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2006 345, 346, 0, 0, 0, 0, 0, 0, 0, 0,
2007 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2008 0, 0, 0, 347, 0, 0, 0, 0, 0, 0,
2009 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2010 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
2011 145, 146, 147, 148, 149, 150, 151, 152, 308, 309,
2012 65, 66, 0, 118, 201, 202, 203, 204, 205, 206,
2013 207, 208, 209, 210, 211, 79, 80, 20, 0, 21,
2014 0, 0, 0, 0, 0, 310, 159, 160, 161, 162,
2015 163, 164, 165, 166, 167, 168, 169, 170, 0, 311,
2016 173, 174, 175, 81, 312, 313, 314, 0, 0, 0,
2017 0, 0, 0, 65, 66, 348, 118, 68, 69, 70,
2018 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
Reid Spencer6e18b7d2006-12-03 06:59:29 +00002019 20, 0, 21, 0, 0, 0, 0, 0, 0, 0,
Andrew Lenharth6353e052006-12-08 18:07:09 +00002020 0, 0, 0, 0, 0, 224, 0, 0, 0, 0,
2021 0, 0, 0, 0, 65, 66, 81, 118, 68, 69,
Reid Spencercd42c582006-12-05 23:29:42 +00002022 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2023 80, 20, 0, 21, 0, 0, 0, 0, 0, 0,
Andrew Lenharth6353e052006-12-08 18:07:09 +00002024 0, 0, 0, 0, 0, 0, 332, 0, 0, 0,
2025 0, 0, 0, 0, 0, 0, 0, 81, 0, 0,
2026 0, 0, 82, 0, 0, 83, 0, 391, 84, 0,
2027 85, 65, 66, 0, 118, 68, 69, 70, 71, 72,
2028 73, 74, 75, 76, 77, 78, 79, 80, 20, 0,
2029 21, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2030 0, 0, 0, 411, 0, 0, 0, 0, 0, 0,
2031 0, 0, 0, 0, 81, 82, 0, 0, 83, 0,
2032 0, 84, 0, 85, 0, 65, 66, 0, 118, 68,
2033 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
2034 79, 80, 20, 0, 21, 0, 0, 0, 0, 0,
2035 0, 0, 0, 0, 0, 0, 82, 460, 0, 83,
2036 0, 0, 84, 0, 85, 0, 65, 66, 81, 67,
2037 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
2038 78, 79, 80, 20, 0, 21, 65, 66, 0, 118,
2039 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
2040 78, 79, 80, 20, 0, 21, 0, 0, 0, 81,
2041 0, 0, 0, 82, 0, 0, 83, 0, 0, 84,
2042 0, 85, 0, 0, 0, 0, 0, 0, 0, 81,
2043 0, 65, 66, 0, 118, 201, 202, 203, 204, 205,
2044 206, 207, 208, 209, 210, 211, 79, 80, 20, 0,
2045 21, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2046 0, 0, 0, 0, 0, 0, 0, 82, 0, 0,
2047 83, 0, 0, 84, 81, 85, 65, 66, 0, 230,
2048 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
2049 78, 79, 80, 20, 0, 21, 0, 0, 0, 0,
2050 0, 125, 0, 0, 0, 0, 0, 0, 82, 0,
2051 0, 83, 0, 0, 84, 126, 85, 0, 0, 81,
2052 0, 0, 0, 0, 0, 127, 128, 0, 82, 0,
2053 0, 83, 0, 0, 84, 0, 85, 0, 129, 130,
2054 131, 132, 133, 134, 135, 136, 137, 138, 139, 140,
2055 141, 142, 143, 144, 145, 146, 147, 148, 149, 150,
2056 151, 152, 153, 154, 0, 0, 0, 0, 0, 0,
2057 0, 0, 0, 82, 0, 0, 83, 0, 0, 84,
2058 0, 85, 0, 0, 155, 156, 157, 0, 0, 158,
2059 159, 160, 161, 162, 163, 164, 165, 166, 167, 168,
2060 169, 170, 171, 172, 173, 174, 175, 176, 177, 178,
2061 179, 0, 0, 0, 0, 0, 0, 0, 82, 0,
2062 0, 83, 0, 0, 84, 0, 85
Reid Spencer3822ff52006-11-08 06:47:33 +00002063};
2064
Andrew Lenharth6353e052006-12-08 18:07:09 +00002065static const short yycheck[] =
Reid Spencer3822ff52006-11-08 06:47:33 +00002066{
Andrew Lenharth6353e052006-12-08 18:07:09 +00002067 37, 131, 112, 131, 53, 275, 3, 126, 4, 132,
2068 129, 296, 297, 215, 15, 23, 53, 85, 316, 317,
2069 15, 0, 30, 34, 9, 227, 29, 537, 556, 146,
2070 232, 233, 52, 53, 54, 146, 21, 61, 157, 156,
2071 568, 326, 244, 148, 41, 156, 57, 557, 146, 117,
2072 348, 71, 157, 172, 152, 123, 57, 176, 177, 178,
2073 179, 146, 57, 186, 183, 184, 23, 154, 146, 146,
2074 157, 156, 109, 110, 111, 277, 154, 154, 32, 33,
2075 146, 117, 145, 285, 286, 287, 152, 123, 152, 126,
2076 87, 61, 129, 157, 145, 5, 6, 24, 8, 9,
Reid Spencercd42c582006-12-05 23:29:42 +00002077 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
Andrew Lenharth6353e052006-12-08 18:07:09 +00002078 20, 21, 22, 145, 24, 55, 56, 57, 155, 156,
2079 157, 158, 55, 56, 10, 11, 12, 13, 14, 15,
2080 16, 17, 121, 122, 171, 172, 27, 28, 48, 176,
2081 177, 178, 179, 180, 181, 182, 183, 184, 156, 217,
2082 218, 4, 155, 221, 356, 357, 358, 20, 443, 155,
2083 3, 4, 364, 10, 11, 12, 13, 14, 15, 16,
2084 17, 3, 4, 292, 376, 377, 3, 4, 41, 42,
2085 43, 44, 45, 46, 47, 150, 223, 50, 10, 11,
2086 12, 13, 14, 15, 16, 17, 245, 45, 22, 47,
2087 24, 471, 145, 473, 3, 4, 3, 4, 245, 64,
2088 65, 66, 67, 68, 69, 70, 145, 145, 420, 256,
2089 422, 4, 148, 4, 426, 148, 24, 4, 24, 24,
2090 432, 433, 434, 151, 151, 148, 273, 147, 59, 4,
2091 150, 290, 4, 153, 4, 155, 156, 366, 4, 368,
2092 369, 370, 7, 290, 291, 292, 375, 7, 4, 7,
2093 154, 146, 149, 146, 466, 467, 152, 469, 470, 337,
2094 146, 150, 232, 233, 476, 146, 386, 387, 388, 389,
2095 390, 146, 146, 485, 244, 146, 146, 146, 398, 399,
2096 400, 401, 402, 98, 99, 100, 101, 102, 103, 104,
2097 105, 106, 107, 36, 146, 152, 24, 146, 148, 24,
2098 148, 148, 148, 148, 516, 148, 63, 277, 148, 148,
2099 148, 146, 148, 154, 34, 285, 286, 287, 146, 366,
2100 367, 368, 369, 370, 444, 445, 333, 374, 375, 149,
2101 146, 451, 146, 150, 146, 146, 146, 24, 21, 21,
2102 4, 4, 554, 146, 148, 24, 148, 148, 146, 478,
2103 479, 480, 146, 148, 146, 36, 146, 569, 146, 57,
2104 146, 146, 409, 146, 576, 146, 146, 146, 580, 581,
2105 146, 149, 492, 493, 494, 495, 423, 497, 498, 499,
2106 4, 501, 146, 146, 146, 514, 356, 357, 358, 24,
2107 149, 146, 439, 146, 364, 27, 28, 537, 0, 537,
2108 146, 146, 522, 523, 146, 146, 376, 377, 57, 146,
2109 150, 149, 146, 152, 149, 146, 149, 557, 21, 557,
2110 149, 468, 149, 25, 36, 545, 149, 547, 548, 31,
2111 149, 478, 479, 480, 152, 149, 149, 484, 21, 41,
2112 42, 43, 44, 45, 46, 47, 149, 149, 149, 146,
2113 420, 21, 422, 500, 146, 76, 426, 21, 21, 97,
2114 62, 97, 432, 433, 434, 309, 97, 514, 97, 97,
2115 41, 25, 104, 105, 106, 107, 108, 109, 110, 111,
2116 112, 113, 114, 115, 116, 117, 308, 52, 410, 215,
2117 409, 3, 61, 19, 423, 446, 466, 467, 484, 469,
2118 470, -1, -1, -1, -1, 20, 476, 22, -1, 24,
2119 -1, -1, -1, -1, -1, 485, 31, 32, 33, -1,
2120 -1, -1, -1, -1, -1, -1, 41, 42, 43, 44,
2121 45, 46, 47, -1, -1, 50, 51, -1, -1, 5,
2122 6, -1, -1, 58, -1, -1, 516, 62, -1, -1,
2123 -1, -1, -1, -1, -1, -1, 22, -1, 24, -1,
2124 26, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2125 -1, -1, 38, 39, -1, -1, -1, -1, -1, -1,
2126 -1, -1, -1, -1, 554, -1, -1, -1, -1, -1,
2127 -1, -1, -1, -1, -1, -1, -1, -1, -1, 569,
2128 -1, -1, -1, -1, -1, -1, 576, -1, -1, -1,
2129 580, 581, 78, 79, 80, 81, 82, 83, 84, 85,
2130 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
2131 96, 97, 5, 6, -1, 8, 9, 10, 11, 12,
2132 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
2133 -1, 24, -1, -1, -1, -1, -1, 123, 124, 125,
2134 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
2135 -1, 137, 138, 139, 140, 48, 142, 143, 144, -1,
2136 -1, -1, -1, -1, 150, -1, -1, 153, -1, 155,
2137 5, 6, 158, 8, 9, 10, 11, 12, 13, 14,
2138 15, 16, 17, 18, 19, 20, 21, 22, -1, 24,
2139 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2140 -1, -1, -1, 3, 4, 5, 6, 7, -1, -1,
2141 -1, -1, -1, 48, -1, -1, -1, -1, -1, -1,
2142 -1, -1, 22, -1, 24, -1, 26, 27, 28, -1,
2143 -1, -1, -1, -1, -1, -1, -1, -1, 38, 39,
2144 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2145 -1, -1, -1, -1, 147, -1, -1, 150, -1, -1,
2146 153, 61, 155, 156, -1, -1, -1, -1, -1, -1,
2147 -1, -1, -1, -1, -1, -1, -1, -1, 78, 79,
2148 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
2149 90, 91, 92, 93, 94, 95, 96, 97, -1, -1,
2150 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2151 -1, -1, 147, -1, -1, 150, -1, -1, 153, -1,
2152 155, 156, -1, 123, 124, 125, 126, 127, 128, 129,
2153 130, 131, 132, 133, 134, 135, -1, 137, 138, 139,
2154 140, -1, 142, 143, 144, 3, 4, -1, -1, 7,
2155 -1, -1, -1, 153, -1, -1, -1, -1, -1, -1,
2156 -1, -1, -1, -1, -1, -1, -1, -1, 26, 27,
2157 28, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2158 38, 39, -1, -1, -1, -1, -1, -1, -1, -1,
2159 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2160 -1, -1, -1, 61, -1, -1, -1, -1, -1, -1,
2161 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2162 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
2163 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
2164 5, 6, -1, 8, 9, 10, 11, 12, 13, 14,
2165 15, 16, 17, 18, 19, 20, 21, 22, -1, 24,
2166 -1, -1, -1, -1, -1, 123, 124, 125, 126, 127,
2167 128, 129, 130, 131, 132, 133, 134, 135, -1, 137,
2168 138, 139, 140, 48, 142, 143, 144, -1, -1, -1,
2169 -1, -1, -1, 5, 6, 153, 8, 9, 10, 11,
Reid Spencercd42c582006-12-05 23:29:42 +00002170 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
2171 22, -1, 24, -1, -1, -1, -1, -1, -1, -1,
Andrew Lenharth6353e052006-12-08 18:07:09 +00002172 -1, -1, -1, -1, -1, 37, -1, -1, -1, -1,
2173 -1, -1, -1, -1, 5, 6, 48, 8, 9, 10,
Reid Spencer4012e832006-12-04 05:24:24 +00002174 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
Reid Spencercd42c582006-12-05 23:29:42 +00002175 21, 22, -1, 24, -1, -1, -1, -1, -1, -1,
2176 -1, -1, -1, -1, -1, -1, 37, -1, -1, -1,
Andrew Lenharth6353e052006-12-08 18:07:09 +00002177 -1, -1, -1, -1, -1, -1, -1, 48, -1, -1,
2178 -1, -1, 147, -1, -1, 150, -1, 152, 153, -1,
2179 155, 5, 6, -1, 8, 9, 10, 11, 12, 13,
2180 14, 15, 16, 17, 18, 19, 20, 21, 22, -1,
2181 24, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2182 -1, -1, -1, 37, -1, -1, -1, -1, -1, -1,
2183 -1, -1, -1, -1, 48, 147, -1, -1, 150, -1,
2184 -1, 153, -1, 155, -1, 5, 6, -1, 8, 9,
2185 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
2186 20, 21, 22, -1, 24, -1, -1, -1, -1, -1,
2187 -1, -1, -1, -1, -1, -1, 147, 37, -1, 150,
2188 -1, -1, 153, -1, 155, -1, 5, 6, 48, 8,
2189 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
2190 19, 20, 21, 22, -1, 24, 5, 6, -1, 8,
2191 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
2192 19, 20, 21, 22, -1, 24, -1, -1, -1, 48,
2193 -1, -1, -1, 147, -1, -1, 150, -1, -1, 153,
2194 -1, 155, -1, -1, -1, -1, -1, -1, -1, 48,
2195 -1, 5, 6, -1, 8, 9, 10, 11, 12, 13,
2196 14, 15, 16, 17, 18, 19, 20, 21, 22, -1,
2197 24, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2198 -1, -1, -1, -1, -1, -1, -1, 147, -1, -1,
2199 150, -1, -1, 153, 48, 155, 5, 6, -1, 8,
2200 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
2201 19, 20, 21, 22, -1, 24, -1, -1, -1, -1,
2202 -1, 35, -1, -1, -1, -1, -1, -1, 147, -1,
2203 -1, 150, -1, -1, 153, 49, 155, -1, -1, 48,
2204 -1, -1, -1, -1, -1, 59, 60, -1, 147, -1,
2205 -1, 150, -1, -1, 153, -1, 155, -1, 72, 73,
2206 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
2207 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
2208 94, 95, 96, 97, -1, -1, -1, -1, -1, -1,
2209 -1, -1, -1, 147, -1, -1, 150, -1, -1, 153,
2210 -1, 155, -1, -1, 118, 119, 120, -1, -1, 123,
2211 124, 125, 126, 127, 128, 129, 130, 131, 132, 133,
2212 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
2213 144, -1, -1, -1, -1, -1, -1, -1, 147, -1,
2214 -1, 150, -1, -1, 153, -1, 155
Reid Spencer3822ff52006-11-08 06:47:33 +00002215};
2216
2217/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2218 symbol of state STATE-NUM. */
Andrew Lenharth6353e052006-12-08 18:07:09 +00002219static const unsigned char yystos[] =
Reid Spencer3822ff52006-11-08 06:47:33 +00002220{
Reid Spencercd42c582006-12-05 23:29:42 +00002221 0, 193, 194, 195, 0, 25, 31, 41, 42, 43,
2222 44, 45, 46, 47, 62, 174, 212, 214, 216, 223,
2223 22, 24, 51, 58, 62, 173, 205, 216, 217, 61,
2224 64, 65, 66, 67, 68, 69, 70, 175, 210, 23,
2225 224, 225, 30, 156, 213, 224, 52, 53, 54, 71,
2226 202, 145, 61, 20, 45, 47, 50, 174, 145, 45,
2227 47, 215, 24, 200, 4, 5, 6, 8, 9, 10,
Reid Spencer3822ff52006-11-08 06:47:33 +00002228 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
Reid Spencercd42c582006-12-05 23:29:42 +00002229 21, 48, 147, 150, 153, 155, 160, 182, 183, 184,
2230 185, 186, 205, 220, 29, 155, 211, 173, 228, 145,
2231 145, 145, 145, 150, 203, 200, 182, 32, 33, 192,
Andrew Lenharth6353e052006-12-08 18:07:09 +00002232 192, 192, 192, 210, 4, 4, 4, 155, 8, 156,
2233 186, 187, 205, 148, 157, 35, 49, 59, 60, 72,
2234 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
2235 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
2236 93, 94, 95, 96, 97, 118, 119, 120, 123, 124,
2237 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
2238 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
2239 162, 163, 164, 165, 166, 226, 232, 233, 235, 236,
2240 24, 55, 56, 201, 4, 24, 24, 204, 184, 184,
2241 184, 9, 10, 11, 12, 13, 14, 15, 16, 17,
2242 18, 19, 169, 170, 172, 184, 189, 151, 151, 156,
2243 187, 146, 156, 148, 37, 187, 188, 184, 222, 59,
2244 8, 222, 9, 21, 10, 11, 12, 13, 14, 15,
2245 16, 17, 169, 170, 171, 175, 98, 99, 100, 101,
2246 102, 103, 104, 105, 106, 107, 167, 27, 28, 104,
2247 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
2248 115, 116, 117, 168, 184, 184, 222, 184, 184, 229,
2249 222, 222, 222, 222, 222, 184, 184, 184, 222, 222,
2250 175, 121, 122, 146, 152, 198, 199, 197, 27, 28,
2251 3, 4, 161, 4, 7, 26, 38, 39, 96, 97,
2252 123, 137, 142, 143, 144, 150, 153, 155, 158, 162,
2253 163, 164, 165, 166, 190, 220, 196, 186, 186, 154,
2254 156, 186, 37, 184, 207, 208, 209, 146, 149, 3,
2255 4, 7, 26, 27, 28, 38, 39, 61, 153, 190,
2256 219, 220, 221, 221, 221, 221, 182, 184, 184, 146,
2257 177, 146, 177, 221, 150, 146, 146, 146, 146, 146,
2258 146, 221, 221, 221, 36, 146, 182, 184, 222, 24,
2259 146, 180, 180, 180, 167, 168, 148, 148, 148, 148,
2260 148, 152, 189, 191, 191, 156, 191, 24, 148, 148,
2261 148, 148, 148, 180, 152, 154, 154, 205, 206, 146,
2262 149, 37, 63, 218, 191, 146, 146, 221, 221, 221,
2263 15, 57, 15, 146, 234, 221, 150, 222, 184, 222,
2264 222, 222, 146, 146, 146, 184, 222, 221, 221, 146,
2265 34, 57, 178, 181, 148, 148, 189, 189, 189, 189,
2266 189, 146, 152, 154, 156, 189, 189, 189, 189, 189,
2267 37, 207, 178, 179, 24, 154, 21, 21, 148, 146,
2268 146, 221, 4, 221, 222, 230, 146, 221, 146, 146,
2269 146, 221, 221, 221, 148, 184, 24, 4, 180, 189,
2270 189, 234, 146, 146, 146, 146, 189, 146, 146, 146,
2271 36, 146, 57, 176, 146, 221, 221, 230, 231, 221,
2272 221, 146, 177, 177, 146, 221, 146, 222, 222, 222,
2273 231, 221, 146, 146, 149, 189, 189, 189, 189, 189,
2274 189, 189, 184, 189, 4, 24, 146, 150, 149, 222,
2275 152, 221, 149, 189, 189, 146, 149, 146, 146, 149,
2276 149, 149, 149, 149, 21, 152, 171, 227, 36, 152,
2277 149, 149, 189, 189, 189, 221, 219, 152, 171, 21,
2278 149, 149, 149, 146, 219, 221, 21, 146, 76, 221,
2279 21, 21, 221, 221
Reid Spencer3822ff52006-11-08 06:47:33 +00002280};
Reid Spencer68a24bd2005-08-27 18:50:39 +00002281
Andrew Lenharth6353e052006-12-08 18:07:09 +00002282#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
2283# define YYSIZE_T __SIZE_TYPE__
2284#endif
2285#if ! defined (YYSIZE_T) && defined (size_t)
2286# define YYSIZE_T size_t
2287#endif
2288#if ! defined (YYSIZE_T)
2289# if defined (__STDC__) || defined (__cplusplus)
2290# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
2291# define YYSIZE_T size_t
2292# endif
2293#endif
2294#if ! defined (YYSIZE_T)
2295# define YYSIZE_T unsigned int
2296#endif
2297
Reid Spencer68a24bd2005-08-27 18:50:39 +00002298#define yyerrok (yyerrstatus = 0)
2299#define yyclearin (yychar = YYEMPTY)
Reid Spencer3822ff52006-11-08 06:47:33 +00002300#define YYEMPTY (-2)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002301#define YYEOF 0
Reid Spencer3822ff52006-11-08 06:47:33 +00002302
Reid Spencer68a24bd2005-08-27 18:50:39 +00002303#define YYACCEPT goto yyacceptlab
Reid Spencer3822ff52006-11-08 06:47:33 +00002304#define YYABORT goto yyabortlab
2305#define YYERROR goto yyerrorlab
2306
2307
2308/* Like YYERROR except do call yyerror. This remains here temporarily
2309 to ease the transition to the new meaning of YYERROR, for GCC.
Reid Spencer68a24bd2005-08-27 18:50:39 +00002310 Once GCC version 2 has supplanted version 1, this can go. */
Reid Spencer3822ff52006-11-08 06:47:33 +00002311
Reid Spencer68a24bd2005-08-27 18:50:39 +00002312#define YYFAIL goto yyerrlab
Reid Spencer3822ff52006-11-08 06:47:33 +00002313
Reid Spencer68a24bd2005-08-27 18:50:39 +00002314#define YYRECOVERING() (!!yyerrstatus)
Reid Spencer3822ff52006-11-08 06:47:33 +00002315
2316#define YYBACKUP(Token, Value) \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002317do \
2318 if (yychar == YYEMPTY && yylen == 1) \
Reid Spencer3822ff52006-11-08 06:47:33 +00002319 { \
2320 yychar = (Token); \
2321 yylval = (Value); \
2322 yytoken = YYTRANSLATE (yychar); \
Andrew Lenharth6353e052006-12-08 18:07:09 +00002323 YYPOPSTACK; \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002324 goto yybackup; \
2325 } \
2326 else \
Andrew Lenharth6353e052006-12-08 18:07:09 +00002327 { \
2328 yyerror ("syntax error: cannot back up");\
Reid Spencer3822ff52006-11-08 06:47:33 +00002329 YYERROR; \
2330 } \
Andrew Lenharth6353e052006-12-08 18:07:09 +00002331while (0)
Reid Spencer3822ff52006-11-08 06:47:33 +00002332
Reid Spencer68a24bd2005-08-27 18:50:39 +00002333#define YYTERROR 1
2334#define YYERRCODE 256
2335
Andrew Lenharth6353e052006-12-08 18:07:09 +00002336/* YYLLOC_DEFAULT -- Compute the default location (before the actions
2337 are run). */
Reid Spencer3822ff52006-11-08 06:47:33 +00002338
Reid Spencer3822ff52006-11-08 06:47:33 +00002339#ifndef YYLLOC_DEFAULT
Andrew Lenharth6353e052006-12-08 18:07:09 +00002340# define YYLLOC_DEFAULT(Current, Rhs, N) \
2341 ((Current).first_line = (Rhs)[1].first_line, \
2342 (Current).first_column = (Rhs)[1].first_column, \
2343 (Current).last_line = (Rhs)[N].last_line, \
2344 (Current).last_column = (Rhs)[N].last_column)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002345#endif
2346
Reid Spencer3822ff52006-11-08 06:47:33 +00002347/* YYLEX -- calling `yylex' with the right arguments. */
2348
Reid Spencer68a24bd2005-08-27 18:50:39 +00002349#ifdef YYLEX_PARAM
Reid Spencer3822ff52006-11-08 06:47:33 +00002350# define YYLEX yylex (YYLEX_PARAM)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002351#else
Reid Spencer3822ff52006-11-08 06:47:33 +00002352# define YYLEX yylex ()
Chris Lattnerf49c1762006-11-08 05:58:47 +00002353#endif
Reid Spencer3822ff52006-11-08 06:47:33 +00002354
2355/* Enable debugging if requested. */
2356#if YYDEBUG
2357
2358# ifndef YYFPRINTF
2359# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2360# define YYFPRINTF fprintf
2361# endif
2362
2363# define YYDPRINTF(Args) \
2364do { \
2365 if (yydebug) \
2366 YYFPRINTF Args; \
Andrew Lenharth6353e052006-12-08 18:07:09 +00002367} while (0)
Reid Spencer3822ff52006-11-08 06:47:33 +00002368
Andrew Lenharth6353e052006-12-08 18:07:09 +00002369# define YYDSYMPRINT(Args) \
2370do { \
2371 if (yydebug) \
2372 yysymprint Args; \
2373} while (0)
Bill Wendlinge8156192006-12-07 01:30:32 +00002374
Andrew Lenharth6353e052006-12-08 18:07:09 +00002375# define YYDSYMPRINTF(Title, Token, Value, Location) \
2376do { \
2377 if (yydebug) \
2378 { \
2379 YYFPRINTF (stderr, "%s ", Title); \
2380 yysymprint (stderr, \
2381 Token, Value); \
2382 YYFPRINTF (stderr, "\n"); \
2383 } \
2384} while (0)
Reid Spencer3822ff52006-11-08 06:47:33 +00002385
2386/*------------------------------------------------------------------.
2387| yy_stack_print -- Print the state stack from its BOTTOM up to its |
2388| TOP (included). |
2389`------------------------------------------------------------------*/
2390
Andrew Lenharth6353e052006-12-08 18:07:09 +00002391#if defined (__STDC__) || defined (__cplusplus)
Reid Spencer3822ff52006-11-08 06:47:33 +00002392static void
Andrew Lenharth6353e052006-12-08 18:07:09 +00002393yy_stack_print (short *bottom, short *top)
Chris Lattnerf49c1762006-11-08 05:58:47 +00002394#else
Reid Spencer3822ff52006-11-08 06:47:33 +00002395static void
2396yy_stack_print (bottom, top)
Andrew Lenharth6353e052006-12-08 18:07:09 +00002397 short *bottom;
2398 short *top;
Chris Lattnerf49c1762006-11-08 05:58:47 +00002399#endif
Reid Spencer3822ff52006-11-08 06:47:33 +00002400{
2401 YYFPRINTF (stderr, "Stack now");
Andrew Lenharth6353e052006-12-08 18:07:09 +00002402 for (/* Nothing. */; bottom <= top; ++bottom)
Reid Spencer3822ff52006-11-08 06:47:33 +00002403 YYFPRINTF (stderr, " %d", *bottom);
2404 YYFPRINTF (stderr, "\n");
2405}
2406
2407# define YY_STACK_PRINT(Bottom, Top) \
2408do { \
2409 if (yydebug) \
2410 yy_stack_print ((Bottom), (Top)); \
Andrew Lenharth6353e052006-12-08 18:07:09 +00002411} while (0)
Reid Spencer3822ff52006-11-08 06:47:33 +00002412
2413
2414/*------------------------------------------------.
2415| Report that the YYRULE is going to be reduced. |
2416`------------------------------------------------*/
2417
Andrew Lenharth6353e052006-12-08 18:07:09 +00002418#if defined (__STDC__) || defined (__cplusplus)
Reid Spencer3822ff52006-11-08 06:47:33 +00002419static void
Andrew Lenharth6353e052006-12-08 18:07:09 +00002420yy_reduce_print (int yyrule)
Reid Spencer3822ff52006-11-08 06:47:33 +00002421#else
2422static void
Andrew Lenharth6353e052006-12-08 18:07:09 +00002423yy_reduce_print (yyrule)
Reid Spencer3822ff52006-11-08 06:47:33 +00002424 int yyrule;
Chris Lattner1ae022f2006-10-22 06:08:13 +00002425#endif
Reid Spencer3822ff52006-11-08 06:47:33 +00002426{
2427 int yyi;
Andrew Lenharth6353e052006-12-08 18:07:09 +00002428 unsigned int yylno = yyrline[yyrule];
2429 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
2430 yyrule - 1, yylno);
2431 /* Print the symbols being reduced, and their result. */
2432 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2433 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
2434 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
Reid Spencer3822ff52006-11-08 06:47:33 +00002435}
Reid Spencer21be8652006-10-22 07:03:43 +00002436
Reid Spencer3822ff52006-11-08 06:47:33 +00002437# define YY_REDUCE_PRINT(Rule) \
2438do { \
2439 if (yydebug) \
Andrew Lenharth6353e052006-12-08 18:07:09 +00002440 yy_reduce_print (Rule); \
2441} while (0)
Reid Spencer21be8652006-10-22 07:03:43 +00002442
Reid Spencer3822ff52006-11-08 06:47:33 +00002443/* Nonzero means print parse trace. It is left uninitialized so that
2444 multiple parsers can coexist. */
2445int yydebug;
2446#else /* !YYDEBUG */
2447# define YYDPRINTF(Args)
Andrew Lenharth6353e052006-12-08 18:07:09 +00002448# define YYDSYMPRINT(Args)
2449# define YYDSYMPRINTF(Title, Token, Value, Location)
Reid Spencer3822ff52006-11-08 06:47:33 +00002450# define YY_STACK_PRINT(Bottom, Top)
2451# define YY_REDUCE_PRINT(Rule)
2452#endif /* !YYDEBUG */
Reid Spencer21be8652006-10-22 07:03:43 +00002453
Reid Spencer21be8652006-10-22 07:03:43 +00002454
Reid Spencer3822ff52006-11-08 06:47:33 +00002455/* YYINITDEPTH -- initial size of the parser's stacks. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002456#ifndef YYINITDEPTH
Reid Spencer3822ff52006-11-08 06:47:33 +00002457# define YYINITDEPTH 200
Reid Spencer68a24bd2005-08-27 18:50:39 +00002458#endif
2459
Reid Spencer3822ff52006-11-08 06:47:33 +00002460/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2461 if the built-in stack extension method is used).
Reid Spencer68a24bd2005-08-27 18:50:39 +00002462
Reid Spencer3822ff52006-11-08 06:47:33 +00002463 Do not make this value too large; the results are undefined if
Andrew Lenharth6353e052006-12-08 18:07:09 +00002464 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
Reid Spencer3822ff52006-11-08 06:47:33 +00002465 evaluated with infinite-precision integer arithmetic. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002466
Andrew Lenharth6353e052006-12-08 18:07:09 +00002467#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
2468# undef YYMAXDEPTH
2469#endif
2470
Reid Spencer68a24bd2005-08-27 18:50:39 +00002471#ifndef YYMAXDEPTH
Reid Spencer3822ff52006-11-08 06:47:33 +00002472# define YYMAXDEPTH 10000
Reid Spencer68a24bd2005-08-27 18:50:39 +00002473#endif
Reid Spencer3822ff52006-11-08 06:47:33 +00002474
Reid Spencer68a24bd2005-08-27 18:50:39 +00002475
2476
Reid Spencer3822ff52006-11-08 06:47:33 +00002477#if YYERROR_VERBOSE
Reid Spencer68a24bd2005-08-27 18:50:39 +00002478
Reid Spencer3822ff52006-11-08 06:47:33 +00002479# ifndef yystrlen
Andrew Lenharth6353e052006-12-08 18:07:09 +00002480# if defined (__GLIBC__) && defined (_STRING_H)
Reid Spencer3822ff52006-11-08 06:47:33 +00002481# define yystrlen strlen
2482# else
2483/* Return the length of YYSTR. */
2484static YYSIZE_T
Andrew Lenharth6353e052006-12-08 18:07:09 +00002485# if defined (__STDC__) || defined (__cplusplus)
Reid Spencer3822ff52006-11-08 06:47:33 +00002486yystrlen (const char *yystr)
Andrew Lenharth6353e052006-12-08 18:07:09 +00002487# else
Reid Spencer3822ff52006-11-08 06:47:33 +00002488yystrlen (yystr)
Andrew Lenharth6353e052006-12-08 18:07:09 +00002489 const char *yystr;
2490# endif
Chris Lattnerf49c1762006-11-08 05:58:47 +00002491{
Andrew Lenharth6353e052006-12-08 18:07:09 +00002492 register const char *yys = yystr;
2493
2494 while (*yys++ != '\0')
Reid Spencer3822ff52006-11-08 06:47:33 +00002495 continue;
Andrew Lenharth6353e052006-12-08 18:07:09 +00002496
2497 return yys - yystr - 1;
Chris Lattnerf49c1762006-11-08 05:58:47 +00002498}
Reid Spencer3822ff52006-11-08 06:47:33 +00002499# endif
2500# endif
Chris Lattnerf49c1762006-11-08 05:58:47 +00002501
Reid Spencer3822ff52006-11-08 06:47:33 +00002502# ifndef yystpcpy
Andrew Lenharth6353e052006-12-08 18:07:09 +00002503# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
Reid Spencer3822ff52006-11-08 06:47:33 +00002504# define yystpcpy stpcpy
2505# else
2506/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2507 YYDEST. */
2508static char *
Andrew Lenharth6353e052006-12-08 18:07:09 +00002509# if defined (__STDC__) || defined (__cplusplus)
Reid Spencer3822ff52006-11-08 06:47:33 +00002510yystpcpy (char *yydest, const char *yysrc)
Andrew Lenharth6353e052006-12-08 18:07:09 +00002511# else
Reid Spencer3822ff52006-11-08 06:47:33 +00002512yystpcpy (yydest, yysrc)
Andrew Lenharth6353e052006-12-08 18:07:09 +00002513 char *yydest;
2514 const char *yysrc;
2515# endif
Chris Lattnerf49c1762006-11-08 05:58:47 +00002516{
Andrew Lenharth6353e052006-12-08 18:07:09 +00002517 register char *yyd = yydest;
2518 register const char *yys = yysrc;
Chris Lattnerf49c1762006-11-08 05:58:47 +00002519
Reid Spencer3822ff52006-11-08 06:47:33 +00002520 while ((*yyd++ = *yys++) != '\0')
2521 continue;
2522
2523 return yyd - 1;
Chris Lattnerf49c1762006-11-08 05:58:47 +00002524}
Reid Spencer3822ff52006-11-08 06:47:33 +00002525# endif
2526# endif
Chris Lattnerf49c1762006-11-08 05:58:47 +00002527
Andrew Lenharth6353e052006-12-08 18:07:09 +00002528#endif /* !YYERROR_VERBOSE */
Reid Spencer3822ff52006-11-08 06:47:33 +00002529
Reid Spencer21be8652006-10-22 07:03:43 +00002530
2531
Andrew Lenharth6353e052006-12-08 18:07:09 +00002532#if YYDEBUG
2533/*--------------------------------.
2534| Print this symbol on YYOUTPUT. |
2535`--------------------------------*/
Reid Spencer3822ff52006-11-08 06:47:33 +00002536
Andrew Lenharth6353e052006-12-08 18:07:09 +00002537#if defined (__STDC__) || defined (__cplusplus)
Reid Spencer3822ff52006-11-08 06:47:33 +00002538static void
Andrew Lenharth6353e052006-12-08 18:07:09 +00002539yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
Reid Spencer3822ff52006-11-08 06:47:33 +00002540#else
2541static void
Andrew Lenharth6353e052006-12-08 18:07:09 +00002542yysymprint (yyoutput, yytype, yyvaluep)
2543 FILE *yyoutput;
Reid Spencer3822ff52006-11-08 06:47:33 +00002544 int yytype;
2545 YYSTYPE *yyvaluep;
2546#endif
2547{
Andrew Lenharth6353e052006-12-08 18:07:09 +00002548 /* Pacify ``unused variable'' warnings. */
2549 (void) yyvaluep;
Reid Spencer3822ff52006-11-08 06:47:33 +00002550
Andrew Lenharth6353e052006-12-08 18:07:09 +00002551 if (yytype < YYNTOKENS)
2552 {
2553 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2554# ifdef YYPRINT
2555 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2556# endif
2557 }
2558 else
2559 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2560
2561 switch (yytype)
2562 {
2563 default:
2564 break;
2565 }
2566 YYFPRINTF (yyoutput, ")");
2567}
2568
2569#endif /* ! YYDEBUG */
2570/*-----------------------------------------------.
2571| Release the memory associated to this symbol. |
2572`-----------------------------------------------*/
2573
2574#if defined (__STDC__) || defined (__cplusplus)
2575static void
2576yydestruct (int yytype, YYSTYPE *yyvaluep)
2577#else
2578static void
2579yydestruct (yytype, yyvaluep)
2580 int yytype;
2581 YYSTYPE *yyvaluep;
2582#endif
2583{
2584 /* Pacify ``unused variable'' warnings. */
2585 (void) yyvaluep;
Reid Spencer3822ff52006-11-08 06:47:33 +00002586
2587 switch (yytype)
2588 {
2589
2590 default:
Andrew Lenharth6353e052006-12-08 18:07:09 +00002591 break;
Reid Spencer3822ff52006-11-08 06:47:33 +00002592 }
2593}
2594
2595
2596/* Prevent warnings from -Wmissing-prototypes. */
2597
2598#ifdef YYPARSE_PARAM
Andrew Lenharth6353e052006-12-08 18:07:09 +00002599# if defined (__STDC__) || defined (__cplusplus)
Reid Spencer3822ff52006-11-08 06:47:33 +00002600int yyparse (void *YYPARSE_PARAM);
Andrew Lenharth6353e052006-12-08 18:07:09 +00002601# else
Reid Spencer3822ff52006-11-08 06:47:33 +00002602int yyparse ();
Andrew Lenharth6353e052006-12-08 18:07:09 +00002603# endif
Reid Spencer3822ff52006-11-08 06:47:33 +00002604#else /* ! YYPARSE_PARAM */
Andrew Lenharth6353e052006-12-08 18:07:09 +00002605#if defined (__STDC__) || defined (__cplusplus)
Reid Spencere812fb22006-01-19 01:21:04 +00002606int yyparse (void);
Chris Lattnerf49c1762006-11-08 05:58:47 +00002607#else
Reid Spencer3822ff52006-11-08 06:47:33 +00002608int yyparse ();
2609#endif
2610#endif /* ! YYPARSE_PARAM */
2611
2612
2613
Andrew Lenharth6353e052006-12-08 18:07:09 +00002614/* The lookahead symbol. */
Reid Spencer3822ff52006-11-08 06:47:33 +00002615int yychar;
2616
Andrew Lenharth6353e052006-12-08 18:07:09 +00002617/* The semantic value of the lookahead symbol. */
Reid Spencer3822ff52006-11-08 06:47:33 +00002618YYSTYPE yylval;
2619
2620/* Number of syntax errors so far. */
2621int yynerrs;
2622
2623
2624
2625/*----------.
2626| yyparse. |
2627`----------*/
2628
2629#ifdef YYPARSE_PARAM
Andrew Lenharth6353e052006-12-08 18:07:09 +00002630# if defined (__STDC__) || defined (__cplusplus)
2631int yyparse (void *YYPARSE_PARAM)
2632# else
2633int yyparse (YYPARSE_PARAM)
2634 void *YYPARSE_PARAM;
2635# endif
Reid Spencer3822ff52006-11-08 06:47:33 +00002636#else /* ! YYPARSE_PARAM */
Andrew Lenharth6353e052006-12-08 18:07:09 +00002637#if defined (__STDC__) || defined (__cplusplus)
Reid Spencer3822ff52006-11-08 06:47:33 +00002638int
2639yyparse (void)
2640#else
2641int
2642yyparse ()
2643
2644#endif
2645#endif
2646{
2647
Andrew Lenharth6353e052006-12-08 18:07:09 +00002648 register int yystate;
2649 register int yyn;
Reid Spencer3822ff52006-11-08 06:47:33 +00002650 int yyresult;
2651 /* Number of tokens to shift before error messages enabled. */
2652 int yyerrstatus;
Andrew Lenharth6353e052006-12-08 18:07:09 +00002653 /* Lookahead token as an internal (translated) token number. */
Reid Spencer3822ff52006-11-08 06:47:33 +00002654 int yytoken = 0;
2655
2656 /* Three stacks and their tools:
2657 `yyss': related to states,
2658 `yyvs': related to semantic values,
2659 `yyls': related to locations.
2660
2661 Refer to the stacks thru separate pointers, to allow yyoverflow
2662 to reallocate them elsewhere. */
2663
2664 /* The state stack. */
Andrew Lenharth6353e052006-12-08 18:07:09 +00002665 short yyssa[YYINITDEPTH];
2666 short *yyss = yyssa;
2667 register short *yyssp;
Reid Spencer3822ff52006-11-08 06:47:33 +00002668
2669 /* The semantic value stack. */
2670 YYSTYPE yyvsa[YYINITDEPTH];
2671 YYSTYPE *yyvs = yyvsa;
Andrew Lenharth6353e052006-12-08 18:07:09 +00002672 register YYSTYPE *yyvsp;
Reid Spencer3822ff52006-11-08 06:47:33 +00002673
2674
2675
Andrew Lenharth6353e052006-12-08 18:07:09 +00002676#define YYPOPSTACK (yyvsp--, yyssp--)
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +00002677
Reid Spencer3822ff52006-11-08 06:47:33 +00002678 YYSIZE_T yystacksize = YYINITDEPTH;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +00002679
Reid Spencer3822ff52006-11-08 06:47:33 +00002680 /* The variables used to return semantic value and location from the
2681 action routines. */
2682 YYSTYPE yyval;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +00002683
2684
Andrew Lenharth6353e052006-12-08 18:07:09 +00002685 /* When reducing, the number of symbols on the RHS of the reduced
2686 rule. */
2687 int yylen;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +00002688
Reid Spencer3822ff52006-11-08 06:47:33 +00002689 YYDPRINTF ((stderr, "Starting parse\n"));
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +00002690
Reid Spencer68a24bd2005-08-27 18:50:39 +00002691 yystate = 0;
2692 yyerrstatus = 0;
2693 yynerrs = 0;
2694 yychar = YYEMPTY; /* Cause a token to be read. */
2695
2696 /* Initialize stack pointers.
2697 Waste one element of value and location stack
2698 so that they stay on the same level as the state stack.
2699 The wasted elements are never initialized. */
2700
Reid Spencer3822ff52006-11-08 06:47:33 +00002701 yyssp = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002702 yyvsp = yyvs;
2703
Reid Spencer3822ff52006-11-08 06:47:33 +00002704 goto yysetstate;
Jeff Cohen66c5fd62005-10-23 04:37:20 +00002705
Reid Spencer3822ff52006-11-08 06:47:33 +00002706/*------------------------------------------------------------.
2707| yynewstate -- Push a new state, which is found in yystate. |
2708`------------------------------------------------------------*/
2709 yynewstate:
2710 /* In all cases, when you get here, the value and location stacks
Andrew Lenharth6353e052006-12-08 18:07:09 +00002711 have just been pushed. so pushing a state here evens the stacks.
2712 */
Reid Spencer3822ff52006-11-08 06:47:33 +00002713 yyssp++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002714
Reid Spencer3822ff52006-11-08 06:47:33 +00002715 yysetstate:
2716 *yyssp = yystate;
2717
2718 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002719 {
2720 /* Get the current used size of the three stacks, in elements. */
Reid Spencer3822ff52006-11-08 06:47:33 +00002721 YYSIZE_T yysize = yyssp - yyss + 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002722
2723#ifdef yyoverflow
Reid Spencer3822ff52006-11-08 06:47:33 +00002724 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00002725 /* Give user a chance to reallocate the stack. Use copies of
Reid Spencer3822ff52006-11-08 06:47:33 +00002726 these so that the &'s don't force the real ones into
2727 memory. */
2728 YYSTYPE *yyvs1 = yyvs;
Andrew Lenharth6353e052006-12-08 18:07:09 +00002729 short *yyss1 = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002730
Reid Spencer3822ff52006-11-08 06:47:33 +00002731
2732 /* Each stack pointer address is followed by the size of the
2733 data in use in that stack, in bytes. This used to be a
2734 conditional around just the two extra args, but that might
2735 be undefined if yyoverflow is a macro. */
Andrew Lenharth6353e052006-12-08 18:07:09 +00002736 yyoverflow ("parser stack overflow",
Reid Spencer3822ff52006-11-08 06:47:33 +00002737 &yyss1, yysize * sizeof (*yyssp),
2738 &yyvs1, yysize * sizeof (*yyvsp),
2739
2740 &yystacksize);
2741
2742 yyss = yyss1;
2743 yyvs = yyvs1;
2744 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00002745#else /* no yyoverflow */
Reid Spencer3822ff52006-11-08 06:47:33 +00002746# ifndef YYSTACK_RELOCATE
Andrew Lenharth6353e052006-12-08 18:07:09 +00002747 goto yyoverflowlab;
Reid Spencer3822ff52006-11-08 06:47:33 +00002748# else
Reid Spencer68a24bd2005-08-27 18:50:39 +00002749 /* Extend the stack our own way. */
Reid Spencer3822ff52006-11-08 06:47:33 +00002750 if (YYMAXDEPTH <= yystacksize)
Andrew Lenharth6353e052006-12-08 18:07:09 +00002751 goto yyoverflowlab;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002752 yystacksize *= 2;
Reid Spencer3822ff52006-11-08 06:47:33 +00002753 if (YYMAXDEPTH < yystacksize)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002754 yystacksize = YYMAXDEPTH;
Reid Spencer3822ff52006-11-08 06:47:33 +00002755
2756 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00002757 short *yyss1 = yyss;
Reid Spencer3822ff52006-11-08 06:47:33 +00002758 union yyalloc *yyptr =
2759 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2760 if (! yyptr)
Andrew Lenharth6353e052006-12-08 18:07:09 +00002761 goto yyoverflowlab;
Reid Spencer3822ff52006-11-08 06:47:33 +00002762 YYSTACK_RELOCATE (yyss);
2763 YYSTACK_RELOCATE (yyvs);
2764
2765# undef YYSTACK_RELOCATE
2766 if (yyss1 != yyssa)
2767 YYSTACK_FREE (yyss1);
2768 }
2769# endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00002770#endif /* no yyoverflow */
2771
Reid Spencer3822ff52006-11-08 06:47:33 +00002772 yyssp = yyss + yysize - 1;
2773 yyvsp = yyvs + yysize - 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002774
2775
Reid Spencer3822ff52006-11-08 06:47:33 +00002776 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2777 (unsigned long int) yystacksize));
2778
2779 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002780 YYABORT;
2781 }
2782
Reid Spencer3822ff52006-11-08 06:47:33 +00002783 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Reid Spencer68a24bd2005-08-27 18:50:39 +00002784
2785 goto yybackup;
Reid Spencer3822ff52006-11-08 06:47:33 +00002786
2787/*-----------.
2788| yybackup. |
2789`-----------*/
2790yybackup:
Reid Spencer68a24bd2005-08-27 18:50:39 +00002791
Andrew Lenharth6353e052006-12-08 18:07:09 +00002792/* Do appropriate processing given the current state. */
2793/* Read a lookahead token if we need one and don't already have one. */
2794/* yyresume: */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002795
Andrew Lenharth6353e052006-12-08 18:07:09 +00002796 /* First try to decide what to do without reference to lookahead token. */
2797
Reid Spencer68a24bd2005-08-27 18:50:39 +00002798 yyn = yypact[yystate];
Reid Spencer3822ff52006-11-08 06:47:33 +00002799 if (yyn == YYPACT_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002800 goto yydefault;
2801
Andrew Lenharth6353e052006-12-08 18:07:09 +00002802 /* Not known => get a lookahead token if don't already have one. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002803
Andrew Lenharth6353e052006-12-08 18:07:09 +00002804 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002805 if (yychar == YYEMPTY)
2806 {
Reid Spencer3822ff52006-11-08 06:47:33 +00002807 YYDPRINTF ((stderr, "Reading a token: "));
Reid Spencer68a24bd2005-08-27 18:50:39 +00002808 yychar = YYLEX;
2809 }
2810
Reid Spencer3822ff52006-11-08 06:47:33 +00002811 if (yychar <= YYEOF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002812 {
Reid Spencer3822ff52006-11-08 06:47:33 +00002813 yychar = yytoken = YYEOF;
2814 YYDPRINTF ((stderr, "Now at end of input.\n"));
Reid Spencer68a24bd2005-08-27 18:50:39 +00002815 }
2816 else
2817 {
Reid Spencer3822ff52006-11-08 06:47:33 +00002818 yytoken = YYTRANSLATE (yychar);
Andrew Lenharth6353e052006-12-08 18:07:09 +00002819 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
Reid Spencer68a24bd2005-08-27 18:50:39 +00002820 }
2821
Reid Spencer3822ff52006-11-08 06:47:33 +00002822 /* If the proper action on seeing token YYTOKEN is to reduce or to
2823 detect an error, take that action. */
2824 yyn += yytoken;
2825 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002826 goto yydefault;
2827 yyn = yytable[yyn];
Reid Spencer3822ff52006-11-08 06:47:33 +00002828 if (yyn <= 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002829 {
Reid Spencer3822ff52006-11-08 06:47:33 +00002830 if (yyn == 0 || yyn == YYTABLE_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002831 goto yyerrlab;
2832 yyn = -yyn;
2833 goto yyreduce;
2834 }
2835
2836 if (yyn == YYFINAL)
2837 YYACCEPT;
2838
Andrew Lenharth6353e052006-12-08 18:07:09 +00002839 /* Shift the lookahead token. */
2840 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
2841
2842 /* Discard the token being shifted unless it is eof. */
2843 if (yychar != YYEOF)
2844 yychar = YYEMPTY;
2845
2846 *++yyvsp = yylval;
2847
2848
Reid Spencer3822ff52006-11-08 06:47:33 +00002849 /* Count tokens shifted since error; after three, turn off error
2850 status. */
2851 if (yyerrstatus)
2852 yyerrstatus--;
Chris Lattner224f84f2006-08-18 17:34:45 +00002853
Reid Spencer68a24bd2005-08-27 18:50:39 +00002854 yystate = yyn;
2855 goto yynewstate;
2856
Chris Lattnerf49c1762006-11-08 05:58:47 +00002857
Reid Spencer3822ff52006-11-08 06:47:33 +00002858/*-----------------------------------------------------------.
2859| yydefault -- do the default action for the current state. |
2860`-----------------------------------------------------------*/
2861yydefault:
Reid Spencer68a24bd2005-08-27 18:50:39 +00002862 yyn = yydefact[yystate];
2863 if (yyn == 0)
2864 goto yyerrlab;
Reid Spencer3822ff52006-11-08 06:47:33 +00002865 goto yyreduce;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002866
Reid Spencer3822ff52006-11-08 06:47:33 +00002867
2868/*-----------------------------.
2869| yyreduce -- Do a reduction. |
2870`-----------------------------*/
Reid Spencer68a24bd2005-08-27 18:50:39 +00002871yyreduce:
Reid Spencer3822ff52006-11-08 06:47:33 +00002872 /* yyn is the number of a rule to reduce with. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002873 yylen = yyr2[yyn];
2874
Reid Spencer3822ff52006-11-08 06:47:33 +00002875 /* If YYLEN is nonzero, implement the default value of the action:
2876 `$$ = $1'.
2877
2878 Otherwise, the following line sets YYVAL to garbage.
2879 This behavior is undocumented and Bison
2880 users should not rely upon it. Assigning to YYVAL
2881 unconditionally makes the parser a bit smaller, and it avoids a
2882 GCC warning that YYVAL may be used uninitialized. */
2883 yyval = yyvsp[1-yylen];
2884
2885
2886 YY_REDUCE_PRINT (yyn);
2887 switch (yyn)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002888 {
Reid Spencer3822ff52006-11-08 06:47:33 +00002889 case 3:
Andrew Lenharth6353e052006-12-08 18:07:09 +00002890#line 991 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00002891 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00002892 if (yyvsp[0].UIntVal > (uint32_t)INT32_MAX) // Outside of my range!
Reid Spencer61c83e02006-08-18 08:43:06 +00002893 GEN_ERROR("Value too large for type!");
Andrew Lenharth6353e052006-12-08 18:07:09 +00002894 yyval.SIntVal = (int32_t)yyvsp[0].UIntVal;
Reid Spencer61c83e02006-08-18 08:43:06 +00002895 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00002896;}
2897 break;
2898
2899 case 5:
Andrew Lenharth6353e052006-12-08 18:07:09 +00002900#line 1000 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00002901 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00002902 if (yyvsp[0].UInt64Val > (uint64_t)INT64_MAX) // Outside of my range!
Reid Spencer61c83e02006-08-18 08:43:06 +00002903 GEN_ERROR("Value too large for type!");
Andrew Lenharth6353e052006-12-08 18:07:09 +00002904 yyval.SInt64Val = (int64_t)yyvsp[0].UInt64Val;
Reid Spencer61c83e02006-08-18 08:43:06 +00002905 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00002906;}
2907 break;
2908
Reid Spencer6e18b7d2006-12-03 06:59:29 +00002909 case 39:
Andrew Lenharth6353e052006-12-08 18:07:09 +00002910#line 1017 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
2911 { yyval.IPredicate = ICmpInst::ICMP_EQ; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00002912 break;
2913
2914 case 40:
Andrew Lenharth6353e052006-12-08 18:07:09 +00002915#line 1017 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
2916 { yyval.IPredicate = ICmpInst::ICMP_NE; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00002917 break;
2918
2919 case 41:
Andrew Lenharth6353e052006-12-08 18:07:09 +00002920#line 1018 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
2921 { yyval.IPredicate = ICmpInst::ICMP_SLT; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00002922 break;
2923
2924 case 42:
Andrew Lenharth6353e052006-12-08 18:07:09 +00002925#line 1018 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
2926 { yyval.IPredicate = ICmpInst::ICMP_SGT; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00002927 break;
2928
2929 case 43:
Andrew Lenharth6353e052006-12-08 18:07:09 +00002930#line 1019 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
2931 { yyval.IPredicate = ICmpInst::ICMP_SLE; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00002932 break;
2933
2934 case 44:
Andrew Lenharth6353e052006-12-08 18:07:09 +00002935#line 1019 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
2936 { yyval.IPredicate = ICmpInst::ICMP_SGE; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00002937 break;
2938
2939 case 45:
Andrew Lenharth6353e052006-12-08 18:07:09 +00002940#line 1020 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
2941 { yyval.IPredicate = ICmpInst::ICMP_ULT; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00002942 break;
2943
2944 case 46:
Andrew Lenharth6353e052006-12-08 18:07:09 +00002945#line 1020 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
2946 { yyval.IPredicate = ICmpInst::ICMP_UGT; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00002947 break;
2948
2949 case 47:
Andrew Lenharth6353e052006-12-08 18:07:09 +00002950#line 1021 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
2951 { yyval.IPredicate = ICmpInst::ICMP_ULE; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00002952 break;
2953
2954 case 48:
Andrew Lenharth6353e052006-12-08 18:07:09 +00002955#line 1021 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
2956 { yyval.IPredicate = ICmpInst::ICMP_UGE; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00002957 break;
2958
2959 case 49:
Andrew Lenharth6353e052006-12-08 18:07:09 +00002960#line 1025 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
2961 { yyval.FPredicate = FCmpInst::FCMP_OEQ; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00002962 break;
2963
2964 case 50:
Andrew Lenharth6353e052006-12-08 18:07:09 +00002965#line 1025 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
2966 { yyval.FPredicate = FCmpInst::FCMP_ONE; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00002967 break;
2968
2969 case 51:
Andrew Lenharth6353e052006-12-08 18:07:09 +00002970#line 1026 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
2971 { yyval.FPredicate = FCmpInst::FCMP_OLT; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00002972 break;
2973
2974 case 52:
Andrew Lenharth6353e052006-12-08 18:07:09 +00002975#line 1026 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
2976 { yyval.FPredicate = FCmpInst::FCMP_OGT; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00002977 break;
2978
2979 case 53:
Andrew Lenharth6353e052006-12-08 18:07:09 +00002980#line 1027 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
2981 { yyval.FPredicate = FCmpInst::FCMP_OLE; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00002982 break;
2983
2984 case 54:
Andrew Lenharth6353e052006-12-08 18:07:09 +00002985#line 1027 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
2986 { yyval.FPredicate = FCmpInst::FCMP_OGE; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00002987 break;
2988
2989 case 55:
Andrew Lenharth6353e052006-12-08 18:07:09 +00002990#line 1028 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
2991 { yyval.FPredicate = FCmpInst::FCMP_ORD; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00002992 break;
2993
2994 case 56:
Andrew Lenharth6353e052006-12-08 18:07:09 +00002995#line 1028 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
2996 { yyval.FPredicate = FCmpInst::FCMP_UNO; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00002997 break;
2998
2999 case 57:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003000#line 1029 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3001 { yyval.FPredicate = FCmpInst::FCMP_UEQ; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003002 break;
3003
3004 case 58:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003005#line 1029 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3006 { yyval.FPredicate = FCmpInst::FCMP_UNE; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003007 break;
3008
3009 case 59:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003010#line 1030 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3011 { yyval.FPredicate = FCmpInst::FCMP_ULT; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003012 break;
3013
3014 case 60:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003015#line 1030 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3016 { yyval.FPredicate = FCmpInst::FCMP_UGT; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003017 break;
3018
3019 case 61:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003020#line 1031 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3021 { yyval.FPredicate = FCmpInst::FCMP_ULE; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003022 break;
3023
3024 case 62:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003025#line 1031 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3026 { yyval.FPredicate = FCmpInst::FCMP_UGE; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003027 break;
3028
3029 case 63:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003030#line 1032 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3031 { yyval.FPredicate = FCmpInst::FCMP_TRUE; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003032 break;
3033
3034 case 64:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003035#line 1033 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3036 { yyval.FPredicate = FCmpInst::FCMP_FALSE; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003037 break;
3038
3039 case 77:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003040#line 1044 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003041 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003042 yyval.StrVal = yyvsp[-1].StrVal;
Reid Spencer61c83e02006-08-18 08:43:06 +00003043 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003044 ;}
3045 break;
3046
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003047 case 78:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003048#line 1048 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003049 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003050 yyval.StrVal = 0;
Reid Spencer61c83e02006-08-18 08:43:06 +00003051 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003052 ;}
3053 break;
3054
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003055 case 79:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003056#line 1053 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3057 { yyval.Linkage = GlobalValue::InternalLinkage; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003058 break;
3059
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003060 case 80:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003061#line 1054 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3062 { yyval.Linkage = GlobalValue::LinkOnceLinkage; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003063 break;
3064
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003065 case 81:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003066#line 1055 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3067 { yyval.Linkage = GlobalValue::WeakLinkage; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003068 break;
3069
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003070 case 82:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003071#line 1056 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3072 { yyval.Linkage = GlobalValue::AppendingLinkage; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003073 break;
3074
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003075 case 83:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003076#line 1057 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3077 { yyval.Linkage = GlobalValue::DLLImportLinkage; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003078 break;
3079
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003080 case 84:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003081#line 1058 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3082 { yyval.Linkage = GlobalValue::DLLExportLinkage; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003083 break;
3084
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003085 case 85:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003086#line 1059 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3087 { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003088 break;
3089
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003090 case 86:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003091#line 1060 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3092 { yyval.Linkage = GlobalValue::ExternalLinkage; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003093 break;
3094
Reid Spencera132e042006-12-03 05:46:11 +00003095 case 87:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003096#line 1062 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3097 { yyval.UIntVal = CallingConv::C; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003098 break;
3099
Reid Spencera132e042006-12-03 05:46:11 +00003100 case 88:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003101#line 1063 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3102 { yyval.UIntVal = CallingConv::C; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003103 break;
3104
Reid Spencera132e042006-12-03 05:46:11 +00003105 case 89:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003106#line 1064 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3107 { yyval.UIntVal = CallingConv::CSRet; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003108 break;
3109
Reid Spencera132e042006-12-03 05:46:11 +00003110 case 90:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003111#line 1065 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3112 { yyval.UIntVal = CallingConv::Fast; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003113 break;
3114
Reid Spencera132e042006-12-03 05:46:11 +00003115 case 91:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003116#line 1066 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3117 { yyval.UIntVal = CallingConv::Cold; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003118 break;
3119
Reid Spencera132e042006-12-03 05:46:11 +00003120 case 92:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003121#line 1067 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3122 { yyval.UIntVal = CallingConv::X86_StdCall; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003123 break;
3124
3125 case 93:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003126#line 1068 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3127 { yyval.UIntVal = CallingConv::X86_FastCall; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003128 break;
3129
3130 case 94:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003131#line 1069 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003132 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003133 if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val)
Reid Spencer61c83e02006-08-18 08:43:06 +00003134 GEN_ERROR("Calling conv too large!");
Andrew Lenharth6353e052006-12-08 18:07:09 +00003135 yyval.UIntVal = yyvsp[0].UInt64Val;
Reid Spencer61c83e02006-08-18 08:43:06 +00003136 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003137 ;}
3138 break;
3139
Reid Spencera132e042006-12-03 05:46:11 +00003140 case 95:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003141#line 1078 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3142 { yyval.UIntVal = 0; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003143 break;
3144
Reid Spencera132e042006-12-03 05:46:11 +00003145 case 96:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003146#line 1079 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003147 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003148 yyval.UIntVal = yyvsp[0].UInt64Val;
3149 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
Reid Spencer3ed469c2006-11-02 20:25:50 +00003150 GEN_ERROR("Alignment must be a power of two!");
3151 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003152;}
3153 break;
3154
Reid Spencera132e042006-12-03 05:46:11 +00003155 case 97:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003156#line 1085 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3157 { yyval.UIntVal = 0; ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003158 break;
3159
3160 case 98:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003161#line 1086 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003162 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003163 yyval.UIntVal = yyvsp[0].UInt64Val;
3164 if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003165 GEN_ERROR("Alignment must be a power of two!");
3166 CHECK_FOR_ERROR
3167;}
3168 break;
3169
3170 case 99:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003171#line 1094 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003172 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003173 for (unsigned i = 0, e = strlen(yyvsp[0].StrVal); i != e; ++i)
3174 if (yyvsp[0].StrVal[i] == '"' || yyvsp[0].StrVal[i] == '\\')
Reid Spencer61c83e02006-08-18 08:43:06 +00003175 GEN_ERROR("Invalid character in section name!");
Andrew Lenharth6353e052006-12-08 18:07:09 +00003176 yyval.StrVal = yyvsp[0].StrVal;
Reid Spencer61c83e02006-08-18 08:43:06 +00003177 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003178;}
3179 break;
3180
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003181 case 100:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003182#line 1102 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3183 { yyval.StrVal = 0; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003184 break;
3185
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003186 case 101:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003187#line 1103 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3188 { yyval.StrVal = yyvsp[0].StrVal; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003189 break;
3190
Reid Spencera132e042006-12-03 05:46:11 +00003191 case 102:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003192#line 1108 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003193 {;}
3194 break;
3195
3196 case 103:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003197#line 1109 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003198 {;}
3199 break;
3200
3201 case 104:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003202#line 1110 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003203 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003204 CurGV->setSection(yyvsp[0].StrVal);
3205 free(yyvsp[0].StrVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00003206 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003207 ;}
3208 break;
3209
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003210 case 105:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003211#line 1115 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003212 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003213 if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val))
Reid Spencer61c83e02006-08-18 08:43:06 +00003214 GEN_ERROR("Alignment must be a power of two!");
Andrew Lenharth6353e052006-12-08 18:07:09 +00003215 CurGV->setAlignment(yyvsp[0].UInt64Val);
Reid Spencer61c83e02006-08-18 08:43:06 +00003216 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003217 ;}
3218 break;
3219
Reid Spencera132e042006-12-03 05:46:11 +00003220 case 107:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003221#line 1129 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3222 { yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003223 break;
3224
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003225 case 109:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003226#line 1130 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3227 { yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003228 break;
3229
3230 case 110:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003231#line 1132 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003232 {
Reid Spencer3da59db2006-11-27 01:05:10 +00003233 if (!UpRefs.empty())
Andrew Lenharth6353e052006-12-08 18:07:09 +00003234 GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
3235 yyval.TypeVal = yyvsp[0].TypeVal;
Reid Spencer61c83e02006-08-18 08:43:06 +00003236 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003237 ;}
3238 break;
3239
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003240 case 124:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003241#line 1144 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencera132e042006-12-03 05:46:11 +00003242 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003243 yyval.TypeVal = new PATypeHolder(OpaqueType::get());
Reid Spencera132e042006-12-03 05:46:11 +00003244 CHECK_FOR_ERROR
3245 ;}
3246 break;
3247
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003248 case 125:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003249#line 1148 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencera132e042006-12-03 05:46:11 +00003250 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003251 yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType);
Reid Spencera132e042006-12-03 05:46:11 +00003252 CHECK_FOR_ERROR
3253 ;}
3254 break;
3255
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003256 case 126:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003257#line 1152 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3da59db2006-11-27 01:05:10 +00003258 { // Named types are also simple types...
Andrew Lenharth6353e052006-12-08 18:07:09 +00003259 const Type* tmp = getTypeVal(yyvsp[0].ValIDVal);
Reid Spencer3da59db2006-11-27 01:05:10 +00003260 CHECK_FOR_ERROR
Andrew Lenharth6353e052006-12-08 18:07:09 +00003261 yyval.TypeVal = new PATypeHolder(tmp);
Reid Spencer3da59db2006-11-27 01:05:10 +00003262;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003263 break;
3264
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003265 case 127:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003266#line 1160 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3da59db2006-11-27 01:05:10 +00003267 { // Type UpReference
Andrew Lenharth6353e052006-12-08 18:07:09 +00003268 if (yyvsp[0].UInt64Val > (uint64_t)~0U) GEN_ERROR("Value out of range!");
Reid Spencer3da59db2006-11-27 01:05:10 +00003269 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Andrew Lenharth6353e052006-12-08 18:07:09 +00003270 UpRefs.push_back(UpRefRecord((unsigned)yyvsp[0].UInt64Val, OT)); // Add to vector...
3271 yyval.TypeVal = new PATypeHolder(OT);
Reid Spencer3da59db2006-11-27 01:05:10 +00003272 UR_OUT("New Upreference!\n");
Reid Spencer61c83e02006-08-18 08:43:06 +00003273 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003274 ;}
3275 break;
3276
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003277 case 128:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003278#line 1168 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3da59db2006-11-27 01:05:10 +00003279 { // Function derived type?
3280 std::vector<const Type*> Params;
Andrew Lenharth6353e052006-12-08 18:07:09 +00003281 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-1].TypeList->begin(),
3282 E = yyvsp[-1].TypeList->end(); I != E; ++I)
Reid Spencera132e042006-12-03 05:46:11 +00003283 Params.push_back(*I);
Reid Spencer3da59db2006-11-27 01:05:10 +00003284 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3285 if (isVarArg) Params.pop_back();
3286
Andrew Lenharth6353e052006-12-08 18:07:09 +00003287 yyval.TypeVal = new PATypeHolder(HandleUpRefs(FunctionType::get(*yyvsp[-3].TypeVal,Params,isVarArg)));
3288 delete yyvsp[-1].TypeList; // Delete the argument list
3289 delete yyvsp[-3].TypeVal; // Delete the return type handle
Reid Spencer3da59db2006-11-27 01:05:10 +00003290 CHECK_FOR_ERROR
3291 ;}
3292 break;
3293
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003294 case 129:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003295#line 1181 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3da59db2006-11-27 01:05:10 +00003296 { // Sized array type?
Andrew Lenharth6353e052006-12-08 18:07:09 +00003297 yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
3298 delete yyvsp[-1].TypeVal;
Reid Spencer3da59db2006-11-27 01:05:10 +00003299 CHECK_FOR_ERROR
3300 ;}
3301 break;
3302
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003303 case 130:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003304#line 1186 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3da59db2006-11-27 01:05:10 +00003305 { // Packed array type?
Andrew Lenharth6353e052006-12-08 18:07:09 +00003306 const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get();
3307 if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val)
Reid Spencera132e042006-12-03 05:46:11 +00003308 GEN_ERROR("Unsigned result not equal to signed result");
3309 if (!ElemTy->isPrimitiveType())
3310 GEN_ERROR("Elemental type of a PackedType must be primitive");
Andrew Lenharth6353e052006-12-08 18:07:09 +00003311 if (!isPowerOf2_32(yyvsp[-3].UInt64Val))
Reid Spencera132e042006-12-03 05:46:11 +00003312 GEN_ERROR("Vector length should be a power of 2!");
Andrew Lenharth6353e052006-12-08 18:07:09 +00003313 yyval.TypeVal = new PATypeHolder(HandleUpRefs(PackedType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
3314 delete yyvsp[-1].TypeVal;
Reid Spencera132e042006-12-03 05:46:11 +00003315 CHECK_FOR_ERROR
Reid Spencer3da59db2006-11-27 01:05:10 +00003316 ;}
3317 break;
3318
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003319 case 131:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003320#line 1198 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3da59db2006-11-27 01:05:10 +00003321 { // Structure type?
3322 std::vector<const Type*> Elements;
Andrew Lenharth6353e052006-12-08 18:07:09 +00003323 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-1].TypeList->begin(),
3324 E = yyvsp[-1].TypeList->end(); I != E; ++I)
Reid Spencera132e042006-12-03 05:46:11 +00003325 Elements.push_back(*I);
Reid Spencer3da59db2006-11-27 01:05:10 +00003326
Andrew Lenharth6353e052006-12-08 18:07:09 +00003327 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
3328 delete yyvsp[-1].TypeList;
Reid Spencer3da59db2006-11-27 01:05:10 +00003329 CHECK_FOR_ERROR
3330 ;}
3331 break;
3332
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003333 case 132:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003334#line 1208 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3da59db2006-11-27 01:05:10 +00003335 { // Empty structure type?
Andrew Lenharth6353e052006-12-08 18:07:09 +00003336 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Reid Spencer3da59db2006-11-27 01:05:10 +00003337 CHECK_FOR_ERROR
3338 ;}
3339 break;
3340
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003341 case 133:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003342#line 1212 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3343 {
3344 std::vector<const Type*> Elements;
3345 for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-2].TypeList->begin(),
3346 E = yyvsp[-2].TypeList->end(); I != E; ++I)
3347 Elements.push_back(*I);
3348
3349 yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
3350 delete yyvsp[-2].TypeList;
Reid Spencer3da59db2006-11-27 01:05:10 +00003351 CHECK_FOR_ERROR
3352 ;}
3353 break;
3354
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003355 case 134:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003356#line 1222 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3357 { // Empty structure type?
3358 yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
Reid Spencer3da59db2006-11-27 01:05:10 +00003359 CHECK_FOR_ERROR
3360 ;}
3361 break;
3362
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003363 case 135:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003364#line 1226 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3365 { // Pointer type?
3366 if (*yyvsp[-1].TypeVal == Type::LabelTy)
3367 GEN_ERROR("Cannot form a pointer to a basic block");
3368 yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-1].TypeVal)));
3369 delete yyvsp[-1].TypeVal;
3370 CHECK_FOR_ERROR
3371 ;}
3372 break;
3373
3374 case 136:
3375#line 1237 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3da59db2006-11-27 01:05:10 +00003376 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003377 yyval.TypeList = new std::list<PATypeHolder>();
3378 yyval.TypeList->push_back(*yyvsp[0].TypeVal); delete yyvsp[0].TypeVal;
Reid Spencer3da59db2006-11-27 01:05:10 +00003379 CHECK_FOR_ERROR
3380 ;}
3381 break;
3382
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003383 case 137:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003384#line 1242 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3da59db2006-11-27 01:05:10 +00003385 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003386 (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal); delete yyvsp[0].TypeVal;
Reid Spencer3da59db2006-11-27 01:05:10 +00003387 CHECK_FOR_ERROR
3388 ;}
3389 break;
3390
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003391 case 139:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003392#line 1249 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3da59db2006-11-27 01:05:10 +00003393 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003394 (yyval.TypeList=yyvsp[-2].TypeList)->push_back(Type::VoidTy);
Reid Spencer3da59db2006-11-27 01:05:10 +00003395 CHECK_FOR_ERROR
3396 ;}
3397 break;
3398
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003399 case 140:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003400#line 1253 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3401 {
3402 (yyval.TypeList = new std::list<PATypeHolder>())->push_back(Type::VoidTy);
Reid Spencer61c83e02006-08-18 08:43:06 +00003403 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003404 ;}
3405 break;
3406
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003407 case 141:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003408#line 1257 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003409 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003410 yyval.TypeList = new std::list<PATypeHolder>();
Reid Spencer61c83e02006-08-18 08:43:06 +00003411 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003412 ;}
3413 break;
3414
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003415 case 142:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003416#line 1268 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3417 { // Nonempty unsized arr
3418 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-3].TypeVal->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00003419 if (ATy == 0)
Reid Spencer61c83e02006-08-18 08:43:06 +00003420 GEN_ERROR("Cannot make array constant with type: '" +
Andrew Lenharth6353e052006-12-08 18:07:09 +00003421 (*yyvsp[-3].TypeVal)->getDescription() + "'!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00003422 const Type *ETy = ATy->getElementType();
Andrew Lenharth6353e052006-12-08 18:07:09 +00003423 int NumElements = ATy->getNumElements();
3424
3425 // Verify that we have the correct size...
3426 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
3427 GEN_ERROR("Type mismatch: constant sized array initialized with " +
3428 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
3429 itostr(NumElements) + "!");
3430
3431 // Verify all elements are correct type!
3432 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3433 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
3434 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3435 ETy->getDescription() +"' as required!\nIt is of type '"+
3436 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
Reid Spencer68a24bd2005-08-27 18:50:39 +00003437 }
Andrew Lenharth6353e052006-12-08 18:07:09 +00003438
3439 yyval.ConstVal = ConstantArray::get(ATy, *yyvsp[-1].ConstVector);
3440 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
Reid Spencer61c83e02006-08-18 08:43:06 +00003441 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003442 ;}
3443 break;
3444
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003445 case 143:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003446#line 1294 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3447 {
3448 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
3449 if (ATy == 0)
3450 GEN_ERROR("Cannot make array constant with type: '" +
3451 (*yyvsp[-2].TypeVal)->getDescription() + "'!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00003452
Andrew Lenharth6353e052006-12-08 18:07:09 +00003453 int NumElements = ATy->getNumElements();
3454 if (NumElements != -1 && NumElements != 0)
3455 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3456 " arguments, but has size of " + itostr(NumElements) +"!");
3457 yyval.ConstVal = ConstantArray::get(ATy, std::vector<Constant*>());
3458 delete yyvsp[-2].TypeVal;
Reid Spencer61c83e02006-08-18 08:43:06 +00003459 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003460 ;}
3461 break;
3462
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003463 case 144:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003464#line 1308 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003465 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003466 const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
3467 if (ATy == 0)
3468 GEN_ERROR("Cannot make array constant with type: '" +
3469 (*yyvsp[-2].TypeVal)->getDescription() + "'!");
Reid Spencer61c83e02006-08-18 08:43:06 +00003470
Andrew Lenharth6353e052006-12-08 18:07:09 +00003471 int NumElements = ATy->getNumElements();
3472 const Type *ETy = ATy->getElementType();
3473 char *EndStr = UnEscapeLexed(yyvsp[0].StrVal, true);
3474 if (NumElements != -1 && NumElements != (EndStr-yyvsp[0].StrVal))
3475 GEN_ERROR("Can't build string constant of size " +
3476 itostr((int)(EndStr-yyvsp[0].StrVal)) +
3477 " when array has size " + itostr(NumElements) + "!");
3478 std::vector<Constant*> Vals;
3479 if (ETy == Type::SByteTy) {
3480 for (signed char *C = (signed char *)yyvsp[0].StrVal; C != (signed char *)EndStr; ++C)
3481 Vals.push_back(ConstantInt::get(ETy, *C));
3482 } else if (ETy == Type::UByteTy) {
3483 for (unsigned char *C = (unsigned char *)yyvsp[0].StrVal;
3484 C != (unsigned char*)EndStr; ++C)
3485 Vals.push_back(ConstantInt::get(ETy, *C));
3486 } else {
3487 free(yyvsp[0].StrVal);
3488 GEN_ERROR("Cannot build string arrays of non byte sized elements!");
3489 }
3490 free(yyvsp[0].StrVal);
3491 yyval.ConstVal = ConstantArray::get(ATy, Vals);
3492 delete yyvsp[-2].TypeVal;
Reid Spencer61c83e02006-08-18 08:43:06 +00003493 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003494 ;}
3495 break;
3496
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003497 case 145:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003498#line 1338 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3499 { // Nonempty unsized arr
3500 const PackedType *PTy = dyn_cast<PackedType>(yyvsp[-3].TypeVal->get());
3501 if (PTy == 0)
3502 GEN_ERROR("Cannot make packed constant with type: '" +
3503 (*yyvsp[-3].TypeVal)->getDescription() + "'!");
3504 const Type *ETy = PTy->getElementType();
3505 int NumElements = PTy->getNumElements();
Reid Spencer68a24bd2005-08-27 18:50:39 +00003506
Andrew Lenharth6353e052006-12-08 18:07:09 +00003507 // Verify that we have the correct size...
3508 if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
3509 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
3510 utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " +
3511 itostr(NumElements) + "!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00003512
Andrew Lenharth6353e052006-12-08 18:07:09 +00003513 // Verify all elements are correct type!
3514 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
3515 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
3516 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3517 ETy->getDescription() +"' as required!\nIt is of type '"+
3518 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
3519 }
3520
3521 yyval.ConstVal = ConstantPacked::get(PTy, *yyvsp[-1].ConstVector);
3522 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
Reid Spencer61c83e02006-08-18 08:43:06 +00003523 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003524 ;}
3525 break;
3526
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003527 case 146:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003528#line 1364 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003529 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003530 const StructType *STy = dyn_cast<StructType>(yyvsp[-3].TypeVal->get());
3531 if (STy == 0)
3532 GEN_ERROR("Cannot make struct constant with type: '" +
3533 (*yyvsp[-3].TypeVal)->getDescription() + "'!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00003534
Andrew Lenharth6353e052006-12-08 18:07:09 +00003535 if (yyvsp[-1].ConstVector->size() != STy->getNumContainedTypes())
3536 GEN_ERROR("Illegal number of initializers for structure type!");
3537
3538 // Check to ensure that constants are compatible with the type initializer!
3539 for (unsigned i = 0, e = yyvsp[-1].ConstVector->size(); i != e; ++i)
3540 if ((*yyvsp[-1].ConstVector)[i]->getType() != STy->getElementType(i))
3541 GEN_ERROR("Expected type '" +
3542 STy->getElementType(i)->getDescription() +
3543 "' for element #" + utostr(i) +
3544 " of structure initializer!");
3545
3546 yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-1].ConstVector);
3547 delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
Reid Spencer61c83e02006-08-18 08:43:06 +00003548 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003549 ;}
3550 break;
3551
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003552 case 147:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003553#line 1385 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003554 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003555 const StructType *STy = dyn_cast<StructType>(yyvsp[-2].TypeVal->get());
3556 if (STy == 0)
3557 GEN_ERROR("Cannot make struct constant with type: '" +
3558 (*yyvsp[-2].TypeVal)->getDescription() + "'!");
3559
3560 if (STy->getNumContainedTypes() != 0)
3561 GEN_ERROR("Illegal number of initializers for structure type!");
3562
3563 yyval.ConstVal = ConstantStruct::get(STy, std::vector<Constant*>());
3564 delete yyvsp[-2].TypeVal;
Reid Spencer61c83e02006-08-18 08:43:06 +00003565 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003566 ;}
3567 break;
3568
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003569 case 148:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003570#line 1398 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003571 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003572 const PointerType *PTy = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
3573 if (PTy == 0)
3574 GEN_ERROR("Cannot make null pointer constant with type: '" +
3575 (*yyvsp[-1].TypeVal)->getDescription() + "'!");
3576
3577 yyval.ConstVal = ConstantPointerNull::get(PTy);
3578 delete yyvsp[-1].TypeVal;
3579 CHECK_FOR_ERROR
3580 ;}
3581 break;
3582
3583 case 149:
3584#line 1408 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3585 {
3586 yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get());
3587 delete yyvsp[-1].TypeVal;
3588 CHECK_FOR_ERROR
3589 ;}
3590 break;
3591
3592 case 150:
3593#line 1413 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3594 {
3595 const PointerType *Ty = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00003596 if (Ty == 0)
Reid Spencer61c83e02006-08-18 08:43:06 +00003597 GEN_ERROR("Global const reference must be a pointer type!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00003598
3599 // ConstExprs can exist in the body of a function, thus creating
3600 // GlobalValues whenever they refer to a variable. Because we are in
3601 // the context of a function, getValNonImprovising will search the functions
3602 // symbol table instead of the module symbol table for the global symbol,
3603 // which throws things all off. To get around this, we just tell
3604 // getValNonImprovising that we are at global scope here.
3605 //
3606 Function *SavedCurFn = CurFun.CurrentFunction;
3607 CurFun.CurrentFunction = 0;
3608
Andrew Lenharth6353e052006-12-08 18:07:09 +00003609 Value *V = getValNonImprovising(Ty, yyvsp[0].ValIDVal);
Reid Spencer5b7e7532006-09-28 19:28:24 +00003610 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00003611
3612 CurFun.CurrentFunction = SavedCurFn;
3613
3614 // If this is an initializer for a constant pointer, which is referencing a
3615 // (currently) undefined variable, create a stub now that shall be replaced
3616 // in the future with the right type of variable.
3617 //
3618 if (V == 0) {
3619 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3620 const PointerType *PT = cast<PointerType>(Ty);
3621
3622 // First check to see if the forward references value is already created!
3623 PerModuleInfo::GlobalRefsType::iterator I =
Andrew Lenharth6353e052006-12-08 18:07:09 +00003624 CurModule.GlobalRefs.find(std::make_pair(PT, yyvsp[0].ValIDVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003625
3626 if (I != CurModule.GlobalRefs.end()) {
3627 V = I->second; // Placeholder already exists, use it...
Andrew Lenharth6353e052006-12-08 18:07:09 +00003628 yyvsp[0].ValIDVal.destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +00003629 } else {
3630 std::string Name;
Andrew Lenharth6353e052006-12-08 18:07:09 +00003631 if (yyvsp[0].ValIDVal.Type == ValID::NameVal) Name = yyvsp[0].ValIDVal.Name;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003632
3633 // Create the forward referenced global.
3634 GlobalValue *GV;
3635 if (const FunctionType *FTy =
3636 dyn_cast<FunctionType>(PT->getElementType())) {
3637 GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
3638 CurModule.CurrentModule);
3639 } else {
3640 GV = new GlobalVariable(PT->getElementType(), false,
3641 GlobalValue::ExternalLinkage, 0,
3642 Name, CurModule.CurrentModule);
3643 }
3644
3645 // Keep track of the fact that we have a forward ref to recycle it
Andrew Lenharth6353e052006-12-08 18:07:09 +00003646 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, yyvsp[0].ValIDVal), GV));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003647 V = GV;
3648 }
3649 }
3650
Andrew Lenharth6353e052006-12-08 18:07:09 +00003651 yyval.ConstVal = cast<GlobalValue>(V);
3652 delete yyvsp[-1].TypeVal; // Free the type handle
Reid Spencer61c83e02006-08-18 08:43:06 +00003653 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003654 ;}
3655 break;
3656
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003657 case 151:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003658#line 1474 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3659 {
3660 if (yyvsp[-1].TypeVal->get() != yyvsp[0].ConstVal->getType())
3661 GEN_ERROR("Mismatched types for constant expression!");
3662 yyval.ConstVal = yyvsp[0].ConstVal;
3663 delete yyvsp[-1].TypeVal;
Reid Spencer61c83e02006-08-18 08:43:06 +00003664 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003665 ;}
3666 break;
3667
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003668 case 152:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003669#line 1481 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3670 {
3671 const Type *Ty = yyvsp[-1].TypeVal->get();
3672 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
3673 GEN_ERROR("Cannot create a null initialized value of this type!");
3674 yyval.ConstVal = Constant::getNullValue(Ty);
3675 delete yyvsp[-1].TypeVal;
Reid Spencer61c83e02006-08-18 08:43:06 +00003676 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003677 ;}
3678 break;
3679
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003680 case 153:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003681#line 1489 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3682 { // integral constants
3683 if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val))
3684 GEN_ERROR("Constant value doesn't fit in type!");
3685 yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].SInt64Val);
Reid Spencer61c83e02006-08-18 08:43:06 +00003686 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003687 ;}
3688 break;
3689
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003690 case 154:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003691#line 1495 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3692 { // integral constants
3693 if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val))
3694 GEN_ERROR("Constant value doesn't fit in type!");
3695 yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].UInt64Val);
Reid Spencer61c83e02006-08-18 08:43:06 +00003696 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003697 ;}
3698 break;
3699
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003700 case 155:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003701#line 1501 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3702 { // Boolean constants
3703 yyval.ConstVal = ConstantBool::getTrue();
Reid Spencer61c83e02006-08-18 08:43:06 +00003704 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003705 ;}
3706 break;
3707
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003708 case 156:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003709#line 1505 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3710 { // Boolean constants
3711 yyval.ConstVal = ConstantBool::getFalse();
3712 CHECK_FOR_ERROR
3713 ;}
3714 break;
3715
3716 case 157:
3717#line 1509 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3718 { // Float & Double constants
3719 if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].FPVal))
3720 GEN_ERROR("Floating point constant invalid for type!!");
3721 yyval.ConstVal = ConstantFP::get(yyvsp[-1].PrimType, yyvsp[0].FPVal);
3722 CHECK_FOR_ERROR
3723 ;}
3724 break;
3725
3726 case 158:
3727#line 1517 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003728 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003729 Constant *Val = yyvsp[-3].ConstVal;
3730 const Type *Ty = yyvsp[-1].TypeVal->get();
Reid Spencer3da59db2006-11-27 01:05:10 +00003731 if (!Val->getType()->isFirstClassType())
Reid Spencer61c83e02006-08-18 08:43:06 +00003732 GEN_ERROR("cast constant expression from a non-primitive type: '" +
Reid Spencer3da59db2006-11-27 01:05:10 +00003733 Val->getType()->getDescription() + "'!");
3734 if (!Ty->isFirstClassType())
Reid Spencer61c83e02006-08-18 08:43:06 +00003735 GEN_ERROR("cast constant expression to a non-primitive type: '" +
Reid Spencer3da59db2006-11-27 01:05:10 +00003736 Ty->getDescription() + "'!");
Andrew Lenharth6353e052006-12-08 18:07:09 +00003737 yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, yyvsp[-1].TypeVal->get());
3738 delete yyvsp[-1].TypeVal;
Reid Spencer3822ff52006-11-08 06:47:33 +00003739 ;}
3740 break;
3741
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003742 case 159:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003743#line 1529 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003744 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003745 if (!isa<PointerType>(yyvsp[-2].ConstVal->getType()))
3746 GEN_ERROR("GetElementPtr requires a pointer operand!");
3747
3748 const Type *IdxTy =
3749 GetElementPtrInst::getIndexedType(yyvsp[-2].ConstVal->getType(), *yyvsp[-1].ValueList, true);
3750 if (!IdxTy)
3751 GEN_ERROR("Index list invalid for constant getelementptr!");
3752
3753 std::vector<Constant*> IdxVec;
3754 for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e; ++i)
3755 if (Constant *C = dyn_cast<Constant>((*yyvsp[-1].ValueList)[i]))
3756 IdxVec.push_back(C);
3757 else
3758 GEN_ERROR("Indices to constant getelementptr must be constants!");
3759
3760 delete yyvsp[-1].ValueList;
3761
3762 yyval.ConstVal = ConstantExpr::getGetElementPtr(yyvsp[-2].ConstVal, IdxVec);
3763 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003764 ;}
3765 break;
3766
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003767 case 160:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003768#line 1550 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003769 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003770 if (yyvsp[-5].ConstVal->getType() != Type::BoolTy)
3771 GEN_ERROR("Select condition must be of boolean type!");
3772 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3773 GEN_ERROR("Select operand types must match!");
3774 yyval.ConstVal = ConstantExpr::getSelect(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00003775 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003776 ;}
3777 break;
3778
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003779 case 161:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003780#line 1558 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003781 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003782 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3783 GEN_ERROR("Binary operator types must match!");
3784 CHECK_FOR_ERROR;
3785 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
Reid Spencer3822ff52006-11-08 06:47:33 +00003786 ;}
3787 break;
3788
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003789 case 162:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003790#line 1564 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003791 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003792 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3793 GEN_ERROR("Logical operator types must match!");
3794 if (!yyvsp[-3].ConstVal->getType()->isIntegral()) {
3795 if (!isa<PackedType>(yyvsp[-3].ConstVal->getType()) ||
3796 !cast<PackedType>(yyvsp[-3].ConstVal->getType())->getElementType()->isIntegral())
3797 GEN_ERROR("Logical operator requires integral operands!");
3798 }
3799 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3800 CHECK_FOR_ERROR
Reid Spencera132e042006-12-03 05:46:11 +00003801 ;}
3802 break;
3803
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003804 case 163:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003805#line 1575 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencera132e042006-12-03 05:46:11 +00003806 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003807 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3808 GEN_ERROR("setcc operand types must match!");
3809 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
3810 CHECK_FOR_ERROR
Reid Spencera132e042006-12-03 05:46:11 +00003811 ;}
3812 break;
3813
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003814 case 164:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003815#line 1581 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencera132e042006-12-03 05:46:11 +00003816 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003817 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3818 GEN_ERROR("icmp operand types must match!");
3819 yyval.ConstVal = ConstantExpr::getICmp(yyvsp[-5].IPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
Reid Spencer3822ff52006-11-08 06:47:33 +00003820 ;}
3821 break;
3822
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003823 case 165:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003824#line 1586 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003825 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003826 if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
3827 GEN_ERROR("fcmp operand types must match!");
3828 yyval.ConstVal = ConstantExpr::getFCmp(yyvsp[-5].FPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
Reid Spencer3822ff52006-11-08 06:47:33 +00003829 ;}
3830 break;
3831
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003832 case 166:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003833#line 1591 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003834 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003835 if (yyvsp[-1].ConstVal->getType() != Type::UByteTy)
3836 GEN_ERROR("Shift count for shift constant must be unsigned byte!");
3837 if (!yyvsp[-3].ConstVal->getType()->isInteger())
3838 GEN_ERROR("Shift constant expression requires integer operand!");
3839 CHECK_FOR_ERROR;
3840 yyval.ConstVal = ConstantExpr::get(yyvsp[-5].OtherOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00003841 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003842 ;}
3843 break;
3844
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003845 case 167:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003846#line 1600 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003847 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003848 if (!ExtractElementInst::isValidOperands(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3849 GEN_ERROR("Invalid extractelement operands!");
3850 yyval.ConstVal = ConstantExpr::getExtractElement(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00003851 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003852 ;}
3853 break;
3854
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003855 case 168:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003856#line 1606 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003857 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003858 if (!InsertElementInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3859 GEN_ERROR("Invalid insertelement operands!");
3860 yyval.ConstVal = ConstantExpr::getInsertElement(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00003861 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003862 ;}
3863 break;
3864
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003865 case 169:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003866#line 1612 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003867 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003868 if (!ShuffleVectorInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
3869 GEN_ERROR("Invalid shufflevector operands!");
3870 yyval.ConstVal = ConstantExpr::getShuffleVector(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00003871 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003872 ;}
3873 break;
3874
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003875 case 170:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003876#line 1621 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3877 {
3878 (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal);
3879 CHECK_FOR_ERROR
3880 ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003881 break;
3882
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003883 case 171:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003884#line 1625 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3885 {
3886 yyval.ConstVector = new std::vector<Constant*>();
3887 yyval.ConstVector->push_back(yyvsp[0].ConstVal);
3888 CHECK_FOR_ERROR
3889 ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00003890 break;
3891
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003892 case 172:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003893#line 1633 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3894 { yyval.BoolVal = false; ;}
3895 break;
3896
3897 case 173:
3898#line 1633 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3899 { yyval.BoolVal = true; ;}
3900 break;
3901
3902 case 174:
3903#line 1643 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003904 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003905 yyval.ModuleVal = ParserResult = yyvsp[0].ModuleVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003906 CurModule.ModuleDone();
Reid Spencerf63697d2006-10-09 17:36:59 +00003907 CHECK_FOR_ERROR;
Reid Spencer3822ff52006-11-08 06:47:33 +00003908;}
3909 break;
3910
Andrew Lenharth6353e052006-12-08 18:07:09 +00003911 case 175:
3912#line 1651 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003913 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003914 yyval.ModuleVal = yyvsp[-1].ModuleVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003915 CurFun.FunctionDone();
Reid Spencer61c83e02006-08-18 08:43:06 +00003916 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003917 ;}
3918 break;
3919
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003920 case 176:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003921#line 1656 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003922 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003923 yyval.ModuleVal = yyvsp[-1].ModuleVal;
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003924 CHECK_FOR_ERROR
3925 ;}
3926 break;
3927
3928 case 177:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003929#line 1660 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003930 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00003931 yyval.ModuleVal = yyvsp[-3].ModuleVal;
3932 CHECK_FOR_ERROR
3933 ;}
3934 break;
3935
3936 case 178:
3937#line 1664 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3938 {
3939 yyval.ModuleVal = yyvsp[-1].ModuleVal;
3940 CHECK_FOR_ERROR
3941 ;}
3942 break;
3943
3944 case 179:
3945#line 1668 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3946 {
3947 yyval.ModuleVal = CurModule.CurrentModule;
Reid Spencer68a24bd2005-08-27 18:50:39 +00003948 // Emit an error if there are any unresolved types left.
3949 if (!CurModule.LateResolveTypes.empty()) {
3950 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
Reid Spencer61c83e02006-08-18 08:43:06 +00003951 if (DID.Type == ValID::NameVal) {
3952 GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'");
3953 } else {
3954 GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num));
3955 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00003956 }
Reid Spencer61c83e02006-08-18 08:43:06 +00003957 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003958 ;}
3959 break;
3960
Andrew Lenharth6353e052006-12-08 18:07:09 +00003961 case 180:
3962#line 1683 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00003963 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00003964 // Eagerly resolve types. This is not an optimization, this is a
3965 // requirement that is due to the fact that we could have this:
3966 //
3967 // %list = type { %list * }
3968 // %list = type { %list * } ; repeated type decl
3969 //
3970 // If types are not resolved eagerly, then the two types will not be
3971 // determined to be the same type!
3972 //
Andrew Lenharth6353e052006-12-08 18:07:09 +00003973 ResolveTypeTo(yyvsp[-2].StrVal, *yyvsp[0].TypeVal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00003974
Andrew Lenharth6353e052006-12-08 18:07:09 +00003975 if (!setTypeName(*yyvsp[0].TypeVal, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
Reid Spencer5b7e7532006-09-28 19:28:24 +00003976 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00003977 // If this is a named type that is not a redefinition, add it to the slot
3978 // table.
Andrew Lenharth6353e052006-12-08 18:07:09 +00003979 CurModule.Types.push_back(*yyvsp[0].TypeVal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00003980 }
Reid Spencera132e042006-12-03 05:46:11 +00003981
Andrew Lenharth6353e052006-12-08 18:07:09 +00003982 delete yyvsp[0].TypeVal;
Reid Spencer61c83e02006-08-18 08:43:06 +00003983 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003984 ;}
3985 break;
3986
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003987 case 181:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003988#line 1705 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3989 { // Function prototypes can be in const pool
Reid Spencer61c83e02006-08-18 08:43:06 +00003990 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003991 ;}
3992 break;
3993
Reid Spencer6e18b7d2006-12-03 06:59:29 +00003994 case 182:
Andrew Lenharth6353e052006-12-08 18:07:09 +00003995#line 1708 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
3996 { // Asm blocks can be in the const pool
3997 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00003998 ;}
3999 break;
4000
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004001 case 183:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004002#line 1711 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004003 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00004004 if (yyvsp[0].ConstVal == 0)
4005 GEN_ERROR("Global value initializer is not a constant!");
4006 CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, yyvsp[-2].Linkage, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal);
Reid Spencer5b7e7532006-09-28 19:28:24 +00004007 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004008 ;}
4009 break;
4010
Reid Spencera132e042006-12-03 05:46:11 +00004011 case 184:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004012#line 1716 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004013 {
Reid Spencer3ed469c2006-11-02 20:25:50 +00004014 CurGV = 0;
Reid Spencer3822ff52006-11-08 06:47:33 +00004015 ;}
4016 break;
4017
Reid Spencera132e042006-12-03 05:46:11 +00004018 case 185:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004019#line 1719 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004020 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00004021 CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::ExternalLinkage, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0);
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004022 CHECK_FOR_ERROR
Andrew Lenharth6353e052006-12-08 18:07:09 +00004023 delete yyvsp[0].TypeVal;
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004024 ;}
4025 break;
4026
4027 case 186:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004028#line 1723 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004029 {
4030 CurGV = 0;
4031 CHECK_FOR_ERROR
4032 ;}
4033 break;
4034
4035 case 187:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004036#line 1727 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004037 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00004038 CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::DLLImportLinkage, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0);
Reid Spencer5b7e7532006-09-28 19:28:24 +00004039 CHECK_FOR_ERROR
Andrew Lenharth6353e052006-12-08 18:07:09 +00004040 delete yyvsp[0].TypeVal;
Reid Spencer3822ff52006-11-08 06:47:33 +00004041 ;}
4042 break;
4043
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004044 case 188:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004045#line 1731 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004046 {
Anton Korobeynikovbcb97702006-09-17 20:25:45 +00004047 CurGV = 0;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +00004048 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004049 ;}
4050 break;
4051
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004052 case 189:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004053#line 1735 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4054 {
4055 CurGV =
4056 ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::ExternalWeakLinkage, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0);
Anton Korobeynikovbcb97702006-09-17 20:25:45 +00004057 CHECK_FOR_ERROR
Andrew Lenharth6353e052006-12-08 18:07:09 +00004058 delete yyvsp[0].TypeVal;
Reid Spencer3822ff52006-11-08 06:47:33 +00004059 ;}
4060 break;
4061
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004062 case 190:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004063#line 1740 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004064 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00004065 CurGV = 0;
Anton Korobeynikovbcb97702006-09-17 20:25:45 +00004066 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004067 ;}
4068 break;
4069
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004070 case 191:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004071#line 1744 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004072 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00004073 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004074 ;}
4075 break;
4076
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004077 case 192:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004078#line 1747 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4079 {
4080 CHECK_FOR_ERROR
4081 ;}
4082 break;
4083
4084 case 193:
4085#line 1750 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4086 {
4087 ;}
4088 break;
4089
4090 case 194:
4091#line 1754 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004092 {
Chris Lattner66316012006-01-24 04:14:29 +00004093 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
Andrew Lenharth6353e052006-12-08 18:07:09 +00004094 char *EndStr = UnEscapeLexed(yyvsp[0].StrVal, true);
4095 std::string NewAsm(yyvsp[0].StrVal, EndStr);
4096 free(yyvsp[0].StrVal);
Chris Lattner66316012006-01-24 04:14:29 +00004097
4098 if (AsmSoFar.empty())
4099 CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
4100 else
4101 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
Reid Spencer61c83e02006-08-18 08:43:06 +00004102 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004103;}
4104 break;
4105
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004106 case 195:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004107#line 1767 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4108 { yyval.Endianness = Module::BigEndian; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00004109 break;
4110
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004111 case 196:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004112#line 1768 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4113 { yyval.Endianness = Module::LittleEndian; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00004114 break;
4115
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004116 case 197:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004117#line 1770 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004118 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00004119 CurModule.CurrentModule->setEndianness(yyvsp[0].Endianness);
4120 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004121 ;}
4122 break;
4123
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004124 case 198:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004125#line 1774 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004126 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00004127 if (yyvsp[0].UInt64Val == 32)
4128 CurModule.CurrentModule->setPointerSize(Module::Pointer32);
4129 else if (yyvsp[0].UInt64Val == 64)
4130 CurModule.CurrentModule->setPointerSize(Module::Pointer64);
4131 else
4132 GEN_ERROR("Invalid pointer size: '" + utostr(yyvsp[0].UInt64Val) + "'!");
4133 CHECK_FOR_ERROR
4134 ;}
4135 break;
4136
4137 case 199:
4138#line 1783 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4139 {
4140 CurModule.CurrentModule->setTargetTriple(yyvsp[0].StrVal);
4141 free(yyvsp[0].StrVal);
Reid Spencer3822ff52006-11-08 06:47:33 +00004142 ;}
4143 break;
4144
Reid Spencera132e042006-12-03 05:46:11 +00004145 case 200:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004146#line 1787 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004147 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00004148 CurModule.CurrentModule->setDataLayout(yyvsp[0].StrVal);
4149 free(yyvsp[0].StrVal);
4150 ;}
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004151 break;
4152
4153 case 202:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004154#line 1794 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4155 {
4156 CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal);
4157 free(yyvsp[0].StrVal);
4158 CHECK_FOR_ERROR
4159 ;}
4160 break;
4161
4162 case 203:
4163#line 1799 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4164 {
4165 CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal);
4166 free(yyvsp[0].StrVal);
4167 CHECK_FOR_ERROR
4168 ;}
4169 break;
4170
4171 case 204:
4172#line 1804 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004173 {
Reid Spencer61c83e02006-08-18 08:43:06 +00004174 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004175 ;}
4176 break;
4177
Andrew Lenharth6353e052006-12-08 18:07:09 +00004178 case 208:
4179#line 1814 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4180 { yyval.StrVal = 0; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00004181 break;
4182
Andrew Lenharth6353e052006-12-08 18:07:09 +00004183 case 209:
4184#line 1816 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004185 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00004186 if (*yyvsp[-1].TypeVal == Type::VoidTy)
Reid Spencer61c83e02006-08-18 08:43:06 +00004187 GEN_ERROR("void typed arguments are invalid!");
Andrew Lenharth6353e052006-12-08 18:07:09 +00004188 yyval.ArgVal = new std::pair<PATypeHolder*, char*>(yyvsp[-1].TypeVal, yyvsp[0].StrVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00004189 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004190;}
4191 break;
4192
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004193 case 210:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004194#line 1823 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004195 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00004196 yyval.ArgList = yyvsp[-2].ArgList;
4197 yyvsp[-2].ArgList->push_back(*yyvsp[0].ArgVal);
4198 delete yyvsp[0].ArgVal;
Reid Spencer61c83e02006-08-18 08:43:06 +00004199 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004200 ;}
4201 break;
4202
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004203 case 211:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004204#line 1829 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004205 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00004206 yyval.ArgList = new std::vector<std::pair<PATypeHolder*,char*> >();
4207 yyval.ArgList->push_back(*yyvsp[0].ArgVal);
4208 delete yyvsp[0].ArgVal;
Reid Spencer61c83e02006-08-18 08:43:06 +00004209 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004210 ;}
4211 break;
4212
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004213 case 212:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004214#line 1836 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004215 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00004216 yyval.ArgList = yyvsp[0].ArgList;
Reid Spencer61c83e02006-08-18 08:43:06 +00004217 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004218 ;}
4219 break;
4220
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004221 case 213:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004222#line 1840 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004223 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00004224 yyval.ArgList = yyvsp[-2].ArgList;
4225 yyval.ArgList->push_back(std::pair<PATypeHolder*,
4226 char*>(new PATypeHolder(Type::VoidTy), 0));
Reid Spencer61c83e02006-08-18 08:43:06 +00004227 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004228 ;}
4229 break;
4230
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004231 case 214:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004232#line 1846 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004233 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00004234 yyval.ArgList = new std::vector<std::pair<PATypeHolder*,char*> >();
4235 yyval.ArgList->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0));
4236 CHECK_FOR_ERROR
4237 ;}
4238 break;
4239
4240 case 215:
4241#line 1851 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4242 {
4243 yyval.ArgList = 0;
4244 CHECK_FOR_ERROR
4245 ;}
4246 break;
4247
4248 case 216:
4249#line 1857 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4250 {
4251 UnEscapeLexed(yyvsp[-5].StrVal);
4252 std::string FunctionName(yyvsp[-5].StrVal);
4253 free(yyvsp[-5].StrVal); // Free strdup'd memory!
Reid Spencer68a24bd2005-08-27 18:50:39 +00004254
Andrew Lenharth6353e052006-12-08 18:07:09 +00004255 if (!(*yyvsp[-6].TypeVal)->isFirstClassType() && *yyvsp[-6].TypeVal != Type::VoidTy)
Reid Spencer61c83e02006-08-18 08:43:06 +00004256 GEN_ERROR("LLVM functions cannot return aggregate types!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004257
4258 std::vector<const Type*> ParamTypeList;
Andrew Lenharth6353e052006-12-08 18:07:09 +00004259 if (yyvsp[-3].ArgList) { // If there are arguments...
4260 for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = yyvsp[-3].ArgList->begin();
4261 I != yyvsp[-3].ArgList->end(); ++I)
Reid Spencera132e042006-12-03 05:46:11 +00004262 ParamTypeList.push_back(I->first->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004263 }
4264
4265 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4266 if (isVarArg) ParamTypeList.pop_back();
4267
Andrew Lenharth6353e052006-12-08 18:07:09 +00004268 const FunctionType *FT = FunctionType::get(*yyvsp[-6].TypeVal, ParamTypeList, isVarArg);
Reid Spencer68a24bd2005-08-27 18:50:39 +00004269 const PointerType *PFT = PointerType::get(FT);
Andrew Lenharth6353e052006-12-08 18:07:09 +00004270 delete yyvsp[-6].TypeVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00004271
4272 ValID ID;
4273 if (!FunctionName.empty()) {
4274 ID = ValID::create((char*)FunctionName.c_str());
4275 } else {
4276 ID = ValID::create((int)CurModule.Values[PFT].size());
4277 }
4278
4279 Function *Fn = 0;
4280 // See if this function was forward referenced. If so, recycle the object.
4281 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4282 // Move the function to the end of the list, from whereever it was
4283 // previously inserted.
4284 Fn = cast<Function>(FWRef);
4285 CurModule.CurrentModule->getFunctionList().remove(Fn);
4286 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4287 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4288 (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) {
4289 // If this is the case, either we need to be a forward decl, or it needs
4290 // to be.
4291 if (!CurFun.isDeclare && !Fn->isExternal())
Reid Spencer61c83e02006-08-18 08:43:06 +00004292 GEN_ERROR("Redefinition of function '" + FunctionName + "'!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004293
4294 // Make sure to strip off any argument names so we can't get conflicts.
4295 if (Fn->isExternal())
4296 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4297 AI != AE; ++AI)
4298 AI->setName("");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004299 } else { // Not already defined?
4300 Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
4301 CurModule.CurrentModule);
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +00004302
Reid Spencer68a24bd2005-08-27 18:50:39 +00004303 InsertValue(Fn, CurModule.Values);
4304 }
4305
4306 CurFun.FunctionStart(Fn);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00004307
4308 if (CurFun.isDeclare) {
4309 // If we have declaration, always overwrite linkage. This will allow us to
4310 // correctly handle cases, when pointer to function is passed as argument to
4311 // another function.
4312 Fn->setLinkage(CurFun.Linkage);
4313 }
Andrew Lenharth6353e052006-12-08 18:07:09 +00004314 Fn->setCallingConv(yyvsp[-7].UIntVal);
4315 Fn->setAlignment(yyvsp[0].UIntVal);
4316 if (yyvsp[-1].StrVal) {
4317 Fn->setSection(yyvsp[-1].StrVal);
4318 free(yyvsp[-1].StrVal);
Chris Lattnere869eef2005-11-12 00:11:49 +00004319 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00004320
4321 // Add all of the arguments we parsed to the function...
Andrew Lenharth6353e052006-12-08 18:07:09 +00004322 if (yyvsp[-3].ArgList) { // Is null if empty...
Reid Spencer68a24bd2005-08-27 18:50:39 +00004323 if (isVarArg) { // Nuke the last entry
Andrew Lenharth6353e052006-12-08 18:07:09 +00004324 assert(yyvsp[-3].ArgList->back().first->get() == Type::VoidTy && yyvsp[-3].ArgList->back().second == 0&&
Reid Spencera132e042006-12-03 05:46:11 +00004325 "Not a varargs marker!");
Andrew Lenharth6353e052006-12-08 18:07:09 +00004326 delete yyvsp[-3].ArgList->back().first;
4327 yyvsp[-3].ArgList->pop_back(); // Delete the last entry
Reid Spencer68a24bd2005-08-27 18:50:39 +00004328 }
4329 Function::arg_iterator ArgIt = Fn->arg_begin();
Andrew Lenharth6353e052006-12-08 18:07:09 +00004330 for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = yyvsp[-3].ArgList->begin();
4331 I != yyvsp[-3].ArgList->end(); ++I, ++ArgIt) {
Reid Spencera132e042006-12-03 05:46:11 +00004332 delete I->first; // Delete the typeholder...
4333
Reid Spencer68a24bd2005-08-27 18:50:39 +00004334 setValueName(ArgIt, I->second); // Insert arg into symtab...
Reid Spencer5b7e7532006-09-28 19:28:24 +00004335 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00004336 InsertValue(ArgIt);
4337 }
Reid Spencera132e042006-12-03 05:46:11 +00004338
Andrew Lenharth6353e052006-12-08 18:07:09 +00004339 delete yyvsp[-3].ArgList; // We're now done with the argument list
Reid Spencer68a24bd2005-08-27 18:50:39 +00004340 }
Reid Spencer61c83e02006-08-18 08:43:06 +00004341 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004342;}
4343 break;
4344
Andrew Lenharth6353e052006-12-08 18:07:09 +00004345 case 219:
4346#line 1953 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004347 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00004348 yyval.FunctionVal = CurFun.CurrentFunction;
Reid Spencer68a24bd2005-08-27 18:50:39 +00004349
4350 // Make sure that we keep track of the linkage type even if there was a
4351 // previous "declare".
Andrew Lenharth6353e052006-12-08 18:07:09 +00004352 yyval.FunctionVal->setLinkage(yyvsp[-2].Linkage);
Reid Spencer3822ff52006-11-08 06:47:33 +00004353;}
4354 break;
4355
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004356 case 222:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004357#line 1963 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4358 {
4359 yyval.FunctionVal = yyvsp[-1].FunctionVal;
4360 CHECK_FOR_ERROR
4361;}
Reid Spencer3822ff52006-11-08 06:47:33 +00004362 break;
4363
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004364 case 224:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004365#line 1969 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4366 { CurFun.Linkage = GlobalValue::DLLImportLinkage; ;}
Reid Spencer3822ff52006-11-08 06:47:33 +00004367 break;
4368
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004369 case 225:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004370#line 1970 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4371 { CurFun.Linkage = GlobalValue::ExternalWeakLinkage; ;}
4372 break;
4373
4374 case 226:
4375#line 1972 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4376 { CurFun.isDeclare = true; ;}
4377 break;
4378
4379 case 227:
4380#line 1972 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004381 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00004382 yyval.FunctionVal = CurFun.CurrentFunction;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +00004383 CurFun.FunctionDone();
Reid Spencer61c83e02006-08-18 08:43:06 +00004384 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004385 ;}
4386 break;
4387
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004388 case 228:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004389#line 1982 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4390 {
4391 yyval.BoolVal = false;
Reid Spencer61c83e02006-08-18 08:43:06 +00004392 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004393 ;}
4394 break;
4395
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004396 case 229:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004397#line 1986 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004398 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00004399 yyval.BoolVal = true;
Reid Spencer61c83e02006-08-18 08:43:06 +00004400 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004401 ;}
4402 break;
4403
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004404 case 230:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004405#line 1991 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4406 { // A reference to a direct constant
4407 yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val);
Reid Spencer61c83e02006-08-18 08:43:06 +00004408 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004409 ;}
4410 break;
4411
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004412 case 231:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004413#line 1995 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004414 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00004415 yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val);
Reid Spencer61c83e02006-08-18 08:43:06 +00004416 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004417 ;}
4418 break;
4419
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004420 case 232:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004421#line 1999 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4422 { // Perhaps it's an FP constant?
4423 yyval.ValIDVal = ValID::create(yyvsp[0].FPVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00004424 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004425 ;}
4426 break;
4427
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004428 case 233:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004429#line 2003 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004430 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00004431 yyval.ValIDVal = ValID::create(ConstantBool::getTrue());
Reid Spencer61c83e02006-08-18 08:43:06 +00004432 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004433 ;}
4434 break;
4435
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004436 case 234:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004437#line 2007 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004438 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00004439 yyval.ValIDVal = ValID::create(ConstantBool::getFalse());
Reid Spencer61c83e02006-08-18 08:43:06 +00004440 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004441 ;}
4442 break;
4443
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004444 case 235:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004445#line 2011 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4446 {
4447 yyval.ValIDVal = ValID::createNull();
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +00004448 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004449 ;}
4450 break;
4451
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004452 case 236:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004453#line 2015 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4454 {
4455 yyval.ValIDVal = ValID::createUndef();
4456 CHECK_FOR_ERROR
4457 ;}
4458 break;
4459
4460 case 237:
4461#line 2019 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4462 { // A vector zero constant.
4463 yyval.ValIDVal = ValID::createZeroInit();
4464 CHECK_FOR_ERROR
4465 ;}
4466 break;
4467
4468 case 238:
4469#line 2023 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004470 { // Nonempty unsized packed vector
Andrew Lenharth6353e052006-12-08 18:07:09 +00004471 const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType();
4472 int NumElements = yyvsp[-1].ConstVector->size();
Reid Spencer68a24bd2005-08-27 18:50:39 +00004473
4474 PackedType* pt = PackedType::get(ETy, NumElements);
4475 PATypeHolder* PTy = new PATypeHolder(
Reid Spencera132e042006-12-03 05:46:11 +00004476 HandleUpRefs(
4477 PackedType::get(
4478 ETy,
4479 NumElements)
4480 )
4481 );
Reid Spencer68a24bd2005-08-27 18:50:39 +00004482
4483 // Verify all elements are correct type!
Andrew Lenharth6353e052006-12-08 18:07:09 +00004484 for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
4485 if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
Reid Spencer61c83e02006-08-18 08:43:06 +00004486 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +00004487 ETy->getDescription() +"' as required!\nIt is of type '" +
Andrew Lenharth6353e052006-12-08 18:07:09 +00004488 (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004489 }
4490
Andrew Lenharth6353e052006-12-08 18:07:09 +00004491 yyval.ValIDVal = ValID::create(ConstantPacked::get(pt, *yyvsp[-1].ConstVector));
4492 delete PTy; delete yyvsp[-1].ConstVector;
Reid Spencer21be8652006-10-22 07:03:43 +00004493 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004494 ;}
4495 break;
4496
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004497 case 239:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004498#line 2048 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4499 {
4500 yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal);
Reid Spencer3822ff52006-11-08 06:47:33 +00004501 CHECK_FOR_ERROR
4502 ;}
4503 break;
4504
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004505 case 240:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004506#line 2052 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4507 {
4508 char *End = UnEscapeLexed(yyvsp[-2].StrVal, true);
4509 std::string AsmStr = std::string(yyvsp[-2].StrVal, End);
4510 End = UnEscapeLexed(yyvsp[0].StrVal, true);
4511 std::string Constraints = std::string(yyvsp[0].StrVal, End);
4512 yyval.ValIDVal = ValID::createInlineAsm(AsmStr, Constraints, yyvsp[-3].BoolVal);
4513 free(yyvsp[-2].StrVal);
4514 free(yyvsp[0].StrVal);
4515 CHECK_FOR_ERROR
4516 ;}
4517 break;
4518
4519 case 241:
4520#line 2066 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4521 { // Is it an integer reference...?
4522 yyval.ValIDVal = ValID::create(yyvsp[0].SIntVal);
4523 CHECK_FOR_ERROR
4524 ;}
4525 break;
4526
4527 case 242:
4528#line 2070 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004529 { // Is it a named reference...?
Andrew Lenharth6353e052006-12-08 18:07:09 +00004530 yyval.ValIDVal = ValID::create(yyvsp[0].StrVal);
Reid Spencer3822ff52006-11-08 06:47:33 +00004531 CHECK_FOR_ERROR
4532 ;}
4533 break;
4534
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004535 case 245:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004536#line 2082 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4537 {
4538 yyval.ValueVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal); delete yyvsp[-1].TypeVal;
Reid Spencer3822ff52006-11-08 06:47:33 +00004539 CHECK_FOR_ERROR
4540 ;}
4541 break;
4542
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004543 case 246:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004544#line 2087 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004545 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00004546 yyval.FunctionVal = yyvsp[-1].FunctionVal;
Reid Spencer3822ff52006-11-08 06:47:33 +00004547 CHECK_FOR_ERROR
4548 ;}
4549 break;
4550
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004551 case 247:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004552#line 2091 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4553 { // Do not allow functions with 0 basic blocks
4554 yyval.FunctionVal = yyvsp[-1].FunctionVal;
Reid Spencer3822ff52006-11-08 06:47:33 +00004555 CHECK_FOR_ERROR
4556 ;}
4557 break;
4558
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004559 case 248:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004560#line 2100 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004561 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00004562 setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal);
Reid Spencer5b7e7532006-09-28 19:28:24 +00004563 CHECK_FOR_ERROR
Andrew Lenharth6353e052006-12-08 18:07:09 +00004564 InsertValue(yyvsp[0].TermInstVal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00004565
Andrew Lenharth6353e052006-12-08 18:07:09 +00004566 yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal);
4567 InsertValue(yyvsp[-2].BasicBlockVal);
4568 yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal;
Reid Spencer61c83e02006-08-18 08:43:06 +00004569 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004570 ;}
4571 break;
4572
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004573 case 249:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004574#line 2111 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004575 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00004576 if (CastInst *CI1 = dyn_cast<CastInst>(yyvsp[0].InstVal))
4577 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4578 if (CI2->getParent() == 0)
4579 yyvsp[-1].BasicBlockVal->getInstList().push_back(CI2);
4580 yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal);
4581 yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
4582 CHECK_FOR_ERROR
4583 ;}
4584 break;
4585
4586 case 250:
4587#line 2120 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4588 {
4589 yyval.BasicBlockVal = getBBVal(ValID::create((int)CurFun.NextBBNum++), true);
Reid Spencer5b7e7532006-09-28 19:28:24 +00004590 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00004591
4592 // Make sure to move the basic block to the correct location in the
4593 // function, instead of leaving it inserted wherever it was first
4594 // referenced.
4595 Function::BasicBlockListType &BBL =
4596 CurFun.CurrentFunction->getBasicBlockList();
Andrew Lenharth6353e052006-12-08 18:07:09 +00004597 BBL.splice(BBL.end(), BBL, yyval.BasicBlockVal);
Reid Spencer3822ff52006-11-08 06:47:33 +00004598 CHECK_FOR_ERROR
4599 ;}
4600 break;
4601
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004602 case 251:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004603#line 2132 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4604 {
4605 yyval.BasicBlockVal = getBBVal(ValID::create(yyvsp[0].StrVal), true);
4606 CHECK_FOR_ERROR
4607
4608 // Make sure to move the basic block to the correct location in the
4609 // function, instead of leaving it inserted wherever it was first
4610 // referenced.
4611 Function::BasicBlockListType &BBL =
4612 CurFun.CurrentFunction->getBasicBlockList();
4613 BBL.splice(BBL.end(), BBL, yyval.BasicBlockVal);
Reid Spencer3822ff52006-11-08 06:47:33 +00004614 CHECK_FOR_ERROR
4615 ;}
4616 break;
4617
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004618 case 252:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004619#line 2145 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4620 { // Return with a result...
4621 yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal);
Reid Spencer3822ff52006-11-08 06:47:33 +00004622 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004623 ;}
4624 break;
4625
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004626 case 253:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004627#line 2149 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4628 { // Return with no result...
4629 yyval.TermInstVal = new ReturnInst();
Reid Spencer3822ff52006-11-08 06:47:33 +00004630 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004631 ;}
4632 break;
4633
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004634 case 254:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004635#line 2153 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4636 { // Unconditional Branch...
4637 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
Reid Spencer3822ff52006-11-08 06:47:33 +00004638 CHECK_FOR_ERROR
Andrew Lenharth6353e052006-12-08 18:07:09 +00004639 yyval.TermInstVal = new BranchInst(tmpBB);
4640 ;}
4641 break;
Reid Spencer3822ff52006-11-08 06:47:33 +00004642
Andrew Lenharth6353e052006-12-08 18:07:09 +00004643 case 255:
4644#line 2158 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4645 {
4646 BasicBlock* tmpBBA = getBBVal(yyvsp[-3].ValIDVal);
4647 CHECK_FOR_ERROR
4648 BasicBlock* tmpBBB = getBBVal(yyvsp[0].ValIDVal);
4649 CHECK_FOR_ERROR
4650 Value* tmpVal = getVal(Type::BoolTy, yyvsp[-6].ValIDVal);
4651 CHECK_FOR_ERROR
4652 yyval.TermInstVal = new BranchInst(tmpBBA, tmpBBB, tmpVal);
4653 ;}
4654 break;
4655
4656 case 256:
4657#line 2167 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4658 {
4659 Value* tmpVal = getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal);
4660 CHECK_FOR_ERROR
4661 BasicBlock* tmpBB = getBBVal(yyvsp[-3].ValIDVal);
4662 CHECK_FOR_ERROR
4663 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, yyvsp[-1].JumpTable->size());
4664 yyval.TermInstVal = S;
4665
4666 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = yyvsp[-1].JumpTable->begin(),
4667 E = yyvsp[-1].JumpTable->end();
Reid Spencer68a24bd2005-08-27 18:50:39 +00004668 for (; I != E; ++I) {
4669 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
4670 S->addCase(CI, I->second);
4671 else
Reid Spencer61c83e02006-08-18 08:43:06 +00004672 GEN_ERROR("Switch case is constant, but not a simple integer!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004673 }
Andrew Lenharth6353e052006-12-08 18:07:09 +00004674 delete yyvsp[-1].JumpTable;
Reid Spencer61c83e02006-08-18 08:43:06 +00004675 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004676 ;}
4677 break;
4678
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004679 case 257:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004680#line 2186 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004681 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00004682 Value* tmpVal = getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal);
4683 CHECK_FOR_ERROR
4684 BasicBlock* tmpBB = getBBVal(yyvsp[-2].ValIDVal);
4685 CHECK_FOR_ERROR
4686 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
4687 yyval.TermInstVal = S;
Reid Spencer61c83e02006-08-18 08:43:06 +00004688 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00004689 ;}
4690 break;
4691
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004692 case 258:
Andrew Lenharth6353e052006-12-08 18:07:09 +00004693#line 2196 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00004694 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00004695 const PointerType *PFTy;
4696 const FunctionType *Ty;
Reid Spencer3822ff52006-11-08 06:47:33 +00004697
Andrew Lenharth6353e052006-12-08 18:07:09 +00004698 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-10].TypeVal->get())) ||
Reid Spencer68a24bd2005-08-27 18:50:39 +00004699 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
4700 // Pull out the types of all of the arguments...
4701 std::vector<const Type*> ParamTypes;
Andrew Lenharth6353e052006-12-08 18:07:09 +00004702 if (yyvsp[-7].ValueList) {
4703 for (std::vector<Value*>::iterator I = yyvsp[-7].ValueList->begin(), E = yyvsp[-7].ValueList->end();
Reid Spencer68a24bd2005-08-27 18:50:39 +00004704 I != E; ++I)
Reid Spencera132e042006-12-03 05:46:11 +00004705 ParamTypes.push_back((*I)->getType());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004706 }
4707
4708 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
4709 if (isVarArg) ParamTypes.pop_back();
4710
Andrew Lenharth6353e052006-12-08 18:07:09 +00004711 Ty = FunctionType::get(yyvsp[-10].TypeVal->get(), ParamTypes, isVarArg);
Reid Spencer68a24bd2005-08-27 18:50:39 +00004712 PFTy = PointerType::get(Ty);
4713 }
4714
Andrew Lenharth6353e052006-12-08 18:07:09 +00004715 Value *V = getVal(PFTy, yyvsp[-9].ValIDVal); // Get the function we're calling...
4716 CHECK_FOR_ERROR
4717 BasicBlock *Normal = getBBVal(yyvsp[-3].ValIDVal);
4718 CHECK_FOR_ERROR
4719 BasicBlock *Except = getBBVal(yyvsp[0].ValIDVal);
Reid Spencer5b7e7532006-09-28 19:28:24 +00004720 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00004721
4722 // Create the call node...
Andrew Lenharth6353e052006-12-08 18:07:09 +00004723 if (!yyvsp[-7].ValueList) { // Has no arguments?
4724 yyval.TermInstVal = new InvokeInst(V, Normal, Except, std::vector<Value*>());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004725 } else { // Has arguments?
4726 // Loop through FunctionType's arguments and ensure they are specified
4727 // correctly!
4728 //
4729 FunctionType::param_iterator I = Ty->param_begin();
4730 FunctionType::param_iterator E = Ty->param_end();
Andrew Lenharth6353e052006-12-08 18:07:09 +00004731 std::vector<Value*>::iterator ArgI = yyvsp[-7].ValueList->begin(), ArgE = yyvsp[-7].ValueList->end();
Reid Spencer68a24bd2005-08-27 18:50:39 +00004732
Reid Spencera132e042006-12-03 05:46:11 +00004733 for (; ArgI != ArgE && I != E; ++ArgI, ++I)
4734 if ((*ArgI)->getType() != *I)
4735 GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" +
4736 (*I)->getDescription() + "'!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004737
4738 if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
Reid Spencer61c83e02006-08-18 08:43:06 +00004739 GEN_ERROR("Invalid number of parameters detected!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004740
Andrew Lenharth6353e052006-12-08 18:07:09 +00004741 yyval.TermInstVal = new InvokeInst(V, Normal, Except, *yyvsp[-7].ValueList);
Reid Spencer68a24bd2005-08-27 18:50:39 +00004742 }
Andrew Lenharth6353e052006-12-08 18:07:09 +00004743 cast<InvokeInst>(yyval.TermInstVal)->setCallingConv(yyvsp[-11].UIntVal);
4744
4745 delete yyvsp[-10].TypeVal;
4746 delete yyvsp[-7].ValueList;
4747 CHECK_FOR_ERROR
4748 ;}
4749 break;
4750
4751 case 259:
4752#line 2251 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4753 {
4754 yyval.TermInstVal = new UnwindInst();
4755 CHECK_FOR_ERROR
4756 ;}
4757 break;
4758
4759 case 260:
4760#line 2255 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4761 {
4762 yyval.TermInstVal = new UnreachableInst();
4763 CHECK_FOR_ERROR
4764 ;}
4765 break;
4766
4767 case 261:
4768#line 2262 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4769 {
4770 yyval.JumpTable = yyvsp[-5].JumpTable;
4771 Constant *V = cast<Constant>(getValNonImprovising(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
4772 CHECK_FOR_ERROR
4773 if (V == 0)
4774 GEN_ERROR("May only switch on a constant pool value!");
4775
4776 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
4777 CHECK_FOR_ERROR
4778 yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
4779 ;}
4780 break;
4781
4782 case 262:
4783#line 2273 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4784 {
4785 yyval.JumpTable = new std::vector<std::pair<Constant*, BasicBlock*> >();
4786 Constant *V = cast<Constant>(getValNonImprovising(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
4787 CHECK_FOR_ERROR
4788
4789 if (V == 0)
4790 GEN_ERROR("May only switch on a constant pool value!");
4791
4792 BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
4793 CHECK_FOR_ERROR
4794 yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
4795 ;}
4796 break;
4797
4798 case 263:
4799#line 2286 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4800 {
4801 // Is this definition named?? if so, assign the name...
4802 setValueName(yyvsp[0].InstVal, yyvsp[-1].StrVal);
4803 CHECK_FOR_ERROR
4804 InsertValue(yyvsp[0].InstVal);
4805 yyval.InstVal = yyvsp[0].InstVal;
4806 CHECK_FOR_ERROR
4807;}
4808 break;
4809
4810 case 264:
4811#line 2295 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4812 { // Used for PHI nodes
4813 yyval.PHIList = new std::list<std::pair<Value*, BasicBlock*> >();
4814 Value* tmpVal = getVal(*yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal);
4815 CHECK_FOR_ERROR
4816 BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
4817 CHECK_FOR_ERROR
4818 yyval.PHIList->push_back(std::make_pair(tmpVal, tmpBB));
4819 delete yyvsp[-5].TypeVal;
4820 ;}
4821 break;
4822
4823 case 265:
4824#line 2304 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4825 {
4826 yyval.PHIList = yyvsp[-6].PHIList;
4827 Value* tmpVal = getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal);
4828 CHECK_FOR_ERROR
4829 BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
4830 CHECK_FOR_ERROR
4831 yyvsp[-6].PHIList->push_back(std::make_pair(tmpVal, tmpBB));
4832 ;}
4833 break;
4834
4835 case 266:
4836#line 2314 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4837 { // Used for call statements, and memory insts...
4838 yyval.ValueList = new std::vector<Value*>();
4839 yyval.ValueList->push_back(yyvsp[0].ValueVal);
4840 ;}
4841 break;
4842
4843 case 267:
4844#line 2318 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4845 {
4846 yyval.ValueList = yyvsp[-2].ValueList;
4847 yyvsp[-2].ValueList->push_back(yyvsp[0].ValueVal);
4848 CHECK_FOR_ERROR
4849 ;}
4850 break;
4851
4852 case 269:
4853#line 2325 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4854 { yyval.ValueList = 0; ;}
4855 break;
4856
4857 case 270:
4858#line 2327 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4859 {
4860 yyval.BoolVal = true;
4861 CHECK_FOR_ERROR
4862 ;}
4863 break;
4864
4865 case 271:
4866#line 2331 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4867 {
4868 yyval.BoolVal = false;
4869 CHECK_FOR_ERROR
4870 ;}
4871 break;
4872
4873 case 272:
4874#line 2336 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4875 {
4876 if (!(*yyvsp[-3].TypeVal)->isInteger() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() &&
4877 !isa<PackedType>((*yyvsp[-3].TypeVal).get()))
4878 GEN_ERROR(
4879 "Arithmetic operator requires integer, FP, or packed operands!");
4880 if (isa<PackedType>((*yyvsp[-3].TypeVal).get()) &&
4881 (yyvsp[-4].BinaryOpVal == Instruction::URem ||
4882 yyvsp[-4].BinaryOpVal == Instruction::SRem ||
4883 yyvsp[-4].BinaryOpVal == Instruction::FRem))
4884 GEN_ERROR("U/S/FRem not supported on packed types!");
4885 Value* val1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4886 CHECK_FOR_ERROR
4887 Value* val2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4888 CHECK_FOR_ERROR
4889 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, val1, val2);
4890 if (yyval.InstVal == 0)
4891 GEN_ERROR("binary operator returned null!");
4892 delete yyvsp[-3].TypeVal;
4893 ;}
4894 break;
4895
4896 case 273:
4897#line 2355 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4898 {
4899 if (!(*yyvsp[-3].TypeVal)->isIntegral()) {
4900 if (!isa<PackedType>(yyvsp[-3].TypeVal->get()) ||
4901 !cast<PackedType>(yyvsp[-3].TypeVal->get())->getElementType()->isIntegral())
4902 GEN_ERROR("Logical operator requires integral operands!");
4903 }
4904 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4905 CHECK_FOR_ERROR
4906 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4907 CHECK_FOR_ERROR
4908 yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, tmpVal1, tmpVal2);
4909 if (yyval.InstVal == 0)
4910 GEN_ERROR("binary operator returned null!");
4911 delete yyvsp[-3].TypeVal;
4912 ;}
4913 break;
4914
4915 case 274:
4916#line 2370 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4917 {
4918 if(isa<PackedType>((*yyvsp[-3].TypeVal).get())) {
4919 GEN_ERROR(
4920 "PackedTypes currently not supported in setcc instructions!");
4921 }
4922 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4923 CHECK_FOR_ERROR
4924 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4925 CHECK_FOR_ERROR
4926 yyval.InstVal = new SetCondInst(yyvsp[-4].BinaryOpVal, tmpVal1, tmpVal2);
4927 if (yyval.InstVal == 0)
4928 GEN_ERROR("binary operator returned null!");
4929 delete yyvsp[-3].TypeVal;
4930 ;}
4931 break;
4932
4933 case 275:
4934#line 2384 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4935 {
4936 if (isa<PackedType>((*yyvsp[-3].TypeVal).get()))
4937 GEN_ERROR("Packed types not supported by icmp instruction");
4938 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4939 CHECK_FOR_ERROR
4940 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4941 CHECK_FOR_ERROR
4942 yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].IPredicate, tmpVal1, tmpVal2);
4943 if (yyval.InstVal == 0)
4944 GEN_ERROR("icmp operator returned null!");
4945 ;}
4946 break;
4947
4948 case 276:
4949#line 2395 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4950 {
4951 if (isa<PackedType>((*yyvsp[-3].TypeVal).get()))
4952 GEN_ERROR("Packed types not supported by fcmp instruction");
4953 Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
4954 CHECK_FOR_ERROR
4955 Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
4956 CHECK_FOR_ERROR
4957 yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].FPredicate, tmpVal1, tmpVal2);
4958 if (yyval.InstVal == 0)
4959 GEN_ERROR("fcmp operator returned null!");
4960 ;}
4961 break;
4962
4963 case 277:
4964#line 2406 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4965 {
4966 cerr << "WARNING: Use of eliminated 'not' instruction:"
4967 << " Replacing with 'xor'.\n";
4968
4969 Value *Ones = ConstantIntegral::getAllOnesValue(yyvsp[0].ValueVal->getType());
4970 if (Ones == 0)
4971 GEN_ERROR("Expected integral type for not instruction!");
4972
4973 yyval.InstVal = BinaryOperator::create(Instruction::Xor, yyvsp[0].ValueVal, Ones);
4974 if (yyval.InstVal == 0)
4975 GEN_ERROR("Could not create a xor instruction!");
4976 CHECK_FOR_ERROR
4977 ;}
4978 break;
4979
4980 case 278:
4981#line 2419 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4982 {
4983 if (yyvsp[0].ValueVal->getType() != Type::UByteTy)
4984 GEN_ERROR("Shift amount must be ubyte!");
4985 if (!yyvsp[-2].ValueVal->getType()->isInteger())
4986 GEN_ERROR("Shift constant expression requires integer operand!");
4987 CHECK_FOR_ERROR;
4988 yyval.InstVal = new ShiftInst(yyvsp[-3].OtherOpVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
4989 CHECK_FOR_ERROR
4990 ;}
4991 break;
4992
4993 case 279:
4994#line 2428 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
4995 {
4996 Value* Val = yyvsp[-2].ValueVal;
4997 const Type* Ty = yyvsp[0].TypeVal->get();
4998 if (!Val->getType()->isFirstClassType())
4999 GEN_ERROR("cast from a non-primitive type: '" +
5000 Val->getType()->getDescription() + "'!");
5001 if (!Ty->isFirstClassType())
5002 GEN_ERROR("cast to a non-primitive type: '" + Ty->getDescription() +"'!");
5003 yyval.InstVal = CastInst::create(yyvsp[-3].CastOpVal, yyvsp[-2].ValueVal, yyvsp[0].TypeVal->get());
5004 delete yyvsp[0].TypeVal;
5005 ;}
5006 break;
5007
5008 case 280:
5009#line 2439 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
5010 {
5011 if (yyvsp[-4].ValueVal->getType() != Type::BoolTy)
5012 GEN_ERROR("select condition must be boolean!");
5013 if (yyvsp[-2].ValueVal->getType() != yyvsp[0].ValueVal->getType())
5014 GEN_ERROR("select value types should match!");
5015 yyval.InstVal = new SelectInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
5016 CHECK_FOR_ERROR
5017 ;}
5018 break;
5019
5020 case 281:
5021#line 2447 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
5022 {
5023 yyval.InstVal = new VAArgInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal);
5024 delete yyvsp[0].TypeVal;
5025 CHECK_FOR_ERROR
5026 ;}
5027 break;
5028
5029 case 282:
5030#line 2452 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
5031 {
5032 if (!ExtractElementInst::isValidOperands(yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
5033 GEN_ERROR("Invalid extractelement operands!");
5034 yyval.InstVal = new ExtractElementInst(yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
5035 CHECK_FOR_ERROR
5036 ;}
5037 break;
5038
5039 case 283:
5040#line 2458 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
5041 {
5042 if (!InsertElementInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
5043 GEN_ERROR("Invalid insertelement operands!");
5044 yyval.InstVal = new InsertElementInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
5045 CHECK_FOR_ERROR
5046 ;}
5047 break;
5048
5049 case 284:
5050#line 2464 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
5051 {
5052 if (!ShuffleVectorInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
5053 GEN_ERROR("Invalid shufflevector operands!");
5054 yyval.InstVal = new ShuffleVectorInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00005055 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00005056 ;}
5057 break;
5058
Reid Spencercd42c582006-12-05 23:29:42 +00005059 case 285:
Andrew Lenharth6353e052006-12-08 18:07:09 +00005060#line 2470 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00005061 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00005062 const Type *Ty = yyvsp[0].PHIList->front().first->getType();
5063 if (!Ty->isFirstClassType())
5064 GEN_ERROR("PHI node operands must be of first class type!");
5065 yyval.InstVal = new PHINode(Ty);
5066 ((PHINode*)yyval.InstVal)->reserveOperandSpace(yyvsp[0].PHIList->size());
5067 while (yyvsp[0].PHIList->begin() != yyvsp[0].PHIList->end()) {
5068 if (yyvsp[0].PHIList->front().first->getType() != Ty)
5069 GEN_ERROR("All elements of a PHI node must be of the same type!");
5070 cast<PHINode>(yyval.InstVal)->addIncoming(yyvsp[0].PHIList->front().first, yyvsp[0].PHIList->front().second);
5071 yyvsp[0].PHIList->pop_front();
5072 }
5073 delete yyvsp[0].PHIList; // Free the list...
Reid Spencer61c83e02006-08-18 08:43:06 +00005074 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00005075 ;}
5076 break;
5077
Reid Spencercd42c582006-12-05 23:29:42 +00005078 case 286:
Andrew Lenharth6353e052006-12-08 18:07:09 +00005079#line 2485 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
5080 {
5081 const PointerType *PFTy = 0;
5082 const FunctionType *Ty = 0;
5083
5084 if (!(PFTy = dyn_cast<PointerType>(yyvsp[-4].TypeVal->get())) ||
5085 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5086 // Pull out the types of all of the arguments...
5087 std::vector<const Type*> ParamTypes;
5088 if (yyvsp[-1].ValueList) {
5089 for (std::vector<Value*>::iterator I = yyvsp[-1].ValueList->begin(), E = yyvsp[-1].ValueList->end();
5090 I != E; ++I)
5091 ParamTypes.push_back((*I)->getType());
5092 }
5093
5094 bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
5095 if (isVarArg) ParamTypes.pop_back();
5096
5097 if (!(*yyvsp[-4].TypeVal)->isFirstClassType() && *yyvsp[-4].TypeVal != Type::VoidTy)
5098 GEN_ERROR("LLVM functions cannot return aggregate types!");
5099
5100 Ty = FunctionType::get(yyvsp[-4].TypeVal->get(), ParamTypes, isVarArg);
5101 PFTy = PointerType::get(Ty);
5102 }
5103
5104 Value *V = getVal(PFTy, yyvsp[-3].ValIDVal); // Get the function we're calling...
5105 CHECK_FOR_ERROR
5106
5107 // Create the call node...
5108 if (!yyvsp[-1].ValueList) { // Has no arguments?
5109 // Make sure no arguments is a good thing!
5110 if (Ty->getNumParams() != 0)
5111 GEN_ERROR("No arguments passed to a function that "
5112 "expects arguments!");
5113
5114 yyval.InstVal = new CallInst(V, std::vector<Value*>());
5115 } else { // Has arguments?
5116 // Loop through FunctionType's arguments and ensure they are specified
5117 // correctly!
5118 //
5119 FunctionType::param_iterator I = Ty->param_begin();
5120 FunctionType::param_iterator E = Ty->param_end();
5121 std::vector<Value*>::iterator ArgI = yyvsp[-1].ValueList->begin(), ArgE = yyvsp[-1].ValueList->end();
5122
5123 for (; ArgI != ArgE && I != E; ++ArgI, ++I)
5124 if ((*ArgI)->getType() != *I)
5125 GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" +
5126 (*I)->getDescription() + "'!");
5127
5128 if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
5129 GEN_ERROR("Invalid number of parameters detected!");
5130
5131 yyval.InstVal = new CallInst(V, *yyvsp[-1].ValueList);
5132 }
5133 cast<CallInst>(yyval.InstVal)->setTailCall(yyvsp[-6].BoolVal);
5134 cast<CallInst>(yyval.InstVal)->setCallingConv(yyvsp[-5].UIntVal);
5135 delete yyvsp[-4].TypeVal;
5136 delete yyvsp[-1].ValueList;
Reid Spencer61c83e02006-08-18 08:43:06 +00005137 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00005138 ;}
5139 break;
5140
Reid Spencercd42c582006-12-05 23:29:42 +00005141 case 287:
Andrew Lenharth6353e052006-12-08 18:07:09 +00005142#line 2544 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
5143 {
5144 yyval.InstVal = yyvsp[0].InstVal;
Reid Spencer61c83e02006-08-18 08:43:06 +00005145 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00005146 ;}
5147 break;
5148
Reid Spencercd42c582006-12-05 23:29:42 +00005149 case 288:
Andrew Lenharth6353e052006-12-08 18:07:09 +00005150#line 2551 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
5151 {
5152 yyval.ValueList = yyvsp[0].ValueList;
Reid Spencer61c83e02006-08-18 08:43:06 +00005153 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00005154 ;}
5155 break;
5156
Reid Spencercd42c582006-12-05 23:29:42 +00005157 case 289:
Andrew Lenharth6353e052006-12-08 18:07:09 +00005158#line 2554 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
5159 {
5160 yyval.ValueList = new std::vector<Value*>();
Reid Spencer61c83e02006-08-18 08:43:06 +00005161 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00005162 ;}
5163 break;
5164
Reid Spencercd42c582006-12-05 23:29:42 +00005165 case 290:
Andrew Lenharth6353e052006-12-08 18:07:09 +00005166#line 2559 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00005167 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00005168 yyval.BoolVal = true;
Reid Spencer61c83e02006-08-18 08:43:06 +00005169 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00005170 ;}
5171 break;
5172
Reid Spencercd42c582006-12-05 23:29:42 +00005173 case 291:
Andrew Lenharth6353e052006-12-08 18:07:09 +00005174#line 2563 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00005175 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00005176 yyval.BoolVal = false;
Reid Spencer61c83e02006-08-18 08:43:06 +00005177 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00005178 ;}
5179 break;
5180
Reid Spencercd42c582006-12-05 23:29:42 +00005181 case 292:
Andrew Lenharth6353e052006-12-08 18:07:09 +00005182#line 2570 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00005183 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00005184 yyval.InstVal = new MallocInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
5185 delete yyvsp[-1].TypeVal;
Reid Spencer61c83e02006-08-18 08:43:06 +00005186 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00005187 ;}
5188 break;
5189
Reid Spencercd42c582006-12-05 23:29:42 +00005190 case 293:
Andrew Lenharth6353e052006-12-08 18:07:09 +00005191#line 2575 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00005192 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00005193 Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00005194 CHECK_FOR_ERROR
Andrew Lenharth6353e052006-12-08 18:07:09 +00005195 yyval.InstVal = new MallocInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
5196 delete yyvsp[-4].TypeVal;
Reid Spencer3822ff52006-11-08 06:47:33 +00005197 ;}
5198 break;
5199
Reid Spencercd42c582006-12-05 23:29:42 +00005200 case 294:
Andrew Lenharth6353e052006-12-08 18:07:09 +00005201#line 2581 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00005202 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00005203 yyval.InstVal = new AllocaInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
5204 delete yyvsp[-1].TypeVal;
Reid Spencer61c83e02006-08-18 08:43:06 +00005205 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00005206 ;}
5207 break;
5208
Reid Spencercd42c582006-12-05 23:29:42 +00005209 case 295:
Andrew Lenharth6353e052006-12-08 18:07:09 +00005210#line 2586 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00005211 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00005212 Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00005213 CHECK_FOR_ERROR
Andrew Lenharth6353e052006-12-08 18:07:09 +00005214 yyval.InstVal = new AllocaInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
5215 delete yyvsp[-4].TypeVal;
Reid Spencer3822ff52006-11-08 06:47:33 +00005216 ;}
5217 break;
5218
Reid Spencercd42c582006-12-05 23:29:42 +00005219 case 296:
Andrew Lenharth6353e052006-12-08 18:07:09 +00005220#line 2592 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00005221 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00005222 if (!isa<PointerType>(yyvsp[0].ValueVal->getType()))
5223 GEN_ERROR("Trying to free nonpointer type " +
5224 yyvsp[0].ValueVal->getType()->getDescription() + "!");
5225 yyval.InstVal = new FreeInst(yyvsp[0].ValueVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00005226 CHECK_FOR_ERROR
Reid Spencer3822ff52006-11-08 06:47:33 +00005227 ;}
5228 break;
5229
Reid Spencercd42c582006-12-05 23:29:42 +00005230 case 297:
Andrew Lenharth6353e052006-12-08 18:07:09 +00005231#line 2600 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer3822ff52006-11-08 06:47:33 +00005232 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00005233 if (!isa<PointerType>(yyvsp[-1].TypeVal->get()))
5234 GEN_ERROR("Can't load from nonpointer type: " +
5235 (*yyvsp[-1].TypeVal)->getDescription());
5236 if (!cast<PointerType>(yyvsp[-1].TypeVal->get())->getElementType()->isFirstClassType())
5237 GEN_ERROR("Can't load from pointer of non-first-class type: " +
5238 (*yyvsp[-1].TypeVal)->getDescription());
5239 Value* tmpVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal);
5240 CHECK_FOR_ERROR
5241 yyval.InstVal = new LoadInst(tmpVal, "", yyvsp[-3].BoolVal);
5242 delete yyvsp[-1].TypeVal;
5243 ;}
5244 break;
5245
5246 case 298:
5247#line 2612 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
5248 {
5249 const PointerType *PT = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
5250 if (!PT)
5251 GEN_ERROR("Can't store to a nonpointer type: " +
5252 (*yyvsp[-1].TypeVal)->getDescription());
5253 const Type *ElTy = PT->getElementType();
5254 if (ElTy != yyvsp[-3].ValueVal->getType())
5255 GEN_ERROR("Can't store '" + yyvsp[-3].ValueVal->getType()->getDescription() +
5256 "' into space of type '" + ElTy->getDescription() + "'!");
5257
5258 Value* tmpVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal);
5259 CHECK_FOR_ERROR
5260 yyval.InstVal = new StoreInst(yyvsp[-3].ValueVal, tmpVal, yyvsp[-5].BoolVal);
5261 delete yyvsp[-1].TypeVal;
5262 ;}
5263 break;
5264
5265 case 299:
5266#line 2627 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
5267 {
5268 if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
Reid Spencer61c83e02006-08-18 08:43:06 +00005269 GEN_ERROR("getelementptr insn requires pointer operand!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005270
Andrew Lenharth6353e052006-12-08 18:07:09 +00005271 if (!GetElementPtrInst::getIndexedType(*yyvsp[-2].TypeVal, *yyvsp[0].ValueList, true))
Reid Spencer61c83e02006-08-18 08:43:06 +00005272 GEN_ERROR("Invalid getelementptr indices for type '" +
Andrew Lenharth6353e052006-12-08 18:07:09 +00005273 (*yyvsp[-2].TypeVal)->getDescription()+ "'!");
5274 Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00005275 CHECK_FOR_ERROR
Andrew Lenharth6353e052006-12-08 18:07:09 +00005276 yyval.InstVal = new GetElementPtrInst(tmpVal, *yyvsp[0].ValueList);
5277 delete yyvsp[-2].TypeVal;
5278 delete yyvsp[0].ValueList;
Reid Spencer3822ff52006-11-08 06:47:33 +00005279 ;}
5280 break;
5281
5282
Reid Spencer3822ff52006-11-08 06:47:33 +00005283 }
5284
Andrew Lenharth6353e052006-12-08 18:07:09 +00005285/* Line 1000 of yacc.c. */
5286#line 5287 "llvmAsmParser.tab.c"
5287
5288 yyvsp -= yylen;
5289 yyssp -= yylen;
5290
5291
Reid Spencer3822ff52006-11-08 06:47:33 +00005292 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005293
5294 *++yyvsp = yyval;
5295
5296
Reid Spencer3822ff52006-11-08 06:47:33 +00005297 /* Now `shift' the result of the reduction. Determine what state
5298 that goes to, based on the state we popped back to and the rule
5299 number reduced by. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00005300
5301 yyn = yyr1[yyn];
5302
Reid Spencer3822ff52006-11-08 06:47:33 +00005303 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5304 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00005305 yystate = yytable[yystate];
5306 else
Reid Spencer3822ff52006-11-08 06:47:33 +00005307 yystate = yydefgoto[yyn - YYNTOKENS];
Reid Spencer68a24bd2005-08-27 18:50:39 +00005308
5309 goto yynewstate;
5310
5311
Reid Spencer3822ff52006-11-08 06:47:33 +00005312/*------------------------------------.
5313| yyerrlab -- here on detecting error |
5314`------------------------------------*/
5315yyerrlab:
5316 /* If not already recovering from an error, report this error. */
5317 if (!yyerrstatus)
Reid Spencer68a24bd2005-08-27 18:50:39 +00005318 {
5319 ++yynerrs;
Andrew Lenharth6353e052006-12-08 18:07:09 +00005320#if YYERROR_VERBOSE
5321 yyn = yypact[yystate];
Bill Wendlinge8156192006-12-07 01:30:32 +00005322
Andrew Lenharth6353e052006-12-08 18:07:09 +00005323 if (YYPACT_NINF < yyn && yyn < YYLAST)
5324 {
5325 YYSIZE_T yysize = 0;
5326 int yytype = YYTRANSLATE (yychar);
5327 const char* yyprefix;
5328 char *yymsg;
5329 int yyx;
5330
5331 /* Start YYX at -YYN if negative to avoid negative indexes in
5332 YYCHECK. */
5333 int yyxbegin = yyn < 0 ? -yyn : 0;
5334
5335 /* Stay within bounds of both yycheck and yytname. */
5336 int yychecklim = YYLAST - yyn;
5337 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
5338 int yycount = 0;
5339
5340 yyprefix = ", expecting ";
5341 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5342 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5343 {
5344 yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
5345 yycount += 1;
5346 if (yycount == 5)
5347 {
5348 yysize = 0;
5349 break;
5350 }
5351 }
5352 yysize += (sizeof ("syntax error, unexpected ")
5353 + yystrlen (yytname[yytype]));
5354 yymsg = (char *) YYSTACK_ALLOC (yysize);
5355 if (yymsg != 0)
5356 {
5357 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
5358 yyp = yystpcpy (yyp, yytname[yytype]);
5359
5360 if (yycount < 5)
5361 {
5362 yyprefix = ", expecting ";
5363 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5364 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5365 {
5366 yyp = yystpcpy (yyp, yyprefix);
5367 yyp = yystpcpy (yyp, yytname[yyx]);
5368 yyprefix = " or ";
5369 }
5370 }
5371 yyerror (yymsg);
5372 YYSTACK_FREE (yymsg);
5373 }
5374 else
5375 yyerror ("syntax error; also virtual memory exhausted");
5376 }
5377 else
5378#endif /* YYERROR_VERBOSE */
5379 yyerror ("syntax error");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005380 }
5381
Reid Spencer3822ff52006-11-08 06:47:33 +00005382
Reid Spencer68a24bd2005-08-27 18:50:39 +00005383
5384 if (yyerrstatus == 3)
5385 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00005386 /* If just tried and failed to reuse lookahead token after an
Reid Spencer3822ff52006-11-08 06:47:33 +00005387 error, discard it. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00005388
Reid Spencer3822ff52006-11-08 06:47:33 +00005389 if (yychar <= YYEOF)
Andrew Lenharth6353e052006-12-08 18:07:09 +00005390 {
5391 /* If at end of input, pop the error token,
5392 then the rest of the stack, then return failure. */
Reid Spencer3822ff52006-11-08 06:47:33 +00005393 if (yychar == YYEOF)
Andrew Lenharth6353e052006-12-08 18:07:09 +00005394 for (;;)
5395 {
5396 YYPOPSTACK;
5397 if (yyssp == yyss)
5398 YYABORT;
5399 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
5400 yydestruct (yystos[*yyssp], yyvsp);
5401 }
5402 }
Reid Spencer3822ff52006-11-08 06:47:33 +00005403 else
5404 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00005405 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
5406 yydestruct (yytoken, &yylval);
Reid Spencer3822ff52006-11-08 06:47:33 +00005407 yychar = YYEMPTY;
Andrew Lenharth6353e052006-12-08 18:07:09 +00005408
Reid Spencer3822ff52006-11-08 06:47:33 +00005409 }
5410 }
5411
Andrew Lenharth6353e052006-12-08 18:07:09 +00005412 /* Else will try to reuse lookahead token after shifting the error
Reid Spencer3822ff52006-11-08 06:47:33 +00005413 token. */
5414 goto yyerrlab1;
5415
5416
5417/*---------------------------------------------------.
5418| yyerrorlab -- error raised explicitly by YYERROR. |
5419`---------------------------------------------------*/
5420yyerrorlab:
5421
Andrew Lenharth6353e052006-12-08 18:07:09 +00005422#ifdef __GNUC__
5423 /* Pacify GCC when the user code never invokes YYERROR and the label
5424 yyerrorlab therefore never appears in user code. */
5425 if (0)
Reid Spencer3822ff52006-11-08 06:47:33 +00005426 goto yyerrorlab;
Andrew Lenharth6353e052006-12-08 18:07:09 +00005427#endif
Reid Spencer3822ff52006-11-08 06:47:33 +00005428
Andrew Lenharth6353e052006-12-08 18:07:09 +00005429 yyvsp -= yylen;
5430 yyssp -= yylen;
Reid Spencer3822ff52006-11-08 06:47:33 +00005431 yystate = *yyssp;
5432 goto yyerrlab1;
5433
5434
5435/*-------------------------------------------------------------.
5436| yyerrlab1 -- common code for both syntax error and YYERROR. |
5437`-------------------------------------------------------------*/
5438yyerrlab1:
5439 yyerrstatus = 3; /* Each real token shifted decrements this. */
5440
5441 for (;;)
5442 {
5443 yyn = yypact[yystate];
5444 if (yyn != YYPACT_NINF)
5445 {
5446 yyn += YYTERROR;
5447 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5448 {
5449 yyn = yytable[yyn];
5450 if (0 < yyn)
5451 break;
5452 }
5453 }
5454
5455 /* Pop the current state because it cannot handle the error token. */
5456 if (yyssp == yyss)
Reid Spencer68a24bd2005-08-27 18:50:39 +00005457 YYABORT;
5458
Andrew Lenharth6353e052006-12-08 18:07:09 +00005459 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
5460 yydestruct (yystos[yystate], yyvsp);
5461 YYPOPSTACK;
Reid Spencer3822ff52006-11-08 06:47:33 +00005462 yystate = *yyssp;
5463 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005464 }
5465
5466 if (yyn == YYFINAL)
5467 YYACCEPT;
5468
Andrew Lenharth6353e052006-12-08 18:07:09 +00005469 YYDPRINTF ((stderr, "Shifting error token, "));
5470
Reid Spencer68a24bd2005-08-27 18:50:39 +00005471 *++yyvsp = yylval;
Reid Spencer3822ff52006-11-08 06:47:33 +00005472
5473
Reid Spencer68a24bd2005-08-27 18:50:39 +00005474 yystate = yyn;
5475 goto yynewstate;
5476
Chris Lattnerf49c1762006-11-08 05:58:47 +00005477
Reid Spencer3822ff52006-11-08 06:47:33 +00005478/*-------------------------------------.
5479| yyacceptlab -- YYACCEPT comes here. |
5480`-------------------------------------*/
5481yyacceptlab:
5482 yyresult = 0;
5483 goto yyreturn;
5484
5485/*-----------------------------------.
5486| yyabortlab -- YYABORT comes here. |
5487`-----------------------------------*/
5488yyabortlab:
5489 yyresult = 1;
5490 goto yyreturn;
5491
5492#ifndef yyoverflow
Andrew Lenharth6353e052006-12-08 18:07:09 +00005493/*----------------------------------------------.
5494| yyoverflowlab -- parser overflow comes here. |
5495`----------------------------------------------*/
5496yyoverflowlab:
5497 yyerror ("parser stack overflow");
Reid Spencer3822ff52006-11-08 06:47:33 +00005498 yyresult = 2;
5499 /* Fall through. */
Chris Lattnerf49c1762006-11-08 05:58:47 +00005500#endif
Reid Spencer3822ff52006-11-08 06:47:33 +00005501
5502yyreturn:
Reid Spencer3822ff52006-11-08 06:47:33 +00005503#ifndef yyoverflow
5504 if (yyss != yyssa)
5505 YYSTACK_FREE (yyss);
5506#endif
Andrew Lenharth6353e052006-12-08 18:07:09 +00005507 return yyresult;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005508}
Reid Spencer3822ff52006-11-08 06:47:33 +00005509
5510
Andrew Lenharth6353e052006-12-08 18:07:09 +00005511#line 2642 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
Reid Spencer61c83e02006-08-18 08:43:06 +00005512
5513
5514void llvm::GenerateError(const std::string &message, int LineNo) {
5515 if (LineNo == -1) LineNo = llvmAsmlineno;
5516 // TODO: column number in exception
5517 if (TheParseError)
5518 TheParseError->setError(CurFilename, message, LineNo);
5519 TriggerError = 1;
5520}
Reid Spencer68a24bd2005-08-27 18:50:39 +00005521
5522int yyerror(const char *ErrorMsg) {
5523 std::string where
5524 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5525 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5526 std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading ";
5527 if (yychar == YYEMPTY || yychar == 0)
5528 errMsg += "end-of-file.";
5529 else
5530 errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'";
Reid Spencer61c83e02006-08-18 08:43:06 +00005531 GenerateError(errMsg);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005532 return 0;
5533}
Reid Spencer3822ff52006-11-08 06:47:33 +00005534