blob: f11f291e1000c92568509a5b2c1e19c614f16951 [file] [log] [blame]
Reid Spencer5cbf9852007-01-30 20:08:39 +00001/* A Bison parser, made by GNU Bison 2.1. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002
Reid Spencer5cbf9852007-01-30 20:08:39 +00003/* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +00005
Reid Spencerb0fcf8f2007-01-17 02:48:45 +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 Korobeynikov178a3522007-01-12 19:22:51 +000010
Reid Spencerb0fcf8f2007-01-17 02:48:45 +000011 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
Reid Spencer41dff5e2007-01-26 08:05:27 +000018 Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA. */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +000020
Reid Spencer5cbf9852007-01-30 20:08:39 +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 Spencerb0fcf8f2007-01-17 02:48:45 +000025
Reid Spencer5cbf9852007-01-30 20:08:39 +000026/* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +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. */
Reid Spencer41dff5e2007-01-26 08:05:27 +000037#define YYBISON 1
38
39/* Bison version. */
Reid Spencer5cbf9852007-01-30 20:08:39 +000040#define YYBISON_VERSION "2.1"
Reid Spencer41dff5e2007-01-26 08:05:27 +000041
42/* Skeleton name. */
43#define YYSKELETON_NAME "yacc.c"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +000044
45/* Pure parsers. */
Reid Spencer41dff5e2007-01-26 08:05:27 +000046#define YYPURE 0
Reid Spencerb0fcf8f2007-01-17 02:48:45 +000047
48/* Using locations. */
49#define YYLSP_NEEDED 0
50
Reid Spencer41dff5e2007-01-26 08:05:27 +000051/* Substitute the variable and function names. */
Reid Spencer68a24bd2005-08-27 18:50:39 +000052#define yyparse llvmAsmparse
Reid Spencerb0fcf8f2007-01-17 02:48:45 +000053#define yylex llvmAsmlex
Reid Spencer68a24bd2005-08-27 18:50:39 +000054#define yyerror llvmAsmerror
Reid Spencerb0fcf8f2007-01-17 02:48:45 +000055#define yylval llvmAsmlval
56#define yychar llvmAsmchar
Reid Spencer68a24bd2005-08-27 18:50:39 +000057#define yydebug llvmAsmdebug
58#define yynerrs llvmAsmnerrs
59
Reid Spencerb0fcf8f2007-01-17 02:48:45 +000060
61/* Tokens. */
62#ifndef YYTOKENTYPE
63# define YYTOKENTYPE
64 /* Put the tokens into the symbol table, so that GDB and other debuggers
65 know about them. */
66 enum yytokentype {
67 ESINT64VAL = 258,
68 EUINT64VAL = 259,
Reid Spencer41dff5e2007-01-26 08:05:27 +000069 LOCALVAL_ID = 260,
70 GLOBALVAL_ID = 261,
Reid Spencerb0fcf8f2007-01-17 02:48:45 +000071 FPVAL = 262,
72 VOID = 263,
73 INTTYPE = 264,
74 FLOAT = 265,
75 DOUBLE = 266,
76 LABEL = 267,
77 TYPE = 268,
Reid Spencer41dff5e2007-01-26 08:05:27 +000078 LOCALVAR = 269,
79 GLOBALVAR = 270,
80 LABELSTR = 271,
81 STRINGCONSTANT = 272,
82 ATSTRINGCONSTANT = 273,
83 IMPLEMENTATION = 274,
84 ZEROINITIALIZER = 275,
85 TRUETOK = 276,
86 FALSETOK = 277,
87 BEGINTOK = 278,
88 ENDTOK = 279,
89 DECLARE = 280,
90 DEFINE = 281,
91 GLOBAL = 282,
92 CONSTANT = 283,
93 SECTION = 284,
94 VOLATILE = 285,
95 TO = 286,
96 DOTDOTDOT = 287,
97 NULL_TOK = 288,
98 UNDEF = 289,
99 INTERNAL = 290,
100 LINKONCE = 291,
101 WEAK = 292,
102 APPENDING = 293,
103 DLLIMPORT = 294,
104 DLLEXPORT = 295,
105 EXTERN_WEAK = 296,
106 OPAQUE = 297,
107 EXTERNAL = 298,
108 TARGET = 299,
109 TRIPLE = 300,
110 ALIGN = 301,
111 DEPLIBS = 302,
112 CALL = 303,
113 TAIL = 304,
114 ASM_TOK = 305,
115 MODULE = 306,
116 SIDEEFFECT = 307,
117 CC_TOK = 308,
118 CCC_TOK = 309,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +0000119 FASTCC_TOK = 310,
120 COLDCC_TOK = 311,
121 X86_STDCALLCC_TOK = 312,
122 X86_FASTCALLCC_TOK = 313,
123 DATALAYOUT = 314,
124 RET = 315,
125 BR = 316,
126 SWITCH = 317,
127 INVOKE = 318,
128 UNWIND = 319,
129 UNREACHABLE = 320,
130 ADD = 321,
131 SUB = 322,
132 MUL = 323,
133 UDIV = 324,
134 SDIV = 325,
135 FDIV = 326,
136 UREM = 327,
137 SREM = 328,
138 FREM = 329,
139 AND = 330,
140 OR = 331,
141 XOR = 332,
142 ICMP = 333,
143 FCMP = 334,
144 EQ = 335,
145 NE = 336,
146 SLT = 337,
147 SGT = 338,
148 SLE = 339,
149 SGE = 340,
150 ULT = 341,
151 UGT = 342,
152 ULE = 343,
153 UGE = 344,
154 OEQ = 345,
155 ONE = 346,
156 OLT = 347,
157 OGT = 348,
158 OLE = 349,
159 OGE = 350,
160 ORD = 351,
161 UNO = 352,
162 UEQ = 353,
163 UNE = 354,
164 MALLOC = 355,
165 ALLOCA = 356,
166 FREE = 357,
167 LOAD = 358,
168 STORE = 359,
169 GETELEMENTPTR = 360,
170 TRUNC = 361,
171 ZEXT = 362,
172 SEXT = 363,
173 FPTRUNC = 364,
174 FPEXT = 365,
175 BITCAST = 366,
176 UITOFP = 367,
177 SITOFP = 368,
178 FPTOUI = 369,
179 FPTOSI = 370,
180 INTTOPTR = 371,
181 PTRTOINT = 372,
182 PHI_TOK = 373,
183 SELECT = 374,
184 SHL = 375,
185 LSHR = 376,
186 ASHR = 377,
187 VAARG = 378,
188 EXTRACTELEMENT = 379,
189 INSERTELEMENT = 380,
190 SHUFFLEVECTOR = 381,
191 NORETURN = 382,
192 INREG = 383,
193 SRET = 384,
194 DEFAULT = 385,
195 HIDDEN = 386
Reid Spencerb0fcf8f2007-01-17 02:48:45 +0000196 };
197#endif
Reid Spencer41dff5e2007-01-26 08:05:27 +0000198/* Tokens. */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +0000199#define ESINT64VAL 258
200#define EUINT64VAL 259
Reid Spencer41dff5e2007-01-26 08:05:27 +0000201#define LOCALVAL_ID 260
202#define GLOBALVAL_ID 261
Reid Spencerb0fcf8f2007-01-17 02:48:45 +0000203#define FPVAL 262
204#define VOID 263
205#define INTTYPE 264
206#define FLOAT 265
207#define DOUBLE 266
208#define LABEL 267
209#define TYPE 268
Reid Spencer41dff5e2007-01-26 08:05:27 +0000210#define LOCALVAR 269
211#define GLOBALVAR 270
212#define LABELSTR 271
213#define STRINGCONSTANT 272
214#define ATSTRINGCONSTANT 273
215#define IMPLEMENTATION 274
216#define ZEROINITIALIZER 275
217#define TRUETOK 276
218#define FALSETOK 277
219#define BEGINTOK 278
220#define ENDTOK 279
221#define DECLARE 280
222#define DEFINE 281
223#define GLOBAL 282
224#define CONSTANT 283
225#define SECTION 284
226#define VOLATILE 285
227#define TO 286
228#define DOTDOTDOT 287
229#define NULL_TOK 288
230#define UNDEF 289
231#define INTERNAL 290
232#define LINKONCE 291
233#define WEAK 292
234#define APPENDING 293
235#define DLLIMPORT 294
236#define DLLEXPORT 295
237#define EXTERN_WEAK 296
238#define OPAQUE 297
239#define EXTERNAL 298
240#define TARGET 299
241#define TRIPLE 300
242#define ALIGN 301
243#define DEPLIBS 302
244#define CALL 303
245#define TAIL 304
246#define ASM_TOK 305
247#define MODULE 306
248#define SIDEEFFECT 307
249#define CC_TOK 308
250#define CCC_TOK 309
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +0000251#define FASTCC_TOK 310
252#define COLDCC_TOK 311
253#define X86_STDCALLCC_TOK 312
254#define X86_FASTCALLCC_TOK 313
255#define DATALAYOUT 314
256#define RET 315
257#define BR 316
258#define SWITCH 317
259#define INVOKE 318
260#define UNWIND 319
261#define UNREACHABLE 320
262#define ADD 321
263#define SUB 322
264#define MUL 323
265#define UDIV 324
266#define SDIV 325
267#define FDIV 326
268#define UREM 327
269#define SREM 328
270#define FREM 329
271#define AND 330
272#define OR 331
273#define XOR 332
274#define ICMP 333
275#define FCMP 334
276#define EQ 335
277#define NE 336
278#define SLT 337
279#define SGT 338
280#define SLE 339
281#define SGE 340
282#define ULT 341
283#define UGT 342
284#define ULE 343
285#define UGE 344
286#define OEQ 345
287#define ONE 346
288#define OLT 347
289#define OGT 348
290#define OLE 349
291#define OGE 350
292#define ORD 351
293#define UNO 352
294#define UEQ 353
295#define UNE 354
296#define MALLOC 355
297#define ALLOCA 356
298#define FREE 357
299#define LOAD 358
300#define STORE 359
301#define GETELEMENTPTR 360
302#define TRUNC 361
303#define ZEXT 362
304#define SEXT 363
305#define FPTRUNC 364
306#define FPEXT 365
307#define BITCAST 366
308#define UITOFP 367
309#define SITOFP 368
310#define FPTOUI 369
311#define FPTOSI 370
312#define INTTOPTR 371
313#define PTRTOINT 372
314#define PHI_TOK 373
315#define SELECT 374
316#define SHL 375
317#define LSHR 376
318#define ASHR 377
319#define VAARG 378
320#define EXTRACTELEMENT 379
321#define INSERTELEMENT 380
322#define SHUFFLEVECTOR 381
323#define NORETURN 382
324#define INREG 383
325#define SRET 384
326#define DEFAULT 385
327#define HIDDEN 386
Reid Spencerb0fcf8f2007-01-17 02:48:45 +0000328
329
330
331
332/* Copy the first part of user declarations. */
Reid Spencer5cbf9852007-01-30 20:08:39 +0000333#line 14 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000334
335#include "ParserInternals.h"
336#include "llvm/CallingConv.h"
Chris Lattner0e9c3762006-01-25 22:27:16 +0000337#include "llvm/InlineAsm.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000338#include "llvm/Instructions.h"
339#include "llvm/Module.h"
340#include "llvm/SymbolTable.h"
341#include "llvm/Support/GetElementPtrTypeIterator.h"
Reid Spencer14310612006-12-31 05:40:51 +0000342#include "llvm/Support/CommandLine.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000343#include "llvm/ADT/STLExtras.h"
Chris Lattner0019bbe2005-11-06 06:46:53 +0000344#include "llvm/Support/MathExtras.h"
Reid Spencer481169e2006-12-01 00:33:46 +0000345#include "llvm/Support/Streams.h"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000346#include <algorithm>
Reid Spencer68a24bd2005-08-27 18:50:39 +0000347#include <list>
348#include <utility>
Reid Spencer14310612006-12-31 05:40:51 +0000349#ifndef NDEBUG
350#define YYDEBUG 1
351#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000352
Reid Spencere4f47592006-08-18 17:32:55 +0000353// The following is a gross hack. In order to rid the libAsmParser library of
354// exceptions, we have to have a way of getting the yyparse function to go into
355// an error situation. So, whenever we want an error to occur, the GenerateError
356// function (see bottom of file) sets TriggerError. Then, at the end of each
357// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
358// (a goto) to put YACC in error state. Furthermore, several calls to
359// GenerateError are made from inside productions and they must simulate the
360// previous exception behavior by exiting the production immediately. We have
361// replaced these with the GEN_ERROR macro which calls GeneratError and then
362// immediately invokes YYERROR. This would be so much cleaner if it was a
363// recursive descent parser.
Reid Spencer61c83e02006-08-18 08:43:06 +0000364static bool TriggerError = false;
Reid Spencerf63697d2006-10-09 17:36:59 +0000365#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } }
Reid Spencer61c83e02006-08-18 08:43:06 +0000366#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
367
Reid Spencer68a24bd2005-08-27 18:50:39 +0000368int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
369int yylex(); // declaration" of xxx warnings.
370int yyparse();
371
372namespace llvm {
373 std::string CurFilename;
Reid Spencer14310612006-12-31 05:40:51 +0000374#if YYDEBUG
375static cl::opt<bool>
376Debug("debug-yacc", cl::desc("Print yacc debug state changes"),
377 cl::Hidden, cl::init(false));
378#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +0000379}
380using namespace llvm;
381
382static Module *ParserResult;
383
384// DEBUG_UPREFS - Define this symbol if you want to enable debugging output
385// relating to upreferences in the input stream.
386//
387//#define DEBUG_UPREFS 1
388#ifdef DEBUG_UPREFS
Bill Wendlinge8156192006-12-07 01:30:32 +0000389#define UR_OUT(X) cerr << X
Reid Spencer68a24bd2005-08-27 18:50:39 +0000390#else
391#define UR_OUT(X)
392#endif
393
394#define YYERROR_VERBOSE 1
395
Chris Lattnerb475c422005-11-12 18:22:38 +0000396static GlobalVariable *CurGV;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000397
398
399// This contains info used when building the body of a function. It is
400// destroyed when the function is completed.
401//
402typedef std::vector<Value *> ValueList; // Numbered defs
Reid Spencer14310612006-12-31 05:40:51 +0000403
Reid Spencer68a24bd2005-08-27 18:50:39 +0000404static void
405ResolveDefinitions(std::map<const Type *,ValueList> &LateResolvers,
406 std::map<const Type *,ValueList> *FutureLateResolvers = 0);
407
408static struct PerModuleInfo {
409 Module *CurrentModule;
410 std::map<const Type *, ValueList> Values; // Module level numbered definitions
411 std::map<const Type *,ValueList> LateResolveValues;
Reid Spencer861d9d62006-11-28 07:29:44 +0000412 std::vector<PATypeHolder> Types;
413 std::map<ValID, PATypeHolder> LateResolveTypes;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000414
415 /// PlaceHolderInfo - When temporary placeholder objects are created, remember
Chris Lattner0ad19702006-06-21 16:53:00 +0000416 /// how they were referenced and on which line of the input they came from so
Reid Spencer68a24bd2005-08-27 18:50:39 +0000417 /// that we can resolve them later and print error messages as appropriate.
418 std::map<Value*, std::pair<ValID, int> > PlaceHolderInfo;
419
420 // GlobalRefs - This maintains a mapping between <Type, ValID>'s and forward
421 // references to global values. Global values may be referenced before they
422 // are defined, and if so, the temporary object that they represent is held
423 // here. This is used for forward references of GlobalValues.
424 //
425 typedef std::map<std::pair<const PointerType *,
426 ValID>, GlobalValue*> GlobalRefsType;
427 GlobalRefsType GlobalRefs;
428
429 void ModuleDone() {
430 // If we could not resolve some functions at function compilation time
431 // (calls to functions before they are defined), resolve them now... Types
432 // are resolved when the constant pool has been completely parsed.
433 //
434 ResolveDefinitions(LateResolveValues);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000435 if (TriggerError)
436 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000437
438 // Check to make sure that all global value forward references have been
439 // resolved!
440 //
441 if (!GlobalRefs.empty()) {
442 std::string UndefinedReferences = "Unresolved global references exist:\n";
443
444 for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end();
445 I != E; ++I) {
446 UndefinedReferences += " " + I->first.first->getDescription() + " " +
447 I->first.second.getName() + "\n";
448 }
Reid Spencer61c83e02006-08-18 08:43:06 +0000449 GenerateError(UndefinedReferences);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000450 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000451 }
452
453 Values.clear(); // Clear out function local definitions
454 Types.clear();
455 CurrentModule = 0;
456 }
457
Reid Spencer68a24bd2005-08-27 18:50:39 +0000458 // GetForwardRefForGlobal - Check to see if there is a forward reference
459 // for this global. If so, remove it from the GlobalRefs map and return it.
460 // If not, just return null.
461 GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) {
462 // Check to see if there is a forward reference to this global variable...
463 // if there is, eliminate it and patch the reference to use the new def'n.
464 GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID));
465 GlobalValue *Ret = 0;
466 if (I != GlobalRefs.end()) {
467 Ret = I->second;
468 GlobalRefs.erase(I);
469 }
470 return Ret;
471 }
Reid Spencer8c8a2dc2007-01-02 21:54:12 +0000472
473 bool TypeIsUnresolved(PATypeHolder* PATy) {
474 // If it isn't abstract, its resolved
475 const Type* Ty = PATy->get();
476 if (!Ty->isAbstract())
477 return false;
478 // Traverse the type looking for abstract types. If it isn't abstract then
479 // we don't need to traverse that leg of the type.
480 std::vector<const Type*> WorkList, SeenList;
481 WorkList.push_back(Ty);
482 while (!WorkList.empty()) {
483 const Type* Ty = WorkList.back();
484 SeenList.push_back(Ty);
485 WorkList.pop_back();
486 if (const OpaqueType* OpTy = dyn_cast<OpaqueType>(Ty)) {
487 // Check to see if this is an unresolved type
488 std::map<ValID, PATypeHolder>::iterator I = LateResolveTypes.begin();
489 std::map<ValID, PATypeHolder>::iterator E = LateResolveTypes.end();
490 for ( ; I != E; ++I) {
491 if (I->second.get() == OpTy)
492 return true;
493 }
494 } else if (const SequentialType* SeqTy = dyn_cast<SequentialType>(Ty)) {
495 const Type* TheTy = SeqTy->getElementType();
496 if (TheTy->isAbstract() && TheTy != Ty) {
497 std::vector<const Type*>::iterator I = SeenList.begin(),
498 E = SeenList.end();
499 for ( ; I != E; ++I)
500 if (*I == TheTy)
501 break;
502 if (I == E)
503 WorkList.push_back(TheTy);
504 }
505 } else if (const StructType* StrTy = dyn_cast<StructType>(Ty)) {
506 for (unsigned i = 0; i < StrTy->getNumElements(); ++i) {
507 const Type* TheTy = StrTy->getElementType(i);
508 if (TheTy->isAbstract() && TheTy != Ty) {
509 std::vector<const Type*>::iterator I = SeenList.begin(),
510 E = SeenList.end();
511 for ( ; I != E; ++I)
512 if (*I == TheTy)
513 break;
514 if (I == E)
515 WorkList.push_back(TheTy);
516 }
517 }
518 }
519 }
520 return false;
521 }
522
523
Reid Spencer68a24bd2005-08-27 18:50:39 +0000524} CurModule;
525
526static struct PerFunctionInfo {
527 Function *CurrentFunction; // Pointer to current function being created
528
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000529 std::map<const Type*, ValueList> Values; // Keep track of #'d definitions
Reid Spencer68a24bd2005-08-27 18:50:39 +0000530 std::map<const Type*, ValueList> LateResolveValues;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000531 bool isDeclare; // Is this function a forward declararation?
532 GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration.
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000533 GlobalValue::VisibilityTypes Visibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000534
535 /// BBForwardRefs - When we see forward references to basic blocks, keep
536 /// track of them here.
537 std::map<BasicBlock*, std::pair<ValID, int> > BBForwardRefs;
538 std::vector<BasicBlock*> NumberedBlocks;
539 unsigned NextBBNum;
540
541 inline PerFunctionInfo() {
542 CurrentFunction = 0;
543 isDeclare = false;
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000544 Linkage = GlobalValue::ExternalLinkage;
545 Visibility = GlobalValue::DefaultVisibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000546 }
547
548 inline void FunctionStart(Function *M) {
549 CurrentFunction = M;
550 NextBBNum = 0;
551 }
552
553 void FunctionDone() {
554 NumberedBlocks.clear();
555
556 // Any forward referenced blocks left?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000557 if (!BBForwardRefs.empty()) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000558 GenerateError("Undefined reference to label " +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000559 BBForwardRefs.begin()->first->getName());
Reid Spencer5b7e7532006-09-28 19:28:24 +0000560 return;
561 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000562
563 // Resolve all forward references now.
564 ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
565
566 Values.clear(); // Clear out function local definitions
567 CurrentFunction = 0;
568 isDeclare = false;
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +0000569 Linkage = GlobalValue::ExternalLinkage;
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000570 Visibility = GlobalValue::DefaultVisibility;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000571 }
572} CurFun; // Info for the current function...
573
574static bool inFunctionScope() { return CurFun.CurrentFunction != 0; }
575
576
577//===----------------------------------------------------------------------===//
578// Code to handle definitions of all the types
579//===----------------------------------------------------------------------===//
580
581static int InsertValue(Value *V,
582 std::map<const Type*,ValueList> &ValueTab = CurFun.Values) {
583 if (V->hasName()) return -1; // Is this a numbered definition?
584
585 // Yes, insert the value into the value table...
586 ValueList &List = ValueTab[V->getType()];
587 List.push_back(V);
588 return List.size()-1;
589}
590
591static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
592 switch (D.Type) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000593 case ValID::LocalID: // Is it a numbered definition?
Reid Spencer68a24bd2005-08-27 18:50:39 +0000594 // Module constants occupy the lowest numbered slots...
Reid Spencer41dff5e2007-01-26 08:05:27 +0000595 if (D.Num < CurModule.Types.size())
596 return CurModule.Types[D.Num];
Reid Spencer68a24bd2005-08-27 18:50:39 +0000597 break;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000598 case ValID::LocalName: // Is it a named definition?
Reid Spencer68a24bd2005-08-27 18:50:39 +0000599 if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) {
600 D.destroy(); // Free old strdup'd memory...
601 return N;
602 }
603 break;
604 default:
Reid Spencer61c83e02006-08-18 08:43:06 +0000605 GenerateError("Internal parser error: Invalid symbol type reference!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000606 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000607 }
608
609 // If we reached here, we referenced either a symbol that we don't know about
610 // or an id number that hasn't been read yet. We may be referencing something
611 // forward, so just create an entry to be resolved later and get to it...
612 //
613 if (DoNotImprovise) return 0; // Do we just want a null to be returned?
614
615
616 if (inFunctionScope()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000617 if (D.Type == ValID::LocalName) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000618 GenerateError("Reference to an undefined type: '" + D.getName() + "'");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000619 return 0;
620 } else {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000621 GenerateError("Reference to an undefined type: #" + utostr(D.Num));
Reid Spencer5b7e7532006-09-28 19:28:24 +0000622 return 0;
623 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000624 }
625
Reid Spencer861d9d62006-11-28 07:29:44 +0000626 std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000627 if (I != CurModule.LateResolveTypes.end())
Reid Spencer861d9d62006-11-28 07:29:44 +0000628 return I->second;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000629
Reid Spencer861d9d62006-11-28 07:29:44 +0000630 Type *Typ = OpaqueType::get();
631 CurModule.LateResolveTypes.insert(std::make_pair(D, Typ));
632 return Typ;
Reid Spencera132e042006-12-03 05:46:11 +0000633 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000634
Reid Spencer68a24bd2005-08-27 18:50:39 +0000635// getValNonImprovising - Look up the value specified by the provided type and
636// the provided ValID. If the value exists and has already been defined, return
637// it. Otherwise return null.
638//
639static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000640 if (isa<FunctionType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000641 GenerateError("Functions are not values and "
Reid Spencer68a24bd2005-08-27 18:50:39 +0000642 "must be referenced as pointers");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000643 return 0;
644 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000645
646 switch (D.Type) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000647 case ValID::LocalID: { // Is it a numbered definition?
648 // Module constants occupy the lowest numbered slots.
649 std::map<const Type*,ValueList>::iterator VI = CurFun.Values.find(Ty);
650 // Make sure that our type is within bounds.
Reid Spencer68a24bd2005-08-27 18:50:39 +0000651 if (VI == CurFun.Values.end()) return 0;
652
Reid Spencer41dff5e2007-01-26 08:05:27 +0000653 // Check that the number is within bounds.
654 if (D.Num >= VI->second.size()) return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000655
Reid Spencer41dff5e2007-01-26 08:05:27 +0000656 return VI->second[D.Num];
657 }
658 case ValID::GlobalID: { // Is it a numbered definition?
659 unsigned Num = D.Num;
660
661 // Module constants occupy the lowest numbered slots...
662 std::map<const Type*,ValueList>::iterator VI = CurModule.Values.find(Ty);
663 if (VI == CurModule.Values.end()) return 0;
664 if (D.Num >= VI->second.size()) return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000665 return VI->second[Num];
666 }
Reid Spencer41dff5e2007-01-26 08:05:27 +0000667
668 case ValID::LocalName: { // Is it a named definition?
669 if (!inFunctionScope()) return 0;
670 SymbolTable &SymTab = CurFun.CurrentFunction->getValueSymbolTable();
671 Value *N = SymTab.lookup(Ty, D.Name);
672 if (N == 0) return 0;
673
674 D.destroy(); // Free old strdup'd memory...
675 return N;
676 }
677 case ValID::GlobalName: { // Is it a named definition?
678 SymbolTable &SymTab = CurModule.CurrentModule->getValueSymbolTable();
679 Value *N = SymTab.lookup(Ty, D.Name);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000680 if (N == 0) return 0;
681
682 D.destroy(); // Free old strdup'd memory...
683 return N;
684 }
685
686 // Check to make sure that "Ty" is an integral type, and that our
687 // value will fit into the specified type...
688 case ValID::ConstSIntVal: // Is it a constant pool reference??
Reid Spencerb83eb642006-10-20 07:07:24 +0000689 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000690 GenerateError("Signed integral constant '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000691 itostr(D.ConstPool64) + "' is invalid for type '" +
692 Ty->getDescription() + "'!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000693 return 0;
694 }
Reid Spencerb83eb642006-10-20 07:07:24 +0000695 return ConstantInt::get(Ty, D.ConstPool64);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000696
697 case ValID::ConstUIntVal: // Is it an unsigned const pool reference?
Reid Spencerb83eb642006-10-20 07:07:24 +0000698 if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) {
699 if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000700 GenerateError("Integral constant '" + utostr(D.UConstPool64) +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000701 "' is invalid or out of range!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000702 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000703 } else { // This is really a signed reference. Transmogrify.
Reid Spencerb83eb642006-10-20 07:07:24 +0000704 return ConstantInt::get(Ty, D.ConstPool64);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000705 }
706 } else {
Reid Spencerb83eb642006-10-20 07:07:24 +0000707 return ConstantInt::get(Ty, D.UConstPool64);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000708 }
709
710 case ValID::ConstFPVal: // Is it a floating point const pool reference?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000711 if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000712 GenerateError("FP constant invalid for type!!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000713 return 0;
714 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000715 return ConstantFP::get(Ty, D.ConstPoolFP);
716
717 case ValID::ConstNullVal: // Is it a null value?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000718 if (!isa<PointerType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000719 GenerateError("Cannot create a a non pointer null!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000720 return 0;
721 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000722 return ConstantPointerNull::get(cast<PointerType>(Ty));
723
724 case ValID::ConstUndefVal: // Is it an undef value?
725 return UndefValue::get(Ty);
726
Chris Lattner7aa61892005-12-21 17:53:23 +0000727 case ValID::ConstZeroVal: // Is it a zero value?
728 return Constant::getNullValue(Ty);
729
Reid Spencer68a24bd2005-08-27 18:50:39 +0000730 case ValID::ConstantVal: // Fully resolved constant?
Reid Spencer5b7e7532006-09-28 19:28:24 +0000731 if (D.ConstantValue->getType() != Ty) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000732 GenerateError("Constant expression type different from required type!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000733 return 0;
734 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000735 return D.ConstantValue;
736
Chris Lattner0e9c3762006-01-25 22:27:16 +0000737 case ValID::InlineAsmVal: { // Inline asm expression
738 const PointerType *PTy = dyn_cast<PointerType>(Ty);
739 const FunctionType *FTy =
740 PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000741 if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000742 GenerateError("Invalid type for asm constraint string!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000743 return 0;
744 }
Chris Lattner0e9c3762006-01-25 22:27:16 +0000745 InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints,
746 D.IAD->HasSideEffects);
747 D.destroy(); // Free InlineAsmDescriptor.
748 return IA;
749 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000750 default:
751 assert(0 && "Unhandled case!");
752 return 0;
753 } // End of switch
754
755 assert(0 && "Unhandled case!");
756 return 0;
757}
758
759// getVal - This function is identical to getValNonImprovising, except that if a
760// value is not already defined, it "improvises" by creating a placeholder var
761// that looks and acts just like the requested variable. When the value is
762// defined later, all uses of the placeholder variable are replaced with the
763// real thing.
764//
765static Value *getVal(const Type *Ty, const ValID &ID) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000766 if (Ty == Type::LabelTy) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000767 GenerateError("Cannot use a basic block here");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000768 return 0;
769 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000770
771 // See if the value has already been defined.
772 Value *V = getValNonImprovising(Ty, ID);
773 if (V) return V;
Reid Spencer5b7e7532006-09-28 19:28:24 +0000774 if (TriggerError) return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000775
Reid Spencer5b7e7532006-09-28 19:28:24 +0000776 if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000777 GenerateError("Invalid use of a composite type!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000778 return 0;
779 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000780
781 // If we reached here, we referenced either a symbol that we don't know about
782 // or an id number that hasn't been read yet. We may be referencing something
783 // forward, so just create an entry to be resolved later and get to it...
784 //
785 V = new Argument(Ty);
786
787 // Remember where this forward reference came from. FIXME, shouldn't we try
788 // to recycle these things??
789 CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID,
790 llvmAsmlineno)));
791
792 if (inFunctionScope())
793 InsertValue(V, CurFun.LateResolveValues);
794 else
795 InsertValue(V, CurModule.LateResolveValues);
796 return V;
797}
798
799/// getBBVal - This is used for two purposes:
800/// * If isDefinition is true, a new basic block with the specified ID is being
801/// defined.
802/// * If isDefinition is true, this is a reference to a basic block, which may
803/// or may not be a forward reference.
804///
805static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) {
806 assert(inFunctionScope() && "Can't get basic block at global scope!");
807
808 std::string Name;
809 BasicBlock *BB = 0;
810 switch (ID.Type) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000811 default:
812 GenerateError("Illegal label reference " + ID.getName());
813 return 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000814 case ValID::LocalID: // Is it a numbered definition?
815 if (ID.Num >= CurFun.NumberedBlocks.size())
Reid Spencer68a24bd2005-08-27 18:50:39 +0000816 CurFun.NumberedBlocks.resize(ID.Num+1);
817 BB = CurFun.NumberedBlocks[ID.Num];
818 break;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000819 case ValID::LocalName: // Is it a named definition?
Reid Spencer68a24bd2005-08-27 18:50:39 +0000820 Name = ID.Name;
821 if (Value *N = CurFun.CurrentFunction->
Reid Spencer78d033e2007-01-06 07:24:44 +0000822 getValueSymbolTable().lookup(Type::LabelTy, Name))
Reid Spencer68a24bd2005-08-27 18:50:39 +0000823 BB = cast<BasicBlock>(N);
824 break;
825 }
826
827 // See if the block has already been defined.
828 if (BB) {
829 // If this is the definition of the block, make sure the existing value was
830 // just a forward reference. If it was a forward reference, there will be
831 // an entry for it in the PlaceHolderInfo map.
Reid Spencer5b7e7532006-09-28 19:28:24 +0000832 if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000833 // The existing value was a definition, not a forward reference.
Reid Spencer61c83e02006-08-18 08:43:06 +0000834 GenerateError("Redefinition of label " + ID.getName());
Reid Spencer5b7e7532006-09-28 19:28:24 +0000835 return 0;
836 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000837
838 ID.destroy(); // Free strdup'd memory.
839 return BB;
840 }
841
842 // Otherwise this block has not been seen before.
843 BB = new BasicBlock("", CurFun.CurrentFunction);
Reid Spencer41dff5e2007-01-26 08:05:27 +0000844 if (ID.Type == ValID::LocalName) {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000845 BB->setName(ID.Name);
846 } else {
847 CurFun.NumberedBlocks[ID.Num] = BB;
848 }
849
850 // If this is not a definition, keep track of it so we can use it as a forward
851 // reference.
852 if (!isDefinition) {
853 // Remember where this forward reference came from.
854 CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno);
855 } else {
856 // The forward declaration could have been inserted anywhere in the
857 // function: insert it into the correct place now.
858 CurFun.CurrentFunction->getBasicBlockList().remove(BB);
859 CurFun.CurrentFunction->getBasicBlockList().push_back(BB);
860 }
861 ID.destroy();
862 return BB;
863}
864
865
866//===----------------------------------------------------------------------===//
867// Code to handle forward references in instructions
868//===----------------------------------------------------------------------===//
869//
870// This code handles the late binding needed with statements that reference
871// values not defined yet... for example, a forward branch, or the PHI node for
872// a loop body.
873//
874// This keeps a table (CurFun.LateResolveValues) of all such forward references
875// and back patchs after we are done.
876//
877
878// ResolveDefinitions - If we could not resolve some defs at parsing
879// time (forward branches, phi functions for loops, etc...) resolve the
880// defs now...
881//
882static void
883ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers,
884 std::map<const Type*,ValueList> *FutureLateResolvers) {
885 // Loop over LateResolveDefs fixing up stuff that couldn't be resolved
886 for (std::map<const Type*,ValueList>::iterator LRI = LateResolvers.begin(),
887 E = LateResolvers.end(); LRI != E; ++LRI) {
888 ValueList &List = LRI->second;
889 while (!List.empty()) {
890 Value *V = List.back();
891 List.pop_back();
892
893 std::map<Value*, std::pair<ValID, int> >::iterator PHI =
894 CurModule.PlaceHolderInfo.find(V);
895 assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!");
896
897 ValID &DID = PHI->second.first;
898
899 Value *TheRealValue = getValNonImprovising(LRI->first, DID);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000900 if (TriggerError)
901 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000902 if (TheRealValue) {
903 V->replaceAllUsesWith(TheRealValue);
904 delete V;
905 CurModule.PlaceHolderInfo.erase(PHI);
906 } else if (FutureLateResolvers) {
907 // Functions have their unresolved items forwarded to the module late
908 // resolver table
909 InsertValue(V, *FutureLateResolvers);
910 } else {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000911 if (DID.Type == ValID::LocalName || DID.Type == ValID::GlobalName) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000912 GenerateError("Reference to an invalid definition: '" +DID.getName()+
Reid Spencer68a24bd2005-08-27 18:50:39 +0000913 "' of type '" + V->getType()->getDescription() + "'",
914 PHI->second.second);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000915 return;
916 } else {
Reid Spencer61c83e02006-08-18 08:43:06 +0000917 GenerateError("Reference to an invalid definition: #" +
Reid Spencer68a24bd2005-08-27 18:50:39 +0000918 itostr(DID.Num) + " of type '" +
919 V->getType()->getDescription() + "'",
920 PHI->second.second);
Reid Spencer5b7e7532006-09-28 19:28:24 +0000921 return;
922 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000923 }
924 }
925 }
926
927 LateResolvers.clear();
928}
929
930// ResolveTypeTo - A brand new type was just declared. This means that (if
931// name is not null) things referencing Name can be resolved. Otherwise, things
932// refering to the number can be resolved. Do this now.
933//
934static void ResolveTypeTo(char *Name, const Type *ToTy) {
935 ValID D;
Reid Spencer41dff5e2007-01-26 08:05:27 +0000936 if (Name) D = ValID::createLocalName(Name);
937 else D = ValID::createLocalID(CurModule.Types.size());
Reid Spencer68a24bd2005-08-27 18:50:39 +0000938
Reid Spencer861d9d62006-11-28 07:29:44 +0000939 std::map<ValID, PATypeHolder>::iterator I =
Reid Spencer68a24bd2005-08-27 18:50:39 +0000940 CurModule.LateResolveTypes.find(D);
941 if (I != CurModule.LateResolveTypes.end()) {
Reid Spencer861d9d62006-11-28 07:29:44 +0000942 ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000943 CurModule.LateResolveTypes.erase(I);
944 }
945}
946
947// setValueName - Set the specified value to the name given. The name may be
948// null potentially, in which case this is a noop. The string passed in is
949// assumed to be a malloc'd string buffer, and is free'd by this function.
950//
951static void setValueName(Value *V, char *NameStr) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000952 if (!NameStr) return;
953 std::string Name(NameStr); // Copy string
954 free(NameStr); // Free old string
Reid Spencer68a24bd2005-08-27 18:50:39 +0000955
Reid Spencer41dff5e2007-01-26 08:05:27 +0000956 if (V->getType() == Type::VoidTy) {
957 GenerateError("Can't assign name '" + Name+"' to value with void type!");
958 return;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000959 }
Reid Spencer41dff5e2007-01-26 08:05:27 +0000960
961 assert(inFunctionScope() && "Must be in function scope!");
962 SymbolTable &ST = CurFun.CurrentFunction->getValueSymbolTable();
963 if (ST.lookup(V->getType(), Name)) {
964 GenerateError("Redefinition of value '" + Name + "' of type '" +
965 V->getType()->getDescription() + "'!");
966 return;
967 }
968
969 // Set the name.
970 V->setName(Name);
Reid Spencer68a24bd2005-08-27 18:50:39 +0000971}
972
973/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null,
974/// this is a declaration, otherwise it is a definition.
Chris Lattnerb475c422005-11-12 18:22:38 +0000975static GlobalVariable *
Anton Korobeynikov178a3522007-01-12 19:22:51 +0000976ParseGlobalVariable(char *NameStr,
977 GlobalValue::LinkageTypes Linkage,
978 GlobalValue::VisibilityTypes Visibility,
Chris Lattnerb475c422005-11-12 18:22:38 +0000979 bool isConstantGlobal, const Type *Ty,
980 Constant *Initializer) {
Reid Spencer5b7e7532006-09-28 19:28:24 +0000981 if (isa<FunctionType>(Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +0000982 GenerateError("Cannot declare global vars of function type!");
Reid Spencer5b7e7532006-09-28 19:28:24 +0000983 return 0;
984 }
Reid Spencer68a24bd2005-08-27 18:50:39 +0000985
986 const PointerType *PTy = PointerType::get(Ty);
987
988 std::string Name;
989 if (NameStr) {
990 Name = NameStr; // Copy string
991 free(NameStr); // Free old string
992 }
993
994 // See if this global value was forward referenced. If so, recycle the
995 // object.
996 ValID ID;
997 if (!Name.empty()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +0000998 ID = ValID::createGlobalName((char*)Name.c_str());
Reid Spencer68a24bd2005-08-27 18:50:39 +0000999 } else {
Reid Spencer41dff5e2007-01-26 08:05:27 +00001000 ID = ValID::createGlobalID(CurModule.Values[PTy].size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00001001 }
1002
1003 if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) {
1004 // Move the global to the end of the list, from whereever it was
1005 // previously inserted.
1006 GlobalVariable *GV = cast<GlobalVariable>(FWGV);
1007 CurModule.CurrentModule->getGlobalList().remove(GV);
1008 CurModule.CurrentModule->getGlobalList().push_back(GV);
1009 GV->setInitializer(Initializer);
1010 GV->setLinkage(Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001011 GV->setVisibility(Visibility);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001012 GV->setConstant(isConstantGlobal);
1013 InsertValue(GV, CurModule.Values);
Chris Lattnerb475c422005-11-12 18:22:38 +00001014 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001015 }
1016
1017 // If this global has a name, check to see if there is already a definition
Reid Spencer63c34452007-01-05 21:51:07 +00001018 // of this global in the module. If so, it is an error.
Reid Spencer68a24bd2005-08-27 18:50:39 +00001019 if (!Name.empty()) {
1020 // We are a simple redefinition of a value, check to see if it is defined
1021 // the same as the old one.
Reid Spencer63c34452007-01-05 21:51:07 +00001022 if (CurModule.CurrentModule->getGlobalVariable(Name, Ty)) {
Reid Spencer61c83e02006-08-18 08:43:06 +00001023 GenerateError("Redefinition of global variable named '" + Name +
Reid Spencer63c34452007-01-05 21:51:07 +00001024 "' of type '" + Ty->getDescription() + "'!");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001025 return 0;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001026 }
1027 }
1028
1029 // Otherwise there is no existing GV to use, create one now.
1030 GlobalVariable *GV =
1031 new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
1032 CurModule.CurrentModule);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001033 GV->setVisibility(Visibility);
Reid Spencer68a24bd2005-08-27 18:50:39 +00001034 InsertValue(GV, CurModule.Values);
Chris Lattnerb475c422005-11-12 18:22:38 +00001035 return GV;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001036}
1037
1038// setTypeName - Set the specified type to the name given. The name may be
1039// null potentially, in which case this is a noop. The string passed in is
1040// assumed to be a malloc'd string buffer, and is freed by this function.
1041//
1042// This function returns true if the type has already been defined, but is
1043// allowed to be redefined in the specified context. If the name is a new name
1044// for the type plane, it is inserted and false is returned.
1045static bool setTypeName(const Type *T, char *NameStr) {
1046 assert(!inFunctionScope() && "Can't give types function-local names!");
1047 if (NameStr == 0) return false;
1048
1049 std::string Name(NameStr); // Copy string
1050 free(NameStr); // Free old string
1051
1052 // We don't allow assigning names to void type
Reid Spencer5b7e7532006-09-28 19:28:24 +00001053 if (T == Type::VoidTy) {
Reid Spencer61c83e02006-08-18 08:43:06 +00001054 GenerateError("Can't assign name '" + Name + "' to the void type!");
Reid Spencer5b7e7532006-09-28 19:28:24 +00001055 return false;
1056 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00001057
1058 // Set the type name, checking for conflicts as we do so.
1059 bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T);
1060
1061 if (AlreadyExists) { // Inserting a name that is already defined???
1062 const Type *Existing = CurModule.CurrentModule->getTypeByName(Name);
1063 assert(Existing && "Conflict but no matching type?");
1064
1065 // There is only one case where this is allowed: when we are refining an
1066 // opaque type. In this case, Existing will be an opaque type.
1067 if (const OpaqueType *OpTy = dyn_cast<OpaqueType>(Existing)) {
1068 // We ARE replacing an opaque type!
1069 const_cast<OpaqueType*>(OpTy)->refineAbstractTypeTo(T);
1070 return true;
1071 }
1072
1073 // Otherwise, this is an attempt to redefine a type. That's okay if
1074 // the redefinition is identical to the original. This will be so if
1075 // Existing and T point to the same Type object. In this one case we
1076 // allow the equivalent redefinition.
1077 if (Existing == T) return true; // Yes, it's equal.
1078
1079 // Any other kind of (non-equivalent) redefinition is an error.
Reid Spencer63c34452007-01-05 21:51:07 +00001080 GenerateError("Redefinition of type named '" + Name + "' of type '" +
1081 T->getDescription() + "'!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00001082 }
1083
1084 return false;
1085}
1086
1087//===----------------------------------------------------------------------===//
1088// Code for handling upreferences in type names...
1089//
1090
1091// TypeContains - Returns true if Ty directly contains E in it.
1092//
1093static bool TypeContains(const Type *Ty, const Type *E) {
1094 return std::find(Ty->subtype_begin(), Ty->subtype_end(),
1095 E) != Ty->subtype_end();
1096}
1097
1098namespace {
1099 struct UpRefRecord {
1100 // NestingLevel - The number of nesting levels that need to be popped before
1101 // this type is resolved.
1102 unsigned NestingLevel;
1103
1104 // LastContainedTy - This is the type at the current binding level for the
1105 // type. Every time we reduce the nesting level, this gets updated.
1106 const Type *LastContainedTy;
1107
1108 // UpRefTy - This is the actual opaque type that the upreference is
1109 // represented with.
1110 OpaqueType *UpRefTy;
1111
1112 UpRefRecord(unsigned NL, OpaqueType *URTy)
1113 : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {}
1114 };
1115}
1116
1117// UpRefs - A list of the outstanding upreferences that need to be resolved.
1118static std::vector<UpRefRecord> UpRefs;
1119
1120/// HandleUpRefs - Every time we finish a new layer of types, this function is
1121/// called. It loops through the UpRefs vector, which is a list of the
1122/// currently active types. For each type, if the up reference is contained in
1123/// the newly completed type, we decrement the level count. When the level
1124/// count reaches zero, the upreferenced type is the type that is passed in:
1125/// thus we can complete the cycle.
1126///
1127static PATypeHolder HandleUpRefs(const Type *ty) {
Chris Lattner224f84f2006-08-18 17:34:45 +00001128 // If Ty isn't abstract, or if there are no up-references in it, then there is
1129 // nothing to resolve here.
1130 if (!ty->isAbstract() || UpRefs.empty()) return ty;
1131
Reid Spencer68a24bd2005-08-27 18:50:39 +00001132 PATypeHolder Ty(ty);
1133 UR_OUT("Type '" << Ty->getDescription() <<
1134 "' newly formed. Resolving upreferences.\n" <<
1135 UpRefs.size() << " upreferences active!\n");
1136
1137 // If we find any resolvable upreferences (i.e., those whose NestingLevel goes
1138 // to zero), we resolve them all together before we resolve them to Ty. At
1139 // the end of the loop, if there is anything to resolve to Ty, it will be in
1140 // this variable.
1141 OpaqueType *TypeToResolve = 0;
1142
1143 for (unsigned i = 0; i != UpRefs.size(); ++i) {
1144 UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
1145 << UpRefs[i].second->getDescription() << ") = "
1146 << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n");
1147 if (TypeContains(Ty, UpRefs[i].LastContainedTy)) {
1148 // Decrement level of upreference
1149 unsigned Level = --UpRefs[i].NestingLevel;
1150 UpRefs[i].LastContainedTy = Ty;
1151 UR_OUT(" Uplevel Ref Level = " << Level << "\n");
1152 if (Level == 0) { // Upreference should be resolved!
1153 if (!TypeToResolve) {
1154 TypeToResolve = UpRefs[i].UpRefTy;
1155 } else {
1156 UR_OUT(" * Resolving upreference for "
1157 << UpRefs[i].second->getDescription() << "\n";
1158 std::string OldName = UpRefs[i].UpRefTy->getDescription());
1159 UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve);
1160 UR_OUT(" * Type '" << OldName << "' refined upreference to: "
1161 << (const void*)Ty << ", " << Ty->getDescription() << "\n");
1162 }
1163 UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list...
1164 --i; // Do not skip the next element...
1165 }
1166 }
1167 }
1168
1169 if (TypeToResolve) {
1170 UR_OUT(" * Resolving upreference for "
1171 << UpRefs[i].second->getDescription() << "\n";
1172 std::string OldName = TypeToResolve->getDescription());
1173 TypeToResolve->refineAbstractTypeTo(Ty);
1174 }
1175
1176 return Ty;
1177}
1178
Reid Spencer68a24bd2005-08-27 18:50:39 +00001179//===----------------------------------------------------------------------===//
1180// RunVMAsmParser - Define an interface to this parser
1181//===----------------------------------------------------------------------===//
1182//
Reid Spencer14310612006-12-31 05:40:51 +00001183static Module* RunParser(Module * M);
1184
Reid Spencer68a24bd2005-08-27 18:50:39 +00001185Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
1186 set_scan_file(F);
1187
1188 CurFilename = Filename;
1189 return RunParser(new Module(CurFilename));
1190}
1191
1192Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
1193 set_scan_string(AsmString);
1194
1195 CurFilename = "from_memory";
1196 if (M == NULL) {
1197 return RunParser(new Module (CurFilename));
1198 } else {
1199 return RunParser(M);
1200 }
1201}
1202
1203
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001204
1205/* Enabling traces. */
1206#ifndef YYDEBUG
1207# define YYDEBUG 0
1208#endif
1209
1210/* Enabling verbose error messages. */
1211#ifdef YYERROR_VERBOSE
1212# undef YYERROR_VERBOSE
1213# define YYERROR_VERBOSE 1
1214#else
1215# define YYERROR_VERBOSE 0
1216#endif
1217
Reid Spencer41dff5e2007-01-26 08:05:27 +00001218/* Enabling the token table. */
1219#ifndef YYTOKEN_TABLE
1220# define YYTOKEN_TABLE 0
1221#endif
1222
Reid Spencer5cbf9852007-01-30 20:08:39 +00001223#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
1224#line 885 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
1225typedef union YYSTYPE {
Reid Spencer68a24bd2005-08-27 18:50:39 +00001226 llvm::Module *ModuleVal;
1227 llvm::Function *FunctionVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001228 llvm::BasicBlock *BasicBlockVal;
1229 llvm::TerminatorInst *TermInstVal;
1230 llvm::Instruction *InstVal;
Reid Spencera132e042006-12-03 05:46:11 +00001231 llvm::Constant *ConstVal;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001232
Reid Spencera132e042006-12-03 05:46:11 +00001233 const llvm::Type *PrimType;
Reid Spencer14310612006-12-31 05:40:51 +00001234 std::list<llvm::PATypeHolder> *TypeList;
Reid Spencera132e042006-12-03 05:46:11 +00001235 llvm::PATypeHolder *TypeVal;
1236 llvm::Value *ValueVal;
Reid Spencera132e042006-12-03 05:46:11 +00001237 std::vector<llvm::Value*> *ValueList;
Reid Spencer14310612006-12-31 05:40:51 +00001238 llvm::ArgListType *ArgList;
1239 llvm::TypeWithAttrs TypeWithAttrs;
1240 llvm::TypeWithAttrsList *TypeWithAttrsList;
1241 llvm::ValueRefList *ValueRefList;
1242
Reid Spencer68a24bd2005-08-27 18:50:39 +00001243 // Represent the RHS of PHI node
Reid Spencera132e042006-12-03 05:46:11 +00001244 std::list<std::pair<llvm::Value*,
1245 llvm::BasicBlock*> > *PHIList;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001246 std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
Reid Spencera132e042006-12-03 05:46:11 +00001247 std::vector<llvm::Constant*> *ConstVector;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001248
1249 llvm::GlobalValue::LinkageTypes Linkage;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001250 llvm::GlobalValue::VisibilityTypes Visibility;
Reid Spencer14310612006-12-31 05:40:51 +00001251 llvm::FunctionType::ParameterAttributes ParamAttrs;
Reid Spencer68a24bd2005-08-27 18:50:39 +00001252 int64_t SInt64Val;
1253 uint64_t UInt64Val;
1254 int SIntVal;
1255 unsigned UIntVal;
1256 double FPVal;
1257 bool BoolVal;
1258
1259 char *StrVal; // This memory is strdup'd!
Reid Spencer1628cec2006-10-26 06:15:43 +00001260 llvm::ValID ValIDVal; // strdup'd memory maybe!
Reid Spencer68a24bd2005-08-27 18:50:39 +00001261
Reid Spencera132e042006-12-03 05:46:11 +00001262 llvm::Instruction::BinaryOps BinaryOpVal;
1263 llvm::Instruction::TermOps TermOpVal;
1264 llvm::Instruction::MemoryOps MemOpVal;
1265 llvm::Instruction::CastOps CastOpVal;
1266 llvm::Instruction::OtherOps OtherOpVal;
Reid Spencera132e042006-12-03 05:46:11 +00001267 llvm::ICmpInst::Predicate IPredicate;
1268 llvm::FCmpInst::Predicate FPredicate;
Reid Spencer5cbf9852007-01-30 20:08:39 +00001269} YYSTYPE;
1270/* Line 196 of yacc.c. */
1271#line 1272 "llvmAsmParser.tab.c"
Reid Spencer41dff5e2007-01-26 08:05:27 +00001272# define yystype YYSTYPE /* obsolescent; will be withdrawn */
1273# define YYSTYPE_IS_DECLARED 1
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001274# define YYSTYPE_IS_TRIVIAL 1
Reid Spencer68a24bd2005-08-27 18:50:39 +00001275#endif
1276
Reid Spencer41dff5e2007-01-26 08:05:27 +00001277
Reid Spencer68a24bd2005-08-27 18:50:39 +00001278
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001279/* Copy the second part of user declarations. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001280
1281
Reid Spencer5cbf9852007-01-30 20:08:39 +00001282/* Line 219 of yacc.c. */
1283#line 1284 "llvmAsmParser.tab.c"
Reid Spencer41dff5e2007-01-26 08:05:27 +00001284
Reid Spencer5cbf9852007-01-30 20:08:39 +00001285#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1286# define YYSIZE_T __SIZE_TYPE__
Reid Spencer41dff5e2007-01-26 08:05:27 +00001287#endif
Reid Spencer5cbf9852007-01-30 20:08:39 +00001288#if ! defined (YYSIZE_T) && defined (size_t)
1289# define YYSIZE_T size_t
Reid Spencer41dff5e2007-01-26 08:05:27 +00001290#endif
Reid Spencer5cbf9852007-01-30 20:08:39 +00001291#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus))
1292# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1293# define YYSIZE_T size_t
Reid Spencer41dff5e2007-01-26 08:05:27 +00001294#endif
Reid Spencer5cbf9852007-01-30 20:08:39 +00001295#if ! defined (YYSIZE_T)
1296# define YYSIZE_T unsigned int
Reid Spencer41dff5e2007-01-26 08:05:27 +00001297#endif
1298
1299#ifndef YY_
1300# if YYENABLE_NLS
1301# if ENABLE_NLS
1302# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1303# define YY_(msgid) dgettext ("bison-runtime", msgid)
1304# endif
1305# endif
1306# ifndef YY_
1307# define YY_(msgid) msgid
1308# endif
1309#endif
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001310
Reid Spencer5cbf9852007-01-30 20:08:39 +00001311#if ! defined (yyoverflow) || YYERROR_VERBOSE
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001312
1313/* The parser invokes alloca or malloc; define the necessary symbols. */
1314
Reid Spencer41dff5e2007-01-26 08:05:27 +00001315# ifdef YYSTACK_USE_ALLOCA
1316# if YYSTACK_USE_ALLOCA
1317# ifdef __GNUC__
1318# define YYSTACK_ALLOC __builtin_alloca
Jeff Cohen361c3ef2007-01-21 19:19:31 +00001319# else
Reid Spencer41dff5e2007-01-26 08:05:27 +00001320# define YYSTACK_ALLOC alloca
Reid Spencer5cbf9852007-01-30 20:08:39 +00001321# if defined (__STDC__) || defined (__cplusplus)
Reid Spencer41dff5e2007-01-26 08:05:27 +00001322# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
Reid Spencer5cbf9852007-01-30 20:08:39 +00001323# define YYINCLUDED_STDLIB_H
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001324# endif
1325# endif
1326# endif
1327# endif
1328
1329# ifdef YYSTACK_ALLOC
Reid Spencer5cbf9852007-01-30 20:08:39 +00001330 /* Pacify GCC's `empty if-body' warning. */
1331# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
Reid Spencer41dff5e2007-01-26 08:05:27 +00001332# ifndef YYSTACK_ALLOC_MAXIMUM
1333 /* The OS might guarantee only one guard page at the bottom of the stack,
1334 and a page size can be as small as 4096 bytes. So we cannot safely
1335 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1336 to allow for a few compiler-allocated temporary stack slots. */
Reid Spencer5cbf9852007-01-30 20:08:39 +00001337# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001338# endif
Reid Spencer41dff5e2007-01-26 08:05:27 +00001339# else
1340# define YYSTACK_ALLOC YYMALLOC
1341# define YYSTACK_FREE YYFREE
1342# ifndef YYSTACK_ALLOC_MAXIMUM
Reid Spencer5cbf9852007-01-30 20:08:39 +00001343# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1)
Reid Spencer41dff5e2007-01-26 08:05:27 +00001344# endif
Reid Spencer5cbf9852007-01-30 20:08:39 +00001345# ifdef __cplusplus
1346extern "C" {
Reid Spencer41dff5e2007-01-26 08:05:27 +00001347# endif
1348# ifndef YYMALLOC
1349# define YYMALLOC malloc
Reid Spencer5cbf9852007-01-30 20:08:39 +00001350# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \
1351 && (defined (__STDC__) || defined (__cplusplus)))
Reid Spencer41dff5e2007-01-26 08:05:27 +00001352void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1353# endif
1354# endif
1355# ifndef YYFREE
1356# define YYFREE free
Reid Spencer5cbf9852007-01-30 20:08:39 +00001357# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \
1358 && (defined (__STDC__) || defined (__cplusplus)))
Reid Spencer41dff5e2007-01-26 08:05:27 +00001359void free (void *); /* INFRINGES ON USER NAME SPACE */
1360# endif
1361# endif
Reid Spencer5cbf9852007-01-30 20:08:39 +00001362# ifdef __cplusplus
1363}
1364# endif
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001365# endif
Reid Spencer5cbf9852007-01-30 20:08:39 +00001366#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001367
1368
Reid Spencer5cbf9852007-01-30 20:08:39 +00001369#if (! defined (yyoverflow) \
1370 && (! defined (__cplusplus) \
1371 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001372
1373/* A type that is properly aligned for any stack member. */
1374union yyalloc
1375{
Reid Spencer5cbf9852007-01-30 20:08:39 +00001376 short int yyss;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001377 YYSTYPE yyvs;
1378 };
1379
1380/* The size of the maximum gap between one aligned stack and the next. */
Reid Spencer41dff5e2007-01-26 08:05:27 +00001381# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001382
1383/* The size of an array large to enough to hold all stacks, each with
1384 N elements. */
1385# define YYSTACK_BYTES(N) \
Reid Spencer5cbf9852007-01-30 20:08:39 +00001386 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
Reid Spencer41dff5e2007-01-26 08:05:27 +00001387 + YYSTACK_GAP_MAXIMUM)
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001388
1389/* Copy COUNT objects from FROM to TO. The source and destination do
1390 not overlap. */
1391# ifndef YYCOPY
Reid Spencer5cbf9852007-01-30 20:08:39 +00001392# if defined (__GNUC__) && 1 < __GNUC__
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001393# define YYCOPY(To, From, Count) \
1394 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
1395# else
1396# define YYCOPY(To, From, Count) \
1397 do \
1398 { \
Reid Spencer41dff5e2007-01-26 08:05:27 +00001399 YYSIZE_T yyi; \
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001400 for (yyi = 0; yyi < (Count); yyi++) \
Reid Spencer41dff5e2007-01-26 08:05:27 +00001401 (To)[yyi] = (From)[yyi]; \
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001402 } \
Reid Spencer5cbf9852007-01-30 20:08:39 +00001403 while (0)
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001404# endif
1405# endif
1406
1407/* Relocate STACK from its old location to the new one. The
1408 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1409 elements in the stack, and YYPTR gives the new location of the
1410 stack. Advance YYPTR to a properly aligned location for the next
1411 stack. */
1412# define YYSTACK_RELOCATE(Stack) \
1413 do \
1414 { \
1415 YYSIZE_T yynewbytes; \
1416 YYCOPY (&yyptr->Stack, Stack, yysize); \
1417 Stack = &yyptr->Stack; \
Reid Spencer41dff5e2007-01-26 08:05:27 +00001418 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001419 yyptr += yynewbytes / sizeof (*yyptr); \
1420 } \
Reid Spencer5cbf9852007-01-30 20:08:39 +00001421 while (0)
Anton Korobeynikov178a3522007-01-12 19:22:51 +00001422
1423#endif
1424
Reid Spencer5cbf9852007-01-30 20:08:39 +00001425#if defined (__STDC__) || defined (__cplusplus)
1426 typedef signed char yysigned_char;
1427#else
1428 typedef short int yysigned_char;
1429#endif
1430
1431/* YYFINAL -- State number of the termination state. */
Reid Spencer41dff5e2007-01-26 08:05:27 +00001432#define YYFINAL 40
1433/* YYLAST -- Last index in YYTABLE. */
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001434#define YYLAST 1466
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001435
Reid Spencer5cbf9852007-01-30 20:08:39 +00001436/* YYNTOKENS -- Number of terminals. */
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001437#define YYNTOKENS 146
Reid Spencer5cbf9852007-01-30 20:08:39 +00001438/* YYNNTS -- Number of nonterminals. */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001439#define YYNNTS 79
Reid Spencer5cbf9852007-01-30 20:08:39 +00001440/* YYNRULES -- Number of rules. */
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001441#define YYNRULES 286
Reid Spencer5cbf9852007-01-30 20:08:39 +00001442/* YYNRULES -- Number of states. */
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001443#define YYNSTATES 567
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001444
1445/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1446#define YYUNDEFTOK 2
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001447#define YYMAXUTOK 386
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001448
Reid Spencer41dff5e2007-01-26 08:05:27 +00001449#define YYTRANSLATE(YYX) \
1450 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001451
1452/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
Reid Spencer5cbf9852007-01-30 20:08:39 +00001453static const unsigned char yytranslate[] =
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001454{
1455 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1456 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1457 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1458 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001459 136, 137, 134, 2, 133, 2, 2, 2, 2, 2,
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001460 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001461 141, 132, 142, 2, 2, 2, 2, 2, 2, 2,
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001462 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1463 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001464 2, 138, 135, 140, 2, 2, 2, 2, 2, 145,
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001465 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1466 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001467 139, 2, 2, 143, 2, 144, 2, 2, 2, 2,
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001468 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1469 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1470 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1471 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1472 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1473 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1474 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1475 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1476 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1477 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1478 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1479 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1480 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1481 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1482 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1483 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1484 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1485 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1486 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1487 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1488 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1489 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1490 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1491 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1492 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001493 125, 126, 127, 128, 129, 130, 131
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001494};
1495
1496#if YYDEBUG
1497/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1498 YYRHS. */
Reid Spencer5cbf9852007-01-30 20:08:39 +00001499static const unsigned short int yyprhs[] =
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001500{
1501 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
1502 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
1503 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
1504 59, 61, 63, 65, 67, 69, 71, 73, 75, 77,
1505 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
1506 99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
Reid Spencer41dff5e2007-01-26 08:05:27 +00001507 119, 121, 122, 125, 126, 128, 130, 133, 134, 136,
1508 138, 140, 142, 144, 146, 148, 150, 151, 153, 154,
1509 156, 158, 159, 161, 163, 165, 167, 168, 170, 172,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001510 174, 176, 178, 181, 183, 185, 187, 189, 190, 193,
1511 195, 197, 198, 201, 202, 205, 206, 210, 213, 214,
1512 216, 217, 221, 223, 226, 228, 230, 232, 234, 236,
1513 238, 241, 243, 246, 252, 258, 264, 270, 274, 277,
1514 283, 288, 291, 293, 295, 297, 301, 303, 307, 309,
1515 310, 312, 316, 321, 325, 329, 334, 339, 343, 350,
1516 356, 359, 362, 365, 368, 371, 374, 377, 380, 383,
1517 386, 393, 399, 408, 415, 422, 430, 438, 445, 452,
1518 461, 470, 474, 476, 478, 480, 482, 483, 485, 488,
1519 489, 493, 494, 498, 502, 504, 508, 512, 513, 520,
1520 521, 529, 530, 538, 541, 545, 547, 551, 555, 559,
1521 563, 565, 566, 572, 576, 578, 582, 584, 585, 595,
1522 597, 599, 604, 606, 608, 611, 615, 616, 618, 620,
1523 622, 624, 626, 628, 630, 632, 634, 638, 640, 646,
1524 648, 650, 652, 654, 656, 658, 661, 664, 667, 671,
1525 674, 675, 677, 680, 683, 687, 697, 707, 716, 731,
1526 733, 735, 742, 748, 751, 758, 766, 770, 776, 777,
1527 778, 782, 785, 787, 793, 799, 806, 813, 818, 823,
1528 830, 835, 840, 847, 854, 857, 866, 868, 870, 871,
1529 875, 882, 886, 893, 896, 901, 908
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001530};
1531
Reid Spencer5cbf9852007-01-30 20:08:39 +00001532/* YYRHS -- A `-1'-separated list of the rules' RHS. */
1533static const short int yyrhs[] =
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001534{
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001535 187, 0, -1, 66, -1, 67, -1, 68, -1, 69,
1536 -1, 70, -1, 71, -1, 72, -1, 73, -1, 74,
1537 -1, 75, -1, 76, -1, 77, -1, 106, -1, 107,
1538 -1, 108, -1, 109, -1, 110, -1, 111, -1, 112,
1539 -1, 113, -1, 114, -1, 115, -1, 116, -1, 117,
1540 -1, 120, -1, 121, -1, 122, -1, 80, -1, 81,
1541 -1, 82, -1, 83, -1, 84, -1, 85, -1, 86,
1542 -1, 87, -1, 88, -1, 89, -1, 90, -1, 91,
1543 -1, 92, -1, 93, -1, 94, -1, 95, -1, 96,
1544 -1, 97, -1, 98, -1, 99, -1, 86, -1, 87,
1545 -1, 88, -1, 89, -1, 21, -1, 22, -1, 9,
1546 -1, 10, -1, 11, -1, 14, -1, 17, -1, 155,
1547 -1, -1, 155, 132, -1, -1, 15, -1, 18, -1,
1548 158, 132, -1, -1, 35, -1, 37, -1, 36, -1,
Reid Spencer41dff5e2007-01-26 08:05:27 +00001549 38, -1, 40, -1, 39, -1, 41, -1, 43, -1,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001550 -1, 131, -1, -1, 39, -1, 41, -1, -1, 35,
Reid Spencer41dff5e2007-01-26 08:05:27 +00001551 -1, 36, -1, 37, -1, 40, -1, -1, 54, -1,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001552 55, -1, 56, -1, 57, -1, 58, -1, 53, 4,
1553 -1, 107, -1, 108, -1, 128, -1, 129, -1, -1,
1554 167, 166, -1, 127, -1, 166, -1, -1, 169, 168,
1555 -1, -1, 46, 4, -1, -1, 133, 46, 4, -1,
1556 29, 17, -1, -1, 172, -1, -1, 133, 175, 174,
1557 -1, 172, -1, 46, 4, -1, 9, -1, 10, -1,
1558 11, -1, 12, -1, 42, -1, 176, -1, 177, 134,
1559 -1, 209, -1, 135, 4, -1, 177, 136, 181, 137,
1560 169, -1, 8, 136, 181, 137, 169, -1, 138, 4,
1561 139, 177, 140, -1, 141, 4, 139, 177, 142, -1,
1562 143, 182, 144, -1, 143, 144, -1, 141, 143, 182,
1563 144, 142, -1, 141, 143, 144, 142, -1, 177, 167,
1564 -1, 177, -1, 8, -1, 178, -1, 180, 133, 178,
1565 -1, 180, -1, 180, 133, 32, -1, 32, -1, -1,
1566 177, -1, 182, 133, 177, -1, 177, 138, 185, 140,
1567 -1, 177, 138, 140, -1, 177, 145, 17, -1, 177,
1568 141, 185, 142, -1, 177, 143, 185, 144, -1, 177,
1569 143, 144, -1, 177, 141, 143, 185, 144, 142, -1,
1570 177, 141, 143, 144, 142, -1, 177, 33, -1, 177,
1571 34, -1, 177, 209, -1, 177, 184, -1, 177, 20,
1572 -1, 153, 3, -1, 153, 4, -1, 9, 21, -1,
1573 9, 22, -1, 154, 7, -1, 149, 136, 183, 31,
1574 177, 137, -1, 105, 136, 183, 220, 137, -1, 119,
1575 136, 183, 133, 183, 133, 183, 137, -1, 147, 136,
1576 183, 133, 183, 137, -1, 148, 136, 183, 133, 183,
1577 137, -1, 78, 151, 136, 183, 133, 183, 137, -1,
1578 79, 152, 136, 183, 133, 183, 137, -1, 150, 136,
1579 183, 133, 183, 137, -1, 124, 136, 183, 133, 183,
1580 137, -1, 125, 136, 183, 133, 183, 133, 183, 137,
1581 -1, 126, 136, 183, 133, 183, 133, 183, 137, -1,
1582 185, 133, 183, -1, 183, -1, 27, -1, 28, -1,
1583 188, -1, -1, 189, -1, 188, 189, -1, -1, 26,
1584 190, 205, -1, -1, 25, 191, 206, -1, 51, 50,
1585 195, -1, 19, -1, 157, 13, 177, -1, 157, 13,
1586 8, -1, -1, 159, 162, 186, 183, 192, 174, -1,
1587 -1, 159, 160, 162, 186, 183, 193, 174, -1, -1,
1588 159, 161, 162, 186, 177, 194, 174, -1, 44, 196,
1589 -1, 47, 132, 197, -1, 17, -1, 45, 132, 17,
1590 -1, 59, 132, 17, -1, 138, 198, 140, -1, 198,
1591 133, 17, -1, 17, -1, -1, 199, 133, 177, 167,
1592 156, -1, 177, 167, 156, -1, 199, -1, 199, 133,
1593 32, -1, 32, -1, -1, 165, 179, 158, 136, 200,
1594 137, 169, 173, 170, -1, 23, -1, 143, -1, 164,
1595 162, 201, 202, -1, 24, -1, 144, -1, 212, 204,
1596 -1, 163, 162, 201, -1, -1, 52, -1, 3, -1,
1597 4, -1, 7, -1, 21, -1, 22, -1, 33, -1,
1598 34, -1, 20, -1, 141, 185, 142, -1, 184, -1,
1599 50, 207, 17, 133, 17, -1, 5, -1, 6, -1,
1600 155, -1, 158, -1, 209, -1, 208, -1, 177, 210,
1601 -1, 212, 213, -1, 203, 213, -1, 214, 157, 215,
1602 -1, 214, 217, -1, -1, 16, -1, 60, 211, -1,
1603 60, 8, -1, 61, 12, 210, -1, 61, 9, 210,
1604 133, 12, 210, 133, 12, 210, -1, 62, 153, 210,
1605 133, 12, 210, 138, 216, 140, -1, 62, 153, 210,
1606 133, 12, 210, 138, 140, -1, 63, 165, 179, 210,
1607 136, 219, 137, 169, 31, 12, 210, 64, 12, 210,
1608 -1, 64, -1, 65, -1, 216, 153, 208, 133, 12,
1609 210, -1, 153, 208, 133, 12, 210, -1, 157, 222,
1610 -1, 177, 138, 210, 133, 210, 140, -1, 218, 133,
1611 138, 210, 133, 210, 140, -1, 177, 210, 167, -1,
1612 219, 133, 177, 210, 167, -1, -1, -1, 220, 133,
1613 211, -1, 49, 48, -1, 48, -1, 147, 177, 210,
1614 133, 210, -1, 148, 177, 210, 133, 210, -1, 78,
1615 151, 177, 210, 133, 210, -1, 79, 152, 177, 210,
1616 133, 210, -1, 150, 211, 133, 211, -1, 149, 211,
1617 31, 177, -1, 119, 211, 133, 211, 133, 211, -1,
1618 123, 211, 133, 177, -1, 124, 211, 133, 211, -1,
1619 125, 211, 133, 211, 133, 211, -1, 126, 211, 133,
1620 211, 133, 211, -1, 118, 218, -1, 221, 165, 179,
1621 210, 136, 219, 137, 169, -1, 224, -1, 30, -1,
1622 -1, 100, 177, 171, -1, 100, 177, 133, 9, 210,
1623 171, -1, 101, 177, 171, -1, 101, 177, 133, 9,
1624 210, 171, -1, 102, 211, -1, 223, 103, 177, 210,
1625 -1, 223, 104, 211, 133, 177, 210, -1, 105, 177,
1626 210, 220, -1
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001627};
1628
1629/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
Reid Spencer5cbf9852007-01-30 20:08:39 +00001630static const unsigned short int yyrline[] =
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001631{
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001632 0, 1031, 1031, 1031, 1031, 1031, 1031, 1031, 1031, 1031,
1633 1031, 1032, 1032, 1032, 1033, 1033, 1033, 1033, 1033, 1033,
1634 1034, 1034, 1034, 1034, 1034, 1034, 1035, 1035, 1035, 1037,
1635 1037, 1038, 1038, 1039, 1039, 1040, 1040, 1041, 1041, 1045,
1636 1045, 1046, 1046, 1047, 1047, 1048, 1048, 1049, 1049, 1050,
1637 1050, 1051, 1051, 1052, 1053, 1058, 1059, 1059, 1061, 1061,
1638 1062, 1062, 1066, 1070, 1075, 1075, 1077, 1081, 1087, 1088,
1639 1089, 1090, 1091, 1095, 1096, 1097, 1101, 1102, 1106, 1107,
1640 1108, 1112, 1113, 1114, 1115, 1116, 1119, 1120, 1121, 1122,
1641 1123, 1124, 1125, 1132, 1133, 1134, 1135, 1138, 1139, 1144,
1642 1145, 1148, 1149, 1156, 1157, 1163, 1164, 1172, 1180, 1181,
1643 1186, 1187, 1188, 1193, 1206, 1206, 1206, 1206, 1209, 1213,
1644 1217, 1224, 1229, 1237, 1255, 1273, 1278, 1290, 1300, 1304,
1645 1314, 1321, 1328, 1335, 1340, 1345, 1352, 1353, 1360, 1367,
1646 1375, 1380, 1391, 1419, 1435, 1464, 1492, 1517, 1536, 1561,
1647 1580, 1592, 1599, 1665, 1675, 1685, 1691, 1697, 1702, 1707,
1648 1715, 1727, 1748, 1756, 1762, 1773, 1778, 1783, 1792, 1798,
1649 1804, 1813, 1817, 1825, 1825, 1836, 1841, 1849, 1850, 1854,
1650 1854, 1858, 1858, 1861, 1864, 1876, 1900, 1911, 1911, 1921,
1651 1921, 1929, 1929, 1939, 1942, 1948, 1961, 1965, 1970, 1972,
1652 1977, 1982, 1991, 2001, 2012, 2016, 2025, 2034, 2039, 2145,
1653 2145, 2147, 2156, 2156, 2158, 2163, 2175, 2179, 2184, 2188,
1654 2192, 2196, 2200, 2204, 2208, 2212, 2216, 2241, 2245, 2259,
1655 2263, 2267, 2271, 2277, 2277, 2283, 2292, 2296, 2305, 2316,
1656 2325, 2337, 2350, 2354, 2358, 2363, 2373, 2392, 2401, 2468,
1657 2472, 2479, 2490, 2503, 2512, 2523, 2533, 2541, 2549, 2552,
1658 2553, 2560, 2564, 2569, 2590, 2607, 2620, 2633, 2642, 2654,
1659 2662, 2669, 2675, 2681, 2687, 2702, 2766, 2771, 2775, 2782,
1660 2789, 2797, 2804, 2812, 2820, 2834, 2851
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001661};
1662#endif
1663
Reid Spencer41dff5e2007-01-26 08:05:27 +00001664#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1665/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
Reid Spencer5cbf9852007-01-30 20:08:39 +00001666 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001667static const char *const yytname[] =
1668{
Reid Spencer41dff5e2007-01-26 08:05:27 +00001669 "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL",
1670 "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE", "FLOAT",
1671 "DOUBLE", "LABEL", "TYPE", "LOCALVAR", "GLOBALVAR", "LABELSTR",
1672 "STRINGCONSTANT", "ATSTRINGCONSTANT", "IMPLEMENTATION",
1673 "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK",
1674 "DECLARE", "DEFINE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO",
1675 "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
1676 "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
1677 "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "DEPLIBS", "CALL", "TAIL",
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001678 "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", "FASTCC_TOK",
1679 "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT",
1680 "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB",
1681 "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR",
1682 "XOR", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT",
1683 "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD",
1684 "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE",
1685 "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST",
1686 "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT",
1687 "PHI_TOK", "SELECT", "SHL", "LSHR", "ASHR", "VAARG", "EXTRACTELEMENT",
1688 "INSERTELEMENT", "SHUFFLEVECTOR", "NORETURN", "INREG", "SRET", "DEFAULT",
1689 "HIDDEN", "'='", "','", "'*'", "'\\\\'", "'('", "')'", "'['", "'x'",
1690 "']'", "'<'", "'>'", "'{'", "'}'", "'c'", "$accept", "ArithmeticOps",
1691 "LogicalOps", "CastOps", "ShiftOps", "IPredicates", "FPredicates",
1692 "IntType", "FPType", "LocalName", "OptLocalName", "OptLocalAssign",
1693 "GlobalName", "OptGlobalAssign", "GVInternalLinkage",
Reid Spencer41dff5e2007-01-26 08:05:27 +00001694 "GVExternalLinkage", "GVVisibilityStyle", "FunctionDeclareLinkage",
1695 "FunctionDefineLinkage", "OptCallingConv", "ParamAttr", "OptParamAttrs",
1696 "FuncAttr", "OptFuncAttrs", "OptAlign", "OptCAlign", "SectionString",
1697 "OptSection", "GlobalVarAttributes", "GlobalVarAttribute", "PrimType",
1698 "Types", "ArgType", "ResultTypes", "ArgTypeList", "ArgTypeListI",
1699 "TypeListI", "ConstVal", "ConstExpr", "ConstVector", "GlobalType",
1700 "Module", "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5",
1701 "AsmBlock", "TargetDefinition", "LibrariesDefinition", "LibList",
1702 "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader",
1703 "END", "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
1704 "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList",
1705 "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst",
1706 "PHIList", "ValueRefList", "IndexList", "OptTailCall", "InstVal",
1707 "OptVolatile", "MemoryInst", 0
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001708};
1709#endif
1710
1711# ifdef YYPRINT
1712/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1713 token YYLEX-NUM. */
Reid Spencer5cbf9852007-01-30 20:08:39 +00001714static const unsigned short int yytoknum[] =
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001715{
1716 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1717 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1718 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1719 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1720 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1721 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1722 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1723 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1724 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1725 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1726 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1727 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1728 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001729 385, 386, 61, 44, 42, 92, 40, 41, 91, 120,
1730 93, 60, 62, 123, 125, 99
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001731};
1732# endif
1733
1734/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
Reid Spencer5cbf9852007-01-30 20:08:39 +00001735static const unsigned char yyr1[] =
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001736{
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001737 0, 146, 147, 147, 147, 147, 147, 147, 147, 147,
1738 147, 148, 148, 148, 149, 149, 149, 149, 149, 149,
1739 149, 149, 149, 149, 149, 149, 150, 150, 150, 151,
1740 151, 151, 151, 151, 151, 151, 151, 151, 151, 152,
1741 152, 152, 152, 152, 152, 152, 152, 152, 152, 152,
1742 152, 152, 152, 152, 152, 153, 154, 154, 155, 155,
1743 156, 156, 157, 157, 158, 158, 159, 159, 160, 160,
1744 160, 160, 160, 161, 161, 161, 162, 162, 163, 163,
1745 163, 164, 164, 164, 164, 164, 165, 165, 165, 165,
1746 165, 165, 165, 166, 166, 166, 166, 167, 167, 168,
1747 168, 169, 169, 170, 170, 171, 171, 172, 173, 173,
1748 174, 174, 175, 175, 176, 176, 176, 176, 177, 177,
1749 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
1750 177, 178, 179, 179, 180, 180, 181, 181, 181, 181,
1751 182, 182, 183, 183, 183, 183, 183, 183, 183, 183,
Reid Spencer41dff5e2007-01-26 08:05:27 +00001752 183, 183, 183, 183, 183, 183, 183, 183, 183, 183,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001753 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
1754 184, 185, 185, 186, 186, 187, 187, 188, 188, 190,
1755 189, 191, 189, 189, 189, 189, 189, 192, 189, 193,
1756 189, 194, 189, 189, 189, 195, 196, 196, 197, 198,
1757 198, 198, 199, 199, 200, 200, 200, 200, 201, 202,
1758 202, 203, 204, 204, 205, 206, 207, 207, 208, 208,
1759 208, 208, 208, 208, 208, 208, 208, 208, 208, 209,
1760 209, 209, 209, 210, 210, 211, 212, 212, 213, 214,
1761 214, 214, 215, 215, 215, 215, 215, 215, 215, 215,
1762 215, 216, 216, 217, 218, 218, 219, 219, 219, 220,
1763 220, 221, 221, 222, 222, 222, 222, 222, 222, 222,
1764 222, 222, 222, 222, 222, 222, 222, 223, 223, 224,
1765 224, 224, 224, 224, 224, 224, 224
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001766};
1767
1768/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
Reid Spencer5cbf9852007-01-30 20:08:39 +00001769static const unsigned char yyr2[] =
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001770{
1771 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1772 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1773 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1774 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1775 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1776 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Reid Spencer41dff5e2007-01-26 08:05:27 +00001777 1, 0, 2, 0, 1, 1, 2, 0, 1, 1,
1778 1, 1, 1, 1, 1, 1, 0, 1, 0, 1,
1779 1, 0, 1, 1, 1, 1, 0, 1, 1, 1,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001780 1, 1, 2, 1, 1, 1, 1, 0, 2, 1,
1781 1, 0, 2, 0, 2, 0, 3, 2, 0, 1,
1782 0, 3, 1, 2, 1, 1, 1, 1, 1, 1,
1783 2, 1, 2, 5, 5, 5, 5, 3, 2, 5,
1784 4, 2, 1, 1, 1, 3, 1, 3, 1, 0,
1785 1, 3, 4, 3, 3, 4, 4, 3, 6, 5,
1786 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1787 6, 5, 8, 6, 6, 7, 7, 6, 6, 8,
1788 8, 3, 1, 1, 1, 1, 0, 1, 2, 0,
1789 3, 0, 3, 3, 1, 3, 3, 0, 6, 0,
1790 7, 0, 7, 2, 3, 1, 3, 3, 3, 3,
1791 1, 0, 5, 3, 1, 3, 1, 0, 9, 1,
1792 1, 4, 1, 1, 2, 3, 0, 1, 1, 1,
1793 1, 1, 1, 1, 1, 1, 3, 1, 5, 1,
1794 1, 1, 1, 1, 1, 2, 2, 2, 3, 2,
1795 0, 1, 2, 2, 3, 9, 9, 8, 14, 1,
1796 1, 6, 5, 2, 6, 7, 3, 5, 0, 0,
1797 3, 2, 1, 5, 5, 6, 6, 4, 4, 6,
1798 4, 4, 6, 6, 2, 8, 1, 1, 0, 3,
1799 6, 3, 6, 2, 4, 6, 4
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001800};
1801
1802/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1803 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
1804 means the default is an error. */
Reid Spencer5cbf9852007-01-30 20:08:39 +00001805static const unsigned short int yydefact[] =
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001806{
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001807 67, 58, 64, 59, 65, 184, 181, 179, 0, 0,
1808 0, 0, 0, 0, 76, 0, 67, 177, 78, 81,
1809 0, 0, 193, 0, 0, 62, 0, 66, 68, 70,
Reid Spencer41dff5e2007-01-26 08:05:27 +00001810 69, 71, 73, 72, 74, 75, 77, 76, 76, 0,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001811 1, 178, 79, 80, 76, 182, 82, 83, 84, 85,
1812 76, 240, 180, 240, 0, 0, 201, 194, 195, 183,
1813 229, 230, 186, 114, 115, 116, 117, 118, 0, 0,
1814 0, 0, 231, 232, 119, 185, 121, 0, 0, 173,
1815 174, 0, 86, 86, 241, 237, 63, 212, 213, 214,
1816 236, 196, 197, 200, 0, 139, 122, 0, 0, 0,
1817 0, 128, 140, 0, 120, 139, 0, 0, 114, 115,
1818 116, 0, 0, 0, 187, 0, 87, 88, 89, 90,
1819 91, 0, 215, 0, 278, 239, 0, 198, 138, 97,
1820 134, 136, 0, 0, 0, 0, 0, 0, 127, 0,
1821 189, 191, 157, 158, 155, 156, 159, 154, 150, 151,
1822 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1823 12, 13, 0, 0, 0, 14, 15, 16, 17, 18,
1824 19, 20, 21, 22, 23, 24, 25, 0, 26, 27,
1825 28, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1826 0, 0, 153, 152, 110, 92, 133, 132, 0, 209,
1827 210, 211, 277, 262, 0, 0, 0, 0, 86, 249,
1828 250, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1829 0, 0, 0, 0, 0, 0, 0, 238, 86, 253,
1830 0, 276, 199, 131, 0, 101, 0, 0, 130, 0,
1831 141, 101, 110, 110, 29, 30, 31, 32, 33, 34,
1832 35, 36, 37, 38, 0, 53, 54, 49, 50, 51,
1833 52, 39, 40, 41, 42, 43, 44, 45, 46, 47,
1834 48, 0, 0, 0, 0, 0, 0, 143, 172, 0,
1835 0, 0, 147, 0, 144, 0, 0, 0, 0, 0,
1836 188, 0, 261, 243, 0, 242, 0, 0, 55, 0,
1837 0, 0, 0, 105, 105, 283, 0, 0, 274, 0,
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001838 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001839 0, 93, 94, 95, 96, 98, 137, 135, 124, 125,
1840 126, 129, 123, 190, 192, 0, 0, 259, 0, 0,
1841 0, 0, 0, 142, 128, 140, 0, 145, 146, 0,
1842 0, 0, 0, 0, 0, 112, 110, 207, 218, 219,
1843 220, 225, 221, 222, 223, 224, 216, 0, 227, 234,
1844 233, 235, 0, 244, 0, 0, 0, 0, 0, 279,
1845 0, 281, 259, 0, 0, 0, 0, 0, 0, 0,
1846 0, 0, 0, 0, 0, 0, 0, 99, 100, 102,
1847 0, 0, 0, 0, 0, 0, 0, 171, 149, 0,
1848 0, 0, 0, 0, 107, 113, 111, 206, 97, 204,
1849 0, 217, 0, 0, 0, 0, 0, 0, 0, 0,
1850 0, 0, 286, 0, 0, 0, 270, 271, 0, 0,
1851 0, 0, 268, 267, 0, 284, 0, 0, 0, 0,
1852 161, 0, 0, 0, 0, 148, 0, 0, 0, 0,
1853 61, 0, 101, 0, 226, 0, 0, 258, 0, 0,
1854 105, 106, 105, 0, 0, 0, 0, 0, 263, 264,
1855 258, 0, 0, 0, 260, 0, 168, 0, 0, 163,
1856 164, 160, 167, 60, 203, 205, 97, 108, 0, 0,
1857 0, 0, 0, 265, 266, 0, 280, 282, 0, 0,
1858 269, 272, 273, 0, 285, 165, 166, 0, 0, 0,
1859 61, 109, 103, 228, 0, 0, 97, 0, 101, 254,
1860 0, 101, 162, 169, 170, 202, 0, 208, 0, 247,
1861 0, 0, 256, 0, 0, 255, 275, 104, 245, 0,
1862 246, 0, 97, 0, 0, 0, 257, 0, 0, 0,
1863 0, 252, 0, 0, 251, 0, 248
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001864};
1865
Reid Spencer5cbf9852007-01-30 20:08:39 +00001866/* YYDEFGOTO[NTERM-NUM]. */
1867static const short int yydefgoto[] =
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001868{
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001869 -1, 188, 189, 190, 191, 254, 271, 111, 112, 72,
1870 494, 12, 73, 14, 37, 38, 39, 44, 50, 121,
1871 325, 233, 399, 328, 537, 379, 355, 522, 290, 356,
1872 74, 113, 130, 198, 131, 132, 103, 278, 368, 279,
1873 81, 15, 16, 17, 19, 18, 194, 242, 243, 59,
1874 22, 57, 94, 419, 420, 122, 201, 51, 89, 52,
1875 45, 422, 369, 76, 371, 295, 53, 85, 86, 227,
1876 541, 125, 308, 502, 402, 228, 229, 230, 231
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001877};
1878
1879/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1880 STATE-NUM. */
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001881#define YYPACT_NINF -386
Reid Spencer5cbf9852007-01-30 20:08:39 +00001882static const short int yypact[] =
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001883{
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001884 357, -386, -386, -386, -386, -386, -386, -386, 28, -112,
1885 61, -51, 136, 27, 288, 172, 594, -386, 209, 93,
1886 49, 75, -386, 48, 230, -386, 841, -386, -386, -386,
1887 -386, -386, -386, -386, -386, -386, -386, 129, 129, 229,
1888 -386, -386, -386, -386, 129, -386, -386, -386, -386, -386,
1889 129, 252, -386, 18, 257, 274, 279, -386, -386, -386,
1890 -386, -386, 161, -386, -386, -386, -386, -386, 294, 295,
1891 4, 13, -386, -386, -386, 137, -386, 229, 229, -386,
1892 -386, 1052, 228, 228, -386, -386, 110, -386, -386, -386,
1893 -386, -386, -386, -386, -65, 126, -386, 164, 165, 108,
1894 161, -386, 137, -49, -386, 126, 1052, 1192, 68, 298,
1895 299, 44, 300, 617, -386, 305, -386, -386, -386, -386,
1896 -386, 1206, -386, 9, 1340, -386, 293, -386, -386, 137,
1897 -386, 178, 175, 1192, 1192, 171, -45, 1192, -386, 177,
1898 -386, 137, -386, -386, -386, -386, -386, -386, -386, -386,
1899 -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,
1900 -386, -386, 264, 475, 179, -386, -386, -386, -386, -386,
1901 -386, -386, -386, -386, -386, -386, -386, 186, -386, -386,
1902 -386, 194, 202, 203, 803, 1241, 461, 325, 219, 222,
1903 237, 243, -386, -386, 236, -386, 161, 137, 226, -386,
1904 -386, -386, -386, -386, 332, 1256, 233, 372, 228, -386,
1905 -386, 264, 475, 1192, 1192, 1192, 1192, 1192, 1192, 1192,
1906 1192, 1192, 1192, 1192, 1192, 1192, 1192, -386, 228, -386,
1907 159, -386, -386, -64, 1095, -386, -33, 78, -386, 242,
1908 137, -386, 236, 236, -386, -386, -386, -386, -386, -386,
1909 -386, -386, -386, -386, 249, -386, -386, -386, -386, -386,
1910 -386, -386, -386, -386, -386, -386, -386, -386, -386, -386,
1911 -386, 250, 1052, 1052, 1052, 1052, 1052, -386, -386, -57,
1912 518, -92, -386, -39, -386, 1052, 1052, 1052, 1052, 23,
1913 -386, 253, -386, 161, 760, -386, 885, 885, -386, 885,
1914 1206, 1192, 1192, 43, 77, -386, 760, 31, 255, 259,
1915 262, 263, 266, 267, 760, 760, 366, 269, 1206, 1192,
1916 1192, -386, -386, -386, -386, -386, -386, -386, -50, -386,
1917 -386, -386, -50, -386, -386, 1052, 1052, -386, 270, 272,
1918 276, 277, 1052, -386, 265, 617, -23, -386, -386, 278,
1919 287, 381, 289, 408, 423, -386, 236, 1134, -386, -386,
1920 -386, -386, -386, -386, -386, -386, 376, 1052, -386, -386,
1921 -386, -386, 296, -386, 297, 885, 760, 760, 3, -386,
1922 5, -386, -386, 885, 301, 1192, 1192, 1192, 1192, 1192,
1923 302, 304, 1192, 1192, 885, 760, 307, -386, -386, -386,
1924 308, 310, -40, 1052, 1052, 1052, 1052, -386, -386, 291,
1925 1052, 1052, 1192, 1052, -386, -386, -386, -386, 137, 311,
1926 309, -386, 421, -88, 433, 435, 312, 316, 320, 885,
1927 450, 885, 323, 324, 885, 326, 137, -386, 328, 329,
1928 885, 885, 137, -386, 322, -386, 1192, 1052, 1052, 1192,
1929 -386, 331, 337, 344, 347, -386, 348, 349, 101, 351,
1930 125, 1150, -386, 356, -386, 885, 885, 1192, 885, 885,
1931 358, -386, 358, 885, 362, 1192, 1192, 1192, -386, -386,
1932 1192, 760, 361, 364, -386, 1052, -386, 1052, 1052, -386,
1933 -386, -386, -386, -386, -386, -386, 137, 56, 448, 371,
1934 343, 760, -31, -386, -386, 438, -386, -386, 359, 885,
1935 -386, -386, -386, 37, -386, -386, -386, 368, 369, 370,
1936 125, -386, 462, -386, 497, 6, -386, 1192, -386, -386,
1937 373, -386, -386, -386, -386, -386, 506, -386, 885, -386,
1938 1009, 20, -64, 760, 151, -386, -50, -386, -386, 382,
1939 -386, 1009, -386, 502, 504, 384, -64, 885, 885, 507,
1940 454, -386, 885, 509, -386, 885, -386
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001941};
1942
1943/* YYPGOTO[NTERM-NUM]. */
Reid Spencer5cbf9852007-01-30 20:08:39 +00001944static const short int yypgoto[] =
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001945{
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001946 -386, 398, 401, 407, 410, 327, 330, -204, -386, 0,
1947 17, 453, 10, -386, -386, -386, 54, -386, -386, -175,
1948 -319, -381, -386, -239, -386, -297, 46, -386, -203, -386,
1949 -386, -25, 306, -283, -386, 436, 445, -70, -109, -180,
1950 210, -386, -386, 529, -386, -386, -386, -386, -386, -386,
1951 -386, -386, -386, -386, -386, 464, -386, -386, -386, -386,
1952 -386, -386, -385, -75, 117, -159, -386, 496, -386, -386,
1953 -386, -386, -386, 70, 170, -386, -386, -386, -386
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001954};
1955
1956/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
1957 positive, shift that token. If negative, reduce the rule which
1958 number is the opposite. If zero, do what YYDEFACT says.
Reid Spencer41dff5e2007-01-26 08:05:27 +00001959 If YYTABLE_NINF, syntax error. */
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001960#define YYTABLE_NINF -177
Reid Spencer5cbf9852007-01-30 20:08:39 +00001961static const short int yytable[] =
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00001962{
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00001963 11, 75, 332, 299, 192, 281, 283, 381, 98, 398,
1964 13, 114, 429, 398, 431, 298, 11, 375, 60, 61,
1965 23, 100, 63, 64, 65, 66, 13, 1, 2, 298,
1966 3, 4, 199, 300, 84, 394, 140, 460, 193, 333,
1967 334, 342, 87, 321, 322, 342, 102, 144, 145, 430,
1968 347, 430, 353, 318, 464, 67, 305, 321, 322, 309,
1969 310, 311, 312, 313, 323, 324, 316, 317, 126, 354,
1970 129, -55, -55, 20, 102, 127, 342, 397, 323, 324,
1971 129, 25, 141, 343, 137, 353, 11, 21, 137, 142,
1972 143, 77, 78, 449, 342, 138, 197, 450, 82, 239,
1973 346, 104, 527, 105, 83, 348, 528, 329, 236, 237,
1974 342, 24, 240, 60, 61, 520, 100, 63, 64, 65,
1975 66, 409, 1, 2, 1, 3, 4, 3, 46, 47,
1976 48, 60, 61, 49, 100, 63, 64, 65, 66, 1,
1977 1, 2, 3, 3, 4, 542, 539, 99, 68, 26,
1978 67, 69, 200, 416, 70, 549, 71, 101, 128, 27,
1979 550, 396, 88, 321, 322, 104, 555, 105, 67, 383,
1980 527, 556, 40, 506, 531, 507, 378, 104, 398, 105,
1981 294, 54, 553, 397, 323, 324, 56, 423, 303, 304,
1982 294, 306, 307, 294, 294, 294, 294, 294, 314, 315,
1983 294, 294, 337, 338, 339, 340, 341, 55, 291, 129,
1984 380, 104, 104, 105, 105, 349, 350, 351, 352, 370,
1985 330, 370, 370, 497, 370, 398, 435, 398, 437, 438,
1986 439, 370, 321, 322, 443, 104, 192, 105, 491, 370,
1987 370, 2, 296, 68, 4, 297, 69, 58, 42, 70,
1988 43, 71, 135, 323, 324, 345, 79, 80, 321, 322,
1989 36, 68, 319, 320, 69, 400, 401, 70, 84, 71,
1990 193, 104, 407, 105, 91, 197, 376, 377, 397, 323,
1991 324, 115, 116, 117, 118, 119, 120, 106, 107, 544,
1992 484, 92, 546, 197, 395, 294, 93, 95, 96, 97,
1993 370, 370, 370, 133, 134, -56, -57, 146, 370, 195,
1994 232, 234, 235, 238, 241, 272, 510, 511, 512, 370,
1995 370, 540, 273, 28, 29, 30, 31, 32, 33, 34,
1996 274, 35, 418, 451, 452, 453, 454, 551, 275, 276,
1997 456, 457, 284, 459, 244, 245, 246, 247, 248, 249,
1998 250, 251, 252, 253, 370, 285, 370, -176, 286, 370,
1999 294, 436, 294, 294, 294, 370, 370, 442, 294, 289,
2000 -63, 1, 2, 287, 3, 4, 5, 482, 483, 288,
2001 292, 298, 6, 7, 331, 335, 336, 458, 384, 357,
2002 370, 370, 385, 370, 370, 386, 387, 392, 370, 388,
2003 389, 8, 393, 403, 9, 404, 370, 408, 10, 405,
2004 406, 410, 412, 372, 373, 517, 374, 518, 519, 36,
2005 411, 481, 413, 382, 294, 414, 370, 415, 421, 424,
2006 425, 390, 391, 455, 370, 440, 496, 441, 463, 434,
2007 446, 447, 501, 448, 461, 465, 462, 466, 467, 468,
2008 294, 294, 294, 469, 471, 501, 449, 473, 480, 475,
2009 493, 476, 477, 370, 485, 523, 60, 61, 370, 100,
2010 108, 109, 110, 66, 486, 1, 2, 487, 3, 4,
2011 488, 525, 370, 370, 430, 489, 490, 370, 492, 498,
2012 370, 505, 426, 427, 428, 509, 255, 256, 515, 529,
2013 433, 516, 543, 67, 524, 532, 533, 534, 536, 538,
2014 547, 444, 445, 545, 557, 554, 558, 559, 563, 562,
2015 493, 565, 223, 60, 61, 224, 100, 108, 109, 110,
2016 66, 225, 1, 2, 226, 3, 4, 535, 301, 124,
2017 327, 139, 302, 521, 136, 41, 470, 123, 472, 90,
2018 513, 474, 432, 0, 0, 0, 0, 478, 479, 0,
2019 67, 257, 258, 259, 260, 261, 262, 263, 264, 265,
2020 266, 267, 268, 269, 270, 0, 0, 0, 0, 0,
2021 0, 0, 499, 500, 0, 503, 504, 0, 0, 0,
2022 508, 0, 0, 0, -175, 0, 68, 0, 514, 69,
2023 0, 0, 70, 0, 71, 282, 0, -63, 1, 2,
2024 0, 3, 4, 5, 0, 0, 0, 0, 526, 6,
2025 7, 0, 60, 61, 0, 0, 530, 0, 0, 0,
2026 0, 1, 2, 0, 3, 4, 0, 147, 8, 0,
2027 0, 9, 0, 0, 0, 10, 0, 0, 0, 0,
2028 148, 149, 0, 68, 0, 548, 69, 0, 0, 70,
2029 552, 71, 344, 0, 0, 0, 0, 0, 0, 0,
2030 0, 0, 0, 0, 560, 561, 0, 0, 0, 564,
2031 0, 0, 566, 150, 151, 152, 153, 154, 155, 156,
2032 157, 158, 159, 160, 161, 162, 163, 0, 0, 0,
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002033 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002034 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002035 0, 0, 164, 165, 166, 167, 168, 169, 170, 171,
2036 172, 173, 174, 175, 176, 0, 177, 178, 179, 180,
2037 0, 181, 182, 183, 0, 0, 0, 0, 0, 0,
2038 0, 104, 0, 105, 0, 184, 0, 0, 185, 0,
2039 186, 0, 187, 358, 359, 60, 61, 360, 0, 0,
2040 0, 0, 0, 0, 1, 2, 0, 3, 4, 0,
2041 361, 362, 363, 0, 0, 0, 0, 0, 0, 0,
2042 0, 0, 0, 364, 365, 0, 0, 0, 0, 0,
2043 0, 0, 0, 0, 0, 0, 0, 0, 60, 61,
2044 366, 100, 108, 109, 110, 66, 0, 1, 2, 0,
2045 3, 4, 0, 0, 0, 0, 150, 151, 152, 153,
2046 154, 155, 156, 157, 158, 159, 160, 161, 162, 163,
2047 0, 0, 0, 0, 0, 67, 60, 61, 0, 62,
Reid Spencer41dff5e2007-01-26 08:05:27 +00002048 63, 64, 65, 66, 0, 1, 2, 0, 3, 4,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002049 0, 0, 0, 0, 0, 164, 165, 166, 167, 168,
2050 169, 170, 171, 172, 173, 174, 175, 176, 0, 177,
2051 178, 179, 180, 67, 181, 182, 183, 0, 358, 359,
2052 60, 61, 360, 0, 104, 0, 105, 0, 0, 1,
2053 2, 367, 3, 4, 0, 361, 362, 363, 0, 0,
2054 0, 0, 0, 0, 0, 0, 0, 0, 364, 365,
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002055 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002056 0, 0, 0, 0, 0, 366, 0, 0, 68, 0,
2057 0, 69, 0, 277, 70, 0, 71, 0, 0, 0,
2058 0, 150, 151, 152, 153, 154, 155, 156, 157, 158,
2059 159, 160, 161, 162, 163, 0, 0, 0, 0, 0,
2060 0, 0, 0, 0, 0, 0, 68, 0, 0, 69,
2061 0, 0, 70, 0, 71, 0, 0, 0, 0, 0,
2062 164, 165, 166, 167, 168, 169, 170, 171, 172, 173,
2063 174, 175, 176, 0, 177, 178, 179, 180, 0, 181,
2064 182, 183, 358, 359, 0, 0, 360, 0, 0, 0,
2065 0, 0, 0, 0, 0, 0, 367, 0, 0, 361,
2066 362, 363, 0, 0, 0, 0, 0, 0, 0, 0,
2067 0, 0, 364, 365, 0, 0, 0, 0, 0, 0,
2068 0, 0, 0, 0, 0, 0, 0, 60, 61, 366,
2069 100, 108, 109, 110, 66, 0, 1, 2, 0, 3,
2070 4, 0, 0, 0, 0, 150, 151, 152, 153, 154,
2071 155, 156, 157, 158, 159, 160, 161, 162, 163, 0,
2072 0, 0, 0, 0, 67, 0, 0, 0, 0, 0,
2073 60, 61, 0, 100, 63, 64, 65, 66, 0, 1,
2074 2, 0, 3, 4, 164, 165, 166, 167, 168, 169,
2075 170, 171, 172, 173, 174, 175, 176, 326, 177, 178,
2076 179, 180, 0, 181, 182, 183, 0, 67, 0, 60,
Reid Spencer41dff5e2007-01-26 08:05:27 +00002077 61, 0, 100, 63, 64, 65, 66, 0, 1, 2,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002078 367, 3, 4, 0, 0, 60, 61, 0, 100, 63,
2079 64, 65, 66, 0, 1, 2, 417, 3, 4, 0,
2080 0, 0, 0, 0, 0, 0, 67, 0, 0, 0,
2081 0, 0, 495, 0, 0, 0, 0, 68, 0, 0,
2082 69, 0, 67, 70, 0, 71, 0, 60, 61, 0,
2083 100, 63, 64, 65, 66, 0, 1, 2, 0, 3,
2084 4, 60, 61, 0, 196, 63, 64, 65, 66, 0,
2085 1, 2, 0, 3, 4, 0, 0, 0, 0, 0,
2086 68, 0, 0, 69, 67, 0, 70, 0, 71, 0,
2087 0, 0, 0, 0, 0, 0, 60, 61, 67, 100,
2088 108, 109, 110, 66, 0, 1, 2, 0, 3, 4,
2089 0, 60, 61, 0, 293, 63, 64, 65, 66, 68,
2090 1, 2, 69, 3, 4, 70, 0, 71, 0, 0,
2091 0, 0, 0, 67, 0, 68, 0, 0, 69, 0,
2092 0, 70, 0, 71, 0, 0, 0, 0, 67, 0,
2093 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2094 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Reid Spencer41dff5e2007-01-26 08:05:27 +00002095 0, 0, 0, 0, 0, 0, 0, 68, 0, 0,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002096 69, 0, 0, 70, 0, 71, 0, 0, 0, 0,
Reid Spencer41dff5e2007-01-26 08:05:27 +00002097 0, 68, 0, 0, 69, 0, 0, 70, 0, 71,
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002098 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2099 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002100 202, 0, 0, 0, 0, 0, 68, 0, 0, 69,
2101 0, 0, 70, 0, 280, 0, 0, 0, 203, 204,
2102 0, 68, 0, 0, 69, 0, 0, 70, 0, 71,
2103 205, 206, 207, 208, 209, 210, 150, 151, 152, 153,
2104 154, 155, 156, 157, 158, 159, 160, 161, 211, 212,
2105 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2106 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2107 213, 214, 215, 0, 0, 216, 165, 166, 167, 168,
2108 169, 170, 171, 172, 173, 174, 175, 176, 217, 218,
2109 178, 179, 180, 219, 220, 221, 222
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002110};
2111
Reid Spencer5cbf9852007-01-30 20:08:39 +00002112static const short int yycheck[] =
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002113{
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002114 0, 26, 241, 207, 113, 185, 186, 304, 4, 328,
2115 0, 81, 9, 332, 9, 9, 16, 300, 5, 6,
2116 132, 8, 9, 10, 11, 12, 16, 14, 15, 9,
2117 17, 18, 23, 208, 16, 318, 106, 418, 113, 242,
2118 243, 133, 24, 107, 108, 133, 71, 3, 4, 46,
2119 142, 46, 29, 228, 142, 42, 215, 107, 108, 218,
2120 219, 220, 221, 222, 128, 129, 225, 226, 133, 46,
2121 95, 3, 4, 45, 99, 140, 133, 127, 128, 129,
2122 105, 132, 107, 140, 133, 29, 86, 59, 133, 21,
2123 22, 37, 38, 133, 133, 144, 121, 137, 44, 144,
2124 280, 134, 133, 136, 50, 144, 137, 140, 133, 134,
2125 133, 50, 137, 5, 6, 496, 8, 9, 10, 11,
2126 12, 144, 14, 15, 14, 17, 18, 17, 35, 36,
2127 37, 5, 6, 40, 8, 9, 10, 11, 12, 14,
2128 14, 15, 17, 17, 18, 526, 140, 143, 135, 13,
2129 42, 138, 143, 356, 141, 540, 143, 144, 32, 132,
2130 140, 320, 144, 107, 108, 134, 551, 136, 42, 138,
2131 133, 552, 0, 470, 137, 472, 133, 134, 497, 136,
2132 205, 132, 31, 127, 128, 129, 138, 367, 213, 214,
Reid Spencer41dff5e2007-01-26 08:05:27 +00002133 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002134 225, 226, 272, 273, 274, 275, 276, 132, 198, 234,
2135 133, 134, 134, 136, 136, 285, 286, 287, 288, 294,
2136 142, 296, 297, 462, 299, 544, 385, 546, 387, 388,
2137 389, 306, 107, 108, 393, 134, 345, 136, 137, 314,
2138 315, 15, 9, 135, 18, 12, 138, 17, 39, 141,
2139 41, 143, 144, 128, 129, 280, 27, 28, 107, 108,
2140 131, 135, 103, 104, 138, 335, 336, 141, 16, 143,
2141 345, 134, 342, 136, 17, 300, 301, 302, 127, 128,
2142 129, 53, 54, 55, 56, 57, 58, 77, 78, 528,
2143 449, 17, 531, 318, 319, 320, 17, 136, 4, 4,
2144 375, 376, 377, 139, 139, 7, 7, 7, 383, 4,
2145 17, 133, 137, 142, 137, 136, 475, 476, 477, 394,
2146 395, 525, 136, 35, 36, 37, 38, 39, 40, 41,
2147 136, 43, 357, 403, 404, 405, 406, 541, 136, 136,
2148 410, 411, 17, 413, 80, 81, 82, 83, 84, 85,
2149 86, 87, 88, 89, 429, 136, 431, 0, 136, 434,
2150 385, 386, 387, 388, 389, 440, 441, 392, 393, 133,
2151 13, 14, 15, 136, 17, 18, 19, 447, 448, 136,
2152 48, 9, 25, 26, 142, 136, 136, 412, 133, 136,
2153 465, 466, 133, 468, 469, 133, 133, 31, 473, 133,
2154 133, 44, 133, 133, 47, 133, 481, 142, 51, 133,
2155 133, 133, 31, 296, 297, 485, 299, 487, 488, 131,
2156 133, 446, 133, 306, 449, 17, 501, 4, 52, 133,
2157 133, 314, 315, 142, 509, 133, 461, 133, 17, 138,
2158 133, 133, 467, 133, 133, 12, 137, 12, 136, 133,
2159 475, 476, 477, 133, 4, 480, 133, 133, 136, 133,
2160 460, 133, 133, 538, 133, 17, 5, 6, 543, 8,
2161 9, 10, 11, 12, 137, 14, 15, 133, 17, 18,
2162 133, 138, 557, 558, 46, 137, 137, 562, 137, 133,
2163 565, 133, 375, 376, 377, 133, 21, 22, 137, 140,
2164 383, 137, 527, 42, 133, 137, 137, 137, 46, 12,
2165 4, 394, 395, 140, 12, 133, 12, 133, 64, 12,
2166 520, 12, 124, 5, 6, 124, 8, 9, 10, 11,
2167 12, 124, 14, 15, 124, 17, 18, 520, 211, 86,
2168 234, 105, 212, 497, 99, 16, 429, 83, 431, 53,
2169 480, 434, 382, -1, -1, -1, -1, 440, 441, -1,
2170 42, 86, 87, 88, 89, 90, 91, 92, 93, 94,
2171 95, 96, 97, 98, 99, -1, -1, -1, -1, -1,
2172 -1, -1, 465, 466, -1, 468, 469, -1, -1, -1,
2173 473, -1, -1, -1, 0, -1, 135, -1, 481, 138,
2174 -1, -1, 141, -1, 143, 144, -1, 13, 14, 15,
2175 -1, 17, 18, 19, -1, -1, -1, -1, 501, 25,
2176 26, -1, 5, 6, -1, -1, 509, -1, -1, -1,
2177 -1, 14, 15, -1, 17, 18, -1, 20, 44, -1,
2178 -1, 47, -1, -1, -1, 51, -1, -1, -1, -1,
2179 33, 34, -1, 135, -1, 538, 138, -1, -1, 141,
2180 543, 143, 144, -1, -1, -1, -1, -1, -1, -1,
2181 -1, -1, -1, -1, 557, 558, -1, -1, -1, 562,
2182 -1, -1, 565, 66, 67, 68, 69, 70, 71, 72,
2183 73, 74, 75, 76, 77, 78, 79, -1, -1, -1,
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002184 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Reid Spencer41dff5e2007-01-26 08:05:27 +00002185 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002186 -1, -1, 105, 106, 107, 108, 109, 110, 111, 112,
2187 113, 114, 115, 116, 117, -1, 119, 120, 121, 122,
2188 -1, 124, 125, 126, -1, -1, -1, -1, -1, -1,
2189 -1, 134, -1, 136, -1, 138, -1, -1, 141, -1,
2190 143, -1, 145, 3, 4, 5, 6, 7, -1, -1,
2191 -1, -1, -1, -1, 14, 15, -1, 17, 18, -1,
2192 20, 21, 22, -1, -1, -1, -1, -1, -1, -1,
2193 -1, -1, -1, 33, 34, -1, -1, -1, -1, -1,
2194 -1, -1, -1, -1, -1, -1, -1, -1, 5, 6,
2195 50, 8, 9, 10, 11, 12, -1, 14, 15, -1,
2196 17, 18, -1, -1, -1, -1, 66, 67, 68, 69,
2197 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2198 -1, -1, -1, -1, -1, 42, 5, 6, -1, 8,
Reid Spencer41dff5e2007-01-26 08:05:27 +00002199 9, 10, 11, 12, -1, 14, 15, -1, 17, 18,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002200 -1, -1, -1, -1, -1, 105, 106, 107, 108, 109,
2201 110, 111, 112, 113, 114, 115, 116, 117, -1, 119,
2202 120, 121, 122, 42, 124, 125, 126, -1, 3, 4,
2203 5, 6, 7, -1, 134, -1, 136, -1, -1, 14,
2204 15, 141, 17, 18, -1, 20, 21, 22, -1, -1,
2205 -1, -1, -1, -1, -1, -1, -1, -1, 33, 34,
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002206 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002207 -1, -1, -1, -1, -1, 50, -1, -1, 135, -1,
2208 -1, 138, -1, 140, 141, -1, 143, -1, -1, -1,
2209 -1, 66, 67, 68, 69, 70, 71, 72, 73, 74,
2210 75, 76, 77, 78, 79, -1, -1, -1, -1, -1,
2211 -1, -1, -1, -1, -1, -1, 135, -1, -1, 138,
2212 -1, -1, 141, -1, 143, -1, -1, -1, -1, -1,
2213 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
2214 115, 116, 117, -1, 119, 120, 121, 122, -1, 124,
2215 125, 126, 3, 4, -1, -1, 7, -1, -1, -1,
2216 -1, -1, -1, -1, -1, -1, 141, -1, -1, 20,
2217 21, 22, -1, -1, -1, -1, -1, -1, -1, -1,
2218 -1, -1, 33, 34, -1, -1, -1, -1, -1, -1,
2219 -1, -1, -1, -1, -1, -1, -1, 5, 6, 50,
2220 8, 9, 10, 11, 12, -1, 14, 15, -1, 17,
2221 18, -1, -1, -1, -1, 66, 67, 68, 69, 70,
2222 71, 72, 73, 74, 75, 76, 77, 78, 79, -1,
2223 -1, -1, -1, -1, 42, -1, -1, -1, -1, -1,
2224 5, 6, -1, 8, 9, 10, 11, 12, -1, 14,
2225 15, -1, 17, 18, 105, 106, 107, 108, 109, 110,
2226 111, 112, 113, 114, 115, 116, 117, 32, 119, 120,
2227 121, 122, -1, 124, 125, 126, -1, 42, -1, 5,
Reid Spencer41dff5e2007-01-26 08:05:27 +00002228 6, -1, 8, 9, 10, 11, 12, -1, 14, 15,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002229 141, 17, 18, -1, -1, 5, 6, -1, 8, 9,
Reid Spencer41dff5e2007-01-26 08:05:27 +00002230 10, 11, 12, -1, 14, 15, 32, 17, 18, -1,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002231 -1, -1, -1, -1, -1, -1, 42, -1, -1, -1,
2232 -1, -1, 32, -1, -1, -1, -1, 135, -1, -1,
2233 138, -1, 42, 141, -1, 143, -1, 5, 6, -1,
2234 8, 9, 10, 11, 12, -1, 14, 15, -1, 17,
2235 18, 5, 6, -1, 8, 9, 10, 11, 12, -1,
2236 14, 15, -1, 17, 18, -1, -1, -1, -1, -1,
2237 135, -1, -1, 138, 42, -1, 141, -1, 143, -1,
2238 -1, -1, -1, -1, -1, -1, 5, 6, 42, 8,
2239 9, 10, 11, 12, -1, 14, 15, -1, 17, 18,
2240 -1, 5, 6, -1, 8, 9, 10, 11, 12, 135,
2241 14, 15, 138, 17, 18, 141, -1, 143, -1, -1,
2242 -1, -1, -1, 42, -1, 135, -1, -1, 138, -1,
2243 -1, 141, -1, 143, -1, -1, -1, -1, 42, -1,
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002244 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2245 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002246 -1, -1, -1, -1, -1, -1, -1, 135, -1, -1,
2247 138, -1, -1, 141, -1, 143, -1, -1, -1, -1,
2248 -1, 135, -1, -1, 138, -1, -1, 141, -1, 143,
2249 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2250 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2251 30, -1, -1, -1, -1, -1, 135, -1, -1, 138,
2252 -1, -1, 141, -1, 143, -1, -1, -1, 48, 49,
2253 -1, 135, -1, -1, 138, -1, -1, 141, -1, 143,
2254 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
2255 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
2256 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2257 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2258 100, 101, 102, -1, -1, 105, 106, 107, 108, 109,
2259 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
2260 120, 121, 122, 123, 124, 125, 126
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002261};
2262
2263/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2264 symbol of state STATE-NUM. */
Reid Spencer5cbf9852007-01-30 20:08:39 +00002265static const unsigned char yystos[] =
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002266{
Reid Spencer41dff5e2007-01-26 08:05:27 +00002267 0, 14, 15, 17, 18, 19, 25, 26, 44, 47,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002268 51, 155, 157, 158, 159, 187, 188, 189, 191, 190,
2269 45, 59, 196, 132, 50, 132, 13, 132, 35, 36,
2270 37, 38, 39, 40, 41, 43, 131, 160, 161, 162,
2271 0, 189, 39, 41, 163, 206, 35, 36, 37, 40,
2272 164, 203, 205, 212, 132, 132, 138, 197, 17, 195,
2273 5, 6, 8, 9, 10, 11, 12, 42, 135, 138,
2274 141, 143, 155, 158, 176, 177, 209, 162, 162, 27,
2275 28, 186, 162, 162, 16, 213, 214, 24, 144, 204,
2276 213, 17, 17, 17, 198, 136, 4, 4, 4, 143,
2277 8, 144, 177, 182, 134, 136, 186, 186, 9, 10,
2278 11, 153, 154, 177, 183, 53, 54, 55, 56, 57,
2279 58, 165, 201, 201, 157, 217, 133, 140, 32, 177,
2280 178, 180, 181, 139, 139, 144, 182, 133, 144, 181,
2281 183, 177, 21, 22, 3, 4, 7, 20, 33, 34,
2282 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
2283 76, 77, 78, 79, 105, 106, 107, 108, 109, 110,
2284 111, 112, 113, 114, 115, 116, 117, 119, 120, 121,
2285 122, 124, 125, 126, 138, 141, 143, 145, 147, 148,
2286 149, 150, 184, 209, 192, 4, 8, 177, 179, 23,
2287 143, 202, 30, 48, 49, 60, 61, 62, 63, 64,
2288 65, 78, 79, 100, 101, 102, 105, 118, 119, 123,
2289 124, 125, 126, 147, 148, 149, 150, 215, 221, 222,
2290 223, 224, 17, 167, 133, 137, 177, 177, 142, 144,
2291 177, 137, 193, 194, 80, 81, 82, 83, 84, 85,
2292 86, 87, 88, 89, 151, 21, 22, 86, 87, 88,
Reid Spencer41dff5e2007-01-26 08:05:27 +00002293 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002294 99, 152, 136, 136, 136, 136, 136, 140, 183, 185,
2295 143, 185, 144, 185, 17, 136, 136, 136, 136, 133,
2296 174, 158, 48, 8, 177, 211, 9, 12, 9, 153,
2297 165, 151, 152, 177, 177, 211, 177, 177, 218, 211,
2298 211, 211, 211, 211, 177, 177, 211, 211, 165, 103,
2299 104, 107, 108, 128, 129, 166, 32, 178, 169, 140,
2300 142, 142, 169, 174, 174, 136, 136, 183, 183, 183,
2301 183, 183, 133, 140, 144, 177, 185, 142, 144, 183,
2302 183, 183, 183, 29, 46, 172, 175, 136, 3, 4,
2303 7, 20, 21, 22, 33, 34, 50, 141, 184, 208,
2304 209, 210, 210, 210, 210, 179, 177, 177, 133, 171,
2305 133, 171, 210, 138, 133, 133, 133, 133, 133, 133,
2306 210, 210, 31, 133, 179, 177, 211, 127, 166, 168,
2307 183, 183, 220, 133, 133, 133, 133, 183, 142, 144,
2308 133, 133, 31, 133, 17, 4, 174, 32, 177, 199,
2309 200, 52, 207, 185, 133, 133, 210, 210, 210, 9,
2310 46, 9, 220, 210, 138, 211, 177, 211, 211, 211,
2311 133, 133, 177, 211, 210, 210, 133, 133, 133, 133,
2312 137, 183, 183, 183, 183, 142, 183, 183, 177, 183,
2313 167, 133, 137, 17, 142, 12, 12, 136, 133, 133,
2314 210, 4, 210, 133, 210, 133, 133, 133, 210, 210,
2315 136, 177, 183, 183, 211, 133, 137, 133, 133, 137,
2316 137, 137, 137, 155, 156, 32, 177, 169, 133, 210,
2317 210, 177, 219, 210, 210, 133, 171, 171, 210, 133,
2318 211, 211, 211, 219, 210, 137, 137, 183, 183, 183,
2319 167, 172, 173, 17, 133, 138, 210, 133, 137, 140,
2320 210, 137, 137, 137, 137, 156, 46, 170, 12, 140,
2321 153, 216, 167, 177, 169, 140, 169, 4, 210, 208,
2322 140, 153, 210, 31, 133, 208, 167, 12, 12, 133,
2323 210, 210, 12, 64, 210, 12, 210
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002324};
Reid Spencer68a24bd2005-08-27 18:50:39 +00002325
2326#define yyerrok (yyerrstatus = 0)
2327#define yyclearin (yychar = YYEMPTY)
Reid Spencer41dff5e2007-01-26 08:05:27 +00002328#define YYEMPTY (-2)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002329#define YYEOF 0
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002330
Reid Spencer68a24bd2005-08-27 18:50:39 +00002331#define YYACCEPT goto yyacceptlab
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002332#define YYABORT goto yyabortlab
Reid Spencer41dff5e2007-01-26 08:05:27 +00002333#define YYERROR goto yyerrorlab
2334
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002335
2336/* Like YYERROR except do call yyerror. This remains here temporarily
2337 to ease the transition to the new meaning of YYERROR, for GCC.
Reid Spencer68a24bd2005-08-27 18:50:39 +00002338 Once GCC version 2 has supplanted version 1, this can go. */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002339
Reid Spencer68a24bd2005-08-27 18:50:39 +00002340#define YYFAIL goto yyerrlab
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002341
Reid Spencer68a24bd2005-08-27 18:50:39 +00002342#define YYRECOVERING() (!!yyerrstatus)
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002343
2344#define YYBACKUP(Token, Value) \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002345do \
2346 if (yychar == YYEMPTY && yylen == 1) \
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002347 { \
2348 yychar = (Token); \
2349 yylval = (Value); \
Reid Spencer41dff5e2007-01-26 08:05:27 +00002350 yytoken = YYTRANSLATE (yychar); \
Reid Spencer5cbf9852007-01-30 20:08:39 +00002351 YYPOPSTACK; \
Reid Spencer68a24bd2005-08-27 18:50:39 +00002352 goto yybackup; \
2353 } \
2354 else \
Reid Spencer41dff5e2007-01-26 08:05:27 +00002355 { \
2356 yyerror (YY_("syntax error: cannot back up")); \
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002357 YYERROR; \
2358 } \
Reid Spencer5cbf9852007-01-30 20:08:39 +00002359while (0)
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002360
Reid Spencer41dff5e2007-01-26 08:05:27 +00002361
Reid Spencer68a24bd2005-08-27 18:50:39 +00002362#define YYTERROR 1
2363#define YYERRCODE 256
2364
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002365
Reid Spencer41dff5e2007-01-26 08:05:27 +00002366/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2367 If N is 0, then set CURRENT to the empty location which ends
2368 the previous symbol: RHS[0] (always defined). */
2369
2370#define YYRHSLOC(Rhs, K) ((Rhs)[K])
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002371#ifndef YYLLOC_DEFAULT
Reid Spencer41dff5e2007-01-26 08:05:27 +00002372# define YYLLOC_DEFAULT(Current, Rhs, N) \
2373 do \
Reid Spencer5cbf9852007-01-30 20:08:39 +00002374 if (N) \
Reid Spencer41dff5e2007-01-26 08:05:27 +00002375 { \
2376 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2377 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2378 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2379 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2380 } \
2381 else \
2382 { \
2383 (Current).first_line = (Current).last_line = \
2384 YYRHSLOC (Rhs, 0).last_line; \
2385 (Current).first_column = (Current).last_column = \
2386 YYRHSLOC (Rhs, 0).last_column; \
2387 } \
Reid Spencer5cbf9852007-01-30 20:08:39 +00002388 while (0)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002389#endif
2390
Reid Spencer41dff5e2007-01-26 08:05:27 +00002391
2392/* YY_LOCATION_PRINT -- Print the location on the stream.
2393 This macro was not mandated originally: define only if we know
2394 we won't break user code: when these are the locations we know. */
2395
2396#ifndef YY_LOCATION_PRINT
2397# if YYLTYPE_IS_TRIVIAL
2398# define YY_LOCATION_PRINT(File, Loc) \
2399 fprintf (File, "%d.%d-%d.%d", \
Reid Spencer5cbf9852007-01-30 20:08:39 +00002400 (Loc).first_line, (Loc).first_column, \
2401 (Loc).last_line, (Loc).last_column)
Reid Spencer41dff5e2007-01-26 08:05:27 +00002402# else
2403# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2404# endif
2405#endif
2406
2407
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002408/* YYLEX -- calling `yylex' with the right arguments. */
2409
Reid Spencer41dff5e2007-01-26 08:05:27 +00002410#ifdef YYLEX_PARAM
2411# define YYLEX yylex (YYLEX_PARAM)
2412#else
2413# define YYLEX yylex ()
2414#endif
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002415
2416/* Enable debugging if requested. */
2417#if YYDEBUG
2418
2419# ifndef YYFPRINTF
2420# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2421# define YYFPRINTF fprintf
2422# endif
2423
2424# define YYDPRINTF(Args) \
2425do { \
2426 if (yydebug) \
2427 YYFPRINTF Args; \
Reid Spencer5cbf9852007-01-30 20:08:39 +00002428} while (0)
Reid Spencer41dff5e2007-01-26 08:05:27 +00002429
Reid Spencer5cbf9852007-01-30 20:08:39 +00002430# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2431do { \
2432 if (yydebug) \
2433 { \
2434 YYFPRINTF (stderr, "%s ", Title); \
2435 yysymprint (stderr, \
2436 Type, Value); \
2437 YYFPRINTF (stderr, "\n"); \
2438 } \
2439} while (0)
Reid Spencer41dff5e2007-01-26 08:05:27 +00002440
2441/*------------------------------------------------------------------.
2442| yy_stack_print -- Print the state stack from its BOTTOM up to its |
2443| TOP (included). |
2444`------------------------------------------------------------------*/
2445
Reid Spencer5cbf9852007-01-30 20:08:39 +00002446#if defined (__STDC__) || defined (__cplusplus)
Reid Spencer41dff5e2007-01-26 08:05:27 +00002447static void
Reid Spencer5cbf9852007-01-30 20:08:39 +00002448yy_stack_print (short int *bottom, short int *top)
Reid Spencer41dff5e2007-01-26 08:05:27 +00002449#else
2450static void
2451yy_stack_print (bottom, top)
Reid Spencer5cbf9852007-01-30 20:08:39 +00002452 short int *bottom;
2453 short int *top;
Reid Spencer41dff5e2007-01-26 08:05:27 +00002454#endif
2455{
2456 YYFPRINTF (stderr, "Stack now");
Reid Spencer5cbf9852007-01-30 20:08:39 +00002457 for (/* Nothing. */; bottom <= top; ++bottom)
Reid Spencer41dff5e2007-01-26 08:05:27 +00002458 YYFPRINTF (stderr, " %d", *bottom);
2459 YYFPRINTF (stderr, "\n");
2460}
2461
2462# define YY_STACK_PRINT(Bottom, Top) \
2463do { \
2464 if (yydebug) \
2465 yy_stack_print ((Bottom), (Top)); \
Reid Spencer5cbf9852007-01-30 20:08:39 +00002466} while (0)
Reid Spencer41dff5e2007-01-26 08:05:27 +00002467
2468
2469/*------------------------------------------------.
2470| Report that the YYRULE is going to be reduced. |
2471`------------------------------------------------*/
2472
Reid Spencer5cbf9852007-01-30 20:08:39 +00002473#if defined (__STDC__) || defined (__cplusplus)
Reid Spencer41dff5e2007-01-26 08:05:27 +00002474static void
Reid Spencer5cbf9852007-01-30 20:08:39 +00002475yy_reduce_print (int yyrule)
Reid Spencer41dff5e2007-01-26 08:05:27 +00002476#else
2477static void
Reid Spencer5cbf9852007-01-30 20:08:39 +00002478yy_reduce_print (yyrule)
Reid Spencer41dff5e2007-01-26 08:05:27 +00002479 int yyrule;
2480#endif
2481{
2482 int yyi;
2483 unsigned long int yylno = yyrline[yyrule];
Reid Spencer5cbf9852007-01-30 20:08:39 +00002484 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ",
2485 yyrule - 1, yylno);
2486 /* Print the symbols being reduced, and their result. */
2487 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
2488 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2489 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
Reid Spencer41dff5e2007-01-26 08:05:27 +00002490}
2491
2492# define YY_REDUCE_PRINT(Rule) \
2493do { \
2494 if (yydebug) \
Reid Spencer5cbf9852007-01-30 20:08:39 +00002495 yy_reduce_print (Rule); \
2496} while (0)
Reid Spencer41dff5e2007-01-26 08:05:27 +00002497
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002498/* Nonzero means print parse trace. It is left uninitialized so that
2499 multiple parsers can coexist. */
2500int yydebug;
2501#else /* !YYDEBUG */
2502# define YYDPRINTF(Args)
Reid Spencer41dff5e2007-01-26 08:05:27 +00002503# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2504# define YY_STACK_PRINT(Bottom, Top)
2505# define YY_REDUCE_PRINT(Rule)
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002506#endif /* !YYDEBUG */
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002507
Reid Spencer41dff5e2007-01-26 08:05:27 +00002508
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002509/* YYINITDEPTH -- initial size of the parser's stacks. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002510#ifndef YYINITDEPTH
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002511# define YYINITDEPTH 200
Reid Spencer68a24bd2005-08-27 18:50:39 +00002512#endif
2513
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002514/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2515 if the built-in stack extension method is used).
Reid Spencer68a24bd2005-08-27 18:50:39 +00002516
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002517 Do not make this value too large; the results are undefined if
Reid Spencer41dff5e2007-01-26 08:05:27 +00002518 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002519 evaluated with infinite-precision integer arithmetic. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002520
2521#ifndef YYMAXDEPTH
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002522# define YYMAXDEPTH 10000
Reid Spencer68a24bd2005-08-27 18:50:39 +00002523#endif
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002524
Reid Spencer68a24bd2005-08-27 18:50:39 +00002525
2526
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002527#if YYERROR_VERBOSE
Reid Spencer68a24bd2005-08-27 18:50:39 +00002528
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002529# ifndef yystrlen
Reid Spencer5cbf9852007-01-30 20:08:39 +00002530# if defined (__GLIBC__) && defined (_STRING_H)
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002531# define yystrlen strlen
2532# else
2533/* Return the length of YYSTR. */
2534static YYSIZE_T
Reid Spencer5cbf9852007-01-30 20:08:39 +00002535# if defined (__STDC__) || defined (__cplusplus)
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002536yystrlen (const char *yystr)
Reid Spencer5cbf9852007-01-30 20:08:39 +00002537# else
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002538yystrlen (yystr)
Reid Spencer5cbf9852007-01-30 20:08:39 +00002539 const char *yystr;
2540# endif
Chris Lattnerb25c4ca2007-01-15 02:12:07 +00002541{
Reid Spencer5cbf9852007-01-30 20:08:39 +00002542 const char *yys = yystr;
2543
2544 while (*yys++ != '\0')
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002545 continue;
Reid Spencer5cbf9852007-01-30 20:08:39 +00002546
2547 return yys - yystr - 1;
Chris Lattnerb25c4ca2007-01-15 02:12:07 +00002548}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002549# endif
2550# endif
Chris Lattnerb25c4ca2007-01-15 02:12:07 +00002551
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002552# ifndef yystpcpy
Reid Spencer5cbf9852007-01-30 20:08:39 +00002553# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002554# define yystpcpy stpcpy
2555# else
2556/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2557 YYDEST. */
2558static char *
Reid Spencer5cbf9852007-01-30 20:08:39 +00002559# if defined (__STDC__) || defined (__cplusplus)
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002560yystpcpy (char *yydest, const char *yysrc)
Reid Spencer5cbf9852007-01-30 20:08:39 +00002561# else
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002562yystpcpy (yydest, yysrc)
Reid Spencer5cbf9852007-01-30 20:08:39 +00002563 char *yydest;
2564 const char *yysrc;
2565# endif
Chris Lattnerb25c4ca2007-01-15 02:12:07 +00002566{
Reid Spencer41dff5e2007-01-26 08:05:27 +00002567 char *yyd = yydest;
2568 const char *yys = yysrc;
Chris Lattnerb25c4ca2007-01-15 02:12:07 +00002569
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002570 while ((*yyd++ = *yys++) != '\0')
2571 continue;
2572
2573 return yyd - 1;
Chris Lattnerb25c4ca2007-01-15 02:12:07 +00002574}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002575# endif
2576# endif
Chris Lattnerb25c4ca2007-01-15 02:12:07 +00002577
Reid Spencer41dff5e2007-01-26 08:05:27 +00002578# ifndef yytnamerr
2579/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2580 quotes and backslashes, so that it's suitable for yyerror. The
2581 heuristic is that double-quoting is unnecessary unless the string
2582 contains an apostrophe, a comma, or backslash (other than
2583 backslash-backslash). YYSTR is taken from yytname. If YYRES is
2584 null, do not copy; instead, return the length of what the result
2585 would have been. */
2586static YYSIZE_T
2587yytnamerr (char *yyres, const char *yystr)
2588{
2589 if (*yystr == '"')
2590 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00002591 size_t yyn = 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +00002592 char const *yyp = yystr;
2593
2594 for (;;)
2595 switch (*++yyp)
2596 {
2597 case '\'':
2598 case ',':
2599 goto do_not_strip_quotes;
2600
2601 case '\\':
2602 if (*++yyp != '\\')
2603 goto do_not_strip_quotes;
2604 /* Fall through. */
2605 default:
2606 if (yyres)
2607 yyres[yyn] = *yyp;
2608 yyn++;
2609 break;
2610
2611 case '"':
2612 if (yyres)
2613 yyres[yyn] = '\0';
2614 return yyn;
2615 }
2616 do_not_strip_quotes: ;
2617 }
2618
2619 if (! yyres)
2620 return yystrlen (yystr);
2621
2622 return yystpcpy (yyres, yystr) - yyres;
2623}
2624# endif
2625
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00002626#endif /* YYERROR_VERBOSE */
Reid Spencer5cbf9852007-01-30 20:08:39 +00002627
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002628
2629
Reid Spencer5cbf9852007-01-30 20:08:39 +00002630#if YYDEBUG
2631/*--------------------------------.
2632| Print this symbol on YYOUTPUT. |
2633`--------------------------------*/
2634
2635#if defined (__STDC__) || defined (__cplusplus)
2636static void
2637yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
2638#else
2639static void
2640yysymprint (yyoutput, yytype, yyvaluep)
2641 FILE *yyoutput;
2642 int yytype;
2643 YYSTYPE *yyvaluep;
2644#endif
2645{
2646 /* Pacify ``unused variable'' warnings. */
2647 (void) yyvaluep;
2648
2649 if (yytype < YYNTOKENS)
2650 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
2651 else
2652 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
2653
2654
2655# ifdef YYPRINT
2656 if (yytype < YYNTOKENS)
2657 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
2658# endif
2659 switch (yytype)
2660 {
2661 default:
2662 break;
2663 }
2664 YYFPRINTF (yyoutput, ")");
2665}
2666
2667#endif /* ! YYDEBUG */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002668/*-----------------------------------------------.
2669| Release the memory associated to this symbol. |
2670`-----------------------------------------------*/
2671
Reid Spencer5cbf9852007-01-30 20:08:39 +00002672#if defined (__STDC__) || defined (__cplusplus)
Reid Spencer41dff5e2007-01-26 08:05:27 +00002673static void
2674yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002675#else
Reid Spencer41dff5e2007-01-26 08:05:27 +00002676static void
2677yydestruct (yymsg, yytype, yyvaluep)
2678 const char *yymsg;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002679 int yytype;
Reid Spencer41dff5e2007-01-26 08:05:27 +00002680 YYSTYPE *yyvaluep;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002681#endif
2682{
Reid Spencer5cbf9852007-01-30 20:08:39 +00002683 /* Pacify ``unused variable'' warnings. */
2684 (void) yyvaluep;
Reid Spencer41dff5e2007-01-26 08:05:27 +00002685
2686 if (!yymsg)
2687 yymsg = "Deleting";
2688 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002689
2690 switch (yytype)
2691 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00002692
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002693 default:
Reid Spencer5cbf9852007-01-30 20:08:39 +00002694 break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002695 }
2696}
2697
2698
Reid Spencer41dff5e2007-01-26 08:05:27 +00002699/* Prevent warnings from -Wmissing-prototypes. */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002700
2701#ifdef YYPARSE_PARAM
Reid Spencer5cbf9852007-01-30 20:08:39 +00002702# if defined (__STDC__) || defined (__cplusplus)
Reid Spencer41dff5e2007-01-26 08:05:27 +00002703int yyparse (void *YYPARSE_PARAM);
Reid Spencer5cbf9852007-01-30 20:08:39 +00002704# else
Reid Spencer41dff5e2007-01-26 08:05:27 +00002705int yyparse ();
Reid Spencer5cbf9852007-01-30 20:08:39 +00002706# endif
Reid Spencer41dff5e2007-01-26 08:05:27 +00002707#else /* ! YYPARSE_PARAM */
Reid Spencer5cbf9852007-01-30 20:08:39 +00002708#if defined (__STDC__) || defined (__cplusplus)
Reid Spencere812fb22006-01-19 01:21:04 +00002709int yyparse (void);
Reid Spencer41dff5e2007-01-26 08:05:27 +00002710#else
2711int yyparse ();
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002712#endif
Reid Spencer41dff5e2007-01-26 08:05:27 +00002713#endif /* ! YYPARSE_PARAM */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002714
2715
Reid Spencer41dff5e2007-01-26 08:05:27 +00002716
2717/* The look-ahead symbol. */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002718int yychar;
2719
Reid Spencer41dff5e2007-01-26 08:05:27 +00002720/* The semantic value of the look-ahead symbol. */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002721YYSTYPE yylval;
2722
Reid Spencer41dff5e2007-01-26 08:05:27 +00002723/* Number of syntax errors so far. */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002724int yynerrs;
2725
2726
Reid Spencer41dff5e2007-01-26 08:05:27 +00002727
2728/*----------.
2729| yyparse. |
2730`----------*/
2731
2732#ifdef YYPARSE_PARAM
Reid Spencer5cbf9852007-01-30 20:08:39 +00002733# if defined (__STDC__) || defined (__cplusplus)
2734int yyparse (void *YYPARSE_PARAM)
2735# else
2736int yyparse (YYPARSE_PARAM)
2737 void *YYPARSE_PARAM;
2738# endif
Reid Spencer41dff5e2007-01-26 08:05:27 +00002739#else /* ! YYPARSE_PARAM */
Reid Spencer5cbf9852007-01-30 20:08:39 +00002740#if defined (__STDC__) || defined (__cplusplus)
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002741int
Reid Spencer41dff5e2007-01-26 08:05:27 +00002742yyparse (void)
2743#else
2744int
2745yyparse ()
2746
2747#endif
2748#endif
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002749{
2750
Reid Spencer41dff5e2007-01-26 08:05:27 +00002751 int yystate;
2752 int yyn;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002753 int yyresult;
2754 /* Number of tokens to shift before error messages enabled. */
2755 int yyerrstatus;
Reid Spencer41dff5e2007-01-26 08:05:27 +00002756 /* Look-ahead token as an internal (translated) token number. */
2757 int yytoken = 0;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002758
2759 /* Three stacks and their tools:
2760 `yyss': related to states,
2761 `yyvs': related to semantic values,
2762 `yyls': related to locations.
2763
2764 Refer to the stacks thru separate pointers, to allow yyoverflow
2765 to reallocate them elsewhere. */
2766
2767 /* The state stack. */
Reid Spencer5cbf9852007-01-30 20:08:39 +00002768 short int yyssa[YYINITDEPTH];
2769 short int *yyss = yyssa;
2770 short int *yyssp;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002771
2772 /* The semantic value stack. */
2773 YYSTYPE yyvsa[YYINITDEPTH];
2774 YYSTYPE *yyvs = yyvsa;
Reid Spencer41dff5e2007-01-26 08:05:27 +00002775 YYSTYPE *yyvsp;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002776
2777
2778
Reid Spencer5cbf9852007-01-30 20:08:39 +00002779#define YYPOPSTACK (yyvsp--, yyssp--)
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002780
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002781 YYSIZE_T yystacksize = YYINITDEPTH;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002782
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002783 /* The variables used to return semantic value and location from the
2784 action routines. */
2785 YYSTYPE yyval;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002786
2787
Reid Spencer5cbf9852007-01-30 20:08:39 +00002788 /* When reducing, the number of symbols on the RHS of the reduced
2789 rule. */
2790 int yylen;
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002791
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002792 YYDPRINTF ((stderr, "Starting parse\n"));
Anton Korobeynikov178a3522007-01-12 19:22:51 +00002793
Reid Spencer68a24bd2005-08-27 18:50:39 +00002794 yystate = 0;
2795 yyerrstatus = 0;
2796 yynerrs = 0;
2797 yychar = YYEMPTY; /* Cause a token to be read. */
2798
2799 /* Initialize stack pointers.
2800 Waste one element of value and location stack
2801 so that they stay on the same level as the state stack.
2802 The wasted elements are never initialized. */
2803
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002804 yyssp = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002805 yyvsp = yyvs;
2806
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002807 goto yysetstate;
Jeff Cohen66c5fd62005-10-23 04:37:20 +00002808
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002809/*------------------------------------------------------------.
2810| yynewstate -- Push a new state, which is found in yystate. |
2811`------------------------------------------------------------*/
2812 yynewstate:
2813 /* In all cases, when you get here, the value and location stacks
Reid Spencer5cbf9852007-01-30 20:08:39 +00002814 have just been pushed. so pushing a state here evens the stacks.
2815 */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002816 yyssp++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002817
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002818 yysetstate:
2819 *yyssp = yystate;
2820
Reid Spencer41dff5e2007-01-26 08:05:27 +00002821 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002822 {
2823 /* Get the current used size of the three stacks, in elements. */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002824 YYSIZE_T yysize = yyssp - yyss + 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002825
2826#ifdef yyoverflow
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002827 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00002828 /* Give user a chance to reallocate the stack. Use copies of
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002829 these so that the &'s don't force the real ones into
2830 memory. */
2831 YYSTYPE *yyvs1 = yyvs;
Reid Spencer5cbf9852007-01-30 20:08:39 +00002832 short int *yyss1 = yyss;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002833
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002834
2835 /* Each stack pointer address is followed by the size of the
2836 data in use in that stack, in bytes. This used to be a
2837 conditional around just the two extra args, but that might
2838 be undefined if yyoverflow is a macro. */
Reid Spencer41dff5e2007-01-26 08:05:27 +00002839 yyoverflow (YY_("memory exhausted"),
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002840 &yyss1, yysize * sizeof (*yyssp),
2841 &yyvs1, yysize * sizeof (*yyvsp),
2842
2843 &yystacksize);
2844
2845 yyss = yyss1;
2846 yyvs = yyvs1;
2847 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00002848#else /* no yyoverflow */
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002849# ifndef YYSTACK_RELOCATE
Reid Spencer41dff5e2007-01-26 08:05:27 +00002850 goto yyexhaustedlab;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002851# else
Reid Spencer68a24bd2005-08-27 18:50:39 +00002852 /* Extend the stack our own way. */
Reid Spencer41dff5e2007-01-26 08:05:27 +00002853 if (YYMAXDEPTH <= yystacksize)
2854 goto yyexhaustedlab;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002855 yystacksize *= 2;
Reid Spencer41dff5e2007-01-26 08:05:27 +00002856 if (YYMAXDEPTH < yystacksize)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002857 yystacksize = YYMAXDEPTH;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002858
2859 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00002860 short int *yyss1 = yyss;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002861 union yyalloc *yyptr =
2862 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2863 if (! yyptr)
Reid Spencer41dff5e2007-01-26 08:05:27 +00002864 goto yyexhaustedlab;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002865 YYSTACK_RELOCATE (yyss);
2866 YYSTACK_RELOCATE (yyvs);
2867
2868# undef YYSTACK_RELOCATE
2869 if (yyss1 != yyssa)
2870 YYSTACK_FREE (yyss1);
2871 }
2872# endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00002873#endif /* no yyoverflow */
2874
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002875 yyssp = yyss + yysize - 1;
2876 yyvsp = yyvs + yysize - 1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002877
2878
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002879 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2880 (unsigned long int) yystacksize));
2881
Reid Spencer41dff5e2007-01-26 08:05:27 +00002882 if (yyss + yystacksize - 1 <= yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002883 YYABORT;
2884 }
2885
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002886 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
Reid Spencer68a24bd2005-08-27 18:50:39 +00002887
2888 goto yybackup;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002889
2890/*-----------.
2891| yybackup. |
2892`-----------*/
2893yybackup:
Reid Spencer68a24bd2005-08-27 18:50:39 +00002894
Reid Spencer5cbf9852007-01-30 20:08:39 +00002895/* Do appropriate processing given the current state. */
2896/* Read a look-ahead token if we need one and don't already have one. */
2897/* yyresume: */
Andrew Lenharth6353e052006-12-08 18:07:09 +00002898
Reid Spencer41dff5e2007-01-26 08:05:27 +00002899 /* First try to decide what to do without reference to look-ahead token. */
Reid Spencer5cbf9852007-01-30 20:08:39 +00002900
Reid Spencer68a24bd2005-08-27 18:50:39 +00002901 yyn = yypact[yystate];
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002902 if (yyn == YYPACT_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002903 goto yydefault;
2904
Reid Spencer41dff5e2007-01-26 08:05:27 +00002905 /* Not known => get a look-ahead token if don't already have one. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002906
Reid Spencer41dff5e2007-01-26 08:05:27 +00002907 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002908 if (yychar == YYEMPTY)
2909 {
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002910 YYDPRINTF ((stderr, "Reading a token: "));
Reid Spencer68a24bd2005-08-27 18:50:39 +00002911 yychar = YYLEX;
2912 }
2913
Reid Spencer41dff5e2007-01-26 08:05:27 +00002914 if (yychar <= YYEOF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002915 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00002916 yychar = yytoken = YYEOF;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002917 YYDPRINTF ((stderr, "Now at end of input.\n"));
Reid Spencer68a24bd2005-08-27 18:50:39 +00002918 }
2919 else
2920 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00002921 yytoken = YYTRANSLATE (yychar);
2922 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
Reid Spencer68a24bd2005-08-27 18:50:39 +00002923 }
2924
Reid Spencer41dff5e2007-01-26 08:05:27 +00002925 /* If the proper action on seeing token YYTOKEN is to reduce or to
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002926 detect an error, take that action. */
Reid Spencer41dff5e2007-01-26 08:05:27 +00002927 yyn += yytoken;
2928 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002929 goto yydefault;
2930 yyn = yytable[yyn];
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002931 if (yyn <= 0)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002932 {
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002933 if (yyn == 0 || yyn == YYTABLE_NINF)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002934 goto yyerrlab;
2935 yyn = -yyn;
2936 goto yyreduce;
2937 }
2938
2939 if (yyn == YYFINAL)
2940 YYACCEPT;
2941
Reid Spencer5cbf9852007-01-30 20:08:39 +00002942 /* Shift the look-ahead token. */
2943 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2944
2945 /* Discard the token being shifted unless it is eof. */
2946 if (yychar != YYEOF)
2947 yychar = YYEMPTY;
2948
2949 *++yyvsp = yylval;
2950
2951
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002952 /* Count tokens shifted since error; after three, turn off error
2953 status. */
2954 if (yyerrstatus)
2955 yyerrstatus--;
Chris Lattner0fab59c2007-01-12 18:33:30 +00002956
Reid Spencer68a24bd2005-08-27 18:50:39 +00002957 yystate = yyn;
2958 goto yynewstate;
2959
Chris Lattnerb25c4ca2007-01-15 02:12:07 +00002960
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002961/*-----------------------------------------------------------.
2962| yydefault -- do the default action for the current state. |
2963`-----------------------------------------------------------*/
2964yydefault:
Reid Spencer68a24bd2005-08-27 18:50:39 +00002965 yyn = yydefact[yystate];
2966 if (yyn == 0)
2967 goto yyerrlab;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002968 goto yyreduce;
Reid Spencer68a24bd2005-08-27 18:50:39 +00002969
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002970
2971/*-----------------------------.
2972| yyreduce -- Do a reduction. |
2973`-----------------------------*/
Reid Spencer68a24bd2005-08-27 18:50:39 +00002974yyreduce:
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002975 /* yyn is the number of a rule to reduce with. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00002976 yylen = yyr2[yyn];
2977
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002978 /* If YYLEN is nonzero, implement the default value of the action:
2979 `$$ = $1'.
2980
2981 Otherwise, the following line sets YYVAL to garbage.
2982 This behavior is undocumented and Bison
2983 users should not rely upon it. Assigning to YYVAL
2984 unconditionally makes the parser a bit smaller, and it avoids a
2985 GCC warning that YYVAL may be used uninitialized. */
2986 yyval = yyvsp[1-yylen];
2987
2988
Reid Spencer41dff5e2007-01-26 08:05:27 +00002989 YY_REDUCE_PRINT (yyn);
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00002990 switch (yyn)
Reid Spencer68a24bd2005-08-27 18:50:39 +00002991 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00002992 case 29:
Reid Spencer5cbf9852007-01-30 20:08:39 +00002993#line 1037 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00002994 { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
2995 break;
2996
2997 case 30:
Reid Spencer5cbf9852007-01-30 20:08:39 +00002998#line 1037 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00002999 { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003000 break;
3001
3002 case 31:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003003#line 1038 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003004 { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003005 break;
3006
3007 case 32:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003008#line 1038 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003009 { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003010 break;
3011
3012 case 33:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003013#line 1039 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003014 { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003015 break;
3016
3017 case 34:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003018#line 1039 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003019 { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003020 break;
3021
3022 case 35:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003023#line 1040 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003024 { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003025 break;
3026
3027 case 36:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003028#line 1040 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003029 { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003030 break;
3031
3032 case 37:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003033#line 1041 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003034 { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003035 break;
3036
3037 case 38:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003038#line 1041 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003039 { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003040 break;
3041
3042 case 39:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003043#line 1045 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003044 { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003045 break;
3046
3047 case 40:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003048#line 1045 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003049 { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003050 break;
3051
3052 case 41:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003053#line 1046 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003054 { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003055 break;
3056
3057 case 42:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003058#line 1046 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003059 { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003060 break;
3061
3062 case 43:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003063#line 1047 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003064 { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003065 break;
3066
3067 case 44:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003068#line 1047 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003069 { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003070 break;
3071
3072 case 45:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003073#line 1048 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003074 { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003075 break;
3076
3077 case 46:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003078#line 1048 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003079 { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003080 break;
3081
3082 case 47:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003083#line 1049 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003084 { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003085 break;
3086
3087 case 48:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003088#line 1049 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003089 { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003090 break;
3091
3092 case 49:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003093#line 1050 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003094 { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003095 break;
3096
3097 case 50:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003098#line 1050 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003099 { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003100 break;
3101
3102 case 51:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003103#line 1051 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003104 { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003105 break;
3106
3107 case 52:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003108#line 1051 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003109 { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003110 break;
3111
3112 case 53:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003113#line 1052 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003114 { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003115 break;
3116
3117 case 54:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003118#line 1053 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003119 { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003120 break;
3121
3122 case 61:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003123#line 1062 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003124 { (yyval.StrVal) = 0; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003125 break;
3126
3127 case 62:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003128#line 1066 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003129 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00003130 (yyval.StrVal) = (yyvsp[-1].StrVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003131 CHECK_FOR_ERROR
3132 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003133 break;
3134
3135 case 63:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003136#line 1070 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003137 {
3138 (yyval.StrVal) = 0;
3139 CHECK_FOR_ERROR
3140 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003141 break;
3142
3143 case 66:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003144#line 1077 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003145 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00003146 (yyval.StrVal) = (yyvsp[-1].StrVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003147 CHECK_FOR_ERROR
3148 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003149 break;
3150
3151 case 67:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003152#line 1081 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003153 {
3154 (yyval.StrVal) = 0;
3155 CHECK_FOR_ERROR
3156 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003157 break;
3158
3159 case 68:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003160#line 1087 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003161 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003162 break;
3163
3164 case 69:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003165#line 1088 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003166 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003167 break;
3168
3169 case 70:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003170#line 1089 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003171 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003172 break;
3173
3174 case 71:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003175#line 1090 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003176 { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003177 break;
3178
3179 case 72:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003180#line 1091 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003181 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003182 break;
3183
3184 case 73:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003185#line 1095 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003186 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003187 break;
3188
3189 case 74:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003190#line 1096 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003191 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003192 break;
3193
3194 case 75:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003195#line 1097 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003196 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003197 break;
3198
3199 case 76:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003200#line 1101 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003201 { (yyval.Visibility) = GlobalValue::DefaultVisibility; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003202 break;
3203
3204 case 77:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003205#line 1102 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003206 { (yyval.Visibility) = GlobalValue::HiddenVisibility; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003207 break;
3208
3209 case 78:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003210#line 1106 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003211 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003212 break;
3213
3214 case 79:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003215#line 1107 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003216 { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003217 break;
3218
3219 case 80:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003220#line 1108 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003221 { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003222 break;
3223
3224 case 81:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003225#line 1112 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003226 { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003227 break;
3228
3229 case 82:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003230#line 1113 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003231 { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003232 break;
3233
3234 case 83:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003235#line 1114 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003236 { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003237 break;
3238
3239 case 84:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003240#line 1115 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003241 { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003242 break;
3243
3244 case 85:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003245#line 1116 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003246 { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003247 break;
3248
3249 case 86:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003250#line 1119 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003251 { (yyval.UIntVal) = CallingConv::C; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003252 break;
3253
3254 case 87:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003255#line 1120 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003256 { (yyval.UIntVal) = CallingConv::C; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003257 break;
3258
3259 case 88:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003260#line 1121 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003261 { (yyval.UIntVal) = CallingConv::Fast; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003262 break;
3263
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003264 case 89:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003265#line 1122 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003266 { (yyval.UIntVal) = CallingConv::Cold; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003267 break;
3268
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003269 case 90:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003270#line 1123 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003271 { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003272 break;
3273
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003274 case 91:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003275#line 1124 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003276 { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
3277 break;
3278
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003279 case 92:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003280#line 1125 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003281 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00003282 if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val))
Reid Spencer41dff5e2007-01-26 08:05:27 +00003283 GEN_ERROR("Calling conv too large!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00003284 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003285 CHECK_FOR_ERROR
3286 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003287 break;
3288
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003289 case 93:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003290#line 1132 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003291 { (yyval.ParamAttrs) = FunctionType::ZExtAttribute; ;}
3292 break;
3293
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003294 case 94:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003295#line 1133 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003296 { (yyval.ParamAttrs) = FunctionType::SExtAttribute; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003297 break;
3298
3299 case 95:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003300#line 1134 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003301 { (yyval.ParamAttrs) = FunctionType::InRegAttribute; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003302 break;
3303
3304 case 96:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003305#line 1135 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003306 { (yyval.ParamAttrs) = FunctionType::StructRetAttribute; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003307 break;
3308
3309 case 97:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003310#line 1138 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003311 { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003312 break;
3313
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003314 case 98:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003315#line 1139 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003316 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00003317 (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs));
Reid Spencer41dff5e2007-01-26 08:05:27 +00003318 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003319 break;
3320
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003321 case 99:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003322#line 1144 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003323 { (yyval.ParamAttrs) = FunctionType::NoReturnAttribute; ;}
3324 break;
3325
3326 case 101:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003327#line 1148 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003328 { (yyval.ParamAttrs) = FunctionType::NoAttributeSet; ;}
3329 break;
3330
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003331 case 102:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003332#line 1149 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003333 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00003334 (yyval.ParamAttrs) = FunctionType::ParameterAttributes((yyvsp[-1].ParamAttrs) | (yyvsp[0].ParamAttrs));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003335 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003336 break;
3337
3338 case 103:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003339#line 1156 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003340 { (yyval.UIntVal) = 0; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003341 break;
3342
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003343 case 104:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003344#line 1157 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003345 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00003346 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003347 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3348 GEN_ERROR("Alignment must be a power of two!");
3349 CHECK_FOR_ERROR
3350;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003351 break;
3352
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003353 case 105:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003354#line 1163 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003355 { (yyval.UIntVal) = 0; ;}
3356 break;
3357
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003358 case 106:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003359#line 1164 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003360 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00003361 (yyval.UIntVal) = (yyvsp[0].UInt64Val);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003362 if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
3363 GEN_ERROR("Alignment must be a power of two!");
Reid Spencer41dff5e2007-01-26 08:05:27 +00003364 CHECK_FOR_ERROR
3365;}
3366 break;
3367
3368 case 107:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003369#line 1172 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003370 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00003371 for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i)
3372 if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\')
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003373 GEN_ERROR("Invalid character in section name!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00003374 (yyval.StrVal) = (yyvsp[0].StrVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003375 CHECK_FOR_ERROR
3376;}
Reid Spencer41dff5e2007-01-26 08:05:27 +00003377 break;
3378
3379 case 108:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003380#line 1180 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003381 { (yyval.StrVal) = 0; ;}
Reid Spencer41dff5e2007-01-26 08:05:27 +00003382 break;
3383
3384 case 109:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003385#line 1181 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
3386 { (yyval.StrVal) = (yyvsp[0].StrVal); ;}
Reid Spencer41dff5e2007-01-26 08:05:27 +00003387 break;
3388
3389 case 110:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003390#line 1186 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003391 {;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003392 break;
3393
3394 case 111:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003395#line 1187 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003396 {;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003397 break;
3398
3399 case 112:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003400#line 1188 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003401 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00003402 CurGV->setSection((yyvsp[0].StrVal));
3403 free((yyvsp[0].StrVal));
Reid Spencer6f407902007-01-13 05:00:46 +00003404 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00003405 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003406 break;
3407
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003408 case 113:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003409#line 1193 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003410 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00003411 if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val)))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003412 GEN_ERROR("Alignment must be a power of two!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00003413 CurGV->setAlignment((yyvsp[0].UInt64Val));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003414 CHECK_FOR_ERROR
3415 ;}
3416 break;
3417
3418 case 118:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003419#line 1209 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003420 {
3421 (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
3422 CHECK_FOR_ERROR
3423 ;}
3424 break;
3425
Reid Spencer41dff5e2007-01-26 08:05:27 +00003426 case 119:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003427#line 1213 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003428 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00003429 (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType));
Reid Spencer41dff5e2007-01-26 08:05:27 +00003430 CHECK_FOR_ERROR
3431 ;}
3432 break;
3433
3434 case 120:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003435#line 1217 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003436 { // Pointer type?
Reid Spencer5cbf9852007-01-30 20:08:39 +00003437 if (*(yyvsp[-1].TypeVal) == Type::LabelTy)
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003438 GEN_ERROR("Cannot form a pointer to a basic block");
Reid Spencer5cbf9852007-01-30 20:08:39 +00003439 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal))));
3440 delete (yyvsp[-1].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003441 CHECK_FOR_ERROR
3442 ;}
3443 break;
3444
3445 case 121:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003446#line 1224 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003447 { // Named types are also simple types...
Reid Spencer5cbf9852007-01-30 20:08:39 +00003448 const Type* tmp = getTypeVal((yyvsp[0].ValIDVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00003449 CHECK_FOR_ERROR
3450 (yyval.TypeVal) = new PATypeHolder(tmp);
3451 ;}
3452 break;
3453
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003454 case 122:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003455#line 1229 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003456 { // Type UpReference
Reid Spencer5cbf9852007-01-30 20:08:39 +00003457 if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!");
Reid Spencer41dff5e2007-01-26 08:05:27 +00003458 OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
Reid Spencer5cbf9852007-01-30 20:08:39 +00003459 UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector...
Reid Spencer41dff5e2007-01-26 08:05:27 +00003460 (yyval.TypeVal) = new PATypeHolder(OT);
3461 UR_OUT("New Upreference!\n");
3462 CHECK_FOR_ERROR
3463 ;}
3464 break;
3465
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003466 case 123:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003467#line 1237 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003468 {
3469 std::vector<const Type*> Params;
3470 std::vector<FunctionType::ParameterAttributes> Attrs;
Reid Spencer5cbf9852007-01-30 20:08:39 +00003471 Attrs.push_back((yyvsp[0].ParamAttrs));
3472 for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00003473 Params.push_back(I->Ty->get());
3474 if (I->Ty->get() != Type::VoidTy)
3475 Attrs.push_back(I->Attrs);
3476 }
3477 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3478 if (isVarArg) Params.pop_back();
3479
Reid Spencer5cbf9852007-01-30 20:08:39 +00003480 FunctionType *FT = FunctionType::get(*(yyvsp[-4].TypeVal), Params, isVarArg, Attrs);
3481 delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list
3482 delete (yyvsp[-4].TypeVal); // Delete the return type handle
Reid Spencer41dff5e2007-01-26 08:05:27 +00003483 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Reid Spencere4d87aa2006-12-23 06:05:41 +00003484 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00003485 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003486 break;
3487
3488 case 124:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003489#line 1255 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003490 {
3491 std::vector<const Type*> Params;
3492 std::vector<FunctionType::ParameterAttributes> Attrs;
Reid Spencer5cbf9852007-01-30 20:08:39 +00003493 Attrs.push_back((yyvsp[0].ParamAttrs));
3494 for (TypeWithAttrsList::iterator I=(yyvsp[-2].TypeWithAttrsList)->begin(), E=(yyvsp[-2].TypeWithAttrsList)->end(); I != E; ++I) {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003495 Params.push_back(I->Ty->get());
3496 if (I->Ty->get() != Type::VoidTy)
3497 Attrs.push_back(I->Attrs);
3498 }
3499 bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
3500 if (isVarArg) Params.pop_back();
3501
Reid Spencer5cbf9852007-01-30 20:08:39 +00003502 FunctionType *FT = FunctionType::get((yyvsp[-4].PrimType), Params, isVarArg, Attrs);
3503 delete (yyvsp[-2].TypeWithAttrsList); // Delete the argument list
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003504 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT));
Reid Spencer41dff5e2007-01-26 08:05:27 +00003505 CHECK_FOR_ERROR
3506 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003507 break;
3508
3509 case 125:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003510#line 1273 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003511 { // Sized array type?
Reid Spencer5cbf9852007-01-30 20:08:39 +00003512 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3513 delete (yyvsp[-1].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003514 CHECK_FOR_ERROR
3515 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003516 break;
3517
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003518 case 126:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003519#line 1278 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003520 { // Packed array type?
Reid Spencer5cbf9852007-01-30 20:08:39 +00003521 const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get();
3522 if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003523 GEN_ERROR("Unsigned result not equal to signed result");
3524 if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
3525 GEN_ERROR("Element type of a PackedType must be primitive");
Reid Spencer5cbf9852007-01-30 20:08:39 +00003526 if (!isPowerOf2_32((yyvsp[-3].UInt64Val)))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003527 GEN_ERROR("Vector length should be a power of 2!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00003528 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
3529 delete (yyvsp[-1].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003530 CHECK_FOR_ERROR
3531 ;}
3532 break;
3533
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003534 case 127:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003535#line 1290 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003536 { // Structure type?
3537 std::vector<const Type*> Elements;
Reid Spencer5cbf9852007-01-30 20:08:39 +00003538 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-1].TypeList)->begin(),
3539 E = (yyvsp[-1].TypeList)->end(); I != E; ++I)
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003540 Elements.push_back(*I);
3541
3542 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
Reid Spencer5cbf9852007-01-30 20:08:39 +00003543 delete (yyvsp[-1].TypeList);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003544 CHECK_FOR_ERROR
3545 ;}
3546 break;
3547
3548 case 128:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003549#line 1300 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003550 { // Empty structure type?
3551 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
Reid Spencer14310612006-12-31 05:40:51 +00003552 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00003553 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003554 break;
3555
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003556 case 129:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003557#line 1304 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003558 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00003559 std::vector<const Type*> Elements;
Reid Spencer5cbf9852007-01-30 20:08:39 +00003560 for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-2].TypeList)->begin(),
3561 E = (yyvsp[-2].TypeList)->end(); I != E; ++I)
Reid Spencer41dff5e2007-01-26 08:05:27 +00003562 Elements.push_back(*I);
3563
3564 (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
Reid Spencer5cbf9852007-01-30 20:08:39 +00003565 delete (yyvsp[-2].TypeList);
Reid Spencer14310612006-12-31 05:40:51 +00003566 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00003567 ;}
3568 break;
3569
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003570 case 130:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003571#line 1314 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003572 { // Empty structure type?
3573 (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
3574 CHECK_FOR_ERROR
3575 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003576 break;
3577
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003578 case 131:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003579#line 1321 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003580 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00003581 (yyval.TypeWithAttrs).Ty = (yyvsp[-1].TypeVal);
3582 (yyval.TypeWithAttrs).Attrs = (yyvsp[0].ParamAttrs);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003583 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003584 break;
3585
3586 case 132:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003587#line 1328 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003588 {
3589 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00003590 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
3591 if (!(*(yyvsp[0].TypeVal))->isFirstClassType())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003592 GEN_ERROR("LLVM functions cannot return aggregate types!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00003593 (yyval.TypeVal) = (yyvsp[0].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003594 ;}
3595 break;
3596
3597 case 133:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003598#line 1335 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003599 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00003600 (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
3601 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003602 break;
3603
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003604 case 134:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003605#line 1340 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003606 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00003607 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
Reid Spencer5cbf9852007-01-30 20:08:39 +00003608 (yyval.TypeWithAttrsList)->push_back((yyvsp[0].TypeWithAttrs));
Reid Spencer6f407902007-01-13 05:00:46 +00003609 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00003610 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003611 break;
3612
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003613 case 135:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003614#line 1345 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003615 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00003616 ((yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList))->push_back((yyvsp[0].TypeWithAttrs));
Reid Spencer3da59db2006-11-27 01:05:10 +00003617 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00003618 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003619 break;
3620
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003621 case 137:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003622#line 1353 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003623 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00003624 (yyval.TypeWithAttrsList)=(yyvsp[-2].TypeWithAttrsList);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003625 TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet;
3626 TWA.Ty = new PATypeHolder(Type::VoidTy);
3627 (yyval.TypeWithAttrsList)->push_back(TWA);
3628 CHECK_FOR_ERROR
3629 ;}
3630 break;
3631
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003632 case 138:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003633#line 1360 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003634 {
3635 (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
3636 TypeWithAttrs TWA; TWA.Attrs = FunctionType::NoAttributeSet;
3637 TWA.Ty = new PATypeHolder(Type::VoidTy);
3638 (yyval.TypeWithAttrsList)->push_back(TWA);
3639 CHECK_FOR_ERROR
3640 ;}
3641 break;
3642
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003643 case 139:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003644#line 1367 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003645 {
3646 (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
3647 CHECK_FOR_ERROR
3648 ;}
3649 break;
3650
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003651 case 140:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003652#line 1375 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003653 {
3654 (yyval.TypeList) = new std::list<PATypeHolder>();
Reid Spencer5cbf9852007-01-30 20:08:39 +00003655 (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003656 CHECK_FOR_ERROR
3657 ;}
3658 break;
3659
3660 case 141:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003661#line 1380 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003662 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00003663 ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
Reid Spencer3da59db2006-11-27 01:05:10 +00003664 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00003665 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003666 break;
3667
Reid Spencer41dff5e2007-01-26 08:05:27 +00003668 case 142:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003669#line 1391 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003670 { // Nonempty unsized arr
Reid Spencer14310612006-12-31 05:40:51 +00003671 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00003672 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3673 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-3].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00003674 if (ATy == 0)
Reid Spencer61c83e02006-08-18 08:43:06 +00003675 GEN_ERROR("Cannot make array constant with type: '" +
Reid Spencer5cbf9852007-01-30 20:08:39 +00003676 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003677 const Type *ETy = ATy->getElementType();
3678 int NumElements = ATy->getNumElements();
3679
3680 // Verify that we have the correct size...
Reid Spencer5cbf9852007-01-30 20:08:39 +00003681 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003682 GEN_ERROR("Type mismatch: constant sized array initialized with " +
Reid Spencer5cbf9852007-01-30 20:08:39 +00003683 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003684 itostr(NumElements) + "!");
3685
3686 // Verify all elements are correct type!
Reid Spencer5cbf9852007-01-30 20:08:39 +00003687 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3688 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003689 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3690 ETy->getDescription() +"' as required!\nIt is of type '"+
Reid Spencer5cbf9852007-01-30 20:08:39 +00003691 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003692 }
3693
Reid Spencer5cbf9852007-01-30 20:08:39 +00003694 (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector));
3695 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003696 CHECK_FOR_ERROR
3697 ;}
3698 break;
3699
3700 case 143:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003701#line 1419 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003702 {
3703 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00003704 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3705 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003706 if (ATy == 0)
3707 GEN_ERROR("Cannot make array constant with type: '" +
Reid Spencer5cbf9852007-01-30 20:08:39 +00003708 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00003709
Andrew Lenharth6353e052006-12-08 18:07:09 +00003710 int NumElements = ATy->getNumElements();
3711 if (NumElements != -1 && NumElements != 0)
3712 GEN_ERROR("Type mismatch: constant sized array initialized with 0"
3713 " arguments, but has size of " + itostr(NumElements) +"!");
Reid Spencer41dff5e2007-01-26 08:05:27 +00003714 (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
Reid Spencer5cbf9852007-01-30 20:08:39 +00003715 delete (yyvsp[-2].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00003716 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00003717 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003718 break;
3719
Reid Spencer41dff5e2007-01-26 08:05:27 +00003720 case 144:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003721#line 1435 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003722 {
Reid Spencer14310612006-12-31 05:40:51 +00003723 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00003724 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3725 const ArrayType *ATy = dyn_cast<ArrayType>((yyvsp[-2].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003726 if (ATy == 0)
3727 GEN_ERROR("Cannot make array constant with type: '" +
Reid Spencer5cbf9852007-01-30 20:08:39 +00003728 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
Reid Spencer61c83e02006-08-18 08:43:06 +00003729
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003730 int NumElements = ATy->getNumElements();
3731 const Type *ETy = ATy->getElementType();
Reid Spencer5cbf9852007-01-30 20:08:39 +00003732 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
3733 if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal)))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003734 GEN_ERROR("Can't build string constant of size " +
Reid Spencer5cbf9852007-01-30 20:08:39 +00003735 itostr((int)(EndStr-(yyvsp[0].StrVal))) +
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003736 " when array has size " + itostr(NumElements) + "!");
3737 std::vector<Constant*> Vals;
3738 if (ETy == Type::Int8Ty) {
Reid Spencer5cbf9852007-01-30 20:08:39 +00003739 for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003740 C != (unsigned char*)EndStr; ++C)
3741 Vals.push_back(ConstantInt::get(ETy, *C));
3742 } else {
Reid Spencer5cbf9852007-01-30 20:08:39 +00003743 free((yyvsp[0].StrVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003744 GEN_ERROR("Cannot build string arrays of non byte sized elements!");
Andrew Lenharth6353e052006-12-08 18:07:09 +00003745 }
Reid Spencer5cbf9852007-01-30 20:08:39 +00003746 free((yyvsp[0].StrVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003747 (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
Reid Spencer5cbf9852007-01-30 20:08:39 +00003748 delete (yyvsp[-2].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00003749 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00003750 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003751 break;
3752
3753 case 145:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003754#line 1464 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003755 { // Nonempty unsized arr
3756 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00003757 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
3758 const PackedType *PTy = dyn_cast<PackedType>((yyvsp[-3].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003759 if (PTy == 0)
3760 GEN_ERROR("Cannot make packed constant with type: '" +
Reid Spencer5cbf9852007-01-30 20:08:39 +00003761 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003762 const Type *ETy = PTy->getElementType();
3763 int NumElements = PTy->getNumElements();
Reid Spencer41dff5e2007-01-26 08:05:27 +00003764
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003765 // Verify that we have the correct size...
Reid Spencer5cbf9852007-01-30 20:08:39 +00003766 if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003767 GEN_ERROR("Type mismatch: constant sized packed initialized with " +
Reid Spencer5cbf9852007-01-30 20:08:39 +00003768 utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " +
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003769 itostr(NumElements) + "!");
Reid Spencer41dff5e2007-01-26 08:05:27 +00003770
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003771 // Verify all elements are correct type!
Reid Spencer5cbf9852007-01-30 20:08:39 +00003772 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
3773 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003774 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
3775 ETy->getDescription() +"' as required!\nIt is of type '"+
Reid Spencer5cbf9852007-01-30 20:08:39 +00003776 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003777 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00003778
Reid Spencer5cbf9852007-01-30 20:08:39 +00003779 (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[-1].ConstVector));
3780 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003781 CHECK_FOR_ERROR
3782 ;}
3783 break;
3784
3785 case 146:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003786#line 1492 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003787 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00003788 const StructType *STy = dyn_cast<StructType>((yyvsp[-3].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00003789 if (STy == 0)
3790 GEN_ERROR("Cannot make struct constant with type: '" +
Reid Spencer5cbf9852007-01-30 20:08:39 +00003791 (*(yyvsp[-3].TypeVal))->getDescription() + "'!");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003792
Reid Spencer5cbf9852007-01-30 20:08:39 +00003793 if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003794 GEN_ERROR("Illegal number of initializers for structure type!");
3795
3796 // Check to ensure that constants are compatible with the type initializer!
Reid Spencer5cbf9852007-01-30 20:08:39 +00003797 for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i)
3798 if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003799 GEN_ERROR("Expected type '" +
3800 STy->getElementType(i)->getDescription() +
3801 "' for element #" + utostr(i) +
3802 " of structure initializer!");
3803
3804 // Check to ensure that Type is not packed
3805 if (STy->isPacked())
3806 GEN_ERROR("Unpacked Initializer to packed type '" + STy->getDescription() + "'");
3807
Reid Spencer5cbf9852007-01-30 20:08:39 +00003808 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector));
3809 delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003810 CHECK_FOR_ERROR
3811 ;}
3812 break;
3813
3814 case 147:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003815#line 1517 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003816 {
3817 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00003818 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
3819 const StructType *STy = dyn_cast<StructType>((yyvsp[-2].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003820 if (STy == 0)
3821 GEN_ERROR("Cannot make struct constant with type: '" +
Reid Spencer5cbf9852007-01-30 20:08:39 +00003822 (*(yyvsp[-2].TypeVal))->getDescription() + "'!");
Reid Spencer41dff5e2007-01-26 08:05:27 +00003823
3824 if (STy->getNumContainedTypes() != 0)
3825 GEN_ERROR("Illegal number of initializers for structure type!");
3826
3827 // Check to ensure that Type is not packed
3828 if (STy->isPacked())
3829 GEN_ERROR("Unpacked Initializer to packed type '" + STy->getDescription() + "'");
3830
3831 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
Reid Spencer5cbf9852007-01-30 20:08:39 +00003832 delete (yyvsp[-2].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003833 CHECK_FOR_ERROR
3834 ;}
3835 break;
3836
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003837 case 148:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003838#line 1536 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003839 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00003840 const StructType *STy = dyn_cast<StructType>((yyvsp[-5].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00003841 if (STy == 0)
3842 GEN_ERROR("Cannot make struct constant with type: '" +
Reid Spencer5cbf9852007-01-30 20:08:39 +00003843 (*(yyvsp[-5].TypeVal))->getDescription() + "'!");
Reid Spencer41dff5e2007-01-26 08:05:27 +00003844
Reid Spencer5cbf9852007-01-30 20:08:39 +00003845 if ((yyvsp[-2].ConstVector)->size() != STy->getNumContainedTypes())
Reid Spencer41dff5e2007-01-26 08:05:27 +00003846 GEN_ERROR("Illegal number of initializers for structure type!");
3847
3848 // Check to ensure that constants are compatible with the type initializer!
Reid Spencer5cbf9852007-01-30 20:08:39 +00003849 for (unsigned i = 0, e = (yyvsp[-2].ConstVector)->size(); i != e; ++i)
3850 if ((*(yyvsp[-2].ConstVector))[i]->getType() != STy->getElementType(i))
Reid Spencer41dff5e2007-01-26 08:05:27 +00003851 GEN_ERROR("Expected type '" +
3852 STy->getElementType(i)->getDescription() +
3853 "' for element #" + utostr(i) +
3854 " of structure initializer!");
3855
3856 // Check to ensure that Type is packed
3857 if (!STy->isPacked())
3858 GEN_ERROR("Packed Initializer to unpacked type '" + STy->getDescription() + "'");
3859
Reid Spencer5cbf9852007-01-30 20:08:39 +00003860 (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-2].ConstVector));
3861 delete (yyvsp[-5].TypeVal); delete (yyvsp[-2].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003862 CHECK_FOR_ERROR
3863 ;}
3864 break;
3865
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003866 case 149:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003867#line 1561 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003868 {
3869 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00003870 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
3871 const StructType *STy = dyn_cast<StructType>((yyvsp[-4].TypeVal)->get());
Reid Spencer41dff5e2007-01-26 08:05:27 +00003872 if (STy == 0)
3873 GEN_ERROR("Cannot make struct constant with type: '" +
Reid Spencer5cbf9852007-01-30 20:08:39 +00003874 (*(yyvsp[-4].TypeVal))->getDescription() + "'!");
Reid Spencer41dff5e2007-01-26 08:05:27 +00003875
3876 if (STy->getNumContainedTypes() != 0)
3877 GEN_ERROR("Illegal number of initializers for structure type!");
3878
3879 // Check to ensure that Type is packed
3880 if (!STy->isPacked())
3881 GEN_ERROR("Packed Initializer to unpacked type '" + STy->getDescription() + "'");
3882
3883 (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
Reid Spencer5cbf9852007-01-30 20:08:39 +00003884 delete (yyvsp[-4].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003885 CHECK_FOR_ERROR
3886 ;}
3887 break;
3888
3889 case 150:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003890#line 1580 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003891 {
3892 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00003893 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3894 const PointerType *PTy = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003895 if (PTy == 0)
3896 GEN_ERROR("Cannot make null pointer constant with type: '" +
Reid Spencer5cbf9852007-01-30 20:08:39 +00003897 (*(yyvsp[-1].TypeVal))->getDescription() + "'!");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003898
3899 (yyval.ConstVal) = ConstantPointerNull::get(PTy);
Reid Spencer5cbf9852007-01-30 20:08:39 +00003900 delete (yyvsp[-1].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003901 CHECK_FOR_ERROR
3902 ;}
3903 break;
3904
3905 case 151:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003906#line 1592 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00003907 {
3908 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00003909 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3910 (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get());
3911 delete (yyvsp[-1].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003912 CHECK_FOR_ERROR
3913 ;}
3914 break;
3915
3916 case 152:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003917#line 1599 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003918 {
3919 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00003920 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3921 const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
Reid Spencer68a24bd2005-08-27 18:50:39 +00003922 if (Ty == 0)
Reid Spencer61c83e02006-08-18 08:43:06 +00003923 GEN_ERROR("Global const reference must be a pointer type!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00003924
3925 // ConstExprs can exist in the body of a function, thus creating
3926 // GlobalValues whenever they refer to a variable. Because we are in
3927 // the context of a function, getValNonImprovising will search the functions
3928 // symbol table instead of the module symbol table for the global symbol,
3929 // which throws things all off. To get around this, we just tell
3930 // getValNonImprovising that we are at global scope here.
3931 //
3932 Function *SavedCurFn = CurFun.CurrentFunction;
3933 CurFun.CurrentFunction = 0;
3934
Reid Spencer5cbf9852007-01-30 20:08:39 +00003935 Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00003936 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00003937
3938 CurFun.CurrentFunction = SavedCurFn;
3939
3940 // If this is an initializer for a constant pointer, which is referencing a
3941 // (currently) undefined variable, create a stub now that shall be replaced
3942 // in the future with the right type of variable.
3943 //
3944 if (V == 0) {
3945 assert(isa<PointerType>(Ty) && "Globals may only be used as pointers!");
3946 const PointerType *PT = cast<PointerType>(Ty);
3947
3948 // First check to see if the forward references value is already created!
3949 PerModuleInfo::GlobalRefsType::iterator I =
Reid Spencer5cbf9852007-01-30 20:08:39 +00003950 CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal)));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003951
3952 if (I != CurModule.GlobalRefs.end()) {
3953 V = I->second; // Placeholder already exists, use it...
Reid Spencer5cbf9852007-01-30 20:08:39 +00003954 (yyvsp[0].ValIDVal).destroy();
Reid Spencer68a24bd2005-08-27 18:50:39 +00003955 } else {
3956 std::string Name;
Reid Spencer5cbf9852007-01-30 20:08:39 +00003957 if ((yyvsp[0].ValIDVal).Type == ValID::GlobalName)
3958 Name = (yyvsp[0].ValIDVal).Name;
3959 else if ((yyvsp[0].ValIDVal).Type != ValID::GlobalID)
Reid Spencer41dff5e2007-01-26 08:05:27 +00003960 GEN_ERROR("Invalid reference to global");
Reid Spencer68a24bd2005-08-27 18:50:39 +00003961
3962 // Create the forward referenced global.
3963 GlobalValue *GV;
3964 if (const FunctionType *FTy =
3965 dyn_cast<FunctionType>(PT->getElementType())) {
3966 GV = new Function(FTy, GlobalValue::ExternalLinkage, Name,
3967 CurModule.CurrentModule);
3968 } else {
3969 GV = new GlobalVariable(PT->getElementType(), false,
3970 GlobalValue::ExternalLinkage, 0,
3971 Name, CurModule.CurrentModule);
3972 }
3973
3974 // Keep track of the fact that we have a forward ref to recycle it
Reid Spencer5cbf9852007-01-30 20:08:39 +00003975 CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV));
Reid Spencer68a24bd2005-08-27 18:50:39 +00003976 V = GV;
3977 }
3978 }
3979
Reid Spencer41dff5e2007-01-26 08:05:27 +00003980 (yyval.ConstVal) = cast<GlobalValue>(V);
Reid Spencer5cbf9852007-01-30 20:08:39 +00003981 delete (yyvsp[-1].TypeVal); // Free the type handle
Reid Spencer61c83e02006-08-18 08:43:06 +00003982 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00003983 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003984 break;
3985
3986 case 153:
Reid Spencer5cbf9852007-01-30 20:08:39 +00003987#line 1665 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003988 {
Reid Spencer14310612006-12-31 05:40:51 +00003989 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00003990 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
3991 if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00003992 GEN_ERROR("Mismatched types for constant expression: " +
Reid Spencer5cbf9852007-01-30 20:08:39 +00003993 (*(yyvsp[-1].TypeVal))->getDescription() + " and " + (yyvsp[0].ConstVal)->getType()->getDescription());
3994 (yyval.ConstVal) = (yyvsp[0].ConstVal);
3995 delete (yyvsp[-1].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00003996 CHECK_FOR_ERROR
3997 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00003998 break;
3999
4000 case 154:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004001#line 1675 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004002 {
4003 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00004004 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4005 const Type *Ty = (yyvsp[-1].TypeVal)->get();
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004006 if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
4007 GEN_ERROR("Cannot create a null initialized value of this type!");
4008 (yyval.ConstVal) = Constant::getNullValue(Ty);
Reid Spencer5cbf9852007-01-30 20:08:39 +00004009 delete (yyvsp[-1].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004010 CHECK_FOR_ERROR
4011 ;}
4012 break;
4013
4014 case 155:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004015#line 1685 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004016 { // integral constants
Reid Spencer5cbf9852007-01-30 20:08:39 +00004017 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)))
Reid Spencer41dff5e2007-01-26 08:05:27 +00004018 GEN_ERROR("Constant value doesn't fit in type!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00004019 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004020 CHECK_FOR_ERROR
4021 ;}
4022 break;
4023
4024 case 156:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004025#line 1691 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004026 { // integral constants
Reid Spencer5cbf9852007-01-30 20:08:39 +00004027 if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004028 GEN_ERROR("Constant value doesn't fit in type!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00004029 (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004030 CHECK_FOR_ERROR
4031 ;}
4032 break;
4033
4034 case 157:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004035#line 1697 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004036 { // Boolean constants
Reid Spencer5cbf9852007-01-30 20:08:39 +00004037 assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004038 (yyval.ConstVal) = ConstantInt::getTrue();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004039 CHECK_FOR_ERROR
4040 ;}
4041 break;
4042
4043 case 158:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004044#line 1702 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004045 { // Boolean constants
Reid Spencer5cbf9852007-01-30 20:08:39 +00004046 assert(cast<IntegerType>((yyvsp[-1].PrimType))->getBitWidth() == 1 && "Not Bool?");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004047 (yyval.ConstVal) = ConstantInt::getFalse();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004048 CHECK_FOR_ERROR
4049 ;}
4050 break;
4051
4052 case 159:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004053#line 1707 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004054 { // Float & Double constants
Reid Spencer5cbf9852007-01-30 20:08:39 +00004055 if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal)))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004056 GEN_ERROR("Floating point constant invalid for type!!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00004057 (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal));
Reid Spencer6f407902007-01-13 05:00:46 +00004058 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004059 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004060 break;
4061
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004062 case 160:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004063#line 1715 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004064 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004065 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00004066 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4067 Constant *Val = (yyvsp[-3].ConstVal);
4068 const Type *DestTy = (yyvsp[-1].TypeVal)->get();
4069 if (!CastInst::castIsValid((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004070 GEN_ERROR("invalid cast opcode for cast from '" +
4071 Val->getType()->getDescription() + "' to '" +
4072 DestTy->getDescription() + "'!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00004073 (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), DestTy);
4074 delete (yyvsp[-1].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004075 ;}
4076 break;
4077
4078 case 161:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004079#line 1727 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004080 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004081 if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType()))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004082 GEN_ERROR("GetElementPtr requires a pointer operand!");
4083
4084 const Type *IdxTy =
Reid Spencer5cbf9852007-01-30 20:08:39 +00004085 GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), *(yyvsp[-1].ValueList), true);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004086 if (!IdxTy)
4087 GEN_ERROR("Index list invalid for constant getelementptr!");
4088
4089 std::vector<Constant*> IdxVec;
Reid Spencer5cbf9852007-01-30 20:08:39 +00004090 for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i)
4091 if (Constant *C = dyn_cast<Constant>((*(yyvsp[-1].ValueList))[i]))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004092 IdxVec.push_back(C);
4093 else
4094 GEN_ERROR("Indices to constant getelementptr must be constants!");
4095
Reid Spencer5cbf9852007-01-30 20:08:39 +00004096 delete (yyvsp[-1].ValueList);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004097
Reid Spencer5cbf9852007-01-30 20:08:39 +00004098 (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), IdxVec);
Andrew Lenharth6353e052006-12-08 18:07:09 +00004099 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004100 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004101 break;
4102
4103 case 162:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004104#line 1748 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004105 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004106 if ((yyvsp[-5].ConstVal)->getType() != Type::Int1Ty)
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004107 GEN_ERROR("Select condition must be of boolean type!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00004108 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004109 GEN_ERROR("Select operand types must match!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00004110 (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004111 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004112 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004113 break;
4114
4115 case 163:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004116#line 1756 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004117 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004118 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004119 GEN_ERROR("Binary operator types must match!");
4120 CHECK_FOR_ERROR;
Reid Spencer5cbf9852007-01-30 20:08:39 +00004121 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004122 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004123 break;
4124
4125 case 164:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004126#line 1762 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004127 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004128 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004129 GEN_ERROR("Logical operator types must match!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00004130 if (!(yyvsp[-3].ConstVal)->getType()->isInteger()) {
4131 if (!isa<PackedType>((yyvsp[-3].ConstVal)->getType()) ||
4132 !cast<PackedType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isInteger())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004133 GEN_ERROR("Logical operator requires integral operands!");
4134 }
Reid Spencer5cbf9852007-01-30 20:08:39 +00004135 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004136 CHECK_FOR_ERROR
4137 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004138 break;
4139
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004140 case 165:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004141#line 1773 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004142 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004143 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004144 GEN_ERROR("icmp operand types must match!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00004145 (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004146 ;}
4147 break;
4148
4149 case 166:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004150#line 1778 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004151 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004152 if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004153 GEN_ERROR("fcmp operand types must match!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00004154 (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004155 ;}
4156 break;
4157
4158 case 167:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004159#line 1783 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004160 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004161 if ((yyvsp[-1].ConstVal)->getType() != Type::Int8Ty)
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004162 GEN_ERROR("Shift count for shift constant must be i8 type!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00004163 if (!(yyvsp[-3].ConstVal)->getType()->isInteger())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004164 GEN_ERROR("Shift constant expression requires integer operand!");
4165 CHECK_FOR_ERROR;
Reid Spencer5cbf9852007-01-30 20:08:39 +00004166 (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004167 CHECK_FOR_ERROR
4168 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004169 break;
4170
4171 case 168:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004172#line 1792 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004173 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004174 if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004175 GEN_ERROR("Invalid extractelement operands!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00004176 (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004177 CHECK_FOR_ERROR
4178 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004179 break;
4180
4181 case 169:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004182#line 1798 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004183 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004184 if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004185 GEN_ERROR("Invalid insertelement operands!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00004186 (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004187 CHECK_FOR_ERROR
4188 ;}
4189 break;
4190
4191 case 170:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004192#line 1804 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004193 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004194 if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004195 GEN_ERROR("Invalid shufflevector operands!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00004196 (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004197 CHECK_FOR_ERROR
4198 ;}
4199 break;
4200
4201 case 171:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004202#line 1813 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004203 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004204 ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004205 CHECK_FOR_ERROR
4206 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004207 break;
4208
4209 case 172:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004210#line 1817 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004211 {
4212 (yyval.ConstVector) = new std::vector<Constant*>();
Reid Spencer5cbf9852007-01-30 20:08:39 +00004213 (yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004214 CHECK_FOR_ERROR
4215 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004216 break;
4217
4218 case 173:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004219#line 1825 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004220 { (yyval.BoolVal) = false; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004221 break;
4222
4223 case 174:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004224#line 1825 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004225 { (yyval.BoolVal) = true; ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004226 break;
4227
4228 case 175:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004229#line 1836 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004230 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004231 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4232 CurModule.ModuleDone();
4233 CHECK_FOR_ERROR;
4234 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004235 break;
4236
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004237 case 176:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004238#line 1841 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004239 {
4240 (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
4241 CurModule.ModuleDone();
4242 CHECK_FOR_ERROR;
4243 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004244 break;
4245
Reid Spencer41dff5e2007-01-26 08:05:27 +00004246 case 179:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004247#line 1854 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004248 { CurFun.isDeclare = false; ;}
4249 break;
4250
4251 case 180:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004252#line 1854 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004253 {
4254 CurFun.FunctionDone();
4255 CHECK_FOR_ERROR
4256 ;}
4257 break;
4258
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004259 case 181:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004260#line 1858 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004261 { CurFun.isDeclare = true; ;}
4262 break;
4263
Reid Spencer41dff5e2007-01-26 08:05:27 +00004264 case 182:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004265#line 1858 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004266 {
4267 CHECK_FOR_ERROR
4268 ;}
4269 break;
4270
4271 case 183:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004272#line 1861 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004273 {
4274 CHECK_FOR_ERROR
4275 ;}
4276 break;
4277
4278 case 184:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004279#line 1864 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004280 {
Reid Spencer68a24bd2005-08-27 18:50:39 +00004281 // Emit an error if there are any unresolved types left.
4282 if (!CurModule.LateResolveTypes.empty()) {
4283 const ValID &DID = CurModule.LateResolveTypes.begin()->first;
Reid Spencer41dff5e2007-01-26 08:05:27 +00004284 if (DID.Type == ValID::LocalName) {
Reid Spencer61c83e02006-08-18 08:43:06 +00004285 GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'");
4286 } else {
4287 GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num));
4288 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00004289 }
Reid Spencer61c83e02006-08-18 08:43:06 +00004290 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004291 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004292 break;
4293
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004294 case 185:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004295#line 1876 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004296 {
Reid Spencer14310612006-12-31 05:40:51 +00004297 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00004298 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004299 // Eagerly resolve types. This is not an optimization, this is a
4300 // requirement that is due to the fact that we could have this:
4301 //
4302 // %list = type { %list * }
4303 // %list = type { %list * } ; repeated type decl
4304 //
4305 // If types are not resolved eagerly, then the two types will not be
4306 // determined to be the same type!
4307 //
Reid Spencer5cbf9852007-01-30 20:08:39 +00004308 ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004309
Reid Spencer5cbf9852007-01-30 20:08:39 +00004310 if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
Reid Spencer5b7e7532006-09-28 19:28:24 +00004311 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00004312 // If this is a named type that is not a redefinition, add it to the slot
4313 // table.
Reid Spencer5cbf9852007-01-30 20:08:39 +00004314 CurModule.Types.push_back(*(yyvsp[0].TypeVal));
Reid Spencer68a24bd2005-08-27 18:50:39 +00004315 }
Reid Spencera132e042006-12-03 05:46:11 +00004316
Reid Spencer5cbf9852007-01-30 20:08:39 +00004317 delete (yyvsp[0].TypeVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00004318 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004319 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004320 break;
4321
4322 case 186:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004323#line 1900 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004324 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004325 ResolveTypeTo((yyvsp[-2].StrVal), (yyvsp[0].PrimType));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004326
Reid Spencer5cbf9852007-01-30 20:08:39 +00004327 if (!setTypeName((yyvsp[0].PrimType), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004328 CHECK_FOR_ERROR
4329 // If this is a named type that is not a redefinition, add it to the slot
4330 // table.
Reid Spencer5cbf9852007-01-30 20:08:39 +00004331 CurModule.Types.push_back((yyvsp[0].PrimType));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004332 }
Reid Spencer6e18b7d2006-12-03 06:59:29 +00004333 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004334 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004335 break;
4336
4337 case 187:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004338#line 1911 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004339 {
4340 /* "Externally Visible" Linkage */
Reid Spencer5cbf9852007-01-30 20:08:39 +00004341 if ((yyvsp[0].ConstVal) == 0)
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004342 GEN_ERROR("Global value initializer is not a constant!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00004343 CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage,
4344 (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004345 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004346 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004347 break;
4348
4349 case 188:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004350#line 1918 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004351 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004352 CurGV = 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +00004353 ;}
4354 break;
4355
4356 case 189:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004357#line 1921 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004358 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004359 if ((yyvsp[0].ConstVal) == 0)
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004360 GEN_ERROR("Global value initializer is not a constant!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00004361 CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), (yyvsp[-3].Linkage), (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), (yyvsp[0].ConstVal)->getType(), (yyvsp[0].ConstVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004362 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004363 ;}
4364 break;
4365
4366 case 190:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004367#line 1926 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004368 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004369 CurGV = 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +00004370 ;}
4371 break;
4372
4373 case 191:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004374#line 1929 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004375 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004376 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00004377 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
4378 CurGV = ParseGlobalVariable((yyvsp[-4].StrVal), (yyvsp[-3].Linkage), (yyvsp[-2].Visibility), (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004379 CHECK_FOR_ERROR
Reid Spencer5cbf9852007-01-30 20:08:39 +00004380 delete (yyvsp[0].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004381 ;}
4382 break;
4383
4384 case 192:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004385#line 1935 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004386 {
4387 CurGV = 0;
Reid Spencer41dff5e2007-01-26 08:05:27 +00004388 CHECK_FOR_ERROR
4389 ;}
4390 break;
4391
4392 case 193:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004393#line 1939 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004394 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004395 CHECK_FOR_ERROR
4396 ;}
4397 break;
4398
4399 case 194:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004400#line 1942 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004401 {
4402 CHECK_FOR_ERROR
4403 ;}
4404 break;
4405
4406 case 195:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004407#line 1948 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004408 {
Chris Lattner66316012006-01-24 04:14:29 +00004409 const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
Reid Spencer5cbf9852007-01-30 20:08:39 +00004410 char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true);
4411 std::string NewAsm((yyvsp[0].StrVal), EndStr);
4412 free((yyvsp[0].StrVal));
Chris Lattner66316012006-01-24 04:14:29 +00004413
4414 if (AsmSoFar.empty())
4415 CurModule.CurrentModule->setModuleInlineAsm(NewAsm);
4416 else
4417 CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm);
Reid Spencer61c83e02006-08-18 08:43:06 +00004418 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004419;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004420 break;
4421
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004422 case 196:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004423#line 1961 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004424 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004425 CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal));
4426 free((yyvsp[0].StrVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004427 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004428 break;
4429
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004430 case 197:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004431#line 1965 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004432 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004433 CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal));
4434 free((yyvsp[0].StrVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004435 ;}
Reid Spencer41dff5e2007-01-26 08:05:27 +00004436 break;
4437
4438 case 199:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004439#line 1972 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004440 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004441 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4442 free((yyvsp[0].StrVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004443 CHECK_FOR_ERROR
4444 ;}
4445 break;
4446
4447 case 200:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004448#line 1977 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004449 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004450 CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
4451 free((yyvsp[0].StrVal));
Reid Spencera54b7cb2007-01-12 07:05:14 +00004452 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004453 ;}
4454 break;
4455
4456 case 201:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004457#line 1982 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004458 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004459 CHECK_FOR_ERROR
4460 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004461 break;
4462
4463 case 202:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004464#line 1991 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004465 {
4466 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00004467 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4468 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
Reid Spencer41dff5e2007-01-26 08:05:27 +00004469 GEN_ERROR("void typed arguments are invalid!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00004470 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
4471 (yyval.ArgList) = (yyvsp[-4].ArgList);
4472 (yyvsp[-4].ArgList)->push_back(E);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004473 CHECK_FOR_ERROR
4474 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004475 break;
4476
4477 case 203:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004478#line 2001 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004479 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004480 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00004481 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
4482 if (*(yyvsp[-2].TypeVal) == Type::VoidTy)
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004483 GEN_ERROR("void typed arguments are invalid!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00004484 ArgListEntry E; E.Attrs = (yyvsp[-1].ParamAttrs); E.Ty = (yyvsp[-2].TypeVal); E.Name = (yyvsp[0].StrVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004485 (yyval.ArgList) = new ArgListType;
Reid Spencer41dff5e2007-01-26 08:05:27 +00004486 (yyval.ArgList)->push_back(E);
Reid Spencer61c83e02006-08-18 08:43:06 +00004487 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004488 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004489 break;
4490
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004491 case 204:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004492#line 2012 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004493 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004494 (yyval.ArgList) = (yyvsp[0].ArgList);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004495 CHECK_FOR_ERROR
4496 ;}
4497 break;
4498
4499 case 205:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004500#line 2016 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004501 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004502 (yyval.ArgList) = (yyvsp[-2].ArgList);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004503 struct ArgListEntry E;
4504 E.Ty = new PATypeHolder(Type::VoidTy);
4505 E.Name = 0;
4506 E.Attrs = FunctionType::NoAttributeSet;
4507 (yyval.ArgList)->push_back(E);
Reid Spencer6f407902007-01-13 05:00:46 +00004508 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004509 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004510 break;
4511
4512 case 206:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004513#line 2025 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004514 {
4515 (yyval.ArgList) = new ArgListType;
4516 struct ArgListEntry E;
4517 E.Ty = new PATypeHolder(Type::VoidTy);
4518 E.Name = 0;
4519 E.Attrs = FunctionType::NoAttributeSet;
4520 (yyval.ArgList)->push_back(E);
4521 CHECK_FOR_ERROR
4522 ;}
4523 break;
4524
4525 case 207:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004526#line 2034 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004527 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004528 (yyval.ArgList) = 0;
Reid Spencer61c83e02006-08-18 08:43:06 +00004529 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004530 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004531 break;
4532
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004533 case 208:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004534#line 2040 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004535 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004536 UnEscapeLexed((yyvsp[-6].StrVal));
4537 std::string FunctionName((yyvsp[-6].StrVal));
4538 free((yyvsp[-6].StrVal)); // Free strdup'd memory!
Reid Spencer68a24bd2005-08-27 18:50:39 +00004539
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00004540 // Check the function result for abstractness if this is a define. We should
4541 // have no abstract types at this point
Reid Spencer5cbf9852007-01-30 20:08:39 +00004542 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[-7].TypeVal)))
4543 GEN_ERROR("Reference to abstract result: "+ (yyvsp[-7].TypeVal)->get()->getDescription());
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00004544
Reid Spencer68a24bd2005-08-27 18:50:39 +00004545 std::vector<const Type*> ParamTypeList;
Reid Spencer14310612006-12-31 05:40:51 +00004546 std::vector<FunctionType::ParameterAttributes> ParamAttrs;
Reid Spencer5cbf9852007-01-30 20:08:39 +00004547 ParamAttrs.push_back((yyvsp[-2].ParamAttrs));
4548 if ((yyvsp[-4].ArgList)) { // If there are arguments...
4549 for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); I != (yyvsp[-4].ArgList)->end(); ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00004550 const Type* Ty = I->Ty->get();
Reid Spencer8c8a2dc2007-01-02 21:54:12 +00004551 if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
4552 GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
Reid Spencer14310612006-12-31 05:40:51 +00004553 ParamTypeList.push_back(Ty);
4554 if (Ty != Type::VoidTy)
4555 ParamAttrs.push_back(I->Attrs);
4556 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00004557 }
4558
4559 bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
4560 if (isVarArg) ParamTypeList.pop_back();
4561
Reid Spencer5cbf9852007-01-30 20:08:39 +00004562 FunctionType *FT = FunctionType::get(*(yyvsp[-7].TypeVal), ParamTypeList, isVarArg,
Reid Spencer14310612006-12-31 05:40:51 +00004563 ParamAttrs);
Reid Spencer68a24bd2005-08-27 18:50:39 +00004564 const PointerType *PFT = PointerType::get(FT);
Reid Spencer5cbf9852007-01-30 20:08:39 +00004565 delete (yyvsp[-7].TypeVal);
Reid Spencer68a24bd2005-08-27 18:50:39 +00004566
4567 ValID ID;
4568 if (!FunctionName.empty()) {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004569 ID = ValID::createGlobalName((char*)FunctionName.c_str());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004570 } else {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004571 ID = ValID::createGlobalID(CurModule.Values[PFT].size());
Reid Spencer68a24bd2005-08-27 18:50:39 +00004572 }
4573
4574 Function *Fn = 0;
4575 // See if this function was forward referenced. If so, recycle the object.
4576 if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) {
4577 // Move the function to the end of the list, from whereever it was
4578 // previously inserted.
4579 Fn = cast<Function>(FWRef);
4580 CurModule.CurrentModule->getFunctionList().remove(Fn);
4581 CurModule.CurrentModule->getFunctionList().push_back(Fn);
4582 } else if (!FunctionName.empty() && // Merge with an earlier prototype?
4583 (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) {
4584 // If this is the case, either we need to be a forward decl, or it needs
4585 // to be.
Reid Spencer5cbf9852007-01-30 20:08:39 +00004586 if (!CurFun.isDeclare && !Fn->isDeclaration())
Reid Spencer61c83e02006-08-18 08:43:06 +00004587 GEN_ERROR("Redefinition of function '" + FunctionName + "'!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004588
4589 // Make sure to strip off any argument names so we can't get conflicts.
Reid Spencer5cbf9852007-01-30 20:08:39 +00004590 if (Fn->isDeclaration())
Reid Spencer68a24bd2005-08-27 18:50:39 +00004591 for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
4592 AI != AE; ++AI)
4593 AI->setName("");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004594 } else { // Not already defined?
4595 Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName,
4596 CurModule.CurrentModule);
Anton Korobeynikov43e3aad2006-09-14 18:25:26 +00004597
Reid Spencer68a24bd2005-08-27 18:50:39 +00004598 InsertValue(Fn, CurModule.Values);
4599 }
4600
4601 CurFun.FunctionStart(Fn);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00004602
4603 if (CurFun.isDeclare) {
4604 // If we have declaration, always overwrite linkage. This will allow us to
4605 // correctly handle cases, when pointer to function is passed as argument to
4606 // another function.
4607 Fn->setLinkage(CurFun.Linkage);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004608 Fn->setVisibility(CurFun.Visibility);
Anton Korobeynikov93c2b372006-09-17 13:06:18 +00004609 }
Reid Spencer5cbf9852007-01-30 20:08:39 +00004610 Fn->setCallingConv((yyvsp[-8].UIntVal));
4611 Fn->setAlignment((yyvsp[0].UIntVal));
4612 if ((yyvsp[-1].StrVal)) {
4613 Fn->setSection((yyvsp[-1].StrVal));
4614 free((yyvsp[-1].StrVal));
Chris Lattnere869eef2005-11-12 00:11:49 +00004615 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00004616
4617 // Add all of the arguments we parsed to the function...
Reid Spencer5cbf9852007-01-30 20:08:39 +00004618 if ((yyvsp[-4].ArgList)) { // Is null if empty...
Reid Spencer68a24bd2005-08-27 18:50:39 +00004619 if (isVarArg) { // Nuke the last entry
Reid Spencer5cbf9852007-01-30 20:08:39 +00004620 assert((yyvsp[-4].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[-4].ArgList)->back().Name == 0&&
Reid Spencera132e042006-12-03 05:46:11 +00004621 "Not a varargs marker!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00004622 delete (yyvsp[-4].ArgList)->back().Ty;
4623 (yyvsp[-4].ArgList)->pop_back(); // Delete the last entry
Reid Spencer68a24bd2005-08-27 18:50:39 +00004624 }
4625 Function::arg_iterator ArgIt = Fn->arg_begin();
Reid Spencer14310612006-12-31 05:40:51 +00004626 unsigned Idx = 1;
Reid Spencer5cbf9852007-01-30 20:08:39 +00004627 for (ArgListType::iterator I = (yyvsp[-4].ArgList)->begin(); I != (yyvsp[-4].ArgList)->end(); ++I, ++ArgIt) {
Reid Spencer14310612006-12-31 05:40:51 +00004628 delete I->Ty; // Delete the typeholder...
4629 setValueName(ArgIt, I->Name); // Insert arg into symtab...
Reid Spencer5b7e7532006-09-28 19:28:24 +00004630 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00004631 InsertValue(ArgIt);
Reid Spencer14310612006-12-31 05:40:51 +00004632 Idx++;
Reid Spencer68a24bd2005-08-27 18:50:39 +00004633 }
Reid Spencera132e042006-12-03 05:46:11 +00004634
Reid Spencer5cbf9852007-01-30 20:08:39 +00004635 delete (yyvsp[-4].ArgList); // We're now done with the argument list
Reid Spencer68a24bd2005-08-27 18:50:39 +00004636 }
Reid Spencer61c83e02006-08-18 08:43:06 +00004637 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004638;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004639 break;
4640
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004641 case 211:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004642#line 2147 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004643 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004644 (yyval.FunctionVal) = CurFun.CurrentFunction;
Reid Spencer68a24bd2005-08-27 18:50:39 +00004645
4646 // Make sure that we keep track of the linkage type even if there was a
4647 // previous "declare".
Reid Spencer5cbf9852007-01-30 20:08:39 +00004648 (yyval.FunctionVal)->setLinkage((yyvsp[-3].Linkage));
4649 (yyval.FunctionVal)->setVisibility((yyvsp[-2].Visibility));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004650;}
4651 break;
4652
4653 case 214:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004654#line 2158 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004655 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004656 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004657 CHECK_FOR_ERROR
4658;}
4659 break;
4660
4661 case 215:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004662#line 2163 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004663 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004664 CurFun.CurrentFunction->setLinkage((yyvsp[-2].Linkage));
4665 CurFun.CurrentFunction->setVisibility((yyvsp[-1].Visibility));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004666 (yyval.FunctionVal) = CurFun.CurrentFunction;
4667 CurFun.FunctionDone();
4668 CHECK_FOR_ERROR
4669 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004670 break;
4671
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004672 case 216:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004673#line 2175 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004674 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004675 (yyval.BoolVal) = false;
4676 CHECK_FOR_ERROR
4677 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004678 break;
4679
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004680 case 217:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004681#line 2179 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004682 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004683 (yyval.BoolVal) = true;
Reid Spencer61c83e02006-08-18 08:43:06 +00004684 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004685 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004686 break;
4687
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004688 case 218:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004689#line 2184 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004690 { // A reference to a direct constant
Reid Spencer5cbf9852007-01-30 20:08:39 +00004691 (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val));
Reid Spencere4d87aa2006-12-23 06:05:41 +00004692 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004693 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004694 break;
4695
4696 case 219:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004697#line 2188 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004698 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004699 (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val));
Reid Spencer6f407902007-01-13 05:00:46 +00004700 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004701 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004702 break;
4703
4704 case 220:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004705#line 2192 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004706 { // Perhaps it's an FP constant?
Reid Spencer5cbf9852007-01-30 20:08:39 +00004707 (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004708 CHECK_FOR_ERROR
4709 ;}
4710 break;
4711
4712 case 221:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004713#line 2196 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004714 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004715 (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
Reid Spencere4d87aa2006-12-23 06:05:41 +00004716 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004717 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004718 break;
4719
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004720 case 222:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004721#line 2200 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004722 {
4723 (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
Reid Spencere4d87aa2006-12-23 06:05:41 +00004724 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004725 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004726 break;
4727
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004728 case 223:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004729#line 2204 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004730 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004731 (yyval.ValIDVal) = ValID::createNull();
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00004732 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004733 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004734 break;
4735
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004736 case 224:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004737#line 2208 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004738 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004739 (yyval.ValIDVal) = ValID::createUndef();
Zhou Sheng6b6b6ef2007-01-11 12:24:14 +00004740 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004741 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004742 break;
4743
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004744 case 225:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004745#line 2212 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004746 { // A vector zero constant.
4747 (yyval.ValIDVal) = ValID::createZeroInit();
Reid Spencer61c83e02006-08-18 08:43:06 +00004748 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004749 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004750 break;
4751
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004752 case 226:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004753#line 2216 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004754 { // Nonempty unsized packed vector
Reid Spencer5cbf9852007-01-30 20:08:39 +00004755 const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType();
4756 int NumElements = (yyvsp[-1].ConstVector)->size();
Reid Spencer68a24bd2005-08-27 18:50:39 +00004757
4758 PackedType* pt = PackedType::get(ETy, NumElements);
4759 PATypeHolder* PTy = new PATypeHolder(
Reid Spencera132e042006-12-03 05:46:11 +00004760 HandleUpRefs(
4761 PackedType::get(
4762 ETy,
4763 NumElements)
4764 )
4765 );
Reid Spencer68a24bd2005-08-27 18:50:39 +00004766
4767 // Verify all elements are correct type!
Reid Spencer5cbf9852007-01-30 20:08:39 +00004768 for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) {
4769 if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType())
Reid Spencer61c83e02006-08-18 08:43:06 +00004770 GEN_ERROR("Element #" + utostr(i) + " is not of type '" +
Reid Spencer68a24bd2005-08-27 18:50:39 +00004771 ETy->getDescription() +"' as required!\nIt is of type '" +
Reid Spencer5cbf9852007-01-30 20:08:39 +00004772 (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'.");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004773 }
4774
Reid Spencer5cbf9852007-01-30 20:08:39 +00004775 (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[-1].ConstVector)));
4776 delete PTy; delete (yyvsp[-1].ConstVector);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004777 CHECK_FOR_ERROR
4778 ;}
4779 break;
4780
4781 case 227:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004782#line 2241 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00004783 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004784 (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00004785 CHECK_FOR_ERROR
4786 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004787 break;
Reid Spencer6f407902007-01-13 05:00:46 +00004788
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004789 case 228:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004790#line 2245 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004791 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004792 char *End = UnEscapeLexed((yyvsp[-2].StrVal), true);
4793 std::string AsmStr = std::string((yyvsp[-2].StrVal), End);
4794 End = UnEscapeLexed((yyvsp[0].StrVal), true);
4795 std::string Constraints = std::string((yyvsp[0].StrVal), End);
4796 (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[-3].BoolVal));
4797 free((yyvsp[-2].StrVal));
4798 free((yyvsp[0].StrVal));
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004799 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004800 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004801 break;
4802
4803 case 229:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004804#line 2259 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004805 { // Is it an integer reference...?
Reid Spencer5cbf9852007-01-30 20:08:39 +00004806 (yyval.ValIDVal) = ValID::createLocalID((yyvsp[0].UIntVal));
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004807 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004808 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004809 break;
4810
4811 case 230:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004812#line 2263 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004813 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004814 (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[0].UIntVal));
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004815 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004816 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004817 break;
4818
4819 case 231:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004820#line 2267 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004821 { // Is it a named reference...?
Reid Spencer5cbf9852007-01-30 20:08:39 +00004822 (yyval.ValIDVal) = ValID::createLocalName((yyvsp[0].StrVal));
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004823 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004824 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004825 break;
4826
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004827 case 232:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004828#line 2271 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004829 { // Is it a named reference...?
Reid Spencer5cbf9852007-01-30 20:08:39 +00004830 (yyval.ValIDVal) = ValID::createGlobalName((yyvsp[0].StrVal));
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004831 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004832 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004833 break;
4834
4835 case 235:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004836#line 2283 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004837 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004838 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00004839 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
4840 (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
4841 delete (yyvsp[-1].TypeVal);
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004842 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004843 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004844 break;
4845
4846 case 236:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004847#line 2292 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004848 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004849 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004850 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004851 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004852 break;
4853
4854 case 237:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004855#line 2296 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004856 { // Do not allow functions with 0 basic blocks
Reid Spencer5cbf9852007-01-30 20:08:39 +00004857 (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004858 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004859 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004860 break;
4861
4862 case 238:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004863#line 2305 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004864 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004865 setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004866 CHECK_FOR_ERROR
Reid Spencer5cbf9852007-01-30 20:08:39 +00004867 InsertValue((yyvsp[0].TermInstVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004868
Reid Spencer5cbf9852007-01-30 20:08:39 +00004869 (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal));
4870 InsertValue((yyvsp[-2].BasicBlockVal));
4871 (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal);
Anton Korobeynikov178a3522007-01-12 19:22:51 +00004872 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004873 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004874 break;
4875
4876 case 239:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004877#line 2316 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004878 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004879 if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal)))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004880 if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
4881 if (CI2->getParent() == 0)
Reid Spencer5cbf9852007-01-30 20:08:39 +00004882 (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2);
4883 (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal));
4884 (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004885 CHECK_FOR_ERROR
4886 ;}
4887 break;
4888
4889 case 240:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004890#line 2325 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004891 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00004892 (yyval.BasicBlockVal) = getBBVal(ValID::createLocalID(CurFun.NextBBNum++), true);
Reid Spencere4d87aa2006-12-23 06:05:41 +00004893 CHECK_FOR_ERROR
4894
4895 // Make sure to move the basic block to the correct location in the
4896 // function, instead of leaving it inserted wherever it was first
4897 // referenced.
4898 Function::BasicBlockListType &BBL =
4899 CurFun.CurrentFunction->getBasicBlockList();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004900 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00004901 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004902 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004903 break;
4904
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004905 case 241:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004906#line 2337 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004907 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004908 (yyval.BasicBlockVal) = getBBVal(ValID::createLocalName((yyvsp[0].StrVal)), true);
Reid Spencere4d87aa2006-12-23 06:05:41 +00004909 CHECK_FOR_ERROR
4910
4911 // Make sure to move the basic block to the correct location in the
4912 // function, instead of leaving it inserted wherever it was first
4913 // referenced.
4914 Function::BasicBlockListType &BBL =
4915 CurFun.CurrentFunction->getBasicBlockList();
Reid Spencer41dff5e2007-01-26 08:05:27 +00004916 BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal));
Reid Spencer3822ff52006-11-08 06:47:33 +00004917 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004918 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004919 break;
Reid Spencer3822ff52006-11-08 06:47:33 +00004920
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004921 case 242:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004922#line 2350 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004923 { // Return with a result...
Reid Spencer5cbf9852007-01-30 20:08:39 +00004924 (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal));
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004925 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004926 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004927 break;
4928
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004929 case 243:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004930#line 2354 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004931 { // Return with no result...
Reid Spencer41dff5e2007-01-26 08:05:27 +00004932 (yyval.TermInstVal) = new ReturnInst();
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004933 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004934 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004935 break;
4936
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004937 case 244:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004938#line 2358 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004939 { // Unconditional Branch...
Reid Spencer5cbf9852007-01-30 20:08:39 +00004940 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004941 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004942 (yyval.TermInstVal) = new BranchInst(tmpBB);
4943 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004944 break;
4945
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004946 case 245:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004947#line 2363 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004948 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004949 assert(cast<IntegerType>((yyvsp[-7].PrimType))->getBitWidth() == 1 && "Not Bool?");
4950 BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal));
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004951 CHECK_FOR_ERROR
Reid Spencer5cbf9852007-01-30 20:08:39 +00004952 BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal));
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004953 CHECK_FOR_ERROR
Reid Spencer5cbf9852007-01-30 20:08:39 +00004954 Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[-6].ValIDVal));
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004955 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004956 (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
4957 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004958 break;
4959
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004960 case 246:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004961#line 2373 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004962 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004963 Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal));
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004964 CHECK_FOR_ERROR
Reid Spencer5cbf9852007-01-30 20:08:39 +00004965 BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal));
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004966 CHECK_FOR_ERROR
Reid Spencer5cbf9852007-01-30 20:08:39 +00004967 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size());
Reid Spencer41dff5e2007-01-26 08:05:27 +00004968 (yyval.TermInstVal) = S;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004969
Reid Spencer5cbf9852007-01-30 20:08:39 +00004970 std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(),
4971 E = (yyvsp[-1].JumpTable)->end();
Reid Spencer68a24bd2005-08-27 18:50:39 +00004972 for (; I != E; ++I) {
4973 if (ConstantInt *CI = dyn_cast<ConstantInt>(I->first))
4974 S->addCase(CI, I->second);
4975 else
Reid Spencer61c83e02006-08-18 08:43:06 +00004976 GEN_ERROR("Switch case is constant, but not a simple integer!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00004977 }
Reid Spencer5cbf9852007-01-30 20:08:39 +00004978 delete (yyvsp[-1].JumpTable);
Reid Spencer61c83e02006-08-18 08:43:06 +00004979 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004980 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004981 break;
4982
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004983 case 247:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004984#line 2392 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004985 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00004986 Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00004987 CHECK_FOR_ERROR
Reid Spencer5cbf9852007-01-30 20:08:39 +00004988 BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00004989 CHECK_FOR_ERROR
4990 SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
Reid Spencer41dff5e2007-01-26 08:05:27 +00004991 (yyval.TermInstVal) = S;
Reid Spencer61c83e02006-08-18 08:43:06 +00004992 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00004993 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004994 break;
4995
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00004996 case 248:
Reid Spencer5cbf9852007-01-30 20:08:39 +00004997#line 2402 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00004998 {
Reid Spencer3822ff52006-11-08 06:47:33 +00004999
Reid Spencer14310612006-12-31 05:40:51 +00005000 // Handle the short syntax
5001 const PointerType *PFTy = 0;
5002 const FunctionType *Ty = 0;
Reid Spencer5cbf9852007-01-30 20:08:39 +00005003 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-11].TypeVal)->get())) ||
Reid Spencer68a24bd2005-08-27 18:50:39 +00005004 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5005 // Pull out the types of all of the arguments...
5006 std::vector<const Type*> ParamTypes;
Reid Spencer14310612006-12-31 05:40:51 +00005007 FunctionType::ParamAttrsList ParamAttrs;
Reid Spencer5cbf9852007-01-30 20:08:39 +00005008 ParamAttrs.push_back((yyvsp[-6].ParamAttrs));
5009 for (ValueRefList::iterator I = (yyvsp[-8].ValueRefList)->begin(), E = (yyvsp[-8].ValueRefList)->end(); I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00005010 const Type *Ty = I->Val->getType();
5011 if (Ty == Type::VoidTy)
5012 GEN_ERROR("Short call syntax cannot be used with varargs");
5013 ParamTypes.push_back(Ty);
5014 ParamAttrs.push_back(I->Attrs);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005015 }
5016
Reid Spencer5cbf9852007-01-30 20:08:39 +00005017 Ty = FunctionType::get((yyvsp[-11].TypeVal)->get(), ParamTypes, false, ParamAttrs);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005018 PFTy = PointerType::get(Ty);
5019 }
5020
Reid Spencer5cbf9852007-01-30 20:08:39 +00005021 Value *V = getVal(PFTy, (yyvsp[-10].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00005022 CHECK_FOR_ERROR
Reid Spencer5cbf9852007-01-30 20:08:39 +00005023 BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005024 CHECK_FOR_ERROR
Reid Spencer5cbf9852007-01-30 20:08:39 +00005025 BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal));
Reid Spencer5b7e7532006-09-28 19:28:24 +00005026 CHECK_FOR_ERROR
Reid Spencer68a24bd2005-08-27 18:50:39 +00005027
Reid Spencer14310612006-12-31 05:40:51 +00005028 // Check the arguments
5029 ValueList Args;
Reid Spencer5cbf9852007-01-30 20:08:39 +00005030 if ((yyvsp[-8].ValueRefList)->empty()) { // Has no arguments?
Reid Spencer14310612006-12-31 05:40:51 +00005031 // Make sure no arguments is a good thing!
5032 if (Ty->getNumParams() != 0)
5033 GEN_ERROR("No arguments passed to a function that "
5034 "expects arguments!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005035 } else { // Has arguments?
5036 // Loop through FunctionType's arguments and ensure they are specified
5037 // correctly!
Reid Spencer68a24bd2005-08-27 18:50:39 +00005038 FunctionType::param_iterator I = Ty->param_begin();
5039 FunctionType::param_iterator E = Ty->param_end();
Reid Spencer5cbf9852007-01-30 20:08:39 +00005040 ValueRefList::iterator ArgI = (yyvsp[-8].ValueRefList)->begin(), ArgE = (yyvsp[-8].ValueRefList)->end();
Reid Spencer68a24bd2005-08-27 18:50:39 +00005041
Reid Spencer14310612006-12-31 05:40:51 +00005042 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5043 if (ArgI->Val->getType() != *I)
5044 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Reid Spencera132e042006-12-03 05:46:11 +00005045 (*I)->getDescription() + "'!");
Reid Spencer14310612006-12-31 05:40:51 +00005046 Args.push_back(ArgI->Val);
5047 }
Reid Spencer68a24bd2005-08-27 18:50:39 +00005048
Reid Spencer14310612006-12-31 05:40:51 +00005049 if (Ty->isVarArg()) {
5050 if (I == E)
5051 for (; ArgI != ArgE; ++ArgI)
5052 Args.push_back(ArgI->Val); // push the remaining varargs
5053 } else if (I != E || ArgI != ArgE)
Reid Spencer61c83e02006-08-18 08:43:06 +00005054 GEN_ERROR("Invalid number of parameters detected!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005055 }
Reid Spencer14310612006-12-31 05:40:51 +00005056
5057 // Create the InvokeInst
5058 InvokeInst *II = new InvokeInst(V, Normal, Except, Args);
Reid Spencer5cbf9852007-01-30 20:08:39 +00005059 II->setCallingConv((yyvsp[-12].UIntVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00005060 (yyval.TermInstVal) = II;
Reid Spencer5cbf9852007-01-30 20:08:39 +00005061 delete (yyvsp[-8].ValueRefList);
Andrew Lenharth6353e052006-12-08 18:07:09 +00005062 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005063 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005064 break;
5065
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005066 case 249:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005067#line 2468 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005068 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005069 (yyval.TermInstVal) = new UnwindInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00005070 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005071 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005072 break;
5073
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005074 case 250:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005075#line 2472 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005076 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005077 (yyval.TermInstVal) = new UnreachableInst();
Andrew Lenharth6353e052006-12-08 18:07:09 +00005078 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005079 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005080 break;
5081
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005082 case 251:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005083#line 2479 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005084 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00005085 (yyval.JumpTable) = (yyvsp[-5].JumpTable);
5086 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005087 CHECK_FOR_ERROR
5088 if (V == 0)
5089 GEN_ERROR("May only switch on a constant pool value!");
5090
Reid Spencer5cbf9852007-01-30 20:08:39 +00005091 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005092 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005093 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5094 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005095 break;
5096
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005097 case 252:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005098#line 2490 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005099 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005100 (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
Reid Spencer5cbf9852007-01-30 20:08:39 +00005101 Constant *V = cast<Constant>(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal)));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005102 CHECK_FOR_ERROR
5103
5104 if (V == 0)
5105 GEN_ERROR("May only switch on a constant pool value!");
5106
Reid Spencer5cbf9852007-01-30 20:08:39 +00005107 BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005108 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005109 (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
5110 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005111 break;
5112
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005113 case 253:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005114#line 2503 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005115 {
Andrew Lenharth6353e052006-12-08 18:07:09 +00005116 // Is this definition named?? if so, assign the name...
Reid Spencer5cbf9852007-01-30 20:08:39 +00005117 setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005118 CHECK_FOR_ERROR
Reid Spencer5cbf9852007-01-30 20:08:39 +00005119 InsertValue((yyvsp[0].InstVal));
5120 (yyval.InstVal) = (yyvsp[0].InstVal);
Andrew Lenharth6353e052006-12-08 18:07:09 +00005121 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005122;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005123 break;
5124
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005125 case 254:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005126#line 2512 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005127 { // Used for PHI nodes
Reid Spencer14310612006-12-31 05:40:51 +00005128 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00005129 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-5].TypeVal))->getDescription());
Reid Spencer41dff5e2007-01-26 08:05:27 +00005130 (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
Reid Spencer5cbf9852007-01-30 20:08:39 +00005131 Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005132 CHECK_FOR_ERROR
Reid Spencer5cbf9852007-01-30 20:08:39 +00005133 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005134 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005135 (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
Reid Spencer5cbf9852007-01-30 20:08:39 +00005136 delete (yyvsp[-5].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00005137 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005138 break;
5139
5140 case 255:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005141#line 2523 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005142 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00005143 (yyval.PHIList) = (yyvsp[-6].PHIList);
5144 Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005145 CHECK_FOR_ERROR
Reid Spencer5cbf9852007-01-30 20:08:39 +00005146 BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005147 CHECK_FOR_ERROR
Reid Spencer5cbf9852007-01-30 20:08:39 +00005148 (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
Reid Spencer41dff5e2007-01-26 08:05:27 +00005149 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005150 break;
5151
5152 case 256:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005153#line 2533 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005154 {
5155 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00005156 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005157 // Used for call and invoke instructions
5158 (yyval.ValueRefList) = new ValueRefList();
Reid Spencer5cbf9852007-01-30 20:08:39 +00005159 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005160 (yyval.ValueRefList)->push_back(E);
5161 ;}
5162 break;
5163
5164 case 257:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005165#line 2541 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005166 {
Reid Spencer14310612006-12-31 05:40:51 +00005167 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00005168 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5169 (yyval.ValueRefList) = (yyvsp[-4].ValueRefList);
5170 ValueRefListEntry E; E.Attrs = (yyvsp[0].ParamAttrs); E.Val = getVal((yyvsp[-2].TypeVal)->get(), (yyvsp[-1].ValIDVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00005171 (yyval.ValueRefList)->push_back(E);
Reid Spencer6f407902007-01-13 05:00:46 +00005172 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005173 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005174 break;
5175
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005176 case 258:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005177#line 2549 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00005178 { (yyval.ValueRefList) = new ValueRefList(); ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005179 break;
5180
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005181 case 259:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005182#line 2552 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer41dff5e2007-01-26 08:05:27 +00005183 { (yyval.ValueList) = new std::vector<Value*>(); ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005184 break;
5185
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005186 case 260:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005187#line 2553 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005188 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00005189 (yyval.ValueList) = (yyvsp[-2].ValueList);
5190 (yyval.ValueList)->push_back((yyvsp[0].ValueVal));
Reid Spencer14310612006-12-31 05:40:51 +00005191 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005192 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005193 break;
5194
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005195 case 261:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005196#line 2560 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005197 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005198 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00005199 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005200 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005201 break;
5202
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005203 case 262:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005204#line 2564 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005205 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005206 (yyval.BoolVal) = false;
Reid Spencere4d87aa2006-12-23 06:05:41 +00005207 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005208 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005209 break;
5210
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005211 case 263:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005212#line 2569 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005213 {
Reid Spencer14310612006-12-31 05:40:51 +00005214 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00005215 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5216 if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() &&
5217 !isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
Reid Spencere4d87aa2006-12-23 06:05:41 +00005218 GEN_ERROR(
5219 "Arithmetic operator requires integer, FP, or packed operands!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00005220 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()) &&
5221 ((yyvsp[-4].BinaryOpVal) == Instruction::URem ||
5222 (yyvsp[-4].BinaryOpVal) == Instruction::SRem ||
5223 (yyvsp[-4].BinaryOpVal) == Instruction::FRem))
Reid Spencere4d87aa2006-12-23 06:05:41 +00005224 GEN_ERROR("U/S/FRem not supported on packed types!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00005225 Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005226 CHECK_FOR_ERROR
Reid Spencer5cbf9852007-01-30 20:08:39 +00005227 Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005228 CHECK_FOR_ERROR
Reid Spencer5cbf9852007-01-30 20:08:39 +00005229 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2);
Reid Spencer41dff5e2007-01-26 08:05:27 +00005230 if ((yyval.InstVal) == 0)
Reid Spencere4d87aa2006-12-23 06:05:41 +00005231 GEN_ERROR("binary operator returned null!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00005232 delete (yyvsp[-3].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00005233 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005234 break;
5235
5236 case 264:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005237#line 2590 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005238 {
Reid Spencer14310612006-12-31 05:40:51 +00005239 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00005240 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5241 if (!(*(yyvsp[-3].TypeVal))->isInteger()) {
5242 if (!isa<PackedType>((yyvsp[-3].TypeVal)->get()) ||
5243 !cast<PackedType>((yyvsp[-3].TypeVal)->get())->getElementType()->isInteger())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005244 GEN_ERROR("Logical operator requires integral operands!");
5245 }
Reid Spencer5cbf9852007-01-30 20:08:39 +00005246 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005247 CHECK_FOR_ERROR
Reid Spencer5cbf9852007-01-30 20:08:39 +00005248 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005249 CHECK_FOR_ERROR
Reid Spencer5cbf9852007-01-30 20:08:39 +00005250 (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005251 if ((yyval.InstVal) == 0)
5252 GEN_ERROR("binary operator returned null!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00005253 delete (yyvsp[-3].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005254 ;}
5255 break;
5256
5257 case 265:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005258#line 2607 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005259 {
5260 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00005261 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5262 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
Reid Spencerac4a1dd2007-01-04 02:57:52 +00005263 GEN_ERROR("Packed types not supported by icmp instruction");
Reid Spencer5cbf9852007-01-30 20:08:39 +00005264 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005265 CHECK_FOR_ERROR
Reid Spencer5cbf9852007-01-30 20:08:39 +00005266 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005267 CHECK_FOR_ERROR
Reid Spencer5cbf9852007-01-30 20:08:39 +00005268 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2);
Reid Spencer41dff5e2007-01-26 08:05:27 +00005269 if ((yyval.InstVal) == 0)
Andrew Lenharth6353e052006-12-08 18:07:09 +00005270 GEN_ERROR("icmp operator returned null!");
Reid Spencer41dff5e2007-01-26 08:05:27 +00005271 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005272 break;
5273
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005274 case 266:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005275#line 2620 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005276 {
Reid Spencer14310612006-12-31 05:40:51 +00005277 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00005278 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-3].TypeVal))->getDescription());
5279 if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
Reid Spencerac4a1dd2007-01-04 02:57:52 +00005280 GEN_ERROR("Packed types not supported by fcmp instruction");
Reid Spencer5cbf9852007-01-30 20:08:39 +00005281 Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005282 CHECK_FOR_ERROR
Reid Spencer5cbf9852007-01-30 20:08:39 +00005283 Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005284 CHECK_FOR_ERROR
Reid Spencer5cbf9852007-01-30 20:08:39 +00005285 (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2);
Reid Spencer41dff5e2007-01-26 08:05:27 +00005286 if ((yyval.InstVal) == 0)
Andrew Lenharth6353e052006-12-08 18:07:09 +00005287 GEN_ERROR("fcmp operator returned null!");
Reid Spencer41dff5e2007-01-26 08:05:27 +00005288 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005289 break;
5290
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005291 case 267:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005292#line 2633 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005293 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00005294 if ((yyvsp[0].ValueVal)->getType() != Type::Int8Ty)
Reid Spencer14310612006-12-31 05:40:51 +00005295 GEN_ERROR("Shift amount must be i8 type!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00005296 if (!(yyvsp[-2].ValueVal)->getType()->isInteger())
Andrew Lenharth6353e052006-12-08 18:07:09 +00005297 GEN_ERROR("Shift constant expression requires integer operand!");
5298 CHECK_FOR_ERROR;
Reid Spencer5cbf9852007-01-30 20:08:39 +00005299 (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005300 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005301 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005302 break;
5303
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005304 case 268:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005305#line 2642 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005306 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005307 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00005308 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5309 Value* Val = (yyvsp[-2].ValueVal);
5310 const Type* DestTy = (yyvsp[0].TypeVal)->get();
5311 if (!CastInst::castIsValid((yyvsp[-3].CastOpVal), Val, DestTy))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005312 GEN_ERROR("invalid cast opcode for cast from '" +
5313 Val->getType()->getDescription() + "' to '" +
5314 DestTy->getDescription() + "'!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00005315 (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), Val, DestTy);
5316 delete (yyvsp[0].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00005317 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005318 break;
5319
5320 case 269:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005321#line 2654 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005322 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00005323 if ((yyvsp[-4].ValueVal)->getType() != Type::Int1Ty)
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005324 GEN_ERROR("select condition must be boolean!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00005325 if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005326 GEN_ERROR("select value types should match!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00005327 (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005328 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005329 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005330 break;
5331
5332 case 270:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005333#line 2662 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005334 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005335 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00005336 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription());
5337 (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal));
5338 delete (yyvsp[0].TypeVal);
Andrew Lenharth6353e052006-12-08 18:07:09 +00005339 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005340 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005341 break;
5342
5343 case 271:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005344#line 2669 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005345 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00005346 if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005347 GEN_ERROR("Invalid extractelement operands!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00005348 (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005349 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005350 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005351 break;
5352
5353 case 272:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005354#line 2675 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005355 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00005356 if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005357 GEN_ERROR("Invalid insertelement operands!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00005358 (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
Andrew Lenharth6353e052006-12-08 18:07:09 +00005359 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005360 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005361 break;
5362
5363 case 273:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005364#line 2681 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005365 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00005366 if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005367 GEN_ERROR("Invalid shufflevector operands!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00005368 (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00005369 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005370 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005371 break;
5372
5373 case 274:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005374#line 2687 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005375 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00005376 const Type *Ty = (yyvsp[0].PHIList)->front().first->getType();
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005377 if (!Ty->isFirstClassType())
5378 GEN_ERROR("PHI node operands must be of first class type!");
5379 (yyval.InstVal) = new PHINode(Ty);
Reid Spencer5cbf9852007-01-30 20:08:39 +00005380 ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size());
5381 while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) {
5382 if ((yyvsp[0].PHIList)->front().first->getType() != Ty)
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005383 GEN_ERROR("All elements of a PHI node must be of the same type!");
Reid Spencer5cbf9852007-01-30 20:08:39 +00005384 cast<PHINode>((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second);
5385 (yyvsp[0].PHIList)->pop_front();
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005386 }
Reid Spencer5cbf9852007-01-30 20:08:39 +00005387 delete (yyvsp[0].PHIList); // Free the list...
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005388 CHECK_FOR_ERROR
5389 ;}
5390 break;
5391
5392 case 275:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005393#line 2703 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005394 {
Reid Spencer14310612006-12-31 05:40:51 +00005395
5396 // Handle the short syntax
Andrew Lenharth6353e052006-12-08 18:07:09 +00005397 const PointerType *PFTy = 0;
5398 const FunctionType *Ty = 0;
Reid Spencer5cbf9852007-01-30 20:08:39 +00005399 if (!(PFTy = dyn_cast<PointerType>((yyvsp[-5].TypeVal)->get())) ||
Andrew Lenharth6353e052006-12-08 18:07:09 +00005400 !(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
5401 // Pull out the types of all of the arguments...
5402 std::vector<const Type*> ParamTypes;
Reid Spencer14310612006-12-31 05:40:51 +00005403 FunctionType::ParamAttrsList ParamAttrs;
Reid Spencer5cbf9852007-01-30 20:08:39 +00005404 ParamAttrs.push_back((yyvsp[0].ParamAttrs));
5405 for (ValueRefList::iterator I = (yyvsp[-2].ValueRefList)->begin(), E = (yyvsp[-2].ValueRefList)->end(); I != E; ++I) {
Reid Spencer14310612006-12-31 05:40:51 +00005406 const Type *Ty = I->Val->getType();
5407 if (Ty == Type::VoidTy)
5408 GEN_ERROR("Short call syntax cannot be used with varargs");
5409 ParamTypes.push_back(Ty);
5410 ParamAttrs.push_back(I->Attrs);
Andrew Lenharth6353e052006-12-08 18:07:09 +00005411 }
5412
Reid Spencer5cbf9852007-01-30 20:08:39 +00005413 Ty = FunctionType::get((yyvsp[-5].TypeVal)->get(), ParamTypes, false, ParamAttrs);
Andrew Lenharth6353e052006-12-08 18:07:09 +00005414 PFTy = PointerType::get(Ty);
5415 }
5416
Reid Spencer5cbf9852007-01-30 20:08:39 +00005417 Value *V = getVal(PFTy, (yyvsp[-4].ValIDVal)); // Get the function we're calling...
Andrew Lenharth6353e052006-12-08 18:07:09 +00005418 CHECK_FOR_ERROR
5419
Reid Spencer14310612006-12-31 05:40:51 +00005420 // Check the arguments
5421 ValueList Args;
Reid Spencer5cbf9852007-01-30 20:08:39 +00005422 if ((yyvsp[-2].ValueRefList)->empty()) { // Has no arguments?
Andrew Lenharth6353e052006-12-08 18:07:09 +00005423 // Make sure no arguments is a good thing!
5424 if (Ty->getNumParams() != 0)
5425 GEN_ERROR("No arguments passed to a function that "
5426 "expects arguments!");
Andrew Lenharth6353e052006-12-08 18:07:09 +00005427 } else { // Has arguments?
5428 // Loop through FunctionType's arguments and ensure they are specified
5429 // correctly!
5430 //
5431 FunctionType::param_iterator I = Ty->param_begin();
5432 FunctionType::param_iterator E = Ty->param_end();
Reid Spencer5cbf9852007-01-30 20:08:39 +00005433 ValueRefList::iterator ArgI = (yyvsp[-2].ValueRefList)->begin(), ArgE = (yyvsp[-2].ValueRefList)->end();
Andrew Lenharth6353e052006-12-08 18:07:09 +00005434
Reid Spencer14310612006-12-31 05:40:51 +00005435 for (; ArgI != ArgE && I != E; ++ArgI, ++I) {
5436 if (ArgI->Val->getType() != *I)
5437 GEN_ERROR("Parameter " + ArgI->Val->getName()+ " is not of type '" +
Andrew Lenharth6353e052006-12-08 18:07:09 +00005438 (*I)->getDescription() + "'!");
Reid Spencer14310612006-12-31 05:40:51 +00005439 Args.push_back(ArgI->Val);
5440 }
5441 if (Ty->isVarArg()) {
5442 if (I == E)
5443 for (; ArgI != ArgE; ++ArgI)
5444 Args.push_back(ArgI->Val); // push the remaining varargs
5445 } else if (I != E || ArgI != ArgE)
Andrew Lenharth6353e052006-12-08 18:07:09 +00005446 GEN_ERROR("Invalid number of parameters detected!");
Andrew Lenharth6353e052006-12-08 18:07:09 +00005447 }
Reid Spencer14310612006-12-31 05:40:51 +00005448 // Create the call node
5449 CallInst *CI = new CallInst(V, Args);
Reid Spencer5cbf9852007-01-30 20:08:39 +00005450 CI->setTailCall((yyvsp[-7].BoolVal));
5451 CI->setCallingConv((yyvsp[-6].UIntVal));
Reid Spencer41dff5e2007-01-26 08:05:27 +00005452 (yyval.InstVal) = CI;
Reid Spencer5cbf9852007-01-30 20:08:39 +00005453 delete (yyvsp[-2].ValueRefList);
5454 delete (yyvsp[-5].TypeVal);
Reid Spencere4d87aa2006-12-23 06:05:41 +00005455 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005456 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005457 break;
5458
5459 case 276:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005460#line 2766 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005461 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00005462 (yyval.InstVal) = (yyvsp[0].InstVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005463 CHECK_FOR_ERROR
5464 ;}
5465 break;
5466
5467 case 277:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005468#line 2771 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005469 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005470 (yyval.BoolVal) = true;
Reid Spencere4d87aa2006-12-23 06:05:41 +00005471 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005472 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005473 break;
5474
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005475 case 278:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005476#line 2775 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005477 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005478 (yyval.BoolVal) = false;
Reid Spencere4d87aa2006-12-23 06:05:41 +00005479 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005480 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005481 break;
5482
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005483 case 279:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005484#line 2782 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005485 {
Reid Spencer6f407902007-01-13 05:00:46 +00005486 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00005487 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5488 (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5489 delete (yyvsp[-1].TypeVal);
Reid Spencer6f407902007-01-13 05:00:46 +00005490 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005491 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005492 break;
5493
5494 case 280:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005495#line 2789 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005496 {
Reid Spencer14310612006-12-31 05:40:51 +00005497 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00005498 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5499 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
Reid Spencere4d87aa2006-12-23 06:05:41 +00005500 CHECK_FOR_ERROR
Reid Spencer5cbf9852007-01-30 20:08:39 +00005501 (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5502 delete (yyvsp[-4].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00005503 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005504 break;
5505
5506 case 281:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005507#line 2797 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005508 {
Reid Spencer14310612006-12-31 05:40:51 +00005509 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00005510 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5511 (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
5512 delete (yyvsp[-1].TypeVal);
Reid Spencer61c83e02006-08-18 08:43:06 +00005513 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005514 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005515 break;
5516
5517 case 282:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005518#line 2804 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005519 {
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005520 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00005521 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-4].TypeVal))->getDescription());
5522 Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00005523 CHECK_FOR_ERROR
Reid Spencer5cbf9852007-01-30 20:08:39 +00005524 (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
5525 delete (yyvsp[-4].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00005526 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005527 break;
5528
5529 case 283:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005530#line 2812 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005531 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00005532 if (!isa<PointerType>((yyvsp[0].ValueVal)->getType()))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005533 GEN_ERROR("Trying to free nonpointer type " +
Reid Spencer5cbf9852007-01-30 20:08:39 +00005534 (yyvsp[0].ValueVal)->getType()->getDescription() + "!");
5535 (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00005536 CHECK_FOR_ERROR
Reid Spencer41dff5e2007-01-26 08:05:27 +00005537 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005538 break;
5539
5540 case 284:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005541#line 2820 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005542 {
Reid Spencer14310612006-12-31 05:40:51 +00005543 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00005544 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5545 if (!isa<PointerType>((yyvsp[-1].TypeVal)->get()))
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005546 GEN_ERROR("Can't load from nonpointer type: " +
Reid Spencer5cbf9852007-01-30 20:08:39 +00005547 (*(yyvsp[-1].TypeVal))->getDescription());
5548 if (!cast<PointerType>((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType())
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005549 GEN_ERROR("Can't load from pointer of non-first-class type: " +
Reid Spencer5cbf9852007-01-30 20:08:39 +00005550 (*(yyvsp[-1].TypeVal))->getDescription());
5551 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00005552 CHECK_FOR_ERROR
Reid Spencer5cbf9852007-01-30 20:08:39 +00005553 (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal));
5554 delete (yyvsp[-1].TypeVal);
Reid Spencer41dff5e2007-01-26 08:05:27 +00005555 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005556 break;
5557
5558 case 285:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005559#line 2834 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005560 {
Reid Spencer14310612006-12-31 05:40:51 +00005561 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00005562 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-1].TypeVal))->getDescription());
5563 const PointerType *PT = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005564 if (!PT)
5565 GEN_ERROR("Can't store to a nonpointer type: " +
Reid Spencer5cbf9852007-01-30 20:08:39 +00005566 (*(yyvsp[-1].TypeVal))->getDescription());
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005567 const Type *ElTy = PT->getElementType();
Reid Spencer5cbf9852007-01-30 20:08:39 +00005568 if (ElTy != (yyvsp[-3].ValueVal)->getType())
5569 GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() +
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005570 "' into space of type '" + ElTy->getDescription() + "'!");
5571
Reid Spencer5cbf9852007-01-30 20:08:39 +00005572 Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal));
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005573 CHECK_FOR_ERROR
Reid Spencer5cbf9852007-01-30 20:08:39 +00005574 (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal));
5575 delete (yyvsp[-1].TypeVal);
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005576 ;}
5577 break;
5578
5579 case 286:
Reid Spencer5cbf9852007-01-30 20:08:39 +00005580#line 2851 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005581 {
5582 if (!UpRefs.empty())
Reid Spencer5cbf9852007-01-30 20:08:39 +00005583 GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[-2].TypeVal))->getDescription());
5584 if (!isa<PointerType>((yyvsp[-2].TypeVal)->get()))
Reid Spencer61c83e02006-08-18 08:43:06 +00005585 GEN_ERROR("getelementptr insn requires pointer operand!");
Reid Spencer68a24bd2005-08-27 18:50:39 +00005586
Reid Spencer5cbf9852007-01-30 20:08:39 +00005587 if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), *(yyvsp[0].ValueList), true))
Reid Spencer61c83e02006-08-18 08:43:06 +00005588 GEN_ERROR("Invalid getelementptr indices for type '" +
Reid Spencer5cbf9852007-01-30 20:08:39 +00005589 (*(yyvsp[-2].TypeVal))->getDescription()+ "'!");
5590 Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal));
Reid Spencer61c83e02006-08-18 08:43:06 +00005591 CHECK_FOR_ERROR
Reid Spencer5cbf9852007-01-30 20:08:39 +00005592 (yyval.InstVal) = new GetElementPtrInst(tmpVal, *(yyvsp[0].ValueList));
5593 delete (yyvsp[-2].TypeVal);
5594 delete (yyvsp[0].ValueList);
Reid Spencer41dff5e2007-01-26 08:05:27 +00005595 ;}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005596 break;
5597
5598
Reid Spencer41dff5e2007-01-26 08:05:27 +00005599 default: break;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005600 }
5601
Reid Spencer5cbf9852007-01-30 20:08:39 +00005602/* Line 1126 of yacc.c. */
5603#line 5604 "llvmAsmParser.tab.c"
5604
5605 yyvsp -= yylen;
5606 yyssp -= yylen;
5607
5608
Reid Spencer41dff5e2007-01-26 08:05:27 +00005609 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005610
5611 *++yyvsp = yyval;
5612
5613
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005614 /* Now `shift' the result of the reduction. Determine what state
5615 that goes to, based on the state we popped back to and the rule
5616 number reduced by. */
Reid Spencer68a24bd2005-08-27 18:50:39 +00005617
5618 yyn = yyr1[yyn];
5619
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005620 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
5621 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
Reid Spencer68a24bd2005-08-27 18:50:39 +00005622 yystate = yytable[yystate];
5623 else
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005624 yystate = yydefgoto[yyn - YYNTOKENS];
Reid Spencer68a24bd2005-08-27 18:50:39 +00005625
5626 goto yynewstate;
5627
5628
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005629/*------------------------------------.
5630| yyerrlab -- here on detecting error |
5631`------------------------------------*/
5632yyerrlab:
5633 /* If not already recovering from an error, report this error. */
5634 if (!yyerrstatus)
Reid Spencer68a24bd2005-08-27 18:50:39 +00005635 {
5636 ++yynerrs;
Reid Spencer5cbf9852007-01-30 20:08:39 +00005637#if YYERROR_VERBOSE
5638 yyn = yypact[yystate];
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005639
Reid Spencer5cbf9852007-01-30 20:08:39 +00005640 if (YYPACT_NINF < yyn && yyn < YYLAST)
5641 {
5642 int yytype = YYTRANSLATE (yychar);
5643 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
5644 YYSIZE_T yysize = yysize0;
5645 YYSIZE_T yysize1;
5646 int yysize_overflow = 0;
5647 char *yymsg = 0;
5648# define YYERROR_VERBOSE_ARGS_MAXIMUM 5
5649 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
5650 int yyx;
5651
5652#if 0
5653 /* This is so xgettext sees the translatable formats that are
5654 constructed on the fly. */
5655 YY_("syntax error, unexpected %s");
5656 YY_("syntax error, unexpected %s, expecting %s");
5657 YY_("syntax error, unexpected %s, expecting %s or %s");
5658 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
5659 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
Anton Korobeynikov9adeaa22007-01-28 13:37:39 +00005660#endif
Reid Spencer5cbf9852007-01-30 20:08:39 +00005661 char *yyfmt;
5662 char const *yyf;
5663 static char const yyunexpected[] = "syntax error, unexpected %s";
5664 static char const yyexpecting[] = ", expecting %s";
5665 static char const yyor[] = " or %s";
5666 char yyformat[sizeof yyunexpected
5667 + sizeof yyexpecting - 1
5668 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
5669 * (sizeof yyor - 1))];
5670 char const *yyprefix = yyexpecting;
5671
5672 /* Start YYX at -YYN if negative to avoid negative indexes in
5673 YYCHECK. */
5674 int yyxbegin = yyn < 0 ? -yyn : 0;
5675
5676 /* Stay within bounds of both yycheck and yytname. */
5677 int yychecklim = YYLAST - yyn;
5678 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
5679 int yycount = 1;
5680
5681 yyarg[0] = yytname[yytype];
5682 yyfmt = yystpcpy (yyformat, yyunexpected);
5683
5684 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
5685 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
5686 {
5687 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
5688 {
5689 yycount = 1;
5690 yysize = yysize0;
5691 yyformat[sizeof yyunexpected - 1] = '\0';
5692 break;
5693 }
5694 yyarg[yycount++] = yytname[yyx];
5695 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
5696 yysize_overflow |= yysize1 < yysize;
5697 yysize = yysize1;
5698 yyfmt = yystpcpy (yyfmt, yyprefix);
5699 yyprefix = yyor;
5700 }
5701
5702 yyf = YY_(yyformat);
5703 yysize1 = yysize + yystrlen (yyf);
5704 yysize_overflow |= yysize1 < yysize;
5705 yysize = yysize1;
5706
5707 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM)
5708 yymsg = (char *) YYSTACK_ALLOC (yysize);
5709 if (yymsg)
5710 {
5711 /* Avoid sprintf, as that infringes on the user's name space.
5712 Don't have undefined behavior even if the translation
5713 produced a string with the wrong number of "%s"s. */
5714 char *yyp = yymsg;
5715 int yyi = 0;
5716 while ((*yyp = *yyf))
5717 {
5718 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
5719 {
5720 yyp += yytnamerr (yyp, yyarg[yyi++]);
5721 yyf += 2;
5722 }
5723 else
5724 {
5725 yyp++;
5726 yyf++;
5727 }
5728 }
5729 yyerror (yymsg);
5730 YYSTACK_FREE (yymsg);
5731 }
5732 else
5733 {
5734 yyerror (YY_("syntax error"));
5735 goto yyexhaustedlab;
5736 }
5737 }
5738 else
5739#endif /* YYERROR_VERBOSE */
5740 yyerror (YY_("syntax error"));
Reid Spencer68a24bd2005-08-27 18:50:39 +00005741 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00005742
5743
5744
5745 if (yyerrstatus == 3)
5746 {
5747 /* If just tried and failed to reuse look-ahead token after an
5748 error, discard it. */
5749
5750 if (yychar <= YYEOF)
Reid Spencer5cbf9852007-01-30 20:08:39 +00005751 {
Reid Spencer41dff5e2007-01-26 08:05:27 +00005752 /* Return failure if at end of input. */
5753 if (yychar == YYEOF)
5754 YYABORT;
Reid Spencer5cbf9852007-01-30 20:08:39 +00005755 }
Reid Spencer41dff5e2007-01-26 08:05:27 +00005756 else
5757 {
Reid Spencer5cbf9852007-01-30 20:08:39 +00005758 yydestruct ("Error: discarding", yytoken, &yylval);
Reid Spencer41dff5e2007-01-26 08:05:27 +00005759 yychar = YYEMPTY;
5760 }
5761 }
5762
5763 /* Else will try to reuse look-ahead token after shifting the error
5764 token. */
Jeff Cohen361c3ef2007-01-21 19:19:31 +00005765 goto yyerrlab1;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005766
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005767
Reid Spencer41dff5e2007-01-26 08:05:27 +00005768/*---------------------------------------------------.
5769| yyerrorlab -- error raised explicitly by YYERROR. |
5770`---------------------------------------------------*/
5771yyerrorlab:
5772
5773 /* Pacify compilers like GCC when the user code never invokes
5774 YYERROR and the label yyerrorlab therefore never appears in user
5775 code. */
Reid Spencer5cbf9852007-01-30 20:08:39 +00005776 if (0)
Reid Spencer41dff5e2007-01-26 08:05:27 +00005777 goto yyerrorlab;
5778
Reid Spencer5cbf9852007-01-30 20:08:39 +00005779yyvsp -= yylen;
5780 yyssp -= yylen;
Reid Spencer41dff5e2007-01-26 08:05:27 +00005781 yystate = *yyssp;
5782 goto yyerrlab1;
5783
5784
5785/*-------------------------------------------------------------.
5786| yyerrlab1 -- common code for both syntax error and YYERROR. |
5787`-------------------------------------------------------------*/
Jeff Cohen361c3ef2007-01-21 19:19:31 +00005788yyerrlab1:
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005789 yyerrstatus = 3; /* Each real token shifted decrements this. */
5790
5791 for (;;)
5792 {
5793 yyn = yypact[yystate];
5794 if (yyn != YYPACT_NINF)
5795 {
5796 yyn += YYTERROR;
5797 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5798 {
5799 yyn = yytable[yyn];
5800 if (0 < yyn)
5801 break;
5802 }
5803 }
5804
5805 /* Pop the current state because it cannot handle the error token. */
5806 if (yyssp == yyss)
Reid Spencer68a24bd2005-08-27 18:50:39 +00005807 YYABORT;
5808
Reid Spencere4d87aa2006-12-23 06:05:41 +00005809
Reid Spencer5cbf9852007-01-30 20:08:39 +00005810 yydestruct ("Error: popping", yystos[yystate], yyvsp);
5811 YYPOPSTACK;
Reid Spencer41dff5e2007-01-26 08:05:27 +00005812 yystate = *yyssp;
5813 YY_STACK_PRINT (yyss, yyssp);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005814 }
5815
5816 if (yyn == YYFINAL)
5817 YYACCEPT;
5818
Reid Spencer68a24bd2005-08-27 18:50:39 +00005819 *++yyvsp = yylval;
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005820
5821
Reid Spencer5cbf9852007-01-30 20:08:39 +00005822 /* Shift the error token. */
Reid Spencer41dff5e2007-01-26 08:05:27 +00005823 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
5824
Reid Spencer68a24bd2005-08-27 18:50:39 +00005825 yystate = yyn;
5826 goto yynewstate;
5827
Chris Lattnerb25c4ca2007-01-15 02:12:07 +00005828
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005829/*-------------------------------------.
5830| yyacceptlab -- YYACCEPT comes here. |
5831`-------------------------------------*/
5832yyacceptlab:
5833 yyresult = 0;
5834 goto yyreturn;
5835
5836/*-----------------------------------.
5837| yyabortlab -- YYABORT comes here. |
5838`-----------------------------------*/
5839yyabortlab:
5840 yyresult = 1;
5841 goto yyreturn;
5842
5843#ifndef yyoverflow
Reid Spencer41dff5e2007-01-26 08:05:27 +00005844/*-------------------------------------------------.
5845| yyexhaustedlab -- memory exhaustion comes here. |
5846`-------------------------------------------------*/
5847yyexhaustedlab:
5848 yyerror (YY_("memory exhausted"));
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005849 yyresult = 2;
5850 /* Fall through. */
Chris Lattnerb25c4ca2007-01-15 02:12:07 +00005851#endif
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005852
5853yyreturn:
Reid Spencer41dff5e2007-01-26 08:05:27 +00005854 if (yychar != YYEOF && yychar != YYEMPTY)
5855 yydestruct ("Cleanup: discarding lookahead",
5856 yytoken, &yylval);
5857 while (yyssp != yyss)
5858 {
5859 yydestruct ("Cleanup: popping",
5860 yystos[*yyssp], yyvsp);
Reid Spencer5cbf9852007-01-30 20:08:39 +00005861 YYPOPSTACK;
Reid Spencer41dff5e2007-01-26 08:05:27 +00005862 }
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005863#ifndef yyoverflow
5864 if (yyss != yyssa)
5865 YYSTACK_FREE (yyss);
5866#endif
Reid Spencer5cbf9852007-01-30 20:08:39 +00005867 return yyresult;
Reid Spencer68a24bd2005-08-27 18:50:39 +00005868}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005869
5870
Reid Spencer5cbf9852007-01-30 20:08:39 +00005871#line 2868 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
Reid Spencer61c83e02006-08-18 08:43:06 +00005872
5873
Reid Spencer14310612006-12-31 05:40:51 +00005874// common code from the two 'RunVMAsmParser' functions
5875static Module* RunParser(Module * M) {
5876
5877 llvmAsmlineno = 1; // Reset the current line number...
5878 CurModule.CurrentModule = M;
5879#if YYDEBUG
5880 yydebug = Debug;
5881#endif
5882
5883 // Check to make sure the parser succeeded
5884 if (yyparse()) {
5885 if (ParserResult)
5886 delete ParserResult;
5887 return 0;
5888 }
5889
5890 // Check to make sure that parsing produced a result
5891 if (!ParserResult)
5892 return 0;
5893
5894 // Reset ParserResult variable while saving its value for the result.
5895 Module *Result = ParserResult;
5896 ParserResult = 0;
5897
5898 return Result;
5899}
5900
Reid Spencer61c83e02006-08-18 08:43:06 +00005901void llvm::GenerateError(const std::string &message, int LineNo) {
5902 if (LineNo == -1) LineNo = llvmAsmlineno;
5903 // TODO: column number in exception
5904 if (TheParseError)
5905 TheParseError->setError(CurFilename, message, LineNo);
5906 TriggerError = 1;
5907}
Reid Spencer68a24bd2005-08-27 18:50:39 +00005908
5909int yyerror(const char *ErrorMsg) {
5910 std::string where
5911 = std::string((CurFilename == "-") ? std::string("<stdin>") : CurFilename)
5912 + ":" + utostr((unsigned) llvmAsmlineno) + ": ";
5913 std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading ";
5914 if (yychar == YYEMPTY || yychar == 0)
5915 errMsg += "end-of-file.";
5916 else
5917 errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'";
Reid Spencer61c83e02006-08-18 08:43:06 +00005918 GenerateError(errMsg);
Reid Spencer68a24bd2005-08-27 18:50:39 +00005919 return 0;
5920}
Reid Spencerb0fcf8f2007-01-17 02:48:45 +00005921